From c5046ca5b33d8f245fe805b92ce8c4e61c5ba065 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 1 Dec 2020 20:07:53 +0000 Subject: [PATCH 001/504] 8246739: InputStream.skipNBytes could be implemented more efficiently Reviewed-by: rriggs, lancea, naoto --- .../share/classes/java/io/InputStream.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/java.base/share/classes/java/io/InputStream.java b/src/java.base/share/classes/java/io/InputStream.java index 9b5b0b09c5192..ec530ad0a853a 100644 --- a/src/java.base/share/classes/java/io/InputStream.java +++ b/src/java.base/share/classes/java/io/InputStream.java @@ -577,13 +577,15 @@ public long skip(long n) throws IOException { * @implSpec * If {@code n} is zero or negative, then no bytes are skipped. * If {@code n} is positive, the default implementation of this method - * invokes {@link #skip(long) skip()} with parameter {@code n}. If the - * return value of {@code skip(n)} is non-negative and less than {@code n}, - * then {@link #read()} is invoked repeatedly until the stream is {@code n} - * bytes beyond its position when this method was invoked or end of stream - * is reached. If the return value of {@code skip(n)} is negative or - * greater than {@code n}, then an {@code IOException} is thrown. Any - * exception thrown by {@code skip()} or {@code read()} will be propagated. + * invokes {@link #skip(long) skip()} repeatedly with its parameter equal + * to the remaining number of bytes to skip until the requested number + * of bytes has been skipped or an error condition occurs. If at any + * point the return value of {@code skip()} is negative or greater than the + * remaining number of bytes to be skipped, then an {@code IOException} is + * thrown. If {@code skip()} ever returns zero, then {@link #read()} is + * invoked to read a single byte, and if it returns {@code -1}, then an + * {@code EOFException} is thrown. Any exception thrown by {@code skip()} + * or {@code read()} will be propagated. * * @param n the number of bytes to be skipped. * @throws EOFException if end of stream is encountered before the @@ -596,20 +598,19 @@ public long skip(long n) throws IOException { * @since 12 */ public void skipNBytes(long n) throws IOException { - if (n > 0) { + while (n > 0) { long ns = skip(n); - if (ns >= 0 && ns < n) { // skipped too few bytes + if (ns > 0 && ns <= n) { // adjust number to skip n -= ns; - // read until requested number skipped or EOS reached - while (n > 0 && read() != -1) { - n--; - } - // if not enough skipped, then EOFE - if (n != 0) { + } else if (ns == 0) { // no bytes skipped + // read one byte to check for EOS + if (read() == -1) { throw new EOFException(); } - } else if (ns != n) { // skipped negative or too many bytes + // one byte read so decrement number to skip + n--; + } else { // skipped negative or too many bytes throw new IOException("Unable to skip exactly"); } } From 29d90b952cfdfb05903fa6932a7930852aaaab5c Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Tue, 1 Dec 2020 21:06:06 +0000 Subject: [PATCH 002/504] 8255968: Confusing error message for inaccessible constructor Reviewed-by: mcimadamore --- .../com/sun/tools/javac/comp/Resolve.java | 42 +++++++++++++++-- .../tools/javac/T8255968/T8255968_1.java | 37 +++++++++++++++ .../tools/javac/T8255968/T8255968_1.out | 2 + .../tools/javac/T8255968/T8255968_10.java | 41 +++++++++++++++++ .../tools/javac/T8255968/T8255968_10.out | 2 + .../tools/javac/T8255968/T8255968_11.java | 41 +++++++++++++++++ .../tools/javac/T8255968/T8255968_11.out | 2 + .../tools/javac/T8255968/T8255968_12.java | 42 +++++++++++++++++ .../tools/javac/T8255968/T8255968_12.out | 2 + .../tools/javac/T8255968/T8255968_13.java | 42 +++++++++++++++++ .../tools/javac/T8255968/T8255968_13.out | 2 + .../tools/javac/T8255968/T8255968_14.java | 43 ++++++++++++++++++ .../tools/javac/T8255968/T8255968_14.out | 2 + .../tools/javac/T8255968/T8255968_15.java | 43 ++++++++++++++++++ .../tools/javac/T8255968/T8255968_15.out | 2 + .../tools/javac/T8255968/T8255968_16.java | 43 ++++++++++++++++++ .../tools/javac/T8255968/T8255968_16.out | 2 + .../tools/javac/T8255968/T8255968_2.java | 37 +++++++++++++++ .../tools/javac/T8255968/T8255968_2.out | 2 + .../tools/javac/T8255968/T8255968_3.java | 38 ++++++++++++++++ .../tools/javac/T8255968/T8255968_3.out | 2 + .../tools/javac/T8255968/T8255968_4.java | 38 ++++++++++++++++ .../tools/javac/T8255968/T8255968_4.out | 2 + .../tools/javac/T8255968/T8255968_5.java | 39 ++++++++++++++++ .../tools/javac/T8255968/T8255968_5.out | 2 + .../tools/javac/T8255968/T8255968_6.java | 39 ++++++++++++++++ .../tools/javac/T8255968/T8255968_6.out | 2 + .../tools/javac/T8255968/T8255968_7.java | 39 ++++++++++++++++ .../tools/javac/T8255968/T8255968_7.out | 2 + .../tools/javac/T8255968/T8255968_8.java | 45 +++++++++++++++++++ .../tools/javac/T8255968/T8255968_9.java | 41 +++++++++++++++++ 31 files changed, 715 insertions(+), 3 deletions(-) create mode 100644 test/langtools/tools/javac/T8255968/T8255968_1.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_1.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_10.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_10.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_11.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_11.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_12.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_12.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_13.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_13.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_14.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_14.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_15.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_15.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_16.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_16.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_2.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_2.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_3.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_3.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_4.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_4.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_5.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_5.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_6.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_6.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_7.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_7.out create mode 100644 test/langtools/tools/javac/T8255968/T8255968_8.java create mode 100644 test/langtools/tools/javac/T8255968/T8255968_9.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 727d2989adf4b..abf883d71062c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -1583,9 +1583,23 @@ Symbol selectBest(Env env, currentResolutionContext.addApplicableCandidate(sym, mt); } catch (InapplicableMethodException ex) { currentResolutionContext.addInapplicableCandidate(sym, ex.getDiagnostic()); + // Currently, an InapplicableMethodException occurs. + // If bestSoFar.kind was ABSENT_MTH, return an InapplicableSymbolError(kind is WRONG_MTH). + // If bestSoFar.kind was HIDDEN(AccessError)/WRONG_MTH/WRONG_MTHS, return an InapplicableSymbolsError(kind is WRONG_MTHS). + // See JDK-8255968 for more information. switch (bestSoFar.kind) { case ABSENT_MTH: return new InapplicableSymbolError(currentResolutionContext); + case HIDDEN: + if (bestSoFar instanceof AccessError) { + // Add the JCDiagnostic of previous AccessError to the currentResolutionContext + // and construct InapplicableSymbolsError. + // Intentionally fallthrough. + currentResolutionContext.addInapplicableCandidate(((AccessError) bestSoFar).sym, + ((AccessError) bestSoFar).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT, null, null, site, null, argtypes, typeargtypes)); + } else { + return bestSoFar; + } case WRONG_MTH: bestSoFar = new InapplicableSymbolsError(currentResolutionContext); default: @@ -1593,9 +1607,31 @@ Symbol selectBest(Env env, } } if (!isAccessible(env, site, sym)) { - return (bestSoFar.kind == ABSENT_MTH) - ? new AccessError(env, site, sym) - : bestSoFar; + AccessError curAccessError = new AccessError(env, site, sym); + JCDiagnostic curDiagnostic = curAccessError.getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT, null, null, site, null, argtypes, typeargtypes); + // Currently, an AccessError occurs. + // If bestSoFar.kind was ABSENT_MTH, return an AccessError(kind is HIDDEN). + // If bestSoFar.kind was HIDDEN(AccessError), WRONG_MTH, WRONG_MTHS, return an InapplicableSymbolsError(kind is WRONG_MTHS). + // See JDK-8255968 for more information. + if (bestSoFar.kind == ABSENT_MTH) { + bestSoFar = curAccessError; + } else if (bestSoFar.kind == WRONG_MTH) { + // Add the JCDiagnostic of current AccessError to the currentResolutionContext + // and construct InapplicableSymbolsError. + currentResolutionContext.addInapplicableCandidate(sym, curDiagnostic); + bestSoFar = new InapplicableSymbolsError(currentResolutionContext); + } else if (bestSoFar.kind == WRONG_MTHS) { + // Add the JCDiagnostic of current AccessError to the currentResolutionContext + currentResolutionContext.addInapplicableCandidate(sym, curDiagnostic); + } else if (bestSoFar.kind == HIDDEN && bestSoFar instanceof AccessError) { + // Add the JCDiagnostics of previous and current AccessError to the currentResolutionContext + // and construct InapplicableSymbolsError. + currentResolutionContext.addInapplicableCandidate(((AccessError) bestSoFar).sym, + ((AccessError) bestSoFar).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT, null, null, site, null, argtypes, typeargtypes)); + currentResolutionContext.addInapplicableCandidate(sym, curDiagnostic); + bestSoFar = new InapplicableSymbolsError(currentResolutionContext); + } + return bestSoFar; } return (bestSoFar.kind.isResolutionError() && bestSoFar.kind != AMBIGUOUS) ? sym diff --git a/test/langtools/tools/javac/T8255968/T8255968_1.java b/test/langtools/tools/javac/T8255968/T8255968_1.java new file mode 100644 index 0000000000000..4c19225c35e25 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_1.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_1.out -XDrawDiagnostics T8255968_1.java + */ + +class T8255968_1 { + T8255968_1_Test c = new T8255968_1_Test(0); +} + +class T8255968_1_Test { + private T8255968_1_Test(int x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_1.out b/test/langtools/tools/javac/T8255968/T8255968_1.out new file mode 100644 index 0000000000000..710b9f3562a68 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_1.out @@ -0,0 +1,2 @@ +T8255968_1.java:32:25: compiler.err.report.access: T8255968_1_Test(int), private, T8255968_1_Test +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_10.java b/test/langtools/tools/javac/T8255968/T8255968_10.java new file mode 100644 index 0000000000000..ea67b9a2bafc2 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_10.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_10.out -XDrawDiagnostics T8255968_10.java + */ + +class T8255968_10 { + T8255968_10_TestMethodReference c = T8255968_10_Test::new; +} + +interface T8255968_10_TestMethodReference { + T8255968_10_Test create(int x); +} + +class T8255968_10_Test { + private T8255968_10_Test(int x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_10.out b/test/langtools/tools/javac/T8255968/T8255968_10.out new file mode 100644 index 0000000000000..45485766e4426 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_10.out @@ -0,0 +1,2 @@ +T8255968_10.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.report.access: T8255968_10_Test(int), private, T8255968_10_Test)) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_11.java b/test/langtools/tools/javac/T8255968/T8255968_11.java new file mode 100644 index 0000000000000..bec6e6e7a7f84 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_11.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_11.out -XDrawDiagnostics T8255968_11.java + */ + +class T8255968_11 { + T8255968_11_TestMethodReference c = T8255968_11_Test::new; +} + +interface T8255968_11_TestMethodReference { + T8255968_11_Test create(int x); +} + +class T8255968_11_Test { + T8255968_11_Test(String x) {} // If this method is private, compiler will output the same error message. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_11.out b/test/langtools/tools/javac/T8255968/T8255968_11.out new file mode 100644 index 0000000000000..63b1546402aeb --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_11.out @@ -0,0 +1,2 @@ +T8255968_11.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, T8255968_11_Test, java.lang.String, int, kindname.class, T8255968_11_Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_12.java b/test/langtools/tools/javac/T8255968/T8255968_12.java new file mode 100644 index 0000000000000..f58181617c72d --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_12.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_12.out -XDrawDiagnostics T8255968_12.java + */ + +class T8255968_12 { + T8255968_12_TestMethodReference c = T8255968_12_Test::new; +} + +interface T8255968_12_TestMethodReference { + T8255968_12_Test create(int x); +} + +class T8255968_12_Test { + private T8255968_12_Test(int x) {} // This method is not at the end. + T8255968_12_Test(String x) {} // If this method is private, compiler will output the same error message. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_12.out b/test/langtools/tools/javac/T8255968/T8255968_12.out new file mode 100644 index 0000000000000..5d9205c15ce0f --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_12.out @@ -0,0 +1,2 @@ +T8255968_12.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_12_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_12_Test, T8255968_12_Test(int), (compiler.misc.report.access: T8255968_12_Test(int), private, T8255968_12_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_12_Test, T8255968_12_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))})) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_13.java b/test/langtools/tools/javac/T8255968/T8255968_13.java new file mode 100644 index 0000000000000..a1a0005f3e754 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_13.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_13.out -XDrawDiagnostics T8255968_13.java + */ + +class T8255968_13 { + T8255968_13_TestMethodReference c = T8255968_13_Test::new; +} + +interface T8255968_13_TestMethodReference { + T8255968_13_Test create(int x); +} + +class T8255968_13_Test { + T8255968_13_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_13_Test(int x) {} // This method is at the end. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_13.out b/test/langtools/tools/javac/T8255968/T8255968_13.out new file mode 100644 index 0000000000000..316c5a9a981e8 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_13.out @@ -0,0 +1,2 @@ +T8255968_13.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_13_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_13_Test, T8255968_13_Test(int), (compiler.misc.report.access: T8255968_13_Test(int), private, T8255968_13_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_13_Test, T8255968_13_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))})) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_14.java b/test/langtools/tools/javac/T8255968/T8255968_14.java new file mode 100644 index 0000000000000..f80c84cb8cb94 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_14.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_14.out -XDrawDiagnostics T8255968_14.java + */ + +class T8255968_14 { + T8255968_14_TestMethodReference c = T8255968_14_Test::new; +} + +interface T8255968_14_TestMethodReference { + T8255968_14_Test create(int x); +} + +class T8255968_14_Test { + private T8255968_14_Test(int x) {} // This method is not at the end. + T8255968_14_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_14_Test(int[] x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_14.out b/test/langtools/tools/javac/T8255968/T8255968_14.out new file mode 100644 index 0000000000000..8df0f90875d8c --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_14.out @@ -0,0 +1,2 @@ +T8255968_14.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_14_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(int), (compiler.misc.report.access: T8255968_14_Test(int), private, T8255968_14_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_14_Test, T8255968_14_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))})) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_15.java b/test/langtools/tools/javac/T8255968/T8255968_15.java new file mode 100644 index 0000000000000..49f900381ef39 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_15.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_15.out -XDrawDiagnostics T8255968_15.java + */ + +class T8255968_15 { + T8255968_15_TestMethodReference c = T8255968_15_Test::new; +} + +interface T8255968_15_TestMethodReference { + T8255968_15_Test create(int x); +} + +class T8255968_15_Test { + T8255968_15_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_15_Test(int x) {} // This method is not at the end. + private T8255968_15_Test(int[] x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_15.out b/test/langtools/tools/javac/T8255968/T8255968_15.out new file mode 100644 index 0000000000000..cf9e7cd8af7f8 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_15.out @@ -0,0 +1,2 @@ +T8255968_15.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_15_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(int), (compiler.misc.report.access: T8255968_15_Test(int), private, T8255968_15_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_15_Test, T8255968_15_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))})) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_16.java b/test/langtools/tools/javac/T8255968/T8255968_16.java new file mode 100644 index 0000000000000..9638338897052 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_16.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_16.out -XDrawDiagnostics T8255968_16.java + */ + +class T8255968_16 { + T8255968_16_TestMethodReference c = T8255968_16_Test::new; +} + +interface T8255968_16_TestMethodReference { + T8255968_16_Test create(int x); +} + +class T8255968_16_Test { + T8255968_16_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_16_Test(int[] x) {} + private T8255968_16_Test(int x) {} // This method is at the end. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_16.out b/test/langtools/tools/javac/T8255968/T8255968_16.out new file mode 100644 index 0000000000000..790dac8e8a3dd --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_16.out @@ -0,0 +1,2 @@ +T8255968_16.java:32:41: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbols: kindname.constructor, T8255968_16_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_16_Test, T8255968_16_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_16_Test, T8255968_16_Test(int), (compiler.misc.report.access: T8255968_16_Test(int), private, T8255968_16_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_16_Test, T8255968_16_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))})) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_2.java b/test/langtools/tools/javac/T8255968/T8255968_2.java new file mode 100644 index 0000000000000..01fe34801134a --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_2.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_2.out -XDrawDiagnostics T8255968_2.java + */ + +class T8255968_2 { + T8255968_2_Test c = new T8255968_2_Test(0); +} + +class T8255968_2_Test { + T8255968_2_Test(String x) {} // If this method is private, compiler will output the same error message. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_2.out b/test/langtools/tools/javac/T8255968/T8255968_2.out new file mode 100644 index 0000000000000..41b878a781173 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_2.out @@ -0,0 +1,2 @@ +T8255968_2.java:32:25: compiler.err.cant.apply.symbol: kindname.constructor, T8255968_2_Test, java.lang.String, int, kindname.class, T8255968_2_Test, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)) +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_3.java b/test/langtools/tools/javac/T8255968/T8255968_3.java new file mode 100644 index 0000000000000..0125995a5f1ff --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_3.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_3.out -XDrawDiagnostics T8255968_3.java + */ + +class T8255968_3 { + T8255968_3_Test c = new T8255968_3_Test(0); +} + +class T8255968_3_Test { + private T8255968_3_Test(int x) {} // This method is not at the end. + T8255968_3_Test(String x) {} // If this method is private, compiler will output the same error message. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_3.out b/test/langtools/tools/javac/T8255968/T8255968_3.out new file mode 100644 index 0000000000000..55d6efad3a4f1 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_3.out @@ -0,0 +1,2 @@ +T8255968_3.java:32:25: compiler.err.cant.apply.symbols: kindname.constructor, T8255968_3_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_3_Test, T8255968_3_Test(int), (compiler.misc.report.access: T8255968_3_Test(int), private, T8255968_3_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_3_Test, T8255968_3_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))} +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_4.java b/test/langtools/tools/javac/T8255968/T8255968_4.java new file mode 100644 index 0000000000000..57e4f5110605c --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_4.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_4.out -XDrawDiagnostics T8255968_4.java + */ + +class T8255968_4 { + T8255968_4_Test c = new T8255968_4_Test(0); +} + +class T8255968_4_Test { + T8255968_4_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_4_Test(int x) {} // This method is at the end. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_4.out b/test/langtools/tools/javac/T8255968/T8255968_4.out new file mode 100644 index 0000000000000..d038fbfbae808 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_4.out @@ -0,0 +1,2 @@ +T8255968_4.java:32:25: compiler.err.cant.apply.symbols: kindname.constructor, T8255968_4_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_4_Test, T8255968_4_Test(int), (compiler.misc.report.access: T8255968_4_Test(int), private, T8255968_4_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_4_Test, T8255968_4_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))} +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_5.java b/test/langtools/tools/javac/T8255968/T8255968_5.java new file mode 100644 index 0000000000000..1b42ac840803a --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_5.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_5.out -XDrawDiagnostics T8255968_5.java + */ + +class T8255968_5 { + T8255968_5_Test c = new T8255968_5_Test(0); +} + +class T8255968_5_Test { + private T8255968_5_Test(int x) {} // This method is not at the end. + T8255968_5_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_5_Test(int[] x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_5.out b/test/langtools/tools/javac/T8255968/T8255968_5.out new file mode 100644 index 0000000000000..a74a2d0629d98 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_5.out @@ -0,0 +1,2 @@ +T8255968_5.java:32:25: compiler.err.cant.apply.symbols: kindname.constructor, T8255968_5_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_5_Test, T8255968_5_Test(int), (compiler.misc.report.access: T8255968_5_Test(int), private, T8255968_5_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_5_Test, T8255968_5_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_5_Test, T8255968_5_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))} +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_6.java b/test/langtools/tools/javac/T8255968/T8255968_6.java new file mode 100644 index 0000000000000..fda79dc969388 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_6.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_6.out -XDrawDiagnostics T8255968_6.java + */ + +class T8255968_6 { + T8255968_6_Test c = new T8255968_6_Test(0); +} + +class T8255968_6_Test { + T8255968_6_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_6_Test(int x) {} // This method is not at the end. + private T8255968_6_Test(int[] x) {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_6.out b/test/langtools/tools/javac/T8255968/T8255968_6.out new file mode 100644 index 0000000000000..c10d2807aa256 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_6.out @@ -0,0 +1,2 @@ +T8255968_6.java:32:25: compiler.err.cant.apply.symbols: kindname.constructor, T8255968_6_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_6_Test, T8255968_6_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_6_Test, T8255968_6_Test(int), (compiler.misc.report.access: T8255968_6_Test(int), private, T8255968_6_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_6_Test, T8255968_6_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))} +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_7.java b/test/langtools/tools/javac/T8255968/T8255968_7.java new file mode 100644 index 0000000000000..be8802fb749c2 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_7.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile/fail/ref=T8255968_7.out -XDrawDiagnostics T8255968_7.java + */ + +class T8255968_7 { + T8255968_7_Test c = new T8255968_7_Test(0); +} + +class T8255968_7_Test { + T8255968_7_Test(String x) {} // If this method is private, compiler will output the same error message. + private T8255968_7_Test(int[] x) {} + private T8255968_7_Test(int x) {} // This method is at the end. +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_7.out b/test/langtools/tools/javac/T8255968/T8255968_7.out new file mode 100644 index 0000000000000..41c9873c5927e --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_7.out @@ -0,0 +1,2 @@ +T8255968_7.java:32:25: compiler.err.cant.apply.symbols: kindname.constructor, T8255968_7_Test, int,{(compiler.misc.inapplicable.method: kindname.constructor, T8255968_7_Test, T8255968_7_Test(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_7_Test, T8255968_7_Test(int), (compiler.misc.report.access: T8255968_7_Test(int), private, T8255968_7_Test)),(compiler.misc.inapplicable.method: kindname.constructor, T8255968_7_Test, T8255968_7_Test(int[]), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[])))} +1 error diff --git a/test/langtools/tools/javac/T8255968/T8255968_8.java b/test/langtools/tools/javac/T8255968/T8255968_8.java new file mode 100644 index 0000000000000..9471ae8285923 --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_8.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile -XDrawDiagnostics T8255968_8.java + */ + +class T8255968_8_Outer { + void m() {} + void m(String s) {} + + class T8255968_8_Inner extends T8255968_8_Sup { + void test() { + m(); + } + } +} + +class T8255968_8_Sup { + private void m(String s) {} + private void m() {} +} diff --git a/test/langtools/tools/javac/T8255968/T8255968_9.java b/test/langtools/tools/javac/T8255968/T8255968_9.java new file mode 100644 index 0000000000000..7fe1eccf6d02c --- /dev/null +++ b/test/langtools/tools/javac/T8255968/T8255968_9.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, 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 8255968 + * @summary Confusing error message for inaccessible constructor + * @run compile -XDrawDiagnostics T8255968_9.java + */ + +class T8255968_9 { + T8255968_9_TestMethodReference c = T8255968_9_Test::new; +} + +interface T8255968_9_TestMethodReference { + T8255968_9_Test create(int x); +} + +class T8255968_9_Test { + T8255968_9_Test(int x) {} +} From 015e6e58c51e489b3ba0221abe2de966bf05e0de Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Tue, 1 Dec 2020 21:08:45 +0000 Subject: [PATCH 003/504] 8257460: Further CompilerOracle cleanup Reviewed-by: kvn, redestad, thartmann --- .../share/compiler/compilerDirectives.cpp | 2 +- src/hotspot/share/compiler/compilerOracle.cpp | 80 +++++++++---------- src/hotspot/share/compiler/compilerOracle.hpp | 6 +- src/hotspot/share/prims/whitebox.cpp | 5 +- 4 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/hotspot/share/compiler/compilerDirectives.cpp b/src/hotspot/share/compiler/compilerDirectives.cpp index ddef13ac6c541..830d63a94b501 100644 --- a/src/hotspot/share/compiler/compilerDirectives.cpp +++ b/src/hotspot/share/compiler/compilerDirectives.cpp @@ -359,7 +359,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle } // inline and dontinline (including exclude) are implemented in the directiveset accessors -#define init_default_cc(name, type, dvalue, cc_flag) { type v; if (!_modified[name##Index] && CompilerOracle::has_option_value(method, CompileCommand::cc_flag, v) && v != this->name##Option) { set.cloned()->name##Option = v; } } +#define init_default_cc(name, type, dvalue, cc_flag) { type v; if (!_modified[name##Index] && CompileCommand::cc_flag != CompileCommand::Unknown && CompilerOracle::has_option_value(method, CompileCommand::cc_flag, v) && v != this->name##Option) { set.cloned()->name##Option = v; } } compilerdirectives_common_flags(init_default_cc) compilerdirectives_c2_flags(init_default_cc) compilerdirectives_c1_flags(init_default_cc) diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 878b65921709d..193c791df7457 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -104,7 +104,6 @@ class TypedMethodOptionMatcher : public MethodMatcher { private: TypedMethodOptionMatcher* _next; enum CompileCommand _option; - OptionType _type; public: union { @@ -117,18 +116,16 @@ class TypedMethodOptionMatcher : public MethodMatcher { TypedMethodOptionMatcher() : MethodMatcher(), _next(NULL), - _option(CompileCommand::Unknown), - _type(OptionType::Unknown) { + _option(CompileCommand::Unknown) { memset(&_u, 0, sizeof(_u)); } ~TypedMethodOptionMatcher(); static TypedMethodOptionMatcher* parse_method_pattern(char*& line, char* errorbuf, const int buf_size); - TypedMethodOptionMatcher* match(const methodHandle &method, enum CompileCommand option, OptionType type); + TypedMethodOptionMatcher* match(const methodHandle &method, enum CompileCommand option); - void init(enum CompileCommand option, OptionType type, TypedMethodOptionMatcher* next) { + void init(enum CompileCommand option, TypedMethodOptionMatcher* next) { _next = next; - _type = type; _option = option; } @@ -140,7 +137,6 @@ class TypedMethodOptionMatcher : public MethodMatcher { void set_next(TypedMethodOptionMatcher* next) {_next = next; } TypedMethodOptionMatcher* next() { return _next; } - OptionType type() { return _type; } enum CompileCommand option() { return _option; } template T value(); template void set_value(T value); @@ -194,8 +190,9 @@ void TypedMethodOptionMatcher::print() { ttyLocker ttyl; print_base(tty); const char* name = option2name(_option); - switch (_type) { - case OptionType::Intx: + enum OptionType type = option2type(_option); + switch (type) { + case OptionType::Intx: tty->print_cr(" intx %s = " INTX_FORMAT, name, value()); break; case OptionType::Uintx: @@ -208,6 +205,7 @@ void TypedMethodOptionMatcher::print() { tty->print_cr(" double %s = %f", name, value()); break; case OptionType::Ccstr: + case OptionType::Ccstrlist: tty->print_cr(" const char* %s = '%s'", name, value()); break; default: @@ -244,7 +242,8 @@ TypedMethodOptionMatcher* TypedMethodOptionMatcher::clone() { } TypedMethodOptionMatcher::~TypedMethodOptionMatcher() { - if (type() == OptionType::Ccstr) { + enum OptionType type = option2type(_option); + if (type == OptionType::Ccstr || type == OptionType::Ccstrlist) { ccstr v = value(); os::free((void*)v); } @@ -263,7 +262,7 @@ TypedMethodOptionMatcher* TypedMethodOptionMatcher::parse_method_pattern(char*& return tom; } -TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(const methodHandle& method, enum CompileCommand option, OptionType type) { +TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(const methodHandle& method, enum CompileCommand option) { TypedMethodOptionMatcher* current = this; while (current != NULL) { if (current->_option == option) { @@ -285,12 +284,9 @@ static void register_command(TypedMethodOptionMatcher* matcher, tty->print_cr("Warning: +LogCompilation must be enabled in order for individual methods to be logged with "); tty->print_cr(" CompileCommand=log,"); } - enum OptionType type = option2type(option); - if (type == OptionType::Ccstrlist) { - type = OptionType::Ccstr; // ccstrlists are stores as ccstr - } - assert(type == get_type_for(), "sanity"); - matcher->init(option, type, option_list); + assert(CompilerOracle::option_matches_type(option, value), "Value must match option type"); + + matcher->init(option, option_list); matcher->set_value(value); option_list = matcher; if ((option != CompileCommand::DontInline) && @@ -308,26 +304,10 @@ static void register_command(TypedMethodOptionMatcher* matcher, } template -bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, T& value, bool verify_type) { - enum OptionType type = option2type(option); - if (type == OptionType::Unknown) { - return false; // Can't query options with type Unknown. - } - if (type == OptionType::Ccstrlist) { - type = OptionType::Ccstr; // CCstrList type options are stored as Ccstr - } - if (verify_type) { - if (type != get_type_for()) { - // Whitebox API expects false if option and type doesn't match - return false; - } - } else { - assert(type == get_type_for(), "Value type (%s) must match option %s (%s)", - optiontype2name(get_type_for()), - option2name(option), optiontype2name(option2type(option))); - } +bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, T& value) { + assert(option_matches_type(option, value), "Value must match option type"); if (option_list != NULL) { - TypedMethodOptionMatcher* m = option_list->match(method, option, type); + TypedMethodOptionMatcher* m = option_list->match(method, option); if (m != NULL) { value = m->value(); return true; @@ -361,11 +341,29 @@ bool CompilerOracle::has_any_command_set() { } // Explicit instantiation for all OptionTypes supported. -template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, intx& value, bool verify_type); -template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, uintx& value, bool verify_type); -template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, bool& value, bool verify_type); -template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, ccstr& value, bool verify_type); -template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, double& value, bool verify_type); +template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, intx& value); +template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, uintx& value); +template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, bool& value); +template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, ccstr& value); +template bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCommand option, double& value); + +template +bool CompilerOracle::option_matches_type(enum CompileCommand option, T& value) { + enum OptionType option_type = option2type(option); + if (option_type == OptionType::Unknown) { + return false; // Can't query options with type Unknown. + } + if (option_type == OptionType::Ccstrlist) { + option_type = OptionType::Ccstr; // CCstrList type options are stored as Ccstr + } + return (get_type_for() == option_type); +} + +template bool CompilerOracle::option_matches_type(enum CompileCommand option, intx& value); +template bool CompilerOracle::option_matches_type(enum CompileCommand option, uintx& value); +template bool CompilerOracle::option_matches_type(enum CompileCommand option, bool& value); +template bool CompilerOracle::option_matches_type(enum CompileCommand option, ccstr& value); +template bool CompilerOracle::option_matches_type(enum CompileCommand option, double& value); bool CompilerOracle::has_option(const methodHandle& method, enum CompileCommand option) { bool value = false; diff --git a/src/hotspot/share/compiler/compilerOracle.hpp b/src/hotspot/share/compiler/compilerOracle.hpp index e834254f50686..e8f7c2097a420 100644 --- a/src/hotspot/share/compiler/compilerOracle.hpp +++ b/src/hotspot/share/compiler/compilerOracle.hpp @@ -149,7 +149,11 @@ class CompilerOracle : AllStatic { // Check if method has option and value set. If yes, overwrite value and return true, // otherwise leave value unchanged and return false. template - static bool has_option_value(const methodHandle& method, enum CompileCommand option, T& value, bool verfiy_type = false); + static bool has_option_value(const methodHandle& method, enum CompileCommand option, T& value); + + // This check is currently only needed by whitebox API + template + static bool option_matches_type(enum CompileCommand option, T& value); // Reads from string instead of file static void parse_from_string(const char* option_string, void (*parser)(char*)); diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 7e780990401df..28a5162abd0ac 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -1814,7 +1814,10 @@ static bool GetMethodOption(JavaThread* thread, JNIEnv* env, jobject method, jst if (option == CompileCommand::Unknown) { return false; } - return CompilerOracle::has_option_value(mh, option, *value, true /* verify type*/); + if (!CompilerOracle::option_matches_type(option, *value)) { + return false; + } + return CompilerOracle::has_option_value(mh, option, *value); } WB_ENTRY(jobject, WB_GetMethodBooleaneOption(JNIEnv* env, jobject wb, jobject method, jstring name)) From 00e79db89e10fac71a8ae4b60b2ef23c0deff032 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Tue, 1 Dec 2020 22:50:05 +0000 Subject: [PATCH 004/504] 8257511: JDK-8254082 brings regression to AbstractStringBuilder.insert(int dstOffset, CharSequence s, int start, int end) Reviewed-by: alanb, rriggs, bpb --- .../java/lang/AbstractStringBuilder.java | 2 +- test/jdk/java/lang/StringBuilder/Insert.java | 32 ++++++++++++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java index 49bf751c2e854..dc1afeaa10a79 100644 --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java @@ -1717,7 +1717,7 @@ private void putStringAt(int index, String str, int off, int end) { if (getCoder() != str.coder()) { inflate(); } - str.getBytes(value, off, index, coder, end); + str.getBytes(value, off, index, coder, end - off); } private void putStringAt(int index, String str) { diff --git a/test/jdk/java/lang/StringBuilder/Insert.java b/test/jdk/java/lang/StringBuilder/Insert.java index 2922c803f6463..d4b1ef28d866f 100644 --- a/test/jdk/java/lang/StringBuilder/Insert.java +++ b/test/jdk/java/lang/StringBuilder/Insert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -21,15 +21,31 @@ * questions. */ +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + /** * @test - * @bug 4914802 - * @summary Test Insert method for infinite loop + * @run testng Insert + * @bug 4914802 8257511 + * @summary Test StringBuilder.insert sanity tests */ - +@Test public class Insert { - public static void main (String argv[]) throws Exception { - StringBuilder sb = new StringBuilder(); - sb.insert(0, false); - } + + public void insertFalse() { + // Caused an infinite loop before 4914802 + StringBuilder sb = new StringBuilder(); + assertEquals("false", sb.insert(0, false).toString()); + } + + public void insertOffset() { + // 8254082 made the String variant cause an AIOOBE, fixed in 8257511 + assertEquals("efabc", new StringBuilder("abc").insert(0, "def", 1, 3).toString()); + assertEquals("efabc", new StringBuilder("abc").insert(0, new StringBuilder("def"), 1, 3).toString()); + // insert(I[CII) and insert(ILjava/lang/CharSequence;II) are inconsistently specified + assertEquals("efabc", new StringBuilder("abc").insert(0, new char[] {'d', 'e', 'f'}, 1, 2).toString()); + } + } From 927504e8270b4ea44c10d7faf0959b107281ddfe Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 1 Dec 2020 23:10:39 +0000 Subject: [PATCH 005/504] 8256474: Migrate Mutex _owner accesses to use Atomic operations Reviewed-by: coleenp, kbarrett --- src/hotspot/share/runtime/mutex.cpp | 24 ++++++++++++------------ src/hotspot/share/runtime/mutex.hpp | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/hotspot/share/runtime/mutex.cpp b/src/hotspot/share/runtime/mutex.cpp index 220b0b58ce9d5..fa969bb20e85c 100644 --- a/src/hotspot/share/runtime/mutex.cpp +++ b/src/hotspot/share/runtime/mutex.cpp @@ -100,7 +100,7 @@ void Mutex::lock_contended(Thread* self) { } void Mutex::lock(Thread* self) { - assert(_owner != self, "invariant"); + assert(owner() != self, "invariant"); check_safepoint_state(self); check_rank(self); @@ -125,7 +125,7 @@ void Mutex::lock() { // in the wrong way this can lead to a deadlock with the safepoint code. void Mutex::lock_without_safepoint_check(Thread * self) { - assert(_owner != self, "invariant"); + assert(owner() != self, "invariant"); check_no_safepoint_state(self); check_rank(self); @@ -145,7 +145,7 @@ bool Mutex::try_lock_inner(bool do_rank_checks) { Thread * const self = Thread::current(); // Checking the owner hides the potential difference in recursive locking behaviour // on some platforms. - if (_owner == self) { + if (owner() == self) { return false; } @@ -308,13 +308,13 @@ Monitor::Monitor(int Rank, const char * name, bool allow_vm_block, Mutex(Rank, name, allow_vm_block, safepoint_check_required) {} bool Mutex::owned_by_self() const { - return _owner == Thread::current(); + return owner() == Thread::current(); } void Mutex::print_on_error(outputStream* st) const { st->print("[" PTR_FORMAT, p2i(this)); st->print("] %s", _name); - st->print(" - owner thread: " PTR_FORMAT, p2i(_owner)); + st->print(" - owner thread: " PTR_FORMAT, p2i(owner())); } // ---------------------------------------------------------------------------------- @@ -332,7 +332,7 @@ const char* print_safepoint_check(Mutex::SafepointCheckRequired safepoint_check) void Mutex::print_on(outputStream* st) const { st->print("Mutex: [" PTR_FORMAT "] %s - owner: " PTR_FORMAT, - p2i(this), _name, p2i(_owner)); + p2i(this), _name, p2i(owner())); if (_allow_vm_block) { st->print("%s", " allow_vm_block"); } @@ -350,9 +350,9 @@ void Mutex::assert_owner(Thread * expected) { else if (expected == Thread::current()) { msg = "should be owned by current thread"; } - assert(_owner == expected, + assert(owner() == expected, "%s: owner=" INTPTR_FORMAT ", should be=" INTPTR_FORMAT, - msg, p2i(_owner), p2i(expected)); + msg, p2i(owner()), p2i(expected)); } Mutex* Mutex::get_least_ranked_lock(Mutex* locks) { @@ -469,8 +469,8 @@ void Mutex::set_owner_implementation(Thread *new_owner) { // the thread is acquiring this lock assert(new_owner == Thread::current(), "Should I be doing this?"); - assert(_owner == NULL, "setting the owner thread of an already owned mutex"); - _owner = new_owner; // set the owner + assert(owner() == NULL, "setting the owner thread of an already owned mutex"); + raw_set_owner(new_owner); // set the owner // link "this" into the owned locks list this->_next = new_owner->_owned_locks; @@ -482,14 +482,14 @@ void Mutex::set_owner_implementation(Thread *new_owner) { } else { // the thread is releasing this lock - Thread* old_owner = _owner; + Thread* old_owner = owner(); _last_owner = old_owner; _skip_rank_check = false; assert(old_owner != NULL, "removing the owner thread of an unowned mutex"); assert(old_owner == Thread::current(), "removing the owner thread of an unowned mutex"); - _owner = NULL; // set the owner + raw_set_owner(NULL); // set the owner Mutex* locks = old_owner->owned_locks(); diff --git a/src/hotspot/share/runtime/mutex.hpp b/src/hotspot/share/runtime/mutex.hpp index fea8c8ecda6b0..06bf999be3462 100644 --- a/src/hotspot/share/runtime/mutex.hpp +++ b/src/hotspot/share/runtime/mutex.hpp @@ -26,6 +26,7 @@ #define SHARE_RUNTIME_MUTEX_HPP #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" // A Mutex/Monitor is a simple wrapper around a native lock plus condition @@ -81,8 +82,14 @@ class Mutex : public CHeapObj { native = max_nonleaf + 1 }; + private: + // The _owner field is only set by the current thread, either to itself after it has acquired + // the low-level _lock, or to NULL before it has released the _lock. Accesses by any thread other + // than the lock owner are inherently racy. + Thread* volatile _owner; + void raw_set_owner(Thread* new_owner) { Atomic::store(&_owner, new_owner); } + protected: // Monitor-Mutex metadata - Thread * volatile _owner; // The owner of the lock os::PlatformMonitor _lock; // Native monitor implementation char _name[MUTEX_NAME_LEN]; // Name of mutex/monitor @@ -111,7 +118,7 @@ class Mutex : public CHeapObj { #endif // ASSERT protected: - void set_owner_implementation(Thread* owner) NOT_DEBUG({ _owner = owner;}); + void set_owner_implementation(Thread* owner) NOT_DEBUG({ raw_set_owner(owner);}); void check_block_state (Thread* thread) NOT_DEBUG_RETURN; void check_safepoint_state (Thread* thread) NOT_DEBUG_RETURN; void check_no_safepoint_state(Thread* thread) NOT_DEBUG_RETURN; @@ -180,7 +187,7 @@ class Mutex : public CHeapObj { void lock(); // prints out warning if VM thread blocks void lock(Thread *thread); // overloaded with current thread void unlock(); - bool is_locked() const { return _owner != NULL; } + bool is_locked() const { return owner() != NULL; } bool try_lock(); // Like lock(), but unblocking. It returns false instead private: @@ -197,9 +204,9 @@ class Mutex : public CHeapObj { // A thread should not call this if failure to acquire ownership will blocks its progress bool try_lock_without_rank_check(); - // Current owner - not not MT-safe. Can only be used to guarantee that + // Current owner - note not MT-safe. Can only be used to guarantee that // the current running thread owns the lock - Thread* owner() const { return _owner; } + Thread* owner() const { return Atomic::load(&_owner); } void set_owner(Thread* owner) { set_owner_implementation(owner); } bool owned_by_self() const; From ce496cbda508bc648741d7da9785dce93a7a5f26 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Tue, 1 Dec 2020 23:50:53 +0000 Subject: [PATCH 006/504] 8257190: simplify PhaseIdealLoop constructors Currently, C2 has 3 private constructors of PhaseIdealLoop as follows. a-b are for verification. only c is for real loop optimizations. a. PhaseIdealLoop( PhaseIterGVN &igvn) b. PhaseIdealLoop(PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) c. PhaseIdealLoop(PhaseIterGVN &igvn, LoopOptsMode mode) I propose 3 changes to simplify them. 1. add assertion in the constructor c. C2 shouldn't use mode = LoopOptsVerify for it. 2. merge a and b into one constructor. 3. make the merged verification ctor only for debug builds. Reviewed-by: thartmann, kvn --- src/hotspot/share/opto/loopnode.hpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 59160a0927c80..075073add2ef0 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1045,17 +1045,6 @@ class PhaseIdealLoop : public PhaseTransform { uint *_dom_depth; // Used for fast LCA test GrowableArray* _dom_stk; // For recomputation of dom depth - // Perform verification that the graph is valid. - PhaseIdealLoop( PhaseIterGVN &igvn) : - PhaseTransform(Ideal_Loop), - _igvn(igvn), - _verify_me(NULL), - _verify_only(true), - _dom_lca_tags(arena()), // Thread::resource_area - _nodes_required(UINT_MAX) { - build_and_optimize(LoopOptsVerify); - } - // build the loop tree and perform any requested optimizations void build_and_optimize(LoopOptsMode mode); @@ -1063,26 +1052,30 @@ class PhaseIdealLoop : public PhaseTransform { void Dominators(); // Compute the Ideal Node to Loop mapping - PhaseIdealLoop(PhaseIterGVN &igvn, LoopOptsMode mode) : + PhaseIdealLoop(PhaseIterGVN& igvn, LoopOptsMode mode) : PhaseTransform(Ideal_Loop), _igvn(igvn), - _verify_me(NULL), + _verify_me(nullptr), _verify_only(false), _dom_lca_tags(arena()), // Thread::resource_area _nodes_required(UINT_MAX) { + assert(mode != LoopOptsVerify, "wrong constructor to verify IdealLoop"); build_and_optimize(mode); } - // Verify that verify_me made the same decisions as a fresh run. - PhaseIdealLoop(PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) : +#ifndef PRODUCT + // Verify that verify_me made the same decisions as a fresh run + // or only verify that the graph is valid if verify_me is null. + PhaseIdealLoop(PhaseIterGVN& igvn, const PhaseIdealLoop* verify_me = nullptr) : PhaseTransform(Ideal_Loop), _igvn(igvn), _verify_me(verify_me), - _verify_only(false), + _verify_only(verify_me == nullptr), _dom_lca_tags(arena()), // Thread::resource_area _nodes_required(UINT_MAX) { build_and_optimize(LoopOptsVerify); } +#endif public: Node* idom_no_update(Node* d) const { From 03f3b8eadd89f33a027b59c68c4af5f40b0b65ff Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 2 Dec 2020 00:04:20 +0000 Subject: [PATCH 007/504] 8210253: Clipped UI rendering with X11 pipeline and HiDPI Reviewed-by: aivanov, kizune --- .../sun/java2d/x11/X11SurfaceData.java | 77 ++++++++++++------- .../sun/java2d/x11/X11SurfaceDataProxy.java | 12 ++- .../java2d/x11/X11VolatileSurfaceManager.java | 6 +- 3 files changed, 60 insertions(+), 35 deletions(-) diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java index a4b995fae4a68..f96297b1019d6 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2020, 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,28 +25,24 @@ package sun.java2d.x11; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Color; import java.awt.Composite; -import java.awt.Rectangle; import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.Image; -import java.awt.color.ColorSpace; +import java.awt.Rectangle; import java.awt.Transparency; -import java.awt.image.BufferedImage; +import java.awt.color.ColorSpace; import java.awt.image.ColorModel; import java.awt.image.ComponentColorModel; import java.awt.image.DirectColorModel; import java.awt.image.IndexColorModel; import java.awt.image.Raster; -import java.awt.peer.ComponentPeer; import sun.awt.SunHints; import sun.awt.SunToolkit; import sun.awt.X11ComponentPeer; import sun.awt.X11GraphicsConfig; -import sun.awt.X11GraphicsEnvironment; import sun.awt.image.PixelConverter; import sun.font.X11TextRenderer; import sun.java2d.InvalidPipeException; @@ -54,16 +50,15 @@ import sun.java2d.SunGraphicsEnvironment; import sun.java2d.SurfaceData; import sun.java2d.SurfaceDataProxy; -import sun.java2d.loops.SurfaceType; import sun.java2d.loops.CompositeType; -import sun.java2d.loops.RenderLoops; import sun.java2d.loops.GraphicsPrimitive; +import sun.java2d.loops.RenderLoops; +import sun.java2d.loops.SurfaceType; import sun.java2d.loops.XORComposite; -import sun.java2d.loops.Blit; -import sun.java2d.pipe.ValidatePipe; import sun.java2d.pipe.PixelToShapeConverter; -import sun.java2d.pipe.TextPipe; import sun.java2d.pipe.Region; +import sun.java2d.pipe.TextPipe; +import sun.java2d.pipe.ValidatePipe; public abstract class X11SurfaceData extends XSurfaceData { X11ComponentPeer peer; @@ -411,11 +406,12 @@ public static X11PixmapSurfaceData createData(X11GraphicsConfig gc, int width, int height, ColorModel cm, Image image, long drawable, - int transparency) + int transparency, + boolean isTexture) { return new X11PixmapSurfaceData(gc, width, height, image, getSurfaceType(gc, transparency, true), - cm, drawable, transparency); + cm, drawable, transparency, isTexture); } // /** @@ -699,11 +695,15 @@ public synchronized void makePipes() { } } - public static class X11WindowSurfaceData extends X11SurfaceData { + private final static class X11WindowSurfaceData extends X11SurfaceData { + + private final int scale; + public X11WindowSurfaceData(X11ComponentPeer peer, X11GraphicsConfig gc, SurfaceType sType) { super(peer, gc, sType, peer.getColorModel()); + this.scale = gc.getDevice().getScaleFactor(); if (isDrawableValid()) { makePipes(); } @@ -716,6 +716,8 @@ public SurfaceData getReplacement() { public Rectangle getBounds() { Rectangle r = peer.getBounds(); r.x = r.y = 0; + r.width *= scale; + r.height *= scale; return r; } @@ -730,27 +732,40 @@ public boolean canSourceSendExposures(int x, int y, int w, int h) { public Object getDestination() { return peer.getTarget(); } + + @Override + public double getDefaultScaleX() { + return scale; + } + + @Override + public double getDefaultScaleY() { + return scale; + } } - public static class X11PixmapSurfaceData extends X11SurfaceData { + private final static class X11PixmapSurfaceData extends X11SurfaceData { - Image offscreenImage; - int width; - int height; - int transparency; + private final Image offscreenImage; + private final int width; + private final int height; + private final int transparency; + private final int scale; public X11PixmapSurfaceData(X11GraphicsConfig gc, int width, int height, Image image, SurfaceType sType, ColorModel cm, - long drawable, int transparency) + long drawable, int transparency, + boolean isTexture) { super(null, gc, sType, cm); - this.width = width; - this.height = height; + this.scale = isTexture ? 1 : gc.getDevice().getScaleFactor(); + this.width = width * scale; + this.height = height * scale; offscreenImage = image; this.transparency = transparency; - initSurface(depth, width, height, drawable); + initSurface(depth, this.width, this.height, drawable); makePipes(); } @@ -798,6 +813,16 @@ public void flush() { public Object getDestination() { return offscreenImage; } + + @Override + public double getDefaultScaleX() { + return scale; + } + + @Override + public double getDefaultScaleY() { + return scale; + } } private static LazyPipe lazypipe = new LazyPipe(); diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java index 6f21c01daeb82..e55c663181f08 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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,18 +26,15 @@ package sun.java2d.x11; import java.awt.Color; -import java.awt.AlphaComposite; -import java.awt.GraphicsConfiguration; import java.awt.Transparency; import java.awt.image.ColorModel; -import java.awt.image.IndexColorModel; import java.awt.image.DirectColorModel; +import java.awt.image.IndexColorModel; import sun.awt.X11GraphicsConfig; +import sun.java2d.SunGraphics2D; import sun.java2d.SurfaceData; import sun.java2d.SurfaceDataProxy; -import sun.java2d.SunGraphics2D; -import sun.java2d.loops.SurfaceType; import sun.java2d.loops.CompositeType; /** @@ -106,7 +103,8 @@ public SurfaceData validateSurfaceData(SurfaceData srcData, // Bitmask will be created lazily during the blit phase cachedData = X11SurfaceData.createData(x11gc, w, h, x11gc.getColorModel(), - null, 0, getTransparency()); + null, 0, + getTransparency(), true); } catch (OutOfMemoryError oome) { } } diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java index 7adad31e19f22..2b06d471de883 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, 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 java.awt.ImageCapabilities; import java.awt.Transparency; import java.awt.image.ColorModel; + import sun.awt.X11GraphicsConfig; import sun.awt.image.SunVolatileImage; import sun.awt.image.VolatileSurfaceManager; @@ -93,7 +94,8 @@ protected SurfaceData initAcceleratedSurface() { vImg.getWidth(), vImg.getHeight(), cm, vImg, drawable, - Transparency.OPAQUE); + Transparency.OPAQUE, + false); } catch (NullPointerException ex) { sData = null; } catch (OutOfMemoryError er) { From cfd070ece64fc4c4248caaf0803d02ba0600fe38 Mon Sep 17 00:00:00 2001 From: Paul Sandoz Date: Wed, 2 Dec 2020 02:01:19 +0000 Subject: [PATCH 008/504] 8257537: [vector] Cleanup redundant bitwise cases on floating point vectors Reviewed-by: vlivanov --- .../classes/jdk/incubator/vector/DoubleVector.java | 8 -------- .../classes/jdk/incubator/vector/FloatVector.java | 8 -------- .../jdk/incubator/vector/X-Vector.java.template | 12 ++++-------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index 0e73f291ac454..4b4e3ac0a7923 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java @@ -665,8 +665,6 @@ opc, getClass(), double.class, length(), v0.bOp(v1, (i, a, b) -> (double)Math.max(a, b)); case VECTOR_OP_MIN: return (v0, v1) -> v0.bOp(v1, (i, a, b) -> (double)Math.min(a, b)); - case VECTOR_OP_OR: return (v0, v1) -> - v0.bOp(v1, (i, a, b) -> fromBits(toBits(a) | toBits(b))); default: return null; }})); } @@ -2319,8 +2317,6 @@ opc, getClass(), double.class, length(), toBits(v.rOp(MAX_OR_INF, (i, a, b) -> (double) Math.min(a, b))); case VECTOR_OP_MAX: return v -> toBits(v.rOp(MIN_OR_INF, (i, a, b) -> (double) Math.max(a, b))); - case VECTOR_OP_OR: return v -> - toBits(v.rOp((double)0, (i, a, b) -> fromBits(toBits(a) | toBits(b)))); default: return null; }}))); } @@ -2336,13 +2332,9 @@ DoubleVector reduceIdentityVector(VectorOperators.Associative op) { = REDUCE_ID_IMPL.find(op, opc, (opc_) -> { switch (opc_) { case VECTOR_OP_ADD: - case VECTOR_OP_OR: - case VECTOR_OP_XOR: return v -> v.broadcast(0); case VECTOR_OP_MUL: return v -> v.broadcast(1); - case VECTOR_OP_AND: - return v -> v.broadcast(-1); case VECTOR_OP_MIN: return v -> v.broadcast(MAX_OR_INF); case VECTOR_OP_MAX: diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index f43ef9e96fbd4..4c9cb3388013f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java @@ -665,8 +665,6 @@ opc, getClass(), float.class, length(), v0.bOp(v1, (i, a, b) -> (float)Math.max(a, b)); case VECTOR_OP_MIN: return (v0, v1) -> v0.bOp(v1, (i, a, b) -> (float)Math.min(a, b)); - case VECTOR_OP_OR: return (v0, v1) -> - v0.bOp(v1, (i, a, b) -> fromBits(toBits(a) | toBits(b))); default: return null; }})); } @@ -2339,8 +2337,6 @@ opc, getClass(), float.class, length(), toBits(v.rOp(MAX_OR_INF, (i, a, b) -> (float) Math.min(a, b))); case VECTOR_OP_MAX: return v -> toBits(v.rOp(MIN_OR_INF, (i, a, b) -> (float) Math.max(a, b))); - case VECTOR_OP_OR: return v -> - toBits(v.rOp((float)0, (i, a, b) -> fromBits(toBits(a) | toBits(b)))); default: return null; }}))); } @@ -2356,13 +2352,9 @@ FloatVector reduceIdentityVector(VectorOperators.Associative op) { = REDUCE_ID_IMPL.find(op, opc, (opc_) -> { switch (opc_) { case VECTOR_OP_ADD: - case VECTOR_OP_OR: - case VECTOR_OP_XOR: return v -> v.broadcast(0); case VECTOR_OP_MUL: return v -> v.broadcast(1); - case VECTOR_OP_AND: - return v -> v.broadcast(-1); case VECTOR_OP_MIN: return v -> v.broadcast(MAX_OR_INF); case VECTOR_OP_MAX: diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 54399c82cfd76..e49e987265fda 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -731,10 +731,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { case VECTOR_OP_URSHIFT: return (v0, v1) -> v0.bOp(v1, (i, a, n) -> ($type$)((a & LSHR_SETUP_MASK) >>> n)); #end[BITWISE] -#if[FP] - case VECTOR_OP_OR: return (v0, v1) -> - v0.bOp(v1, (i, a, b) -> fromBits(toBits(a) | toBits(b))); -#end[FP] default: return null; }})); } @@ -2836,10 +2832,6 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { case VECTOR_OP_XOR: return v -> toBits(v.rOp(($type$)0, (i, a, b) -> ($type$)(a ^ b))); #end[BITWISE] -#if[FP] - case VECTOR_OP_OR: return v -> - toBits(v.rOp(($type$)0, (i, a, b) -> fromBits(toBits(a) | toBits(b)))); -#end[FP] default: return null; }}))); } @@ -2855,13 +2847,17 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = REDUCE_ID_IMPL.find(op, opc, (opc_) -> { switch (opc_) { case VECTOR_OP_ADD: +#if[BITWISE] case VECTOR_OP_OR: case VECTOR_OP_XOR: +#end[BITWISE] return v -> v.broadcast(0); case VECTOR_OP_MUL: return v -> v.broadcast(1); +#if[BITWISE] case VECTOR_OP_AND: return v -> v.broadcast(-1); +#end[BITWISE] case VECTOR_OP_MIN: return v -> v.broadcast(MAX_OR_INF); case VECTOR_OP_MAX: From 8f4fa3f8d5f34ebc80fb70f1b36aa67a8bd35211 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Wed, 2 Dec 2020 02:31:08 +0000 Subject: [PATCH 009/504] 8257232: CompileThresholdScaling fails to work on 32-bit platforms Reviewed-by: kvn, redestad --- src/hotspot/share/compiler/compilerDefinitions.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index 2fcb359aa5ee2..dc8c726ce3605 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -119,13 +119,17 @@ intx CompilerConfig::scaled_freq_log(intx freq_log, double scale) { // max_freq_bits accordingly. intx max_freq_bits = InvocationCounter::number_of_count_bits + 1; intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale); + if (scaled_freq == 0) { // Return 0 right away to avoid calculating log2 of 0. return 0; - } else if (scaled_freq > nth_bit(max_freq_bits)) { - return max_freq_bits; } else { - return log2_intptr(scaled_freq); + intx res = log2_intptr(scaled_freq); + if (res > max_freq_bits) { + return max_freq_bits; + } else { + return res; + } } } From 541c7f74bbe0ffbacfa802e9e0d6cb6c63d81b10 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Wed, 2 Dec 2020 02:50:33 +0000 Subject: [PATCH 010/504] 8257434: jpackage fails to create rpm on Fedora Linux Reviewed-by: almatvee, herrick --- .../jdk/jpackage/internal/resources/template.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec index a1885ff949a6c..017761babb941 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec @@ -5,19 +5,19 @@ Release: APPLICATION_RELEASE License: APPLICATION_LICENSE_TYPE Vendor: APPLICATION_VENDOR -%if "xAPPLICATION_PREFIX" != x +%if "xAPPLICATION_PREFIX" != "x" Prefix: APPLICATION_PREFIX %endif Provides: APPLICATION_PACKAGE -%if "xAPPLICATION_GROUP" != x +%if "xAPPLICATION_GROUP" != "x" Group: APPLICATION_GROUP %endif Autoprov: 0 Autoreq: 0 -%if "xPACKAGE_DEFAULT_DEPENDENCIES" != x || "xPACKAGE_CUSTOM_DEPENDENCIES" != x +%if "xPACKAGE_DEFAULT_DEPENDENCIES" != "x" || "xPACKAGE_CUSTOM_DEPENDENCIES" != "x" Requires: PACKAGE_DEFAULT_DEPENDENCIES PACKAGE_CUSTOM_DEPENDENCIES %endif @@ -43,7 +43,7 @@ APPLICATION_DESCRIPTION rm -rf %{buildroot} install -d -m 755 %{buildroot}APPLICATION_DIRECTORY cp -r %{_sourcedir}APPLICATION_DIRECTORY/* %{buildroot}APPLICATION_DIRECTORY -%if "xAPPLICATION_LICENSE_FILE" != x +%if "xAPPLICATION_LICENSE_FILE" != "x" %define license_install_file %{_defaultlicensedir}/%{name}-%{version}/%{basename:APPLICATION_LICENSE_FILE} install -d -m 755 "%{buildroot}%{dirname:%{license_install_file}}" install -m 644 "APPLICATION_LICENSE_FILE" "%{buildroot}%{license_install_file}" @@ -53,12 +53,12 @@ cp -r %{_sourcedir}APPLICATION_DIRECTORY/* %{buildroot}APPLICATION_DIRECTORY comm -23 %{app_filelist} %{filesystem_filelist} > %{package_filelist} sed -i -e 's/.*/%dir "&"/' %{package_filelist} (cd %{buildroot} && find . -not -type d) | sed -e 's/^\.//' -e 's/.*/"&"/' >> %{package_filelist} -%if "xAPPLICATION_LICENSE_FILE" != x +%if "xAPPLICATION_LICENSE_FILE" != "x" sed -i -e 's|"%{license_install_file}"||' -e '/^$/d' %{package_filelist} %endif %files -f %{package_filelist} -%if "xAPPLICATION_LICENSE_FILE" != x +%if "xAPPLICATION_LICENSE_FILE" != "x" %license "%{license_install_file}" %endif From fe5cccc1ec76a5c29b1f55af311823f84483395b Mon Sep 17 00:00:00 2001 From: Bradford Wetmore Date: Wed, 2 Dec 2020 04:14:28 +0000 Subject: [PATCH 011/504] 8254631: Better support ALPN byte wire values in SunJSSE Reviewed-by: xuelei, dfuchs --- .../classes/javax/net/ssl/SSLEngine.java | 42 +++ .../classes/javax/net/ssl/SSLParameters.java | 23 +- .../classes/javax/net/ssl/SSLSocket.java | 43 ++- .../sun/security/ssl/AlpnExtension.java | 37 ++- .../share/conf/security/java.security | 10 + .../sun/security/ssl/ALPN/AlpnGreaseTest.java | 306 ++++++++++++++++++ 6 files changed, 450 insertions(+), 11 deletions(-) create mode 100644 test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java diff --git a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java index c81e033dcefb7..812cecf867213 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLEngine.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLEngine.java @@ -336,6 +336,48 @@ * started, an {@code SSLEngine} can not switch between client and server * modes, even when performing renegotiations. *

+ * The ApplicationProtocol {@code String} values returned by the methods + * in this class are in the network byte representation sent by the peer. + * The bytes could be directly compared, or converted to its Unicode + * {code String} format for comparison. + * + *

+ *     String networkString = sslEngine.getHandshakeApplicationProtocol();
+ *     byte[] bytes = networkString.getBytes(StandardCharsets.ISO_8859_1);
+ *
+ *     //
+ *     // Match using bytes:
+ *     //
+ *     //   "http/1.1"                       (7-bit ASCII values same in UTF-8)
+ *     //   MEETEI MAYEK LETTERS "HUK UN I"  (Unicode 0xabcd->0xabcf)
+ *     //
+ *     String HTTP1_1 = "http/1.1";
+ *     byte[] HTTP1_1_BYTES = HTTP1_1.getBytes(StandardCharsets.UTF_8);
+ *
+ *     byte[] HUK_UN_I_BYTES = new byte[] {
+ *         (byte) 0xab, (byte) 0xcd,
+ *         (byte) 0xab, (byte) 0xce,
+ *         (byte) 0xab, (byte) 0xcf};
+ *
+ *     if ((Arrays.compare(bytes, HTTP1_1_BYTES) == 0 )
+ *             || Arrays.compare(bytes, HUK_UN_I_BYTES) == 0) {
+ *        ...
+ *     }
+ *
+ *     //
+ *     // Alternatively match using string.equals() if we know the ALPN value
+ *     // was encoded from a {@code String} using a certain character set,
+ *     // for example {@code UTF-8}.  The ALPN value must first be properly
+ *     // decoded to a Unicode {@code String} before use.
+ *     //
+ *     String unicodeString = new String(bytes, StandardCharsets.UTF_8);
+ *     if (unicodeString.equals(HTTP1_1)
+ *             || unicodeString.equals("\u005cuabcd\u005cuabce\u005cuabcf")) {
+ *         ...
+ *     }
+ * 
+ * + *

* Applications might choose to process delegated tasks in different * threads. When an {@code SSLEngine} * is created, the current {@link java.security.AccessControlContext} diff --git a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java index 5df0d7becdd9c..04a50686064a1 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -646,6 +646,27 @@ public String[] getApplicationProtocols() { * requested by the peer, the underlying protocol will determine what * action to take. (For example, ALPN will send a * {@code "no_application_protocol"} alert and terminate the connection.) + *

+ * The {@code String} values must be presented using the network + * byte representation expected by the peer. For example, if an ALPN + * {@code String} should be exchanged using {@code UTF-8}, the + * {@code String} should be converted to its {@code byte[]} representation + * and stored as a byte-oriented {@code String} before calling this method. + * + *

+     *     // MEETEI MAYEK LETTERS HUK UN I (Unicode 0xabcd->0xabcf): 2 bytes
+     *     byte[] bytes = "\u005cuabcd\u005cuabce\u005cuabcf"
+     *             .getBytes(StandardCharsets.UTF_8);
+     *     String HUK_UN_I = new String(bytes, StandardCharsets.ISO_8859_1);
+     *
+     *     // 0x00-0xFF:  1 byte
+     *     String rfc7301Grease8F = "\u005c008F\u005c008F";
+     *
+     *     SSLParameters p = sslSocket.getSSLParameters();
+     *     p.setApplicationProtocols(new String[] {
+     *             "h2", "http/1.1", rfc7301Grease8F, HUK_UN_I});
+     *     sslSocket.setSSLParameters(p);
+     * 
* * @implSpec * This method will make a copy of the {@code protocols} array. diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java index 7271f3434b0b7..7f44a4fe6c530 100644 --- a/src/java.base/share/classes/javax/net/ssl/SSLSocket.java +++ b/src/java.base/share/classes/javax/net/ssl/SSLSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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,6 +130,47 @@ * socket can not switch between client and server modes, even when * performing renegotiations. * + *

The ApplicationProtocol {@code String} values returned by the methods + * in this class are in the network byte representation sent by the peer. + * The bytes could be directly compared, or converted to its Unicode + * {code String} format for comparison. + * + *

+ *     String networkString = sslSocket.getHandshakeApplicationProtocol();
+ *     byte[] bytes = networkString.getBytes(StandardCharsets.ISO_8859_1);
+ *
+ *     //
+ *     // Match using bytes:
+ *     //
+ *     //   "http/1.1"                       (7-bit ASCII values same in UTF-8)
+ *     //   MEETEI MAYEK LETTERS "HUK UN I"  (Unicode 0xabcd->0xabcf)
+ *     //
+ *     String HTTP1_1 = "http/1.1";
+ *     byte[] HTTP1_1_BYTES = HTTP1_1.getBytes(StandardCharsets.UTF_8);
+ *
+ *     byte[] HUK_UN_I_BYTES = new byte[] {
+ *         (byte) 0xab, (byte) 0xcd,
+ *         (byte) 0xab, (byte) 0xce,
+ *         (byte) 0xab, (byte) 0xcf};
+ *
+ *     if ((Arrays.compare(bytes, HTTP1_1_BYTES) == 0 )
+ *             || Arrays.compare(bytes, HUK_UN_I_BYTES) == 0) {
+ *        ...
+ *     }
+ *
+ *     //
+ *     // Alternatively match using string.equals() if we know the ALPN value
+ *     // was encoded from a {@code String} using a certain character set,
+ *     // for example {@code UTF-8}.  The ALPN value must first be properly
+ *     // decoded to a Unicode {@code String} before use.
+ *     //
+ *     String unicodeString = new String(bytes, StandardCharsets.UTF_8);
+ *     if (unicodeString.equals(HTTP1_1)
+ *             || unicodeString.equals("\u005cuabcd\u005cuabce\u005cuabcf")) {
+ *         ...
+ *     }
+ * 
+ * * @apiNote * When the connection is no longer needed, the client and server * applications should each close both sides of their respective connection. diff --git a/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java b/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java index fae54d5b6532d..b2448b023f468 100644 --- a/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java @@ -27,7 +27,10 @@ import java.io.IOException; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; +import java.nio.charset.Charset; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.Security; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; @@ -59,6 +62,20 @@ final class AlpnExtension { static final SSLStringizer alpnStringizer = new AlpnStringizer(); + // Encoding Charset to convert between String and byte[] + static final Charset alpnCharset; + + static { + String alpnCharsetString = AccessController.doPrivileged( + (PrivilegedAction) () + -> Security.getProperty("jdk.tls.alpnCharset")); + if ((alpnCharsetString == null) + || (alpnCharsetString.length() == 0)) { + alpnCharsetString = "ISO_8859_1"; + } + alpnCharset = Charset.forName(alpnCharsetString); + } + /** * The "application_layer_protocol_negotiation" extension. * @@ -101,7 +118,7 @@ private AlpnSpec(HandshakeContext hc, "extension: empty application protocol name")); } - String appProtocol = new String(bytes, StandardCharsets.UTF_8); + String appProtocol = new String(bytes, alpnCharset); protocolNames.add(appProtocol); } @@ -168,10 +185,10 @@ public byte[] produce(ConnectionContext context, return null; } - // Produce the extension. + // Produce the extension: first find the overall length int listLength = 0; // ProtocolNameList length for (String ap : laps) { - int length = ap.getBytes(StandardCharsets.UTF_8).length; + int length = ap.getBytes(alpnCharset).length; if (length == 0) { // log the configuration problem if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { @@ -223,8 +240,10 @@ public byte[] produce(ConnectionContext context, byte[] extData = new byte[listLength + 2]; ByteBuffer m = ByteBuffer.wrap(extData); Record.putInt16(m, listLength); + + // opaque ProtocolName<1..2^8-1>; for (String ap : laps) { - Record.putBytes8(m, ap.getBytes(StandardCharsets.UTF_8)); + Record.putBytes8(m, ap.getBytes(alpnCharset)); } // Update the context. @@ -414,14 +433,14 @@ public byte[] produce(ConnectionContext context, } // opaque ProtocolName<1..2^8-1>, RFC 7301. - int listLen = shc.applicationProtocol.length() + 1; - // 1: length byte + byte[] bytes = shc.applicationProtocol.getBytes(alpnCharset); + int listLen = bytes.length + 1; // 1: length byte + // ProtocolName protocol_name_list<2..2^16-1>, RFC 7301. byte[] extData = new byte[listLen + 2]; // 2: list length ByteBuffer m = ByteBuffer.wrap(extData); Record.putInt16(m, listLen); - Record.putBytes8(m, - shc.applicationProtocol.getBytes(StandardCharsets.UTF_8)); + Record.putBytes8(m, bytes); // Update the context. shc.conContext.applicationProtocol = shc.applicationProtocol; diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security index 63a621be9c89c..844178231912f 100644 --- a/src/java.base/share/conf/security/java.security +++ b/src/java.base/share/conf/security/java.security @@ -1309,3 +1309,13 @@ jdk.io.permissionsUseCanonicalPath=false # System value prevails. The default value of the property is "false". # #jdk.security.allowNonCaAnchor=true + +# +# The default Character set name (java.nio.charset.Charset.forName()) +# for converting TLS ALPN values between byte arrays and Strings. +# Prior versions of the JDK may use UTF-8 as the default charset. If +# you experience interoperability issues, setting this property to UTF-8 +# may help. +# +# jdk.tls.alpnCharset=UTF-8 +jdk.tls.alpnCharset=ISO_8859_1 diff --git a/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java b/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java new file mode 100644 index 0000000000000..d3c656043a266 --- /dev/null +++ b/test/jdk/sun/security/ssl/ALPN/AlpnGreaseTest.java @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2020, 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. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 8254631 + * @summary Better support ALPN byte wire values in SunJSSE + * @library /javax/net/ssl/templates + * @run main/othervm AlpnGreaseTest + */ +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; + +/** + * A SSLEngine usage example which simplifies the presentation + * by removing the I/O and multi-threading concerns. + * + * The test creates two SSLEngines, simulating a client and server. + * The "transport" layer consists two byte buffers: think of them + * as directly connected pipes. + * + * Note, this is a *very* simple example: real code will be much more + * involved. For example, different threading and I/O models could be + * used, transport mechanisms could close unexpectedly, and so on. + * + * When this application runs, notice that several messages + * (wrap/unwrap) pass before any application data is consumed or + * produced. + */ +public class AlpnGreaseTest implements SSLContextTemplate { + + private final SSLEngine clientEngine; // client Engine + private final ByteBuffer clientOut; // write side of clientEngine + private final ByteBuffer clientIn; // read side of clientEngine + + private final SSLEngine serverEngine; // server Engine + private final ByteBuffer serverOut; // write side of serverEngine + private final ByteBuffer serverIn; // read side of serverEngine + + // For data transport, this example uses local ByteBuffers. This + // isn't really useful, but the purpose of this example is to show + // SSLEngine concepts, not how to do network transport. + private final ByteBuffer cTOs; // "reliable" transport client->server + private final ByteBuffer sTOc; // "reliable" transport server->client + + // These are the various 8-bit char values that could be sent as GREASE + // values. We'll just make one big String here to make it easy to check + // that the right values are being output. + private static final byte[] greaseBytes = new byte[] { + (byte) 0x0A, (byte) 0x1A, (byte) 0x2A, (byte) 0x3A, + (byte) 0x4A, (byte) 0x5A, (byte) 0x6A, (byte) 0x7A, + (byte) 0x8A, (byte) 0x9A, (byte) 0xAA, (byte) 0xBA, + (byte) 0xCA, (byte) 0xDA, (byte) 0xEA, (byte) 0xFA + }; + + private static final String greaseString = + new String(greaseBytes, StandardCharsets.ISO_8859_1); + + private static void findGreaseInClientHello(byte[] bytes) throws Exception { + for (int i = 0; i < bytes.length - greaseBytes.length; i++) { + if (Arrays.equals(bytes, i, i + greaseBytes.length, + greaseBytes, 0, greaseBytes.length)) { + System.out.println("Found greaseBytes in ClientHello at: " + i); + return; + } + } + throw new Exception("Couldn't find greaseBytes"); + } + + private AlpnGreaseTest() throws Exception { + serverEngine = configureServerEngine( + createServerSSLContext().createSSLEngine()); + + clientEngine = configureClientEngine( + createClientSSLContext().createSSLEngine()); + + // We'll assume the buffer sizes are the same + // between client and server. + SSLSession session = clientEngine.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + + // We'll make the input buffers a bit bigger than the max needed + // size, so that unwrap()s following a successful data transfer + // won't generate BUFFER_OVERFLOWS. + // + // We'll use a mix of direct and indirect ByteBuffers for + // tutorial purposes only. In reality, only use direct + // ByteBuffers when they give a clear performance enhancement. + clientIn = ByteBuffer.allocate(appBufferMax + 50); + serverIn = ByteBuffer.allocate(appBufferMax + 50); + + cTOs = ByteBuffer.allocateDirect(netBufferMax); + sTOc = ByteBuffer.allocateDirect(netBufferMax); + + clientOut = ByteBuffer.wrap("Hi Server, I'm Client".getBytes()); + serverOut = ByteBuffer.wrap("Hello Client, I'm Server".getBytes()); + } + + // + // Protected methods could be used to customize the test case. + // + + /* + * Configure the client side engine. + */ + protected SSLEngine configureClientEngine(SSLEngine clientEngine) { + clientEngine.setUseClientMode(true); + + // Get/set parameters if needed + SSLParameters paramsClient = clientEngine.getSSLParameters(); + paramsClient.setApplicationProtocols(new String[] { greaseString }); + + clientEngine.setSSLParameters(paramsClient); + + return clientEngine; + } + + /* + * Configure the server side engine. + */ + protected SSLEngine configureServerEngine(SSLEngine serverEngine) { + serverEngine.setUseClientMode(false); + serverEngine.setNeedClientAuth(true); + + // Get/set parameters if needed + // + SSLParameters paramsServer = serverEngine.getSSLParameters(); + paramsServer.setApplicationProtocols(new String[] { greaseString }); + serverEngine.setSSLParameters(paramsServer); + + return serverEngine; + } + + public static void main(String[] args) throws Exception { + new AlpnGreaseTest().runTest(); + } + + // + // Private methods that used to build the common part of the test. + // + + private void runTest() throws Exception { + SSLEngineResult clientResult; + SSLEngineResult serverResult; + + boolean dataDone = false; + boolean firstClientWrap = true; + while (isOpen(clientEngine) || isOpen(serverEngine)) { + log("================="); + + // client wrap + log("---Client Wrap---"); + clientResult = clientEngine.wrap(clientOut, cTOs); + logEngineStatus(clientEngine, clientResult); + runDelegatedTasks(clientEngine); + + if (firstClientWrap) { + firstClientWrap = false; + byte[] bytes = new byte[cTOs.position()]; + cTOs.duplicate().flip().get(bytes); + findGreaseInClientHello(bytes); + } + + // server wrap + log("---Server Wrap---"); + serverResult = serverEngine.wrap(serverOut, sTOc); + logEngineStatus(serverEngine, serverResult); + runDelegatedTasks(serverEngine); + + cTOs.flip(); + sTOc.flip(); + + // client unwrap + log("---Client Unwrap---"); + clientResult = clientEngine.unwrap(sTOc, clientIn); + logEngineStatus(clientEngine, clientResult); + runDelegatedTasks(clientEngine); + + // server unwrap + log("---Server Unwrap---"); + serverResult = serverEngine.unwrap(cTOs, serverIn); + logEngineStatus(serverEngine, serverResult); + runDelegatedTasks(serverEngine); + + cTOs.compact(); + sTOc.compact(); + + // After we've transferred all application data between the client + // and server, we close the clientEngine's outbound stream. + // This generates a close_notify handshake message, which the + // server engine receives and responds by closing itself. + if (!dataDone && (clientOut.limit() == serverIn.position()) && + (serverOut.limit() == clientIn.position())) { + + // Check ALPN Value + String alpnServerValue = serverEngine.getApplicationProtocol(); + String alpnClientValue = clientEngine.getApplicationProtocol(); + + if (!alpnServerValue.equals(greaseString) + || !alpnClientValue.equals(greaseString)) { + throw new Exception("greaseString didn't match"); + } + + // A sanity check to ensure we got what was sent. + checkTransfer(serverOut, clientIn); + checkTransfer(clientOut, serverIn); + + log("\tClosing clientEngine's *OUTBOUND*..."); + clientEngine.closeOutbound(); + logEngineStatus(clientEngine); + + dataDone = true; + log("\tClosing serverEngine's *OUTBOUND*..."); + serverEngine.closeOutbound(); + logEngineStatus(serverEngine); + } + } + } + + private static boolean isOpen(SSLEngine engine) { + return (!engine.isOutboundDone() || !engine.isInboundDone()); + } + + private static void logEngineStatus(SSLEngine engine) { + log("\tCurrent HS State: " + engine.getHandshakeStatus()); + log("\tisInboundDone() : " + engine.isInboundDone()); + log("\tisOutboundDone(): " + engine.isOutboundDone()); + } + + private static void logEngineStatus( + SSLEngine engine, SSLEngineResult result) { + log("\tResult Status : " + result.getStatus()); + log("\tResult HS Status : " + result.getHandshakeStatus()); + log("\tEngine HS Status : " + engine.getHandshakeStatus()); + log("\tisInboundDone() : " + engine.isInboundDone()); + log("\tisOutboundDone() : " + engine.isOutboundDone()); + log("\tMore Result : " + result); + } + + private static void log(String message) { + System.err.println(message); + } + + // If the result indicates that we have outstanding tasks to do, + // go ahead and run them in this thread. + private static void runDelegatedTasks(SSLEngine engine) throws Exception { + if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + log(" running delegated task..."); + runnable.run(); + } + HandshakeStatus hsStatus = engine.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + throw new Exception( + "handshake shouldn't need additional tasks"); + } + logEngineStatus(engine); + } + } + + // Simple check to make sure everything came across as expected. + private static void checkTransfer(ByteBuffer a, ByteBuffer b) + throws Exception { + a.flip(); + b.flip(); + + if (!a.equals(b)) { + throw new Exception("Data didn't transfer cleanly"); + } else { + log("\tData transferred cleanly"); + } + + a.position(a.limit()); + b.position(b.limit()); + a.limit(a.capacity()); + b.limit(b.capacity()); + } +} From f2a0988a4aa1270f49280eb465e468bc002b3a1f Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Wed, 2 Dec 2020 06:49:57 +0000 Subject: [PATCH 012/504] 8257228: G1: SIGFPE in G1ConcurrentRefine::create(int*) due to buffers_to_cards overflow Reviewed-by: kbarrett, tschatzl --- .../share/gc/g1/g1ConcurrentRefine.cpp | 25 +++++++--- .../gc/g1/TestBuffersToCardsOverflow.java | 46 +++++++++++++++++++ 2 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 test/hotspot/jtreg/gc/g1/TestBuffersToCardsOverflow.java diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index bb9731f8b4162..7d8076f3cf3c6 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -34,6 +34,7 @@ #include "runtime/java.hpp" #include "runtime/thread.hpp" #include "utilities/debug.hpp" +#include "utilities/formatBuffer.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/pair.hpp" #include @@ -183,8 +184,16 @@ STATIC_ASSERT(max_yellow_zone <= max_red_zone); // For logging zone values, ensuring consistency of level and tags. #define LOG_ZONES(...) log_debug( CTRL_TAGS )(__VA_ARGS__) -static size_t buffers_to_cards(size_t value) { - return value * G1UpdateBufferSize; +// Convert configuration values in units of buffers to number of cards. +static size_t configuration_buffers_to_cards(size_t value, const char* value_name) { + if (value == 0) return 0; + size_t res = value * G1UpdateBufferSize; + + if (res / value != G1UpdateBufferSize) { // Check overflow + vm_exit_during_initialization(err_msg("configuration_buffers_to_cards: " + "(%s = " SIZE_FORMAT ") * (G1UpdateBufferSize = " SIZE_FORMAT ") overflow!", value_name, value, G1UpdateBufferSize)); + } + return res; } // Package for pair of refinement thread activation and deactivation @@ -206,7 +215,7 @@ static Thresholds calc_thresholds(size_t green_zone, // doing any processing, as that might lead to significantly more // than green_zone buffers to be processed during pause. So limit // to an extra half buffer per pause-time processing thread. - step = MIN2(step, buffers_to_cards(ParallelGCThreads) / 2.0); + step = MIN2(step, configuration_buffers_to_cards(ParallelGCThreads, "ParallelGCThreads") / 2.0); } size_t activate_offset = static_cast(ceil(step * (worker_id + 1))); size_t deactivate_offset = static_cast(floor(step * worker_id)); @@ -232,7 +241,7 @@ jint G1ConcurrentRefine::initialize() { } static size_t calc_min_yellow_zone_size() { - size_t step = buffers_to_cards(G1ConcRefinementThresholdStep); + size_t step = configuration_buffers_to_cards(G1ConcRefinementThresholdStep, "G1ConcRefinementThresholdStep"); uint n_workers = G1ConcurrentRefine::max_num_threads(); if ((max_yellow_zone / step) < n_workers) { return max_yellow_zone; @@ -243,15 +252,17 @@ static size_t calc_min_yellow_zone_size() { static size_t calc_init_green_zone() { size_t green = G1ConcRefinementGreenZone; + const char* name = "G1ConcRefinementGreenZone"; if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) { green = ParallelGCThreads; + name = "ParallelGCThreads"; } - green = buffers_to_cards(green); + green = configuration_buffers_to_cards(green, name); return MIN2(green, max_green_zone); } static size_t calc_init_yellow_zone(size_t green, size_t min_size) { - size_t config = buffers_to_cards(G1ConcRefinementYellowZone); + size_t config = configuration_buffers_to_cards(G1ConcRefinementYellowZone, "G1ConcRefinementYellowZone"); size_t size = 0; if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) { size = green * 2; @@ -266,7 +277,7 @@ static size_t calc_init_yellow_zone(size_t green, size_t min_size) { static size_t calc_init_red_zone(size_t green, size_t yellow) { size_t size = yellow - green; if (!FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) { - size_t config = buffers_to_cards(G1ConcRefinementRedZone); + size_t config = configuration_buffers_to_cards(G1ConcRefinementRedZone, "G1ConcRefinementRedZone"); if (yellow < config) { size = MAX2(size, config - yellow); } diff --git a/test/hotspot/jtreg/gc/g1/TestBuffersToCardsOverflow.java b/test/hotspot/jtreg/gc/g1/TestBuffersToCardsOverflow.java new file mode 100644 index 0000000000000..dd8a1aade20d3 --- /dev/null +++ b/test/hotspot/jtreg/gc/g1/TestBuffersToCardsOverflow.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2020 THL A29 Limited, a Tencent company. 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 8257228 + * @library /test/lib + * @requires vm.bits == 64 + * @build gc.g1.TestBuffersToCardsOverflow jdk.test.lib.process.* + * @run main gc.g1.TestBuffersToCardsOverflow + */ + +package gc.g1; + +import jdk.test.lib.process.ProcessTools; + +public class TestBuffersToCardsOverflow { + public static void main(String... args) throws Exception { + ProcessTools.executeTestJava("-XX:G1ConcRefinementThresholdStep=16G", + "-XX:G1UpdateBufferSize=1G") + .outputTo(System.out) + .errorTo(System.out) + .stdoutShouldNotContain("SIGFPE") + .stdoutShouldNotContain("hs_err"); + } +} From 282cb325b19ebc0cc1ef8d40f768c49de8033388 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 2 Dec 2020 06:51:53 +0000 Subject: [PATCH 013/504] 8005970: Mouse cursor is default cursor over TextArea's scrollbar Reviewed-by: kizune --- test/jdk/ProblemList.txt | 1 - .../MouseOverScrollbarWhenTyping/Test.java | 4 +- .../MouseOverScrollbarWhenTyping/Test1.java | 409 ------------------ 3 files changed, 2 insertions(+), 412 deletions(-) delete mode 100644 test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test1.java diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 96f90907d28eb..9dc6a663dd882 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -864,7 +864,6 @@ java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,802 java/awt/Modal/WsDisabledStyle/CloseBlocker/CloseBlocker.java 7187741 linux-all,macosx-all java/awt/Component/UpdatingBootTime/UpdatingBootTime.html 7194219 linux-all java/awt/xembed/server/TestXEmbedServerJava.java 8001150,8004031 generic-all -java/awt/TextArea/MouseOverScrollbarWhenTyping/Test1.java 8005970 macosx-all,windows-all javax/swing/JFileChooser/6698013/bug6698013.java 8024419 macosx-all javax/swing/JColorChooser/8065098/bug8065098.java 8065647 macosx-all java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java 8068378 generic-all diff --git a/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test.java b/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test.java index c785370d5a9e4..947d02d8a1254 100644 --- a/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test.java +++ b/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020, 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,7 +51,7 @@ private static void init() { f.setLayout( new BorderLayout () ); f.add( new TextArea( text ) ); f.setSize(400, 300); - + f.setLocationRelativeTo(null); f.setVisible(true); String[] instructions = { diff --git a/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test1.java b/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test1.java deleted file mode 100644 index 898b865d50d79..0000000000000 --- a/test/jdk/java/awt/TextArea/MouseOverScrollbarWhenTyping/Test1.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - @test - @bug 6431076 - @summary Mouse cursor must remain DEFAULT over scrollbar when text is typed - @author Andrei Dmitriev: area=TextArea - @run main/manual Test1 -*/ - -import java.awt.*; -import java.awt.event.*; - -public class Test1 { - private static void init() { - Frame f = new Frame("Test1 for cursor"); - final int dim = 100; - String line = ""; - for( int i=0; i 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); - } - - //catch presses of the passed and failed buttons. - //simply call the standard pass() or fail() static methods of - //ManualMainTest - public void actionPerformed( ActionEvent e ) - { - if( e.getActionCommand() == "pass" ) - { - Test1.pass(); - } - else - { - Test1.fail(); - } - } - -}// TestDialog class From 9de283b891d48326e957d7448c5de96fab3c8b9a Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Wed, 2 Dec 2020 08:53:54 +0000 Subject: [PATCH 014/504] 8257505: nsk/share/test/StressOptions stressTime is scaled in getter but not when printed Reviewed-by: kbarrett, dholmes --- .../jtreg/vmTestbase/nsk/share/test/StressOptions.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java b/test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java index fab4e07ed7744..c2ca9b5142914 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java @@ -200,10 +200,10 @@ public void parseCommandLine(String[] args) { * @param out output stream */ public void printInfo(PrintStream out) { - out.println("Stress time: " + time + " seconds"); - out.println("Stress iterations factor: " + iterationsFactor); - out.println("Stress threads factor: " + threadsFactor); - out.println("Stress runs factor: " + runsFactor); + out.println("Stress time: " + getTime() + " seconds"); + out.println("Stress iterations factor: " + getIterationsFactor()); + out.println("Stress threads factor: " + getThreadsFactor()); + out.println("Stress runs factor: " + getRunsFactor()); } private void error(String msg) { From fb139cff1a6ddf7659908053d5a0a6ae7563e725 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Wed, 2 Dec 2020 09:06:02 +0000 Subject: [PATCH 015/504] 8257467: [TESTBUG] -Wdeprecated-declarations is reported at sigset() in exesigtest.c Reviewed-by: dholmes, stuefe --- test/hotspot/jtreg/runtime/signal/exesigtest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/signal/exesigtest.c b/test/hotspot/jtreg/runtime/signal/exesigtest.c index 02dd76255992e..7a27f1f6c8004 100644 --- a/test/hotspot/jtreg/runtime/signal/exesigtest.c +++ b/test/hotspot/jtreg/runtime/signal/exesigtest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -242,7 +242,14 @@ void setSignalHandler() } // end - dealing with sigaction else if (!strcmp(mode, "sigset")) { +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif sigset(signal_num, handler); +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif } // end dealing with sigset printf("%s: signal handler using function '%s' has been set\n", signal_name, mode); } From 3e3745c2dabf3e9d5f326362a6688a701b7dcf21 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Wed, 2 Dec 2020 09:19:24 +0000 Subject: [PATCH 016/504] 8256008: UL does not report anything if disk writing fails Reviewed-by: stuefe --- src/hotspot/share/logging/logFileOutput.cpp | 18 ++++--- .../share/logging/logFileStreamOutput.cpp | 48 +++++++++++++++---- .../share/logging/logFileStreamOutput.hpp | 7 ++- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/src/hotspot/share/logging/logFileOutput.cpp b/src/hotspot/share/logging/logFileOutput.cpp index 81a42822b45fe..40a499c57b921 100644 --- a/src/hotspot/share/logging/logFileOutput.cpp +++ b/src/hotspot/share/logging/logFileOutput.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -292,10 +292,12 @@ int LogFileOutput::write(const LogDecorations& decorations, const char* msg) { _rotation_semaphore.wait(); int written = LogFileStreamOutput::write(decorations, msg); - _current_size += written; + if (written > 0) { + _current_size += written; - if (should_rotate()) { - rotate(); + if (should_rotate()) { + rotate(); + } } _rotation_semaphore.signal(); @@ -310,10 +312,12 @@ int LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator) { _rotation_semaphore.wait(); int written = LogFileStreamOutput::write(msg_iterator); - _current_size += written; + if (written > 0) { + _current_size += written; - if (should_rotate()) { - rotate(); + if (should_rotate()) { + rotate(); + } } _rotation_semaphore.signal(); diff --git a/src/hotspot/share/logging/logFileStreamOutput.cpp b/src/hotspot/share/logging/logFileStreamOutput.cpp index 78f5befbf55b0..c331c7c9c6de7 100644 --- a/src/hotspot/share/logging/logFileStreamOutput.cpp +++ b/src/hotspot/share/logging/logFileStreamOutput.cpp @@ -28,6 +28,7 @@ #include "logging/logFileStreamOutput.hpp" #include "logging/logMessageBuffer.hpp" #include "memory/allocation.inline.hpp" +#include "utilities/defaultStream.hpp" static bool initialized; static union { @@ -86,19 +87,47 @@ class FileLocker : public StackObj { } }; +bool LogFileStreamOutput::flush() { + bool result = true; + if (fflush(_stream) != 0) { + if (!_write_error_is_shown) { + jio_fprintf(defaultStream::error_stream(), + "Could not flush log: %s (%s (%d))\n", name(), os::strerror(errno), errno); + jio_fprintf(_stream, "\nERROR: Could not flush log (%d)\n", errno); + _write_error_is_shown = true; + } + result = false; + } + return result; +} + +#define WRITE_LOG_WITH_RESULT_CHECK(op, total) \ +{ \ + int result = op; \ + if (result < 0) { \ + if (!_write_error_is_shown) { \ + jio_fprintf(defaultStream::error_stream(), \ + "Could not write log: %s\n", name()); \ + jio_fprintf(_stream, "\nERROR: Could not write log\n"); \ + _write_error_is_shown = true; \ + return -1; \ + } \ + } \ + total += result; \ +} + int LogFileStreamOutput::write(const LogDecorations& decorations, const char* msg) { const bool use_decorations = !_decorators.is_empty(); int written = 0; FileLocker flocker(_stream); if (use_decorations) { - written += write_decorations(decorations); - written += jio_fprintf(_stream, " "); + WRITE_LOG_WITH_RESULT_CHECK(write_decorations(decorations), written); + WRITE_LOG_WITH_RESULT_CHECK(jio_fprintf(_stream, " "), written); } - written += jio_fprintf(_stream, "%s\n", msg); - fflush(_stream); + WRITE_LOG_WITH_RESULT_CHECK(jio_fprintf(_stream, "%s\n", msg), written); - return written; + return flush() ? written : -1; } int LogFileStreamOutput::write(LogMessageBuffer::Iterator msg_iterator) { @@ -108,12 +137,11 @@ int LogFileStreamOutput::write(LogMessageBuffer::Iterator msg_iterator) { FileLocker flocker(_stream); for (; !msg_iterator.is_at_end(); msg_iterator++) { if (use_decorations) { - written += write_decorations(msg_iterator.decorations()); - written += jio_fprintf(_stream, " "); + WRITE_LOG_WITH_RESULT_CHECK(write_decorations(msg_iterator.decorations()), written); + WRITE_LOG_WITH_RESULT_CHECK(jio_fprintf(_stream, " "), written); } - written += jio_fprintf(_stream, "%s\n", msg_iterator.message()); + WRITE_LOG_WITH_RESULT_CHECK(jio_fprintf(_stream, "%s\n", msg_iterator.message()), written); } - fflush(_stream); - return written; + return flush() ? written : -1; } diff --git a/src/hotspot/share/logging/logFileStreamOutput.hpp b/src/hotspot/share/logging/logFileStreamOutput.hpp index a02c56f6d184c..c4a0db7355d2c 100644 --- a/src/hotspot/share/logging/logFileStreamOutput.hpp +++ b/src/hotspot/share/logging/logFileStreamOutput.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,17 +40,20 @@ static LogFileStreamInitializer log_stream_initializer; // Base class for all FileStream-based log outputs. class LogFileStreamOutput : public LogOutput { + private: + bool _write_error_is_shown; protected: FILE* _stream; size_t _decorator_padding[LogDecorators::Count]; - LogFileStreamOutput(FILE *stream) : _stream(stream) { + LogFileStreamOutput(FILE *stream) : _write_error_is_shown(false), _stream(stream) { for (size_t i = 0; i < LogDecorators::Count; i++) { _decorator_padding[i] = 0; } } int write_decorations(const LogDecorations& decorations); + bool flush(); public: virtual int write(const LogDecorations& decorations, const char* msg); From 7e37c7c5441b9aceac31a7b8996f1d607877e0fa Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Wed, 2 Dec 2020 10:14:46 +0000 Subject: [PATCH 017/504] 8257471: fatal error: Fatal exception in JVMCI: Exception during JVMCI compiler initialization Reviewed-by: kvn, never --- .../hotspot/HotSpotJVMCICompilerConfig.java | 29 ++++++++++-------- .../vm/ci/hotspot/HotSpotJVMCIRuntime.java | 30 ++++++++++++------- .../jvmci/TestEnableJVMCIProduct.java | 6 +++- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java index 245239443c9c3..9bfb3050b6b99 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java @@ -48,14 +48,16 @@ final class HotSpotJVMCICompilerConfig { private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler { private final String reason; + private final HotSpotJVMCIRuntime runtime; - DummyCompilerFactory(String reason) { + DummyCompilerFactory(String reason, HotSpotJVMCIRuntime runtime) { this.reason = reason; + this.runtime = runtime; } @Override public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) { - throw new JVMCIError("no JVMCI compiler selected: " + reason); + throw runtime.exitHotSpotWithMessage(1, "Cannot use JVMCI compiler: %s%n", reason); } @Override @@ -64,7 +66,7 @@ public String getCompilerName() { } @Override - public JVMCICompiler createCompiler(JVMCIRuntime runtime) { + public JVMCICompiler createCompiler(JVMCIRuntime rt) { return this; } } @@ -81,15 +83,16 @@ public JVMCICompiler createCompiler(JVMCIRuntime runtime) { * @throws SecurityException if a security manager is present and it denies * {@link JVMCIPermission} for any {@link JVMCIServiceLocator} loaded by this method */ - static JVMCICompilerFactory getCompilerFactory() { + static JVMCICompilerFactory getCompilerFactory(HotSpotJVMCIRuntime runtime) { if (compilerFactory == null) { JVMCICompilerFactory factory = null; String compilerName = Option.Compiler.getString(); if (compilerName != null) { + String compPropertyName = Option.Compiler.getPropertyName(); if (compilerName.isEmpty()) { - factory = new DummyCompilerFactory(" empty \"\" is specified"); + factory = new DummyCompilerFactory("Value of " + compPropertyName + " is empty", runtime); } else if (compilerName.equals("null")) { - factory = new DummyCompilerFactory("\"null\" is specified"); + factory = new DummyCompilerFactory("Value of " + compPropertyName + " is \"null\"", runtime); } else { for (JVMCICompilerFactory f : getJVMCICompilerFactories()) { if (f.getCompilerName().equals(compilerName)) { @@ -98,29 +101,29 @@ static JVMCICompilerFactory getCompilerFactory() { } if (factory == null) { if (Services.IS_IN_NATIVE_IMAGE) { - throw new JVMCIError("JVMCI compiler '%s' not found in JVMCI native library.%n" + - "Use -XX:-UseJVMCINativeLibrary when specifying a JVMCI compiler available on a class path with %s.", - compilerName, Option.Compiler.getPropertyName()); + throw runtime.exitHotSpotWithMessage(1, "JVMCI compiler '%s' not found in JVMCI native library.%n" + + "Use -XX:-UseJVMCINativeLibrary when specifying a JVMCI compiler available on a class path with %s.%n", + compilerName, compPropertyName); } - throw new JVMCIError("JVMCI compiler '%s' not found", compilerName); + throw runtime.exitHotSpotWithMessage(1, "JVMCI compiler '%s' specified by %s not found%n", compilerName, compPropertyName); } } } else { // Auto select a single available compiler - String reason = "default compiler is not found"; + String reason = "No JVMCI compiler found"; for (JVMCICompilerFactory f : getJVMCICompilerFactories()) { if (factory == null) { openJVMCITo(f.getClass().getModule()); factory = f; } else { // Multiple factories seen - cancel auto selection - reason = "multiple factories seen: \"" + factory.getCompilerName() + "\" and \"" + f.getCompilerName() + "\""; + reason = "Multiple JVMCI compilers found: \"" + factory.getCompilerName() + "\" and \"" + f.getCompilerName() + "\""; factory = null; break; } } if (factory == null) { - factory = new DummyCompilerFactory(reason); + factory = new DummyCompilerFactory(reason, runtime); } } factory.onSelection(); diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java index 530706f75b94f..23ec67eb89ec2 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java @@ -63,7 +63,6 @@ import jdk.vm.ci.runtime.JVMCICompilerFactory; import jdk.vm.ci.runtime.JVMCIRuntime; import jdk.vm.ci.services.JVMCIServiceLocator; -import jdk.vm.ci.services.Services; /** * HotSpot implementation of a JVMCI runtime. @@ -380,9 +379,9 @@ static float stringSimiliarity(String str1, String str2) { * Parses all system properties starting with {@value #JVMCI_OPTION_PROPERTY_PREFIX} and * initializes the options based on their values. * - * @param compilerToVm + * @param runtime */ - static void parse(CompilerToVM compilerToVm) { + static void parse(HotSpotJVMCIRuntime runtime) { Map savedProps = jdk.vm.ci.services.Services.getSavedProperties(); for (Map.Entry e : savedProps.entrySet()) { String name = e.getKey(); @@ -405,9 +404,7 @@ static void parse(CompilerToVM compilerToVm) { } } msg.format("%nError: A fatal exception has occurred. Program will exit.%n"); - byte[] msgBytes = msg.toString().getBytes(); - compilerToVm.writeDebugOutput(msgBytes, 0, msgBytes.length, true, true); - compilerToVm.callSystemExit(1); + runtime.exitHotSpotWithMessage(1, msg.toString()); } else if (value instanceof Option) { Option option = (Option) value; option.init(e.getValue()); @@ -536,7 +533,7 @@ private HotSpotJVMCIRuntime() { } // Initialize the Option values. - Option.parse(compilerToVm); + Option.parse(this); String hostArchitecture = config.getHostArchitectureName(); @@ -549,7 +546,7 @@ private HotSpotJVMCIRuntime() { hostBackend = registerBackend(factory.createJVMCIBackend(this, null)); } - compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory(); + compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory(this); if (compilerFactory instanceof HotSpotJVMCICompilerFactory) { hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory; if (hsCompilerFactory.getCompilationLevelAdjustment() != None) { @@ -1161,12 +1158,12 @@ public void detachCurrentThread() { } /** - * Informs HotSpot that no method whose module is in {@code modules} is to be compiled - * with {@link #compileMethod}. + * Informs HotSpot that no method whose module is in {@code modules} is to be compiled with + * {@link #compileMethod}. * * @param modules the set of modules containing JVMCI compiler classes */ - public void excludeFromJVMCICompilation(Module...modules) { + public void excludeFromJVMCICompilation(Module... modules) { this.excludeFromJVMCICompilation = modules.clone(); } @@ -1179,4 +1176,15 @@ public void exitHotSpot(int status) { } compilerToVm.callSystemExit(status); } + + /** + * Writes a message to HotSpot's log stream and then calls {@link System#exit(int)} in HotSpot's + * runtime. + */ + JVMCIError exitHotSpotWithMessage(int status, String format, Object... args) { + byte[] messageBytes = String.format(format, args).getBytes(); + compilerToVm.writeDebugOutput(messageBytes, 0, messageBytes.length, true, true); + exitHotSpot(status); + throw JVMCIError.shouldNotReachHere(); + } } diff --git a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java index d577e30b6cee3..6634c85e40fb6 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java @@ -80,6 +80,10 @@ static void test(String explicitFlag, Expectation... expectations) throws Except for (Expectation expectation : expectations) { output.stdoutShouldMatch(expectation.pattern); } - output.shouldHaveExitValue(0); + if (output.getExitValue() != 0) { + // This should only happen when JVMCI compilation is requested and the VM has no + // JVMCI compiler (e.g. Graal is not included in the build) + output.stdoutShouldMatch("No JVMCI compiler found"); + } } } From e7ca0c4ae3a8159fdebdfaae0dfcac44d7e028bc Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 2 Dec 2020 10:18:15 +0000 Subject: [PATCH 018/504] 8257224: JDK-8251549 didn't update building.html Reviewed-by: sundar, shade --- doc/building.html | 51 +++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/doc/building.html b/doc/building.html index 20adf7e303762..03e87f6fa897e 100644 --- a/doc/building.html +++ b/doc/building.html @@ -97,12 +97,10 @@

Building the JDK

  • Getting Help
  • Hints and Suggestions for Advanced Users
  • Understanding the Build System

    TL;DR (Instructions for the Impatient)

    -

    If you are eager to try out building the JDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level JDK repository that you want to build.

    +

    If you are eager to try out building the JDK, these simple steps works most of the time. They assume that you have installed Git (and Cygwin if running on Windows) and cloned the top-level JDK repository that you want to build.

    1. Get the complete source code:
      -hg clone http://hg.openjdk.java.net/jdk/jdk

    2. +git clone https://git.openjdk.java.net/jdk/

    3. Run configure:
      bash configure

      If configure fails due to missing dependencies (to either the toolchain, build tools, external libraries or the boot JDK), most of the time it prints a suggestion on how to resolve the situation on your platform. Follow the instructions, and try running bash configure again.

    4. @@ -135,8 +133,8 @@

      Introduction

      The JDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.

      If you just want to use the JDK and not build it yourself, this document is not for you. See for instance OpenJDK installation for some methods of installing a prebuilt JDK.

      Getting the Source Code

      -

      Make sure you are getting the correct version. As of JDK 10, the source is no longer split into separate repositories so you only need to clone one single repository. At the OpenJDK Mercurial server you can see a list of all available repositories. If you want to build an older version, e.g. JDK 8, it is recommended that you get the jdk8u forest, which contains incremental updates, instead of the jdk8 forest, which was frozen at JDK 8 GA.

      -

      If you are new to Mercurial, a good place to start is the Mercurial Beginner's Guide. The rest of this document assumes a working knowledge of Mercurial.

      +

      Make sure you are getting the correct version. As of JDK 10, the source is no longer split into separate repositories so you only need to clone one single repository. At the OpenJDK Git site you can see a list of all available repositories. If you want to build an older version, e.g. JDK 11, it is recommended that you get the jdk11u repo, which contains incremental updates, instead of the jdk11 repo, which was frozen at JDK 11 GA.

      +

      If you are new to Git, a good place to start is the book Pro Git. The rest of this document assumes a working knowledge of Git.

      Special Considerations

      For a smooth building experience, it is recommended that you follow these rules on where and how to check out the source code.

        @@ -147,7 +145,11 @@

        Special Considerations

        • Create the directory that is going to contain the top directory of the JDK clone by using the mkdir command in the Cygwin bash shell. That is, do not create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.

        • Do not put the JDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.

        • -
        • Clone the JDK repository using the Cygwin command line hg client as instructed in this document. That is, do not use another Mercurial client such as TortoiseHg.

        • +
        • You need to install a git client. You have two choices, Cygwin git or Git for Windows. Unfortunately there are pros and cons with each choice.

          +
            +
          • The Cygwin git client has no line ending issues and understands Cygwin paths (which are used throughout the JDK build system). However, it does not currently work well with the Skara CLI tooling. Please see the Skara wiki on Git clients for up-to-date information about the Skara git client support.

          • +
          • The Git for Windows client has issues with line endings, and do not understand Cygwin paths. It does work well with the Skara CLI tooling, however. To alleviate the line ending problems, make sure you set core.autocrlf to false (this is asked during installation).

          • +

        Failure to follow this procedure might result in hard-to-debug build problems.

      @@ -194,7 +196,7 @@

      Windows

      Windows XP is not a supported platform, but all newer Windows should be able to build the JDK.

      On Windows, it is important that you pay attention to the instructions in the Special Considerations.

      Windows is the only non-POSIX OS supported by the JDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layers are Cygwin and Windows Subsystem for Linux (WSL). (Msys is no longer supported due to a too old bash; msys2 would likely be possible to support in a future version but that would require effort to implement.)

      -

      Internally in the build system, all paths are represented as Unix-style paths, e.g. /cygdrive/c/hg/jdk9/Makefile rather than C:\hg\jdk9\Makefile. This rule also applies to input to the build system, e.g. in arguments to configure. So, use --with-msvcr-dll=/cygdrive/c/msvcr100.dll rather than --with-msvcr-dll=c:\msvcr100.dll. For details on this conversion, see the section on Fixpath.

      +

      Internally in the build system, all paths are represented as Unix-style paths, e.g. /cygdrive/c/git/jdk/Makefile rather than C:\git\jdk\Makefile. This rule also applies to input to the build system, e.g. in arguments to configure. So, use --with-msvcr-dll=/cygdrive/c/msvcr100.dll rather than --with-msvcr-dll=c:\msvcr100.dll. For details on this conversion, see the section on Fixpath.

      Cygwin

      A functioning Cygwin environment is required for building the JDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.

      Note: Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the JDK build process, and that can cause unexpected build problems.

      @@ -758,14 +760,14 @@

      Build Failure Summary

      === Output from failing command(s) repeated here === * For target hotspot_variant-server_libjvm_objs_psMemoryPool.o: -/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type +/localhome/git/jdk-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type ... (rest of output omitted) -* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs. +* All command lines available in /localhome/git/jdk-sandbox/build/linux-x64/make-support/failure-logs. === End of repeated output === === Make failed targets repeated here === -lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed +lib/CompileJvm.gmk:207: recipe for target '/localhome/git/jdk-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed === End of repeated output === @@ -792,7 +794,7 @@

      Problems with Incremental RebuildsHere are a suggested list of things to try if you are having unexpected build problems. Each step requires more time than the one before, so try them in order. Most issues will be solved at step 1 or 2.

      1. Make sure your repository is up-to-date

        -

        Run hg pull -u to make sure you have the latest changes.

      2. +

        Run git pull origin master to make sure you have the latest changes.

      3. Clean build results

        The simplest way to fix incremental rebuild issues is to run make clean. This will remove all build results, but not the configuration or any build system support artifacts. In most cases, this will solve build errors resulting from incremental build mismatches.

      4. Completely clean the build directory.

        @@ -801,8 +803,8 @@

        Problems with Incremental Rebuilds

      5. -
      6. Re-clone the Mercurial repository

        -

        Sometimes the Mercurial repository gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the "sledgehammer approach": delete the entire repository, and re-clone it. If you have local changes, save them first to a different location using hg export.

      7. +
      8. Re-clone the Git repository

        +

        Sometimes the Git repository gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the "sledgehammer approach": delete the entire repository, and re-clone it. If you have local changes, save them first to a different location using git format-patch.

      Specific Build Issues

      Clock Skew

      @@ -821,19 +823,6 @@

      Getting Help

      If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to build-dev@openjdk.java.net. Please include the relevant parts of the configure and/or build log.

      If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on Contributing to OpenJDK for more information.

      Hints and Suggestions for Advanced Users

      -

      Setting Up a Repository for Pushing Changes (defpath)

      -

      To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as defpath. It will help you setup a proper push path for pushing changes to the JDK.

      -

      Install the extension by cloning http://hg.openjdk.java.net/code-tools/defpath and updating your .hgrc file. Here's one way to do this:

      -
      cd ~
      -mkdir hg-ext
      -cd hg-ext
      -hg clone http://hg.openjdk.java.net/code-tools/defpath
      -cat << EOT >> ~/.hgrc
      -[extensions]
      -defpath=~/hg-ext/defpath/defpath.py
      -EOT
      -

      You can now setup a proper push path using:

      -
      hg defpath -d -u <your OpenJDK username>

      Bash Completion

      The configure and make commands tries to play nice with bash command-line completion (using <tab> or <tab><tab>). To use this functionality, make sure you enable completion in your ~/.bashrc (see instructions for bash in your operating system).

      Make completion will work out of the box, and will complete valid make targets. For instance, typing make jdk-i<tab> will complete to make jdk-image.

      @@ -886,14 +875,6 @@

      Skipping the Dependency Check

      Rebuilding Part of java.base (JDK_FILTER)

      If you are modifying files in java.base, which is the by far largest module in the JDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)

      As a hack, you can use the make control variable JDK_FILTER to specify a pattern that will be used to limit the set of files being recompiled. For instance, make java.base JDK_FILTER=javax/crypto (or, to combine methods, make java.base-java-only JDK_FILTER=javax/crypto) will limit the compilation to files in the javax.crypto package.

      -

      Learn About Mercurial

      -

      To become an efficient JDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:

      -

      Understanding the Build System

      This section will give you a more technical description on the details of the build system.

      Configurations

      From 9a60413ba0d00278a9bbc4bed4740d6526fa1612 Mon Sep 17 00:00:00 2001 From: Stuart Monteith Date: Wed, 2 Dec 2020 10:22:20 +0000 Subject: [PATCH 019/504] 8248736: [aarch64] runtime/signal/TestSigpoll.java failed "fatal error: not an ldr (literal) instruction." Reviewed-by: aph, shade --- .../cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp index 951920fdce4d7..440a894ed9d7b 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp @@ -254,7 +254,7 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) { __ cmpw(rscratch1, rscratch2); __ br(Assembler::EQ, skip); - __ mov(rscratch1, StubRoutines::aarch64::method_entry_barrier()); + __ movptr(rscratch1, (uintptr_t) StubRoutines::aarch64::method_entry_barrier()); __ blr(rscratch1); __ b(skip); From bff68f1f67fb02b3fc75021fc18502c557d48d39 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 2 Dec 2020 10:30:48 +0000 Subject: [PATCH 020/504] 8257533: legacy-jre-image includes jpackage and jlink tools Reviewed-by: alanb, sundar --- make/common/Modules.gmk | 1 - 1 file changed, 1 deletion(-) diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 910f8beb2ffb4..f75c76e72c0d7 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -125,7 +125,6 @@ endif JRE_TOOL_MODULES += \ jdk.jdwp.agent \ - jdk.jpackage \ # ################################################################################ From 1fd0ea703522472a14d1d02fe5290e710d7858b1 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 2 Dec 2020 12:28:10 +0000 Subject: [PATCH 021/504] 8256382: Use try_lock for hs_err EventLog printing Reviewed-by: stuefe --- src/hotspot/share/utilities/events.hpp | 34 +++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp index d4613073673ad..0b1d442d8b33b 100644 --- a/src/hotspot/share/utilities/events.hpp +++ b/src/hotspot/share/utilities/events.hpp @@ -311,12 +311,38 @@ inline void Events::log_deopt_message(Thread* thread, const char* format, ...) { template inline void EventLogBase::print_log_on(outputStream* out, int max) { - if (Thread::current_or_null() == NULL) { - // Not yet attached? Don't try to use locking + struct MaybeLocker { + Mutex* const _mutex; + bool _proceed; + bool _locked; + + MaybeLocker(Mutex* mutex) : _mutex(mutex), _proceed(false), _locked(false) { + if (Thread::current_or_null() == NULL) { + _proceed = true; + } else if (VMError::is_error_reported()) { + if (_mutex->try_lock_without_rank_check()) { + _proceed = _locked = true; + } + } else { + _mutex->lock_without_safepoint_check(); + _proceed = _locked = true; + } + } + ~MaybeLocker() { + if (_locked) { + _mutex->unlock(); + } + } + }; + + MaybeLocker ml(&_mutex); + + if (ml._proceed) { print_log_impl(out, max); } else { - MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag); - print_log_impl(out, max); + out->print_cr("%s (%d events):", _name, _count); + out->print_cr("No events printed - crash while holding lock"); + out->cr(); } } From 287b829c0463018fb05e51d947d7a6783c03f199 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 2 Dec 2020 12:28:38 +0000 Subject: [PATCH 022/504] 8254877: GCLogPrecious::_lock rank constrains what locks you are allowed to have when crashing Reviewed-by: eosterlund --- src/hotspot/share/gc/shared/gcLogPrecious.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/gc/shared/gcLogPrecious.cpp b/src/hotspot/share/gc/shared/gcLogPrecious.cpp index 3e996c228c3a7..eddbbdcf11d3c 100644 --- a/src/hotspot/share/gc/shared/gcLogPrecious.cpp +++ b/src/hotspot/share/gc/shared/gcLogPrecious.cpp @@ -33,7 +33,7 @@ Mutex* GCLogPrecious::_lock = NULL; void GCLogPrecious::initialize() { _lines = new (ResourceObj::C_HEAP, mtGC) stringStream(); _temp = new (ResourceObj::C_HEAP, mtGC) stringStream(); - _lock = new Mutex(Mutex::tty, + _lock = new Mutex(Mutex::event, /* The lowest lock rank I could find */ "GCLogPrecious Lock", true, Mutex::_safepoint_check_never); @@ -77,11 +77,23 @@ void GCLogPrecious::vwrite_and_debug(LogTargetHandle log, } void GCLogPrecious::print_on_error(outputStream* st) { - if (_lines != NULL) { - MutexLocker locker(_lock, Mutex::_no_safepoint_check_flag); - if (_lines->size() > 0) { - st->print_cr("GC Precious Log:"); - st->print_cr("%s", _lines->base()); - } + st->print_cr("GC Precious Log:"); + + if (_lines == NULL) { + st->print_cr("\n"); + return; + } + + if (!_lock->try_lock_without_rank_check()) { + st->print_cr("\n"); + return; } + + if (_lines->size() == 0) { + st->print_cr("\n"); + } else { + st->print_cr("%s", _lines->base()); + } + + _lock->unlock(); } From cfb50a9cb7da16375a26c3f147ebd17ca393f914 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 2 Dec 2020 13:40:26 +0000 Subject: [PATCH 023/504] 8253916: ResourceExhausted/resexhausted001 crashes on Linux-x64 Reviewed-by: stuefe, sspitsyn, dholmes --- src/hotspot/share/runtime/stackOverflow.cpp | 5 +---- src/hotspot/share/utilities/debug.hpp | 3 ++- src/hotspot/share/utilities/vmError.cpp | 4 +++- test/hotspot/jtreg/ProblemList.txt | 2 -- .../ResourceExhausted/resexhausted001/TestDescription.java | 3 ++- .../ResourceExhausted/resexhausted004/TestDescription.java | 3 ++- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hotspot/share/runtime/stackOverflow.cpp b/src/hotspot/share/runtime/stackOverflow.cpp index 01aba3ea2de47..942f3a29e3fda 100644 --- a/src/hotspot/share/runtime/stackOverflow.cpp +++ b/src/hotspot/share/runtime/stackOverflow.cpp @@ -103,10 +103,7 @@ void StackOverflow::create_stack_guard_pages() { } else { log_warning(os, thread)("Attempt to protect stack guard pages failed (" PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len)); - if (os::uncommit_memory((char *) low_addr, len)) { - log_warning(os, thread)("Attempt to deallocate stack guard pages failed."); - } - return; + vm_exit_out_of_memory(len, OOM_MPROTECT_ERROR, "memory to guard stack pages"); } log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages activated: " diff --git a/src/hotspot/share/utilities/debug.hpp b/src/hotspot/share/utilities/debug.hpp index cd44aea2781f9..8f6858ac58917 100644 --- a/src/hotspot/share/utilities/debug.hpp +++ b/src/hotspot/share/utilities/debug.hpp @@ -149,7 +149,8 @@ do { enum VMErrorType { INTERNAL_ERROR = 0xe0000000, OOM_MALLOC_ERROR = 0xe0000001, - OOM_MMAP_ERROR = 0xe0000002 + OOM_MMAP_ERROR = 0xe0000002, + OOM_MPROTECT_ERROR = 0xe0000003 }; // Set to suppress secondary error reporting. diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 16e3b8e11c212..9b0dc413bcda9 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -510,10 +510,12 @@ void VMError::report(outputStream* st, bool _verbose) { switch(static_cast(_id)) { case OOM_MALLOC_ERROR: case OOM_MMAP_ERROR: + case OOM_MPROTECT_ERROR: if (_size) { st->print("# Native memory allocation "); st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : - "(mmap) failed to map "); + (_id == (int)OOM_MMAP_ERROR) ? "(mmap) failed to map " : + "(mprotect) failed to protect "); jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); st->print("%s", buf); st->print(" bytes"); diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 75fbead6ab989..4c45915438d21 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -131,8 +131,6 @@ vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_99m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_default/TestDescription.java 8208250 generic-all -vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java 8253916 linux-all -vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java 8253916 linux-all vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 generic-all vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/TestDescription.java 8219652 aix-ppc64 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java index c86d34c9b2c2b..58a1867a9fc77 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java @@ -24,6 +24,7 @@ /* * @test + * @bug 8253916 * * @summary converted from VM Testbase nsk/jvmti/ResourceExhausted/resexhausted001. * VM Testbase keywords: [jpda, jvmti, noras, vm6, nonconcurrent, quarantine, exclude] @@ -37,7 +38,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm/native/timeout=240 + * @run main/othervm/native/manual/timeout=240 * -agentlib:resexhausted=-waittime=5 * -XX:-UseGCOverheadLimit * -Xms16m diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java index 8b53a5627d523..e795bf1f9d4aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java @@ -24,6 +24,7 @@ /* * @test + * @bug 8253916 * * @key randomness * @summary converted from VM Testbase nsk/jvmti/ResourceExhausted/resexhausted004. @@ -39,7 +40,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm/native + * @run main/othervm/native/manual * -agentlib:resexhausted=-waittime=5 * -Xms16m * -Xmx16m From 2508bc7c58b631c41f1c2415dd9925d9d309dbe8 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 2 Dec 2020 14:09:55 +0000 Subject: [PATCH 024/504] 8257140: Crash in JvmtiTagMap::flush_object_free_events() Reviewed-by: sspitsyn, kbarrett --- src/hotspot/share/prims/jvmtiEnvBase.cpp | 10 +++++----- src/hotspot/share/prims/jvmtiTagMap.cpp | 8 ++++++++ src/hotspot/share/prims/jvmtiTagMap.hpp | 1 + src/hotspot/share/prims/jvmtiTagMapTable.cpp | 13 ++++++++++--- src/hotspot/share/prims/jvmtiTagMapTable.hpp | 1 + 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/prims/jvmtiEnvBase.cpp b/src/hotspot/share/prims/jvmtiEnvBase.cpp index 2065aa68f8c44..55ac65b614fa7 100644 --- a/src/hotspot/share/prims/jvmtiEnvBase.cpp +++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp @@ -256,11 +256,11 @@ JvmtiEnvBase::env_dispose() { // Same situation as with events (see above) set_native_method_prefixes(0, NULL); - JvmtiTagMap* tag_map_to_deallocate = _tag_map; - set_tag_map(NULL); - // A tag map can be big, deallocate it now - if (tag_map_to_deallocate != NULL) { - delete tag_map_to_deallocate; + JvmtiTagMap* tag_map_to_clear = tag_map_acquire(); + // A tag map can be big, clear it now to save memory until + // the destructor runs. + if (tag_map_to_clear != NULL) { + tag_map_to_clear->clear(); } _needs_clean_up = true; diff --git a/src/hotspot/share/prims/jvmtiTagMap.cpp b/src/hotspot/share/prims/jvmtiTagMap.cpp index a6c1b947b4a6b..a20ad93fbb73f 100644 --- a/src/hotspot/share/prims/jvmtiTagMap.cpp +++ b/src/hotspot/share/prims/jvmtiTagMap.cpp @@ -97,6 +97,14 @@ JvmtiTagMap::~JvmtiTagMap() { _hashmap = NULL; } +// Called by env_dispose() to reclaim memory before deallocation. +// Remove all the entries but keep the empty table intact. +// This needs the table lock. +void JvmtiTagMap::clear() { + MutexLocker ml(lock(), Mutex::_no_safepoint_check_flag); + _hashmap->clear(); +} + // returns the tag map for the given environments. If the tag map // doesn't exist then it is created. JvmtiTagMap* JvmtiTagMap::tag_map_for(JvmtiEnv* env) { diff --git a/src/hotspot/share/prims/jvmtiTagMap.hpp b/src/hotspot/share/prims/jvmtiTagMap.hpp index bce2f71c6c55f..ab5f9d7f2b62c 100644 --- a/src/hotspot/share/prims/jvmtiTagMap.hpp +++ b/src/hotspot/share/prims/jvmtiTagMap.hpp @@ -119,6 +119,7 @@ class JvmtiTagMap : public CHeapObj { static void gc_notification(size_t num_dead_entries) NOT_JVMTI_RETURN; void flush_object_free_events(); + void clear(); // Clear tagmap table after the env is disposed. // For ServiceThread static void flush_all_object_free_events() NOT_JVMTI_RETURN; diff --git a/src/hotspot/share/prims/jvmtiTagMapTable.cpp b/src/hotspot/share/prims/jvmtiTagMapTable.cpp index f9f22507ffcf0..90879a63cd9f2 100644 --- a/src/hotspot/share/prims/jvmtiTagMapTable.cpp +++ b/src/hotspot/share/prims/jvmtiTagMapTable.cpp @@ -49,9 +49,9 @@ oop JvmtiTagMapEntry::object_no_keepalive() { JvmtiTagMapTable::JvmtiTagMapTable() : Hashtable(_table_size, sizeof(JvmtiTagMapEntry)) {} -JvmtiTagMapTable::~JvmtiTagMapTable() { - // Delete this table - log_debug(jvmti, table)("JvmtiTagMapTable deleted"); +void JvmtiTagMapTable::clear() { + // Clear this table + log_debug(jvmti, table)("JvmtiTagMapTable cleared"); for (int i = 0; i < table_size(); ++i) { for (JvmtiTagMapEntry* m = bucket(i); m != NULL;) { JvmtiTagMapEntry* entry = m; @@ -59,11 +59,18 @@ JvmtiTagMapTable::~JvmtiTagMapTable() { m = m->next(); free_entry(entry); } + JvmtiTagMapEntry** p = bucket_addr(i); + *p = NULL; // clear out buckets. } assert(number_of_entries() == 0, "should have removed all entries"); assert(new_entry_free_list() == NULL, "entry present on JvmtiTagMapTable's free list"); } +JvmtiTagMapTable::~JvmtiTagMapTable() { + clear(); + // base class ~BasicHashtable deallocates the buckets. +} + // Entries are C_Heap allocated JvmtiTagMapEntry* JvmtiTagMapTable::new_entry(unsigned int hash, WeakHandle w, jlong tag) { JvmtiTagMapEntry* entry = (JvmtiTagMapEntry*)Hashtable::allocate_new_entry(hash, w); diff --git a/src/hotspot/share/prims/jvmtiTagMapTable.hpp b/src/hotspot/share/prims/jvmtiTagMapTable.hpp index 37f290d07f607..5f83f4e44c8ab 100644 --- a/src/hotspot/share/prims/jvmtiTagMapTable.hpp +++ b/src/hotspot/share/prims/jvmtiTagMapTable.hpp @@ -90,6 +90,7 @@ class JvmtiTagMapTable : public Hashtable { // Cleanup cleared entries and post void remove_dead_entries(JvmtiEnv* env, bool post_object_free); void rehash(); + void clear(); }; // A supporting class for iterating over all entries in Hashmap From 0b8c7807fe9381bf812ea5ae0ae051a46f35b6d8 Mon Sep 17 00:00:00 2001 From: Yumin Qi Date: Wed, 2 Dec 2020 16:22:51 +0000 Subject: [PATCH 025/504] 8256256: UL should not use heap allocation for output string Reviewed-by: dholmes, stuefe --- src/hotspot/share/logging/logTagSet.cpp | 51 +++++++++++++++++++------ 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/logging/logTagSet.cpp b/src/hotspot/share/logging/logTagSet.cpp index 2a2f640e0c660..53ee53bdfceae 100644 --- a/src/hotspot/share/logging/logTagSet.cpp +++ b/src/hotspot/share/logging/logTagSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,19 +121,48 @@ void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list args) { ret = os::vsnprintf(buf + prefix_len, sizeof(buf) - prefix_len, fmt, args); } else { // Buffer too small. Just call printf to find out the length for realloc below. - ret = os::vsnprintf(buf, sizeof(buf), fmt, args); + ret = os::vsnprintf(nullptr, 0, fmt, args); } + assert(ret >= 0, "Log message buffer issue"); - if ((size_t)ret >= sizeof(buf)) { - size_t newbuf_len = prefix_len + ret + 1; - char* newbuf = NEW_C_HEAP_ARRAY(char, newbuf_len, mtLogging); - prefix_len = _write_prefix(newbuf, newbuf_len); - ret = os::vsnprintf(newbuf + prefix_len, newbuf_len - prefix_len, fmt, saved_args); - assert(ret >= 0, "Log message buffer issue"); - log(level, newbuf); - FREE_C_HEAP_ARRAY(char, newbuf); - } else { + if (ret < 0) { + // Error, just log contents in buf. + log(level, buf); + log(level, "Log message buffer issue"); + va_end(saved_args); + return; + } + + + size_t newbuf_len = (size_t)ret + prefix_len + 1; // total bytes needed including prefix. + if (newbuf_len <= sizeof(buf)) { log(level, buf); + } else { + // Buffer too small, allocate a large enough buffer using malloc/free to avoid circularity. + char* newbuf = (char*)::malloc(newbuf_len * sizeof(char)); + if (newbuf != nullptr) { + prefix_len = _write_prefix(newbuf, newbuf_len); + ret = os::vsnprintf(newbuf + prefix_len, newbuf_len - prefix_len, fmt, saved_args); + assert(ret >= 0, "Log message newbuf issue"); + // log the contents in newbuf even with error happened. + log(level, newbuf); + if (ret < 0) { + log(level, "Log message newbuf issue"); + } + ::free(newbuf); + } else { + // Native OOM, use buf to output the least message. At this moment buf is full of either + // truncated prefix or truncated prefix + string. Put trunc_msg at the end of buf. + const char* trunc_msg = "..(truncated), native OOM"; + const size_t ltr = strlen(trunc_msg) + 1; + ret = os::snprintf(buf + sizeof(buf) - ltr, ltr, "%s", trunc_msg); + assert(ret >= 0, "Log message buffer issue"); + // log the contents in newbuf even with error happened. + log(level, buf); + if (ret < 0) { + log(level, "Log message buffer issue under OOM"); + } + } } va_end(saved_args); } From 670426646d3513f0b132b954a9e5cf22c37f3654 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 2 Dec 2020 16:56:55 +0000 Subject: [PATCH 026/504] 8257565: epsilonBarrierSet.hpp should not include barrierSetAssembler Reviewed-by: kbarrett, stuefe, shade --- src/hotspot/cpu/aarch64/aarch64.ad | 1 + src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp | 1 + src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index e3da0e72c8ea9..d89363099d318 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -1238,6 +1238,7 @@ definitions %{ source_hpp %{ #include "asm/macroAssembler.hpp" +#include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/collectedHeap.hpp" diff --git a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp index f41d79e102166..cbe58e692dc4f 100644 --- a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "asm/macroAssembler.hpp" #include "jvmci/jvmci.hpp" #include "jvmci/jvmciCodeInstaller.hpp" #include "jvmci/jvmciRuntime.hpp" diff --git a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp index f3c07f6cbbfd9..7a8083df6bb4a 100644 --- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp +++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_GC_EPSILON_EPSILONBARRIERSET_HPP #define SHARE_GC_EPSILON_EPSILONBARRIERSET_HPP -#include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/barrierSet.hpp" // No interaction with application is required for Epsilon, and therefore From 692b273ec53f54a879a4bbaad6c2f5f1d5358a71 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Wed, 2 Dec 2020 17:35:41 +0000 Subject: [PATCH 027/504] 8257189: Handle concurrent updates of MH.form better Reviewed-by: redestad, psandoz --- .../java/lang/invoke/DirectMethodHandle.java | 11 +-- .../classes/java/lang/invoke/Invokers.java | 16 ++--- .../classes/java/lang/invoke/LambdaForm.java | 3 + .../java/lang/invoke/MethodHandle.java | 67 +++++++++++++------ .../java/lang/invoke/MethodHandleImpl.java | 25 +++---- 5 files changed, 69 insertions(+), 53 deletions(-) diff --git a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java index e9eb5f86aaf85..a9ce7622e9b04 100644 --- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java @@ -36,6 +36,7 @@ import java.lang.ref.WeakReference; import java.util.Arrays; import java.util.Objects; +import java.util.function.Function; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.Kind.*; @@ -387,10 +388,12 @@ protected WeakReference computeValue(Class type) { private void ensureInitialized() { if (checkInitialized(member)) { // The coast is clear. Delete the barrier. - if (member.isField()) - updateForm(preparedFieldLambdaForm(member)); - else - updateForm(preparedLambdaForm(member)); + updateForm(new Function<>() { + public LambdaForm apply(LambdaForm oldForm) { + return (member.isField() ? preparedFieldLambdaForm(member) + : preparedLambdaForm(member)); + } + }); } } private static boolean checkInitialized(MemberName member) { diff --git a/src/java.base/share/classes/java/lang/invoke/Invokers.java b/src/java.base/share/classes/java/lang/invoke/Invokers.java index ee1f9baa3da94..3a9ef635181be 100644 --- a/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -596,21 +596,17 @@ static MethodHandle getCallSiteTarget(CallSite site) { @ForceInline /*non-public*/ static void checkCustomized(MethodHandle mh) { - if (MethodHandleImpl.isCompileConstant(mh)) return; - if (mh.form.customized == null) { - maybeCustomize(mh); + if (MethodHandleImpl.isCompileConstant(mh)) { + return; // no need to customize a MH when the instance is known to JIT + } + if (mh.form.customized == null) { // fast approximate check that the underlying form is already customized + maybeCustomize(mh); // marked w/ @DontInline } } @DontInline - /*non-public*/ static void maybeCustomize(MethodHandle mh) { - byte count = mh.customizationCount; - if (count >= CUSTOMIZE_THRESHOLD) { - mh.customize(); - } else { - mh.customizationCount = (byte)(count+1); - } + mh.maybeCustomize(); } // Local constant functions: diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/src/java.base/share/classes/java/lang/invoke/LambdaForm.java index 0f527b527d054..da52a39dcdbac 100644 --- a/src/java.base/share/classes/java/lang/invoke/LambdaForm.java +++ b/src/java.base/share/classes/java/lang/invoke/LambdaForm.java @@ -501,6 +501,9 @@ private static boolean namesOK(int arity, Name[] names) { /** Customize LambdaForm for a particular MethodHandle */ LambdaForm customize(MethodHandle mh) { + if (customized == mh) { + return this; + } LambdaForm customForm = new LambdaForm(arity, names, result, forceInline, mh, kind); if (COMPILE_THRESHOLD >= 0 && isCompiled) { // If shared LambdaForm has been compiled, compile customized version as well. diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java index e9f8dc918e2ce..04cbe9ca49b88 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java @@ -30,13 +30,13 @@ import java.lang.constant.ClassDesc; import java.lang.constant.Constable; -import java.lang.constant.ConstantDesc; import java.lang.constant.DirectMethodHandleDesc; import java.lang.constant.MethodHandleDesc; import java.lang.constant.MethodTypeDesc; import java.util.Arrays; import java.util.Objects; import java.util.Optional; +import java.util.function.Function; import static java.lang.invoke.MethodHandleInfo.*; import static java.lang.invoke.MethodHandleStatics.*; @@ -455,9 +455,8 @@ public abstract class MethodHandle implements Constable { /*private*/ MethodHandle asTypeCache; // asTypeCache is not private so that invokers can easily fetch it - /*non-public*/ - byte customizationCount; - // customizationCount should be accessible from invokers + + private byte customizationCount; /** * Reports the type of this method handle. @@ -1733,6 +1732,30 @@ Object internalProperties() { */ abstract BoundMethodHandle rebind(); + /* non-public */ + void maybeCustomize() { + if (form.customized == null) { + byte count = customizationCount; + if (count >= CUSTOMIZE_THRESHOLD) { + customize(); + } else { + customizationCount = (byte) (count + 1); + } + } + } + + /** Craft a LambdaForm customized for this particular MethodHandle. */ + /*non-public*/ + void customize() { + updateForm(new Function<>() { + public LambdaForm apply(LambdaForm oldForm) { + return oldForm.customize(MethodHandle.this); + } + }); + } + + private volatile boolean updateInProgress; // = false; + /** * Replace the old lambda form of this method handle with a new one. * The new one must be functionally equivalent to the old one. @@ -1741,26 +1764,26 @@ Object internalProperties() { * Use with discretion. */ /*non-public*/ - void updateForm(LambdaForm newForm) { - assert(newForm.customized == null || newForm.customized == this); - if (form == newForm) return; - newForm.prepare(); // as in MethodHandle. - UNSAFE.putReference(this, FORM_OFFSET, newForm); - UNSAFE.fullFence(); - } - - /** Craft a LambdaForm customized for this particular MethodHandle */ - /*non-public*/ - void customize() { - final LambdaForm form = this.form; - if (form.customized == null) { - LambdaForm newForm = form.customize(this); - updateForm(newForm); + void updateForm(Function updater) { + if (UNSAFE.compareAndSetBoolean(this, UPDATE_OFFSET, false, true)) { // updateInProgress = true + // Only 1 thread wins the race and updates MH.form field. + try { + LambdaForm oldForm = form; + LambdaForm newForm = updater.apply(oldForm); + if (oldForm != newForm) { + assert (newForm.customized == null || newForm.customized == this); + newForm.prepare(); // as in MethodHandle. + UNSAFE.putReference(this, FORM_OFFSET, newForm); + UNSAFE.fullFence(); + } + } finally { + updateInProgress = false; + } } else { - assert(form.customized == this); + // Update got lost due to concurrent update. But callers don't care. } } - private static final long FORM_OFFSET - = UNSAFE.objectFieldOffset(MethodHandle.class, "form"); + private static final long FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class, "form"); + private static final long UPDATE_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class, "updateInProgress"); } diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 45cec744792ab..29d3a699a4038 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -841,21 +841,9 @@ public MethodHandle asTypeUncached(MethodType newType) { return (asTypeCache = wrapper); } - // Customize target if counting happens for too long. - private int invocations = CUSTOMIZE_THRESHOLD; - private void maybeCustomizeTarget() { - int c = invocations; - if (c >= 0) { - if (c == 1) { - target.customize(); - } - invocations = c - 1; - } - } - boolean countDown() { int c = count; - maybeCustomizeTarget(); + target.maybeCustomize(); // customize if counting happens for too long if (c <= 1) { // Try to limit number of updates. MethodHandle.updateForm() doesn't guarantee LF update visibility. if (isCounting) { @@ -872,12 +860,15 @@ boolean countDown() { @Hidden static void maybeStopCounting(Object o1) { - CountingWrapper wrapper = (CountingWrapper) o1; + final CountingWrapper wrapper = (CountingWrapper) o1; if (wrapper.countDown()) { // Reached invocation threshold. Replace counting behavior with a non-counting one. - LambdaForm lform = wrapper.nonCountingFormProducer.apply(wrapper.target); - lform.compileToBytecode(); // speed up warmup by avoiding LF interpretation again after transition - wrapper.updateForm(lform); + wrapper.updateForm(new Function<>() { + public LambdaForm apply(LambdaForm oldForm) { + LambdaForm lform = wrapper.nonCountingFormProducer.apply(wrapper.target); + lform.compileToBytecode(); // speed up warmup by avoiding LF interpretation again after transition + return lform; + }}); } } From 93b6ab56ae1499616d38c0b62f4256f1d7c17ce5 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Wed, 2 Dec 2020 19:23:26 +0000 Subject: [PATCH 028/504] 8256818: SSLSocket that is never bound or connected leaks socket resources Reviewed-by: xuelei --- .../sun/security/ssl/SSLSocketImpl.java | 37 +++++++----- .../checkHandles/CheckHandles.java | 16 +++-- .../ssl/SSLSocketImpl/SSLSocketLeak.java | 59 +++++++++++++++++++ test/lib/jdk/test/lib/util/FileUtils.java | 32 +++++++--- .../jdk/test/lib/util/libFileUtils.c} | 2 +- 5 files changed, 114 insertions(+), 32 deletions(-) create mode 100644 test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java rename test/{jdk/java/lang/ProcessBuilder/checkHandles/libCheckHandles.c => lib/jdk/test/lib/util/libFileUtils.c} (93%) diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java index 0412d4f3eda39..439be80a1e6ed 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -553,7 +553,7 @@ public boolean isClosed() { // locks may be deadlocked. @Override public void close() throws IOException { - if (tlsIsClosed) { + if (isClosed()) { return; } @@ -562,19 +562,16 @@ public void close() throws IOException { } try { - // shutdown output bound, which may have been closed previously. - if (!isOutputShutdown()) { - duplexCloseOutput(); - } - - // shutdown input bound, which may have been closed previously. - if (!isInputShutdown()) { - duplexCloseInput(); - } + if (isConnected()) { + // shutdown output bound, which may have been closed previously. + if (!isOutputShutdown()) { + duplexCloseOutput(); + } - if (!isClosed()) { - // close the connection directly - closeSocket(false); + // shutdown input bound, which may have been closed previously. + if (!isInputShutdown()) { + duplexCloseInput(); + } } } catch (IOException ioe) { // ignore the exception @@ -582,7 +579,19 @@ public void close() throws IOException { SSLLogger.warning("SSLSocket duplex close failed", ioe); } } finally { - tlsIsClosed = true; + if (!isClosed()) { + // close the connection directly + try { + closeSocket(false); + } catch (IOException ioe) { + // ignore the exception + if (SSLLogger.isOn && SSLLogger.isOn("ssl")) { + SSLLogger.warning("SSLSocket close failed", ioe); + } + } finally { + tlsIsClosed = true; + } + } } } diff --git a/test/jdk/java/lang/ProcessBuilder/checkHandles/CheckHandles.java b/test/jdk/java/lang/ProcessBuilder/checkHandles/CheckHandles.java index 14d6b4383cdab..69686573be51f 100644 --- a/test/jdk/java/lang/ProcessBuilder/checkHandles/CheckHandles.java +++ b/test/jdk/java/lang/ProcessBuilder/checkHandles/CheckHandles.java @@ -27,32 +27,30 @@ import java.io.InputStreamReader; import java.lang.ProcessHandle; +import jdk.test.lib.util.FileUtils; + /* * @test * @bug 8239893 * @summary Verify that handles for processes that terminate do not accumulate * @requires ((os.family == "windows") & (vm.compMode != "Xcomp")) + * @library /test/lib * @run main/othervm/native -Xint CheckHandles */ public class CheckHandles { - // Return the current process handle count - private static native long getProcessHandleCount(); - public static void main(String[] args) throws Exception { - System.loadLibrary("CheckHandles"); - System.out.println("mypid: " + ProcessHandle.current().pid()); // Warmup the process launch mechanism and vm to stabilize the number of handles in use int MAX_WARMUP = 20; - long prevCount = getProcessHandleCount(); + long prevCount = FileUtils.getProcessHandleCount(); for (int i = 0; i < MAX_WARMUP; i++) { oneProcess(); System.gc(); // an opportunity to close unreferenced handles sleep(10); - long count = getProcessHandleCount(); + long count = FileUtils.getProcessHandleCount(); if (count < 0) throw new AssertionError("getProcessHandleCount failed"); System.out.println("warmup handle delta: " + (count - prevCount)); @@ -61,7 +59,7 @@ public static void main(String[] args) throws Exception { System.out.println("Warmup done"); System.out.println(); - prevCount = getProcessHandleCount(); + prevCount = FileUtils.getProcessHandleCount(); long startHandles = prevCount; long maxHandles = startHandles; int MAX_SPAWN = 50; @@ -70,7 +68,7 @@ public static void main(String[] args) throws Exception { System.gc(); // an opportunity to close unreferenced handles sleep(10); - long count = getProcessHandleCount(); + long count = FileUtils.getProcessHandleCount(); if (count < 0) throw new AssertionError("getProcessHandleCount failed"); System.out.println("handle delta: " + (count - prevCount)); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java new file mode 100644 index 0000000000000..dcca7246bcf78 --- /dev/null +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 SAP SE. 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.IOException; + +import javax.net.SocketFactory; +import javax.net.ssl.SSLSocketFactory; + +import jdk.test.lib.util.FileUtils; + +/* + * @test + * @bug 8256818 + * @summary Test that creating and closing SSL Sockets without bind/connect + * will not leave leaking socket file descriptors + * @library /test/lib + * @run main/othervm SSLSocketLeak + */ +public class SSLSocketLeak { + + private static final int NUM_TEST_SOCK = 500; + + public static void main(String[] args) throws IOException { + long fds_start = FileUtils.getProcessHandleCount(); + System.out.println("FDs at the beginning: " + fds_start); + + SocketFactory f = SSLSocketFactory.getDefault(); + for (int i = 0; i < NUM_TEST_SOCK; i++) { + f.createSocket().close(); + } + + long fds_end = FileUtils.getProcessHandleCount(); + System.out.println("FDs in the end: " + fds_end); + + if ((fds_end - fds_start) > (NUM_TEST_SOCK / 10)) { + throw new RuntimeException("Too many open file descriptors. Looks leaky."); + } + } +} diff --git a/test/lib/jdk/test/lib/util/FileUtils.java b/test/lib/jdk/test/lib/util/FileUtils.java index 5997696fa0188..14b70076af258 100644 --- a/test/lib/jdk/test/lib/util/FileUtils.java +++ b/test/lib/jdk/test/lib/util/FileUtils.java @@ -23,34 +23,34 @@ package jdk.test.lib.util; -import jdk.test.lib.Platform; - import java.io.BufferedReader; -import java.io.InputStreamReader; import java.io.IOException; +import java.io.InputStreamReader; import java.io.PrintStream; import java.io.UncheckedIOException; import java.lang.ProcessBuilder.Redirect; +import java.lang.management.ManagementFactory; import java.nio.file.DirectoryNotEmptyException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.time.Instant; -import java.time.Duration; -import java.util.Arrays; import java.util.ArrayList; -import java.util.ArrayDeque; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.TimeUnit; + +import jdk.test.lib.Platform; + +import com.sun.management.UnixOperatingSystemMXBean; /** * Common library for various test file utility functions. @@ -59,6 +59,7 @@ public final class FileUtils { private static final boolean IS_WINDOWS = Platform.isWindows(); private static final int RETRY_DELETE_MILLIS = IS_WINDOWS ? 500 : 0; private static final int MAX_RETRY_DELETE_TIMES = IS_WINDOWS ? 15 : 0; + private static volatile boolean nativeLibLoaded; /** * Deletes a file, retrying if necessary. @@ -363,6 +364,21 @@ public static void listFileDescriptors(PrintStream ps) { }); } + // Return the current process handle count + public static long getProcessHandleCount() { + if (IS_WINDOWS) { + if (!nativeLibLoaded) { + System.loadLibrary("FileUtils"); + nativeLibLoaded = true; + } + return getWinProcessHandleCount(); + } else { + return ((UnixOperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean()).getOpenFileDescriptorCount(); + } + } + + private static native long getWinProcessHandleCount(); + // Possible command locations and arguments static String[][] lsCommands = new String[][] { {"/usr/bin/lsof", "-p"}, diff --git a/test/jdk/java/lang/ProcessBuilder/checkHandles/libCheckHandles.c b/test/lib/jdk/test/lib/util/libFileUtils.c similarity index 93% rename from test/jdk/java/lang/ProcessBuilder/checkHandles/libCheckHandles.c rename to test/lib/jdk/test/lib/util/libFileUtils.c index d23d3db6a10de..1af90afff49eb 100644 --- a/test/jdk/java/lang/ProcessBuilder/checkHandles/libCheckHandles.c +++ b/test/lib/jdk/test/lib/util/libFileUtils.c @@ -29,7 +29,7 @@ #include "jni.h" #include -JNIEXPORT jlong JNICALL Java_CheckHandles_getProcessHandleCount(JNIEnv *env) +JNIEXPORT jlong JNICALL Java_jdk_test_lib_util_FileUtils_getWinProcessHandleCount(JNIEnv *env) { DWORD handleCount; HANDLE handle = GetCurrentProcess(); From 3e89981d98b51b4012c492941bfdcf4106422632 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Wed, 2 Dec 2020 20:16:28 +0000 Subject: [PATCH 029/504] 8257623: vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java shouldn't use timeout Reviewed-by: sspitsyn, dcubed --- .../ResourceExhausted/resexhausted001/TestDescription.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java index 58a1867a9fc77..3642f3ceb0ed1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java @@ -38,7 +38,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm/native/manual/timeout=240 + * @run main/othervm/native/manual * -agentlib:resexhausted=-waittime=5 * -XX:-UseGCOverheadLimit * -Xms16m From 7104400ad8b5864d646d2b2792f1fdb20d35eaef Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Wed, 2 Dec 2020 21:47:27 +0000 Subject: [PATCH 030/504] 8257164: Share LambdaForms for VH linkers/invokers Reviewed-by: redestad, kvn, psandoz --- .../classes/java/lang/invoke/Invokers.java | 58 +++++++++++-------- .../java/lang/invoke/MethodHandleNatives.java | 2 +- .../java/lang/invoke/MethodTypeForm.java | 5 +- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/java.base/share/classes/java/lang/invoke/Invokers.java b/src/java.base/share/classes/java/lang/invoke/Invokers.java index 3a9ef635181be..65907fd52141c 100644 --- a/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -139,7 +139,7 @@ private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak, boolean MethodType mtype = targetType; MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class); - LambdaForm lform = varHandleMethodInvokerHandleForm(ak, mtype, isExact); + LambdaForm lform = varHandleMethodInvokerHandleForm(mtype, isExact); VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal()); MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad); @@ -346,20 +346,22 @@ static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int whi } - static MemberName varHandleInvokeLinkerMethod(VarHandle.AccessMode ak, MethodType mtype) { - LambdaForm lform; - if (mtype.parameterSlotCount() <= MethodType.MAX_MH_ARITY - MH_LINKER_ARG_APPENDED) { - lform = varHandleMethodGenericLinkerHandleForm(ak, mtype); - } else { - // TODO + static MemberName varHandleInvokeLinkerMethod(MethodType mtype) { + if (mtype.parameterSlotCount() > MethodType.MAX_MH_ARITY - MH_LINKER_ARG_APPENDED) { throw newInternalError("Unsupported parameter slot count " + mtype.parameterSlotCount()); } + LambdaForm lform = varHandleMethodGenericLinkerHandleForm(mtype); return lform.vmentry; } - private static LambdaForm varHandleMethodGenericLinkerHandleForm(VarHandle.AccessMode ak, - MethodType mtype) { - // TODO Cache form? + private static LambdaForm varHandleMethodGenericLinkerHandleForm(MethodType mtype) { + mtype = mtype.basicType(); // normalize Z to I, String to Object, etc. + + int which = MethodTypeForm.LF_VH_GEN_LINKER; + LambdaForm lform = mtype.form().cachedLambdaForm(which); + if (lform != null) { + return lform; + } final int THIS_VH = 0; final int ARG_BASE = THIS_VH + 1; @@ -396,19 +398,26 @@ private static LambdaForm varHandleMethodGenericLinkerHandleForm(VarHandle.Acces MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class) .basicType(); names[LINKER_CALL] = new Name(outCallType, outArgs); - LambdaForm lform = new LambdaForm(ARG_LIMIT + 1, names, VARHANDLE_LINKER); + lform = new LambdaForm(ARG_LIMIT + 1, names, VARHANDLE_LINKER); if (LambdaForm.debugNames()) { - String name = ak.methodName() + ":VarHandle_invoke_MT_" + - shortenSignature(basicTypeSignature(mtype)); + String name = "VarHandle_invoke_MT_" + shortenSignature(basicTypeSignature(mtype)); LambdaForm.associateWithDebugName(lform, name); } lform.compileToBytecode(); + + lform = mtype.form().setCachedLambdaForm(which, lform); + return lform; } - private static LambdaForm varHandleMethodInvokerHandleForm(VarHandle.AccessMode ak, - MethodType mtype, boolean isExact) { - // TODO Cache form? + private static LambdaForm varHandleMethodInvokerHandleForm(MethodType mtype, boolean isExact) { + mtype = mtype.basicType(); // normalize Z to I, String to Object, etc. + + int which = (isExact ? MethodTypeForm.LF_VH_EX_INVOKER : MethodTypeForm.LF_VH_GEN_INVOKER); + LambdaForm lform = mtype.form().cachedLambdaForm(which); + if (lform != null) { + return lform; + } final int THIS_MH = 0; final int CALL_VH = THIS_MH + 1; @@ -448,17 +457,18 @@ private static LambdaForm varHandleMethodInvokerHandleForm(VarHandle.AccessMode } MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class) - .basicType(); + .basicType(); names[LINKER_CALL] = new Name(outCallType, outArgs); Kind kind = isExact ? VARHANDLE_EXACT_INVOKER : VARHANDLE_INVOKER; - LambdaForm lform = new LambdaForm(ARG_LIMIT, names, kind); + lform = new LambdaForm(ARG_LIMIT, names, kind); if (LambdaForm.debugNames()) { - String name = ak.methodName() + - (isExact ? ":VarHandle_exactInvoker_" : ":VarHandle_invoker_") + - shortenSignature(basicTypeSignature(mtype)); + String name = (isExact ? "VarHandle_exactInvoker_" : "VarHandle_invoker_") + shortenSignature(basicTypeSignature(mtype)); LambdaForm.associateWithDebugName(lform, name); } lform.prepare(); + + lform = mtype.form().setCachedLambdaForm(which, lform); + return lform; } @@ -473,12 +483,10 @@ static MethodHandle checkVarHandleGenericType(VarHandle handle, VarHandle.Access // Test for exact match on invoker types // TODO match with erased types and add cast of return value to lambda form MethodHandle mh = handle.getMethodHandle(ad.mode); - if (mh.type() == ad.symbolicMethodTypeInvoker) { - return mh; - } - else { + if (mh.type() != ad.symbolicMethodTypeInvoker) { return mh.asType(ad.symbolicMethodTypeInvoker); } + return mh; } @ForceInline diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java index 0112120e98ed7..2d6925f206607 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -578,7 +578,7 @@ VarHandleGuards.class, getVarHandleGuardMethodName(guardType), // Fall back to lambda form linkage if guard method is not available // TODO Optionally log fallback ? } - return Invokers.varHandleInvokeLinkerMethod(ak, mtype); + return Invokers.varHandleInvokeLinkerMethod(mtype); } static String getVarHandleGuardMethodName(MethodType guardType) { String prefix = "guard_"; diff --git a/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java b/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java index ece336136e4d8..2c0e7f3d7d4e3 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java @@ -87,7 +87,10 @@ final class MethodTypeForm { LF_LOOP = 19, // loop LF_INVSPECIAL_IFC = 20, // DMH invokeSpecial of (private) interface method LF_INVNATIVE = 21, // NMH invokeNative - LF_LIMIT = 22; + LF_VH_EX_INVOKER = 22, // VarHandle exact invoker + LF_VH_GEN_INVOKER = 23, // VarHandle generic invoker + LF_VH_GEN_LINKER = 24, // VarHandle generic linker + LF_LIMIT = 25; /** Return the type corresponding uniquely (1-1) to this MT-form. * It might have any primitive returns or arguments, but will have no references except Object. From 3da30e991a741fd985d844afe1be5a09c5d7d4a1 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Wed, 2 Dec 2020 22:17:46 +0000 Subject: [PATCH 031/504] 8257241: CDS should not handle disableEagerInitialization for archived lambda proxy classes Reviewed-by: iklam, redestad, mchung --- .../classfile/systemDictionaryShared.cpp | 7 +- .../classfile/systemDictionaryShared.hpp | 3 +- src/hotspot/share/include/jvm.h | 3 +- src/hotspot/share/prims/jvm.cpp | 5 +- .../invoke/InnerClassLambdaMetafactory.java | 58 ++++---- .../lang/invoke/LambdaProxyClassArchive.java | 10 +- .../native/libjava/LambdaProxyClassArchive.c | 5 +- .../runtime/cds/appcds/LambdaEagerInit.java | 133 ++++++++++++++++++ .../test-classes/LambdaEagerInitTest.java | 86 +++++++++++ 9 files changed, 260 insertions(+), 50 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/test-classes/LambdaEagerInitTest.java diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 237116ce13e9a..9c68e5f1fe7b9 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -1684,8 +1684,7 @@ InstanceKlass* SystemDictionaryShared::get_shared_nest_host(InstanceKlass* lambd } InstanceKlass* SystemDictionaryShared::prepare_shared_lambda_proxy_class(InstanceKlass* lambda_ik, - InstanceKlass* caller_ik, - bool initialize, TRAPS) { + InstanceKlass* caller_ik, TRAPS) { Handle class_loader(THREAD, caller_ik->class_loader()); Handle protection_domain; PackageEntry* pkg_entry = get_package_entry_from_class_name(class_loader, caller_ik->name()); @@ -1726,9 +1725,7 @@ InstanceKlass* SystemDictionaryShared::prepare_shared_lambda_proxy_class(Instanc SystemDictionary::post_class_load_event(&class_load_start_event, loaded_lambda, ClassLoaderData::class_loader_data(class_loader())); } - if (initialize) { - loaded_lambda->initialize(CHECK_NULL); - } + loaded_lambda->initialize(CHECK_NULL); return loaded_lambda; } diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp index 92046292d752b..4da9beb834fb2 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.hpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp @@ -304,8 +304,7 @@ class SystemDictionaryShared: public SystemDictionary { Symbol* instantiated_method_type) NOT_CDS_RETURN_(NULL); static InstanceKlass* get_shared_nest_host(InstanceKlass* lambda_ik) NOT_CDS_RETURN_(NULL); static InstanceKlass* prepare_shared_lambda_proxy_class(InstanceKlass* lambda_ik, - InstanceKlass* caller_ik, - bool initialize, TRAPS) NOT_CDS_RETURN_(NULL); + InstanceKlass* caller_ik, TRAPS) NOT_CDS_RETURN_(NULL); static bool check_linking_constraints(InstanceKlass* klass, TRAPS) NOT_CDS_RETURN_(false); static void record_linking_constraint(Symbol* name, InstanceKlass* klass, Handle loader1, Handle loader2, TRAPS) NOT_CDS_RETURN; diff --git a/src/hotspot/share/include/jvm.h b/src/hotspot/share/include/jvm.h index f6e53e2dc3f8a..87e2c422fe533 100644 --- a/src/hotspot/share/include/jvm.h +++ b/src/hotspot/share/include/jvm.h @@ -194,8 +194,7 @@ JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env, jclass caller, jobject invokedType, jobject methodType, jobject implMethodMember, - jobject instantiatedMethodType, - jboolean initialize); + jobject instantiatedMethodType); JNIEXPORT jboolean JNICALL JVM_IsCDSDumpingEnabled(JNIEnv* env); diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 3bb1e7446b449..5c237dd6f243e 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -3825,8 +3825,7 @@ JVM_ENTRY(jclass, JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env, jobject invokedType, jobject methodType, jobject implMethodMember, - jobject instantiatedMethodType, - jboolean initialize)) + jobject instantiatedMethodType)) JVMWrapper("JVM_LookupLambdaProxyClassFromArchive"); #if INCLUDE_CDS @@ -3860,7 +3859,7 @@ JVM_ENTRY(jclass, JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env, method_type, m, instantiated_method_type); jclass jcls = NULL; if (lambda_ik != NULL) { - InstanceKlass* loaded_lambda = SystemDictionaryShared::prepare_shared_lambda_proxy_class(lambda_ik, caller_ik, initialize, THREAD); + InstanceKlass* loaded_lambda = SystemDictionaryShared::prepare_shared_lambda_proxy_class(lambda_ik, caller_ik, THREAD); jcls = loaded_lambda == NULL ? NULL : (jclass) JNIHandles::make_local(THREAD, loaded_lambda->java_mirror()); } return jcls; diff --git a/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java b/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java index a6dbe6ef23f49..4d073178494c1 100644 --- a/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java +++ b/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java @@ -271,37 +271,37 @@ public Constructor[] run() { * registers the lambda proxy class for including into the CDS archive. */ private Class spinInnerClass() throws LambdaConversionException { - // include lambda proxy class in CDS archive at dump time - if (CDS.isDumpingArchive()) { - Class innerClass = generateInnerClass(); - LambdaProxyClassArchive.register(targetClass, - samMethodName, - invokedType, - samMethodType, - implMethod, - instantiatedMethodType, - isSerializable, - markerInterfaces, - additionalBridges, - innerClass); - return innerClass; - } + // CDS does not handle disableEagerInitialization. + if (!disableEagerInitialization) { + // include lambda proxy class in CDS archive at dump time + if (CDS.isDumpingArchive()) { + Class innerClass = generateInnerClass(); + LambdaProxyClassArchive.register(targetClass, + samMethodName, + invokedType, + samMethodType, + implMethod, + instantiatedMethodType, + isSerializable, + markerInterfaces, + additionalBridges, + innerClass); + return innerClass; + } - // load from CDS archive if present - Class innerClass = LambdaProxyClassArchive.find(targetClass, - samMethodName, - invokedType, - samMethodType, - implMethod, - instantiatedMethodType, - isSerializable, - markerInterfaces, - additionalBridges, - !disableEagerInitialization); - if (innerClass == null) { - innerClass = generateInnerClass(); + // load from CDS archive if present + Class innerClass = LambdaProxyClassArchive.find(targetClass, + samMethodName, + invokedType, + samMethodType, + implMethod, + instantiatedMethodType, + isSerializable, + markerInterfaces, + additionalBridges); + if (innerClass != null) return innerClass; } - return innerClass; + return generateInnerClass(); } /** diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaProxyClassArchive.java b/src/java.base/share/classes/java/lang/invoke/LambdaProxyClassArchive.java index 438bfd0210f9d..40f1467c045d1 100644 --- a/src/java.base/share/classes/java/lang/invoke/LambdaProxyClassArchive.java +++ b/src/java.base/share/classes/java/lang/invoke/LambdaProxyClassArchive.java @@ -50,8 +50,7 @@ private static native Class findFromArchive(Class caller, MethodType invokedType, MethodType samMethodType, MemberName implMethod, - MethodType instantiatedMethodType, - boolean initialize); + MethodType instantiatedMethodType); /** * Registers the lambdaProxyClass into CDS archive. @@ -101,16 +100,15 @@ static Class find(Class caller, MethodType instantiatedMethodType, boolean isSerializable, Class[] markerInterfaces, - MethodType[] additionalBridges, - boolean initialize) { + MethodType[] additionalBridges) { if (CDS.isDumpingArchive()) throw new IllegalStateException("cannot load class from CDS archive at dump time"); - if (!loadedByBuiltinLoader(caller) || !initialize || + if (!loadedByBuiltinLoader(caller) || !CDS.isSharingEnabled() || isSerializable || markerInterfaces.length > 0 || additionalBridges.length > 0) return null; return findFromArchive(caller, invokedName, invokedType, samMethodType, - implMethod.internalMemberName(), instantiatedMethodType, initialize); + implMethod.internalMemberName(), instantiatedMethodType); } } diff --git a/src/java.base/share/native/libjava/LambdaProxyClassArchive.c b/src/java.base/share/native/libjava/LambdaProxyClassArchive.c index 5d87535926ef4..b77376602f889 100644 --- a/src/java.base/share/native/libjava/LambdaProxyClassArchive.c +++ b/src/java.base/share/native/libjava/LambdaProxyClassArchive.c @@ -51,9 +51,8 @@ Java_java_lang_invoke_LambdaProxyClassArchive_findFromArchive(JNIEnv *env, jclas jobject invokedType, jobject methodType, jobject implMethodMember, - jobject instantiatedMethodType, - jboolean initialize) { + jobject instantiatedMethodType) { return JVM_LookupLambdaProxyClassFromArchive(env, caller, invokedName, invokedType, methodType, implMethodMember, - instantiatedMethodType, initialize); + instantiatedMethodType); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java b/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java new file mode 100644 index 0000000000000..79667bc4df1cc --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2020, 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 8257241 + * @summary Run the LambdaEagerInitTest.java test in static CDS archive mode. + * Create a custom base archive with the -Djdk.internal.lambda.disableEagerInitialization=true property. + * Run with the custom base archive with and without specifying the property. + * With the disableEagerInit set to true during dump time, lambda proxy classes + * will not be archived. During runtime, lambda proxy classes will not be loaded + * from the archive. + * Run with the default CDS archive, lambda proxy classes will be loaded + * from the archive if the property is not set. + * @requires vm.cds + * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds test-classes + * @run main/othervm LambdaEagerInit + */ + +import java.io.File; + +import jdk.test.lib.cds.CDSOptions; +import jdk.test.lib.cds.CDSTestUtils; +import jdk.test.lib.process.OutputAnalyzer; + +public class LambdaEagerInit { + public static void main(String[] args) throws Exception { + createArchiveWithEagerInitializationEnabled(); + testWithEagerInitializationEnabled(); + testWithEagerInitializationDisabled(); + // Skip testing with default CDS archive on aarch64 platform because + // default archive isn't being generated on that platform. + if (!("aarch64".equals(System.getProperty("os.arch")))) { + testDefaultArchiveWithEagerInitializationEnabled(); + testDefaultArchiveWithEagerInitializationDisabled(); + } + } + + private static final String classDir = System.getProperty("test.classes"); + private static final String mainClass = LambdaEagerInitTest.class.getName(); + private static final String testProperty = "-Djdk.internal.lambda.disableEagerInitialization=true"; + private static final String lambdaNotLoadedFromArchive = + ".class.load. java.util.stream.Collectors[$][$]Lambda[$].*/0x.*source:.*java.*util.*stream.*Collectors"; + private static final String lambdaLoadedFromArchive = + ".class.load. java.util.stream.Collectors[$][$]Lambda[$].*/0x.*source:.*shared.*objects.*file"; + private static final String cdsLoadedLambdaProxy = ".cds.*Loaded.*lambda.*proxy"; + private static final String archiveName = mainClass + ".jsa"; + private static String appJar; + + static void createArchiveWithEagerInitializationEnabled() throws Exception { + appJar = JarBuilder.build("lambda_eager", new File(classDir), null); + + // create base archive with the -Djdk.internal.lambda.disableEagerInitialization=true property + CDSOptions opts = (new CDSOptions()) + .addPrefix(testProperty, + "-Xlog:class+load,cds") + .setArchiveName(archiveName); + CDSTestUtils.createArchiveAndCheck(opts); + } + + static void testWithEagerInitializationEnabled() throws Exception { + // run with custom base archive with the -Djdk.internal.lambda.disableEagerInitialization=true property + CDSOptions runOpts = (new CDSOptions()) + .addPrefix("-cp", appJar, testProperty, "-Xlog:class+load,cds=debug") + .setArchiveName(archiveName) + .setUseVersion(false) + .addSuffix(mainClass); + OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output.shouldMatch(lambdaNotLoadedFromArchive) + .shouldNotMatch(cdsLoadedLambdaProxy) + .shouldHaveExitValue(0); + } + + static void testWithEagerInitializationDisabled() throws Exception { + // run with custom base archive without the -Djdk.internal.lambda.disableEagerInitialization=true property + CDSOptions runOpts = (new CDSOptions()) + .addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug") + .setArchiveName(archiveName) + .setUseVersion(false) + .addSuffix(mainClass); + OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output.shouldMatch(lambdaNotLoadedFromArchive) + .shouldNotMatch(cdsLoadedLambdaProxy) + .shouldHaveExitValue(0); + } + + static void testDefaultArchiveWithEagerInitializationEnabled() throws Exception { + // run with default CDS archive with the -Djdk.internal.lambda.disableEagerInitialization=true property + CDSOptions runOpts = (new CDSOptions()) + .addPrefix("-cp", appJar, testProperty, "-Xlog:class+load,cds=debug") + .setUseSystemArchive(true) + .setUseVersion(false) + .addSuffix(mainClass); + OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output.shouldMatch(lambdaNotLoadedFromArchive) + .shouldNotMatch(cdsLoadedLambdaProxy) + .shouldHaveExitValue(0); + } + + static void testDefaultArchiveWithEagerInitializationDisabled() throws Exception { + // run with default CDS archive without the -Djdk.internal.lambda.disableEagerInitialization=true property + CDSOptions runOpts = (new CDSOptions()) + .addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug") + .setUseSystemArchive(true) + .setUseVersion(false) + .addSuffix(mainClass); + OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts); + output.shouldMatch(lambdaLoadedFromArchive) + .shouldMatch(cdsLoadedLambdaProxy) + .shouldHaveExitValue(0); + } +} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/LambdaEagerInitTest.java b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/LambdaEagerInitTest.java new file mode 100644 index 0000000000000..c40b07db41e05 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/LambdaEagerInitTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2020, 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. + */ + +/* + * This file is copied from open/test/jdk/java/lang/invoke/lambda. + * It is being used as the main class for the appcds/LambdaEagerInit.java test. + */ + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +import static jdk.test.lib.Asserts.*; + +public class LambdaEagerInitTest { + + interface H {Object m(String s);} + + private static Set allowedStaticFields(boolean nonCapturing) { + Set s = new HashSet<>(); + if (Boolean.getBoolean("jdk.internal.lambda.disableEagerInitialization")) { + if (nonCapturing) s.add("LAMBDA_INSTANCE$"); + } + return s; + } + + private void nonCapturingLambda() { + H la = s -> s; + assertEquals("hi", la.m("hi")); + Class c1 = la.getClass(); + verifyLambdaClass(la.getClass(), true); + } + + private void capturingLambda() { + H la = s -> concat(s, "foo"); + assertEquals("hi foo", la.m("hi")); + verifyLambdaClass(la.getClass(), false); + } + + private void verifyLambdaClass(Class c, boolean nonCapturing) { + Set staticFields = new HashSet<>(); + Set instanceFields = new HashSet<>(); + for (Field f : c.getDeclaredFields()) { + if (Modifier.isStatic(f.getModifiers())) { + staticFields.add(f.getName()); + } else { + instanceFields.add(f.getName()); + } + } + assertEquals(instanceFields.size(), nonCapturing ? 0 : 1, "Unexpected instance fields"); + assertEquals(staticFields, allowedStaticFields(nonCapturing), "Unexpected static fields"); + } + + private String concat(String... ss) { + return Arrays.stream(ss).collect(Collectors.joining(" ")); + } + + public static void main(String[] args) { + LambdaEagerInitTest test = new LambdaEagerInitTest(); + test.nonCapturingLambda(); + test.capturingLambda(); + } +} From cc1915b3b320d9729772a81642cf5ca6563094cd Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Wed, 2 Dec 2020 23:10:32 +0000 Subject: [PATCH 032/504] 8253821: Improve ByteBuffer performance with GCM Reviewed-by: xuelei, valeriep --- .../com/sun/crypto/provider/AESCipher.java | 41 +- .../com/sun/crypto/provider/CipherCore.java | 59 +- .../sun/crypto/provider/FeedbackCipher.java | 24 + .../classes/com/sun/crypto/provider/GCTR.java | 114 ++- .../com/sun/crypto/provider/GHASH.java | 33 + .../crypto/provider/GaloisCounterMode.java | 475 +++++++++- .../provider/Cipher/AEAD/GCMBufferTest.java | 851 ++++++++++++++++++ .../Cipher/AEAD/GCMIncrementByte4.java | 43 + .../Cipher/AEAD/GCMIncrementDirect4.java | 41 + .../Cipher/AEAD/OverlapByteBuffer.java | 159 ++++ .../provider/Cipher/AEAD/SameBuffer.java | 11 + .../provider/Cipher/AES/TestKATForGCM.java | 239 +++-- .../TextLength/SameBufferOverwrite.java | 128 +++ .../CipherByteBufferOverwriteTest.java | 58 +- .../ssl/SSLSession/CheckSessionContext.java | 21 + 15 files changed, 2137 insertions(+), 160 deletions(-) create mode 100644 test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMBufferTest.java create mode 100644 test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementByte4.java create mode 100644 test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementDirect4.java create mode 100644 test/jdk/com/sun/crypto/provider/Cipher/AEAD/OverlapByteBuffer.java create mode 100644 test/jdk/com/sun/crypto/provider/Cipher/TextLength/SameBufferOverwrite.java diff --git a/src/java.base/share/classes/com/sun/crypto/provider/AESCipher.java b/src/java.base/share/classes/com/sun/crypto/provider/AESCipher.java index e7669109e1294..d0f9f9886b1d4 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/AESCipher.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/AESCipher.java @@ -25,12 +25,21 @@ package com.sun.crypto.provider; -import java.security.*; -import java.security.spec.*; -import javax.crypto.*; -import javax.crypto.spec.*; import javax.crypto.BadPaddingException; +import javax.crypto.CipherSpi; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.ShortBufferException; import java.nio.ByteBuffer; +import java.security.AlgorithmParameters; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.security.ProviderException; +import java.security.SecureRandom; +import java.security.spec.AlgorithmParameterSpec; /** * This class implements the AES algorithm in its various modes @@ -411,6 +420,7 @@ protected int engineUpdate(byte[] input, int inputOffset, int inputLen, outputOffset); } + /** * Encrypts or decrypts data in a single-part operation, * or finishes a multiple-part operation. @@ -641,5 +651,26 @@ protected void engineUpdateAAD(ByteBuffer src) { } } } -} + /** + * Finalize crypto operation with ByteBuffers + * + * @param input the input ByteBuffer + * @param output the output ByteBuffer + * + * @return output length + * @throws ShortBufferException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + @Override + protected int engineDoFinal(ByteBuffer input, ByteBuffer output) + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + if (core.getMode() == CipherCore.GCM_MODE && !input.hasArray()) { + return core.gcmDoFinal(input, output); + } else { + return super.engineDoFinal(input, output); + } + } +} diff --git a/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java b/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java index ddee737674a34..c804bcc00b2c6 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java @@ -25,6 +25,7 @@ package com.sun.crypto.provider; +import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Locale; @@ -722,8 +723,7 @@ int update(byte[] input, int inputOffset, int inputLen, byte[] output, len = (len > 0 ? (len - (len % unitBytes)) : 0); // check output buffer capacity - if ((output == null) || - ((output.length - outputOffset) < len)) { + if (output == null || (output.length - outputOffset) < len) { throw new ShortBufferException("Output buffer must be " + "(at least) " + len + " bytes long"); @@ -917,10 +917,10 @@ int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int estOutSize = getOutputSizeByOperation(inputLen, true); int outputCapacity = checkOutputCapacity(output, outputOffset, estOutSize); - int offset = decrypting ? 0 : outputOffset; // 0 for decrypting + int offset = outputOffset; byte[] finalBuf = prepareInputBuffer(input, inputOffset, inputLen, output, outputOffset); - byte[] outWithPadding = null; // for decrypting only + byte[] internalOutput = null; // for decrypting only int finalOffset = (finalBuf == input) ? inputOffset : 0; int finalBufLen = (finalBuf == input) ? inputLen : finalBuf.length; @@ -934,11 +934,14 @@ int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, if (outputCapacity < estOutSize) { cipher.save(); } - // create temporary output buffer so that only "real" - // data bytes are passed to user's output buffer. - outWithPadding = new byte[estOutSize]; + if (getMode() != GCM_MODE || outputCapacity < estOutSize) { + // create temporary output buffer if the estimated size is larger + // than the user-provided buffer. + internalOutput = new byte[estOutSize]; + offset = 0; + } } - byte[] outBuffer = decrypting ? outWithPadding : output; + byte[] outBuffer = (internalOutput != null) ? internalOutput : output; int outLen = fillOutputBuffer(finalBuf, finalOffset, outBuffer, offset, finalBufLen, input); @@ -954,9 +957,11 @@ int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, + " bytes needed"); } // copy the result into user-supplied output buffer - System.arraycopy(outWithPadding, 0, output, outputOffset, outLen); - // decrypt mode. Zero out output data that's not required - Arrays.fill(outWithPadding, (byte) 0x00); + if (internalOutput != null) { + System.arraycopy(internalOutput, 0, output, outputOffset, outLen); + // decrypt mode. Zero out output data that's not required + Arrays.fill(internalOutput, (byte) 0x00); + } } endDoFinal(); return outLen; @@ -970,16 +975,15 @@ private void endDoFinal() { } } - private int unpad(int outLen, byte[] outWithPadding) + private int unpad(int outLen, int off, byte[] outWithPadding) throws BadPaddingException { - int padStart = padding.unpad(outWithPadding, 0, outLen); + int padStart = padding.unpad(outWithPadding, off, outLen); if (padStart < 0) { throw new BadPaddingException("Given final block not " + "properly padded. Such issues can arise if a bad key " + "is used during decryption."); } - outLen = padStart; - return outLen; + return padStart - off; } private byte[] prepareInputBuffer(byte[] input, int inputOffset, @@ -1055,7 +1059,7 @@ private int fillOutputBuffer(byte[] finalBuf, int finalOffset, len = finalNoPadding(finalBuf, finalOffset, output, outOfs, finalBufLen); if (decrypting && padding != null) { - len = unpad(len, output); + len = unpad(len, outOfs, output); } return len; } finally { @@ -1225,4 +1229,27 @@ void updateAAD(byte[] src, int offset, int len) { checkReinit(); cipher.updateAAD(src, offset, len); } + + // This must only be used with GCM. + // If some data has been buffered from an update call, operate on the buffer + // then run doFinal. + int gcmDoFinal(ByteBuffer src, ByteBuffer dst) throws ShortBufferException, + IllegalBlockSizeException, BadPaddingException { + int estOutSize = getOutputSizeByOperation(src.remaining(), true); + if (estOutSize > dst.remaining()) { + throw new ShortBufferException("output buffer too small"); + } + + if (decrypting) { + if (buffered > 0) { + cipher.decrypt(buffer, 0, buffered, new byte[0], 0); + } + return cipher.decryptFinal(src, dst); + } else { + if (buffered > 0) { + ((GaloisCounterMode)cipher).encrypt(buffer, 0, buffered); + } + return cipher.encryptFinal(src, dst); + } + } } diff --git a/src/java.base/share/classes/com/sun/crypto/provider/FeedbackCipher.java b/src/java.base/share/classes/com/sun/crypto/provider/FeedbackCipher.java index a6d46adf0e391..c7bb57664a153 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/FeedbackCipher.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/FeedbackCipher.java @@ -25,6 +25,7 @@ package com.sun.crypto.provider; +import java.nio.ByteBuffer; import java.security.InvalidKeyException; import java.security.InvalidAlgorithmParameterException; import javax.crypto.*; @@ -242,4 +243,27 @@ int getBufferedLength() { // internally during decryption mode return 0; } + + /* + * ByteBuffer methods should not be accessed as CipherCore and AESCipher + * copy the data to byte arrays. These methods are to satisfy the compiler. + */ + int encrypt(ByteBuffer src, ByteBuffer dst) { + throw new UnsupportedOperationException("ByteBuffer not supported"); + }; + + int decrypt(ByteBuffer src, ByteBuffer dst) { + throw new UnsupportedOperationException("ByteBuffer not supported"); + }; + + int encryptFinal(ByteBuffer src, ByteBuffer dst) + throws IllegalBlockSizeException, ShortBufferException { + throw new UnsupportedOperationException("ByteBuffer not supported"); + }; + + int decryptFinal(ByteBuffer src, ByteBuffer dst) + throws IllegalBlockSizeException, AEADBadTagException, + ShortBufferException { + throw new UnsupportedOperationException("ByteBuffer not supported"); + } } diff --git a/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java b/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java index 60d26083b7fed..1a09a617a4d45 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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 @@ -54,11 +54,15 @@ */ final class GCTR extends CounterMode { + // Maximum buffer size rotating ByteBuffer->byte[] intrinsic copy + private static final int MAX_LEN = 1024; + GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) { super(cipher); if (initialCounterBlk.length != AES_BLOCK_SIZE) { - throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length + - ") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")"); + throw new RuntimeException("length of initial counter block (" + + initialCounterBlk.length + ") not equal to AES_BLOCK_SIZE (" + + AES_BLOCK_SIZE + ")"); } iv = initialCounterBlk; @@ -112,9 +116,89 @@ int update(byte[] in, int inOfs, int inLen, byte[] out, int outOfs) { } } + // input must be multiples of AES blocks, 128-bit, when calling update + int update(byte[] in, int inOfs, int inLen, ByteBuffer dst) { + if (inLen - inOfs > in.length) { + throw new RuntimeException("input length out of bound"); + } + if (inLen < 0 || inLen % AES_BLOCK_SIZE != 0) { + throw new RuntimeException("input length unsupported"); + } + // See GaloisCounterMode. decryptFinal(bytebuffer, bytebuffer) for + // details on the check for 'dst' having enough space for the result. + + long blocksLeft = blocksUntilRollover(); + int numOfCompleteBlocks = inLen / AES_BLOCK_SIZE; + if (numOfCompleteBlocks >= blocksLeft) { + // Counter Mode encryption cannot be used because counter will + // roll over incorrectly. Use GCM-specific code instead. + byte[] encryptedCntr = new byte[AES_BLOCK_SIZE]; + for (int i = 0; i < numOfCompleteBlocks; i++) { + embeddedCipher.encryptBlock(counter, 0, encryptedCntr, 0); + for (int n = 0; n < AES_BLOCK_SIZE; n++) { + int index = (i * AES_BLOCK_SIZE + n); + dst.put((byte) ((in[inOfs + index] ^ encryptedCntr[n]))); + } + GaloisCounterMode.increment32(counter); + } + return inLen; + } else { + int len = inLen - inLen % AES_BLOCK_SIZE; + int processed = len; + byte[] out = new byte[Math.min(MAX_LEN, len)]; + int offset = inOfs; + while (processed > MAX_LEN) { + encrypt(in, offset, MAX_LEN, out, 0); + dst.put(out, 0, MAX_LEN); + processed -= MAX_LEN; + offset += MAX_LEN; + } + encrypt(in, offset, processed, out, 0); + // If dst is less than blocksize, insert only what it can. Extra + // bytes would cause buffers with enough size to fail with a + // short buffer + dst.put(out, 0, Math.min(dst.remaining(), processed)); + return len; + } + } + + // input operates on multiples of AES blocks, 128-bit, when calling update. + // The remainder is left in the src buffer. + int update(ByteBuffer src, ByteBuffer dst) { + long blocksLeft = blocksUntilRollover(); + int numOfCompleteBlocks = src.remaining() / AES_BLOCK_SIZE; + if (numOfCompleteBlocks >= blocksLeft) { + // Counter Mode encryption cannot be used because counter will + // roll over incorrectly. Use GCM-specific code instead. + byte[] encryptedCntr = new byte[AES_BLOCK_SIZE]; + for (int i = 0; i < numOfCompleteBlocks; i++) { + embeddedCipher.encryptBlock(counter, 0, encryptedCntr, 0); + for (int n = 0; n < AES_BLOCK_SIZE; n++) { + dst.put((byte) (src.get() ^ encryptedCntr[n])); + } + GaloisCounterMode.increment32(counter); + } + return numOfCompleteBlocks * AES_BLOCK_SIZE; + } + + int len = src.remaining() - (src.remaining() % AES_BLOCK_SIZE); + int processed = len; + byte[] in = new byte[Math.min(MAX_LEN, len)]; + while (processed > MAX_LEN) { + src.get(in, 0, MAX_LEN); + encrypt(in, 0, MAX_LEN, in, 0); + dst.put(in, 0, MAX_LEN); + processed -= MAX_LEN; + } + src.get(in, 0, processed); + encrypt(in, 0, processed, in, 0); + dst.put(in, 0, processed); + return len; + } + // input can be arbitrary size when calling doFinal int doFinal(byte[] in, int inOfs, int inLen, byte[] out, - int outOfs) throws IllegalBlockSizeException { + int outOfs) throws IllegalBlockSizeException { try { if (inLen < 0) { throw new IllegalBlockSizeException("Negative input size!"); @@ -130,7 +214,7 @@ int doFinal(byte[] in, int inOfs, int inLen, byte[] out, for (int n = 0; n < lastBlockSize; n++) { out[outOfs + completeBlkLen + n] = (byte) ((in[inOfs + completeBlkLen + n] ^ - encryptedCntr[n])); + encryptedCntr[n])); } } } @@ -139,4 +223,24 @@ int doFinal(byte[] in, int inOfs, int inLen, byte[] out, } return inLen; } + + // src can be arbitrary size when calling doFinal + int doFinal(ByteBuffer src, ByteBuffer dst) { + int len = src.remaining(); + int lastBlockSize = len % AES_BLOCK_SIZE; + try { + update(src, dst); + if (lastBlockSize != 0) { + // do the last partial block + byte[] encryptedCntr = new byte[AES_BLOCK_SIZE]; + embeddedCipher.encryptBlock(counter, 0, encryptedCntr, 0); + for (int n = 0; n < lastBlockSize; n++) { + dst.put((byte) (src.get() ^ encryptedCntr[n])); + } + } + } finally { + reset(); + } + return len; + } } diff --git a/src/java.base/share/classes/com/sun/crypto/provider/GHASH.java b/src/java.base/share/classes/com/sun/crypto/provider/GHASH.java index 7ee114624eeff..e9ce33b6b582b 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/GHASH.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/GHASH.java @@ -29,6 +29,7 @@ package com.sun.crypto.provider; +import java.nio.ByteBuffer; import java.security.ProviderException; import jdk.internal.vm.annotation.IntrinsicCandidate; @@ -198,6 +199,38 @@ void update(byte[] in, int inOfs, int inLen) { processBlocks(in, inOfs, inLen/AES_BLOCK_SIZE, state, subkeyHtbl); } + // Maximum buffer size rotating ByteBuffer->byte[] intrinsic copy + private static final int MAX_LEN = 1024; + + // Will process as many blocks it can and will leave the remaining. + int update(ByteBuffer src, int inLen) { + inLen -= (inLen % AES_BLOCK_SIZE); + if (inLen == 0) { + return 0; + } + + int processed = inLen; + byte[] in = new byte[Math.min(MAX_LEN, inLen)]; + while (processed > MAX_LEN ) { + src.get(in, 0, MAX_LEN); + update(in, 0 , MAX_LEN); + processed -= MAX_LEN; + } + src.get(in, 0, processed); + update(in, 0, processed); + return inLen; + } + + void doLastBlock(ByteBuffer src, int inLen) { + int processed = update(src, inLen); + if (inLen == processed) { + return; + } + byte[] block = new byte[AES_BLOCK_SIZE]; + src.get(block, 0, inLen - processed); + update(block, 0, AES_BLOCK_SIZE); + } + private static void ghashRangeCheck(byte[] in, int inOfs, int inLen, long[] st, long[] subH) { if (inLen < 0) { throw new RuntimeException("invalid input length: " + inLen); diff --git a/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java b/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java index 178bdb024a2bc..cde13fff1c247 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java @@ -25,13 +25,21 @@ package com.sun.crypto.provider; -import java.util.Arrays; -import java.io.*; -import java.security.*; -import javax.crypto.*; -import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE; +import sun.nio.ch.DirectBuffer; import sun.security.util.ArrayUtil; +import javax.crypto.AEADBadTagException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.ShortBufferException; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.ProviderException; + +import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE; + /** * This class represents ciphers in GaloisCounter (GCM) mode. @@ -68,9 +76,12 @@ final class GaloisCounterMode extends FeedbackCipher { private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream(); private int sizeOfAAD = 0; - // buffer for storing input in decryption, not used for encryption + // buffer data for crypto operation private ByteArrayOutputStream ibuffer = null; + // Original dst buffer if there was an overlap situation + private ByteBuffer originalDst = null; + // in bytes; need to convert to bits (default value 128) when needed private int tagLenBytes = DEFAULT_TAG_LEN; @@ -177,8 +188,17 @@ private static byte[] getJ0(byte[] iv, byte[] subkeyH) { return j0; } - private static void checkDataLength(int processed, int len) { - if (processed > MAX_BUF_SIZE - len) { + /** + * Calculate if the given data lengths and the already processed data + * exceeds the maximum allowed processed data by GCM. + * @param lengths lengths of unprocessed data. + */ + private void checkDataLength(int ... lengths) { + int max = MAX_BUF_SIZE; + for (int len : lengths) { + max = Math.subtractExact(max, len); + } + if (processed > max) { throw new ProviderException("SunJCE provider only supports " + "input size up to " + MAX_BUF_SIZE + " bytes"); } @@ -426,6 +446,64 @@ void doLastBlock(byte[] in, int inOfs, int len, byte[] out, int outOfs, } } + // Process en/decryption all the way to the last block. It takes both + // For input it takes the ibuffer which is wrapped in 'buffer' and 'src' + // from doFinal. + void doLastBlock(ByteBuffer buffer, ByteBuffer src, ByteBuffer dst) + throws IllegalBlockSizeException { + + if (buffer != null && buffer.remaining() > 0) { + // en/decrypt on how much buffer there is in AES_BLOCK_SIZE + processed += gctrPAndC.update(buffer, dst); + + // Process the remainder in the buffer + if (buffer.remaining() > 0) { + // Copy the remainder of the buffer into the extra block + byte[] block = new byte[AES_BLOCK_SIZE]; + int over = buffer.remaining(); + int len = over; // how much is processed by in the extra block + buffer.get(block, 0, over); + + // if src is empty, update the final block and wait for later + // to finalize operation + if (src.remaining() > 0) { + // Fill out block with what is in data + if (src.remaining() > AES_BLOCK_SIZE - over) { + src.get(block, over, AES_BLOCK_SIZE - over); + len += AES_BLOCK_SIZE - over; + } else { + // If the remaining in buffer + data does not fill a + // block, complete the ghash operation + int l = src.remaining(); + src.get(block, over, l); + len += l; + } + } + gctrPAndC.update(block, 0, AES_BLOCK_SIZE, dst); + processed += len; + } + } + + // en/decrypt whatever remains in src. + // If src has been consumed, this will be a no-op + processed += gctrPAndC.doFinal(src, dst); + } + + /* + * This method is for CipherCore to insert the remainder of its buffer + * into the ibuffer before a doFinal(ByteBuffer, ByteBuffer) operation + */ + int encrypt(byte[] in, int inOfs, int len) { + if (len > 0) { + // store internally until encryptFinal + ArrayUtil.nullAndBoundsCheck(in, inOfs, len); + if (ibuffer == null) { + ibuffer = new ByteArrayOutputStream(); + } + ibuffer.write(in, inOfs, len); + } + return len; + } /** * Performs encryption operation. @@ -436,32 +514,93 @@ void doLastBlock(byte[] in, int inOfs, int len, byte[] out, int outOfs, * * @param in the buffer with the input data to be encrypted * @param inOfs the offset in in - * @param len the length of the input data + * @param inLen the length of the input data * @param out the buffer for the result * @param outOfs the offset in out - * @exception ProviderException if len is not - * a multiple of the block size * @return the number of bytes placed into the out buffer */ - int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { - ArrayUtil.blockSizeCheck(len, blockSize); - - checkDataLength(processed, len); + int encrypt(byte[] in, int inOfs, int inLen, byte[] out, int outOfs) { + checkDataLength(inLen, getBufferedLength()); + ArrayUtil.nullAndBoundsCheck(in, inOfs, inLen); + ArrayUtil.nullAndBoundsCheck(out, outOfs, inLen); processAAD(); + // 'inLen' stores the length to use with buffer 'in'. + // 'len' stores the length returned by the method. + int len = inLen; + + // if there is enough data in the ibuffer and 'in', encrypt it. + if (ibuffer != null && ibuffer.size() > 0) { + byte[] buffer = ibuffer.toByteArray(); + // number of bytes not filling a block + int remainder = ibuffer.size() % blockSize; + // number of bytes along block boundary + int blen = ibuffer.size() - remainder; + + // If there is enough bytes in ibuffer for a block or more, + // encrypt that first. + if (blen > 0) { + encryptBlocks(buffer, 0, blen, out, outOfs); + outOfs += blen; + } - if (len > 0) { - ArrayUtil.nullAndBoundsCheck(in, inOfs, len); - ArrayUtil.nullAndBoundsCheck(out, outOfs, len); + // blen is now the offset for 'buffer' + + // Construct and encrypt a block if there is enough 'buffer' and + // 'in' to make one + if ((inLen + remainder) >= blockSize) { + byte[] block = new byte[blockSize]; + + System.arraycopy(buffer, blen, block, 0, remainder); + int inLenUsed = blockSize - remainder; + System.arraycopy(in, inOfs, block, remainder, inLenUsed); + + encryptBlocks(block, 0, blockSize, out, outOfs); + inOfs += inLenUsed; + inLen -= inLenUsed; + len += (blockSize - inLenUsed); + outOfs += blockSize; + ibuffer.reset(); + // Code below will write the remainder from 'in' to ibuffer + } else if (remainder > 0) { + // If a block or more was encrypted from 'buffer' only, but the + // rest of 'buffer' with 'in' could not construct a block, then + // put the rest of 'buffer' back into ibuffer. + ibuffer.reset(); + ibuffer.write(buffer, blen, remainder); + // Code below will write the remainder from 'in' to ibuffer + } + // If blen == 0 and there was not enough to construct a block + // from 'buffer' and 'in', then let the below code append 'in' to + // the ibuffer. + } + + // Write any remaining bytes outside the blockSize into ibuffer. + int remainder = inLen % blockSize; + if (remainder > 0) { + if (ibuffer == null) { + ibuffer = new ByteArrayOutputStream(inLen % blockSize); + } + len -= remainder; + inLen -= remainder; + // remainder offset is based on original buffer length + ibuffer.write(in, inOfs + inLen, remainder); + } - gctrPAndC.update(in, inOfs, len, out, outOfs); - processed += len; - ghashAllToS.update(out, outOfs, len); + // Encrypt the remaining blocks inside of 'in' + if (inLen > 0) { + encryptBlocks(in, inOfs, inLen, out, outOfs); } return len; } + void encryptBlocks(byte[] in, int inOfs, int len, byte[] out, int outOfs) { + gctrPAndC.update(in, inOfs, len, out, outOfs); + processed += len; + ghashAllToS.update(out, outOfs, len); + } + /** * Performs encryption operation for the last time. * @@ -474,10 +613,8 @@ int encrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { */ int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs) throws IllegalBlockSizeException, ShortBufferException { - if (len > MAX_BUF_SIZE - tagLenBytes) { - throw new ShortBufferException - ("Can't fit both data and tag into one buffer"); - } + checkDataLength(len, getBufferedLength(), tagLenBytes); + try { ArrayUtil.nullAndBoundsCheck(out, outOfs, (len + tagLenBytes)); @@ -485,8 +622,6 @@ int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs) throw new ShortBufferException("Output buffer too small"); } - checkDataLength(processed, len); - processAAD(); if (len > 0) { ArrayUtil.nullAndBoundsCheck(in, inOfs, len); @@ -494,15 +629,45 @@ int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs) doLastBlock(in, inOfs, len, out, outOfs, true); } - byte[] lengthBlock = - getLengthBlock(sizeOfAAD, processed); - ghashAllToS.update(lengthBlock); - byte[] s = ghashAllToS.digest(); - byte[] sOut = new byte[s.length]; + byte[] block = getLengthBlock(sizeOfAAD, processed); + ghashAllToS.update(block); + block = ghashAllToS.digest(); GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock); - gctrForSToTag.doFinal(s, 0, s.length, sOut, 0); + gctrForSToTag.doFinal(block, 0, tagLenBytes, block, 0); + + System.arraycopy(block, 0, out, (outOfs + len), tagLenBytes); + return (len + tagLenBytes); + } + + int encryptFinal(ByteBuffer src, ByteBuffer dst) + throws IllegalBlockSizeException, ShortBufferException { + dst = overlapDetection(src, dst); + int len = src.remaining(); + len += getBufferedLength(); + + // 'len' includes ibuffer data + checkDataLength(len, tagLenBytes); + dst.mark(); + if (dst.remaining() < len + tagLenBytes) { + throw new ShortBufferException("Output buffer too small"); + } + + processAAD(); + if (len > 0) { + doLastBlock((ibuffer == null || ibuffer.size() == 0) ? + null : ByteBuffer.wrap(ibuffer.toByteArray()), src, dst); + dst.reset(); + ghashAllToS.doLastBlock(dst, len); + } + + byte[] block = getLengthBlock(sizeOfAAD, processed); + ghashAllToS.update(block); + block = ghashAllToS.digest(); + GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock); + gctrForSToTag.doFinal(block, 0, tagLenBytes, block, 0); + dst.put(block, 0, tagLenBytes); + restoreDst(dst); - System.arraycopy(sOut, 0, out, (outOfs + len), tagLenBytes); return (len + tagLenBytes); } @@ -524,10 +689,6 @@ int encryptFinal(byte[] in, int inOfs, int len, byte[] out, int outOfs) * @return the number of bytes placed into the out buffer */ int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { - ArrayUtil.blockSizeCheck(len, blockSize); - - checkDataLength(ibuffer.size(), len); - processAAD(); if (len > 0) { @@ -540,6 +701,19 @@ int decrypt(byte[] in, int inOfs, int len, byte[] out, int outOfs) { return 0; } + int decrypt(ByteBuffer src, ByteBuffer dst) { + if (src.remaining() > 0) { + byte[] b = new byte[src.remaining()]; + src.get(b); + try { + ibuffer.write(b); + } catch (IOException e) { + throw new ProviderException("Unable to add remaining input to the buffer", e); + } + } + return 0; + } + /** * Performs decryption operation for the last time. * @@ -566,11 +740,11 @@ int decryptFinal(byte[] in, int inOfs, int len, // do this check here can also catch the potential integer overflow // scenario for the subsequent output buffer capacity check. - checkDataLength(ibuffer.size(), (len - tagLenBytes)); + checkDataLength(getBufferedLength(), (len - tagLenBytes)); try { ArrayUtil.nullAndBoundsCheck(out, outOfs, - (ibuffer.size() + len) - tagLenBytes); + (getBufferedLength() + len) - tagLenBytes); } catch (ArrayIndexOutOfBoundsException aiobe) { throw new ShortBufferException("Output buffer too small"); } @@ -586,7 +760,7 @@ int decryptFinal(byte[] in, int inOfs, int len, // If decryption is in-place or there is buffered "ibuffer" data, copy // the "in" byte array into the ibuffer before proceeding. - if (in == out || ibuffer.size() > 0) { + if (in == out || getBufferedLength() > 0) { if (len > 0) { ibuffer.write(in, inOfs, len); } @@ -602,19 +776,16 @@ int decryptFinal(byte[] in, int inOfs, int len, doLastBlock(in, inOfs, len, out, outOfs, false); } - byte[] lengthBlock = - getLengthBlock(sizeOfAAD, processed); - ghashAllToS.update(lengthBlock); - - byte[] s = ghashAllToS.digest(); - byte[] sOut = new byte[s.length]; + byte[] block = getLengthBlock(sizeOfAAD, processed); + ghashAllToS.update(block); + block = ghashAllToS.digest(); GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock); - gctrForSToTag.doFinal(s, 0, s.length, sOut, 0); + gctrForSToTag.doFinal(block, 0, tagLenBytes, block, 0); // check entire authentication tag for time-consistency int mismatch = 0; for (int i = 0; i < tagLenBytes; i++) { - mismatch |= tag[i] ^ sOut[i]; + mismatch |= tag[i] ^ block[i]; } if (mismatch != 0) { @@ -624,6 +795,122 @@ int decryptFinal(byte[] in, int inOfs, int len, return len; } + // Note: In-place operations do not need an intermediary copy because + // the GHASH check was performed before the decryption. + int decryptFinal(ByteBuffer src, ByteBuffer dst) + throws IllegalBlockSizeException, AEADBadTagException, + ShortBufferException { + + dst = overlapDetection(src, dst); + // Length of the input + ByteBuffer tag; + ByteBuffer ct = src.duplicate(); + + ByteBuffer buffer = ((ibuffer == null || ibuffer.size() == 0) ? null : + ByteBuffer.wrap(ibuffer.toByteArray())); + int len; + + if (ct.remaining() >= tagLenBytes) { + tag = src.duplicate(); + tag.position(ct.limit() - tagLenBytes); + ct.limit(ct.limit() - tagLenBytes); + len = ct.remaining(); + if (buffer != null) { + len += buffer.remaining(); + } + } else if (buffer != null && ct.remaining() < tagLenBytes) { + // It's unlikely the tag will be between the buffer and data + tag = ByteBuffer.allocate(tagLenBytes); + int limit = buffer.remaining() - (tagLenBytes - ct.remaining()); + buffer.mark(); + buffer.position(limit); + // Read from "new" limit to buffer's end + tag.put(buffer); + // reset buffer to data only + buffer.reset(); + buffer.limit(limit); + tag.put(ct); + tag.flip(); + // Limit is how much of the ibuffer has been chopped off. + len = buffer.remaining(); + } else { + throw new AEADBadTagException("Input too short - need tag"); + } + + // 'len' contains the length in ibuffer and src + checkDataLength(len); + + if (len > dst.remaining()) { + throw new ShortBufferException("Output buffer too small"); + } + + processAAD(); + // Set the mark for a later reset. Either it will be zero, or the tag + // buffer creation above will have consume some or all of it. + ct.mark(); + + // If there is data stored in the buffer + if (buffer != null && buffer.remaining() > 0) { + ghashAllToS.update(buffer, buffer.remaining()); + // Process the overage + if (buffer.remaining() > 0) { + // Fill out block between two buffers + if (ct.remaining() > 0) { + int over = buffer.remaining(); + byte[] block = new byte[AES_BLOCK_SIZE]; + // Copy the remainder of the buffer into the extra block + buffer.get(block, 0, over); + + // Fill out block with what is in data + if (ct.remaining() > AES_BLOCK_SIZE - over) { + ct.get(block, over, AES_BLOCK_SIZE - over); + ghashAllToS.update(block, 0, AES_BLOCK_SIZE); + } else { + // If the remaining in buffer + data does not fill a + // block, complete the ghash operation + int l = ct.remaining(); + ct.get(block, over, l); + ghashAllToS.doLastBlock(ByteBuffer.wrap(block), over + l); + } + } else { + // data is empty, so complete the ghash op with the + // remaining buffer + ghashAllToS.doLastBlock(buffer, buffer.remaining()); + } + } + // Prepare buffer for decryption + buffer.flip(); + } + + if (ct.remaining() > 0) { + ghashAllToS.doLastBlock(ct, ct.remaining()); + } + // Prepare buffer for decryption if available + ct.reset(); + + byte[] block = getLengthBlock(sizeOfAAD, len); + ghashAllToS.update(block); + block = ghashAllToS.digest(); + GCTR gctrForSToTag = new GCTR(embeddedCipher, this.preCounterBlock); + gctrForSToTag.doFinal(block, 0, tagLenBytes, block, 0); + + // check entire authentication tag for time-consistency + int mismatch = 0; + for (int i = 0; i < tagLenBytes; i++) { + mismatch |= tag.get() ^ block[i]; + } + + if (mismatch != 0) { + throw new AEADBadTagException("Tag mismatch!"); + } + + // Decrypt the all the input data and put it into dst + doLastBlock(buffer, ct, dst); + restoreDst(dst); + // 'processed' from the gctr decryption operation, not ghash + return processed; + } + // return tag length in bytes int getTagLen() { return this.tagLenBytes; @@ -636,4 +923,94 @@ int getBufferedLength() { return ibuffer.size(); } } + + /** + * Check for overlap. If the src and dst buffers are using shared data and + * if dst will overwrite src data before src can be processed. If so, make + * a copy to put the dst data in. + */ + ByteBuffer overlapDetection(ByteBuffer src, ByteBuffer dst) { + if (src.isDirect() && dst.isDirect()) { + DirectBuffer dsrc = (DirectBuffer) src; + DirectBuffer ddst = (DirectBuffer) dst; + + // Get the current memory address for the given ByteBuffers + long srcaddr = dsrc.address(); + long dstaddr = ddst.address(); + + // Find the lowest attachment that is the base memory address of the + // shared memory for the src object + while (dsrc.attachment() != null) { + srcaddr = ((DirectBuffer) dsrc.attachment()).address(); + dsrc = (DirectBuffer) dsrc.attachment(); + } + + // Find the lowest attachment that is the base memory address of the + // shared memory for the dst object + while (ddst.attachment() != null) { + dstaddr = ((DirectBuffer) ddst.attachment()).address(); + ddst = (DirectBuffer) ddst.attachment(); + } + + // If the base addresses are not the same, there is no overlap + if (srcaddr != dstaddr) { + return dst; + } + // At this point we know these objects share the same memory. + // This checks the starting position of the src and dst address for + // overlap. + // It uses the base address minus the passed object's address to get + // the offset from the base address, then add the position() from + // the passed object. That gives up the true offset from the base + // address. As long as the src side is >= the dst side, we are not + // in overlap. + if (((DirectBuffer) src).address() - srcaddr + src.position() >= + ((DirectBuffer) dst).address() - dstaddr + dst.position()) { + return dst; + } + + } else if (!src.isDirect() && !dst.isDirect()) { + if (!src.isReadOnly()) { + // If using the heap, check underlying byte[] address. + if (!src.array().equals(dst.array()) ) { + return dst; + } + + // Position plus arrayOffset() will give us the true offset from + // the underlying byte[] address. + if (src.position() + src.arrayOffset() >= + dst.position() + dst.arrayOffset()) { + return dst; + } + } + } else { + // buffer types aren't the same + return dst; + } + + // Create a copy + ByteBuffer tmp = dst.duplicate(); + // We can use a heap buffer for internal use, save on alloc cost + ByteBuffer bb = ByteBuffer.allocate(dst.remaining()); + tmp.limit(dst.limit()); + tmp.position(dst.position()); + bb.put(tmp); + bb.flip(); + originalDst = dst; + return bb; + } + + /** + * If originalDst exists, dst is an internal dst buffer, then copy the data + * into the original dst buffer + */ + void restoreDst(ByteBuffer dst) { + if (originalDst == null) { + return; + } + + dst.flip(); + originalDst.put(dst); + originalDst = null; + } } diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMBufferTest.java b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMBufferTest.java new file mode 100644 index 0000000000000..54d271d63ae9b --- /dev/null +++ b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMBufferTest.java @@ -0,0 +1,851 @@ +/* + * Copyright (c) 2020, 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 Use Cipher update and doFinal with a mixture of byte[], bytebuffer, + * and offset while verifying return values. Also using different and + * in-place buffers. + * + * in-place is not tested with different buffer types as it is not a logical + * scenario and is complicated by getOutputSize calculations. + */ + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.ByteArrayOutputStream; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.security.SecureRandom; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +public class GCMBufferTest implements Cloneable { + + // Data type for the operation + enum dtype { BYTE, HEAP, DIRECT }; + // Data map + static HashMap> datamap = new HashMap<>(); + // List of enum values for order of operation + List ops; + + static final int AESBLOCK = 16; + // The remaining input data length is inserted at the particular index + // in sizes[] during execution. + static final int REMAINDER = -1; + + String algo; + boolean same = true; + int[] sizes; + boolean incremental = false; + // In some cases the theoretical check is too complicated to verify + boolean theoreticalCheck; + List dataSet; + int inOfs = 0, outOfs = 0; + + static class Data { + int id; + SecretKey key; + byte[] iv; + byte[] pt; + byte[] aad; + byte[] ct; + byte[] tag; + + Data(String keyalgo, int id, String key, String iv, byte[] pt, String aad, + String ct, String tag) { + this.id = id; + this.key = new SecretKeySpec(HexToBytes(key), keyalgo); + this.iv = HexToBytes(iv); + this.pt = pt; + this.aad = HexToBytes(aad); + this.ct = HexToBytes(ct); + this.tag = HexToBytes(tag); + } + + Data(String keyalgo, int id, String key, String iv, String pt, String aad, + String ct, String tag) { + this(keyalgo, id, key, iv, HexToBytes(pt), aad, ct, tag); + } + + Data(String keyalgo, int id, String key, int ptlen) { + this.id = id; + this.key = new SecretKeySpec(HexToBytes(key), keyalgo); + iv = new byte[16]; + pt = new byte[ptlen]; + tag = new byte[12]; + aad = new byte[0]; + byte[] tct = null; + try { + SecureRandom r = new SecureRandom(); + r.nextBytes(iv); + r.nextBytes(pt); + Cipher c = Cipher.getInstance("AES/GCM/NoPadding"); + c.init(Cipher.ENCRYPT_MODE, this.key, + new GCMParameterSpec(tag.length * 8, this.iv)); + tct = c.doFinal(pt); + } catch (Exception e) { + System.out.println("Error in generating data for length " + + ptlen); + } + ct = new byte[ptlen]; + System.arraycopy(tct, 0, ct, 0, ct.length); + System.arraycopy(tct, ct.length, tag, 0, tag.length); + } + + } + + /** + * Construct a test with an algorithm and a list of dtype. + * @param algo Algorithm string + * @param ops List of dtypes. If only one dtype is specified, only a + * doFinal operation will occur. If multiple dtypes are + * specified, the last is a doFinal, the others are updates. + */ + GCMBufferTest(String algo, List ops) { + this.algo = algo; + this.ops = ops; + theoreticalCheck = true; + dataSet = datamap.get(algo); + } + + public GCMBufferTest clone() throws CloneNotSupportedException{ + return (GCMBufferTest)super.clone(); + } + + /** + * Define particular data sizes to be tested. "REMAINDER", which has a + * value of -1, can be used to insert the remaining input text length at + * that index during execution. + * @param sizes Data sizes for each dtype in the list. + */ + GCMBufferTest dataSegments(int[] sizes) { + this.sizes = sizes; + return this; + } + + /** + * Do not perform in-place operations + */ + GCMBufferTest differentBufferOnly() { + this.same = false; + return this; + } + + /** + * Enable incrementing through each data size available. This can only be + * used when the List has more than one dtype entry. + */ + GCMBufferTest incrementalSegments() { + this.incremental = true; + return this; + } + + /** + * Specify a particular test dataset. + * + * @param id id value for the test data to used in this test. + */ + GCMBufferTest dataSet(int id) throws Exception { + for (Data d : datamap.get(algo)) { + if (d.id == id) { + dataSet = List.of(d); + return this; + } + } + throw new Exception("Unaeble to find dataSet id = " + id); + } + + /** + * Set both input and output offsets to the same offset + * @param offset value for inOfs and outOfs + * @return + */ + GCMBufferTest offset(int offset) { + this.inOfs = offset; + this.outOfs = offset; + return this; + } + + /** + * Set the input offset + * @param offset value for input offset + * @return + */ + GCMBufferTest inOfs(int offset) { + this.inOfs = offset; + return this; + } + + /** + * Set the output offset + * @param offset value for output offset + * @return + */ + GCMBufferTest outOfs(int offset) { + this.outOfs = offset; + return this; + } + + /** + * Reverse recursive loop that starts at the end-1 index, going to 0, in + * the size array to calculate all the possible sizes. + * It returns the remaining data size not used in the loop. This remainder + * is used for the end index which is the doFinal op. + */ + int inc(int index, int max, int total) { + if (sizes[index] == max - total) { + sizes[index + 1]++; + total++; + sizes[index] = 0; + } else if (index == 0) { + sizes[index]++; + } + + total += sizes[index]; + if (index > 0) { + return inc(index - 1, max, total); + } + return total; + } + + // Call recursive loop and take returned remainder value for last index + boolean incrementSizes(int max) { + sizes[ops.size() - 1] = max - inc(ops.size() - 2, max, 0); + if (sizes[ops.size() - 2] == max) { + // We are at the end, exit test loop + return false; + } + return true; + } + + void test() throws Exception { + int i = 1; + System.out.println("Algo: " + algo + " \tOps: " + ops.toString()); + for (Data data : dataSet) { + + // If incrementalSegments is enabled, run through that test only + if (incremental) { + if (ops.size() < 2) { + throw new Exception("To do incrementalSegments you must" + + "have more that 1 dtype in the list"); + } + sizes = new int[ops.size()]; + + while (incrementSizes(data.pt.length)) { + System.out.print("Encrypt: Data Index: " + i + " \tSizes[ "); + for (int v : sizes) { + System.out.print(v + " "); + } + System.out.println("]"); + encrypt(data); + } + Arrays.fill(sizes, 0); + + while (incrementSizes(data.ct.length + data.tag.length)) { + System.out.print("Decrypt: Data Index: " + i + " \tSizes[ "); + for (int v : sizes) { + System.out.print(v + " "); + } + System.out.println("]"); + decrypt(data); + } + + } else { + // Default test of 0 and 2 offset doing in place and different + // i/o buffers + System.out.println("Encrypt: Data Index: " + i); + encrypt(data); + + System.out.println("Decrypt: Data Index: " + i); + decrypt(data); + } + i++; + } + } + + // Setup data for encryption + void encrypt(Data data) throws Exception { + byte[] input, output; + + input = data.pt; + output = new byte[data.ct.length + data.tag.length]; + System.arraycopy(data.ct, 0, output, 0, data.ct.length); + System.arraycopy(data.tag, 0, output, data.ct.length, + data.tag.length); + + // Test different input/output buffers + System.out.println("\tinput len: " + input.length + " inOfs " + + inOfs + " outOfs " + outOfs + " in/out buffer: different"); + crypto(true, data, input, output); + + // Test with in-place buffers + if (same) { + System.out.println("\tinput len: " + input.length + " inOfs " + + inOfs + " outOfs " + outOfs + " in/out buffer: in-place"); + cryptoSameBuffer(true, data, input, output); + } + } + + // Setup data for decryption + void decrypt(Data data) throws Exception { + byte[] input, output; + + input = new byte[data.ct.length + data.tag.length]; + System.arraycopy(data.ct, 0, input, 0, data.ct.length); + System.arraycopy(data.tag, 0, input, data.ct.length, data.tag.length); + output = data.pt; + + // Test different input/output buffers + System.out.println("\tinput len: " + input.length + " inOfs " + + inOfs + " outOfs " + outOfs + " in-place: different"); + crypto(false, data, input, output); + + // Test with in-place buffers + if (same) { + System.out.println("\tinput len: " + input.length + " inOfs " + + inOfs + " outOfs " + outOfs + " in-place: same"); + cryptoSameBuffer(false, data, input, output); + } + } + + /** + * Perform cipher operation using different input and output buffers. + * This method allows mixing of data types (byte, heap, direct). + */ + void crypto(boolean encrypt, Data d, byte[] input, byte[] output) + throws Exception { + byte[] pt = new byte[input.length + inOfs]; + System.arraycopy(input, 0, pt, inOfs, input.length); + byte[] expectedOut = new byte[output.length + outOfs]; + System.arraycopy(output, 0, expectedOut, outOfs, output.length); + int plen = input.length / ops.size(); // partial input length + int theoreticallen;// expected output length + int dataoffset = 0; // offset of unconsumed data in pt + int index = 0; // index of which op we are on + int rlen; // result length + int pbuflen = 0; // plen remaining in the GCM internal buffers + + Cipher cipher = Cipher.getInstance(algo); + cipher.init((encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE), + d.key, new GCMParameterSpec(d.tag.length * 8, d.iv)); + cipher.updateAAD(d.aad); + + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + ba.write(new byte[outOfs], 0, outOfs); + for (dtype v : ops) { + if (index < ops.size() - 1) { + if (sizes != null && input.length > 0) { + if (sizes[index] == -1) { + plen = input.length - dataoffset; + } else { + if (sizes[index] > input.length) { + plen = input.length; + } else { + plen = sizes[index]; + } + } + } + + int olen = cipher.getOutputSize(plen) + outOfs; + + /* + * The theoretical limit is the length of the data sent to + * update() + any data might be setting in CipherCore or GCM + * internal buffers % the block size. + */ + theoreticallen = (plen + pbuflen) - ((plen + pbuflen) % AESBLOCK); + + // Update operations + switch (v) { + case BYTE -> { + byte[] out = new byte[olen]; + rlen = cipher.update(pt, dataoffset + inOfs, plen, out, + outOfs); + ba.write(out, outOfs, rlen); + } + case HEAP -> { + ByteBuffer b = ByteBuffer.allocate(plen + outOfs); + b.position(outOfs); + b.put(pt, dataoffset + inOfs, plen); + b.flip(); + b.position(outOfs); + ByteBuffer out = ByteBuffer.allocate(olen); + out.position(outOfs); + rlen = cipher.update(b, out); + ba.write(out.array(), outOfs, rlen); + } + case DIRECT -> { + ByteBuffer b = ByteBuffer.allocateDirect(plen + outOfs); + b.position(outOfs); + b.put(pt, dataoffset + inOfs, plen); + b.flip(); + b.position(outOfs); + ByteBuffer out = ByteBuffer.allocateDirect(olen); + out.position(outOfs); + rlen = cipher.update(b, out); + byte[] o = new byte[rlen]; + out.flip(); + out.position(outOfs); + out.get(o, 0, rlen); + ba.write(o); + } + default -> throw new Exception("Unknown op: " + v.name()); + } + + if (theoreticalCheck) { + pbuflen += plen - rlen; + if (encrypt && rlen != theoreticallen) { + throw new Exception("Wrong update return len (" + + v.name() + "): " + "rlen=" + rlen + + ", expected output len=" + theoreticallen); + } + } + + dataoffset += plen; + index++; + + } else { + // doFinal operation + plen = input.length - dataoffset; + + int olen = cipher.getOutputSize(plen) + outOfs; + switch (v) { + case BYTE -> { + byte[] out = new byte[olen]; + rlen = cipher.doFinal(pt, dataoffset + inOfs, + plen, out, outOfs); + ba.write(out, outOfs, rlen); + } + case HEAP -> { + ByteBuffer b = ByteBuffer.allocate(plen + inOfs); + b.limit(b.capacity()); + b.position(inOfs); + b.put(pt, dataoffset + inOfs, plen); + b.flip(); + b.position(inOfs); + ByteBuffer out = ByteBuffer.allocate(olen); + out.limit(out.capacity()); + out.position(outOfs); + rlen = cipher.doFinal(b, out); + ba.write(out.array(), outOfs, rlen); + } + case DIRECT -> { + ByteBuffer b = ByteBuffer.allocateDirect(plen + inOfs); + b.limit(b.capacity()); + b.position(inOfs); + b.put(pt, dataoffset + inOfs, plen); + b.flip(); + b.position(inOfs); + ByteBuffer out = ByteBuffer.allocateDirect(olen); + out.limit(out.capacity()); + out.position(outOfs); + rlen = cipher.doFinal(b, out); + byte[] o = new byte[rlen]; + out.flip(); + out.position(outOfs); + out.get(o, 0, rlen); + ba.write(o); + } + default -> throw new Exception("Unknown op: " + v.name()); + } + + if (theoreticalCheck && rlen != olen - outOfs) { + throw new Exception("Wrong doFinal return len (" + + v.name() + "): " + "rlen=" + rlen + + ", expected output len=" + (olen - outOfs)); + } + + // Verify results + byte[] ctresult = ba.toByteArray(); + if (ctresult.length != expectedOut.length || + Arrays.compare(ctresult, expectedOut) != 0) { + String s = "Ciphertext mismatch (" + v.name() + + "):\nresult (len=" + ctresult.length + "):" + + String.format("%0" + (ctresult.length << 1) + "x", + new BigInteger(1, ctresult)) + + "\nexpected (len=" + output.length + "):" + + String.format("%0" + (output.length << 1) + "x", + new BigInteger(1, output)); + System.err.println(s); + throw new Exception(s); + + } + } + } + } + + /** + * Perform cipher operation using in-place buffers. This method does not + * allow mixing of data types (byte, heap, direct). + * + * Mixing data types makes no sense for in-place operations and would + * greatly complicate the test code. + */ + void cryptoSameBuffer(boolean encrypt, Data d, byte[] input, byte[] output) throws Exception { + + byte[] data, out; + if (encrypt) { + data = new byte[output.length + Math.max(inOfs, outOfs)]; + } else { + data = new byte[input.length + Math.max(inOfs, outOfs)]; + } + + ByteBuffer bbin = null, bbout = null; + System.arraycopy(input, 0, data, inOfs, input.length); + byte[] expectedOut = new byte[output.length + outOfs]; + System.arraycopy(output, 0, expectedOut, outOfs, output.length); + int plen = input.length / ops.size(); // partial input length + int theorticallen = plen - (plen % AESBLOCK); // output length + int dataoffset = 0; + int index = 0; + int rlen = 0; // result length + int len = 0; + + Cipher cipher = Cipher.getInstance(algo); + cipher.init((encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE), + d.key, new GCMParameterSpec(d.tag.length * 8, d.iv)); + cipher.updateAAD(d.aad); + + // Prepare data + switch (ops.get(0)) { + case HEAP -> { + bbin = ByteBuffer.wrap(data); + bbin.limit(input.length + inOfs); + bbout = bbin.duplicate(); + } + case DIRECT -> { + bbin = ByteBuffer.allocateDirect(data.length); + bbout = bbin.duplicate(); + bbin.put(data, 0, input.length + inOfs); + bbin.flip(); + } + } + + // Set data limits for bytebuffers + if (bbin != null) { + bbin.position(inOfs); + bbout.limit(output.length + outOfs); + bbout.position(outOfs); + } + + // Iterate through each operation + for (dtype v : ops) { + if (index < ops.size() - 1) { + switch (v) { + case BYTE -> { + rlen = cipher.update(data, dataoffset + inOfs, plen, + data, len + outOfs); + } + case HEAP, DIRECT -> { + theorticallen = bbin.remaining() - + (bbin.remaining() % AESBLOCK); + rlen = cipher.update(bbin, bbout); + } + default -> throw new Exception("Unknown op: " + v.name()); + } + + // Check that the theoretical return value matches the actual. + if (theoreticalCheck && encrypt && rlen != theorticallen) { + throw new Exception("Wrong update return len (" + + v.name() + "): " + "rlen=" + rlen + + ", expected output len=" + theorticallen); + } + + dataoffset += plen; + len += rlen; + index++; + + } else { + // Run doFinal op + plen = input.length - dataoffset; + + switch (v) { + case BYTE -> { + rlen = cipher.doFinal(data, dataoffset + inOfs, + plen, data, len + outOfs); + out = Arrays.copyOfRange(data, 0,len + rlen + outOfs); + } + case HEAP, DIRECT -> { + rlen = cipher.doFinal(bbin, bbout); + bbout.flip(); + out = new byte[bbout.remaining()]; + bbout.get(out); + } + default -> throw new Exception("Unknown op: " + v.name()); + } + len += rlen; + + // Verify results + if (len != output.length || + Arrays.compare(out, 0, len, expectedOut, 0, + output.length) != 0) { + String s = "Ciphertext mismatch (" + v.name() + + "):\nresult (len=" + len + "):\n" + + byteToHex(out) + + "\nexpected (len=" + output.length + "):\n" + + String.format("%0" + (output.length << 1) + "x", + new BigInteger(1, output)); + System.err.println(s); + throw new Exception(s); + } + } + } + } + static void offsetTests(GCMBufferTest t) throws Exception { + t.clone().offset(2).test(); + t.clone().inOfs(2).test(); + // Test not designed for overlap situations + t.clone().outOfs(2).differentBufferOnly().test(); + } + + public static void main(String args[]) throws Exception { + initTest(); + // Test single byte array + new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE))); + // Test update-doFinal with byte arrays + new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE))); + // Test update-update-doFinal with byte arrays + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE))); + + // Test single heap bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP))); + // Test update-doFinal with heap bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.HEAP, dtype.HEAP)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP, dtype.HEAP))); + // Test update-update-doFinal with heap bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.HEAP, dtype.HEAP, dtype.HEAP)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.HEAP, dtype.HEAP, dtype.HEAP))); + + // Test single direct bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.DIRECT)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", List.of(dtype.DIRECT))); + // Test update-doFinal with direct bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.DIRECT)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.DIRECT))); + // Test update-update-doFinal with direct bytebuffer + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT)).test(); + offsetTests(new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT))); + + // Test update-update-doFinal with byte arrays and preset data sizes + GCMBufferTest t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).dataSegments( + new int[] { 1, 1, GCMBufferTest.REMAINDER}); + t.clone().test(); + offsetTests(t.clone()); + + // Test update-doFinal with a byte array and a direct bytebuffer + t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.BYTE, dtype.DIRECT)).differentBufferOnly(); + t.clone().test(); + offsetTests(t.clone()); + // Test update-doFinal with a byte array and heap and direct bytebuffer + t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.BYTE, dtype.HEAP, dtype.DIRECT)).differentBufferOnly(); + t.clone().test(); + offsetTests(t.clone()); + // Test update-doFinal with a direct bytebuffer and a byte array. + t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.BYTE)).differentBufferOnly(); + t.clone().test(); + offsetTests(t.clone()); + + // Test update-doFinal with a direct bytebuffer and a byte array with + // preset data sizes. + t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.BYTE)).differentBufferOnly(). + dataSegments(new int[] { 20, GCMBufferTest.REMAINDER }); + t.clone().test(); + offsetTests(t.clone()); + // Test update-update-doFinal with a direct and heap bytebuffer and a + // byte array with preset data sizes. + t = new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.BYTE, dtype.HEAP)). + differentBufferOnly().dataSet(5). + dataSegments(new int[] { 5000, 1000, GCMBufferTest.REMAINDER }); + t.clone().test(); + offsetTests(t.clone()); + + // Test update-update-doFinal with byte arrays, incrementing through + // every data size combination for the Data set 0 + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.BYTE, dtype.BYTE, dtype.BYTE)).incrementalSegments(). + dataSet(0).test(); + // Test update-update-doFinal with direct bytebuffers, incrementing through + // every data size combination for the Data set 0 + new GCMBufferTest("AES/GCM/NoPadding", + List.of(dtype.DIRECT, dtype.DIRECT, dtype.DIRECT)). + incrementalSegments().dataSet(0).test(); + } + + private static byte[] HexToBytes(String hexVal) { + if (hexVal == null) { + return new byte[0]; + } + byte[] result = new byte[hexVal.length()/2]; + for (int i = 0; i < result.length; i++) { + String byteVal = hexVal.substring(2*i, 2*i +2); + result[i] = Integer.valueOf(byteVal, 16).byteValue(); + } + return result; + } + + private static String byteToHex(byte[] barray) { + StringBuilder s = new StringBuilder(); + for (byte b : barray) { + s.append(String.format("%02x", b)); + } + return s.toString(); + } + + // Test data + static void initTest() { + datamap.put("AES/GCM/NoPadding", List.of( + // GCM KAT + new Data("AES", 0, + "141f1ce91989b07e7eb6ae1dbd81ea5e", + "49451da24bd6074509d3cebc2c0394c972e6934b45a1d91f3ce1d3ca69e19" + + "4aa1958a7c21b6f21d530ce6d2cc5256a3f846b6f9d2f38df0102c4791e5" + + "7df038f6e69085646007df999751e248e06c47245f4cd3b8004585a7470d" + + "ee1690e9d2d63169a58d243c0b57b3e5b4a481a3e4e8c60007094ef3adea" + + "2e8f05dd3a1396f", + "d384305af2388699aa302f510913fed0f2cb63ba42efa8c5c9de2922a2ec" + + "2fe87719dadf1eb0aef212b51e74c9c5b934104a43", + "630cf18a91cc5a6481ac9eefd65c24b1a3c93396bd7294d6b8ba3239517" + + "27666c947a21894a079ef061ee159c05beeb4", + "f4c34e5fbe74c0297313268296cd561d59ccc95bbfcdfcdc71b0097dbd83" + + "240446b28dc088abd42b0fc687f208190ff24c0548", + "dbb93bbb56d0439cd09f620a57687f5d"), + // GCM KAT + new Data("AES", 1, "11754cd72aec309bf52f7687212e8957", + "3c819d9a9bed087615030b65", + (String)null, null, null, + "250327c674aaf477aef2675748cf6971"), + // GCM KAT + new Data("AES", 2, "272f16edb81a7abbea887357a58c1917", + "794ec588176c703d3d2a7a07", + (String)null, null, null, + "b6e6f197168f5049aeda32dafbdaeb"), + // zero'd test data + new Data("AES", 3, "272f16edb81a7abbea887357a58c1917", + "794ec588176c703d3d2a7a07", + new byte[256], null, + "15b461672153270e8ba1e6789f7641c5411f3e642abda731b6086f535c216457" + + "e87305bc59a1ff1f7e1e0bbdf302b75549b136606c67d7e5f71277aeca4bc670" + + "07a98f78e0cfa002ed183e62f07893ad31fe67aad1bb37e15b957a14d145f14f" + + "7483d041f2c3612ad5033155984470bdfc64d18df73c2745d92f28461bb09832" + + "33524811321ba87d213692825815dd13f528dba601a3c319cac6be9b48686c23" + + "a0ce23d5062916ea8827bbb243f585e446131489e951354c8ab24661f625c02e" + + "15536c5bb602244e98993ff745f3e523399b2059f0e062d8933fad2366e7e147" + + "510a931282bb0e3f635efe7bf05b1dd715f95f5858261b00735224256b6b3e80", + "08b3593840d4ed005f5234ae062a5c"), + // Random test data + new Data("AES", 4, "272f16edb81a7abbea887357a58c1917", + "794ec588176c703d3d2a7a07", + new byte[2075], null, + "15b461672153270e8ba1e6789f7641c5411f3e642abda731b6086f535c216457" + + "e87305bc59a1ff1f7e1e0bbdf302b75549b136606c67d7e5f71277aeca4bc670" + + "07a98f78e0cfa002ed183e62f07893ad31fe67aad1bb37e15b957a14d145f14f" + + "7483d041f2c3612ad5033155984470bdfc64d18df73c2745d92f28461bb09832" + + "33524811321ba87d213692825815dd13f528dba601a3c319cac6be9b48686c23" + + "a0ce23d5062916ea8827bbb243f585e446131489e951354c8ab24661f625c02e" + + "15536c5bb602244e98993ff745f3e523399b2059f0e062d8933fad2366e7e147" + + "510a931282bb0e3f635efe7bf05b1dd715f95f5858261b00735224256b6b3e80" + + "7364cb53ff6d4e88f928cf67ac70da127718a8a35542efbae9dd7567c818a074" + + "9a0c74bd69014639f59768bc55056d1166ea5523e8c66f9d78d980beb8f0d83b" + + "a9e2c5544b94dc3a1a4b6f0f95f897b010150e89ebcacf0daee3c2793d6501a0" + + "b58b411de273dee987e8e8cf8bb29ef2e7f655b46b55fabf64c6a4295e0d080b" + + "6a570ace90eb0fe0f5b5d878bdd90eddaa1150e4d5a6505b350aac814fe99615" + + "317ecd0516a464c7904011ef5922409c0d65b1e43b69d7c3293a8f7d3e9fbee9" + + "eb91ec0007a7d6f72e64deb675d459c5ba07dcfd58d08e6820b100465e6e04f0" + + "663e310584a00d36d23699c1bffc6afa094c75184fc7cde7ad35909c0f49f2f3" + + "fe1e6d745ab628d74ea56b757047de57ce18b4b3c71e8af31a6fac16189cb0a3" + + "a97a1bea447042ce382fcf726560476d759c24d5c735525ea26a332c2094408e" + + "671c7deb81d5505bbfd178f866a6f3a011b3cfdbe089b4957a790688028dfdf7" + + "9a096b3853f9d0d6d3feef230c7f5f46ffbf7486ebdaca5804dc5bf9d202415e" + + "e0d67b365c2f92a17ea740807e4f0b198b42b54f15faa9dff2c7c35d2cf8d72e" + + "b8f8b18875a2e7b5c43d1e0aa5139c461e8153c7f632895aa46ffe2b134e6a0d" + + "dfbf6a336e709adfe951bd52c4dfc7b07a15fb3888fc35b7e758922f87a104c4" + + "563c5c7839cfe5a7edbdb97264a7c4ebc90367b10cbe09dbf2390767ad7afaa8" + + "8fb46b39d3f55f216d2104e5cf040bf3d39b758bea28e2dbce576c808d17a8eb" + + "e2fd183ef42a774e39119dff1f539efeb6ad15d889dfcb0d54d0d4d4cc03c8d9" + + "aa6c9ebd157f5e7170183298d6a30ada8792dcf793d931e2a1eafccbc63c11c0" + + "c5c5ed60837f30017d693ccb294df392a8066a0594a56954aea7b78a16e9a11f" + + "4a8bc2104070a7319f5fab0d2c4ccad8ec5cd8f47c839179bfd54a7bf225d502" + + "cd0a318752fe763e8c09eb88fa57fc5399ad1f797d0595c7b8afdd23f13603e9" + + "6802192bb51433b7723f4e512bd4f799feb94b458e7f9792f5f9bd6733828f70" + + "a6b7ffbbc0bb7575021f081ec2a0d37fecd7cda2daec9a3a9d9dfe1c8034cead" + + "e4b56b581cc82bd5b74b2b30817967d9da33850336f171a4c68e2438e03f4b11" + + "96da92f01b3b7aeab795180ccf40a4b090b1175a1fc0b67c95f93105c3aef00e" + + "13d76cc402539192274fee703730cd0d1c5635257719cc96cacdbad00c6255e2" + + "bd40c775b43ad09599e84f2c3205d75a6661ca3f151183be284b354ce21457d1" + + "3ba65b9b2cdb81874bd14469c2008b3ddec78f7225ecc710cc70de7912ca6a6d" + + "348168322ab59fdafcf5c833bfa0ad4046f4b6da90e9f263db7079af592eda07" + + "5bf16c6b1a8346da9c292a48bf660860a4fc89eaef40bc132779938eca294569" + + "787c740af2b5a8de7f5e10ac750d1e3d0ef3ed168ba408a676e10b8a20bd4be8" + + "3e8336b45e54481726d73e1bd19f165a98e242aca0d8387f2dd22d02d74e23db" + + "4cef9a523587413e0a44d7e3260019a34d3a6b38426ae9fa4655be338d721970" + + "cb9fe76c073f26f9303093a033022cd2c62b2790bce633ba9026a1c93b6535f1" + + "1882bf5880e511b9e1b0b7d8f23a993aae5fd275faac3a5b4ccaf7c06b0b266a" + + "ee970a1e3a4cd7a41094f516960630534e692545b25a347c30e3f328bba4825f" + + "ed754e5525d846131ecba7ca120a6aeabc7bab9f59c890c80b7e31f9bc741591" + + "55d292433ce9558e104102f2cc63ee267c1c8333e841522707ea6d595cb802b9" + + "61697da77bbc4cb404ea62570ab335ebffa2023730732ac5ddba1c3dbb5be408" + + "3c50aea462c1ffa166d7cc3db4b742b747e81b452db2363e91374dee8c6b40f0" + + "e7fbf50e60eaf5cc5649f6bb553aae772c185026ceb052af088c545330a1ffbf" + + "50615b8c7247c6cd386afd7440654f4e15bcfae0c45442ec814fe88433a9d616" + + "ee6cc3f163f0d3d325526d05f25d3b37ad5eeb3ca77248ad86c9042b16c65554" + + "aebb6ad3e17b981492b13f42c5a5dc088e991da303e5a273fdbb8601aece4267" + + "47b01f6cb972e6da1743a0d7866cf206e95f23c6f8e337c901b9cd34a9a1fbbe" + + "1694f2c26b00dfa4d02c0d54540163e798fbdc9c25f30d6406f5b4c13f7ed619" + + "34e350f4059c13aa5e973307a9e3058917cda96fdd082e9c629ccfb2a9f98d12" + + "5c6e4703a7b0f348f5cdeb63cef2133d1c6c1a087591e0a2bca29d09c6565e66" + + "e91042f83b0e74e60a5d57562c23e2fbcd6599c29d7c19e47cf625c2ce24bb8a" + + "13f8e54041498437eec2cedd1e3d8e57a051baa962c0a62d70264d99c5ee716d" + + "5c8b9078db08c8b2c5613f464198a7aff43f76c5b4612b46a4f1cd2a494386c5" + + "7fd28f3d199f0ba8d8e39116cc7db16ce6188205ee49a9dce3d4fa32ea394919" + + "f6e91ef58b84d00b99596b4306c2d9f432d917bb4ac73384c42ae12adb4920d8" + + "c33a816febcb299dcddf3ec7a8eb6e04cdc90891c6e145bd9fc5f41dc4061a46" + + "9feba38545b64ec8203f386ceef52785619e991d274ae80af7e54af535e0b011" + + "5effdf847472992875e09398457604d04e0bb965db692c0cdcf11a", + "687cc09c89298491deb51061d709af"), + // Randomly generated data at the time of execution. + new Data("AES", 5, "11754cd72aec309bf52f7687212e8957", 12345) + ) + ); + } +} diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementByte4.java b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementByte4.java new file mode 100644 index 0000000000000..1a92e0f4249e1 --- /dev/null +++ b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementByte4.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020, 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.List; + +/* + * @test + * @summary Uses GCMBufferTest to run a long test with incrementing through + * each byte in each byte array + * @run main/manual GCMIncrementByte4 + */ + +public class GCMIncrementByte4 { + + public static void main(String args[]) throws Exception { + GCMBufferTest.initTest(); + new GCMBufferTest("AES/GCM/NoPadding", + List.of(GCMBufferTest.dtype.BYTE, GCMBufferTest.dtype.BYTE, + GCMBufferTest.dtype.BYTE)).incrementalSegments().dataSet(4). + test(); + + } +} diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementDirect4.java b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementDirect4.java new file mode 100644 index 0000000000000..3372c7713a125 --- /dev/null +++ b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/GCMIncrementDirect4.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, 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.List; + +/* + * @test + * @summary Uses GCMBufferTest to run a long test with incrementing through + * each byte in each direct bytebuffer + * @run main/manual GCMIncrementDirect4 + */ + +public class GCMIncrementDirect4 { + + public static void main(String args[]) throws Exception { + new GCMBufferTest("AES/GCM/NoPadding", + List.of(GCMBufferTest.dtype.DIRECT, GCMBufferTest.dtype.DIRECT, + GCMBufferTest.dtype.DIRECT)).incrementalSegments().dataSet(4). + test(); + } +} diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/OverlapByteBuffer.java b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/OverlapByteBuffer.java new file mode 100644 index 0000000000000..9e84887c9908d --- /dev/null +++ b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/OverlapByteBuffer.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2020, 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 javax.crypto.Cipher; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.nio.ByteBuffer; + +/* + * @test + * @summary This tests overlapping buffers using ByteBuffer.slice() with + * array-backed ByteBuffer, read only array-backed, ByteBuffer, and direct + * ByteBuffer. + */ + +/* + * This tests overlapping buffers created with ByteBuffer.slice(). That is + * when the input and output ByteBuffers have shared memory (use the same + * underlying buffer space, commonly used for in-place crypto). The + * complication is the Cipher object specifies that it must be copy-safe. That + * means the output buffer will not overwrite any input data that has not been + * processed. If the output buffer's position or offset is greater than the + * input's overwriting will occur. + */ + +public class OverlapByteBuffer { + + public static void main(String[] args) throws Exception { + byte[] baseBuf = new byte[8192]; + ByteBuffer output, input, in; + // Output offset from the baseBuf + int outOfs; + + for (int i = 0; i < 3; i++) { + for (outOfs = -1; outOfs <= 1; outOfs++) { + + SecretKeySpec key = new SecretKeySpec(new byte[16], "AES"); + GCMParameterSpec params = + new GCMParameterSpec(128, new byte[12]); + Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); + cipher.init(Cipher.ENCRYPT_MODE, key, params); + + // Offset on the particular ByteBuffer (aka position()) + int inOfsInBuf = 1; + int outOfsInBuf = inOfsInBuf + outOfs; + int sliceLen = cipher.getOutputSize(baseBuf.length); + int bufferSize = sliceLen + Math.max(inOfsInBuf, outOfsInBuf); + byte[] buffer; + // Create overlapping input and output buffers + switch (i) { + case 0 -> { + buffer = new byte[bufferSize]; + output = ByteBuffer.wrap(buffer, outOfsInBuf, sliceLen). + slice(); + input = ByteBuffer.wrap(buffer, inOfsInBuf, sliceLen). + slice(); + System.out.println("Using array-backed ByteBuffer"); + in = input.duplicate(); + } + case 1 -> { + buffer = new byte[bufferSize]; + output = ByteBuffer.wrap(buffer, outOfsInBuf, sliceLen). + slice(); + input = ByteBuffer.wrap(buffer, inOfsInBuf, sliceLen). + slice(); + + System.out.println("Using read-only array-backed " + "ByteBuffer"); + in = input.asReadOnlyBuffer(); + } + case 2 -> { + System.out.println("Using direct ByteBuffer"); + ByteBuffer buf = ByteBuffer.allocateDirect(bufferSize); + output = buf.duplicate(); + output.position(outOfsInBuf); + output.limit(sliceLen + outOfsInBuf); + output = output.slice(); + + input = buf.duplicate(); + input.position(inOfsInBuf); + input.limit(sliceLen + inOfsInBuf); + input = input.slice(); + + in = input.duplicate(); + } + default -> { + throw new Exception("Unknown index " + i); + } + } + + // Copy data into shared buffer + input.put(baseBuf); + input.flip(); + in.limit(input.limit()); + + try { + int ctSize = cipher.doFinal(in, output); + + // Get ready to decrypt + byte[] tmp = new byte[ctSize]; + output.flip(); + output.get(tmp); + output.clear(); + + input.clear(); + input.put(tmp); + input.flip(); + + in.clear(); + in.limit(input.limit()); + + cipher.init(Cipher.DECRYPT_MODE, key, params); + cipher.doFinal(in, output); + + output.flip(); + System.out.println("inOfsInBuf = " + inOfsInBuf); + System.out.println("outOfsInBuf = " + outOfsInBuf); + ByteBuffer b = ByteBuffer.wrap(baseBuf); + if (b.compareTo(output) != 0) { + System.err.println( + "\nresult (" + output + "):\n" + + byteToHex(output) + + "\nexpected (" + b + "):\n" + + byteToHex(b)); + throw new Exception("Mismatch"); + } + } catch (Exception e) { + throw new Exception("Error with base offset " + outOfs, e); + } + } + } + } + private static String byteToHex(ByteBuffer bb) { + StringBuilder s = new StringBuilder(); + while (bb.remaining() > 0) { + s.append(String.format("%02x", bb.get())); + } + return s.toString(); + } +} diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/SameBuffer.java b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/SameBuffer.java index 30afb8ee8ea67..574e87a579046 100644 --- a/test/jdk/com/sun/crypto/provider/Cipher/AEAD/SameBuffer.java +++ b/test/jdk/com/sun/crypto/provider/Cipher/AEAD/SameBuffer.java @@ -29,12 +29,14 @@ import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.spec.GCMParameterSpec; +import jdk.test.lib.Convert; /* * @test * @bug 8048596 * @summary Check if AEAD operations work correctly when buffers used * for storing plain text and cipher text are overlapped or the same + * @library /test/lib */ public class SameBuffer { @@ -255,6 +257,13 @@ private void runGCMWithSeparateArray(int mode, byte[] AAD, byte[] text, // check if two resutls are equal if (!isEqual(text, myoff, outputText, 0, outputText.length)) { + System.err.println( + "\noutputText: len = " + outputText.length + " txtOffset = " + txtOffset + "\n" + + jdk.test.lib.Convert.byteArrayToHexString(outputText) + "\n" + + "text: len = " + text.length + " myoff = " + myoff + "\n" + + jdk.test.lib.Convert.byteArrayToHexString(text) + "\n" + + "lenght " + lenght); + System.err.println("tlen = " + params.getParameterSpec(GCMParameterSpec.class).getTLen() / 8); throw new RuntimeException("Two results not equal, mode:" + mode); } } @@ -387,6 +396,8 @@ private boolean isEqual(byte[] A, int offsetA, byte[] B, int offsetB, int setB = i + offsetB; if (setA > A.length - 1 || setB > B.length - 1 || A[setA] != B[setB]) { + System.err.println("i = " + i + " A[setA] = " + A[setA] + + " B[setB] = " + B[setB]); return false; } } diff --git a/test/jdk/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java b/test/jdk/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java index 3595bbd22f1e0..bdcf465f854eb 100644 --- a/test/jdk/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java +++ b/test/jdk/com/sun/crypto/provider/Cipher/AES/TestKATForGCM.java @@ -33,6 +33,7 @@ */ +import java.nio.ByteBuffer; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; @@ -55,6 +56,7 @@ private static byte[] HexToBytes(String hexVal) { } private static class TestVector { + int id; SecretKey key; byte[] plainText; byte[] aad; @@ -63,23 +65,41 @@ private static class TestVector { GCMParameterSpec spec; String info; - TestVector(String key, String iv, String pt, String aad, + TestVector(int id, String key, String iv, String pt, String aad, String ct, String tag) { + this.id = id; this.key = new SecretKeySpec(HexToBytes(key), "AES"); this.plainText = HexToBytes(pt); this.aad = HexToBytes(aad); this.cipherText = HexToBytes(ct); this.tag = HexToBytes(tag); this.spec = new GCMParameterSpec(this.tag.length * 8, HexToBytes(iv)); - this.info = "key=" + key + ", iv=" + iv + ", pt=" + pt + + this.info = "id = " + id + ", key=" + key + ", iv=" + iv + ", pt=" + pt + ",aad=" + aad + ", ct=" + ct + ", tag=" + tag; } + TestVector() {}; + + TestVector duplicate() { + TestVector t = new TestVector(); + t.id = id; + t.key = key; + t.plainText = plainText; + t.cipherText = cipherText; + t.aad = aad; + t.tag = tag; + t.spec = spec; + t.info = info; + return t; + } + public String toString() { return info; } } + static boolean testFailed = false; + // These test vectors are found off NIST's CAVP page // http://csrc.nist.gov/groups/STM/cavp/index.html // inside the link named "GCM Test Vectors", i.e. @@ -88,53 +108,53 @@ public String toString() { private static TestVector[] testValues = { // 96-bit iv w/ 128/120/112/104/96-bit tags // no plain text, no aad - new TestVector("11754cd72aec309bf52f7687212e8957", + new TestVector(1, "11754cd72aec309bf52f7687212e8957", "3c819d9a9bed087615030b65", null, null, null, "250327c674aaf477aef2675748cf6971"), - new TestVector("272f16edb81a7abbea887357a58c1917", + new TestVector(2, "272f16edb81a7abbea887357a58c1917", "794ec588176c703d3d2a7a07", null, null, null, "b6e6f197168f5049aeda32dafbdaeb"), - new TestVector("81b6844aab6a568c4556a2eb7eae752f", + new TestVector(3, "81b6844aab6a568c4556a2eb7eae752f", "ce600f59618315a6829bef4d", null, null, null, "89b43e9dbc1b4f597dbbc7655bb5"), - new TestVector("cde2f9a9b1a004165ef9dc981f18651b", + new TestVector(4, "cde2f9a9b1a004165ef9dc981f18651b", "29512c29566c7322e1e33e8e", null, null, null, "2e58ce7dabd107c82759c66a75"), - new TestVector("b01e45cc3088aaba9fa43d81d481823f", + new TestVector(5, "b01e45cc3088aaba9fa43d81d481823f", "5a2c4a66468713456a4bd5e1", null, null, null, "014280f944f53c681164b2ff"), // 96-bit iv w/ 128/120/112/104/96-bit tags // no plain text, 16-byte aad - new TestVector("77be63708971c4e240d1cb79e8d77feb", + new TestVector(6, "77be63708971c4e240d1cb79e8d77feb", "e0e00f19fed7ba0136a797f3", null, "7a43ec1d9c0a5a78a0b16533a6213cab", null, "209fcc8d3675ed938e9c7166709dd946"), - new TestVector("da0b615656135194ba6d3c851099bc48", + new TestVector(7, "da0b615656135194ba6d3c851099bc48", "d39d4b4d3cc927885090e6c3", null, "e7e5e6f8dac913036cb2ff29e8625e0e", null, "ab967711a5770461724460b07237e2"), - new TestVector("7e0986937a88eef894235aba4a2f43b2", + new TestVector(8, "7e0986937a88eef894235aba4a2f43b2", "92c4a631695907166b422d60", null, "85c185f8518f9f2cd597a8f9208fc76b", null, "3bb916b728df94fe9d1916736be1"), - new TestVector("c3db570d7f0c21e86b028f11465d1dc9", + new TestVector(9, "c3db570d7f0c21e86b028f11465d1dc9", "f86970f58ceef89fc7cb679e", null, "c095240708c0f57c288d86090ae34ee1", null, "e043c52160d652e82c7262fcf4"), - new TestVector("bea48ae4980d27f357611014d4486625", + new TestVector(10, "bea48ae4980d27f357611014d4486625", "32bddb5c3aa998a08556454c", null, "8a50b0b8c7654bced884f7f3afda2ead", @@ -142,56 +162,56 @@ public String toString() { "8e0f6d8bf05ffebe6f500eb1"), // 96-bit iv w/ 128/120/112/104/96-bit tags // no plain text, 20-byte aad - new TestVector("2fb45e5b8f993a2bfebc4b15b533e0b4", + new TestVector(11, "2fb45e5b8f993a2bfebc4b15b533e0b4", "5b05755f984d2b90f94b8027", null, "e85491b2202caf1d7dce03b97e09331c32473941", null, "c75b7832b2a2d9bd827412b6ef5769db"), - new TestVector("9bf406339fcef9675bbcf156aa1a0661", + new TestVector(12, "9bf406339fcef9675bbcf156aa1a0661", "8be4a9543d40f542abacac95", null, "7167cbf56971793186333a6685bbd58d47d379b3", null, "5e7968d7bbd5ba58cfcc750e2ef8f1"), - new TestVector("a2e962fff70fd0f4d63be728b80556fc", + new TestVector(13, "a2e962fff70fd0f4d63be728b80556fc", "1fa7103483de43d09bc23db4", null, "2a58edf1d53f46e4e7ee5e77ee7aeb60fc360658", null, "fa37f2dbbefab1451eae1d0d74ca"), - new TestVector("6bf4fdce82926dcdfc52616ed5f23695", + new TestVector(14, "6bf4fdce82926dcdfc52616ed5f23695", "cc0f5899a10615567e1193ed", null, "3340655592374c1da2f05aac3ee111014986107f", null, "8ad3385cce3b5e7c985908192c"), - new TestVector("4df7a13e43c3d7b66b1a72fac5ba398e", + new TestVector(15, "4df7a13e43c3d7b66b1a72fac5ba398e", "97179a3a2d417908dcf0fb28", null, "cbb7fc0010c255661e23b07dbd804b1e06ae70ac", null, "37791edae6c137ea946cfb40"), // 96-bit iv w/ 128-bit tags, 13/16/32/51-byte plain text, no aad - new TestVector("fe9bb47deb3a61e423c2231841cfd1fb", + new TestVector(16, "fe9bb47deb3a61e423c2231841cfd1fb", "4d328eb776f500a2f7fb47aa", "f1cc3818e421876bb6b8bbd6c9", null, "b88c5c1977b35b517b0aeae967", "43fd4727fe5cdb4b5b42818dea7ef8c9"), - new TestVector("7fddb57453c241d03efbed3ac44e371c", + new TestVector(17, "7fddb57453c241d03efbed3ac44e371c", "ee283a3fc75575e33efd4887", "d5de42b461646c255c87bd2962d3b9a2", null, "2ccda4a5415cb91e135c2a0f78c9b2fd", "b36d1df9b9d5e596f83e8b7f52971cb3"), - new TestVector("9971071059abc009e4f2bd69869db338", + new TestVector(18, "9971071059abc009e4f2bd69869db338", "07a9a95ea3821e9c13c63251", "f54bc3501fed4f6f6dfb5ea80106df0bd836e6826225b75c0222f6e859b35983", null, "0556c159f84ef36cb1602b4526b12009c775611bffb64dc0d9ca9297cd2c6a01", "7870d9117f54811a346970f1de090c41"), - new TestVector("594157ec4693202b030f33798b07176d", + new TestVector(19, "594157ec4693202b030f33798b07176d", "49b12054082660803a1df3df", "3feef98a976a1bd634f364ac428bb59cd51fb159ec1789946918dbd50ea6c9d594a3a31a5269b0da6936c29d063a5fa2cc8a1c", @@ -200,26 +220,26 @@ public String toString() { "c1b7a46a335f23d65b8db4008a49796906e225474f4fe7d39e55bf2efd97fd82d4167de082ae30fa01e465a601235d8d68bc69", "ba92d3661ce8b04687e8788d55417dc2"), // 96-bit iv w/ 128-bit tags, 16-byte plain text, 16/20/48/90-byte aad - new TestVector("c939cc13397c1d37de6ae0e1cb7c423c", + new TestVector(20, "c939cc13397c1d37de6ae0e1cb7c423c", "b3d8cc017cbb89b39e0f67e2", "c3b3c41f113a31b73d9a5cd432103069", "24825602bd12a984e0092d3e448eda5f", "93fe7d9e9bfd10348a5606e5cafa7354", "0032a1dc85f1c9786925a2e71d8272dd"), - new TestVector("d4a22488f8dd1d5c6c19a7d6ca17964c", + new TestVector(21, "d4a22488f8dd1d5c6c19a7d6ca17964c", "f3d5837f22ac1a0425e0d1d5", "7b43016a16896497fb457be6d2a54122", "f1c5d424b83f96c6ad8cb28ca0d20e475e023b5a", "c2bd67eef5e95cac27e3b06e3031d0a8", "f23eacf9d1cdf8737726c58648826e9c"), - new TestVector("89850dd398e1f1e28443a33d40162664", + new TestVector(22, "89850dd398e1f1e28443a33d40162664", "e462c58482fe8264aeeb7231", "2805cdefb3ef6cc35cd1f169f98da81a", "d74e99d1bdaa712864eec422ac507bddbe2b0d4633cd3dff29ce5059b49fe868526c59a2a3a604457bc2afea866e7606", "ba80e244b7fc9025cd031d0f63677e06", "d84a8c3eac57d1bb0e890a8f461d1065"), - new TestVector("bd7c5c63b7542b56a00ebe71336a1588", + new TestVector(23, "bd7c5c63b7542b56a00ebe71336a1588", "87721f23ba9c3c8ea5571abc", "de15ddbb1e202161e8a79af6a55ac6f3", @@ -227,17 +247,17 @@ public String toString() { "41eb28c0fee4d762de972361c863bc80", "9cb567220d0b252eb97bff46e4b00ff8"), // 8/1024-bit iv w/ 128-bit tag, no plain text, no aad - new TestVector("1672c3537afa82004c6b8a46f6f0d026", + new TestVector(24, "1672c3537afa82004c6b8a46f6f0d026", "05", null, null, null, "8e2ad721f9455f74d8b53d3141f27e8e"), - new TestVector("d0f1f4defa1e8c08b4b26d576392027c", + new TestVector(25, "d0f1f4defa1e8c08b4b26d576392027c", "42b4f01eb9f5a1ea5b1eb73b0fb0baed54f387ecaa0393c7d7dffc6af50146ecc021abf7eb9038d4303d91f8d741a11743166c0860208bcc02c6258fd9511a2fa626f96d60b72fcff773af4e88e7a923506e4916ecbd814651e9f445adef4ad6a6b6c7290cc13b956130eef5b837c939fcac0cbbcc9656cd75b13823ee5acdac", null, null, null, "7ab49b57ddf5f62c427950111c5c4f0d"), // 8-bit iv w/ 128-bit tag, 13-byte plain text, 90-byte aad - new TestVector("9f79239f0904eace50784b863e723f6b", + new TestVector(26, "9f79239f0904eace50784b863e723f6b", "d9", "bdb0bb10c87965acd34d146171", @@ -245,7 +265,7 @@ public String toString() { "7e5a7c8dadb3f0c7335b4d9d8d", "6b6ef1f53723a89f3bb7c6d043840717"), // 1024-bit iv w/ 128-bit tag, 51-byte plain text, 48-byte aad - new TestVector("141f1ce91989b07e7eb6ae1dbd81ea5e", + new TestVector(27, "141f1ce91989b07e7eb6ae1dbd81ea5e", "49451da24bd6074509d3cebc2c0394c972e6934b45a1d91f3ce1d3ca69e194aa1958a7c21b6f21d530ce6d2cc5256a3f846b6f9d2f38df0102c4791e57df038f6e69085646007df999751e248e06c47245f4cd3b8004585a7470dee1690e9d2d63169a58d243c0b57b3e5b4a481a3e4e8c60007094ef3adea2e8f05dd3a1396f", @@ -257,56 +277,139 @@ public String toString() { "dbb93bbb56d0439cd09f620a57687f5d"), }; - public boolean execute(TestVector[] testValues) throws Exception { - boolean testFailed = false; + void executeArray(TestVector tv) throws Exception { Cipher c = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE"); - for (int i = 0; i < testValues.length; i++) { - try { - c.init(Cipher.ENCRYPT_MODE, testValues[i].key, testValues[i].spec); - c.updateAAD(testValues[i].aad); - byte[] ctPlusTag = c.doFinal(testValues[i].plainText); - - c.init(Cipher.DECRYPT_MODE, testValues[i].key, testValues[i].spec); - c.updateAAD(testValues[i].aad); - byte[] pt = c.doFinal(ctPlusTag); // should fail if tag mismatched - - // check encryption/decryption results just to be sure - if (!Arrays.equals(testValues[i].plainText, pt)) { - System.out.println("PlainText diff failed for test# " + i); - testFailed = true; - } - int ctLen = testValues[i].cipherText.length; - if (!Arrays.equals(testValues[i].cipherText, - Arrays.copyOf(ctPlusTag, ctLen))) { - System.out.println("CipherText diff failed for test# " + i); - testFailed = true; - } - int tagLen = testValues[i].tag.length; - if (!Arrays.equals - (testValues[i].tag, - Arrays.copyOfRange(ctPlusTag, ctLen, ctLen+tagLen))) { - System.out.println("Tag diff failed for test# " + i); - testFailed = true; - } - } catch (Exception ex) { - // continue testing other test vectors - System.out.println("Failed Test Vector: " + testValues[i]); - ex.printStackTrace(); + try { + System.out.println("Test #" + tv.id + ": byte[]."); + + c.init(Cipher.ENCRYPT_MODE, tv.key, tv.spec); + c.updateAAD(tv.aad); + byte[] ctPlusTag = c.doFinal(tv.plainText); + + c.init(Cipher.DECRYPT_MODE, tv.key, tv.spec); + c.updateAAD(tv.aad); + byte[] pt = c.doFinal(ctPlusTag); // should fail if tag mismatched + + // check encryption/decryption results just to be sure + if (!Arrays.equals(tv.plainText, pt)) { + System.out.println("PlainText diff failed for test# " + tv.id); testFailed = true; - continue; } + int ctLen = tv.cipherText.length; + if (!Arrays.equals(tv.cipherText, + Arrays.copyOf(ctPlusTag, ctLen))) { + System.out.println("CipherText diff failed for test# " + tv.id); + testFailed = true; + } + int tagLen = tv.tag.length; + if (!Arrays.equals + (tv.tag, + Arrays.copyOfRange(ctPlusTag, ctLen, ctLen+tagLen))) { + System.out.println("Tag diff failed for test# " + tv.id); + testFailed = true; + } + } catch (Exception ex) { + // continue testing other test vectors + System.out.println("Failed Test Vector: " + tv); + ex.printStackTrace(); + testFailed = true; } if (testFailed) { throw new Exception("Test Failed"); } - // passed all tests...hooray! - return true; + } + + void executeByteBuffer(TestVector tv, boolean direct, int offset) throws Exception { + Cipher c = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE"); + + ByteBuffer src; + ByteBuffer ctdst; + ByteBuffer ptdst; + + if (direct) { + System.out.print("Test #" + tv.id + ": ByteBuffer Direct."); + src = ByteBuffer.allocateDirect(tv.plainText.length + offset); + ctdst = ByteBuffer.allocateDirect(tv.cipherText.length + tv.tag.length + offset); + ptdst = ByteBuffer.allocateDirect(tv.plainText.length + offset); + } else { + System.out.print("Test #" + tv.id + ": ByteBuffer Heap."); + src = ByteBuffer.allocate(tv.plainText.length + offset); + ctdst = ByteBuffer.allocate(tv.cipherText.length + tv.tag.length + offset); + ptdst = ByteBuffer.allocate(tv.plainText.length + offset); + } + + byte[] plainText; + + if (offset > 0) { + System.out.println(" offset = " + offset); + plainText = new byte[tv.plainText.length + offset]; + System.arraycopy(tv.plainText, 0, plainText, offset, + tv.plainText.length); + } else { + System.out.println(); + plainText = tv.plainText; + } + + src.put(plainText); + src.position(offset); + ctdst.position(offset); + ctdst.mark(); + ptdst.position(offset); + ptdst.mark(); + + try { + c.init(Cipher.ENCRYPT_MODE, tv.key, tv.spec); + c.updateAAD(tv.aad); + c.doFinal(src, ctdst); + + ctdst.reset(); + ByteBuffer tag = ctdst.duplicate(); + tag.position(tag.limit() - tv.tag.length); + + c.init(Cipher.DECRYPT_MODE, tv.key, tv.spec); + c.updateAAD(tv.aad); + c.doFinal(ctdst, ptdst); // should fail if tag mismatched + + ptdst.reset(); + // check encryption/decryption results just to be sure + if (ptdst.compareTo(ByteBuffer.wrap(tv.plainText)) != 0) { + System.out.println("\t PlainText diff failed for test# " + tv.id); + testFailed = true; + } + + ctdst.reset(); + ctdst.limit(ctdst.limit() - tv.tag.length); + if (ctdst.compareTo(ByteBuffer.wrap(tv.cipherText)) != 0) { + System.out.println("\t CipherText diff failed for test# " + tv.id); + testFailed = true; + } + + int mismatch = 0; + for (int i = 0; i < tv.tag.length; i++) { + mismatch |= tag.get() ^ tv.tag[i]; + } + if (mismatch != 0) { + System.out.println("\t Tag diff failed for test# " + tv.id); + testFailed = true; + } + } catch (Exception ex) { + // continue testing other test vectors + System.out.println("\t Failed Test Vector ( #" + tv.id + ") : " + tv); + ex.printStackTrace(); + } } public static void main (String[] args) throws Exception { TestKATForGCM test = new TestKATForGCM(); - if (test.execute(testValues)) { - System.out.println("Test Passed!"); + for (TestVector tv : testValues) { + test.executeArray(tv); + test.executeByteBuffer(tv, false, 0); + test.executeByteBuffer(tv, true, 0); + test.executeByteBuffer(tv, false, 2); + test.executeByteBuffer(tv, true, 2); + } + if (!testFailed) { + System.out.println("Tests passed"); } } } diff --git a/test/jdk/com/sun/crypto/provider/Cipher/TextLength/SameBufferOverwrite.java b/test/jdk/com/sun/crypto/provider/Cipher/TextLength/SameBufferOverwrite.java new file mode 100644 index 0000000000000..d110c05a339ef --- /dev/null +++ b/test/jdk/com/sun/crypto/provider/Cipher/TextLength/SameBufferOverwrite.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2020, 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 javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import java.security.AlgorithmParameters; +import java.util.Arrays; + + +/* + * @test + * @summary Verify when decrypting over an existing buffer than padding does not + * overwrite past what the plaintext length is. + * + */ + +public class SameBufferOverwrite { + + private SecretKey skey; + private Cipher c; + private int start = 17, end = 17; // default + + SameBufferOverwrite(String algo, String transformation) + throws Exception { + + KeyGenerator kg = KeyGenerator.getInstance(algo, "SunJCE"); + skey = kg.generateKey(); + c = Cipher.getInstance(transformation, "SunJCE"); + } + + /* + * Run the test + */ + void test() throws Exception { + byte[] in = new byte[end + (c.getBlockSize() - (end % c.getBlockSize()))]; + Arrays.fill(in, (byte)8); + int len = start; + AlgorithmParameters params = null; + + System.out.println("Testing transformation: " + c.getAlgorithm() + + ", byte length from " + start + " to " + end); + while (end >= len) { + // encrypt + c.init(Cipher.ENCRYPT_MODE, skey, params); + byte[] out = c.doFinal(in, 0, len); + System.out.println(" enc = " + byteToHex(out)); + System.out.println(" => enc " + len + " bytes, ret " + + (out == null ? "null" : (out.length + " byte"))); + + // decrypt + params = c.getParameters(); + c.init(Cipher.DECRYPT_MODE, skey, params); + int rLen = c.doFinal(out, 0, out.length, in); + System.out.println(" dec = " + byteToHex(in)); + System.out.println(" => dec " + out.length + " bytes, ret " + + rLen + " byte"); + // check if more than rLen bytes are written into 'in' + for (int j = rLen; j < in.length; j++) { + if (in[j] != (byte) 8) { + throw new Exception("Value check failed at index " + j); + } + } + System.out.println(" Test Passed: len = " + len); + len++; + + // Because GCM doesn't allow params reuse + if (c.getAlgorithm().contains("GCM")) { + params = null; + } + } + } + + /** + * Builder method for the test to run data lengths from the start value to + * the end value. To do one length, have start and end equal that number. + * @param start starting data length + * @param end ending data length + */ + SameBufferOverwrite iterate(int start, int end) { + this.start = start; + this.end = end; + return this; + } + + public static void main(String args[]) throws Exception { + new SameBufferOverwrite("AES", "AES/GCM/NoPadding").iterate(1, 25). + test(); + new SameBufferOverwrite("AES", "AES/CTR/NoPadding").iterate(1, 25). + test(); + new SameBufferOverwrite("AES", "AES/CBC/PKCS5Padding").iterate(1, 25). + test(); + new SameBufferOverwrite("AES", "AES/ECB/PKCS5Padding").iterate(1, 25). + test(); + new SameBufferOverwrite("DES", "DES/CBC/PKCS5Padding").iterate(1, 17). + test(); + new SameBufferOverwrite("DESede", "DESede/CBC/PKCS5Padding").iterate(1, 17). + test(); + } + + private static String byteToHex(byte[] barray) { + StringBuilder s = new StringBuilder(); + for (byte b : barray) { + s.append(String.format("%02x", b)); + } + return s.toString(); + } +} diff --git a/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java b/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java index 2fdd4f05a6973..260d667714744 100644 --- a/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java +++ b/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020 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,15 +26,21 @@ * @bug 8181386 * @summary CipherSpi ByteBuffer to byte array conversion fails for * certain data overlap conditions - * @run main CipherByteBufferOverwriteTest 0 false - * @run main CipherByteBufferOverwriteTest 0 true - * @run main CipherByteBufferOverwriteTest 4 false - * @run main CipherByteBufferOverwriteTest 4 true + * @run main CipherByteBufferOverwriteTest AES/CBC/PKCS5Padding 0 false + * @run main CipherByteBufferOverwriteTest AES/CBC/PKCS5Padding 0 true + * @run main CipherByteBufferOverwriteTest AES/CBC/PKCS5Padding 4 false + * @run main CipherByteBufferOverwriteTest AES/CBC/PKCS5Padding 4 true + * @run main CipherByteBufferOverwriteTest AES/GCM/NoPadding 0 false + * @run main CipherByteBufferOverwriteTest AES/GCM/NoPadding 0 true + * @run main CipherByteBufferOverwriteTest AES/GCM/NoPadding 4 false + * @run main CipherByteBufferOverwriteTest AES/GCM/NoPadding 4 true */ +import java.math.BigInteger; import java.security.spec.AlgorithmParameterSpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.nio.ByteBuffer; @@ -44,7 +50,7 @@ public class CipherByteBufferOverwriteTest { private static final boolean DEBUG = false; - private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding"; + private static String transformation; // must be larger than the temp array size, i.e. 4096, hardcoded in // javax.crypto.CipherSpi class @@ -53,8 +59,7 @@ public class CipherByteBufferOverwriteTest { private static final int CIPHERTEXT_BUFFER_SIZE = PLAINTEXT_SIZE + 32; private static final SecretKey KEY = new SecretKeySpec(new byte[16], "AES"); - private static final AlgorithmParameterSpec PARAMS = - new IvParameterSpec(new byte[16]); + private static AlgorithmParameterSpec params; private static ByteBuffer inBuf; private static ByteBuffer outBuf; @@ -65,9 +70,15 @@ private enum BufferType { public static void main(String[] args) throws Exception { - int offset = Integer.parseInt(args[0]); - boolean useRO = Boolean.parseBoolean(args[1]); + transformation = args[0]; + int offset = Integer.parseInt(args[1]); + boolean useRO = Boolean.parseBoolean(args[2]); + if (transformation.equalsIgnoreCase("AES/GCM/NoPadding")) { + params = new GCMParameterSpec(16 * 8, new byte[16]); + } else { + params = new IvParameterSpec(new byte[16]); + } // an all-zeros plaintext is the easiest way to demonstrate the issue, // but it fails with any plaintext, of course byte[] expectedPT = new byte[PLAINTEXT_SIZE]; @@ -75,8 +86,8 @@ public static void main(String[] args) throws Exception { System.arraycopy(expectedPT, 0, buf, 0, PLAINTEXT_SIZE); // generate expected cipher text using byte[] methods - Cipher c = Cipher.getInstance(TRANSFORMATION); - c.init(Cipher.ENCRYPT_MODE, KEY, PARAMS); + Cipher c = Cipher.getInstance(transformation); + c.init(Cipher.ENCRYPT_MODE, KEY, params); byte[] expectedCT = c.doFinal(expectedPT); // Test#1: against ByteBuffer generated with allocate(int) call @@ -89,9 +100,9 @@ public static void main(String[] args) throws Exception { // Test#2: against direct ByteBuffer prepareBuffers(BufferType.DIRECT, useRO, buf.length, buf, 0, PLAINTEXT_SIZE, offset); - System.out.println("\tDIRECT: passed"); runTest(offset, expectedPT, expectedCT); + System.out.println("\tDIRECT: passed"); // Test#3: against ByteBuffer wrapping existing array prepareBuffers(BufferType.WRAP, useRO, buf.length, @@ -150,8 +161,8 @@ private static void prepareBuffers(BufferType type, private static void runTest(int ofs, byte[] expectedPT, byte[] expectedCT) throws Exception { - Cipher c = Cipher.getInstance(TRANSFORMATION); - c.init(Cipher.ENCRYPT_MODE, KEY, PARAMS); + Cipher c = Cipher.getInstance(transformation); + c.init(Cipher.ENCRYPT_MODE, KEY, params); int ciphertextSize = c.doFinal(inBuf, outBuf); // read out the encrypted result @@ -166,14 +177,20 @@ private static void runTest(int ofs, byte[] expectedPT, byte[] expectedCT) outBuf.get(finalCT); if (!Arrays.equals(finalCT, expectedCT)) { + System.err.println("Ciphertext mismatch:" + + "\nresult (len=" + finalCT.length + "):\n" + + String.format("%0" + (finalCT.length << 1) + "x", + new BigInteger(1, finalCT)) + + "\nexpected (len=" + expectedCT.length + "):\n" + + String.format("%0" + (expectedCT.length << 1) + "x", + new BigInteger(1, expectedCT))); throw new Exception("ERROR: Ciphertext does not match"); } // now do decryption outBuf.position(ofs); outBuf.limit(ofs + ciphertextSize); - - c.init(Cipher.DECRYPT_MODE, KEY, PARAMS); + c.init(Cipher.DECRYPT_MODE, KEY, params); ByteBuffer finalPTBuf = ByteBuffer.allocate( c.getOutputSize(outBuf.remaining())); c.doFinal(outBuf, finalPTBuf); @@ -184,6 +201,13 @@ private static void runTest(int ofs, byte[] expectedPT, byte[] expectedCT) finalPTBuf.get(finalPT); if (!Arrays.equals(finalPT, expectedPT)) { + System.err.println("Ciphertext mismatch " + + "):\nresult (len=" + finalCT.length + "):\n" + + String.format("%0" + (finalCT.length << 1) + "x", + new BigInteger(1, finalCT)) + + "\nexpected (len=" + expectedCT.length + "):\n" + + String.format("%0" + (expectedCT.length << 1) + "x", + new BigInteger(1, expectedCT))); throw new Exception("ERROR: Plaintext does not match"); } } diff --git a/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java b/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java index b0d15afc53627..98c7afb2738f7 100644 --- a/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java +++ b/test/jdk/javax/net/ssl/SSLSession/CheckSessionContext.java @@ -31,11 +31,21 @@ * @run main/othervm -Djdk.tls.client.protocols=TLSv1.2 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true CheckSessionContext * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=false CheckSessionContext * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=true -Djdk.tls.client.enableSessionTicketExtension=true CheckSessionContext + * @run main/othervm -Djdk.tls.client.protocols=TLSv1.3 -Djdk.tls.server.enableSessionTicketExtension=false -Djdk.tls.client.enableSessionTicketExtension=true CheckSessionContext * */ +import javax.net.ssl.SSLSession; + public class CheckSessionContext { + static void toHex(byte[] id) { + for (byte b : id) { + System.out.printf("%02X ", b); + } + System.out.println(); + } + public static void main(String[] args) throws Exception { TLSBase.Server server = new TLSBase.Server(); @@ -46,6 +56,17 @@ public static void main(String[] args) throws Exception { } else { System.out.println("Context was found"); } + SSLSession ss = server.getSession(client1); + System.out.println(ss); + byte[] id = ss.getId(); + System.out.print("id = "); + toHex(id); + System.out.println("ss.getSessionContext().getSession(id) = " + ss.getSessionContext().getSession(id)); + if (ss.getSessionContext().getSession(id) != null) { + id = ss.getSessionContext().getSession(id).getId(); + System.out.print("id = "); + toHex(id); + } server.close(client1); client1.close(); From 02a0a027f49765e6d9103ef3169008d33176edd9 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 3 Dec 2020 01:34:04 +0000 Subject: [PATCH 033/504] 8257563: Remove excessive include of klass.inline.hpp Reviewed-by: dholmes, stuefe, stefank --- .../arm/templateInterpreterGenerator_arm.cpp | 1 + src/hotspot/cpu/arm/templateTable_arm.cpp | 1 + .../ppc/templateInterpreterGenerator_ppc.cpp | 1 + src/hotspot/cpu/s390/s390.ad | 2 + .../templateInterpreterGenerator_s390.cpp | 1 + src/hotspot/cpu/s390/templateTable_s390.cpp | 1 + .../x86/templateInterpreterGenerator_x86.cpp | 1 + .../cpu/zero/bytecodeInterpreter_zero.cpp | 1 + src/hotspot/cpu/zero/methodHandles_zero.cpp | 2 + src/hotspot/cpu/zero/zeroInterpreter_zero.cpp | 1 + src/hotspot/share/c1/c1_Runtime1.cpp | 1 + src/hotspot/share/ci/ciEnv.cpp | 1 + src/hotspot/share/ci/ciField.cpp | 2 + src/hotspot/share/ci/ciInstanceKlass.cpp | 3 + src/hotspot/share/ci/ciKlass.cpp | 3 +- src/hotspot/share/ci/ciReplay.cpp | 2 + src/hotspot/share/classfile/altHashing.cpp | 1 + .../share/classfile/classFileParser.cpp | 2 +- src/hotspot/share/classfile/classLoader.cpp | 1 + .../share/classfile/classLoaderData.cpp | 1 + .../share/classfile/classLoaderExt.cpp | 1 + .../share/classfile/fieldLayoutBuilder.cpp | 1 + src/hotspot/share/classfile/javaClasses.cpp | 3 +- .../classfile/systemDictionaryShared.cpp | 8 ++ .../classfile/systemDictionaryShared.hpp | 11 +-- src/hotspot/share/classfile/verifier.cpp | 3 +- src/hotspot/share/classfile/vmSymbols.cpp | 1 + src/hotspot/share/code/vtableStubs.cpp | 1 + src/hotspot/share/compiler/compileBroker.cpp | 1 + src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp | 1 + .../gc/shared/modRefBarrierSet.inline.hpp | 5 +- .../share/interpreter/interpreterRuntime.cpp | 3 +- .../share/interpreter/linkResolver.cpp | 3 +- .../interpreter/zero/bytecodeInterpreter.cpp | 3 + .../jfrEventClassTransformer.cpp | 1 + src/hotspot/share/jfr/jni/jfrJavaSupport.cpp | 1 + .../recorder/checkpoint/types/jfrTypeSet.cpp | 2 +- .../share/jfr/support/jfrJdkJfrEvent.cpp | 3 +- .../share/jvmci/jvmciCodeInstaller.cpp | 1 + src/hotspot/share/jvmci/jvmciCompilerToVM.cpp | 1 + src/hotspot/share/jvmci/jvmciJavaClasses.cpp | 1 + src/hotspot/share/jvmci/jvmciRuntime.cpp | 1 + src/hotspot/share/memory/dynamicArchive.cpp | 1 + src/hotspot/share/memory/metaspaceShared.cpp | 1 + src/hotspot/share/memory/universe.cpp | 1 + src/hotspot/share/oops/arrayKlass.cpp | 1 + src/hotspot/share/oops/constantPool.cpp | 1 + src/hotspot/share/oops/instanceKlass.hpp | 82 +++---------------- .../share/oops/instanceKlass.inline.hpp | 79 +++++++++++++++++- src/hotspot/share/oops/klassVtable.cpp | 3 +- src/hotspot/share/oops/method.cpp | 1 + src/hotspot/share/oops/oop.inline.hpp | 1 - src/hotspot/share/prims/jni.cpp | 1 + src/hotspot/share/prims/jvm.cpp | 1 + src/hotspot/share/prims/jvmtiEnv.cpp | 1 + src/hotspot/share/prims/jvmtiEnvBase.cpp | 2 + src/hotspot/share/prims/jvmtiExport.cpp | 1 + .../share/prims/jvmtiGetLoadedClasses.cpp | 4 +- src/hotspot/share/prims/jvmtiImpl.cpp | 2 + .../share/prims/jvmtiRedefineClasses.cpp | 1 + src/hotspot/share/prims/jvmtiTagMap.cpp | 1 + src/hotspot/share/prims/methodHandles.cpp | 1 + src/hotspot/share/prims/nativeLookup.cpp | 1 + src/hotspot/share/prims/stackwalk.cpp | 1 + .../share/prims/universalUpcallHandler.cpp | 1 + src/hotspot/share/prims/unsafe.cpp | 1 + src/hotspot/share/prims/vectorSupport.cpp | 1 + src/hotspot/share/prims/whitebox.cpp | 1 + src/hotspot/share/runtime/fieldDescriptor.cpp | 3 +- src/hotspot/share/runtime/java.cpp | 1 + src/hotspot/share/runtime/objectMonitor.cpp | 2 + src/hotspot/share/runtime/reflection.cpp | 3 +- src/hotspot/share/runtime/sharedRuntime.cpp | 1 + src/hotspot/share/runtime/signature.cpp | 1 + src/hotspot/share/runtime/statSampler.cpp | 3 +- src/hotspot/share/runtime/thread.cpp | 2 + .../share/services/diagnosticCommand.cpp | 1 + src/hotspot/share/services/gcNotifier.cpp | 1 + src/hotspot/share/services/heapDumper.cpp | 1 + src/hotspot/share/services/management.cpp | 2 + src/hotspot/share/services/memoryManager.cpp | 2 + src/hotspot/share/services/memoryPool.cpp | 2 + src/hotspot/share/services/threadService.cpp | 1 + src/hotspot/share/utilities/debug.cpp | 1 + src/hotspot/share/utilities/exceptions.cpp | 1 + 85 files changed, 209 insertions(+), 96 deletions(-) diff --git a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp index 0af4a3e9ade76..aa9d1e117c349 100644 --- a/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "classfile/javaClasses.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interp_masm.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/arm/templateTable_arm.cpp b/src/hotspot/cpu/arm/templateTable_arm.cpp index 6ca5d10b23c31..ccfd7a6f166b2 100644 --- a/src/hotspot/cpu/arm/templateTable_arm.cpp +++ b/src/hotspot/cpu/arm/templateTable_arm.cpp @@ -31,6 +31,7 @@ #include "interpreter/templateTable.hpp" #include "memory/universe.hpp" #include "oops/cpCache.hpp" +#include "oops/klass.inline.hpp" #include "oops/methodData.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index a59265a714c83..59af7c64e3404 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" +#include "classfile/javaClasses.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index b924b74f1ee24..b05432d6dc036 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -1325,6 +1325,8 @@ source_hpp %{ // To keep related declarations/definitions/uses close together, // we switch between source %{ }% and source_hpp %{ }% freely as needed. +#include "oops/klass.inline.hpp" + //-------------------------------------------------------------- // Used for optimization in Compile::Shorten_branches //-------------------------------------------------------------- diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp index e1862f11c493c..9014a3045ce83 100644 --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" +#include "classfile/javaClasses.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/abstractInterpreter.hpp" #include "interpreter/bytecodeHistogram.hpp" diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp index daaacf27fb215..485d6d962e898 100644 --- a/src/hotspot/cpu/s390/templateTable_s390.cpp +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp @@ -31,6 +31,7 @@ #include "interpreter/interp_masm.hpp" #include "interpreter/templateTable.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/methodData.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index 072b3d144fa8d..2025f41ffb608 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" +#include "classfile/javaClasses.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/bytecodeHistogram.hpp" diff --git a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp index f165de3a086af..de44d3afb5842 100644 --- a/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp +++ b/src/hotspot/cpu/zero/bytecodeInterpreter_zero.cpp @@ -28,6 +28,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/zero/bytecodeInterpreter.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/cpu/zero/methodHandles_zero.cpp b/src/hotspot/cpu/zero/methodHandles_zero.cpp index 851be31fe3773..fa347e427cd3c 100644 --- a/src/hotspot/cpu/zero/methodHandles_zero.cpp +++ b/src/hotspot/cpu/zero/methodHandles_zero.cpp @@ -30,6 +30,8 @@ #include "interpreter/zero/zeroInterpreterGenerator.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/frame.inline.hpp" diff --git a/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp index 900e65b416a8c..9300338051b59 100644 --- a/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp +++ b/src/hotspot/cpu/zero/zeroInterpreter_zero.cpp @@ -33,6 +33,7 @@ #include "interpreter/zero/zeroInterpreterGenerator.hpp" #include "oops/access.inline.hpp" #include "oops/cpCache.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index c06c5bca085e6..8045fbfaa59e6 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -52,6 +52,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index 04db31908d266..cb823998e309e 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -33,6 +33,7 @@ #include "ci/ciNullObject.hpp" #include "ci/ciReplay.hpp" #include "ci/ciUtilities.inline.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index f5abad6bc1079..83af90fe51fa6 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -26,9 +26,11 @@ #include "ci/ciField.hpp" #include "ci/ciInstanceKlass.hpp" #include "ci/ciUtilities.inline.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "interpreter/linkResolver.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index 4fb1be82e988f..85ab8d353401f 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -28,9 +28,12 @@ #include "ci/ciInstanceKlass.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/javaClasses.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/fieldStreams.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" diff --git a/src/hotspot/share/ci/ciKlass.cpp b/src/hotspot/share/ci/ciKlass.cpp index 8ceb326dd69f0..c78a761bad501 100644 --- a/src/hotspot/share/ci/ciKlass.cpp +++ b/src/hotspot/share/ci/ciKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2020, 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,7 @@ #include "ci/ciKlass.hpp" #include "ci/ciSymbol.hpp" #include "ci/ciUtilities.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" // ciKlass diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index fc66729a3bb77..1395f24cff0d4 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -29,12 +29,14 @@ #include "ci/ciSymbol.hpp" #include "ci/ciKlass.hpp" #include "ci/ciUtilities.inline.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "compiler/compileBroker.hpp" #include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/constantPool.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" diff --git a/src/hotspot/share/classfile/altHashing.cpp b/src/hotspot/share/classfile/altHashing.cpp index a01e6e29fb73d..cf9b9cffcd7ae 100644 --- a/src/hotspot/share/classfile/altHashing.cpp +++ b/src/hotspot/share/classfile/altHashing.cpp @@ -43,6 +43,7 @@ #include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/systemDictionary.hpp" +#include "oops/klass.inline.hpp" #include "oops/markWord.hpp" #include "oops/oop.inline.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index ecf83005854a4..f0463f2c3bbfb 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -50,7 +50,7 @@ #include "oops/annotations.hpp" #include "oops/constantPool.inline.hpp" #include "oops/fieldStreams.inline.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/klass.inline.hpp" #include "oops/klassVtable.hpp" diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 7b34ef939c5d4..8dcd7985a40f2 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -52,6 +52,7 @@ #include "memory/universe.hpp" #include "oops/instanceKlass.hpp" #include "oops/instanceRefKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp index ac699ada874ba..35e6bad112a05 100644 --- a/src/hotspot/share/classfile/classLoaderData.cpp +++ b/src/hotspot/share/classfile/classLoaderData.cpp @@ -64,6 +64,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/oopHandle.inline.hpp" #include "oops/weakHandle.inline.hpp" diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index 666b45404e03a..04a8923060e89 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -38,6 +38,7 @@ #include "memory/filemap.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "runtime/arguments.hpp" diff --git a/src/hotspot/share/classfile/fieldLayoutBuilder.cpp b/src/hotspot/share/classfile/fieldLayoutBuilder.cpp index 06907a56ba18a..0a5314d5ea3cd 100644 --- a/src/hotspot/share/classfile/fieldLayoutBuilder.cpp +++ b/src/hotspot/share/classfile/fieldLayoutBuilder.cpp @@ -30,6 +30,7 @@ #include "oops/array.hpp" #include "oops/fieldStreams.inline.hpp" #include "oops/instanceMirrorKlass.hpp" +#include "oops/instanceKlass.inline.hpp" #include "oops/klass.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index b05215d907bd5..4e7e977712d21 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -44,9 +44,10 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/fieldStreams.inline.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/klass.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 9c68e5f1fe7b9..063f780da51ff 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -56,6 +56,7 @@ #include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "oops/typeArrayOop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/handles.inline.hpp" @@ -710,6 +711,13 @@ static RunTimeSharedDictionary _unregistered_dictionary; static RunTimeSharedDictionary _dynamic_builtin_dictionary; static RunTimeSharedDictionary _dynamic_unregistered_dictionary; +void SystemDictionaryShared::atomic_set_array_index(OopHandle array, int index, oop o) { + // Benign race condition: array.obj_at(index) may already be filled in. + // The important thing here is that all threads pick up the same result. + // It doesn't matter which racing thread wins, as long as only one + // result is used by all threads, and all future queries. + ((objArrayOop)array.resolve())->atomic_compare_exchange_oop(index, o, NULL); +} Handle SystemDictionaryShared::create_jar_manifest(const char* manifest_chars, size_t size, TRAPS) { typeArrayOop buf = oopFactory::new_byteArray((int)size, CHECK_NH); diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp index 4da9beb834fb2..ffbe4f1596f3d 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.hpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp @@ -25,10 +25,11 @@ #ifndef SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP #define SHARE_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP -#include "oops/klass.hpp" #include "classfile/packageEntry.hpp" #include "classfile/systemDictionary.hpp" #include "memory/filemap.hpp" +#include "oops/klass.hpp" +#include "oops/oopHandle.hpp" /*=============================================================================== @@ -181,13 +182,7 @@ class SystemDictionaryShared: public SystemDictionary { static Handle get_shared_protection_domain(Handle class_loader, ModuleEntry* mod, TRAPS); - static void atomic_set_array_index(OopHandle array, int index, oop o) { - // Benign race condition: array.obj_at(index) may already be filled in. - // The important thing here is that all threads pick up the same result. - // It doesn't matter which racing thread wins, as long as only one - // result is used by all threads, and all future queries. - ((objArrayOop)array.resolve())->atomic_compare_exchange_oop(index, o, NULL); - } + static void atomic_set_array_index(OopHandle array, int index, oop o); static oop shared_protection_domain(int index); static void atomic_set_shared_protection_domain(int index, oop pd) { diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 25511485a6c48..6ea7440291adc 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -42,7 +42,8 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/constantPool.inline.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayOop.hpp" #include "runtime/arguments.hpp" diff --git a/src/hotspot/share/classfile/vmSymbols.cpp b/src/hotspot/share/classfile/vmSymbols.cpp index 4702fc95f4841..0c6c8a9897f4e 100644 --- a/src/hotspot/share/classfile/vmSymbols.cpp +++ b/src/hotspot/share/classfile/vmSymbols.cpp @@ -32,6 +32,7 @@ #include "memory/metaspaceClosure.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/signature.hpp" #include "utilities/tribool.hpp" #include "utilities/xmlstream.hpp" diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index 9b6513a08d468..d490adb3eeff9 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -30,6 +30,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/klassVtable.hpp" #include "oops/oop.inline.hpp" #include "prims/forte.hpp" diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 08f52c365c506..76b5b171379c0 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "jvm.h" +#include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index 59db5f680dc4a..9ff4d0887fed4 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -30,6 +30,7 @@ #include "gc/g1/g1ParScanThreadState.inline.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/shared/gcTimer.hpp" +#include "gc/shared/oopStorage.hpp" #include "gc/shared/workerDataArray.inline.hpp" #include "memory/resourceArea.hpp" #include "logging/log.hpp" diff --git a/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp b/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp index fb8a380f172a6..94594b923bca8 100644 --- a/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shared/modRefBarrierSet.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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,10 +28,11 @@ #include "gc/shared/barrierSet.hpp" #include "gc/shared/modRefBarrierSet.hpp" #include "oops/compressedOops.inline.hpp" -#include "oops/klass.inline.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.hpp" +class Klass; + // count is number of array elements being written void ModRefBarrierSet::write_ref_array(HeapWord* start, size_t count) { HeapWord* end = (HeapWord*)((char*)start + (count*heapOopSize)); diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index efe343bc00697..c5142cfc32e39 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -43,7 +43,8 @@ #include "memory/universe.hpp" #include "oops/constantPool.hpp" #include "oops/cpCache.inline.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/methodData.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index b96a326ad382b..bba22a037f776 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -43,7 +43,8 @@ #include "memory/resourceArea.hpp" #include "oops/constantPool.hpp" #include "oops/cpCache.inline.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" diff --git a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp index fe46f0a2cc921..3f8f5299ad002 100644 --- a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp +++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp @@ -23,6 +23,7 @@ */ // no precompiled headers +#include "classfile/javaClasses.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/threadLocalAllocBuffer.inline.hpp" @@ -35,6 +36,8 @@ #include "memory/universe.hpp" #include "oops/constantPool.inline.hpp" #include "oops/cpCache.inline.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/methodCounters.hpp" #include "oops/objArrayKlass.hpp" diff --git a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp index 56e44608bcdc4..72963943a12cb 100644 --- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp +++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp @@ -47,6 +47,7 @@ #include "memory/resourceArea.hpp" #include "oops/array.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.hpp" #include "prims/jvmtiRedefineClasses.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp index c7c38378b1fe2..7c03bbe5214ee 100644 --- a/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp +++ b/src/hotspot/share/jfr/jni/jfrJavaSupport.cpp @@ -34,6 +34,7 @@ #include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceOop.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index 1792602489c1a..6193c2109c9cf 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -40,7 +40,7 @@ #include "jfr/writers/jfrTypeWriterHost.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" #include "utilities/accessFlags.hpp" diff --git a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp index efc55c08bad8c..dfcbda88fc8b4 100644 --- a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp +++ b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -31,6 +31,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/thread.inline.hpp" #include "utilities/stack.inline.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index 058fa06872a68..e5025b9b37edf 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -30,6 +30,7 @@ #include "jvmci/jvmciRuntime.hpp" #include "memory/universe.hpp" #include "oops/compressedOops.inline.hpp" +#include "oops/klass.inline.hpp" #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index be021285601fb..4e6cf58f0d3bf 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -41,6 +41,7 @@ #include "memory/oopFactory.hpp" #include "memory/universe.hpp" #include "oops/constantPool.inline.hpp" +#include "oops/instanceKlass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/typeArrayOop.inline.hpp" #include "prims/jvmtiExport.hpp" diff --git a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp index 66782af564dd4..0e75127da3b68 100644 --- a/src/hotspot/share/jvmci/jvmciJavaClasses.cpp +++ b/src/hotspot/share/jvmci/jvmciJavaClasses.cpp @@ -28,6 +28,7 @@ #include "jvmci/jvmciJavaClasses.hpp" #include "jvmci/jvmciRuntime.hpp" #include "memory/resourceArea.hpp" +#include "oops/instanceKlass.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/jniHandles.inline.hpp" #include "runtime/java.hpp" diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 58081a3c284fd..c7ed875f85444 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -34,6 +34,7 @@ #include "memory/oopFactory.hpp" #include "memory/universe.hpp" #include "oops/constantPool.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/memory/dynamicArchive.cpp b/src/hotspot/share/memory/dynamicArchive.cpp index 5cb889f60cf21..fcaf1c38e57cb 100644 --- a/src/hotspot/share/memory/dynamicArchive.cpp +++ b/src/hotspot/share/memory/dynamicArchive.cpp @@ -34,6 +34,7 @@ #include "memory/metaspaceClosure.hpp" #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" +#include "oops/klass.inline.hpp" #include "runtime/os.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vmThread.hpp" diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index 410b25a51b43b..c5dca41b9c814 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -56,6 +56,7 @@ #include "memory/universe.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/instanceMirrorKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" #include "oops/oopHandle.hpp" diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index 637fd23387153..855b1cf9931f5 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -52,6 +52,7 @@ #include "oops/compressedOops.hpp" #include "oops/instanceKlass.hpp" #include "oops/instanceMirrorKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/oopHandle.inline.hpp" diff --git a/src/hotspot/share/oops/arrayKlass.cpp b/src/hotspot/share/oops/arrayKlass.cpp index 1fdcd17519893..c86f5c097d23f 100644 --- a/src/hotspot/share/oops/arrayKlass.cpp +++ b/src/hotspot/share/oops/arrayKlass.cpp @@ -35,6 +35,7 @@ #include "oops/arrayKlass.hpp" #include "oops/arrayOop.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 1761efa7ac075..8ae78664ab372 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -46,6 +46,7 @@ #include "oops/constantPool.inline.hpp" #include "oops/cpCache.inline.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 8b37a0781d58b..5e1da7c4f95f5 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -688,25 +688,8 @@ class InstanceKlass: public Klass { objArrayOop signers() const; // host class - InstanceKlass* unsafe_anonymous_host() const { - InstanceKlass** hk = adr_unsafe_anonymous_host(); - if (hk == NULL) { - assert(!is_unsafe_anonymous(), "Unsafe anonymous classes have host klasses"); - return NULL; - } else { - assert(*hk != NULL, "host klass should always be set if the address is not null"); - assert(is_unsafe_anonymous(), "Only unsafe anonymous classes have host klasses"); - return *hk; - } - } - void set_unsafe_anonymous_host(const InstanceKlass* host) { - assert(is_unsafe_anonymous(), "not unsafe anonymous"); - const InstanceKlass** addr = (const InstanceKlass **)adr_unsafe_anonymous_host(); - assert(addr != NULL, "no reversed space"); - if (addr != NULL) { - *addr = host; - } - } + inline InstanceKlass* unsafe_anonymous_host() const; + inline void set_unsafe_anonymous_host(const InstanceKlass* host); bool is_unsafe_anonymous() const { return (_misc_flags & _misc_is_unsafe_anonymous) != 0; } @@ -1097,60 +1080,17 @@ class InstanceKlass: public Klass { has_stored_fingerprint()); } - intptr_t* start_of_itable() const { return (intptr_t*)start_of_vtable() + vtable_length(); } - intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); } - - int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; } - - oop static_field_base_raw() { return java_mirror(); } - - OopMapBlock* start_of_nonstatic_oop_maps() const { - return (OopMapBlock*)(start_of_itable() + itable_length()); - } - - Klass** end_of_nonstatic_oop_maps() const { - return (Klass**)(start_of_nonstatic_oop_maps() + - nonstatic_oop_map_count()); - } - - Klass* volatile* adr_implementor() const { - if (is_interface()) { - return (Klass* volatile*)end_of_nonstatic_oop_maps(); - } else { - return NULL; - } - }; - - InstanceKlass** adr_unsafe_anonymous_host() const { - if (is_unsafe_anonymous()) { - InstanceKlass** adr_impl = (InstanceKlass**)adr_implementor(); - if (adr_impl != NULL) { - return adr_impl + 1; - } else { - return (InstanceKlass **)end_of_nonstatic_oop_maps(); - } - } else { - return NULL; - } - } - - address adr_fingerprint() const { - if (has_stored_fingerprint()) { - InstanceKlass** adr_host = adr_unsafe_anonymous_host(); - if (adr_host != NULL) { - return (address)(adr_host + 1); - } + inline intptr_t* start_of_itable() const; + inline intptr_t* end_of_itable() const; + inline int itable_offset_in_words() const; + inline oop static_field_base_raw(); - Klass* volatile* adr_impl = adr_implementor(); - if (adr_impl != NULL) { - return (address)(adr_impl + 1); - } + inline OopMapBlock* start_of_nonstatic_oop_maps() const; + inline Klass** end_of_nonstatic_oop_maps() const; - return (address)end_of_nonstatic_oop_maps(); - } else { - return NULL; - } - } + inline Klass* volatile* adr_implementor() const; + inline InstanceKlass** adr_unsafe_anonymous_host() const; + inline address adr_fingerprint() const; // Use this to return the size of an instance in heap words: int size_helper() const { diff --git a/src/hotspot/share/oops/instanceKlass.inline.hpp b/src/hotspot/share/oops/instanceKlass.inline.hpp index a8bdf3c20ce5d..a1e40852a8e3e 100644 --- a/src/hotspot/share/oops/instanceKlass.inline.hpp +++ b/src/hotspot/share/oops/instanceKlass.inline.hpp @@ -25,17 +25,94 @@ #ifndef SHARE_OOPS_INSTANCEKLASS_INLINE_HPP #define SHARE_OOPS_INSTANCEKLASS_INLINE_HPP +#include "classfile/javaClasses.hpp" #include "classfile/vmSymbols.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" -#include "oops/klass.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +inline InstanceKlass* InstanceKlass::unsafe_anonymous_host() const { + InstanceKlass** hk = adr_unsafe_anonymous_host(); + if (hk == NULL) { + assert(!is_unsafe_anonymous(), "Unsafe anonymous classes have host klasses"); + return NULL; + } else { + assert(*hk != NULL, "host klass should always be set if the address is not null"); + assert(is_unsafe_anonymous(), "Only unsafe anonymous classes have host klasses"); + return *hk; + } +} + +inline void InstanceKlass::set_unsafe_anonymous_host(const InstanceKlass* host) { + assert(is_unsafe_anonymous(), "not unsafe anonymous"); + const InstanceKlass** addr = (const InstanceKlass **)adr_unsafe_anonymous_host(); + assert(addr != NULL, "no reversed space"); + if (addr != NULL) { + *addr = host; + } +} + +inline intptr_t* InstanceKlass::start_of_itable() const { return (intptr_t*)start_of_vtable() + vtable_length(); } +inline intptr_t* InstanceKlass::end_of_itable() const { return start_of_itable() + itable_length(); } + +inline int InstanceKlass::itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; } + +inline oop InstanceKlass::static_field_base_raw() { return java_mirror(); } + +inline OopMapBlock* InstanceKlass::start_of_nonstatic_oop_maps() const { + return (OopMapBlock*)(start_of_itable() + itable_length()); +} + +inline Klass** InstanceKlass::end_of_nonstatic_oop_maps() const { + return (Klass**)(start_of_nonstatic_oop_maps() + + nonstatic_oop_map_count()); +} + +inline Klass* volatile* InstanceKlass::adr_implementor() const { + if (is_interface()) { + return (Klass* volatile*)end_of_nonstatic_oop_maps(); + } else { + return NULL; + } +} + +inline InstanceKlass** InstanceKlass::adr_unsafe_anonymous_host() const { + if (is_unsafe_anonymous()) { + InstanceKlass** adr_impl = (InstanceKlass**)adr_implementor(); + if (adr_impl != NULL) { + return adr_impl + 1; + } else { + return (InstanceKlass **)end_of_nonstatic_oop_maps(); + } + } else { + return NULL; + } +} + +inline address InstanceKlass::adr_fingerprint() const { + if (has_stored_fingerprint()) { + InstanceKlass** adr_host = adr_unsafe_anonymous_host(); + if (adr_host != NULL) { + return (address)(adr_host + 1); + } + + Klass* volatile* adr_impl = adr_implementor(); + if (adr_impl != NULL) { + return (address)(adr_impl + 1); + } + + return (address)end_of_nonstatic_oop_maps(); + } else { + return NULL; + } +} + inline ObjArrayKlass* InstanceKlass::array_klasses_acquire() const { return Atomic::load_acquire(&_array_klasses); } diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index 84e4592b6b9e4..4ead0c71ae90f 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -34,7 +34,8 @@ #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/klassVtable.hpp" #include "oops/method.hpp" #include "oops/objArrayOop.hpp" diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index 4c9d025fdf04d..75983a402a5c0 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -49,6 +49,7 @@ #include "memory/universe.hpp" #include "oops/constMethod.hpp" #include "oops/constantPool.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/methodData.hpp" #include "oops/objArrayKlass.hpp" diff --git a/src/hotspot/share/oops/oop.inline.hpp b/src/hotspot/share/oops/oop.inline.hpp index 7cccf0db0b2c9..da8421f34406f 100644 --- a/src/hotspot/share/oops/oop.inline.hpp +++ b/src/hotspot/share/oops/oop.inline.hpp @@ -31,7 +31,6 @@ #include "oops/arrayKlass.hpp" #include "oops/arrayOop.hpp" #include "oops/compressedOops.inline.hpp" -#include "oops/klass.inline.hpp" #include "oops/markWord.inline.hpp" #include "oops/oop.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index e251b48f2e139..c400456f2efd5 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -52,6 +52,7 @@ #include "oops/arrayOop.inline.hpp" #include "oops/instanceKlass.inline.hpp" #include "oops/instanceOop.hpp" +#include "oops/klass.inline.hpp" #include "oops/markWord.hpp" #include "oops/method.hpp" #include "oops/objArrayKlass.hpp" diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 5c237dd6f243e..909961a17c92b 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -55,6 +55,7 @@ #include "oops/constantPool.hpp" #include "oops/fieldStreams.inline.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.hpp" #include "oops/recordComponent.hpp" #include "oops/objArrayKlass.hpp" diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index 85dfd4066223f..4559f9d279d1f 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -38,6 +38,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/jniCheck.hpp" diff --git a/src/hotspot/share/prims/jvmtiEnvBase.cpp b/src/hotspot/share/prims/jvmtiEnvBase.cpp index 55ac65b614fa7..51a540c0277ed 100644 --- a/src/hotspot/share/prims/jvmtiEnvBase.cpp +++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp @@ -24,11 +24,13 @@ #include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/systemDictionary.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp index 3fdf6d9ee8a23..c25781da310b5 100644 --- a/src/hotspot/share/prims/jvmtiExport.cpp +++ b/src/hotspot/share/prims/jvmtiExport.cpp @@ -37,6 +37,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp index 4918d90212fde..e05877a6d9f2e 100644 --- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp +++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,9 +25,11 @@ #include "precompiled.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/dictionary.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "prims/jvmtiGetLoadedClasses.hpp" #include "runtime/handles.inline.hpp" #include "runtime/jniHandles.inline.hpp" diff --git a/src/hotspot/share/prims/jvmtiImpl.cpp b/src/hotspot/share/prims/jvmtiImpl.cpp index 1617db70a8d62..d7b31721f3f07 100644 --- a/src/hotspot/share/prims/jvmtiImpl.cpp +++ b/src/hotspot/share/prims/jvmtiImpl.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/nmethod.hpp" @@ -35,6 +36,7 @@ #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "prims/jvmtiAgentThread.hpp" #include "prims/jvmtiEventController.inline.hpp" #include "prims/jvmtiImpl.hpp" diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 277af0e98f17d..ed77f7db2e75a 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -45,6 +45,7 @@ #include "oops/annotations.hpp" #include "oops/constantPool.hpp" #include "oops/fieldStreams.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/klassVtable.hpp" #include "oops/oop.inline.hpp" #include "oops/recordComponent.hpp" diff --git a/src/hotspot/share/prims/jvmtiTagMap.cpp b/src/hotspot/share/prims/jvmtiTagMap.cpp index a20ad93fbb73f..07da8e3159686 100644 --- a/src/hotspot/share/prims/jvmtiTagMap.cpp +++ b/src/hotspot/share/prims/jvmtiTagMap.cpp @@ -37,6 +37,7 @@ #include "oops/arrayOop.inline.hpp" #include "oops/constantPool.inline.hpp" #include "oops/instanceMirrorKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/prims/methodHandles.cpp b/src/hotspot/share/prims/methodHandles.cpp index addee7e7168a5..5a8bdd9ba0cb1 100644 --- a/src/hotspot/share/prims/methodHandles.cpp +++ b/src/hotspot/share/prims/methodHandles.cpp @@ -38,6 +38,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/prims/nativeLookup.cpp b/src/hotspot/share/prims/nativeLookup.cpp index 0c863eddde406..9641d9242d139 100644 --- a/src/hotspot/share/prims/nativeLookup.cpp +++ b/src/hotspot/share/prims/nativeLookup.cpp @@ -32,6 +32,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" diff --git a/src/hotspot/share/prims/stackwalk.cpp b/src/hotspot/share/prims/stackwalk.cpp index 07ede2efaa346..45a1af82a9a35 100644 --- a/src/hotspot/share/prims/stackwalk.cpp +++ b/src/hotspot/share/prims/stackwalk.cpp @@ -30,6 +30,7 @@ #include "logging/logStream.hpp" #include "memory/oopFactory.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "prims/stackwalk.hpp" diff --git a/src/hotspot/share/prims/universalUpcallHandler.cpp b/src/hotspot/share/prims/universalUpcallHandler.cpp index 9eff9f53c3fc0..66cd4dbfb2909 100644 --- a/src/hotspot/share/prims/universalUpcallHandler.cpp +++ b/src/hotspot/share/prims/universalUpcallHandler.cpp @@ -23,6 +23,7 @@ #include "precompiled.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/systemDictionary.hpp" #include "memory/resourceArea.hpp" #include "prims/universalUpcallHandler.hpp" #include "runtime/interfaceSupport.inline.hpp" diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp index fc8ea88313061..0df435b0fd651 100644 --- a/src/hotspot/share/prims/unsafe.cpp +++ b/src/hotspot/share/prims/unsafe.cpp @@ -36,6 +36,7 @@ #include "oops/access.inline.hpp" #include "oops/fieldStreams.inline.hpp" #include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayOop.inline.hpp" diff --git a/src/hotspot/share/prims/vectorSupport.cpp b/src/hotspot/share/prims/vectorSupport.cpp index f6d1306ce89fc..be3bb27177e77 100644 --- a/src/hotspot/share/prims/vectorSupport.cpp +++ b/src/hotspot/share/prims/vectorSupport.cpp @@ -28,6 +28,7 @@ #include "classfile/javaClasses.inline.hpp" #include "classfile/vmSymbols.hpp" #include "code/location.hpp" +#include "oops/klass.inline.hpp" #include "prims/vectorSupport.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 28a5162abd0ac..9640c9e04a7f5 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -54,6 +54,7 @@ #include "oops/array.hpp" #include "oops/compressedOops.hpp" #include "oops/constantPool.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/method.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/runtime/fieldDescriptor.cpp b/src/hotspot/share/runtime/fieldDescriptor.cpp index e3be65c6ccae2..d1a913a28dfd9 100644 --- a/src/hotspot/share/runtime/fieldDescriptor.cpp +++ b/src/hotspot/share/runtime/fieldDescriptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ #include "oops/annotations.hpp" #include "oops/constantPool.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/fieldStreams.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index c7726fd538809..d82cfe59c99d3 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -27,6 +27,7 @@ #include "aot/aotLoader.hpp" #include "classfile/classLoader.hpp" #include "classfile/classLoaderDataGraph.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index 15870dc9a2aab..242eb2feb9923 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -34,6 +34,8 @@ #include "memory/resourceArea.hpp" #include "oops/markWord.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" +#include "oops/weakHandle.inline.hpp" #include "prims/jvmtiDeferredUpdates.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/runtime/reflection.cpp b/src/hotspot/share/runtime/reflection.cpp index 50bb12861fe06..fd5451089c743 100644 --- a/src/hotspot/share/runtime/reflection.cpp +++ b/src/hotspot/share/runtime/reflection.cpp @@ -36,7 +36,8 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" -#include "oops/instanceKlass.hpp" +#include "oops/instanceKlass.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index ef2b688c7f129..80a84ccbf9aac 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "jvm.h" #include "aot/aotLoader.hpp" #include "classfile/stringTable.hpp" diff --git a/src/hotspot/share/runtime/signature.cpp b/src/hotspot/share/runtime/signature.cpp index 44c1480339fc9..3fd5811e551a0 100644 --- a/src/hotspot/share/runtime/signature.cpp +++ b/src/hotspot/share/runtime/signature.cpp @@ -30,6 +30,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayKlass.hpp" diff --git a/src/hotspot/share/runtime/statSampler.cpp b/src/hotspot/share/runtime/statSampler.cpp index 471e9577a0f00..ed0060a09652c 100644 --- a/src/hotspot/share/runtime/statSampler.cpp +++ b/src/hotspot/share/runtime/statSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "memory/allocation.inline.hpp" diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index e75160c145703..fa0f0841a9eae 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -57,8 +57,10 @@ #include "memory/universe.hpp" #include "oops/access.inline.hpp" #include "oops/instanceKlass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayOop.inline.hpp" #include "oops/verifyOopClosure.hpp" diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index 451c94d045841..45984a3d8fad7 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -26,6 +26,7 @@ #include "jvm.h" #include "classfile/classLoaderHierarchyDCmd.hpp" #include "classfile/classLoaderStats.hpp" +#include "classfile/javaClasses.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" #include "compiler/directivesParser.hpp" diff --git a/src/hotspot/share/services/gcNotifier.cpp b/src/hotspot/share/services/gcNotifier.cpp index b9a1e9b5852fe..dd50fc8b0711e 100644 --- a/src/hotspot/share/services/gcNotifier.cpp +++ b/src/hotspot/share/services/gcNotifier.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/services/heapDumper.cpp b/src/hotspot/share/services/heapDumper.cpp index b1489e8499069..7059f3ab17a7f 100644 --- a/src/hotspot/share/services/heapDumper.cpp +++ b/src/hotspot/share/services/heapDumper.cpp @@ -37,6 +37,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index 7b22e7b4e50d3..e5fed2c7c2448 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -33,9 +33,11 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/klass.hpp" +#include "oops/klass.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "oops/typeArrayOop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/flags/jvmFlag.hpp" diff --git a/src/hotspot/share/services/memoryManager.cpp b/src/hotspot/share/services/memoryManager.cpp index 2ed0be7e0b89a..36d298dac9edb 100644 --- a/src/hotspot/share/services/memoryManager.cpp +++ b/src/hotspot/share/services/memoryManager.cpp @@ -23,11 +23,13 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "memory/allocation.inline.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" diff --git a/src/hotspot/share/services/memoryPool.cpp b/src/hotspot/share/services/memoryPool.cpp index e2159a1258383..f7ed91ba19f9f 100644 --- a/src/hotspot/share/services/memoryPool.cpp +++ b/src/hotspot/share/services/memoryPool.cpp @@ -23,11 +23,13 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "memory/metaspace.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/services/threadService.cpp b/src/hotspot/share/services/threadService.cpp index 8f1ef6f05554b..b447a85d7c119 100644 --- a/src/hotspot/share/services/threadService.cpp +++ b/src/hotspot/share/services/threadService.cpp @@ -34,6 +34,7 @@ #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" +#include "oops/oopHandle.inline.hpp" #include "prims/jvmtiRawMonitor.hpp" #include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index b9ff0d6a4f8eb..9b970be5e6db3 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -37,6 +37,7 @@ #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp index 0fd035a7619ac..590540bab3d9e 100644 --- a/src/hotspot/share/utilities/exceptions.cpp +++ b/src/hotspot/share/utilities/exceptions.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" From 39325272882e863df8d20e192321d0a2318cf03d Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Thu, 3 Dec 2020 04:26:23 +0000 Subject: [PATCH 034/504] 8257466: Improve enum iteration Improve support for iteration on enums that are just range of values, without named enumerators. Reviewed-by: iklam, lfoltan --- src/hotspot/share/utilities/enumIterator.hpp | 89 ++++++++++---- .../gtest/utilities/test_enumIterator.cpp | 112 ++++++++++++++++++ 2 files changed, 179 insertions(+), 22 deletions(-) create mode 100644 test/hotspot/gtest/utilities/test_enumIterator.cpp diff --git a/src/hotspot/share/utilities/enumIterator.hpp b/src/hotspot/share/utilities/enumIterator.hpp index 45a1a0fe08285..aadae51b803f5 100644 --- a/src/hotspot/share/utilities/enumIterator.hpp +++ b/src/hotspot/share/utilities/enumIterator.hpp @@ -28,6 +28,7 @@ #include #include #include "memory/allStatic.hpp" +#include "metaprogramming/enableIf.hpp" #include "utilities/debug.hpp" // Iteration support for enums. @@ -73,21 +74,52 @@ // } // EnumeratorRange is a traits type supporting iteration over the enumerators of T. -// Specializations must provide static const data members named -// "_first" and "_last", whose values are the smallest / largest -// (resp.) enumerator values for T. For iteration, the enumerators of -// T must have sequential values in that range. +// Specializations must provide static const data members named "_start" and "_end". +// The type of _start and _end must be the underlying type of T. +// _start is the inclusive lower bound of values in the range. +// _end is the exclusive upper bound of values in the range. +// The enumerators of T must have sequential values in that range. template struct EnumeratorRange; -// Specialize EnumeratorRange. -#define ENUMERATOR_RANGE(T, First, Last) \ - template<> struct EnumeratorRange { \ - static constexpr T _first = First; \ - static constexpr T _last = Last; \ +// Helper class for ENUMERATOR_RANGE and ENUMERATOR_VALUE_RANGE. +struct EnumeratorRangeImpl : AllStatic { + template using Underlying = std::underlying_type_t; + + // T not deduced to verify argument is of expected type. + template::value)> + static constexpr Underlying start_value(U first) { + return static_cast>(first); + } + + // T not deduced to verify argument is of expected type. + template::value)> + static constexpr Underlying end_value(U last) { + Underlying value = static_cast>(last); + assert(value < std::numeric_limits>::max(), "end value overflow"); + return static_cast>(value + 1); + } +}; + +// Specialize EnumeratorRange. Start and End must be constant expressions +// whose value is convertible to the underlying type of T. They provide the +// values of the required _start and _end members respectively. +#define ENUMERATOR_VALUE_RANGE(T, Start, End) \ + template<> struct EnumeratorRange { \ + static constexpr EnumeratorRangeImpl::Underlying _start{Start}; \ + static constexpr EnumeratorRangeImpl::Underlying _end{End}; \ }; -// A helper class for EnumIterator, computing some additional information the -// iterator uses, based on T and EnumeratorRange. +// Specialize EnumeratorRange. First and Last must be constant expressions +// of type T. They determine the values of the required _start and _end members +// respectively. _start is the underlying value of First. _end is the underlying +// value of Last, plus one. +#define ENUMERATOR_RANGE(T, First, Last) \ + ENUMERATOR_VALUE_RANGE(T, \ + EnumeratorRangeImpl::start_value(First), \ + EnumeratorRangeImpl::end_value(Last)); + +// A helper class for EnumRange and EnumIterator, computing some +// additional information based on T and EnumeratorRange. template class EnumIterationTraits : AllStatic { using RangeType = EnumeratorRange; @@ -96,21 +128,20 @@ class EnumIterationTraits : AllStatic { // The underlying type for T. using Underlying = std::underlying_type_t; - // The first enumerator of T. - static constexpr T _first = RangeType::_first; + // The value of the first enumerator of T. + static constexpr Underlying _start = RangeType::_start; - // The last enumerator of T. - static constexpr T _last = RangeType::_last; + // The one-past-the-end value for T. + static constexpr Underlying _end = RangeType::_end; - static_assert(static_cast(_last) < - std::numeric_limits::max(), - "No one-past-the-end value for enum"); + // The first enumerator of T. + static constexpr T _first = static_cast(_start); - // The value of the first enumerator of T. - static constexpr Underlying _start = static_cast(_first); + // The last enumerator of T. + static constexpr T _last = static_cast(_end - 1); - // The one-past-the-end value for T. - static constexpr Underlying _end = static_cast(_last) + 1; + static_assert(_start != _end, "empty range"); + static_assert(_start <= _end, "invalid range"); // <= so only one failure when ==. }; template @@ -125,6 +156,8 @@ class EnumIterator { } public: + using EnumType = T; + // Return a beyond-the-end iterator. constexpr EnumIterator() : _value(Traits::_end) {} @@ -180,6 +213,7 @@ class EnumRange { Underlying _end; public: + using EnumType = T; using Iterator = EnumIterator; // Default constructor gives the full range. @@ -214,6 +248,17 @@ class EnumRange { constexpr size_t size() const { return static_cast(_end - _start); // _end is exclusive } + + constexpr T first() const { return static_cast(_start); } + constexpr T last() const { return static_cast(_end - 1); } + + // Convert value to a zero-based index into the range [first(), last()]. + // precondition: first() <= value && value <= last() + constexpr size_t index(T value) const { + assert(first() <= value, "out of bounds"); + assert(value <= last(), "out of bounds"); + return static_cast(static_cast(value) - _start); + } }; #endif // SHARE_UTILITIES_ENUMITERATOR_HPP diff --git a/test/hotspot/gtest/utilities/test_enumIterator.cpp b/test/hotspot/gtest/utilities/test_enumIterator.cpp new file mode 100644 index 0000000000000..f1bf16f1a76b3 --- /dev/null +++ b/test/hotspot/gtest/utilities/test_enumIterator.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include "precompiled.hpp" +#include "utilities/enumIterator.hpp" +#include +#include "unittest.hpp" + +enum class ExplicitTest : int { value1, value2, value3 }; +ENUMERATOR_RANGE(ExplicitTest, ExplicitTest::value1, ExplicitTest::value3); +constexpr int explicit_start = 0; +constexpr int explicit_end = 3; + +enum class ImplicitTest : int {}; +ENUMERATOR_VALUE_RANGE(ImplicitTest, 5, 10); +constexpr int implicit_start = 5; +constexpr int implicit_end = 10; + +TEST(TestEnumIterator, explicit_full_range) { + using Range = EnumRange; + constexpr Range range{}; + EXPECT_TRUE((std::is_same::value)); + EXPECT_EQ(size_t(explicit_end - explicit_start), range.size()); + EXPECT_EQ(ExplicitTest::value1, range.first()); + EXPECT_EQ(ExplicitTest::value3, range.last()); + EXPECT_EQ(size_t(1), range.index(ExplicitTest::value2)); +} + +TEST(TestEnumIterator, explicit_partial_range) { + using Range = EnumRange; + constexpr Range range{ExplicitTest::value2}; + EXPECT_TRUE((std::is_same::value)); + EXPECT_EQ(size_t(explicit_end - (explicit_start + 1)), range.size()); + EXPECT_EQ(ExplicitTest::value2, range.first()); + EXPECT_EQ(ExplicitTest::value3, range.last()); + EXPECT_EQ(size_t(0), range.index(ExplicitTest::value2)); +} + +TEST(TestEnumIterator, implicit_full_range) { + using Range = EnumRange; + constexpr Range range{}; + EXPECT_TRUE((std::is_same::value)); + EXPECT_EQ(size_t(implicit_end - implicit_start), range.size()); + EXPECT_EQ(static_cast(implicit_start), range.first()); + EXPECT_EQ(static_cast(implicit_end - 1), range.last()); + EXPECT_EQ(size_t(2), range.index(static_cast(implicit_start + 2))); +} + +TEST(TestEnumIterator, implicit_partial_range) { + using Range = EnumRange; + constexpr Range range{static_cast(implicit_start + 2)}; + EXPECT_TRUE((std::is_same::value)); + EXPECT_EQ(size_t(implicit_end - (implicit_start + 2)), range.size()); + EXPECT_EQ(static_cast(implicit_start + 2), range.first()); + EXPECT_EQ(static_cast(implicit_end - 1), range.last()); + EXPECT_EQ(size_t(1), range.index(static_cast(implicit_start + 3))); +} + +TEST(TestEnumIterator, explict_iterator) { + using Range = EnumRange; + using Iterator = EnumIterator; + constexpr Range range{}; + EXPECT_EQ(range.first(), *range.begin()); + EXPECT_EQ(Iterator(range.first()), range.begin()); + EnumIterator it = range.begin(); + ++it; + EXPECT_EQ(ExplicitTest::value2, *it); + it = range.begin(); + for (int i = explicit_start; i < explicit_end; ++i, ++it) { + ExplicitTest value = static_cast(i); + EXPECT_EQ(value, *it); + EXPECT_EQ(Iterator(value), it); + EXPECT_EQ(size_t(i - explicit_start), range.index(value)); + } + EXPECT_EQ(it, range.end()); +} + +TEST(TestEnumIterator, implicit_iterator) { + using Range = EnumRange; + using Iterator = EnumIterator; + constexpr Range range{}; + EXPECT_EQ(range.first(), *range.begin()); + EXPECT_EQ(Iterator(range.first()), range.begin()); + EnumIterator it = range.begin(); + for (int i = implicit_start; i < implicit_end; ++i, ++it) { + ImplicitTest value = static_cast(i); + EXPECT_EQ(value, *it); + EXPECT_EQ(Iterator(value), it); + EXPECT_EQ(size_t(i - implicit_start), range.index(value)); + } + EXPECT_EQ(it, range.end()); +} From d80ae05f617b35bd327e03869284de0c41adb94d Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Thu, 3 Dec 2020 06:12:07 +0000 Subject: [PATCH 035/504] 8166596: TLS support for the EdDSA signature algorithm Reviewed-by: xuelei --- .../sun/security/ssl/CertificateRequest.java | 19 +- .../sun/security/ssl/CertificateVerify.java | 3 + .../security/ssl/ECDHServerKeyExchange.java | 3 + .../classes/sun/security/ssl/JsseJce.java | 5 + .../sun/security/ssl/SSLExtension.java | 4 +- .../sun/security/ssl/SSLKeyExchange.java | 84 +- .../sun/security/ssl/SignatureScheme.java | 26 +- .../sun/security/ssl/X509Authentication.java | 5 +- .../javax/net/ssl/TLSCommon/TLSWithEdDSA.java | 736 ++++++++++++++++++ 9 files changed, 825 insertions(+), 60 deletions(-) create mode 100644 test/jdk/javax/net/ssl/TLSCommon/TLSWithEdDSA.java diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java index 9356894b7fd5f..1512b52800368 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java @@ -67,8 +67,8 @@ final class CertificateRequest { // TLS 1.2 and prior versions private static enum ClientCertificateType { // RFC 2246 - RSA_SIGN ((byte)0x01, "rsa_sign", "RSA", true), - DSS_SIGN ((byte)0x02, "dss_sign", "DSA", true), + RSA_SIGN ((byte)0x01, "rsa_sign", List.of("RSA"), true), + DSS_SIGN ((byte)0x02, "dss_sign", List.of("DSA"), true), RSA_FIXED_DH ((byte)0x03, "rsa_fixed_dh"), DSS_FIXED_DH ((byte)0x04, "dss_fixed_dh"), @@ -77,9 +77,10 @@ private static enum ClientCertificateType { DSS_EPHEMERAL_DH ((byte)0x06, "dss_ephemeral_dh"), FORTEZZA_DMS ((byte)0x14, "fortezza_dms"), - // RFC 4492 + // RFC 4492 and 8442 ECDSA_SIGN ((byte)0x40, "ecdsa_sign", - "EC", JsseJce.isEcAvailable()), + List.of("EC", "EdDSA"), + JsseJce.isEcAvailable()), RSA_FIXED_ECDH ((byte)0x41, "rsa_fixed_ecdh"), ECDSA_FIXED_ECDH ((byte)0x42, "ecdsa_fixed_ecdh"); @@ -95,7 +96,7 @@ private static enum ClientCertificateType { final byte id; final String name; - final String keyAlgorithm; + final List keyAlgorithm; final boolean isAvailable; private ClientCertificateType(byte id, String name) { @@ -103,7 +104,7 @@ private ClientCertificateType(byte id, String name) { } private ClientCertificateType(byte id, String name, - String keyAlgorithm, boolean isAvailable) { + List keyAlgorithm, boolean isAvailable) { this.id = id; this.name = name; this.keyAlgorithm = keyAlgorithm; @@ -134,7 +135,11 @@ private static String[] getKeyTypes(byte[] ids) { for (byte id : ids) { ClientCertificateType cct = ClientCertificateType.valueOf(id); if (cct.isAvailable) { - keyTypes.add(cct.keyAlgorithm); + cct.keyAlgorithm.forEach(key -> { + if (!keyTypes.contains(key)) { + keyTypes.add(key); + } + }); } } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java index da9b1d8303de7..1aea41525665e 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java @@ -459,6 +459,9 @@ private static Signature getSignature(String algorithm, case "EC": signer = Signature.getInstance(JsseJce.SIGNATURE_RAWECDSA); break; + case "EdDSA": + signer = Signature.getInstance(JsseJce.SIGNATURE_EDDSA); + break; default: throw new SignatureException("Unrecognized algorithm: " + algorithm); diff --git a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java index b96a7bf572c70..d3d30f7cecaa5 100644 --- a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java @@ -424,6 +424,9 @@ private static Signature getSignature(String keyAlgorithm, case "EC": signer = Signature.getInstance(JsseJce.SIGNATURE_ECDSA); break; + case "EdDSA": + signer = Signature.getInstance(JsseJce.SIGNATURE_EDDSA); + break; case "RSA": signer = RSASignature.getInstance(); break; diff --git a/src/java.base/share/classes/sun/security/ssl/JsseJce.java b/src/java.base/share/classes/sun/security/ssl/JsseJce.java index c6ca4977d0a29..eefaaf2b79aff 100644 --- a/src/java.base/share/classes/sun/security/ssl/JsseJce.java +++ b/src/java.base/share/classes/sun/security/ssl/JsseJce.java @@ -90,6 +90,11 @@ final class JsseJce { */ static final String SIGNATURE_ECDSA = "SHA1withECDSA"; + /** + * JCA identifier for EdDSA signatures. + */ + static final String SIGNATURE_EDDSA = "EdDSA"; + /** * JCA identifier string for Raw DSA, i.e. a DSA signature without * hashing where the application provides the SHA-1 hash of the data. diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java index c46786b3deade..05ee5ff399fbf 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java @@ -274,11 +274,11 @@ enum SSLExtension implements SSLStringizer { SIGNED_CERT_TIMESTAMP (0x0012, "signed_certificate_timestamp"), // extensions defined in RFC 7250 - CLIENT_CERT_TYPE (0x0013, "padding"), + CLIENT_CERT_TYPE (0x0013, "client_certificate_type"), SERVER_CERT_TYPE (0x0014, "server_certificate_type"), // extensions defined in RFC 7685 - PADDING (0x0015, "client_certificate_type"), + PADDING (0x0015, "padding"), // extensions defined in RFC 7366 ENCRYPT_THEN_MAC (0x0016, "encrypt_then_mac"), diff --git a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java index 846f7a84f3dbc..e9657de057eb7 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,18 +29,23 @@ import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import sun.security.ssl.SupportedGroupsExtension.SupportedGroups; import sun.security.ssl.X509Authentication.X509Possession; final class SSLKeyExchange implements SSLKeyAgreementGenerator, SSLHandshakeBinding { - private final SSLAuthentication authentication; + private final List authentication; private final SSLKeyAgreement keyAgreement; - SSLKeyExchange(X509Authentication authentication, + SSLKeyExchange(List authentication, SSLKeyAgreement keyAgreement) { - this.authentication = authentication; + if (authentication != null) { + this.authentication = List.copyOf(authentication); + } else { + this.authentication = null; + } this.keyAgreement = keyAgreement; } @@ -48,7 +53,15 @@ SSLPossession[] createPossessions(HandshakeContext context) { // authentication SSLPossession authPossession = null; if (authentication != null) { - authPossession = authentication.createPossession(context); + // Loop through potential authentication types and end at + // the first non-null possession. + for (SSLAuthentication authType : authentication) { + if ((authPossession = authType.createPossession(context)) + != null) { + break; + } + } + if (authPossession == null) { return new SSLPossession[0]; } else if (context instanceof ServerHandshakeContext) { @@ -109,12 +122,14 @@ public SSLKeyDerivation createKeyDerivation( @Override public SSLHandshake[] getRelatedHandshakers( HandshakeContext handshakeContext) { - SSLHandshake[] auHandshakes; + SSLHandshake[] auHandshakes = null; if (authentication != null) { - auHandshakes = - authentication.getRelatedHandshakers(handshakeContext); - } else { - auHandshakes = null; + for (SSLAuthentication authType : authentication) { + auHandshakes = authType.getRelatedHandshakers(handshakeContext); + if (auHandshakes != null && auHandshakes.length > 0) { + break; + } + } } SSLHandshake[] kaHandshakes = @@ -136,12 +151,14 @@ public SSLHandshake[] getRelatedHandshakers( @Override public Map.Entry[] getHandshakeProducers( HandshakeContext handshakeContext) { - Map.Entry[] auProducers; + Map.Entry[] auProducers = null; if (authentication != null) { - auProducers = - authentication.getHandshakeProducers(handshakeContext); - } else { - auProducers = null; + for (SSLAuthentication authType : authentication) { + auProducers = authType.getHandshakeProducers(handshakeContext); + if (auProducers != null && auProducers.length > 0) { + break; + } + } } Map.Entry[] kaProducers = @@ -163,12 +180,14 @@ public Map.Entry[] getHandshakeProducers( @Override public Map.Entry[] getHandshakeConsumers( HandshakeContext handshakeContext) { - Map.Entry[] auConsumers; + Map.Entry[] auConsumers = null; if (authentication != null) { - auConsumers = - authentication.getHandshakeConsumers(handshakeContext); - } else { - auConsumers = null; + for (SSLAuthentication authType : authentication) { + auConsumers = authType.getHandshakeConsumers(handshakeContext); + if (auConsumers != null && auConsumers.length > 0) { + break; + } + } } Map.Entry[] kaConsumers = @@ -247,37 +266,37 @@ static SSLKeyExchange valueOf(NamedGroup namedGroup) { private static class SSLKeyExRSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA, T12KeyAgreement.RSA); + List.of(X509Authentication.RSA), T12KeyAgreement.RSA); } private static class SSLKeyExRSAExport { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA, T12KeyAgreement.RSA_EXPORT); + List.of(X509Authentication.RSA), T12KeyAgreement.RSA_EXPORT); } private static class SSLKeyExDHEDSS { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.DSA, T12KeyAgreement.DHE); + List.of(X509Authentication.DSA), T12KeyAgreement.DHE); } private static class SSLKeyExDHEDSSExport { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.DSA, T12KeyAgreement.DHE_EXPORT); + List.of(X509Authentication.DSA), T12KeyAgreement.DHE_EXPORT); } private static class SSLKeyExDHERSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA, T12KeyAgreement.DHE); + List.of(X509Authentication.RSA), T12KeyAgreement.DHE); } private static class SSLKeyExDHERSAOrPSS { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA_OR_PSS, T12KeyAgreement.DHE); + List.of(X509Authentication.RSA_OR_PSS), T12KeyAgreement.DHE); } private static class SSLKeyExDHERSAExport { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA, T12KeyAgreement.DHE_EXPORT); + List.of(X509Authentication.RSA), T12KeyAgreement.DHE_EXPORT); } private static class SSLKeyExDHANON { @@ -292,27 +311,28 @@ private static class SSLKeyExDHANONExport { private static class SSLKeyExECDHECDSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.EC, T12KeyAgreement.ECDH); + List.of(X509Authentication.EC), T12KeyAgreement.ECDH); } private static class SSLKeyExECDHRSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.EC, T12KeyAgreement.ECDH); + List.of(X509Authentication.EC), T12KeyAgreement.ECDH); } private static class SSLKeyExECDHEECDSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.EC, T12KeyAgreement.ECDHE); + List.of(X509Authentication.EC, X509Authentication.EDDSA), + T12KeyAgreement.ECDHE); } private static class SSLKeyExECDHERSA { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA, T12KeyAgreement.ECDHE); + List.of(X509Authentication.RSA), T12KeyAgreement.ECDHE); } private static class SSLKeyExECDHERSAOrPSS { private static SSLKeyExchange KE = new SSLKeyExchange( - X509Authentication.RSA_OR_PSS, T12KeyAgreement.ECDHE); + List.of(X509Authentication.RSA_OR_PSS), T12KeyAgreement.ECDHE); } private static class SSLKeyExECDHANON { diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java index 539ce3141f119..fe089b1403a9a 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java @@ -47,14 +47,6 @@ import sun.security.util.SignatureUtil; enum SignatureScheme { - // EdDSA algorithms - ED25519 (0x0807, "ed25519", "ed25519", - "ed25519", - ProtocolVersion.PROTOCOLS_OF_13), - ED448 (0x0808, "ed448", "ed448", - "ed448", - ProtocolVersion.PROTOCOLS_OF_13), - // ECDSA algorithms ECDSA_SECP256R1_SHA256 (0x0403, "ecdsa_secp256r1_sha256", "SHA256withECDSA", @@ -72,6 +64,14 @@ enum SignatureScheme { NamedGroup.SECP521_R1, ProtocolVersion.PROTOCOLS_TO_13), + // EdDSA algorithms + ED25519 (0x0807, "ed25519", "Ed25519", + "EdDSA", + ProtocolVersion.PROTOCOLS_12_13), + ED448 (0x0808, "ed448", "Ed448", + "EdDSA", + ProtocolVersion.PROTOCOLS_12_13), + // RSASSA-PSS algorithms with public key OID rsaEncryption // // The minimalKeySize is calculated as (See RFC 8017 for details): @@ -275,16 +275,6 @@ private SignatureScheme(int id, String name, boolean mediator = true; - // Disable EdDSA algorithms for TLS. Remove this when support is added. - if (id == 0x0807 || id == 0x0808) { - mediator = false; - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.warning( - "Signature algorithm, " + algorithm + - ", not supported by JSSE"); - } - } - // An EC provider, for example the SunEC provider, may support // AlgorithmParameters but not KeyPairGenerator or Signature. // diff --git a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java index 5810a7e0132d6..7962ffa161cb8 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java +++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java @@ -64,7 +64,10 @@ enum X509Authentication implements SSLAuthentication { // Require EC public key EC ("EC", new X509PossessionGenerator( - new String[] {"EC"})); + new String[] {"EC"})), + // Edwards-Curve key + EDDSA ("EdDSA", new X509PossessionGenerator( + new String[] {"EdDSA"})); final String keyType; final SSLPossessionGenerator possessionGenerator; diff --git a/test/jdk/javax/net/ssl/TLSCommon/TLSWithEdDSA.java b/test/jdk/javax/net/ssl/TLSCommon/TLSWithEdDSA.java new file mode 100644 index 0000000000000..3fabc5bd73c88 --- /dev/null +++ b/test/jdk/javax/net/ssl/TLSCommon/TLSWithEdDSA.java @@ -0,0 +1,736 @@ +/* + * Copyright (c) 2020, 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. + */ + +/* + * SunJSSE does not support dynamic system properties, no way to re-use + * system properties in samevm/agentvm mode. + * For extra debugging output, add -Djavax.net.debug=ssl:handshake into the + * run directive below. + */ + +/* + * @test + * @bug 8166596 + * @summary TLS support for the EdDSA signature algorithm + * @library /javax/net/ssl/templates /test/lib + * @run main/othervm TLSWithEdDSA + */ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.net.SocketException; +import java.nio.charset.Charset; +import java.security.GeneralSecurityException; +import java.security.KeyFactory; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Principal; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.PKIXBuilderParameters; +import java.security.cert.X509CertSelector; +import java.security.cert.X509Certificate; +import java.security.interfaces.ECKey; +import java.security.interfaces.EdECKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.*; +import javax.net.ssl.CertPathTrustManagerParameters; +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509ExtendedKeyManager; +import javax.net.ssl.X509KeyManager; +import jdk.test.lib.security.SecurityUtils; + +public class TLSWithEdDSA extends SSLSocketTemplate { + private static final String PASSWD = "passphrase"; + private static final String DEF_TRUST_ANCHORS = "CA_DSA_1024:CA_DSA_2048:" + + "CA_ECDSA_SECP256R1:CA_ECDSA_SECP384R1:CA_ECDSA_SECP521R1:" + + "CA_ED25519:CA_ED448:CA_RSA_2048"; + private static final String DEF_ALL_EE = "EE_ECDSA_SECP256R1:" + + "EE_ECDSA_SECP384R1:EE_ECDSA_SECP521R1:EE_RSA_2048:" + + "EE_EC_RSA_SECP256R1:EE_DSA_2048:EE_DSA_1024:EE_ED25519:EE_ED448"; + private static final List TEST_PROTOS = List.of( + "TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1"); + + private static CertificateFactory certFac; + private static final Map clientParameters = + new HashMap<>(); + private static final Map serverParameters = + new HashMap<>(); + + private final SessionChecker clientChecker; + private final SessionChecker serverChecker; + private final Class clientException; + private final Class serverException; + + interface SessionChecker { + public void check(SSLSocket socket); + } + + /** + * Checks to make sure the end-entity certificate presented by the + * peer uses and Ed25519 key. + */ + final static SessionChecker isPeerEd25519 = new SessionChecker() { + @Override + public void check(SSLSocket sock) { + try { + SSLSession session = sock.getSession(); + System.out.println("Peer certificate check for Ed25519:\n" + + sessionDump(session)); + Certificate[] serverCertChain = session.getPeerCertificates(); + X509Certificate tlsCert = (X509Certificate)serverCertChain[0]; + keyCheck(tlsCert.getPublicKey(), "EdDSA", "Ed25519"); + } catch (SSLPeerUnverifiedException sslpe) { + throw new RuntimeException(sslpe); + } + } + }; + + /** + * Checks to make sure the end-entity certificate presented by the + * peer uses and Ed448 key. + */ + final static SessionChecker isPeerEd448 = new SessionChecker() { + @Override + public void check(SSLSocket sock) { + try { + SSLSession session = sock.getSession(); + System.out.println("Peer certificate check for Ed448:\n" + + sessionDump(session)); + Certificate[] serverCertChain = session.getPeerCertificates(); + X509Certificate tlsCert = (X509Certificate)serverCertChain[0]; + keyCheck(tlsCert.getPublicKey(), "EdDSA", "Ed448"); + } catch (SSLPeerUnverifiedException sslpe) { + throw new RuntimeException(sslpe); + } + } + }; + + /** + * Checks to make sure the end-entity certificate presented by the + * peer uses an EC secp521r1 key. + */ + final static SessionChecker isPeerP521 = new SessionChecker() { + @Override + public void check(SSLSocket sock) { + try { + SSLSession session = sock.getSession(); + System.out.println("Peer certificate check for secp521r1:\n" + + sessionDump(session)); + Certificate[] serverCertChain = session.getPeerCertificates(); + X509Certificate tlsCert = (X509Certificate)serverCertChain[0]; + keyCheck(tlsCert.getPublicKey(), "EC", "secp521r1"); + } catch (SSLPeerUnverifiedException sslpe) { + throw new RuntimeException(sslpe); + } + } + }; + + /** + * Returns a String summary of an SSLSession object + * + * @param sess the SSLSession object to be dumped + * + * @return a String representation of the test-relevant portions of the + * SSLSession object. + */ + private static String sessionDump(SSLSession sess) { + StringBuilder sb = new StringBuilder(); + sb.append("----- Session Info -----\n"); + sb.append("Protocol: ").append(sess.getProtocol()).append("\n"); + sb.append("Cipher Suite: ").append(sess.getCipherSuite()); + Certificate[] localCerts = sess.getLocalCertificates(); + if (localCerts != null) { + sb.append("\nLocal Certs:"); + int i = 0; + for (Certificate cert : localCerts) { + sb.append(String.format("\n [%d]: %s", i++, + ((X509Certificate)cert).getSubjectX500Principal())); + } + } + try { + Certificate[] peerCerts = sess.getPeerCertificates(); + if (peerCerts != null) { + sb.append("\nPeer Certs:"); + int i = 0; + for (Certificate cert : peerCerts) { + sb.append(String.format("\n [%d]: %s", i++, + ((X509Certificate)cert).getSubjectX500Principal())); + } + } + } catch (SSLPeerUnverifiedException sslex) { + throw new RuntimeException(sslex); + } + + return sb.toString(); + } + + /** + * Checks to make sure the public key conforms to the expected key type + * and (where applicable) curve. + * + * @param pubKey the public key to be checked + * @param expPkType the expected key type (RSA/DSA/EC/EdDSA) + * @param expCurveName if an EC/EdDSA key, the expected curve + */ + private static void keyCheck(PublicKey pubKey, String expPkType, + String expCurveName) { + String curveName = null; + String pubKeyAlg = pubKey.getAlgorithm(); + if (!expPkType.equalsIgnoreCase(pubKeyAlg)) { + throw new RuntimeException("Expected " + expPkType + " key, got " + + pubKeyAlg); + } + + // Check the curve type + if (expCurveName != null) { + switch (pubKeyAlg) { + case "EdDSA": + curveName = ((EdECKey)pubKey).getParams().getName(). + toLowerCase(); + if (!expCurveName.equalsIgnoreCase(curveName)) { + throw new RuntimeException("Expected " + expCurveName + + " curve, " + "got " + curveName); + } + break; + case "EC": + curveName = ((ECKey)pubKey).getParams().toString(). + toLowerCase(); + if (!curveName.contains(expCurveName.toLowerCase())) { + throw new RuntimeException("Expected " + expCurveName + + " curve, " + "got " + curveName); + } + break; + default: + throw new IllegalArgumentException( + "Unsupported key type: " + pubKeyAlg); + } + } + System.out.format("Found key: %s / %s\n", pubKeyAlg, + curveName != null ? curveName : ""); + } + + TLSWithEdDSA(SessionChecker cliChk, Class cliExpExc, + SessionChecker servChk, Class servExpExc) { + super(); + clientChecker = cliChk; + clientException = cliExpExc; + serverChecker = servChk; + serverException = servExpExc; + } + + /** + * Creates an SSLContext for use with the client side of this test. This + * uses parameters held in the static client parameters map. + * + * @return an initialized SSLContext for use with the client. + * + * @throws Exception if any downstream errors occur during key store + * creation, key/trust manager factory creation or context + * initialization. + */ + @Override + protected SSLContext createClientSSLContext() throws Exception { + KeyStore clientKeyStore = createKeyStore( + clientParameters.getOrDefault(ParamType.KSENTRIES, ""), + PASSWD.toCharArray()); + KeyStore clientTrustStore = createTrustStore( + clientParameters.getOrDefault(ParamType.TSENTRIES, + DEF_TRUST_ANCHORS)); + return createCtxCommon(clientKeyStore, + clientParameters.get(ParamType.CERTALIAS), PASSWD.toCharArray(), + clientTrustStore, "jdk.tls.client.SignatureSchemes", + clientParameters.get(ParamType.SIGALGS)); + } + + /** + * Creates an SSLContext for use with the server side of this test. This + * uses parameters held in the static server parameters map. + * + * @return an initialized SSLContext for use with the server. + * + * @throws Exception if any downstream errors occur during key store + * creation, key/trust manager factory creation or context + * initialization. + */ + @Override + protected SSLContext createServerSSLContext() throws Exception { + KeyStore serverKeyStore = createKeyStore( + serverParameters.getOrDefault(ParamType.KSENTRIES, ""), + PASSWD.toCharArray()); + KeyStore serverTrustStore = createTrustStore( + serverParameters.getOrDefault(ParamType.TSENTRIES, + DEF_TRUST_ANCHORS)); + return createCtxCommon(serverKeyStore, + serverParameters.get(ParamType.CERTALIAS), PASSWD.toCharArray(), + serverTrustStore, "jdk.tls.server.SignatureSchemes", + serverParameters.get(ParamType.SIGALGS)); + } + + /** + * Create a trust store containing any CA certificates designated as + * trust anchors. + * + * @return the trust store populated with the root CA certificate. + * + * @throws GeneralSecurityException if any certificates cannot be added to + * the key store. + */ + private static KeyStore createTrustStore(String certEnumNames) + throws GeneralSecurityException { + KeyStore.Builder keyStoreBuilder = + KeyStore.Builder.newInstance("PKCS12", null, + new KeyStore.PasswordProtection(PASSWD.toCharArray())); + KeyStore ks = keyStoreBuilder.getKeyStore(); + for (String certName : certEnumNames.split(":")) { + try { + SSLSocketTemplate.Cert cert = + SSLSocketTemplate.Cert.valueOf(certName); + ks.setCertificateEntry(certName, pem2Cert(cert.certStr)); + } catch (IllegalArgumentException iae) { + System.out.println("Unable to find Cert enum entry for " + + certName + ", skipping"); + } + } + return ks; + } + + /** + * Create a key store containing any end-entity private keys/certs + * specified in the parameters. + * + * @param certEnumNames a colon-delimited list of String values that are + * the names of the SSLSocketTemplate.Cert enumeration entries. + * @param pass the desired password for the resulting KeyStore object. + * + * @return a populated, loaded KeyStore ready for use. + * + * @throws GeneralSecurityException if any issues occur while setting + * the private key or certificate entries. + */ + private static KeyStore createKeyStore(String certEnumNames, char[] pass) + throws GeneralSecurityException { + KeyStore.Builder keyStoreBuilder = + KeyStore.Builder.newInstance("PKCS12", null, + new KeyStore.PasswordProtection(pass)); + KeyStore ks = keyStoreBuilder.getKeyStore(); + if (certEnumNames != null && !certEnumNames.isEmpty()) { + for (String certName : certEnumNames.split(":")) { + try { + SSLSocketTemplate.Cert cert = + SSLSocketTemplate.Cert.valueOf(certName); + ks.setKeyEntry(certName, + pem2PrivKey(cert.privKeyStr, cert.keyAlgo), pass, + new Certificate[] { pem2Cert(cert.certStr) }); + } catch (IllegalArgumentException iae) { + System.out.println("Unable to find Cert enum entry for " + + certName + ", skipping"); + } + } + } + + return ks; + } + + /** + * Covert a PEM-encoded certificate into a X509Certificate object. + * + * @param certPem the PEM encoding for the certificate. + * + * @return the corresponding X509Certificate object for the provided PEM. + * + * @throws CertificateException if any decoding errors occur. + */ + private static X509Certificate pem2Cert(String certPem) + throws CertificateException { + return (X509Certificate)certFac.generateCertificate( + new ByteArrayInputStream(certPem.getBytes( + Charset.forName("UTF-8")))); + } + + /** + * Covert a PEM-encoded PKCS8 private key into a PrivateKey object. + * + * @param keyPem the PEM encoding for the certificate. + * @param keyAlg the algorithm for the private key contained in the PKCS8 + * ` encoding. + * + * @return the corresponding PrivateKey object for the provided PEM. + * + * @throws GeneralSecurityException if any decoding errors occur. + */ + private static PrivateKey pem2PrivKey(String keyPem, String keyAlg) + throws GeneralSecurityException { + PKCS8EncodedKeySpec p8Spec = new PKCS8EncodedKeySpec( + Base64.getMimeDecoder().decode(keyPem)); + KeyFactory keyFac = KeyFactory.getInstance(keyAlg); + return keyFac.generatePrivate(p8Spec); + } + + /** + * Create an SSLContext for use with the client or server sides of this + * test. + * + * @param keys the key store object for this SSLContext. + * @param alias optional alias specifier to exclusively use that alias for + * TLS connections. + * @param pass the key store password + * @param trust the trust store object + * @param sigAlgProp the signature algorithm property name to set + * (reserved for future use pending the fix for JDK-8255867) + * @param sigAlgVal the property value to be applied. + * + * @return an initialized SSLContext object. + * + * @throws IOException if any IOExceptions during manager factory creation + * take place + * @throws GeneralSecurityException any other failure during SSLContext + * creation/initialization + */ + private static SSLContext createCtxCommon(KeyStore keys, String alias, + char[] pass, KeyStore trust, String sigAlgProp, String sigAlgVal) + throws IOException, GeneralSecurityException { + SSLContext ctx; + if (sigAlgVal != null && !sigAlgVal.isEmpty()) { + System.setProperty(sigAlgProp, sigAlgVal); + } + + // If an alias is specified use our local AliasKeyManager + KeyManager[] kms = (alias != null && !alias.isEmpty()) ? + new KeyManager[] { new AliasKeyManager(keys, pass, alias) } : + createKeyManagerFactory(keys, pass).getKeyManagers(); + + ctx = SSLContext.getInstance("TLS"); + ctx.init(kms, createTrustManagerFactory(trust).getTrustManagers(), + null); + return ctx; + } + + /** + * Creates a KeyManagerFactory for use during SSLContext initialization. + * + * @param ks the KeyStore forming the base of the KeyManagerFactory + * @param passwd the password to use for the key store + * + * @return the initialized KeyManagerFactory + * + * @throws IOException any IOExceptions during key manager factory + * initialization. + * @throws GeneralSecurityException if any failures during instantiation + * take place. + */ + private static KeyManagerFactory createKeyManagerFactory(KeyStore ks, + char[] passwd) throws IOException, GeneralSecurityException { + KeyManagerFactory kmf; + kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, passwd); + + KeyManager[] kmgrs = kmf.getKeyManagers(); + X509ExtendedKeyManager xkm = (X509ExtendedKeyManager)kmgrs[0]; + return kmf; + } + + /** + * Creates a TrustManagerFactory for use during SSLContext initialization. + * + * @param trustStrore the KeyStore forming the base of the + * TrustManagerFactory + * + * @return the initialized TrustManagerFactory + * + * @throws IOException any IOExceptions during trust manager factory + * initialization. + * @throws GeneralSecurityException if any failures during instantiation + * take place. + */ + private static TrustManagerFactory createTrustManagerFactory( + KeyStore trustStore) throws IOException, GeneralSecurityException { + TrustManagerFactory tmf; + PKIXBuilderParameters pkixParams = + new PKIXBuilderParameters(trustStore, new X509CertSelector()); + pkixParams.setRevocationEnabled(false); + tmf = TrustManagerFactory.getInstance("PKIX"); + tmf.init(new CertPathTrustManagerParameters(pkixParams)); + return tmf; + } + + /* + * Configure the client side socket. + */ + @Override + protected void configureClientSocket(SSLSocket socket) { + String pVal; + if ((pVal = clientParameters.get(ParamType.PROTOS)) != null) { + socket.setEnabledProtocols(pVal.split(":")); + } + + if ((pVal = clientParameters.get(ParamType.CIPHERS)) != null) { + socket.setEnabledCipherSuites(pVal.split(":")); + } + } + + /* + * Configure the server side socket. + */ + @Override + protected void configureServerSocket(SSLServerSocket socket) { + String pVal; + try { + socket.setReuseAddress(true); + if ((pVal = serverParameters.get(ParamType.PROTOS)) != null) { + socket.setEnabledProtocols(pVal.split(":")); + } + + if ((pVal = serverParameters.get(ParamType.CIPHERS)) != null) { + socket.setEnabledCipherSuites(pVal.split(":")); + } + + pVal = serverParameters.get(ParamType.CLIAUTH); + socket.setWantClientAuth("WANT".equalsIgnoreCase(pVal)); + socket.setNeedClientAuth("NEED".equalsIgnoreCase(pVal)); + } catch (SocketException se) { + throw new RuntimeException(se); + } + } + + + @Override + protected void runServerApplication(SSLSocket socket) throws Exception { + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + + sslIS.read(); + sslOS.write(85); + sslOS.flush(); + + if (serverChecker != null) { + serverChecker.check(socket); + } + } + + @Override + protected void runClientApplication(SSLSocket socket) throws Exception { + InputStream sslIS = socket.getInputStream(); + OutputStream sslOS = socket.getOutputStream(); + + sslOS.write(280); + sslOS.flush(); + sslIS.read(); + + if (clientChecker != null) { + clientChecker.check(socket); + } + } + + public static void main(String[] args) throws Exception { + SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1", "TLSv1"); + certFac = CertificateFactory.getInstance("X.509"); + String testFormat; + + System.out.println("===== Test KeyManager alias retrieval ====="); + testKeyManager(DEF_ALL_EE, "EdDSA", + new String[] {"ee_ed25519", "ee_ed448"}); + + testFormat = + "===== Basic Ed25519 Server-side Authentication: %s =====\n"; + serverParameters.put(ParamType.KSENTRIES, "EE_ED25519:EE_RSA_2048"); + runtest(testFormat, isPeerEd25519, null, null, null); + + testFormat = + "===== Basic Ed448 Server-side Authentication: %s =====\n"; + serverParameters.put(ParamType.KSENTRIES, "EE_ED448:EE_RSA_2048"); + runtest(testFormat, isPeerEd448, null, null, null); + + testFormat = "===== EC favored over EdDSA by default: %s =====\n"; + serverParameters.put(ParamType.KSENTRIES, + "EE_ED25519:EE_ECDSA_SECP521R1"); + runtest(testFormat, isPeerP521, null, null, null); + + testFormat = "===== Override EC favoring by alias: %s =====\n"; + serverParameters.put(ParamType.CERTALIAS, "EE_ED25519"); + runtest(testFormat, isPeerEd25519, null, null, null); + serverParameters.remove(ParamType.CERTALIAS); + + testFormat = "===== EdDSA Client Authentication: %s =====\n"; + serverParameters.put(ParamType.KSENTRIES, "EE_RSA_2048"); + serverParameters.put(ParamType.CLIAUTH, "NEED"); + clientParameters.put(ParamType.KSENTRIES, "EE_ED25519"); + runtest(testFormat, null, null, isPeerEd25519, null); + } + + private static void testKeyManager(String keyStoreSpec, String keyType, + String[] expAliases) + throws GeneralSecurityException, IOException { + char[] passChar = PASSWD.toCharArray(); + + // Create the KeyManager factory and resulting KeyManager + KeyManagerFactory kmf = createKeyManagerFactory( + createKeyStore(keyStoreSpec, passChar), passChar); + KeyManager[] kMgrs = kmf.getKeyManagers(); + X509KeyManager xkm = (X509KeyManager)kMgrs[0]; + + String[] cliEdDSAAlises = xkm.getClientAliases(keyType, null); + System.out.format("Client Aliases (%s): ", keyType); + for (String alias : cliEdDSAAlises) { + System.out.print(alias + " "); + } + System.out.println(); + + String[] servEdDSAAliases = xkm.getServerAliases(keyType, null); + System.out.format("Server Aliases (%s): ", keyType); + for (String alias : servEdDSAAliases) { + System.out.print(alias + " "); + } + System.out.println(); + + if (!Arrays.equals(cliEdDSAAlises, expAliases)) { + throw new RuntimeException("Client alias mismatch"); + } else if (!Arrays.equals(servEdDSAAliases, expAliases)) { + throw new RuntimeException("Server alias mismatch"); + } + } + + private static void runtest(String testNameFmt, SessionChecker cliChk, + Class cliExpExc, SessionChecker servChk, + Class servExpExc) { + TEST_PROTOS.forEach(protocol -> { + clientParameters.put(ParamType.PROTOS, protocol); + TLSWithEdDSA testObj = new TLSWithEdDSA(cliChk, cliExpExc, servChk, + servExpExc); + System.out.format(testNameFmt, protocol); + try { + testObj.run(); + if (testObj.clientException != null || + testObj.serverException != null) { + throw new RuntimeException("Expected exception from " + + "either client or server but was missed"); + } + } catch (Exception exc) { + if (testObj.clientException == null && + testObj.serverException == null) { + throw new RuntimeException( + "Expected test failure did not occur"); + } else if (testObj.clientException != null && + !testObj.clientException.isAssignableFrom(exc.getClass())) { + throw new RuntimeException("Unexpected client exception " + + "detected: Expected " + + testObj.clientException.getName() + + ", got " + exc.getClass().getName()); + + } else if (testObj.serverException != null && + !testObj.serverException.isAssignableFrom(exc.getClass())) { + throw new RuntimeException("Unexpected client exception " + + "detected: Expected " + + testObj.serverException.getName() + + ", got " + exc.getClass().getName()); + } + } + System.out.println(); + }); + } + + /** + * A Custom KeyManager that allows the user to specify a key/certificate + * by alias to be used for any TLS authentication actions. + */ + static class AliasKeyManager implements X509KeyManager { + private final String alias; + private final KeyStore keystore; + private final char[] pass; + + public AliasKeyManager(KeyStore keystore, char[] pass, String alias) { + this.keystore = Objects.requireNonNull(keystore); + this.alias = Objects.requireNonNull(alias); + this.pass = Objects.requireNonNull(pass); + } + + @Override + public PrivateKey getPrivateKey(String alias) { + try { + return (PrivateKey)keystore.getKey(alias, pass); + } catch (GeneralSecurityException exc) { + throw new RuntimeException(exc); + } + } + + @Override + public X509Certificate[] getCertificateChain(String alias) { + try { + Certificate[] certAr = keystore.getCertificateChain(alias); + return (certAr != null) ? Arrays.copyOf(certAr, certAr.length, + X509Certificate[].class) : null; + } catch (KeyStoreException ke) { + throw new RuntimeException(ke); + } + } + + @Override + public String chooseClientAlias(String[] keyType, Principal[] issuers, + Socket socket) { + // Blindly return the one selected alias. + return alias; + } + + @Override + public String chooseServerAlias(String keyType, Principal[] issuers, + Socket socket) { + // Blindly return the one selected alias. + return alias; + } + + @Override + public String[] getClientAliases(String keyType, Principal[] issuers) { + // There can be only one! + return new String[] { alias }; + } + + @Override + public String[] getServerAliases(String keyType, Principal[] issuers) { + // There can be only one! + return new String[] { alias }; + } + } + + static enum ParamType { + PROTOS, + CIPHERS, + SIGALGS, + CLIAUTH, + KSENTRIES, + TSENTRIES, + CERTALIAS + } +} \ No newline at end of file From a5a034b72f2babf87d4981ebd90b18b1baa4e793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 3 Dec 2020 07:12:25 +0000 Subject: [PATCH 036/504] 8257617: TestLinkPlatform fails with new Java source version Reviewed-by: darcy --- .../testLinkPlatform/TestLinkPlatform.java | 23 +++++++++++++++---- .../testLinkPlatform/linkplatform.properties | 10 -------- 2 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 test/langtools/jdk/javadoc/doclet/testLinkPlatform/linkplatform.properties diff --git a/test/langtools/jdk/javadoc/doclet/testLinkPlatform/TestLinkPlatform.java b/test/langtools/jdk/javadoc/doclet/testLinkPlatform/TestLinkPlatform.java index d036b9046a6af..76bc7dc94da31 100644 --- a/test/langtools/jdk/javadoc/doclet/testLinkPlatform/TestLinkPlatform.java +++ b/test/langtools/jdk/javadoc/doclet/testLinkPlatform/TestLinkPlatform.java @@ -30,7 +30,7 @@ * jdk.javadoc/jdk.javadoc.internal.tool * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main - * @build javadoc.tester.* + * @build toolbox.ToolBox javadoc.tester.* * @run main TestLinkPlatform */ @@ -55,8 +55,8 @@ public class TestLinkPlatform extends JavadocTester { final static String NEW_PLATFORM_URL = "https://docs.oracle.com/en/java/javase/%d/docs/api/java.base/java/lang/Object.html"; final static String PRE_PLATFORM_URL = "https://download.java.net/java/early_access/jdk%d/docs/api/java.base/java/lang/Object.html"; - final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs/%d/api/java/lang/Object.html"; - final static String MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs/%d/api/java.base/java/lang/Object.html"; + final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://example.com/%d/api/java/lang/Object.html"; + final static String MODULAR_CUSTOM_PLATFORM_URL = "https://example.com/%d/api/java.base/java/lang/Object.html"; final static int EARLIEST_VERSION = 7; final static int LATEST_VERSION = Integer.parseInt(SourceVersion.latest().name().substring(8)); @@ -113,13 +113,14 @@ private void testPlatformLinkWithSupportedVersions(Path base, String versionOpti @Test public void testPlatformLinkWithCustomPropertyURL(Path base) throws Exception { + Path customProps = writeCustomProperties(base); for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) { Path out = base.resolve("out_" + version); javadoc("-d", out.toString(), "-sourcepath", packageSrc.toString(), "--release", Integer.toString(version), - "--link-platform-properties", "file:" + testSrc("linkplatform.properties"), + "--link-platform-properties", customProps.toUri().toString(), "p.q"); checkExit(Exit.OK); @@ -134,13 +135,14 @@ public void testPlatformLinkWithCustomPropertyURL(Path base) throws Exception { @Test public void testPlatformLinkWithCustomPropertyFile(Path base) throws Exception { + Path customProps = writeCustomProperties(base); for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) { Path out = base.resolve("out_" + version); javadoc("-d", out.toString(), "-sourcepath", packageSrc.toString(), "--release", Integer.toString(version), - "--link-platform-properties", testSrc("linkplatform.properties"), + "--link-platform-properties", customProps.toString(), "p.q"); checkExit(Exit.OK); @@ -153,6 +155,17 @@ public void testPlatformLinkWithCustomPropertyFile(Path base) throws Exception { } } + private Path writeCustomProperties(Path base) throws IOException { + ToolBox tb = new ToolBox(); + StringBuilder sb = new StringBuilder(); + for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) { + sb.append(String.format("doclet.platform.docs.%1$d= https://example.com/%1$d/api/\n", version)); + } + Path path = base.resolve("linkplatform.properties"); + tb.writeFile(path, sb.toString()); + return path; + } + @Test public void testPlatformLinkWithInvalidPropertyFile(Path base) throws Exception { for (int version = EARLIEST_VERSION; version <= LATEST_VERSION; version++) { diff --git a/test/langtools/jdk/javadoc/doclet/testLinkPlatform/linkplatform.properties b/test/langtools/jdk/javadoc/doclet/testLinkPlatform/linkplatform.properties deleted file mode 100644 index e77d2ffb11bff..0000000000000 --- a/test/langtools/jdk/javadoc/doclet/testLinkPlatform/linkplatform.properties +++ /dev/null @@ -1,10 +0,0 @@ -doclet.platform.docs.7= https://some.domain/docs/7/api/ -doclet.platform.docs.8= https://some.domain/docs/8/api/ -doclet.platform.docs.9= https://some.domain/docs/9/api/ -doclet.platform.docs.10=https://some.domain/docs/10/api/ -doclet.platform.docs.11=https://some.domain/docs/11/api/ -doclet.platform.docs.12=https://some.domain/docs/12/api/ -doclet.platform.docs.13=https://some.domain/docs/13/api/ -doclet.platform.docs.14=https://some.domain/docs/14/api/ -doclet.platform.docs.15=https://some.domain/docs/15/api/ -doclet.platform.docs.16=https://some.domain/docs/16/api/ From 4169d96e249bee6e9c467d4f1d27da533321a8d9 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 3 Dec 2020 07:26:10 +0000 Subject: [PATCH 037/504] 8257143: Enable JVMCI code installation tests on AArch64 Reviewed-by: burban, kvn --- src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp | 6 +- .../vm/ci/code/test/CodeInstallationTest.java | 12 + .../jdk/vm/ci/code/test/DataPatchTest.java | 5 +- .../code/test/InterpreterFrameSizeTest.java | 5 +- .../code/test/MaxOopMapStackOffsetTest.java | 5 +- .../jdk/vm/ci/code/test/NativeCallTest.java | 5 +- .../code/test/SimpleCodeInstallationTest.java | 5 +- .../vm/ci/code/test/SimpleDebugInfoTest.java | 5 +- .../code/test/VirtualObjectDebugInfoTest.java | 5 +- .../test/aarch64/AArch64TestAssembler.java | 537 ++++++++++++++++++ 10 files changed, 573 insertions(+), 17 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/aarch64/AArch64TestAssembler.java diff --git a/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp b/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp index 13375e739d005..7708b4423e048 100644 --- a/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -31,8 +31,8 @@ enum { // Relocations are byte-aligned. offset_unit = 1, - // We don't use format(). - format_width = 0 + // Must be at least 1 for RelocInfo::narrow_oop_in_const. + format_width = 1 }; public: diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java index 5af14226e525f..d7ecc7c04ef06 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java @@ -22,12 +22,15 @@ */ package jdk.vm.ci.code.test; +import jdk.vm.ci.aarch64.AArch64; import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.test.aarch64.AArch64TestAssembler; import jdk.vm.ci.code.test.amd64.AMD64TestAssembler; +import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; @@ -44,6 +47,8 @@ */ public class CodeInstallationTest { + private static final boolean DEBUG = false; + protected final MetaAccessProvider metaAccess; protected final CodeCacheProvider codeCache; protected final TargetDescription target; @@ -68,6 +73,8 @@ private TestAssembler createAssembler() { Architecture arch = codeCache.getTarget().arch; if (arch instanceof AMD64) { return new AMD64TestAssembler(codeCache, config); + } else if (arch instanceof AArch64) { + return new AArch64TestAssembler(codeCache, config); } else { Assert.fail("unsupported architecture"); return null; @@ -95,6 +102,11 @@ protected void test(TestCompiler compiler, Method method, Object... args) { HotSpotCompiledCode code = asm.finish(resolvedMethod); InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null); + if (DEBUG) { + String str = ((HotSpotCodeCacheProvider) codeCache).disassemble(installed); + System.out.println(str); + } + Object expected = method.invoke(null, args); Object actual = installed.executeVarargs(args); Assert.assertEquals(expected, actual); diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java index c9710a11811c9..2e3f90368b10e 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java @@ -24,15 +24,16 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.DataPatchTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java index d5b41ff1424db..b88832677eb50 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java @@ -24,15 +24,16 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.InterpreterFrameSizeTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java index 2a92029b92ec4..f473d089a54a4 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java @@ -24,7 +24,7 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.meta @@ -32,8 +32,9 @@ * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.common * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.MaxOopMapStackOffsetTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java index 26b3736ae7370..dce107095d54d 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java @@ -24,7 +24,7 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library /test/lib / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.code @@ -32,8 +32,9 @@ * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.runtime * jdk.internal.vm.ci/jdk.vm.ci.common + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java TestHotSpotVMConfig.java NativeCallTest.java TestAssembler.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java TestHotSpotVMConfig.java NativeCallTest.java TestAssembler.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. jdk.vm.ci.code.test.NativeCallTest */ package jdk.vm.ci.code.test; diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java index a84fd04d2cdad..e5fc53e8013f1 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java @@ -24,15 +24,16 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.SimpleCodeInstallationTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java index b588b37c1ec25..bfd611312a2af 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java @@ -24,15 +24,16 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.SimpleDebugInfoTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java index 50b3a54fbbdbb..1fb0d77eb73ca 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java @@ -24,15 +24,16 @@ /** * @test * @requires vm.jvmci - * @requires vm.simpleArch == "x64" + * @requires vm.simpleArch == "x64" | vm.simpleArch == "aarch64" * @library / * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot * jdk.internal.vm.ci/jdk.vm.ci.meta * jdk.internal.vm.ci/jdk.vm.ci.code * jdk.internal.vm.ci/jdk.vm.ci.code.site * jdk.internal.vm.ci/jdk.vm.ci.runtime + * jdk.internal.vm.ci/jdk.vm.ci.aarch64 * jdk.internal.vm.ci/jdk.vm.ci.amd64 - * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java aarch64/AArch64TestAssembler.java * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler jdk.vm.ci.code.test.VirtualObjectDebugInfoTest */ diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/aarch64/AArch64TestAssembler.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/aarch64/AArch64TestAssembler.java new file mode 100644 index 0000000000000..b71d2397f7152 --- /dev/null +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/aarch64/AArch64TestAssembler.java @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Arm Limited. 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.vm.ci.code.test.aarch64; + +import jdk.vm.ci.aarch64.AArch64; +import jdk.vm.ci.aarch64.AArch64Kind; +import jdk.vm.ci.code.CallingConvention; +import jdk.vm.ci.code.CodeCacheProvider; +import jdk.vm.ci.code.DebugInfo; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterValue; +import jdk.vm.ci.code.StackSlot; +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.code.test.TestAssembler; +import jdk.vm.ci.code.test.TestHotSpotVMConfig; +import jdk.vm.ci.hotspot.HotSpotCallingConventionType; +import jdk.vm.ci.hotspot.HotSpotConstant; +import jdk.vm.ci.hotspot.HotSpotForeignCallTarget; +import jdk.vm.ci.meta.AllocatableValue; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.VMConstant; + +public class AArch64TestAssembler extends TestAssembler { + + private static final Register scratchRegister = AArch64.rscratch1; + private static final Register doubleScratch = AArch64.v9; + + public AArch64TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) { + super(codeCache, config, + 16 /* initialFrameSize */, 16 /* stackAlignment */, + AArch64Kind.DWORD /* narrowOopKind */, + /* registers */ + AArch64.r0, AArch64.r1, AArch64.r2, AArch64.r3, + AArch64.r4, AArch64.r5, AArch64.r6, AArch64.r7); + } + + private static int f(int val, int msb, int lsb) { + int nbits = msb - lsb + 1; + assert val >= 0; + assert val < (1 << nbits); + assert msb >= lsb; + return val << lsb; + } + + private static int f(Register r, int msb, int lsb) { + assert msb - lsb == 4; + return f(r.encoding, msb, lsb); + } + + private void emitNop() { + code.emitInt(0xd503201f); + } + + private void emitAdd(Register Rd, Register Rn, Register Rm) { + // ADD (shifted register) + code.emitInt(f(0b10001011000, 31, 21) + | f(Rm, 20, 16) + | f(0, 15, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitAdd(Register Rd, Register Rn, int imm12) { + // ADD (immediate) + code.emitInt(f(0b1001000100, 31, 22) + | f(imm12, 21, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitSub(Register Rd, Register Rn, int imm12) { + // SUB (immediate) + code.emitInt(f(0b1101000100, 31, 22) + | f(imm12, 21, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitSub(Register Rd, Register Rn, Register Rm) { + // SUB (extended register) + code.emitInt(f(0b11001011001, 31, 21) + | f(Rm, 20, 16) + | f(0b011000, 15, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitMov(Register Rd, Register Rm) { + // MOV (register) + code.emitInt(f(0b10101010000, 31, 21) + | f(Rm, 20, 16) + | f(0, 15, 10) + | f(AArch64.zr, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitMovz(Register Rd, int imm16, int shift) { + // MOVZ + int hw = 0; + switch (shift) { + case 0: hw = 0; break; + case 16: hw = 1; break; + case 32: hw = 2; break; + case 48: hw = 3; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(0b110100101, 31, 23) + | f(hw, 22, 21) + | f(imm16, 20, 5) + | f(Rd, 4, 0)); + } + + private void emitMovk(Register Rd, int imm16, int shift) { + // MOVK + int hw = 0; + switch (shift) { + case 0: hw = 0; break; + case 16: hw = 1; break; + case 32: hw = 2; break; + case 48: hw = 3; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(0b111100101, 31, 23) + | f(hw, 22, 21) + | f(imm16, 20, 5) + | f(Rd, 4, 0)); + } + + private void emitShiftLeft(Register Rd, Register Rn, int shift) { + // LSL (immediate) + code.emitInt(f(0b1101001101, 31, 22) + | f(-shift & 0b111111, 21, 16) + | f(63 - shift, 15, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + private void emitLoadRegister(Register Rt, AArch64Kind kind, int offset) { + // LDR (literal) + int opc = 0; + switch (kind) { + case DWORD: opc = 0; break; + case QWORD: opc = 1; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(opc, 31, 30) + | f(0b011000, 29, 24) + | f(offset, 23, 5) + | f(Rt, 4, 0)); + } + + private void emitLoadRegister(Register Rt, AArch64Kind kind, Register Rn, int offset) { + // LDR (immediate) + assert offset >= 0; + int size = 0; + switch (kind) { + case DWORD: size = 0b10; break; + case QWORD: size = 0b11; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(size, 31, 30) + | f(0b11100101, 29, 22) + | f(offset >> size, 21, 10) + | f(Rn, 9, 5) + | f(Rt, 4, 0)); + } + + private void emitStoreRegister(Register Rt, AArch64Kind kind, Register Rn, int offset) { + // STR (immediate) + assert offset >= 0; + int size = 0, fp = 0; + switch (kind) { + case DWORD: size = 0b10; fp = 0; break; + case QWORD: size = 0b11; fp = 0; break; + case SINGLE: size = 0b10; fp = 1; break; + case DOUBLE: size = 0b11; fp = 1; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(size, 31, 30) + | f(0b111, 29, 27) + | f(fp, 26, 26) + | f(0b0100, 25, 22) + | f(offset >> size, 21, 10) + | f(Rn, 9, 5) + | f(Rt, 4, 0)); + } + + private void emitBlr(Register Rn) { + // BLR + code.emitInt(f(0b1101011000111111000000, 31, 10) + | f(Rn, 9, 5) + | f(0, 4, 0)); + } + + private void emitFmov(Register Rd, AArch64Kind kind, Register Rn) { + // FMOV (general) + int ftype = 0, sf = 0; + switch (kind) { + case SINGLE: sf = 0; ftype = 0b00; break; + case DOUBLE: sf = 1; ftype = 0b01; break; + default: throw new IllegalArgumentException(); + } + code.emitInt(f(sf, 31, 31) + | f(0b0011110, 30, 24) + | f(ftype, 23, 22) + | f(0b100111, 21, 16) + | f(0, 15, 10) + | f(Rn, 9, 5) + | f(Rd, 4, 0)); + } + + @Override + public void emitGrowStack(int size) { + assert size % 16 == 0; + if (size > -4096 && size < 0) { + emitAdd(AArch64.sp, AArch64.sp, -size); + } else if (size == 0) { + // No-op + } else if (size < 4096) { + emitSub(AArch64.sp, AArch64.sp, size); + } else if (size < 65535) { + emitMovz(scratchRegister, size & 0xffff, 0); + emitMovk(scratchRegister, (size >> 16) & 0xffff, 16); + emitSub(AArch64.sp, AArch64.sp, scratchRegister); + } else { + throw new IllegalArgumentException(); + } + } + + @Override + public void emitPrologue() { + // Must be patchable by NativeJump::patch_verified_entry + emitNop(); + code.emitInt(0xa9be7bfd); // stp x29, x30, [sp, #-32]! + code.emitInt(0x910003fd); // mov x29, sp + + setDeoptRescueSlot(newStackSlot(AArch64Kind.QWORD)); + } + + @Override + public void emitEpilogue() { + recordMark(config.MARKID_DEOPT_HANDLER_ENTRY); + recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 5, true, null); + code.emitInt(0x94000000); // bl + } + + @Override + public void emitCallPrologue(CallingConvention cc, Object... prim) { + emitGrowStack(cc.getStackSize()); + frameSize += cc.getStackSize(); + AllocatableValue[] args = cc.getArguments(); + for (int i = 0; i < args.length; i++) { + emitLoad(args[i], prim[i]); + } + } + + @Override + public void emitCallEpilogue(CallingConvention cc) { + emitGrowStack(-cc.getStackSize()); + frameSize -= cc.getStackSize(); + } + + @Override + public void emitCall(long addr) { + emitLoadLong(scratchRegister, addr); + emitBlr(scratchRegister); + } + + @Override + public void emitLoad(AllocatableValue av, Object prim) { + if (av instanceof RegisterValue) { + Register reg = ((RegisterValue) av).getRegister(); + if (prim instanceof Float) { + emitLoadFloat(reg, (Float) prim); + } else if (prim instanceof Double) { + emitLoadDouble(reg, (Double) prim); + } else if (prim instanceof Integer) { + emitLoadInt(reg, (Integer) prim); + } else if (prim instanceof Long) { + emitLoadLong(reg, (Long) prim); + } + } else if (av instanceof StackSlot) { + StackSlot slot = (StackSlot) av; + if (prim instanceof Float) { + emitFloatToStack(slot, emitLoadFloat(doubleScratch, (Float) prim)); + } else if (prim instanceof Double) { + emitDoubleToStack(slot, emitLoadDouble(doubleScratch, (Double) prim)); + } else if (prim instanceof Integer) { + emitIntToStack(slot, emitLoadInt(scratchRegister, (Integer) prim)); + } else if (prim instanceof Long) { + emitLongToStack(slot, emitLoadLong(scratchRegister, (Long) prim)); + } else { + assert false : "Unimplemented"; + } + } else { + throw new IllegalArgumentException("Unknown value " + av); + } + } + + @Override + public Register emitLoadPointer(HotSpotConstant c) { + recordDataPatchInCode(new ConstantReference((VMConstant) c)); + + Register ret = newRegister(); + if (c.isCompressed()) { + // Set upper 16 bits first. See MacroAssembler::patch_oop(). + emitMovz(ret, 0xdead, 16); + emitMovk(ret, 0xdead, 0); + } else { + // 48-bit VA + emitMovz(ret, 0xdead, 0); + emitMovk(ret, 0xdead, 16); + emitMovk(ret, 0xdead, 32); + } + return ret; + } + + @Override + public Register emitLoadPointer(Register b, int offset) { + Register ret = newRegister(); + emitLoadRegister(ret, AArch64Kind.QWORD, b, offset); + return ret; + } + + @Override + public Register emitLoadNarrowPointer(DataSectionReference ref) { + recordDataPatchInCode(ref); + + Register ret = newRegister(); + emitLoadRegister(ret, AArch64Kind.DWORD, 0xdead); + return ret; + } + + @Override + public Register emitLoadPointer(DataSectionReference ref) { + recordDataPatchInCode(ref); + + Register ret = newRegister(); + emitLoadRegister(ret, AArch64Kind.QWORD, 0xdead); + return ret; + } + + private Register emitLoadDouble(Register reg, double c) { + DataSectionReference ref = new DataSectionReference(); + ref.setOffset(data.position()); + data.emitDouble(c); + + recordDataPatchInCode(ref); + emitLoadRegister(scratchRegister, AArch64Kind.QWORD, 0xdead); + emitFmov(reg, AArch64Kind.DOUBLE, scratchRegister); + return reg; + } + + private Register emitLoadFloat(Register reg, float c) { + DataSectionReference ref = new DataSectionReference(); + ref.setOffset(data.position()); + data.emitFloat(c); + + recordDataPatchInCode(ref); + emitLoadRegister(scratchRegister, AArch64Kind.DWORD, 0xdead); + emitFmov(reg, AArch64Kind.SINGLE, scratchRegister); + return reg; + } + + @Override + public Register emitLoadFloat(float c) { + Register ret = AArch64.v0; + return emitLoadFloat(ret, c); + } + + private Register emitLoadLong(Register reg, long c) { + emitMovz(reg, (int)(c & 0xffff), 0); + emitMovk(reg, (int)((c >> 16) & 0xffff), 16); + emitMovk(reg, (int)((c >> 32) & 0xffff), 32); + emitMovk(reg, (int)((c >> 48) & 0xffff), 48); + return reg; + } + + @Override + public Register emitLoadLong(long c) { + Register ret = newRegister(); + return emitLoadLong(ret, c); + } + + private Register emitLoadInt(Register reg, int c) { + emitMovz(reg, (int)(c & 0xffff), 0); + emitMovk(reg, (int)((c >> 16) & 0xffff), 16); + return reg; + } + + @Override + public Register emitLoadInt(int c) { + Register ret = newRegister(); + return emitLoadInt(ret, c); + } + + @Override + public Register emitIntArg0() { + return codeCache.getRegisterConfig() + .getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int) + .get(0); + } + + @Override + public Register emitIntArg1() { + return codeCache.getRegisterConfig() + .getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int) + .get(1); + } + + @Override + public Register emitIntAdd(Register a, Register b) { + emitAdd(a, a, b); + return a; + } + + @Override + public void emitTrap(DebugInfo info) { + // Dereference null pointer + emitMovz(scratchRegister, 0, 0); + recordImplicitException(info); + emitLoadRegister(AArch64.zr, AArch64Kind.QWORD, scratchRegister, 0); + } + + @Override + public void emitIntRet(Register a) { + emitMov(AArch64.r0, a); + code.emitInt(0x910003bf); // mov sp, x29 + code.emitInt(0xa8c27bfd); // ldp x29, x30, [sp], #32 + code.emitInt(0xd65f03c0); // ret + } + + @Override + public void emitFloatRet(Register a) { + assert a == AArch64.v0 : "Unimplemented move " + a; + code.emitInt(0x910003bf); // mov sp, x29 + code.emitInt(0xa8c27bfd); // ldp x29, x30, [sp], #32 + code.emitInt(0xd65f03c0); // ret + } + + @Override + public void emitPointerRet(Register a) { + emitIntRet(a); + } + + @Override + public StackSlot emitPointerToStack(Register a) { + return emitLongToStack(a); + } + + @Override + public StackSlot emitNarrowPointerToStack(Register a) { + return emitIntToStack(a); + } + + @Override + public Register emitUncompressPointer(Register compressed, long base, int shift) { + if (shift > 0) { + emitShiftLeft(compressed, compressed, shift); + } + + if (base != 0) { + emitLoadLong(scratchRegister, base); + emitAdd(compressed, compressed, scratchRegister); + } + + return compressed; + } + + private StackSlot emitDoubleToStack(StackSlot slot, Register a) { + emitStoreRegister(a, AArch64Kind.DOUBLE, AArch64.sp, slot.getOffset(frameSize)); + return slot; + } + + @Override + public StackSlot emitDoubleToStack(Register a) { + StackSlot ret = newStackSlot(AArch64Kind.DOUBLE); + return emitDoubleToStack(ret, a); + } + + private StackSlot emitFloatToStack(StackSlot slot, Register a) { + emitStoreRegister(a, AArch64Kind.SINGLE, AArch64.sp, slot.getOffset(frameSize)); + return slot; + } + + @Override + public StackSlot emitFloatToStack(Register a) { + StackSlot ret = newStackSlot(AArch64Kind.SINGLE); + return emitFloatToStack(ret, a); + } + + private StackSlot emitIntToStack(StackSlot slot, Register a) { + emitStoreRegister(a, AArch64Kind.DWORD, AArch64.sp, slot.getOffset(frameSize)); + return slot; + } + + @Override + public StackSlot emitIntToStack(Register a) { + StackSlot ret = newStackSlot(AArch64Kind.DWORD); + return emitIntToStack(ret, a); + } + + private StackSlot emitLongToStack(StackSlot slot, Register a) { + emitStoreRegister(a, AArch64Kind.QWORD, AArch64.sp, slot.getOffset(frameSize)); + return slot; + } + + @Override + public StackSlot emitLongToStack(Register a) { + StackSlot ret = newStackSlot(AArch64Kind.QWORD); + return emitLongToStack(ret, a); + } + +} From ae1eb286c6a2e76c3b38d68641208d4c01d4eef8 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 3 Dec 2020 07:50:19 +0000 Subject: [PATCH 038/504] 8257604: JNI_ArgumentPusherVaArg leaks valist Reviewed-by: dcubed, coleenp --- src/hotspot/share/prims/jni.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index c400456f2efd5..bdf03279580b2 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -870,7 +870,6 @@ class JNI_ArgumentPusher : public SignatureIterator { class JNI_ArgumentPusherVaArg : public JNI_ArgumentPusher { - protected: va_list _ap; void set_ap(va_list rap) { @@ -906,6 +905,10 @@ class JNI_ArgumentPusherVaArg : public JNI_ArgumentPusher { set_ap(rap); } + ~JNI_ArgumentPusherVaArg() { + va_end(_ap); + } + virtual void push_arguments_on(JavaCallArguments* arguments) { _arguments = arguments; do_parameters_on(this); From b44a329f919a7d5c53a45584d3d681a30730731f Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 3 Dec 2020 08:41:26 +0000 Subject: [PATCH 039/504] 8256864: [windows] Improve tracing for mapping errors Reviewed-by: iklam, rrich --- src/hotspot/os/windows/os_windows.cpp | 111 +++++++++++++++++++++---- src/hotspot/share/runtime/os.cpp | 5 ++ src/hotspot/share/runtime/os.hpp | 2 + test/hotspot/gtest/runtime/test_os.cpp | 43 ++++++++-- 4 files changed, 141 insertions(+), 20 deletions(-) diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 3342ecf781756..32020da916db7 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3215,9 +3215,10 @@ void os::split_reserved_memory(char *base, size_t size, size_t split) { (attempt_reserve_memory_at(base, split) != NULL) && (attempt_reserve_memory_at(split_address, size - split) != NULL); if (!rc) { - log_warning(os)("os::split_reserved_memory failed for [" RANGE_FORMAT ")", + log_warning(os)("os::split_reserved_memory failed for " RANGE_FORMAT, RANGE_FORMAT_ARGS(base, size)); - assert(false, "os::split_reserved_memory failed for [" RANGE_FORMAT ")", + os::print_memory_mappings(base, size, tty); + assert(false, "os::split_reserved_memory failed for " RANGE_FORMAT, RANGE_FORMAT_ARGS(base, size)); } @@ -5989,19 +5990,55 @@ bool os::win32::find_mapping(address addr, mapping_info_t* mi) { return rc; } +// Helper for print_one_mapping: print n words, both as hex and ascii. +// Use Safefetch for all values. +static void print_snippet(const void* p, outputStream* st) { + static const int num_words = LP64_ONLY(3) NOT_LP64(6); + static const int num_bytes = num_words * sizeof(int); + intptr_t v[num_words]; + const int errval = 0xDE210244; + for (int i = 0; i < num_words; i++) { + v[i] = SafeFetchN((intptr_t*)p + i, errval); + if (v[i] == errval && + SafeFetchN((intptr_t*)p + i, ~errval) == ~errval) { + return; + } + } + st->put('['); + for (int i = 0; i < num_words; i++) { + st->print(INTPTR_FORMAT " ", v[i]); + } + const char* b = (char*)v; + st->put('\"'); + for (int i = 0; i < num_bytes; i++) { + st->put(::isgraph(b[i]) ? b[i] : '.'); + } + st->put('\"'); + st->put(']'); +} + // Helper function for print_memory_mappings: // Given a MEMORY_BASIC_INFORMATION, containing information about a non-free region: // print out all regions in that allocation. If any of those regions // fall outside the given range [start, end), indicate that in the output. // Return the pointer to the end of the allocation. static address print_one_mapping(MEMORY_BASIC_INFORMATION* minfo, address start, address end, outputStream* st) { - assert(start != NULL && end != NULL && end > start, "Sanity"); + // Print it like this: + // + // Base: : [xxxx - xxxx], state=MEM_xxx, prot=x, type=MEM_xxx (region 1) + // [xxxx - xxxx], state=MEM_xxx, prot=x, type=MEM_xxx (region 2) assert(minfo->State != MEM_FREE, "Not inside an allocation."); address allocation_base = (address)minfo->AllocationBase; - address last_region_end = NULL; - st->print_cr("AllocationBase: " PTR_FORMAT ":", allocation_base); #define IS_IN(p) (p >= start && p < end) + bool first_line = true; + bool is_dll = false; for(;;) { + if (first_line) { + st->print("Base " PTR_FORMAT ": ", p2i(allocation_base)); + } else { + st->print_raw(NOT_LP64 (" ") + LP64_ONLY(" ")); + } address region_start = (address)minfo->BaseAddress; address region_end = region_start + minfo->RegionSize; assert(region_end > region_start, "Sanity"); @@ -6014,19 +6051,39 @@ static address print_one_mapping(MEMORY_BASIC_INFORMATION* minfo, address start, } st->print("[" PTR_FORMAT "-" PTR_FORMAT "), state=", p2i(region_start), p2i(region_end)); switch (minfo->State) { - case MEM_COMMIT: st->print("MEM_COMMIT"); break; - case MEM_FREE: st->print("MEM_FREE"); break; - case MEM_RESERVE: st->print("MEM_RESERVE"); break; + case MEM_COMMIT: st->print_raw("MEM_COMMIT "); break; + case MEM_FREE: st->print_raw("MEM_FREE "); break; + case MEM_RESERVE: st->print_raw("MEM_RESERVE"); break; default: st->print("%x?", (unsigned)minfo->State); } - st->print(", prot=%x, type=", (unsigned)minfo->AllocationProtect); + st->print(", prot=%3x, type=", (unsigned)minfo->Protect); switch (minfo->Type) { - case MEM_IMAGE: st->print("MEM_IMAGE"); break; - case MEM_MAPPED: st->print("MEM_MAPPED"); break; - case MEM_PRIVATE: st->print("MEM_PRIVATE"); break; + case MEM_IMAGE: st->print_raw("MEM_IMAGE "); break; + case MEM_MAPPED: st->print_raw("MEM_MAPPED "); break; + case MEM_PRIVATE: st->print_raw("MEM_PRIVATE"); break; default: st->print("%x?", (unsigned)minfo->State); } + // At the start of every allocation, print some more information about this mapping. + // Notes: + // - this could be beefed up a lot, similar to os::print_location + // - for now we just query the allocation start point. This may be confusing for cases where + // the kernel merges multiple mappings. + if (first_line) { + char buf[MAX_PATH]; + if (os::dll_address_to_library_name(allocation_base, buf, sizeof(buf), nullptr)) { + st->print(", %s", buf); + is_dll = true; + } + } + // If memory is accessible, and we do not know anything else about it, print a snippet + if (!is_dll && + minfo->State == MEM_COMMIT && + !(minfo->Protect & PAGE_NOACCESS || minfo->Protect & PAGE_GUARD)) { + st->print_raw(", "); + print_snippet(region_start, st); + } st->cr(); + // Next region... bool rc = checkedVirtualQuery(region_end, minfo); if (rc == false || // VirtualQuery error, end of allocation? (minfo->State == MEM_FREE) || // end of allocation, free memory follows @@ -6035,6 +6092,7 @@ static address print_one_mapping(MEMORY_BASIC_INFORMATION* minfo, address start, { return region_end; } + first_line = false; } #undef IS_IN ShouldNotReachHere(); @@ -6046,7 +6104,14 @@ void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) { address start = (address)addr; address end = start + bytes; address p = start; - while (p < end) { + if (p == nullptr) { // Lets skip the zero pages. + p += os::vm_allocation_granularity(); + } + address p2 = p; // guard against wraparounds + int fuse = 0; + + while (p < end && p >= p2) { + p2 = p; // Probe for the next mapping. if (checkedVirtualQuery(p, &minfo)) { if (minfo.State != MEM_FREE) { @@ -6064,8 +6129,24 @@ void os::print_memory_mappings(char* addr, size_t bytes, outputStream* st) { p = region_end; } } else { - // advance probe pointer. - p += os::vm_allocation_granularity(); + // MSDN doc on VirtualQuery is unclear about what it means if it returns an error. + // In particular, whether querying an address outside any mappings would report + // a MEM_FREE region or just return an error. From experiments, it seems to return + // a MEM_FREE region for unmapped areas in valid address space and an error if we + // are outside valid address space. + // Here, we advance the probe pointer by alloc granularity. But if the range to print + // is large, this may take a long time. Therefore lets stop right away if the address + // is outside of what we know are valid addresses on Windows. Also, add a loop fuse. + static const address end_virt = (address)(LP64_ONLY(0x7ffffffffffULL) NOT_LP64(3*G)); + if (p >= end_virt) { + break; + } else { + // Advance probe pointer, but with a fuse to break long loops. + if (fuse++ == 100000) { + break; + } + p += os::vm_allocation_granularity(); + } } } } diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 4d702eb94699c..b228a0eecd33b 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1737,6 +1737,11 @@ bool os::release_memory(char* addr, size_t bytes) { return res; } +// Prints all mappings +void os::print_memory_mappings(outputStream* st) { + os::print_memory_mappings(nullptr, (size_t)-1, st); +} + void os::pretouch_memory(void* start, void* end, size_t page_size) { for (volatile char *p = (char*)start; p < (char*)end; p += page_size) { *p = 0; diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index e38e1a068b43c..56afb9d1ec021 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -349,6 +349,8 @@ class os: AllStatic { // A diagnostic function to print memory mappings in the given range. static void print_memory_mappings(char* addr, size_t bytes, outputStream* st); + // Prints all mappings + static void print_memory_mappings(outputStream* st); // Touch memory pages that cover the memory range from start to end (exclusive) // to make the OS back the memory range with actual memory. diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 4795a78407ec0..e7605baf6ef59 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "memory/allocation.hpp" #include "memory/resourceArea.hpp" #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" @@ -494,11 +495,43 @@ TEST_VM(os, release_one_mapping_multi_commits) { PRINT_MAPPINGS("D"); } -TEST_VM(os, show_mappings_1) { - // Display an arbitrary large address range. Make this works, does not hang, etc. - char dummy[16 * K]; // silent truncation is fine, we don't care. - stringStream ss(dummy, sizeof(dummy)); - os::print_memory_mappings((char*)0x1000, LP64_ONLY(1024) NOT_LP64(3) * G, &ss); +static void test_show_mappings(address start, size_t size) { + // Note: should this overflow, thats okay. stream will silently truncate. Does not matter for the test. + const size_t buflen = 4 * M; + char* buf = NEW_C_HEAP_ARRAY(char, buflen, mtInternal); + buf[0] = '\0'; + stringStream ss(buf, buflen); + if (start != nullptr) { + os::print_memory_mappings((char*)start, size, &ss); + } else { + os::print_memory_mappings(&ss); // prints full address space + } + // Still an empty implementation on MacOS and AIX +#if defined(LINUX) || defined(_WIN32) + EXPECT_NE(buf[0], '\0'); +#endif + // buf[buflen - 1] = '\0'; + // tty->print_raw(buf); + FREE_C_HEAP_ARRAY(char, buf); +} + +TEST_VM(os, show_mappings_small_range) { + test_show_mappings((address)0x100000, 2 * G); +} + +TEST_VM(os, show_mappings_full_range) { + // Reserve a small range and fill it with a marker string, should show up + // on implementations displaying range snippets + char* p = os::reserve_memory(1 * M, mtInternal); + if (p != nullptr) { + if (os::commit_memory(p, 1 * M, false)) { + strcpy(p, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + } + } + test_show_mappings(nullptr, 0); + if (p != nullptr) { + os::release_memory(p, 1 * M); + } } #ifdef _WIN32 From 4a267f1bc2b025aae2cb9df7283156aeb0282406 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Thu, 3 Dec 2020 08:50:08 +0000 Subject: [PATCH 040/504] 8244847: Linux/PPC: runtime/CompressedOops/CompressedClassPointers: smallHeapTest fails Reviewed-by: stuefe, mdoerr --- src/hotspot/share/memory/metaspace.cpp | 11 ++++++++++- .../CompressedOops/CompressedClassPointers.java | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index 6d1ada365b56a..4bd6118cfbb42 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -532,7 +532,7 @@ bool Metaspace::class_space_is_initialized() { // On error, returns an unreserved space. ReservedSpace Metaspace::reserve_address_space_for_compressed_classes(size_t size) { -#ifdef AARCH64 +#if defined(AARCH64) || defined(PPC64) const size_t alignment = Metaspace::reserve_alignment(); // AArch64: Try to align metaspace so that we can decode a compressed @@ -542,6 +542,13 @@ ReservedSpace Metaspace::reserve_address_space_for_compressed_classes(size_t siz // of the upper 32-bits of the address are zero so we can handle a shift // when decoding. + // PPC64: smaller heaps up to 2g will be mapped just below 4g. Then the + // attempt to place the compressed class space just after the heap fails on + // Linux 4.1.42 and higher because the launcher is loaded at 4g + // (ELF_ET_DYN_BASE). In that case we reach here and search the address space + // below 32g to get a zerobased CCS. For simplicity we reuse the search + // strategy for AARCH64. + static const struct { address from; address to; @@ -565,7 +572,9 @@ ReservedSpace Metaspace::reserve_address_space_for_compressed_classes(size_t siz a += search_ranges[i].increment; } } +#endif // defined(AARCH64) || defined(PPC64) +#ifdef AARCH64 // Note: on AARCH64, if the code above does not find any good placement, we // have no recourse. We return an empty space and the VM will exit. return ReservedSpace(); diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java index ec46c128d7291..8c3bacfacb46b 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java @@ -44,7 +44,7 @@ public class CompressedClassPointers { // Returns true if we are to test the narrow klass base; we only do this on // platforms where we can be reasonably shure that we get reproducable placement). static boolean testNarrowKlassBase() { - if (Platform.isWindows() || Platform.isPPC()) { + if (Platform.isWindows()) { return false; } return true; @@ -98,7 +98,11 @@ public static void largeHeapTest() throws Exception { "-Xshare:off", "-XX:+VerifyBeforeGC", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - if (testNarrowKlassBase()) { + if (testNarrowKlassBase() && !Platform.isAix()) { + // AIX: the heap cannot be placed below 32g. The first attempt to + // place the CCS behind the heap fails (luckily). Subsequently CCS + // is successfully placed below 32g. So we get 0x0 as narrow klass + // base. output.shouldNotContain("Narrow klass base: 0x0000000000000000"); output.shouldContain("Narrow klass shift: 0"); } From e4497c9e6969cbf0ba25526a49febda205abecfb Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Thu, 3 Dec 2020 13:14:57 +0000 Subject: [PATCH 041/504] 8256718: Obsolete the long term deprecated and aliased Trace flags Reviewed-by: sspitsyn, iklam, dholmes, coleenp --- .../cpu/aarch64/methodHandles_aarch64.cpp | 2 - src/hotspot/cpu/x86/methodHandles_x86.cpp | 2 - src/hotspot/share/oops/method.hpp | 2 +- src/hotspot/share/runtime/arguments.cpp | 130 +++--------------- src/hotspot/share/runtime/arguments.hpp | 18 --- src/hotspot/share/runtime/globals.hpp | 3 - .../CommandLine/TraceExceptionsTest.java | 2 +- .../runtime/cds/appcds/ClassPathAttr.java | 10 -- .../cds/appcds/IgnoreEmptyClassPaths.java | 6 +- .../cds/appcds/javaldr/GCDuringDump.java | 2 +- .../javaldr/GCSharedStringsDuringDump.java | 4 +- .../appcds/javaldr/HumongousDuringDump.java | 2 +- .../classpathtests/BootAppendTests.java | 2 +- .../runtime/logging/BiasedLockingTest.java | 14 +- .../runtime/logging/ClassLoadUnloadTest.java | 18 +-- .../runtime/logging/ClassResolutionTest.java | 16 +-- .../jtreg/runtime/logging/ExceptionsTest.java | 14 +- .../logging/ExceptionsTest_options_file | 2 +- .../logging/LoaderConstraintsTest.java | 13 +- .../runtime/logging/MonitorInflationTest.java | 10 +- .../logging/RemovedDevelopFlagsTest.java | 63 --------- .../runtime/logging/SafepointCleanupTest.java | 8 -- test/jdk/com/sun/jdi/cds/CDSJDITest.java | 4 +- 23 files changed, 37 insertions(+), 310 deletions(-) delete mode 100644 test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java diff --git a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp index 82b1401e34b60..e60fb5539e68c 100644 --- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp @@ -132,8 +132,6 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm, assert(recv != noreg, "required register"); assert(method_temp == rmethod, "required register for loading method"); - //NOT_PRODUCT({ FlagSetting fs(TraceMethodHandles, true); trace_method_handle(_masm, "LZMH"); }); - // Load the invoker, as MH -> MH.form -> LF.vmentry __ verify_oop(recv); __ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset())), temp2); diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp index b4c7d43c73275..298c5144a1575 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.cpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp @@ -168,8 +168,6 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm, assert(recv != noreg, "required register"); assert(method_temp == rbx, "required register for loading method"); - //NOT_PRODUCT({ FlagSetting fs(TraceMethodHandles, true); trace_method_handle(_masm, "LZMH"); }); - // Load the invoker, as MH -> MH.form -> LF.vmentry __ verify_oop(recv); __ load_heap_oop(method_temp, Address(recv, NONZERO(java_lang_invoke_MethodHandle::form_offset())), temp2); diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp index f80ecdf369d05..38646672d5c8f 100644 --- a/src/hotspot/share/oops/method.hpp +++ b/src/hotspot/share/oops/method.hpp @@ -1009,7 +1009,7 @@ class Method : public Metadata { // Printing void print_short_name(outputStream* st = tty); // prints as klassname::methodname; Exposed so field engineers can debug VM #if INCLUDE_JVMTI - void print_name(outputStream* st = tty); // prints as "virtual void foo(int)"; exposed for TraceRedefineClasses + void print_name(outputStream* st = tty); // prints as "virtual void foo(int)"; exposed for -Xlog:redefine+class #else void print_name(outputStream* st = tty) PRODUCT_RETURN; // prints as "virtual void foo(int)" #endif diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 357b7e7e3a82a..3b62a67deec49 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -557,6 +557,22 @@ static SpecialFlag const special_jvm_flags[] = { { "Debugging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, { "UseRDPCForConstantTableBase", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, { "VerifyMergedCPBytecodes", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "PrintSharedSpaces", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceBiasedLocking", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceClassLoading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceClassLoadingPreorder", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceClassPaths", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceClassResolution", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceClassUnloading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceExceptions", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceInvokeDynamic", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceLoaderConstraints", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceMethodHandles", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceMonitorInflation", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceSafepointCleanupTime", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceJVMTIObjectTagging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "TraceRedefineClasses", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, + { "PrintJNIResolving", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS // These entries will generate build errors. Their purpose is to test the macros. @@ -584,44 +600,6 @@ static AliasedFlag const aliased_jvm_flags[] = { { NULL, NULL} }; -// NOTE: A compatibility request will be necessary for each alias to be removed. -static AliasedLoggingFlag const aliased_logging_flags[] = { - { "PrintSharedSpaces", LogLevel::Info, true, LOG_TAGS(cds) }, - { "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) }, - { "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(class, load) }, - { "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(class, preorder) }, - { "TraceClassPaths", LogLevel::Info, true, LOG_TAGS(class, path) }, - { "TraceClassResolution", LogLevel::Debug, true, LOG_TAGS(class, resolve) }, - { "TraceClassUnloading", LogLevel::Info, true, LOG_TAGS(class, unload) }, - { "TraceExceptions", LogLevel::Info, true, LOG_TAGS(exceptions) }, - { "TraceInvokeDynamic", LogLevel::Debug, true, LOG_TAGS(methodhandles, indy) }, - { "TraceLoaderConstraints", LogLevel::Info, true, LOG_TAGS(class, loader, constraints) }, - { "TraceMethodHandles", LogLevel::Info, true, LOG_TAGS(methodhandles) }, - { "TraceMonitorInflation", LogLevel::Trace, true, LOG_TAGS(monitorinflation) }, - { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepoint, cleanup) }, - { "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) }, - { "TraceRedefineClasses", LogLevel::Info, false, LOG_TAGS(redefine, class) }, - { "PrintJNIResolving", LogLevel::Debug, true, LOG_TAGS(jni, resolve) }, - { NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) } -}; - -#ifndef PRODUCT -// These options are removed in jdk9. Remove this code for jdk10. -static AliasedFlag const removed_develop_logging_flags[] = { - { "TraceClassInitialization", "-Xlog:class+init" }, - { "TraceClassLoaderData", "-Xlog:class+loader+data" }, - { "TraceDefaultMethods", "-Xlog:defaultmethods=debug" }, - { "TraceItables", "-Xlog:itables=debug" }, - { "TraceMonitorMismatch", "-Xlog:monitormismatch=info" }, - { "TraceSafepoint", "-Xlog:safepoint=debug" }, - { "TraceStartupTime", "-Xlog:startuptime" }, - { "TraceVMOperation", "-Xlog:vmoperation=debug" }, - { "PrintVtables", "-Xlog:vtables=debug" }, - { "VerboseVerification", "-Xlog:verification" }, - { NULL, NULL } -}; -#endif //PRODUCT - // Return true if "v" is less than "other", where "other" may be "undefined". static bool version_less_than(JDK_Version v, JDK_Version other) { assert(!v.is_undefined(), "must be defined"); @@ -685,18 +663,6 @@ int Arguments::is_deprecated_flag(const char *flag_name, JDK_Version* version) { return 0; } -#ifndef PRODUCT -const char* Arguments::removed_develop_logging_flag_name(const char* name){ - for (size_t i = 0; removed_develop_logging_flags[i].alias_name != NULL; i++) { - const AliasedFlag& flag = removed_develop_logging_flags[i]; - if (strcmp(flag.alias_name, name) == 0) { - return flag.real_name; - } - } - return NULL; -} -#endif // PRODUCT - const char* Arguments::real_flag_name(const char *flag_name) { for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) { const AliasedFlag& flag_status = aliased_jvm_flags[i]; @@ -1014,44 +980,6 @@ const char* Arguments::handle_aliases_and_deprecation(const char* arg, bool warn return NULL; } -void log_deprecated_flag(const char* name, bool on, AliasedLoggingFlag alf) { - LogTagType tagSet[] = {alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5}; - // Set tagset string buffer at max size of 256, large enough for any alias tagset - const int max_tagset_size = 256; - int max_tagset_len = max_tagset_size - 1; - char tagset_buffer[max_tagset_size]; - tagset_buffer[0] = '\0'; - - // Write tag-set for aliased logging option, in string list form - int max_tags = sizeof(tagSet)/sizeof(tagSet[0]); - for (int i = 0; i < max_tags && tagSet[i] != LogTag::__NO_TAG; i++) { - if (i > 0) { - strncat(tagset_buffer, "+", max_tagset_len - strlen(tagset_buffer)); - } - strncat(tagset_buffer, LogTag::name(tagSet[i]), max_tagset_len - strlen(tagset_buffer)); - } - if (!alf.exactMatch) { - strncat(tagset_buffer, "*", max_tagset_len - strlen(tagset_buffer)); - } - log_warning(arguments)("-XX:%s%s is deprecated. Will use -Xlog:%s=%s instead.", - (on) ? "+" : "-", - name, - tagset_buffer, - (on) ? LogLevel::name(alf.level) : "off"); -} - -AliasedLoggingFlag Arguments::catch_logging_aliases(const char* name, bool on){ - for (size_t i = 0; aliased_logging_flags[i].alias_name != NULL; i++) { - const AliasedLoggingFlag& alf = aliased_logging_flags[i]; - if (strcmp(alf.alias_name, name) == 0) { - log_deprecated_flag(name, on, alf); - return alf; - } - } - AliasedLoggingFlag a = {NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG)}; - return a; -} - bool Arguments::parse_argument(const char* arg, JVMFlagOrigin origin) { // range of acceptable characters spelled out for portability reasons @@ -1063,11 +991,6 @@ bool Arguments::parse_argument(const char* arg, JVMFlagOrigin origin) { bool warn_if_deprecated = true; if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { - AliasedLoggingFlag alf = catch_logging_aliases(name, false); - if (alf.alias_name != NULL){ - LogConfiguration::configure_stdout(LogLevel::Off, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5); - return true; - } real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); if (real_name == NULL) { return false; @@ -1076,11 +999,6 @@ bool Arguments::parse_argument(const char* arg, JVMFlagOrigin origin) { return set_bool_flag(flag, false, origin); } if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) { - AliasedLoggingFlag alf = catch_logging_aliases(name, true); - if (alf.alias_name != NULL){ - LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5); - return true; - } real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); if (real_name == NULL) { return false; @@ -1094,11 +1012,6 @@ bool Arguments::parse_argument(const char* arg, JVMFlagOrigin origin) { const char* value = strchr(arg, '=') + 1; // this scanf pattern matches both strings (handled here) and numbers (handled later)) - AliasedLoggingFlag alf = catch_logging_aliases(name, true); - if (alf.alias_name != NULL) { - LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5); - return true; - } real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); if (real_name == NULL) { return false; @@ -1297,17 +1210,6 @@ bool Arguments::process_argument(const char* arg, warning("Ignoring option %s; support was removed in %s", stripped_argname, version); return true; } -#ifndef PRODUCT - else { - const char* replacement; - if ((replacement = removed_develop_logging_flag_name(stripped_argname)) != NULL){ - log_warning(arguments)("%s has been removed. Please use %s instead.", - stripped_argname, - replacement); - return false; - } - } -#endif //PRODUCT } // For locked flags, report a custom error message if available. diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index 7bb0c27453247..c0b874ac18c65 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -226,19 +226,6 @@ class AgentLibraryList { // Helper class for controlling the lifetime of JavaVMInitArgs objects. class ScopedVMInitArgs; -// Most logging functions require 5 tags. Some of them may be _NO_TAG. -typedef struct { - const char* alias_name; - LogLevelType level; - bool exactMatch; - LogTagType tag0; - LogTagType tag1; - LogTagType tag2; - LogTagType tag3; - LogTagType tag4; - LogTagType tag5; -} AliasedLoggingFlag; - class Arguments : AllStatic { friend class VMStructs; friend class JvmtiExport; @@ -460,10 +447,6 @@ class Arguments : AllStatic { // the version number when the flag became obsolete. static bool is_obsolete_flag(const char* flag_name, JDK_Version* version); -#ifndef PRODUCT - static const char* removed_develop_logging_flag_name(const char* name); -#endif // PRODUCT - // Returns 1 if the flag is deprecated (and not yet obsolete or expired). // In this case the 'version' buffer is filled in with the version number when // the flag became deprecated. @@ -477,7 +460,6 @@ class Arguments : AllStatic { // Return the "real" name for option arg if arg is an alias, and print a warning if arg is deprecated. // Return NULL if the arg has expired. static const char* handle_aliases_and_deprecation(const char* arg, bool warn); - static AliasedLoggingFlag catch_logging_aliases(const char* name, bool on); static char* SharedArchivePath; static char* SharedDynamicArchivePath; diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index fc2fd82733311..2814742768093 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -955,9 +955,6 @@ const intx ObjectAlignmentInBytes = 8; \ /* JVMTI heap profiling */ \ \ - product(bool, TraceJVMTIObjectTagging, false, DIAGNOSTIC, \ - "Trace JVMTI object tagging calls") \ - \ product(bool, VerifyBeforeIteration, false, DIAGNOSTIC, \ "Verify memory system before JVMTI iteration") \ \ diff --git a/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java b/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java index 14a447452d7f2..5a363114882ab 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java @@ -24,7 +24,7 @@ /* * @test * @bug 8048933 - * @summary TraceExceptions output should have the exception message - useful for ClassNotFoundExceptions especially + * @summary -Xlog:exceptions=info output should have the exception message - useful for ClassNotFoundExceptions especially * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/cds/appcds/ClassPathAttr.java b/test/hotspot/jtreg/runtime/cds/appcds/ClassPathAttr.java index bf9bb5bb274db..5a3bb39b8b968 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/ClassPathAttr.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/ClassPathAttr.java @@ -85,16 +85,6 @@ static void testNormalOps() throws Exception { output.shouldMatch("checking shared classpath entry: .*cpattr2.jar"); output.shouldMatch("checking shared classpath entry: .*cpattr3.jar"); }); - - // Make sure aliased TraceClassPaths still works - TestCommon.run( - "-XX:+TraceClassPaths", - "-cp", cp, - "CpAttr1") - .assertNormalExit(output -> { - output.shouldMatch("checking shared classpath entry: .*cpattr2.jar"); - output.shouldMatch("checking shared classpath entry: .*cpattr3.jar"); - }); } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/IgnoreEmptyClassPaths.java b/test/hotspot/jtreg/runtime/cds/appcds/IgnoreEmptyClassPaths.java index daa4e7e162737..97b5a26755bb4 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/IgnoreEmptyClassPaths.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/IgnoreEmptyClassPaths.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020, 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 @@ -46,13 +46,13 @@ public static void main(String[] args) throws Exception { String cp_exec = sep + jar1 + sep + sep + jar2 + sep; TestCommon.testDump(cp_dump, TestCommon.list("Hello", "HelloMore"), - "-XX:+TraceClassPaths", "-XX:+IgnoreEmptyClassPaths"); + "-Xlog:class+path=info", "-XX:+IgnoreEmptyClassPaths"); TestCommon.run( "-verbose:class", "-cp", cp_exec, "-XX:+IgnoreEmptyClassPaths", // should affect classpath even if placed after the "-cp" argument - "-XX:+TraceClassPaths", + "-Xlog:class+path=info", "HelloMore") .assertNormalExit(); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java index a9499866ebcb2..e4a16bb6f21ae 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java @@ -73,7 +73,7 @@ public static void main(String[] args) throws Throwable { TestCommon.run( "-cp", appJar, "-Xmx32m", - "-XX:+PrintSharedSpaces", + "-Xlog:cds=info", "-XX:+UnlockDiagnosticVMOptions", extraOption, gcLog, Hello.class.getName()) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java index beda2edd79396..465f5d196fd6c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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 static void main(String[] args) throws Throwable { extraArg, "-Xlog:cds=info,class+path=info", "-Xmx32m", - "-XX:+PrintSharedSpaces", + "-Xlog:cds=info", "-XX:+UnlockDiagnosticVMOptions", extraOption, "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java index f87534dae21c8..94601b6bcf3b8 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java @@ -75,7 +75,7 @@ public static void main(String[] args) throws Throwable { "-cp", appJar, "-verbose", "-Xmx64m", - "-XX:+PrintSharedSpaces", + "-Xlog:cds=info", "-XX:+UnlockDiagnosticVMOptions", extraOption, gcLog, Hello.class.getName()) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/classpathtests/BootAppendTests.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/classpathtests/BootAppendTests.java index a367bcffb03c7..2a037ce1a916b 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/classpathtests/BootAppendTests.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/classpathtests/BootAppendTests.java @@ -189,7 +189,7 @@ public static void testBootAppendClassWithAppCDS() throws Exception { OutputAnalyzer output = TestCommon.exec( appJar, "-Xbootclasspath/a:" + bootAppendJar, - "-XX:+TraceClassLoading", + "-Xlog:class+load=info", MAIN_CLASS, "Test #6", BOOT_APPEND_CLASS, "true", "BOOT"); TestCommon.checkExec(output); diff --git a/test/hotspot/jtreg/runtime/logging/BiasedLockingTest.java b/test/hotspot/jtreg/runtime/logging/BiasedLockingTest.java index a0605d0ff4f77..df4486efbf77b 100644 --- a/test/hotspot/jtreg/runtime/logging/BiasedLockingTest.java +++ b/test/hotspot/jtreg/runtime/logging/BiasedLockingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -54,23 +54,11 @@ public static void main(String[] args) throws Exception { InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseBiasedLocking", - "-XX:+TraceBiasedLocking", - "-XX:BiasedLockingStartupDelay=0", - InnerClass.class.getName()); - analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseBiasedLocking", "-Xlog:biasedlocking=off", "-XX:BiasedLockingStartupDelay=0", InnerClass.class.getName()); analyzeOutputOff(pb); - - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseBiasedLocking", - "-XX:-TraceBiasedLocking", - "-XX:BiasedLockingStartupDelay=0", - InnerClass.class.getName()); - analyzeOutputOff(pb); } public static class InnerClass { diff --git a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java index 06e8171e0a75e..1ccda83101b19 100644 --- a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java +++ b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -90,14 +90,6 @@ public static void main(String... args) throws Exception { pb = exec("-Xlog:class+unload=off"); checkAbsent("[class,unload]"); - // -XX:+TraceClassUnloading - pb = exec("-XX:+TraceClassUnloading"); - checkFor("[class,unload]", "unloading class"); - - // -XX:-TraceClassUnloading - pb = exec("-XX:-TraceClassUnloading"); - checkAbsent("[class,unload]"); - // -Xlog:class+load=info pb = exec("-Xlog:class+load=info"); checkFor("[class,load]", "java.lang.Object", "source:"); @@ -110,14 +102,6 @@ public static void main(String... args) throws Exception { pb = exec("-Xlog:class+load=off"); checkAbsent("[class,load]"); - // -XX:+TraceClassLoading - pb = exec("-XX:+TraceClassLoading"); - checkFor("[class,load]", "java.lang.Object", "source:"); - - // -XX:-TraceClassLoading - pb = exec("-XX:-TraceClassLoading"); - checkAbsent("[class,load]"); - // -verbose:class pb = exec("-verbose:class"); checkFor("[class,load]", "java.lang.Object", "source:"); diff --git a/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java b/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java index 32f43b1333784..18b74e2635399 100644 --- a/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java +++ b/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -71,20 +71,6 @@ public static void main(String... args) throws Exception { ClassResolutionTestMain.class.getName()); o = new OutputAnalyzer(pb.start()); o.shouldNotContain("[class,resolve]"); - - // (3) TraceClassResolution should turn on. - pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceClassResolution", - ClassResolutionTestMain.class.getName()); - o = new OutputAnalyzer(pb.start()); - o.shouldContain("[class,resolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); - - // (4) TraceClassResolution should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", - "-XX:-TraceClassResolution", - ClassResolutionTestMain.class.getName()); - o = new OutputAnalyzer(pb.start()); - o.shouldNotContain("[class,resolve]"); - }; } diff --git a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java index db2cf0a5bdb8f..ab61fb8b7c3af 100644 --- a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java +++ b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -60,24 +60,16 @@ public static void main(String[] args) throws Exception { InternalClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceExceptions", - InternalClass.class.getName()); - analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=off", InternalClass.class.getName()); analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions", - InternalClass.class.getName()); - analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName()); - updateEnvironment(pb, "_JAVA_OPTIONS", "-XX:+TraceExceptions"); + updateEnvironment(pb, "_JAVA_OPTIONS", "-Xlog:exceptions=info"); analyzeOutputOn(pb); pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName()); - updateEnvironment(pb, "JAVA_TOOL_OPTIONS", "-Xlog:exceptions=info -XX:-TraceExceptions"); + updateEnvironment(pb, "JAVA_TOOL_OPTIONS", "-Xlog:exceptions=info -Xlog:exceptions=off"); analyzeOutputOff(pb); pb = ProcessTools.createJavaProcessBuilder("-XX:VMOptionsFile=" + System.getProperty("test.src", ".") diff --git a/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file b/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file index b5f0532f96cc4..d3e8be7f85752 100644 --- a/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file +++ b/test/hotspot/jtreg/runtime/logging/ExceptionsTest_options_file @@ -1 +1 @@ --XX:+TraceExceptions +-Xlog:exceptions=info diff --git a/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java b/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java index b2b56b4238b9e..cf37a49f43aa2 100644 --- a/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java +++ b/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -63,22 +63,11 @@ static ProcessBuilder exec(String... args) throws Exception { public static void main(String... args) throws Exception { - // -XX:+TraceLoaderConstraints - pb = exec("-XX:+TraceLoaderConstraints"); - out = new OutputAnalyzer(pb.start()); - out.getOutput(); - out.shouldContain("[class,loader,constraints] adding new constraint for name: java/lang/Class, loader[0]: 'app', loader[1]: 'bootstrap'"); - // -Xlog:class+loader+constraints=info pb = exec("-Xlog:class+loader+constraints=info"); out = new OutputAnalyzer(pb.start()); out.shouldContain("[class,loader,constraints] adding new constraint for name: java/lang/Class, loader[0]: 'app', loader[1]: 'bootstrap'"); - // -XX:-TraceLoaderConstraints - pb = exec("-XX:-TraceLoaderConstraints"); - out = new OutputAnalyzer(pb.start()); - out.shouldNotContain("[class,loaderconstraints]"); - // -Xlog:class+loader+constraints=off pb = exec("-Xlog:class+loader+constraints=off"); out = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java b/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java index 1be25bd9a9b73..568055617f9c6 100644 --- a/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java +++ b/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -54,17 +54,9 @@ public static void main(String[] args) throws Exception { InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceMonitorInflation", - InnerClass.class.getName()); - analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:monitorinflation=off", InnerClass.class.getName()); analyzeOutputOff(pb); - - pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceMonitorInflation", - InnerClass.class.getName()); - analyzeOutputOff(pb); } public static class Waiter { diff --git a/test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java b/test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java deleted file mode 100644 index 9c9ce86b7cd72..0000000000000 --- a/test/hotspot/jtreg/runtime/logging/RemovedDevelopFlagsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2016, 2020, 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 RemovedDevelopFlagsTest - * @bug 8146632 - * @modules java.base/jdk.internal.misc - * @requires vm.debug - * @library /test/lib - * @run driver RemovedDevelopFlagsTest - */ -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; - -public class RemovedDevelopFlagsTest { - public static ProcessBuilder pb; - - public static class RemovedDevelopFlagsTestMain { - public static void main(String... args) { - System.out.print("Hello!"); - } - } - - public static void exec(String flag, String value) throws Exception { - pb = ProcessTools.createJavaProcessBuilder("-XX:+"+flag, RemovedDevelopFlagsTestMain.class.getName()); - OutputAnalyzer o = new OutputAnalyzer(pb.start()); - o.shouldContain(flag+" has been removed. Please use "+value+" instead."); - o.shouldHaveExitValue(1); - } - - public static void main(String... args) throws Exception { - exec("TraceClassInitialization", "-Xlog:class+init"); - exec("TraceClassLoaderData", "-Xlog:class+loader+data"); - exec("TraceDefaultMethods", "-Xlog:defaultmethods=debug"); - exec("TraceItables", "-Xlog:itables=debug"); - exec("TraceSafepoint", "-Xlog:safepoint=debug"); - exec("TraceStartupTime", "-Xlog:startuptime"); - exec("TraceVMOperation", "-Xlog:vmoperation=debug"); - exec("PrintVtables", "-Xlog:vtables=debug"); - exec("VerboseVerification", "-Xlog:verification"); - } -} diff --git a/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java b/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java index 5c445dc4f1c56..9136953a5e980 100644 --- a/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java +++ b/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java @@ -55,17 +55,9 @@ public static void main(String[] args) throws Exception { InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceSafepointCleanupTime", - InnerClass.class.getName()); - analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=off", InnerClass.class.getName()); analyzeOutputOff(pb); - - pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceSafepointCleanupTime", - InnerClass.class.getName()); - analyzeOutputOff(pb); } public static class InnerClass { diff --git a/test/jdk/com/sun/jdi/cds/CDSJDITest.java b/test/jdk/com/sun/jdi/cds/CDSJDITest.java index f55c55373d017..e10c61d748c05 100644 --- a/test/jdk/com/sun/jdi/cds/CDSJDITest.java +++ b/test/jdk/com/sun/jdi/cds/CDSJDITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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 @@ -61,7 +61,7 @@ public static void runTest(String testname, String[] jarClasses) throws Exceptio // pass them as JVM arguments to the debuggee process it creates. "-Xbootclasspath/a:" + appJar, "-XX:+UnlockDiagnosticVMOptions", - "-XX:+TraceClassPaths", + "-Xlog:class+path=info", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-Xshare:on", "-showversion" From 129c37700ff1ab6f2b9540422f93689970b5e9a0 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 3 Dec 2020 13:42:19 +0000 Subject: [PATCH 042/504] 8257594: C2 compiled checkcast of non-null object triggers endless deoptimization/recompilation cycle Reviewed-by: roland, vlivanov --- src/hotspot/share/opto/graphKit.cpp | 8 +- src/hotspot/share/opto/parse2.cpp | 3 + src/hotspot/share/opto/parseHelper.cpp | 5 +- .../TestNullAssertAtCheckCast.java | 119 ++++++++++++++++++ 4 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/uncommontrap/TestNullAssertAtCheckCast.java diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index 166933525a1a3..dc5c19fa6b3dd 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -3311,7 +3311,13 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass, case Compile::SSC_always_false: // It needs a null check because a null will *pass* the cast check. // A non-null value will always produce an exception. - return null_assert(obj); + if (!objtp->maybe_null()) { + builtin_throw(Deoptimization::Reason_class_check, makecon(TypeKlassPtr::make(objtp->klass()))); + return top(); + } else if (!too_many_traps_or_recompiles(Deoptimization::Reason_null_assert)) { + return null_assert(obj); + } + break; // Fall through to full check } } } diff --git a/src/hotspot/share/opto/parse2.cpp b/src/hotspot/share/opto/parse2.cpp index 6f2ae1af88a6d..c006de2ae5acb 100644 --- a/src/hotspot/share/opto/parse2.cpp +++ b/src/hotspot/share/opto/parse2.cpp @@ -83,6 +83,9 @@ void Parse::array_store(BasicType bt) { if (stopped()) return; // guaranteed null or range check if (bt == T_OBJECT) { array_store_check(); + if (stopped()) { + return; + } } Node* val; // Oop to store if (big_val) { diff --git a/src/hotspot/share/opto/parseHelper.cpp b/src/hotspot/share/opto/parseHelper.cpp index c885f7806b18a..fbcb0713555ab 100644 --- a/src/hotspot/share/opto/parseHelper.cpp +++ b/src/hotspot/share/opto/parseHelper.cpp @@ -89,7 +89,10 @@ void Parse::do_checkcast() { return; } - Node *res = gen_checkcast(obj, makecon(TypeKlassPtr::make(klass)) ); + Node* res = gen_checkcast(obj, makecon(TypeKlassPtr::make(klass))); + if (stopped()) { + return; + } // Pop from stack AFTER gen_checkcast because it can uncommon trap and // the debug info has to be correct. diff --git a/test/hotspot/jtreg/compiler/uncommontrap/TestNullAssertAtCheckCast.java b/test/hotspot/jtreg/compiler/uncommontrap/TestNullAssertAtCheckCast.java new file mode 100644 index 0000000000000..7b69f3411b19a --- /dev/null +++ b/test/hotspot/jtreg/compiler/uncommontrap/TestNullAssertAtCheckCast.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2020, 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 8257594 + * @summary Test that failing checkcast does not trigger repeated recompilation until cutoff is hit. + * @requires vm.compiler2.enabled + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Xbatch -XX:CompileCommand=dontinline,compiler.uncommontrap.TestNullAssertAtCheckCast::test* + * -XX:CompileCommand=inline,compiler.uncommontrap.TestNullAssertAtCheckCast::cast + * -XX:CompileCommand=inline,compiler.uncommontrap.TestNullAssertAtCheckCast::store + * compiler.uncommontrap.TestNullAssertAtCheckCast + */ + +package compiler.uncommontrap; + +import sun.hotspot.WhiteBox; + +import java.lang.reflect.Method; + +public class TestNullAssertAtCheckCast { + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static final int COMP_LEVEL_FULL_OPTIMIZATION = 4; + + static Long cast(Object val) { + return (Long)val; + } + + static void test1() { + try { + // Always fails + cast(new Integer(42)); + } catch (ClassCastException cce) { + // Ignored + } + } + + static void test2(Integer val) { + try { + // Always fails + cast(val); + } catch (ClassCastException cce) { + // Ignored + } + } + + static void store(Object[] array, Object val) { + array[0] = val; + } + + static void test3() { + try { + // Always fails + store(new Long[1], new Integer(42)); + } catch (ArrayStoreException cce) { + // Ignored + } + } + + static void test4(Integer val) { + try { + // Always fails + store(new Long[1], val); + } catch (ArrayStoreException cce) { + // Ignored + } + } + + public static void main(String[] args) throws Exception { + for (int i = 0; i < 1_000_000; ++i) { + test1(); + test2((i % 2 == 0) ? null : 42); + test3(); + test4((i % 2 == 0) ? null : 42); + } + Method method = TestNullAssertAtCheckCast.class.getDeclaredMethod("test1"); + if (!WB.isMethodCompilable(method, COMP_LEVEL_FULL_OPTIMIZATION, false)) { + throw new RuntimeException("TestNullAssertAtCheckCast::test1 not compilable"); + } + method = TestNullAssertAtCheckCast.class.getDeclaredMethod("test2", Integer.class); + if (!WB.isMethodCompilable(method, COMP_LEVEL_FULL_OPTIMIZATION, false)) { + throw new RuntimeException("TestNullAssertAtCheckCast::test2 not compilable"); + } + method = TestNullAssertAtCheckCast.class.getDeclaredMethod("test3"); + if (!WB.isMethodCompilable(method, COMP_LEVEL_FULL_OPTIMIZATION, false)) { + throw new RuntimeException("TestNullAssertAtCheckCast::test3 not compilable"); + } + method = TestNullAssertAtCheckCast.class.getDeclaredMethod("test4", Integer.class); + if (!WB.isMethodCompilable(method, COMP_LEVEL_FULL_OPTIMIZATION, false)) { + throw new RuntimeException("TestNullAssertAtCheckCast::test4 not compilable"); + } + } +} + From fa58671f9f8a8230d907c0a6289685f8455bce1f Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Thu, 3 Dec 2020 13:42:50 +0000 Subject: [PATCH 043/504] 8257020: [JVMCI] enable a JVMCICompiler to specify which GCs it supports Reviewed-by: stefank, kvn --- .../share/compiler/compilerDefinitions.cpp | 2 +- src/hotspot/share/jvmci/jvmciEnv.cpp | 25 +++++++++ src/hotspot/share/jvmci/jvmciEnv.hpp | 2 + src/hotspot/share/jvmci/jvmciJavaClasses.hpp | 1 + src/hotspot/share/jvmci/jvmciRuntime.cpp | 9 +++ src/hotspot/share/jvmci/jvmciRuntime.hpp | 4 ++ src/hotspot/share/jvmci/jvmci_globals.cpp | 8 ++- src/hotspot/share/jvmci/jvmci_globals.hpp | 5 +- src/hotspot/share/jvmci/vmStructs_jvmci.cpp | 8 +++ src/hotspot/share/jvmci/vmSymbols_jvmci.hpp | 1 + src/hotspot/share/logging/logTag.hpp | 1 + src/hotspot/share/prims/whitebox.cpp | 24 ++++++++ .../hotspot/HotSpotJVMCICompilerConfig.java | 5 ++ .../vm/ci/hotspot/HotSpotJVMCIRuntime.java | 11 ++++ .../src/jdk/vm/ci/runtime/JVMCICompiler.java | 11 ++++ .../hotspot/HotSpotGraalCompiler.java | 10 ++++ .../compiler/hotspot/HotSpotGraalRuntime.java | 55 +++++++++++++++---- test/jtreg-ext/requires/VMProps.java | 33 ++--------- test/lib/sun/hotspot/WhiteBox.java | 2 + test/lib/sun/hotspot/code/Compiler.java | 14 +++++ test/lib/sun/hotspot/gc/GC.java | 7 +++ 21 files changed, 197 insertions(+), 41 deletions(-) diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index dc8c726ce3605..c12ca9a466cd9 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -457,7 +457,7 @@ void CompilerConfig::ergo_initialize() { #endif #if INCLUDE_JVMCI - // Check that JVMCI compiler supports selested GC. + // Check that JVMCI supports selected GC. // Should be done after GCConfig::initialize() was called. JVMCIGlobals::check_jvmci_supported_gc(); diff --git a/src/hotspot/share/jvmci/jvmciEnv.cpp b/src/hotspot/share/jvmci/jvmciEnv.cpp index daa4b8ad4cf4b..73afe41e90313 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.cpp +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp @@ -635,6 +635,31 @@ void JVMCIEnv::fthrow_error(const char* file, int line, const char* format, ...) } } +jboolean JVMCIEnv::call_HotSpotJVMCIRuntime_isGCSupported (JVMCIObject runtime, jint gcIdentifier) { + JavaThread* THREAD = JavaThread::current(); + if (is_hotspot()) { + JavaCallArguments jargs; + jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(runtime))); + jargs.push_int(gcIdentifier); + JavaValue result(T_BOOLEAN); + JavaCalls::call_special(&result, + HotSpotJVMCI::HotSpotJVMCIRuntime::klass(), + vmSymbols::isGCSupported_name(), + vmSymbols::int_bool_signature(), &jargs, CHECK_0); + return result.get_jboolean(); + } else { + JNIAccessMark jni(this, THREAD); + jboolean result = jni()->CallNonvirtualBooleanMethod(runtime.as_jobject(), + JNIJVMCI::HotSpotJVMCIRuntime::clazz(), + JNIJVMCI::HotSpotJVMCIRuntime::isGCSupported_method(), + gcIdentifier); + if (jni()->ExceptionCheck()) { + return false; + } + return result; + } +} + JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_compileMethod (JVMCIObject runtime, JVMCIObject method, int entry_bci, jlong compile_state, int id) { JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); diff --git a/src/hotspot/share/jvmci/jvmciEnv.hpp b/src/hotspot/share/jvmci/jvmciEnv.hpp index e59a3bde6e037..3f5658a19ada0 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.hpp +++ b/src/hotspot/share/jvmci/jvmciEnv.hpp @@ -310,6 +310,8 @@ class JVMCIEnv : public ResourceObj { JVMCIObject call_JavaConstant_forFloat(float value, JVMCI_TRAPS); JVMCIObject call_JavaConstant_forDouble(double value, JVMCI_TRAPS); + jboolean call_HotSpotJVMCIRuntime_isGCSupported(JVMCIObject runtime, jint gcIdentifier); + BasicType kindToBasicType(JVMCIObject kind, JVMCI_TRAPS); #define DO_THROW(name) \ diff --git a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp index 7e981d5738a45..25d0a109e7e64 100644 --- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp +++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp @@ -348,6 +348,7 @@ start_class(HotSpotJVMCIRuntime, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime) \ objectarray_field(HotSpotJVMCIRuntime, excludeFromJVMCICompilation, "[Ljava/lang/Module;") \ jvmci_method(CallNonvirtualObjectMethod, GetMethodID, call_special, JVMCIObject, HotSpotJVMCIRuntime, compileMethod, compileMethod_signature, (JVMCIObject runtime, JVMCIObject method, int entry_bci, jlong env, int id)) \ + jvmci_method(CallNonvirtualObjectMethod, GetMethodID, call_special, JVMCIObject, HotSpotJVMCIRuntime, isGCSupported, int_bool_signature, (JVMCIObject runtime, int gcIdentifier)) \ jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, encodeThrowable, encodeThrowable_signature, (JVMCIObject throwable)) \ jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, decodeThrowable, decodeThrowable_signature, (JVMCIObject encodedThrowable)) \ jvmci_method(CallNonvirtualVoidMethod, GetMethodID, call_special, void, HotSpotJVMCIRuntime, bootstrapFinished, void_method_signature, (JVMCIObject runtime, JVMCI_TRAPS)) \ diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index c7ed875f85444..4cd91108f4849 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1516,6 +1516,15 @@ void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, c } } +bool JVMCIRuntime::is_gc_supported(JVMCIEnv* JVMCIENV, CollectedHeap::Name name) { + JVMCI_EXCEPTION_CONTEXT + + JVMCIObject receiver = get_HotSpotJVMCIRuntime(JVMCIENV); + if (JVMCIENV->has_pending_exception()) { + fatal_exception(JVMCIENV, "Exception during HotSpotJVMCIRuntime initialization"); + } + return JVMCIENV->call_HotSpotJVMCIRuntime_isGCSupported(receiver, (int) name); +} // ------------------------------------------------------------------ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV, diff --git a/src/hotspot/share/jvmci/jvmciRuntime.hpp b/src/hotspot/share/jvmci/jvmciRuntime.hpp index 0fb677c2d0160..2f475f9e4470c 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.hpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp @@ -25,6 +25,7 @@ #define SHARE_JVMCI_JVMCIRUNTIME_HPP #include "code/nmethod.hpp" +#include "gc/shared/collectedHeap.hpp" #include "jvmci/jvmci.hpp" #include "jvmci/jvmciExceptions.hpp" #include "jvmci/jvmciObject.hpp" @@ -279,6 +280,9 @@ class JVMCIRuntime: public CHeapObj { // Compiles `target` with the JVMCI compiler. void compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& target, int entry_bci); + // Determines if the GC identified by `name` is supported by the JVMCI compiler. + bool is_gc_supported(JVMCIEnv* JVMCIENV, CollectedHeap::Name name); + // Register the result of a compilation. JVMCI::CodeInstallResult register_method(JVMCIEnv* JVMCIENV, const methodHandle& target, diff --git a/src/hotspot/share/jvmci/jvmci_globals.cpp b/src/hotspot/share/jvmci/jvmci_globals.cpp index bbf3ec67b1b09..4d9dbc3005b7b 100644 --- a/src/hotspot/share/jvmci/jvmci_globals.cpp +++ b/src/hotspot/share/jvmci/jvmci_globals.cpp @@ -200,11 +200,15 @@ bool JVMCIGlobals::enable_jvmci_product_mode(JVMFlagOrigin origin) { return true; } +bool JVMCIGlobals::gc_supports_jvmci() { + return UseSerialGC || UseParallelGC || UseG1GC; +} + void JVMCIGlobals::check_jvmci_supported_gc() { if (EnableJVMCI) { // Check if selected GC is supported by JVMCI and Java compiler - if (!(UseSerialGC || UseParallelGC || UseG1GC)) { - vm_exit_during_initialization("JVMCI Compiler does not support selected GC", GCConfig::hs_err_name()); + if (!gc_supports_jvmci()) { + log_warning(gc, jvmci)("Setting EnableJVMCI to false as selected GC does not support JVMCI: %s", GCConfig::hs_err_name()); FLAG_SET_DEFAULT(EnableJVMCI, false); FLAG_SET_DEFAULT(UseJVMCICompiler, false); } diff --git a/src/hotspot/share/jvmci/jvmci_globals.hpp b/src/hotspot/share/jvmci/jvmci_globals.hpp index 5009b17db6234..57d40b5fabd09 100644 --- a/src/hotspot/share/jvmci/jvmci_globals.hpp +++ b/src/hotspot/share/jvmci/jvmci_globals.hpp @@ -155,7 +155,10 @@ class JVMCIGlobals { // Convert JVMCI experimental flags to product static bool enable_jvmci_product_mode(JVMFlagOrigin); - // Check and exit VM with error if selected GC is not supported by JVMCI. + // Returns true iff the GC fully supports JVMCI. + static bool gc_supports_jvmci(); + + // Check and turn off EnableJVMCI if selected GC does not support JVMCI. static void check_jvmci_supported_gc(); static fileStream* get_jni_config_file() { return _jni_config_file; } diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index ccc611ca07b4b..8b8d3061d573a 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -482,6 +482,14 @@ declare_constant(CodeInstaller::VERIFY_OOP_MASK) \ declare_constant(CodeInstaller::INVOKE_INVALID) \ \ + declare_constant(CollectedHeap::None) \ + declare_constant(CollectedHeap::Serial) \ + declare_constant(CollectedHeap::Parallel) \ + declare_constant(CollectedHeap::G1) \ + declare_constant(CollectedHeap::Epsilon) \ + declare_constant(CollectedHeap::Z) \ + declare_constant(CollectedHeap::Shenandoah) \ + \ declare_constant(vmIntrinsics::FIRST_MH_SIG_POLY) \ declare_constant(vmIntrinsics::LAST_MH_SIG_POLY) \ declare_constant(vmIntrinsics::_invokeGeneric) \ diff --git a/src/hotspot/share/jvmci/vmSymbols_jvmci.hpp b/src/hotspot/share/jvmci/vmSymbols_jvmci.hpp index 4d0b167bb433d..801c1cdd2b171 100644 --- a/src/hotspot/share/jvmci/vmSymbols_jvmci.hpp +++ b/src/hotspot/share/jvmci/vmSymbols_jvmci.hpp @@ -103,6 +103,7 @@ template(visitFrame_signature, "(Ljdk/vm/ci/code/stack/InspectedFrame;)Ljava/lang/Object;") \ template(compileMethod_name, "compileMethod") \ template(compileMethod_signature, "(Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;IJI)Ljdk/vm/ci/hotspot/HotSpotCompilationRequestResult;") \ + template(isGCSupported_name, "isGCSupported") \ template(encodeThrowable_name, "encodeThrowable") \ template(encodeThrowable_signature, "(Ljava/lang/Throwable;)Ljava/lang/String;") \ template(decodeThrowable_name, "decodeThrowable") \ diff --git a/src/hotspot/share/logging/logTag.hpp b/src/hotspot/share/logging/logTag.hpp index fea94d89d2d37..d558159ddb77d 100644 --- a/src/hotspot/share/logging/logTag.hpp +++ b/src/hotspot/share/logging/logTag.hpp @@ -94,6 +94,7 @@ LOG_TAG(jfr) \ LOG_TAG(jit) \ LOG_TAG(jni) \ + LOG_TAG(jvmci) \ LOG_TAG(jvmti) \ LOG_TAG(lambda) \ LOG_TAG(library) \ diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 9640c9e04a7f5..ffcddade86cc0 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -108,6 +108,10 @@ #include "services/memTracker.hpp" #include "utilities/nativeCallStack.hpp" #endif // INCLUDE_NMT +#if INCLUDE_JVMCI +#include "jvmci/jvmciEnv.hpp" +#include "jvmci/jvmciRuntime.hpp" +#endif #if INCLUDE_AOT #include "aot/aotLoader.hpp" #endif // INCLUDE_AOT @@ -354,6 +358,16 @@ WB_ENTRY(jboolean, WB_IsGCSupported(JNIEnv* env, jobject o, jint name)) return GCConfig::is_gc_supported((CollectedHeap::Name)name); WB_END +WB_ENTRY(jboolean, WB_IsGCSupportedByJVMCICompiler(JNIEnv* env, jobject o, jint name)) +#if INCLUDE_JVMCI + if (EnableJVMCI) { + JVMCIEnv jvmciEnv(thread, env, __FILE__, __LINE__); + return jvmciEnv.runtime()->is_gc_supported(&jvmciEnv, (CollectedHeap::Name)name); + } +#endif + return false; +WB_END + WB_ENTRY(jboolean, WB_IsGCSelected(JNIEnv* env, jobject o, jint name)) return GCConfig::is_gc_selected((CollectedHeap::Name)name); WB_END @@ -1945,6 +1959,14 @@ WB_ENTRY(jboolean, WB_isC2OrJVMCIIncludedInVmBuild(JNIEnv* env)) #endif WB_END +WB_ENTRY(jboolean, WB_IsJVMCISupportedByGC(JNIEnv* env)) +#if INCLUDE_JVMCI + return JVMCIGlobals::gc_supports_jvmci(); +#else + return false; +#endif +WB_END + WB_ENTRY(jboolean, WB_IsJavaHeapArchiveSupported(JNIEnv* env)) return HeapShared::is_heap_object_archiving_allowed(); WB_END @@ -2508,6 +2530,7 @@ static JNINativeMethod methods[] = { {CC"isCDSIncludedInVmBuild", CC"()Z", (void*)&WB_IsCDSIncludedInVmBuild }, {CC"isJFRIncludedInVmBuild", CC"()Z", (void*)&WB_IsJFRIncludedInVmBuild }, {CC"isC2OrJVMCIIncludedInVmBuild", CC"()Z", (void*)&WB_isC2OrJVMCIIncludedInVmBuild }, + {CC"isJVMCISupportedByGC", CC"()Z", (void*)&WB_IsJVMCISupportedByGC}, {CC"isJavaHeapArchiveSupported", CC"()Z", (void*)&WB_IsJavaHeapArchiveSupported }, {CC"cdsMemoryMappingFailed", CC"()Z", (void*)&WB_CDSMemoryMappingFailed }, @@ -2520,6 +2543,7 @@ static JNINativeMethod methods[] = { (void*)&WB_AddCompilerDirective }, {CC"removeCompilerDirective", CC"(I)V", (void*)&WB_RemoveCompilerDirective }, {CC"isGCSupported", CC"(I)Z", (void*)&WB_IsGCSupported}, + {CC"isGCSupportedByJVMCICompiler", CC"(I)Z", (void*)&WB_IsGCSupportedByJVMCICompiler}, {CC"isGCSelected", CC"(I)Z", (void*)&WB_IsGCSelected}, {CC"isGCSelectedErgonomically", CC"()Z", (void*)&WB_IsGCSelectedErgonomically}, {CC"supportsConcurrentGCBreakpoints", CC"()Z", (void*)&WB_SupportsConcurrentGCBreakpoints}, diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java index 9bfb3050b6b99..c84fe09f2b5d4 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java @@ -69,6 +69,11 @@ public String getCompilerName() { public JVMCICompiler createCompiler(JVMCIRuntime rt) { return this; } + + @Override + public boolean isGCSupported(int gcIdentifier) { + return false; + } } /** diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java index 23ec67eb89ec2..442c93164ca5d 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java @@ -712,6 +712,11 @@ static class ErrorCreatingCompiler implements JVMCICompiler { public CompilationRequestResult compileMethod(CompilationRequest request) { throw t; } + + @Override + public boolean isGCSupported(int gcIdentifier) { + return false; + } } @Override @@ -814,6 +819,12 @@ private HotSpotCompilationRequestResult compileMethod(HotSpotResolvedJavaMethod return hsResult; } + @SuppressWarnings("try") + @VMEntryPoint + private boolean isGCSupported(int gcIdentifier) { + return getCompiler().isGCSupported(gcIdentifier); + } + /** * Guard to ensure shut down actions are performed at most once. */ diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java index 8aa5df1bf8c3c..bbb9c79e9f56a 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java @@ -33,4 +33,15 @@ public interface JVMCICompiler { * install it in the code cache if the compilation is successful. */ CompilationRequestResult compileMethod(CompilationRequest request); + + /** + * Determines if this compiler supports the {@code gcIdentifier} garbage collector. The default + * implementation of this method returns true as that is the effective answer given by a + * {@link JVMCICompiler} before this method was added. + * + * @param gcIdentifier a VM dependent GC identifier + */ + default boolean isGCSupported(int gcIdentifier) { + return true; + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java index f61528b37b05e..3c054bdd90504 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java @@ -43,6 +43,7 @@ import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.debug.DebugOptions; import org.graalvm.compiler.hotspot.CompilationCounters.Options; +import org.graalvm.compiler.hotspot.HotSpotGraalRuntime.HotSpotGC; import org.graalvm.compiler.hotspot.meta.HotSpotProviders; import org.graalvm.compiler.hotspot.phases.OnStackReplacementPhase; import org.graalvm.compiler.java.GraphBuilderPhase; @@ -323,4 +324,13 @@ public void formatTo(Formatter buf, int flags, int width, int precision) { } }; } + + @Override + public boolean isGCSupported(int gcIdentifier) { + HotSpotGC gc = HotSpotGC.forName(gcIdentifier, graalRuntime.getVMConfig()); + if (gc != null) { + return gc.supported; + } + return false; + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java index 3e1917b23d84c..d89ba75305748 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java @@ -247,38 +247,59 @@ public GlobalMetrics getMetricValues() { } /** - * Constants denoting the GC algorithms available in HotSpot. + * Constants denoting the GC algorithms available in HotSpot. The names of the constants match + * the constants in the {@code CollectedHeap::Name} C++ enum. */ public enum HotSpotGC { // Supported GCs - Serial(true, "UseSerialGC", true), - Parallel(true, "UseParallelGC", true, "UseParallelOldGC", JDK < 15, "UseParNewGC", JDK < 10), - CMS(true, "UseConcMarkSweepGC", JDK < 14), - G1(true, "UseG1GC", true), + Serial(true, JDK >= 11, "UseSerialGC", true), + Parallel(true, JDK >= 11, "UseParallelGC", true, "UseParallelOldGC", JDK < 15, "UseParNewGC", JDK < 10), + CMS(true, JDK >= 11 && JDK <= 14, "UseConcMarkSweepGC", JDK < 14), + G1(true, JDK >= 11, "UseG1GC", true), // Unsupported GCs - Epsilon(false, "UseEpsilonGC", JDK >= 11), - Z(false, "UseZGC", JDK >= 11); + Epsilon(false, JDK >= 11, "UseEpsilonGC", JDK >= 11), + Z(false, JDK >= 11, "UseZGC", JDK >= 11), + Shenandoah(false, JDK >= 12, "UseShenandoahGC", JDK >= 12); - HotSpotGC(boolean supported, + HotSpotGC(boolean supported, boolean expectNamePresent, String flag1, boolean expectFlagPresent1, String flag2, boolean expectFlagPresent2, String flag3, boolean expectFlagPresent3) { this.supported = supported; + this.expectNamePresent = expectNamePresent; this.expectFlagsPresent = new boolean[]{expectFlagPresent1, expectFlagPresent2, expectFlagPresent3}; this.flags = new String[]{flag1, flag2, flag3}; } - HotSpotGC(boolean supported, String flag, boolean expectFlagPresent) { + HotSpotGC(boolean supported, boolean expectNamePresent, String flag, boolean expectFlagPresent) { this.supported = supported; + this.expectNamePresent = expectNamePresent; this.expectFlagsPresent = new boolean[]{expectFlagPresent}; this.flags = new String[]{flag}; } + /** + * Specifies if this GC supported by Graal. + */ final boolean supported; - final boolean[] expectFlagsPresent; + + /** + * Specifies if {@link #name()} is expected to be present in the {@code CollectedHeap::Name} + * C++ enum. + */ + final boolean expectNamePresent; + + /** + * The VM flags that will select this GC. + */ private final String[] flags; + /** + * Specifies which {@link #flags} are expected to be present in the VM. + */ + final boolean[] expectFlagsPresent; + public boolean isSelected(GraalHotSpotVMConfig config) { boolean selected = false; for (int i = 0; i < flags.length; i++) { @@ -293,6 +314,20 @@ public boolean isSelected(GraalHotSpotVMConfig config) { } return selected; } + + /** + * Gets the GC matching {@code name}. + * + * @param name the ordinal of a {@code CollectedHeap::Name} value + */ + static HotSpotGC forName(int name, GraalHotSpotVMConfig config) { + for (HotSpotGC gc : HotSpotGC.values()) { + if (config.getConstant("CollectedHeap::" + gc.name(), Integer.class, -1, gc.expectNamePresent) == name) { + return gc; + } + } + return null; + } } private HotSpotGC getSelectedGC() throws GraalError { diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 68a6f1e3f88ca..599bf969efbb6 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -239,18 +239,12 @@ protected String vmJvmci() { return "false"; } - switch (GC.selected()) { - case Serial: - case Parallel: - case G1: - // These GCs are supported with JVMCI - return "true"; - default: - break; + // Not all GCs have full JVMCI support + if (!WB.isJVMCISupportedByGC()) { + return "false"; } - // Every other GC is not supported - return "false"; + return "true"; } /** @@ -271,21 +265,6 @@ protected String cpuFeatures() { return CPUInfo.getFeatures().toString(); } - private boolean isGcSupportedByGraal(GC gc) { - switch (gc) { - case Serial: - case Parallel: - case G1: - return true; - case Epsilon: - case Z: - case Shenandoah: - return false; - default: - throw new IllegalStateException("Unknown GC " + gc.name()); - } - } - /** * For all existing GC sets vm.gc.X property. * Example vm.gc.G1=true means: @@ -296,11 +275,11 @@ private boolean isGcSupportedByGraal(GC gc) { * @param map - property-value pairs */ protected void vmGC(SafeMap map) { - var isGraalEnabled = Compiler.isGraalEnabled(); + var isJVMCIEnabled = Compiler.isJVMCIEnabled(); for (GC gc: GC.values()) { map.put("vm.gc." + gc.name(), () -> "" + (gc.isSupported() - && (!isGraalEnabled || isGcSupportedByGraal(gc)) + && (!isJVMCIEnabled || gc.isSupportedByJVMCICompiler()) && (gc.isSelected() || GC.isSelectedErgonomically()))); } } diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java index 0c6ffed0b4a7f..fc34a795300c7 100644 --- a/test/lib/sun/hotspot/WhiteBox.java +++ b/test/lib/sun/hotspot/WhiteBox.java @@ -232,6 +232,7 @@ public Object[] parseCommandLine(String commandline, char delim, Dia // Compiler public native boolean isC2OrJVMCIIncludedInVmBuild(); + public native boolean isJVMCISupportedByGC(); public native int matchesMethod(Executable method, String pattern); public native int matchesInline(Executable method, String pattern); @@ -415,6 +416,7 @@ public void clearInlineCaches(boolean preserve_static_stubs) { // Don't use these methods directly // Use sun.hotspot.gc.GC class instead. public native boolean isGCSupported(int name); + public native boolean isGCSupportedByJVMCICompiler(int name); public native boolean isGCSelected(int name); public native boolean isGCSelectedErgonomically(); diff --git a/test/lib/sun/hotspot/code/Compiler.java b/test/lib/sun/hotspot/code/Compiler.java index 3df802d462e55..99122bd93b8e9 100644 --- a/test/lib/sun/hotspot/code/Compiler.java +++ b/test/lib/sun/hotspot/code/Compiler.java @@ -43,6 +43,20 @@ public static boolean isC2OrJVMCIIncludedInVmBuild() { return WB.isC2OrJVMCIIncludedInVmBuild(); } + /** + * Check if JVMCI is enabled. + * + * @return true if JVMCI is enabled + */ + public static boolean isJVMCIEnabled() { + Boolean enableJvmci = WB.getBooleanVMFlag("EnableJVMCI"); + if (enableJvmci == null || !enableJvmci) { + return false; + } + + return true; + } + /** * Check if Graal is used as JIT compiler. * diff --git a/test/lib/sun/hotspot/gc/GC.java b/test/lib/sun/hotspot/gc/GC.java index 19fb51f26d180..99b33aa2ac08d 100644 --- a/test/lib/sun/hotspot/gc/GC.java +++ b/test/lib/sun/hotspot/gc/GC.java @@ -55,6 +55,13 @@ public boolean isSupported() { return WB.isGCSupported(name); } + /** + * @return true if this GC is supported by the JVMCI compiler + */ + public boolean isSupportedByJVMCICompiler() { + return WB.isGCSupportedByJVMCICompiler(name); + } + /** * @return true if this GC is currently selected/used */ From 66a2e70985fcdb8e0b91b05fbeae825db6ae9c78 Mon Sep 17 00:00:00 2001 From: Evan Whelan Date: Thu, 3 Dec 2020 15:28:42 +0000 Subject: [PATCH 044/504] 8255845: Memory leak in imageFile.cpp Reviewed-by: jlaskey, sundar --- src/java.base/share/native/libjimage/imageFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.base/share/native/libjimage/imageFile.cpp b/src/java.base/share/native/libjimage/imageFile.cpp index 001d7d8fcf3b7..0b7b92960b9bf 100644 --- a/src/java.base/share/native/libjimage/imageFile.cpp +++ b/src/java.base/share/native/libjimage/imageFile.cpp @@ -178,8 +178,8 @@ const char* ImageModuleData::package_to_module(const char* package_name) { // retrieve package location ImageLocation location; bool found = _image_file->find_location(path, location); + delete[] path; if (!found) { - delete[] path; return NULL; } From b170c8376d683a18acf786ac69a462da0dbf1386 Mon Sep 17 00:00:00 2001 From: Julia Boes Date: Thu, 3 Dec 2020 15:48:03 +0000 Subject: [PATCH 045/504] 8257591: Remove suppression of record preview related warnings in java.lang Reviewed-by: chegar --- src/java.base/share/classes/java/lang/Class.java | 2 -- .../share/classes/java/lang/reflect/RecordComponent.java | 4 +--- .../share/classes/java/lang/runtime/ObjectMethods.java | 3 +-- test/jdk/java/lang/invoke/unreflect/UnreflectTest.java | 5 ++--- .../java/lang/reflect/records/RecordPermissionsTest.java | 6 +++--- .../jdk/java/lang/reflect/records/RecordReflectionTest.java | 6 +++--- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index d1a9f63cc69d4..3a8cae6e2a69b 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -269,7 +269,6 @@ public String toString() { * * @since 1.8 */ - @SuppressWarnings("preview") public String toGenericString() { if (isPrimitive()) { return toString(); @@ -3548,7 +3547,6 @@ private static Constructor[] copyConstructors(Constructor[] arg) { private native Method[] getDeclaredMethods0(boolean publicOnly); private native Constructor[] getDeclaredConstructors0(boolean publicOnly); private native Class[] getDeclaredClasses0(); - @SuppressWarnings("preview") private native RecordComponent[] getRecordComponents0(); private native boolean isRecord0(); diff --git a/src/java.base/share/classes/java/lang/reflect/RecordComponent.java b/src/java.base/share/classes/java/lang/reflect/RecordComponent.java index 7079f3d28f75b..50d36418631a0 100644 --- a/src/java.base/share/classes/java/lang/reflect/RecordComponent.java +++ b/src/java.base/share/classes/java/lang/reflect/RecordComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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,6 @@ public final class RecordComponent implements AnnotatedElement { private transient FieldRepository genericInfo; private byte[] annotations; private byte[] typeAnnotations; - @SuppressWarnings("preview") private RecordComponent root; // only the JVM can create record components @@ -189,7 +188,6 @@ private Map, Annotation> declaredAnnotations() { if ((declAnnos = declaredAnnotations) == null) { synchronized (this) { if ((declAnnos = declaredAnnotations) == null) { - @SuppressWarnings("preview") RecordComponent root = this.root; if (root != null) { declAnnos = root.declaredAnnotations(); diff --git a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java index ad50a002f718e..54155c4e5bd54 100644 --- a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java +++ b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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 @@ -72,7 +72,6 @@ private ObjectMethods() { } static { try { - @SuppressWarnings("preview") Class OBJECT_METHODS_CLASS = ObjectMethods.class; MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); MethodHandles.Lookup lookup = MethodHandles.lookup(); diff --git a/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java b/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java index 206287c57c663..31dc851f4ea0f 100644 --- a/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java +++ b/test/jdk/java/lang/invoke/unreflect/UnreflectTest.java @@ -21,10 +21,10 @@ * questions. */ -/** +/* * @test * @bug 8238358 8247444 - * @run testng/othervm --enable-preview UnreflectTest + * @run testng/othervm UnreflectTest * @summary Test Lookup::unreflectSetter and Lookup::unreflectVarHandle on * trusted final fields (declared in hidden classes and records) */ @@ -99,7 +99,6 @@ static record TestRecord(int i) { * Test Lookup::unreflectSetter and Lookup::unreflectVarHandle that * cannot write the value of a non-static final field in a record class */ - @SuppressWarnings("preview") public void testFieldsInRecordClass() throws Throwable { assertTrue(TestRecord.class.isRecord()); Object o = new TestRecord(1); diff --git a/test/jdk/java/lang/reflect/records/RecordPermissionsTest.java b/test/jdk/java/lang/reflect/records/RecordPermissionsTest.java index d6947a7519f9b..46180ef143901 100644 --- a/test/jdk/java/lang/reflect/records/RecordPermissionsTest.java +++ b/test/jdk/java/lang/reflect/records/RecordPermissionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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,8 +25,8 @@ * @test * @bug 8235369 * @summary Security manager checks for record related core reflection - * @compile --enable-preview -source ${jdk.version} RecordPermissionsTest.java - * @run testng/othervm/java.security.policy=allPermissions.policy --enable-preview RecordPermissionsTest + * @compile RecordPermissionsTest.java + * @run testng/othervm/java.security.policy=allPermissions.policy RecordPermissionsTest */ import java.net.URL; diff --git a/test/jdk/java/lang/reflect/records/RecordReflectionTest.java b/test/jdk/java/lang/reflect/records/RecordReflectionTest.java index b121bac5ef589..5968b4813ea8f 100644 --- a/test/jdk/java/lang/reflect/records/RecordReflectionTest.java +++ b/test/jdk/java/lang/reflect/records/RecordReflectionTest.java @@ -25,9 +25,9 @@ * @test * @bug 8235369 8235550 8247444 * @summary reflection test for records - * @compile --enable-preview -source ${jdk.version} RecordReflectionTest.java - * @run testng/othervm --enable-preview RecordReflectionTest - * @run testng/othervm/java.security.policy=allPermissions.policy --enable-preview RecordReflectionTest + * @compile RecordReflectionTest.java + * @run testng/othervm RecordReflectionTest + * @run testng/othervm/java.security.policy=allPermissions.policy RecordReflectionTest */ import java.lang.annotation.*; From e83639620739749834d91e026cfecb56529aa295 Mon Sep 17 00:00:00 2001 From: Evgeny Astigeevich Date: Thu, 3 Dec 2020 15:55:32 +0000 Subject: [PATCH 046/504] 8257436: [aarch64] Regressions in ArrayCopyUnalignedDst.testByte/testChar for 65-78 bytes when UseSIMDForMemoryOps is on Reviewed-by: simonis --- .../cpu/aarch64/stubGenerator_aarch64.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index c1b25a076e5b6..3022aacd40db5 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1094,10 +1094,10 @@ class StubGenerator: public StubCodeGenerator { Register count, Register tmp, int step) { copy_direction direction = step < 0 ? copy_backwards : copy_forwards; bool is_backwards = step < 0; - int granularity = uabs(step); + unsigned int granularity = uabs(step); const Register t0 = r3, t1 = r4; - // <= 96 bytes do inline. Direction doesn't matter because we always + // <= 80 (or 96 for SIMD) bytes do inline. Direction doesn't matter because we always // load all the data before writing anything Label copy4, copy8, copy16, copy32, copy80, copy_big, finish; const Register t2 = r5, t3 = r6, t4 = r7, t5 = r8; @@ -1154,7 +1154,28 @@ class StubGenerator: public StubCodeGenerator { if (UseSIMDForMemoryOps) { __ ldpq(v0, v1, Address(s, 0)); __ ldpq(v2, v3, Address(s, 32)); + // Unaligned pointers can be an issue for copying. + // The issue has more chances to happen when granularity of data is + // less than 4(sizeof(jint)). Pointers for arrays of jint are at least + // 4 byte aligned. Pointers for arrays of jlong are 8 byte aligned. + // The most performance drop has been seen for the range 65-80 bytes. + // For such cases using the pair of ldp/stp instead of the third pair of + // ldpq/stpq fixes the performance issue. + if (granularity < sizeof (jint)) { + Label copy96; + __ cmp(count, u1(80/granularity)); + __ br(Assembler::HI, copy96); + __ ldp(t0, t1, Address(send, -16)); + + __ stpq(v0, v1, Address(d, 0)); + __ stpq(v2, v3, Address(d, 32)); + __ stp(t0, t1, Address(dend, -16)); + __ b(finish); + + __ bind(copy96); + } __ ldpq(v4, v5, Address(send, -32)); + __ stpq(v0, v1, Address(d, 0)); __ stpq(v2, v3, Address(d, 32)); __ stpq(v4, v5, Address(dend, -32)); From 70517c83c2784a781d85dc903a787ebeb64fdb0c Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Thu, 3 Dec 2020 16:29:16 +0000 Subject: [PATCH 047/504] 8257642: CipherByteBufferOverwriteTest copyright issue Reviewed-by: xuelei, wetmore --- .../javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java b/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java index 260d667714744..c1acd17712331 100644 --- a/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java +++ b/test/jdk/javax/crypto/CipherSpi/CipherByteBufferOverwriteTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 From 6c9482eef5710e7e04279a6172d18e30b80502fa Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 3 Dec 2020 17:02:04 +0000 Subject: [PATCH 048/504] 8257561: Some code is not vectorized after 8251925 and 8250607 Reviewed-by: chagedorn, vlivanov, thartmann --- src/hotspot/share/opto/cfgnode.cpp | 6 ++---- src/hotspot/share/opto/superword.cpp | 16 +++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index 3cf786fd13742..b70d279f270ec 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -1105,11 +1105,9 @@ const Type* PhiNode::Value(PhaseGVN* phase) const { if (bt != BoolTest::ne) { if (stride_t->hi_as_long() < 0) { // Down-counter loop swap(lo, hi); - return TypeInteger::make(MIN2(lo->lo_as_long(), hi->lo_as_long()), hi->hi_as_long(), 3, - l->bt())->filter_speculative(_type); + return TypeInteger::make(MIN2(lo->lo_as_long(), hi->lo_as_long()), hi->hi_as_long(), 3, l->bt()); } else if (stride_t->lo_as_long() >= 0) { - return TypeInteger::make(lo->lo_as_long(), MAX2(lo->hi_as_long(), hi->hi_as_long()), 3, - l->bt())->filter_speculative(_type); + return TypeInteger::make(lo->lo_as_long(), MAX2(lo->hi_as_long(), hi->hi_as_long()), 3, l->bt()); } } } diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 1da62777018ee..8c8f47c80a446 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -3995,16 +3995,14 @@ bool SWPointer::offset_plus_k(Node* n, bool negate) { assert(!is_main_loop_member(n), "sanity"); n = n->in(1); } - - // Check if 'n' can really be used as invariant (not in main loop and dominating the pre loop). - if (invariant(n)) { - _negate_invar = negate; - _invar = n; - NOT_PRODUCT(_tracer.offset_plus_k_10(n, _invar, _negate_invar, _offset);) - return true; - } } - return false; + // Check if 'n' can really be used as invariant (not in main loop and dominating the pre loop). + if (invariant(n)) { + _negate_invar = negate; + _invar = n; + NOT_PRODUCT(_tracer.offset_plus_k_10(n, _invar, _negate_invar, _offset);) + return true; + } } NOT_PRODUCT(_tracer.offset_plus_k_11(n);) From d3f3c322829c6cd595a6979a2147b3bcfc458d9d Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Thu, 3 Dec 2020 18:02:05 +0000 Subject: [PATCH 049/504] 8255742: PrintInlining as compiler directive doesn't print virtual calls Reviewed-by: thartmann, kvn --- src/hotspot/share/opto/doCall.cpp | 4 +- .../compiler/inlining/PrintInlining.java | 98 +++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/compiler/inlining/PrintInlining.java diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index 13053bb6317b2..c906b72b9d0a3 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -355,7 +355,9 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool // Use a more generic tactic, like a simple call. if (call_does_dispatch) { const char* msg = "virtual call"; - if (PrintInlining) print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg); + if (C->print_inlining()) { + print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg); + } C->log_inline_failure(msg); return CallGenerator::for_virtual_call(callee, vtable_index); } else { diff --git a/test/hotspot/jtreg/compiler/inlining/PrintInlining.java b/test/hotspot/jtreg/compiler/inlining/PrintInlining.java new file mode 100644 index 0000000000000..7feaa300c6d11 --- /dev/null +++ b/test/hotspot/jtreg/compiler/inlining/PrintInlining.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, 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 8255742 + * @summary PrintInlining as compiler directive doesn't print virtual calls + * @modules java.base/jdk.internal.misc + * @library /test/lib + * + * @run driver compiler.inlining.PrintInlining + */ + +package compiler.inlining; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class PrintInlining { + + static void test(String option) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", + "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:-UseOnStackReplacement", + "-XX:CompileCommand=dontinline,*::bar", + "-XX:CompileCommand=compileonly,*::foo", + "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", option, + Launcher.class.getName()); + + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + + analyzer.shouldHaveExitValue(0); + + // The test is applicable only to C2 (present in Server VM). + if (analyzer.getStderr().contains("Server VM")) { + analyzer.outputTo(System.out); + if (analyzer.asLines().stream() + .filter(s -> s.matches(".*A::bar.+virtual call.*")) + .count() != 1) { + throw new Exception("'" + option + "' didn't print virtual call."); + } + } + } + + public static void main(String[] args) throws Exception { + test("-XX:+PrintInlining"); + test("-XX:CompileCommand=option,*::foo,PrintInlining"); + } + + static class A { + void bar() {} + } + + static class B extends A { + void bar() {} + } + + static class C extends A { + void bar() {} + } + + static class D extends A { + void bar() {} + } + + static void foo(A a) { + a.bar(); + } + + static class Launcher { + public static void main(String[] args) throws Exception { + A[] as = { new B(), new C(), new D() }; + for (int i = 0; i < 20_000; i++) { + foo(as[i % 3]); + } + } + } +} From 55f5542ca2104df91e14693534cc7b3c36e81953 Mon Sep 17 00:00:00 2001 From: Anthony Scarpino Date: Thu, 3 Dec 2020 18:05:53 +0000 Subject: [PATCH 050/504] 8026976: ECParameters, Point does not match field size Reviewed-by: xuelei --- .../classes/sun/security/pkcs11/P11ECKeyFactory.java | 10 ++++++++-- test/jdk/ProblemList.txt | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java index f26ab6eb921e9..79daca151f17a 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020, 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 @@ -294,7 +294,13 @@ T implGetPublicKeySpec(P11Key key, Class keySpec, try { token.p11.C_GetAttributeValue(session[0].id(), keyID, attributes); ECParameterSpec params = decodeParameters(attributes[1].getByteArray()); - ECPoint point = decodePoint(attributes[0].getByteArray(), params.getCurve()); + ECPoint point; + + if (!token.config.getUseEcX963Encoding()) { + point = decodePoint(new DerValue(attributes[0].getByteArray()).getOctetString(), params.getCurve()); + } else { + point = decodePoint(attributes[0].getByteArray(), params.getCurve()); + } return keySpec.cast(new ECPublicKeySpec(point, params)); } catch (IOException e) { throw new InvalidKeySpecException("Could not parse key", e); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 9dc6a663dd882..0bd8eb8f5ab6f 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -661,7 +661,6 @@ com/sun/nio/sctp/SctpChannel/SocketOptionTests.java 8141694 linux-al # jdk_security -sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java 8161536 generic-all sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all From e29ee5b8a5a6c098871df885439412d872f669e8 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Thu, 3 Dec 2020 18:42:42 +0000 Subject: [PATCH 051/504] 8257641: Shenandoah: Query is_at_shenandoah_safepoint() from control thread should return false Reviewed-by: shade --- src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp | 1 + src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 3a109a2267324..90d809be6f481 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -122,6 +122,7 @@ class ShenandoahHeap : public CollectedHeap { friend class ShenandoahGCSession; friend class ShenandoahGCStateResetter; friend class ShenandoahParallelObjectIterator; + friend class ShenandoahSafepoint; // ---------- Locks that guard important data structures in Heap // private: diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp b/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp index 2f4fde1364115..c09507529fa46 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp @@ -147,9 +147,15 @@ class ShenandoahSafepoint : public AllStatic { static inline bool is_at_shenandoah_safepoint() { if (!SafepointSynchronize::is_at_safepoint()) return false; + Thread* const thr = Thread::current(); + // Shenandoah GC specific safepoints are scheduled by control thread. + // So if we are enter here from control thread, then we are definitely not + // at Shenandoah safepoint, but at something else. + if (thr == ShenandoahHeap::heap()->control_thread()) return false; + // This is not VM thread, cannot see what VM thread is doing, // so pretend this is a proper Shenandoah safepoint - if (!Thread::current()->is_VM_thread()) return true; + if (!thr->is_VM_thread()) return true; // Otherwise check we are at proper operation type VM_Operation* vm_op = VMThread::vm_operation(); From 805d05812c5e831947197419d163f9c83d55634a Mon Sep 17 00:00:00 2001 From: Amit Pawar Date: Thu, 3 Dec 2020 19:05:04 +0000 Subject: [PATCH 052/504] 8254699: Suboptimal PreTouchParallelChunkSize defaults and limits Reviewed-by: tschatzl, sjohanss --- src/hotspot/os/aix/globals_aix.hpp | 1 + src/hotspot/os/bsd/globals_bsd.hpp | 1 + src/hotspot/os/linux/globals_linux.hpp | 1 + src/hotspot/os/windows/globals_windows.hpp | 1 + src/hotspot/share/gc/shared/gc_globals.hpp | 4 ++-- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hotspot/os/aix/globals_aix.hpp b/src/hotspot/os/aix/globals_aix.hpp index 1203b09c883e1..a047e79b695fa 100644 --- a/src/hotspot/os/aix/globals_aix.hpp +++ b/src/hotspot/os/aix/globals_aix.hpp @@ -86,6 +86,7 @@ // UseLargePages means nothing, for now, on AIX. // Use Use64KPages or Use16MPages instead. +define_pd_global(size_t, PreTouchParallelChunkSize, 1 * G); define_pd_global(bool, UseLargePages, false); define_pd_global(bool, UseLargePagesIndividualAllocation, false); define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/src/hotspot/os/bsd/globals_bsd.hpp b/src/hotspot/os/bsd/globals_bsd.hpp index b36173655df8a..2204adc7abac6 100644 --- a/src/hotspot/os/bsd/globals_bsd.hpp +++ b/src/hotspot/os/bsd/globals_bsd.hpp @@ -42,6 +42,7 @@ // Defines Bsd-specific default values. The flags are available on all // platforms, but they may have different default values on other platforms. // +define_pd_global(size_t, PreTouchParallelChunkSize, 1 * G); define_pd_global(bool, UseLargePages, false); define_pd_global(bool, UseLargePagesIndividualAllocation, false); define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/src/hotspot/os/linux/globals_linux.hpp b/src/hotspot/os/linux/globals_linux.hpp index a37fd28f0e476..72915b5afbbbe 100644 --- a/src/hotspot/os/linux/globals_linux.hpp +++ b/src/hotspot/os/linux/globals_linux.hpp @@ -90,6 +90,7 @@ // Defines Linux-specific default values. The flags are available on all // platforms, but they may have different default values on other platforms. // +define_pd_global(size_t, PreTouchParallelChunkSize, 4 * M); define_pd_global(bool, UseLargePages, false); define_pd_global(bool, UseLargePagesIndividualAllocation, false); define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/src/hotspot/os/windows/globals_windows.hpp b/src/hotspot/os/windows/globals_windows.hpp index 61157041f887b..7ddf3c9131b8a 100644 --- a/src/hotspot/os/windows/globals_windows.hpp +++ b/src/hotspot/os/windows/globals_windows.hpp @@ -45,6 +45,7 @@ product(bool, UseOSErrorReporting, false, \ // Defines Windows-specific default values. The flags are available on all // platforms, but they may have different default values on other platforms. // +define_pd_global(size_t, PreTouchParallelChunkSize, 1 * G); define_pd_global(bool, UseLargePages, false); define_pd_global(bool, UseLargePagesIndividualAllocation, true); define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 9aeb8a4ba2ef0..aca8d6b6c349f 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -200,9 +200,9 @@ product(bool, AlwaysPreTouch, false, \ "Force all freshly committed pages to be pre-touched") \ \ - product(size_t, PreTouchParallelChunkSize, 1 * G, \ + product_pd(size_t, PreTouchParallelChunkSize, \ "Per-thread chunk size for parallel memory pre-touch.") \ - range(1, SIZE_MAX / 2) \ + range(4*K, SIZE_MAX / 2) \ \ /* where does the range max value of (max_jint - 1) come from? */ \ product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ From 2b73f9929f89693b9fb09e368eae55f95c57002c Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Thu, 3 Dec 2020 19:32:53 +0000 Subject: [PATCH 053/504] 8228615: Optional.empty doc should suggest using isEmpty Reviewed-by: lancea, bpb, naoto --- src/java.base/share/classes/java/util/Optional.java | 6 +++--- src/java.base/share/classes/java/util/OptionalDouble.java | 6 +++--- src/java.base/share/classes/java/util/OptionalInt.java | 6 +++--- src/java.base/share/classes/java/util/OptionalLong.java | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java.base/share/classes/java/util/Optional.java b/src/java.base/share/classes/java/util/Optional.java index 9533e35e60eda..af8ea6d1f98bf 100644 --- a/src/java.base/share/classes/java/util/Optional.java +++ b/src/java.base/share/classes/java/util/Optional.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -74,9 +74,9 @@ public final class Optional { * * @apiNote * Though it may be tempting to do so, avoid testing if an object is empty - * by comparing with {@code ==} against instances returned by + * by comparing with {@code ==} or {@code !=} against instances returned by * {@code Optional.empty()}. There is no guarantee that it is a singleton. - * Instead, use {@link #isPresent()}. + * Instead, use {@link #isEmpty()} or {@link #isPresent()}. * * @param The type of the non-existent value * @return an empty {@code Optional} diff --git a/src/java.base/share/classes/java/util/OptionalDouble.java b/src/java.base/share/classes/java/util/OptionalDouble.java index 9eb4d46e4b31f..7c8ed649cbeea 100644 --- a/src/java.base/share/classes/java/util/OptionalDouble.java +++ b/src/java.base/share/classes/java/util/OptionalDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -83,9 +83,9 @@ private OptionalDouble() { * * @apiNote * Though it may be tempting to do so, avoid testing if an object is empty - * by comparing with {@code ==} against instances returned by + * by comparing with {@code ==} or {@code !=} against instances returned by * {@code OptionalDouble.empty()}. There is no guarantee that it is a singleton. - * Instead, use {@link #isPresent()}. + * Instead, use {@link #isEmpty()} or {@link #isPresent()}. * * @return an empty {@code OptionalDouble}. */ diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java index 7f97200f58513..aa8a669d0105c 100644 --- a/src/java.base/share/classes/java/util/OptionalInt.java +++ b/src/java.base/share/classes/java/util/OptionalInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -83,9 +83,9 @@ private OptionalInt() { * * @apiNote * Though it may be tempting to do so, avoid testing if an object is empty - * by comparing with {@code ==} against instances returned by + * by comparing with {@code ==} or {@code !=} against instances returned by * {@code OptionalInt.empty()}. There is no guarantee that it is a singleton. - * Instead, use {@link #isPresent()}. + * Instead, use {@link #isEmpty()} or {@link #isPresent()}. * * @return an empty {@code OptionalInt} */ diff --git a/src/java.base/share/classes/java/util/OptionalLong.java b/src/java.base/share/classes/java/util/OptionalLong.java index dc25a52666c16..c18457358fe74 100644 --- a/src/java.base/share/classes/java/util/OptionalLong.java +++ b/src/java.base/share/classes/java/util/OptionalLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -83,9 +83,9 @@ private OptionalLong() { * * @apiNote * Though it may be tempting to do so, avoid testing if an object is empty - * by comparing with {@code ==} against instances returned by + * by comparing with {@code ==} or {@code !=} against instances returned by * {@code OptionalLong.empty()}. There is no guarantee that it is a singleton. - * Instead, use {@link #isPresent()}. + * Instead, use {@link #isEmpty()} or {@link #isPresent()}. * * @return an empty {@code OptionalLong}. */ From 7c7facc234c9def1b4603cd5f8c8a4fc724c5870 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Thu, 3 Dec 2020 19:58:58 +0000 Subject: [PATCH 054/504] 8257701: Shenandoah: objArrayKlass metadata is not marked with chunked arrays Reviewed-by: shade --- .../share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp index 837c00de2b085..40e0957fa72e1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp @@ -111,6 +111,11 @@ inline void ShenandoahConcurrentMark::do_chunked_array_start(ShenandoahObjToScan objArrayOop array = objArrayOop(obj); int len = array->length(); + // Mark objArray klass metadata + if (Devirtualizer::do_metadata(cl)) { + Devirtualizer::do_klass(cl, array->klass()); + } + if (len <= (int) ObjArrayMarkingStride*2) { // A few slices only, process directly array->oop_iterate_range(cl, 0, len); From 85269470e530f820f9190ae799c459c6f65104c6 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Thu, 3 Dec 2020 20:08:09 +0000 Subject: [PATCH 055/504] 6508941: java.awt.Desktop.open causes VM to crash with video files sporadically Reviewed-by: kizune, aivanov --- .../native/libawt/windows/awt_Desktop.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp index 7fd94b70f4ced..73b3c51c79603 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,13 +85,24 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute // 6457572: ShellExecute possibly changes FPU control word - saving it here unsigned oldcontrol87 = _control87(0, 0); - HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, SW_SHOWNORMAL); - DWORD error = ::GetLastError(); + HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | + COINIT_DISABLE_OLE1DDE); + HINSTANCE retval; + DWORD error; + if (SUCCEEDED(hr)) { + retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, + SW_SHOWNORMAL); + error = ::GetLastError(); + ::CoUninitialize(); + } _control87(oldcontrol87, 0xffffffff); JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c); JNU_ReleaseStringPlatformChars(env, verb_j, verb_c); + if (FAILED(hr)) { + return JNU_NewStringPlatform(env, L"CoInitializeEx() failed."); + } if ((int)((intptr_t)retval) <= 32) { // ShellExecute failed. LPTSTR buffer = NULL; From c5b32b33eb698fc6383c73c6b103b67c3e9568f0 Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Thu, 3 Dec 2020 21:31:33 +0000 Subject: [PATCH 056/504] 8256808: com/sun/jdi/CatchAllTest.java failed with "NullPointerException: Cannot invoke "lib.jdb.Jdb.log(String)" because "this.jdb" is null" Reviewed-by: cjplummer, sspitsyn --- test/jdk/com/sun/jdi/lib/jdb/Jdb.java | 4 ++-- test/jdk/com/sun/jdi/lib/jdb/JdbTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/jdk/com/sun/jdi/lib/jdb/Jdb.java b/test/jdk/com/sun/jdi/lib/jdb/Jdb.java index 2d34afead92e1..878ec77eff9e5 100644 --- a/test/jdk/com/sun/jdi/lib/jdb/Jdb.java +++ b/test/jdk/com/sun/jdi/lib/jdb/Jdb.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -260,7 +260,7 @@ public void quit() { command(JdbCommand.quit()); } - void log(String s) { + private void log(String s) { System.out.println(s); } diff --git a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java index f286e126aed76..b9872b91895be 100644 --- a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java +++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,9 +94,9 @@ public void run() { setup(); runCases(); } catch (Throwable e) { - jdb.log("======================================="); - jdb.log("Exception thrown during test execution: " + e.getMessage()); - jdb.log("======================================="); + System.out.println("======================================="); + System.out.println("Exception thrown during test execution: " + e.getMessage()); + System.out.println("======================================="); throw e; } finally { shutdown(); From 36209b70daf4df54435b6acd7092b77d2b5053df Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Thu, 3 Dec 2020 21:41:37 +0000 Subject: [PATCH 057/504] 8257547: Handle multiple prereqs on the same line in deps files Reviewed-by: ihse, tbell --- make/common/NativeCompilation.gmk | 18 +++++++-- test/make/TestFixDepsFile.gmk | 66 +++++++++++++++++++++++++++++++ test/make/TestMake.gmk | 6 ++- 3 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 test/make/TestFixDepsFile.gmk diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 0472ec3802115..6901d6d003f54 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -240,12 +240,22 @@ ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)-$(FILE_MACRO_CFLAGS), false-) # When compiling with relative paths, the deps file may come out with relative # paths, and that path may start with './'. First remove any leading ./, then # add WORKSPACE_ROOT to any line not starting with /, while allowing for - # leading spaces. + # leading spaces. There may also be multiple entries on the same line, so start + # with splitting such lines. + # Non GNU sed (BSD on macosx) cannot substitue in literal \n using regex. + # Instead use a bash escaped literal newline. To avoid having unmatched quotes + # ruin the ability for an editor to properly syntax highlight this file, define + # that newline sequence as a separate variable and add the closing quote behind + # a comment. + sed_newline := \'$$'\n''#' define fix-deps-file $(SED) \ - -e 's|^\([ ]*\)\./|\1|' \ - -e '/^[ ]*[^/ ]/s|^\([ ]*\)|\1$(WORKSPACE_ROOT)/|' \ - $1.tmp > $1 + -e 's|\([^ ]\) \{1,\}\([^\\:]\)|\1 \\$(sed_newline) \2|g' \ + $1.tmp \ + | $(SED) \ + -e 's|^\([ ]*\)\./|\1|' \ + -e '/^[ ]*[^/ ]/s|^\([ ]*\)|\1$(WORKSPACE_ROOT)/|' \ + > $1 endef else # By default the MakeCommandRelative macro does nothing. diff --git a/test/make/TestFixDepsFile.gmk b/test/make/TestFixDepsFile.gmk new file mode 100644 index 0000000000000..22308260d617c --- /dev/null +++ b/test/make/TestFixDepsFile.gmk @@ -0,0 +1,66 @@ +# +# Copyright (c) 2020, 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. +# + +default: all + +include $(SPEC) +include MakeBase.gmk +include UtilsForTests.gmk + +THIS_FILE := $(TOPDIR)/test/make/FixDepsFile.gmk +DEPS := $(THIS_FILE) \ + $(TOPDIR)/make/common/NativeCompilation.gmk \ + # + +OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/fix-deps-file +$(call MakeDir, $(OUTPUT_DIR)) + +################################################################################ +# The relevant case to test is when absolute paths aren't allowed. +ALLOW_ABSOLUTE_PATHS_IN_OUTPUT := false +FILE_MACRO_CFLAGS := +include NativeCompilation.gmk + +DEPS_FILE := $(OUTPUT_DIR)/deps.d + +test-fix-deps-file: + $(ECHO) "foo/bar1: \\" > $(DEPS_FILE).tmp + $(ECHO) "foo/baz1" >> $(DEPS_FILE).tmp + $(ECHO) "foo/bar : bar \\" >> $(DEPS_FILE).tmp + $(ECHO) " ./bar/baz /foo/baz" >> $(DEPS_FILE).tmp + $(call fix-deps-file, $(DEPS_FILE)) + $(ECHO) "$(WORKSPACE_ROOT)/foo/bar1: \\" > $(DEPS_FILE).expected + $(ECHO) "$(WORKSPACE_ROOT)/foo/baz1" >> $(DEPS_FILE).expected + $(ECHO) "$(WORKSPACE_ROOT)/foo/bar : \\" >> $(DEPS_FILE).expected + $(ECHO) " $(WORKSPACE_ROOT)/bar \\" >> $(DEPS_FILE).expected + $(ECHO) " $(WORKSPACE_ROOT)/bar/baz \\" >> $(DEPS_FILE).expected + $(ECHO) " /foo/baz" >> $(DEPS_FILE).expected + $(DIFF) $(DEPS_FILE).expected $(DEPS_FILE) + +TEST_TARGETS := test-fix-deps-file + +################################################################################ + +all: $(TEST_TARGETS) diff --git a/test/make/TestMake.gmk b/test/make/TestMake.gmk index 669fa6e30a802..de715933b3b83 100644 --- a/test/make/TestMake.gmk +++ b/test/make/TestMake.gmk @@ -36,6 +36,9 @@ java-compilation: copy-files: +$(MAKE) -f TestCopyFiles.gmk $(TEST_SUBTARGET) +fix-deps-file: + +$(MAKE) -f TestFixDepsFile.gmk $(TEST_SUBTARGET) + idea: +$(MAKE) -f TestIdea.gmk $(TEST_SUBTARGET) @@ -46,7 +49,8 @@ configure: $(BASH) $(TOPDIR)/test/make/autoconf/test-configure.sh \ "$(AUTOCONF)" "$(TOPDIR)" "$(TEST_SUPPORT_DIR)" -TARGETS += make-base java-compilation copy-files idea compile-commands configure +TARGETS += make-base java-compilation copy-files fix-deps-file idea \ + compile-commands configure all: $(TARGETS) From f0b1194004a6e7ebcb918cf58bad16f68130ccf2 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Thu, 3 Dec 2020 22:14:52 +0000 Subject: [PATCH 058/504] 8235784: java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java fails due to timeout with fastdebug bits Reviewed-by: bchristi, naoto --- .../invoke/VarHandles/VarHandleTestByteArrayAsChar.java | 8 ++++---- .../invoke/VarHandles/VarHandleTestByteArrayAsDouble.java | 8 ++++---- .../invoke/VarHandles/VarHandleTestByteArrayAsFloat.java | 8 ++++---- .../invoke/VarHandles/VarHandleTestByteArrayAsInt.java | 8 ++++---- .../invoke/VarHandles/VarHandleTestByteArrayAsLong.java | 8 ++++---- .../invoke/VarHandles/VarHandleTestByteArrayAsShort.java | 8 ++++---- .../VarHandles/X-VarHandleTestByteArrayView.java.template | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java index d7439671fcbd4..1f5cf9c63240d 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsChar - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsChar + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsChar + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsChar */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java index 943b1b3a612df..02a8a8d44975d 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsDouble - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsDouble + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsDouble + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsDouble */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java index 4c1c9c9aa3672..2fa4806d84f10 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsFloat - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsFloat + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsFloat + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsFloat */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java index 145a5b8e2bdf0..6585849284e53 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsInt - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsInt + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsInt + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsInt */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java index 3192d5aff2979..be6b6af439c6c 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsLong - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsLong + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsLong + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsLong */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java index cca8699522955..3b20bf21f569b 100644 --- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java +++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAsShort - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsShort + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAsShort + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAsShort */ import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template index 9c7246f2184c2..918609070e96b 100644 --- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template +++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,9 +24,9 @@ /* * @test * @bug 8154556 - * @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$ - * @run testng/othervm -Diters=20000 VarHandleTestByteArrayAs$Type$ - * @run testng/othervm -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAs$Type$ + * @run testng/othervm/timeout=360 -Diters=20000 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$ + * @run testng/othervm/timeout=360 -Diters=20000 VarHandleTestByteArrayAs$Type$ + * @run testng/othervm/timeout=360 -Diters=20000 -XX:-TieredCompilation VarHandleTestByteArrayAs$Type$ */ import org.testng.annotations.DataProvider; From 37c7835c78a467d79b46fbd02eb199df513545c4 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Thu, 3 Dec 2020 23:09:07 +0000 Subject: [PATCH 059/504] 8257673: Build fails without shenandoahgc after JDK-8257563 Reviewed-by: aph, shade --- src/hotspot/share/jvmci/compilerRuntime.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hotspot/share/jvmci/compilerRuntime.cpp b/src/hotspot/share/jvmci/compilerRuntime.cpp index f0776dbcad424..4c5edb5c1b156 100644 --- a/src/hotspot/share/jvmci/compilerRuntime.cpp +++ b/src/hotspot/share/jvmci/compilerRuntime.cpp @@ -29,6 +29,7 @@ #include "interpreter/linkResolver.hpp" #include "jvmci/compilerRuntime.hpp" #include "oops/cpCache.inline.hpp" +#include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" From f83fd4acb4c04285d14eae6b8fee0de58bfcdd45 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Thu, 3 Dec 2020 23:11:55 +0000 Subject: [PATCH 060/504] 8257438: Avoid adding duplicate values into extendedKeyCodesSet Reviewed-by: serb --- .../share/classes/sun/awt/ExtendedKeyCodes.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java b/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java index c034dbebd44f2..69e670a601e14 100644 --- a/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java +++ b/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2020, 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 @@ -44,7 +44,7 @@ public class ExtendedKeyCodes { // known keyboard layout. For instance, sterling sign is on the primary layer // of the Mac Italian layout. private static final HashSet extendedKeyCodesSet = - new HashSet(501, 1.0f); + new HashSet(496, 1.0f); public static final int getExtendedKeyCodeForChar( int c ) { int uc = Character.toUpperCase( c ); int lc = Character.toLowerCase( c ); @@ -394,7 +394,6 @@ public static final int getExtendedKeyCodeForChar( int c ) { extendedKeyCodesSet.add(0x01000000+0x06AF); extendedKeyCodesSet.add(0x01000000+0x06BE); extendedKeyCodesSet.add(0x01000000+0x06CC); - extendedKeyCodesSet.add(0x01000000+0x06CC); extendedKeyCodesSet.add(0x01000000+0x06D2); extendedKeyCodesSet.add(0x01000000+0x0493); extendedKeyCodesSet.add(0x01000000+0x0497); @@ -577,12 +576,8 @@ public static final int getExtendedKeyCodeForChar( int c ) { extendedKeyCodesSet.add(0x01000000+0x0E59); extendedKeyCodesSet.add(0x01000000+0x0587); extendedKeyCodesSet.add(0x01000000+0x0589); - extendedKeyCodesSet.add(0x01000000+0x0589); - extendedKeyCodesSet.add(0x01000000+0x055D); extendedKeyCodesSet.add(0x01000000+0x055D); extendedKeyCodesSet.add(0x01000000+0x055B); - extendedKeyCodesSet.add(0x01000000+0x055B); - extendedKeyCodesSet.add(0x01000000+0x055E); extendedKeyCodesSet.add(0x01000000+0x055E); extendedKeyCodesSet.add(0x01000000+0x0561); extendedKeyCodesSet.add(0x01000000+0x0562); From 49f9e577156986825a1ab6c627573956ba712beb Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Fri, 4 Dec 2020 03:52:04 +0000 Subject: [PATCH 061/504] 8257734: Extraneous output in HmacSHA3_512 constructor Reviewed-by: ascarpino --- .../share/classes/com/sun/crypto/provider/HmacCore.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java b/src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java index baa85ab20d7b4..fecc30a5a085d 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/HmacCore.java @@ -334,7 +334,6 @@ public HmacSHA3_384() throws NoSuchAlgorithmException { public static final class HmacSHA3_512 extends HmacCore { public HmacSHA3_512() throws NoSuchAlgorithmException { super("SHA3-512", 72); - System.out.println(AlgorithmId.get("HmacSHA3-512")); } } } From d08c612b4059f0ffa0dc97b5df45a5d7e4b2de8a Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Fri, 4 Dec 2020 06:32:14 +0000 Subject: [PATCH 062/504] 8257708: Remove redundant unmodifiableSet wrapper from already immutable set returned by Collections.singleton Reviewed-by: shade, sspitsyn --- .../DefaultPlatformMBeanProvider.java | 32 +++++++------------ .../internal/PlatformMBeanProviderImpl.java | 8 ++--- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java b/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java index ba8661c5bcbaa..7e928227e57cb 100644 --- a/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java +++ b/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -56,8 +56,7 @@ private List> init() { */ initMBeanList.add(new PlatformComponent() { private final Set classLoadingInterfaceNames = - Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.ClassLoadingMXBean")); + Collections.singleton("java.lang.management.ClassLoadingMXBean"); @Override public Set> mbeanInterfaces() { @@ -87,8 +86,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set compilationMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.CompilationMXBean")); + = Collections.singleton("java.lang.management.CompilationMXBean"); @Override public Set> mbeanInterfaces() { @@ -123,8 +121,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set memoryMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.MemoryMXBean")); + = Collections.singleton("java.lang.management.MemoryMXBean"); @Override public Set> mbeanInterfaces() { @@ -203,8 +200,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set memoryManagerMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.MemoryManagerMXBean")); + = Collections.singleton("java.lang.management.MemoryManagerMXBean"); @Override public Set> mbeanInterfaces() { @@ -252,8 +248,7 @@ private boolean isMemoryManager(MemoryManagerMXBean mbean) { */ initMBeanList.add(new PlatformComponent() { private final Set memoryPoolMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.MemoryPoolMXBean")); + = Collections.singleton("java.lang.management.MemoryPoolMXBean"); @Override public Set> mbeanInterfaces() { @@ -298,8 +293,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set runtimeMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.RuntimeMXBean")); + = Collections.singleton("java.lang.management.RuntimeMXBean"); @Override public Set> mbeanInterfaces() { @@ -329,8 +323,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set threadMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.ThreadMXBean")); + = Collections.singleton("java.lang.management.ThreadMXBean"); @Override public Set> mbeanInterfaces() { @@ -361,8 +354,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set platformLoggingMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.PlatformLoggingMXBean")); + = Collections.singleton("java.lang.management.PlatformLoggingMXBean"); @Override public Set> mbeanInterfaces() { @@ -393,8 +385,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set bufferPoolMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.BufferPoolMXBean")); + = Collections.singleton("java.lang.management.BufferPoolMXBean"); @Override public Set> mbeanInterfaces() { @@ -437,8 +428,7 @@ public Map nameToMBeanMap() { */ initMBeanList.add(new PlatformComponent() { private final Set operatingSystemMXBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "java.lang.management.OperatingSystemMXBean")); + = Collections.singleton("java.lang.management.OperatingSystemMXBean"); @Override public Set> mbeanInterfaces() { diff --git a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java index 24fbbb54c9392..da1558f59a877 100644 --- a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java +++ b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -204,8 +204,7 @@ public Map nameToMBeanMap() */ initMBeanList.add(new PlatformComponent() { private final Set hotSpotDiagnosticMXBeanInterfaceNames = - Collections.unmodifiableSet(Collections.singleton( - "com.sun.management.HotSpotDiagnosticMXBean")); + Collections.singleton("com.sun.management.HotSpotDiagnosticMXBean"); @Override public Set> mbeanInterfaces() { @@ -237,8 +236,7 @@ public Map nameToMBeanMap() if (diagMBean != null) { initMBeanList.add(new PlatformComponent() { final Set dynamicMBeanInterfaceNames - = Collections.unmodifiableSet(Collections.singleton( - "javax.management.DynamicMBean")); + = Collections.singleton("javax.management.DynamicMBean"); @Override public Set mbeanInterfaceNames() { From 4390f2c8c3e87312ab25bb829f180c5d4d898361 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 07:53:17 +0000 Subject: [PATCH 063/504] 8257630: C2: ReplacedNodes doesn't handle non-CFG multi nodes Reviewed-by: neliasso, kvn, thartmann --- src/hotspot/share/opto/replacednodes.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/replacednodes.cpp b/src/hotspot/share/opto/replacednodes.cpp index 68928fc16010b..0a89b06a7e7d0 100644 --- a/src/hotspot/share/opto/replacednodes.cpp +++ b/src/hotspot/share/opto/replacednodes.cpp @@ -120,7 +120,7 @@ static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) { } } -// Perfom node replacement following late inlining +// Perform node replacement following late inlining. void ReplacedNodes::apply(Compile* C, Node* ctl) { // ctl is the control on exit of the method that was late inlined if (is_empty()) { @@ -144,20 +144,22 @@ void ReplacedNodes::apply(Compile* C, Node* ctl) { work.clear(); enqueue_use(initial, use, work); bool replace = true; - // Check that this use is dominated by ctl. Go ahead with the - // replacement if it is. + // Check that this use is dominated by ctl. Go ahead with the replacement if it is. while (work.size() != 0 && replace) { Node* n = work.pop(); if (use->outcnt() == 0) { continue; } if (n->is_CFG() || (n->in(0) != NULL && !n->in(0)->is_top())) { - int depth = 0; - Node *m = n; + // Skip projections, since some of the multi nodes aren't CFG (e.g., LoadStore and SCMemProj). + if (n->is_Proj()) { + n = n->in(0); + } if (!n->is_CFG()) { n = n->in(0); } assert(n->is_CFG(), "should be CFG now"); + int depth = 0; while(n != ctl) { n = IfNode::up_one_dom(n); depth++; From 6845fee9055727e13f00e4a71e30067702057d5d Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 07:54:24 +0000 Subject: [PATCH 064/504] 8257625: C2: Harden input checks in vector intrinsics Reviewed-by: thartmann --- src/hotspot/share/opto/vectorIntrinsics.cpp | 198 +++++++++++++------- src/hotspot/share/opto/vectornode.cpp | 153 ++++++--------- src/hotspot/share/opto/vectornode.hpp | 2 + 3 files changed, 185 insertions(+), 168 deletions(-) diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 6f6932af0ec51..07036d2ca7b7e 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -197,12 +197,13 @@ static bool is_klass_initialized(const TypeInstPtr* vec_klass) { // TernaryOperation defaultImpl) { // bool LibraryCallKit::inline_vector_nary_operation(int n) { - const TypeInt* opr = gvn().type(argument(0))->is_int(); - const TypeInstPtr* vector_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInt* opr = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); - if (!opr->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { + if (opr == NULL || vector_klass == NULL || elem_klass == NULL || vlen == NULL || + !opr->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: opr=%s vclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], @@ -229,6 +230,12 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) { int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); int sopc = VectorNode::opcode(opc, elem_bt); + if (sopc == 0) { + if (C->print_intrinsics()) { + tty->print_cr(" ** operation not supported: opc=%s bt=%s", NodeClassNames[opc], type2name(elem_bt)); + } + return false; // operation not supported + } ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); @@ -305,14 +312,18 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) { // Sh ShuffleIota(Class E, Class ShuffleClass, Vector.Species s, int length, // int start, int step, int wrap, ShuffleIotaOperation defaultImpl) bool LibraryCallKit::inline_vector_shuffle_iota() { - const TypeInstPtr* shuffle_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); - Node* start = argument(4); - const TypeInt* start_val = gvn().type(start)->is_int(); - Node* step = argument(5); - const TypeInt* step_val = gvn().type(step)->is_int(); - const TypeInt* wrap = gvn().type(argument(6))->is_int(); + const TypeInstPtr* shuffle_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); + const TypeInt* start_val = gvn().type(argument(4))->isa_int(); + const TypeInt* step_val = gvn().type(argument(5))->isa_int(); + const TypeInt* wrap = gvn().type(argument(6))->isa_int(); + + Node* start = argument(4); + Node* step = argument(5); + if (shuffle_klass == NULL || vlen == NULL || start_val == NULL || step_val == NULL || wrap == NULL) { + return false; // dead code + } if (!vlen->is_con() || !is_power_of_2(vlen->get_con()) || shuffle_klass->const_oop() == NULL || !wrap->is_con()) { return false; // not enough info for intrinsification @@ -396,12 +407,15 @@ bool LibraryCallKit::inline_vector_shuffle_iota() { // VM shuffleToVector(Class VecClass, ClassE , Class ShuffleClass, Sh s, int length, // ShuffleToVectorOperation defaultImpl) bool LibraryCallKit::inline_vector_shuffle_to_vector() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* shuffle_klass = gvn().type(argument(2))->is_instptr(); - Node* shuffle = argument(3); - const TypeInt* vlen = gvn().type(argument(4))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* shuffle_klass = gvn().type(argument(2))->isa_instptr(); + Node* shuffle = argument(3); + const TypeInt* vlen = gvn().type(argument(4))->isa_int(); + if (vector_klass == NULL || elem_klass == NULL || shuffle_klass == NULL || shuffle->is_top() || vlen == NULL) { + return false; // dead code + } if (!vlen->is_con() || vector_klass->const_oop() == NULL || shuffle_klass->const_oop() == NULL) { return false; // not enough info for intrinsification } @@ -451,11 +465,12 @@ bool LibraryCallKit::inline_vector_shuffle_to_vector() { // long bits, // LongFunction defaultImpl) bool LibraryCallKit::inline_vector_broadcast_coerced() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(2))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(2))->isa_int(); - if (vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { + if (vector_klass == NULL || elem_klass == NULL || vlen == NULL || + vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], @@ -546,11 +561,12 @@ bool LibraryCallKit::inline_vector_broadcast_coerced() { // StoreVectorOperation defaultImpl) { bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(2))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(2))->isa_int(); - if (vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { + if (vector_klass == NULL || elem_klass == NULL || vlen == NULL || + vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], @@ -708,12 +724,13 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { // StoreVectorOperationWithMap defaultImpl) { // bool LibraryCallKit::inline_vector_gather_scatter(bool is_scatter) { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(2))->is_int(); - const TypeInstPtr* vector_idx_klass = gvn().type(argument(3))->is_instptr(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(2))->isa_int(); + const TypeInstPtr* vector_idx_klass = gvn().type(argument(3))->isa_instptr(); - if (vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || vector_idx_klass->const_oop() == NULL || !vlen->is_con()) { + if (vector_klass == NULL || elem_klass == NULL || vector_idx_klass == NULL || vlen == NULL || + vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || vector_idx_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s etype=%s vlen=%s viclass=%s", NodeClassNames[argument(0)->Opcode()], @@ -812,12 +829,13 @@ bool LibraryCallKit::inline_vector_gather_scatter(bool is_scatter) { // Function defaultImpl) bool LibraryCallKit::inline_vector_reduction() { - const TypeInt* opr = gvn().type(argument(0))->is_int(); - const TypeInstPtr* vector_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInt* opr = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); - if (!opr->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { + if (opr == NULL || vector_klass == NULL || elem_klass == NULL || vlen == NULL || + !opr->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: opr=%s vclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], @@ -899,12 +917,13 @@ bool LibraryCallKit::inline_vector_reduction() { // BiFunction defaultImpl) { // bool LibraryCallKit::inline_vector_test() { - const TypeInt* cond = gvn().type(argument(0))->is_int(); - const TypeInstPtr* vector_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInt* cond = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); - if (!cond->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { + if (cond == NULL || vector_klass == NULL || elem_klass == NULL || vlen == NULL || + !cond->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: cond=%s vclass=%s etype=%s vlen=%s", NodeClassNames[argument(0)->Opcode()], @@ -962,11 +981,14 @@ bool LibraryCallKit::inline_vector_test() { // VectorBlendOp defaultImpl) { ... // bool LibraryCallKit::inline_vector_blend() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* mask_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* mask_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); + if (mask_klass == NULL || vector_klass == NULL || elem_klass == NULL || vlen == NULL) { + return false; // dead code + } if (mask_klass->const_oop() == NULL || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { @@ -1032,12 +1054,15 @@ bool LibraryCallKit::inline_vector_blend() { // VectorCompareOp defaultImpl) { ... // bool LibraryCallKit::inline_vector_compare() { - const TypeInt* cond = gvn().type(argument(0))->is_int(); - const TypeInstPtr* vector_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* mask_klass = gvn().type(argument(2))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(3))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(4))->is_int(); + const TypeInt* cond = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* mask_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(3))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(4))->isa_int(); + if (cond == NULL || vector_klass == NULL || mask_klass == NULL || elem_klass == NULL || vlen == NULL) { + return false; // dead code + } if (!cond->is_con() || vector_klass->const_oop() == NULL || mask_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { @@ -1107,11 +1132,14 @@ bool LibraryCallKit::inline_vector_compare() { // VectorSwizzleOp defaultImpl) { ... bool LibraryCallKit::inline_vector_rearrange() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* shuffle_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* shuffle_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); + if (vector_klass == NULL || shuffle_klass == NULL || elem_klass == NULL || vlen == NULL) { + return false; // dead code + } if (shuffle_klass->const_oop() == NULL || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { @@ -1182,11 +1210,14 @@ bool LibraryCallKit::inline_vector_rearrange() { // VectorBroadcastIntOp defaultImpl) { // bool LibraryCallKit::inline_vector_broadcast_int() { - const TypeInt* opr = gvn().type(argument(0))->is_int(); - const TypeInstPtr* vector_klass = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(3))->is_int(); + const TypeInt* opr = gvn().type(argument(0))->isa_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(3))->isa_int(); + if (opr == NULL || vector_klass == NULL || elem_klass == NULL || vlen == NULL) { + return false; // dead code + } if (!opr->is_con() || vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: opr=%s vclass=%s etype=%s vlen=%s", @@ -1213,7 +1244,19 @@ bool LibraryCallKit::inline_vector_broadcast_int() { BasicType elem_bt = elem_type->basic_type(); int num_elem = vlen->get_con(); int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); + if (opc == 0 || !VectorNode::is_shift_opcode(opc)) { + if (C->print_intrinsics()) { + tty->print_cr(" ** operation not supported: op=%d bt=%s", opr->get_con(), type2name(elem_bt)); + } + return false; // operation not supported + } int sopc = VectorNode::opcode(opc, elem_bt); + if (sopc == 0) { + if (C->print_intrinsics()) { + tty->print_cr(" ** operation not supported: opc=%s bt=%s", NodeClassNames[opc], type2name(elem_bt)); + } + return false; // operation not supported + } ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass(); const TypeInstPtr* vbox_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass); @@ -1247,16 +1290,21 @@ bool LibraryCallKit::inline_vector_broadcast_int() { // VectorConvertOp defaultImpl) { // bool LibraryCallKit::inline_vector_convert() { - const TypeInt* opr = gvn().type(argument(0))->is_int(); + const TypeInt* opr = gvn().type(argument(0))->isa_int(); - const TypeInstPtr* vector_klass_from = gvn().type(argument(1))->is_instptr(); - const TypeInstPtr* elem_klass_from = gvn().type(argument(2))->is_instptr(); - const TypeInt* vlen_from = gvn().type(argument(3))->is_int(); + const TypeInstPtr* vector_klass_from = gvn().type(argument(1))->isa_instptr(); + const TypeInstPtr* elem_klass_from = gvn().type(argument(2))->isa_instptr(); + const TypeInt* vlen_from = gvn().type(argument(3))->isa_int(); - const TypeInstPtr* vector_klass_to = gvn().type(argument(4))->is_instptr(); - const TypeInstPtr* elem_klass_to = gvn().type(argument(5))->is_instptr(); - const TypeInt* vlen_to = gvn().type(argument(6))->is_int(); + const TypeInstPtr* vector_klass_to = gvn().type(argument(4))->isa_instptr(); + const TypeInstPtr* elem_klass_to = gvn().type(argument(5))->isa_instptr(); + const TypeInt* vlen_to = gvn().type(argument(6))->isa_int(); + if (opr == NULL || + vector_klass_from == NULL || elem_klass_from == NULL || vlen_from == NULL || + vector_klass_to == NULL || elem_klass_to == NULL || vlen_to == NULL) { + return false; // dead code + } if (!opr->is_con() || vector_klass_from->const_oop() == NULL || elem_klass_from->const_oop() == NULL || !vlen_from->is_con() || vector_klass_to->const_oop() == NULL || elem_klass_to->const_oop() == NULL || !vlen_to->is_con()) { @@ -1431,11 +1479,14 @@ bool LibraryCallKit::inline_vector_convert() { // VecInsertOp defaultImpl) { // bool LibraryCallKit::inline_vector_insert() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(2))->is_int(); - const TypeInt* idx = gvn().type(argument(4))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(2))->isa_int(); + const TypeInt* idx = gvn().type(argument(4))->isa_int(); + if (vector_klass == NULL || elem_klass == NULL || vlen == NULL || idx == NULL) { + return false; // dead code + } if (vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con() || !idx->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s etype=%s vlen=%s idx=%s", @@ -1521,11 +1572,14 @@ bool LibraryCallKit::inline_vector_insert() { // VecExtractOp defaultImpl) { // bool LibraryCallKit::inline_vector_extract() { - const TypeInstPtr* vector_klass = gvn().type(argument(0))->is_instptr(); - const TypeInstPtr* elem_klass = gvn().type(argument(1))->is_instptr(); - const TypeInt* vlen = gvn().type(argument(2))->is_int(); - const TypeInt* idx = gvn().type(argument(4))->is_int(); + const TypeInstPtr* vector_klass = gvn().type(argument(0))->isa_instptr(); + const TypeInstPtr* elem_klass = gvn().type(argument(1))->isa_instptr(); + const TypeInt* vlen = gvn().type(argument(2))->isa_int(); + const TypeInt* idx = gvn().type(argument(4))->isa_int(); + if (vector_klass == NULL || elem_klass == NULL || vlen == NULL || idx == NULL) { + return false; // dead code + } if (vector_klass->const_oop() == NULL || elem_klass->const_oop() == NULL || !vlen->is_con() || !idx->is_con()) { if (C->print_intrinsics()) { tty->print_cr(" ** missing constant: vclass=%s etype=%s vlen=%s idx=%s", diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 872701105dd5f..42f7a8b929051 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -43,17 +43,12 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_CHAR: case T_SHORT: return Op_AddVS; case T_INT: return Op_AddVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } - case Op_AddL: - assert(bt == T_LONG, "must be"); - return Op_AddVL; - case Op_AddF: - assert(bt == T_FLOAT, "must be"); - return Op_AddVF; - case Op_AddD: - assert(bt == T_DOUBLE, "must be"); - return Op_AddVD; + case Op_AddL: return (bt == T_LONG ? Op_AddVL : 0); + case Op_AddF: return (bt == T_FLOAT ? Op_AddVF : 0); + case Op_AddD: return (bt == T_DOUBLE ? Op_AddVD : 0); + case Op_SubI: switch (bt) { case T_BOOLEAN: @@ -61,17 +56,12 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_CHAR: case T_SHORT: return Op_SubVS; case T_INT: return Op_SubVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } - case Op_SubL: - assert(bt == T_LONG, "must be"); - return Op_SubVL; - case Op_SubF: - assert(bt == T_FLOAT, "must be"); - return Op_SubVF; - case Op_SubD: - assert(bt == T_DOUBLE, "must be"); - return Op_SubVD; + case Op_SubL: return (bt == T_LONG ? Op_SubVL : 0); + case Op_SubF: return (bt == T_FLOAT ? Op_SubVF : 0); + case Op_SubD: return (bt == T_DOUBLE ? Op_SubVD : 0); + case Op_MulI: switch (bt) { case T_BOOLEAN:return 0; @@ -79,35 +69,25 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_CHAR: case T_SHORT: return Op_MulVS; case T_INT: return Op_MulVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } - case Op_MulL: - assert(bt == T_LONG, "must be"); - return Op_MulVL; + case Op_MulL: return (bt == T_LONG ? Op_MulVL : 0); case Op_MulF: - assert(bt == T_FLOAT, "must be"); - return Op_MulVF; + return (bt == T_FLOAT ? Op_MulVF : 0); case Op_MulD: - assert(bt == T_DOUBLE, "must be"); - return Op_MulVD; + return (bt == T_DOUBLE ? Op_MulVD : 0); case Op_FmaD: - assert(bt == T_DOUBLE, "must be"); - return Op_FmaVD; + return (bt == T_DOUBLE ? Op_FmaVD : 0); case Op_FmaF: - assert(bt == T_FLOAT, "must be"); - return Op_FmaVF; + return (bt == T_FLOAT ? Op_FmaVF : 0); case Op_CMoveF: - assert(bt == T_FLOAT, "must be"); - return Op_CMoveVF; + return (bt == T_FLOAT ? Op_CMoveVF : 0); case Op_CMoveD: - assert(bt == T_DOUBLE, "must be"); - return Op_CMoveVD; + return (bt == T_DOUBLE ? Op_CMoveVD : 0); case Op_DivF: - assert(bt == T_FLOAT, "must be"); - return Op_DivVF; + return (bt == T_FLOAT ? Op_DivVF : 0); case Op_DivD: - assert(bt == T_DOUBLE, "must be"); - return Op_DivVD; + return (bt == T_DOUBLE ? Op_DivVD : 0); case Op_AbsI: switch (bt) { case T_BOOLEAN: @@ -115,11 +95,10 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_BYTE: return Op_AbsVB; case T_SHORT: return Op_AbsVS; case T_INT: return Op_AbsVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_AbsL: - assert(bt == T_LONG, "must be"); - return Op_AbsVL; + return (bt == T_LONG ? Op_AbsVL : 0); case Op_MinI: switch (bt) { case T_BOOLEAN: @@ -127,17 +106,14 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_BYTE: case T_SHORT: case T_INT: return Op_MinV; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_MinL: - assert(bt == T_LONG, "must be"); - return Op_MinV; + return (bt == T_LONG ? Op_MinV : 0); case Op_MinF: - assert(bt == T_FLOAT, "must be"); - return Op_MinV; + return (bt == T_FLOAT ? Op_MinV : 0); case Op_MinD: - assert(bt == T_DOUBLE, "must be"); - return Op_MinV; + return (bt == T_DOUBLE ? Op_MinV : 0); case Op_MaxI: switch (bt) { case T_BOOLEAN: @@ -145,54 +121,38 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_BYTE: case T_SHORT: case T_INT: return Op_MaxV; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_MaxL: - assert(bt == T_LONG, "must be"); - return Op_MaxV; + return (bt == T_LONG ? Op_MaxV : 0); case Op_MaxF: - assert(bt == T_FLOAT, "must be"); - return Op_MaxV; + return (bt == T_FLOAT ? Op_MaxV : 0); case Op_MaxD: - assert(bt == T_DOUBLE, "must be"); - return Op_MaxV; + return (bt == T_DOUBLE ? Op_MaxV : 0); case Op_AbsF: - assert(bt == T_FLOAT, "must be"); - return Op_AbsVF; + return (bt == T_FLOAT ? Op_AbsVF : 0); case Op_AbsD: - assert(bt == T_DOUBLE, "must be"); - return Op_AbsVD; + return (bt == T_DOUBLE ? Op_AbsVD : 0); case Op_NegI: - assert(bt == T_INT, "must be"); - return Op_NegVI; + return (bt == T_INT ? Op_NegVI : 0); case Op_NegF: - assert(bt == T_FLOAT, "must be"); - return Op_NegVF; + return (bt == T_FLOAT ? Op_NegVF : 0); case Op_NegD: - assert(bt == T_DOUBLE, "must be"); - return Op_NegVD; + return (bt == T_DOUBLE ? Op_NegVD : 0); case Op_RoundDoubleMode: - assert(bt == T_DOUBLE, "must be"); - return Op_RoundDoubleModeV; + return (bt == T_DOUBLE ? Op_RoundDoubleModeV : 0); case Op_RotateLeft: - assert(bt == T_LONG || bt == T_INT, "must be"); - return Op_RotateLeftV; + return (bt == T_LONG || bt == T_INT ? Op_RotateLeftV : 0); case Op_RotateRight: - assert(bt == T_LONG || bt == T_INT, "must be"); - return Op_RotateRightV; + return (bt == T_LONG || bt == T_INT ? Op_RotateRightV : 0); case Op_SqrtF: - assert(bt == T_FLOAT, "must be"); - return Op_SqrtVF; + return (bt == T_FLOAT ? Op_SqrtVF : 0); case Op_SqrtD: - assert(bt == T_DOUBLE, "must be"); - return Op_SqrtVD; + return (bt == T_DOUBLE ? Op_SqrtVD : 0); case Op_PopCountI: - if (bt == T_INT) { - return Op_PopCountVI; - } // Unimplemented for subword types since bit count changes // depending on size of lane (and sign bit). - return 0; + return (bt == T_INT ? Op_PopCountVI : 0); case Op_LShiftI: switch (bt) { case T_BOOLEAN: @@ -200,11 +160,10 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_CHAR: case T_SHORT: return Op_LShiftVS; case T_INT: return Op_LShiftVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_LShiftL: - assert(bt == T_LONG, "must be"); - return Op_LShiftVL; + return (bt == T_LONG ? Op_LShiftVL : 0); case Op_RShiftI: switch (bt) { case T_BOOLEAN:return Op_URShiftVB; // boolean is unsigned value @@ -212,17 +171,14 @@ int VectorNode::opcode(int sopc, BasicType bt) { case T_BYTE: return Op_RShiftVB; case T_SHORT: return Op_RShiftVS; case T_INT: return Op_RShiftVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_RShiftL: - assert(bt == T_LONG, "must be"); - return Op_RShiftVL; + return (bt == T_LONG ? Op_RShiftVL : 0); case Op_URShiftB: - assert(bt == T_BYTE, "must be"); - return Op_URShiftVB; + return (bt == T_BYTE ? Op_URShiftVB : 0); case Op_URShiftS: - assert(bt == T_SHORT, "must be"); - return Op_URShiftVS; + return (bt == T_SHORT ? Op_URShiftVS : 0); case Op_URShiftI: switch (bt) { case T_BOOLEAN:return Op_URShiftVB; @@ -234,11 +190,10 @@ int VectorNode::opcode(int sopc, BasicType bt) { // a short value into int value with sign // extension before a shift. case T_INT: return Op_URShiftVI; - default: ShouldNotReachHere(); return 0; + default: return 0; } case Op_URShiftL: - assert(bt == T_LONG, "must be"); - return Op_URShiftVL; + return (bt == T_LONG ? Op_URShiftVL : 0); case Op_AndI: case Op_AndL: return Op_AndV; @@ -372,12 +327,14 @@ bool VectorNode::is_vector_rotate_supported(int vopc, uint vlen, BasicType bt) { } } -bool VectorNode::is_shift(Node* n) { - switch (n->Opcode()) { +bool VectorNode::is_shift_opcode(int opc) { + switch (opc) { case Op_LShiftI: case Op_LShiftL: case Op_RShiftI: case Op_RShiftL: + case Op_URShiftB: + case Op_URShiftS: case Op_URShiftI: case Op_URShiftL: return true; @@ -386,6 +343,10 @@ bool VectorNode::is_shift(Node* n) { } } +bool VectorNode::is_shift(Node* n) { + return is_shift_opcode(n->Opcode()); +} + bool VectorNode::is_vshift_cnt(Node* n) { switch (n->Opcode()) { case Op_LShiftCntV: diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index d4b2fc83079d2..3203598ce863e 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -75,6 +75,8 @@ class VectorNode : public TypeNode { static VectorNode* make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt); static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt); + static bool is_shift_opcode(int opc); + static int opcode(int opc, BasicType bt); static int replicate_opcode(BasicType bt); static bool implemented(int opc, uint vlen, BasicType bt); From 417e7e631740761a380df78894eee48f350c8af8 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 07:55:04 +0000 Subject: [PATCH 065/504] 8257632: C2: Late inlining attempt on a call with a dead memory crashes Reviewed-by: neliasso, kvn, thartmann --- src/hotspot/share/opto/callGenerator.cpp | 6 ++++++ src/hotspot/share/opto/graphKit.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp index 02fc4253f5257..f6a2ae3c73ceb 100644 --- a/src/hotspot/share/opto/callGenerator.cpp +++ b/src/hotspot/share/opto/callGenerator.cpp @@ -363,6 +363,12 @@ void LateInlineCallGenerator::do_late_inline() { assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing"); return; } + if (call->in(TypeFunc::Memory)->is_MergeMem()) { + MergeMemNode* merge_mem = call->in(TypeFunc::Memory)->as_MergeMem(); + if (merge_mem->base_memory() == merge_mem->empty_memory()) { + return; // dead path + } + } // check for unreachable loop CallProjections callprojs; diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index dc5c19fa6b3dd..14c3807d2e219 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -1460,6 +1460,7 @@ void GraphKit::replace_in_map(Node* old, Node* neww) { Node* GraphKit::memory(uint alias_idx) { MergeMemNode* mem = merged_memory(); Node* p = mem->memory_at(alias_idx); + assert(p != mem->empty_memory(), "empty"); _gvn.set_type(p, Type::MEMORY); // must be mapped return p; } From f33808ffc92fc4af376cd4bf56577627113fd221 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 07:55:40 +0000 Subject: [PATCH 066/504] 8257631: C2: Assertion failure in ArrayCopyNode::get_count() during late inlining Reviewed-by: neliasso, kvn, thartmann --- src/hotspot/share/opto/arraycopynode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/arraycopynode.cpp b/src/hotspot/share/opto/arraycopynode.cpp index 5fc4759497ecf..4fc21c9ac1f0d 100644 --- a/src/hotspot/share/opto/arraycopynode.cpp +++ b/src/hotspot/share/opto/arraycopynode.cpp @@ -136,8 +136,8 @@ int ArrayCopyNode::get_count(PhaseGVN *phase) const { // length input to ArrayCopyNode is constant, length of input // array must be too. - assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con() || - phase->is_IterGVN() || StressReflectiveCode, "inconsistent"); + assert((get_length_if_constant(phase) == -1) != ary_src->size()->is_con() || + phase->is_IterGVN() || phase->C->inlining_incrementally() || StressReflectiveCode, "inconsistent"); if (ary_src->size()->is_con()) { return ary_src->size()->get_con(); From 4a855149636bcfd2aa68dc8bba19fc10b549c36e Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Fri, 4 Dec 2020 08:10:31 +0000 Subject: [PATCH 067/504] 8257182: JCK test failures in integer / long rotation tests Reviewed-by: mdoerr, vlivanov, thartmann, kvn --- src/hotspot/share/opto/mulnode.cpp | 20 +++-- .../c2/TestRotateNegativeEvenValues.java | 82 +++++++++++++++++++ 2 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/c2/TestRotateNegativeEvenValues.java diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp index 3bdfd45bb0d41..734cd2f131932 100644 --- a/src/hotspot/share/opto/mulnode.cpp +++ b/src/hotspot/share/opto/mulnode.cpp @@ -1506,8 +1506,9 @@ const Type* RotateLeftNode::Value(PhaseGVN* phase) const { return r1; } if (r1->is_con() && r2->is_con()) { - int shift = r2->get_con() & (BitsPerJavaInteger - 1); // semantics of Java shifts - return TypeInt::make((r1->get_con() << shift) | (r1->get_con() >> (32 - shift))); + juint r1_con = (juint)r1->get_con(); + juint shift = (juint)(r2->get_con()) & (juint)(BitsPerJavaInteger - 1); // semantics of Java shifts + return TypeInt::make((r1_con << shift) | (r1_con >> (32 - shift))); } return TypeInt::INT; } else { @@ -1524,8 +1525,9 @@ const Type* RotateLeftNode::Value(PhaseGVN* phase) const { return r1; } if (r1->is_con() && r2->is_con()) { - int shift = r2->get_con() & (BitsPerJavaLong - 1); // semantics of Java shifts - return TypeLong::make((r1->get_con() << shift) | (r1->get_con() >> (64 - shift))); + julong r1_con = (julong)r1->get_con(); + julong shift = (julong)(r2->get_con()) & (julong)(BitsPerJavaLong - 1); // semantics of Java shifts + return TypeLong::make((r1_con << shift) | (r1_con >> (64 - shift))); } return TypeLong::LONG; } @@ -1583,8 +1585,9 @@ const Type* RotateRightNode::Value(PhaseGVN* phase) const { return r1; } if (r1->is_con() && r2->is_con()) { - int shift = r2->get_con() & (BitsPerJavaInteger - 1); // semantics of Java shifts - return TypeInt::make((r1->get_con() >> shift) | (r1->get_con() << (32 - shift))); + juint r1_con = (juint)r1->get_con(); + juint shift = (juint)(r2->get_con()) & (juint)(BitsPerJavaInteger - 1); // semantics of Java shifts + return TypeInt::make((r1_con >> shift) | (r1_con << (32 - shift))); } return TypeInt::INT; } else { @@ -1600,8 +1603,9 @@ const Type* RotateRightNode::Value(PhaseGVN* phase) const { return r1; } if (r1->is_con() && r2->is_con()) { - int shift = r2->get_con() & (BitsPerJavaLong - 1); // semantics of Java shifts - return TypeLong::make((r1->get_con() >> shift) | (r1->get_con() << (64 - shift))); + julong r1_con = (julong)r1->get_con(); + julong shift = (julong)(r2->get_con()) & (julong)(BitsPerJavaLong - 1); // semantics of Java shifts + return TypeLong::make((r1_con >> shift) | (r1_con << (64 - shift))); } return TypeLong::LONG; } diff --git a/test/hotspot/jtreg/compiler/c2/TestRotateNegativeEvenValues.java b/test/hotspot/jtreg/compiler/c2/TestRotateNegativeEvenValues.java new file mode 100644 index 0000000000000..edac80ae69b58 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestRotateNegativeEvenValues.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2020, 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 8257182 + * @requires vm.compiler2.enabled + * @summary Test RotateLeftNode and RotateRightNode with negative even numbers which produces a wrong result due to + * applying an arithemtic instead of a logical shift. + * @run main/othervm -XX:CompileCommand=compileonly,compiler.c2.TestRotateNegativeEvenValues::run + * -XX:CompileCommand=inline,compiler.c2.TestRotateNegativeEvenValues::test + * -Xcomp -XX:-TieredCompilation compiler.c2.TestRotateNegativeEvenValues + */ +package compiler.c2; + +public class TestRotateNegativeEvenValues { + + public static void run() { + test(1 << 31); // INT_MIN + test(1L << 63); // LONG_MIN + test(-1 << 10); // -1024 + test(-1L << 10); // -1024 + test(-1 << 20); // -1048576 + test(-1L << 20); // -1048576 + test(-2); // 111...10 + test(-2L); // 111...10 + test(-3546); // Random minus even number + test(-3546L); // Random minus even number + } + + // Inlined such that negativeEvenNumber is a constant + public static void test(int negativeEvenNumber) { + for (int i = 1; i <= 1; i++) { + int leftShift = negativeEvenNumber << -i; + int rightShift = negativeEvenNumber >>> i; + if ((leftShift | rightShift) != (rightShift | leftShift)) { + int or1 = leftShift | rightShift; + int or2 = rightShift | leftShift; + throw new RuntimeException("Or operations are not equal:" + " " + or1 + " vs. "+ or2 + + " - leftShift: " + leftShift + ", rightShift: " + rightShift); + } + } + } + + // Inlined such that negativeEvenNumber is a constant + public static void test(long negativeEvenNumber) { + for (int i = 1; i <= 1; i++) { + long leftShift = negativeEvenNumber << -i; + long rightShift = negativeEvenNumber >>> i; + if ((leftShift | rightShift) != (rightShift | leftShift)) { + long or1 = leftShift | rightShift; + long or2 = rightShift | leftShift; + throw new RuntimeException("Or operations are not equal:" + " " + or1 + " vs. "+ or2 + + " - leftShift: " + leftShift + ", rightShift: " + rightShift); + } + } + } + + public static void main(String argv[]) { + run(); + } +} From ca402671afd74003f0b68b1c94d956be3b10ed5f Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 4 Dec 2020 08:40:12 +0000 Subject: [PATCH 068/504] 8257509: Strengthen requirements to call G1HeapVerifier::verify(VerifyOption) Reviewed-by: sjohanss, ayang --- src/hotspot/share/gc/g1/g1HeapVerifier.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index ec97cb463d3b2..09c869f45822e 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -471,12 +471,7 @@ bool G1HeapVerifier::should_verify(G1VerifyType type) { } void G1HeapVerifier::verify(VerifyOption vo) { - if (!SafepointSynchronize::is_at_safepoint()) { - log_info(gc, verify)("Skipping verification. Not at safepoint."); - } - - assert(Thread::current()->is_VM_thread(), - "Expected to be executed serially by the VM thread at this point"); + assert_at_safepoint_on_vm_thread(); log_debug(gc, verify)("Roots"); VerifyRootsClosure rootsCl(vo); From 2b4a423fd70b729e70e3376c105a92fc99d6215b Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 4 Dec 2020 08:59:14 +0000 Subject: [PATCH 069/504] 8255542: Attribute length of Module, ModulePackages and other attributes is ignored Reviewed-by: mchung, dfuchs, chegar --- .../jdk/internal/module/ModuleInfo.java | 134 +++++++++++++++++- .../BadModuleAttributeLength/Driver.java | 31 ++++ .../BadModuleAttributeLength/module-info.jcod | 98 +++++++++++++ .../BadModuleMainAttributeLength/Driver.java | 31 ++++ .../module-info.jcod | 98 +++++++++++++ .../Driver.java | 31 ++++ .../module-info.jcod | 98 +++++++++++++ .../module/badclasses/CheckBadModuleInfo.java | 50 +++++++ 8 files changed, 566 insertions(+), 5 deletions(-) create mode 100644 test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/Driver.java create mode 100644 test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/module-info.jcod create mode 100644 test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/Driver.java create mode 100644 test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/module-info.jcod create mode 100644 test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/Driver.java create mode 100644 test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/module-info.jcod create mode 100644 test/jdk/java/lang/module/badclasses/CheckBadModuleInfo.java diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java index 46e22d544d65c..338fbeb9555ae 100644 --- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java +++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020, 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 @@ -180,7 +180,8 @@ public static Attributes readIgnoringHashes(ByteBuffer bb, Supplier> * because an identifier is not a legal Java identifier, duplicate * exports, and many other reasons */ - private Attributes doRead(DataInput in) throws IOException { + private Attributes doRead(DataInput input) throws IOException { + var in = new CountingDataInput(input); int magic = in.readInt(); if (magic != 0xCAFEBABE) @@ -243,8 +244,9 @@ private Attributes doRead(DataInput in) throws IOException { + attribute_name + " attribute"); } - switch (attribute_name) { + long initialPosition = in.count(); + switch (attribute_name) { case MODULE : builder = readModuleAttribute(in, cpool, major_version); break; @@ -280,8 +282,15 @@ private Attributes doRead(DataInput in) throws IOException { } else { in.skipBytes(length); } + } + long newPosition = in.count(); + if ((newPosition - initialPosition) != length) { + // attribute length does not match actual attribute size + throw invalidModuleDescriptor("Attribute " + attribute_name + + " does not match its expected length"); } + } // the Module attribute is required @@ -1079,12 +1088,127 @@ public String readUTF() throws IOException { } } + /** + * A DataInput implementation that reads from another DataInput and counts + * the number of bytes read. + */ + private static class CountingDataInput implements DataInput { + private final DataInput delegate; + private long count; + + CountingDataInput(DataInput delegate) { + this.delegate = delegate; + } + + long count() { + return count; + } + + @Override + public void readFully(byte b[]) throws IOException { + delegate.readFully(b, 0, b.length); + count += b.length; + } + + @Override + public void readFully(byte b[], int off, int len) throws IOException { + delegate.readFully(b, off, len); + count += len; + } + + @Override + public int skipBytes(int n) throws IOException { + int skip = delegate.skipBytes(n); + count += skip; + return skip; + } + + @Override + public boolean readBoolean() throws IOException { + boolean b = delegate.readBoolean(); + count++; + return b; + } + + @Override + public byte readByte() throws IOException { + byte b = delegate.readByte(); + count++; + return b; + } + + @Override + public int readUnsignedByte() throws IOException { + int i = delegate.readUnsignedByte(); + count++; + return i; + } + + @Override + public short readShort() throws IOException { + short s = delegate.readShort(); + count += 2; + return s; + } + + @Override + public int readUnsignedShort() throws IOException { + int s = delegate.readUnsignedShort(); + count += 2; + return s; + } + + @Override + public char readChar() throws IOException { + char c = delegate.readChar(); + count += 2; + return c; + } + + @Override + public int readInt() throws IOException { + int i = delegate.readInt(); + count += 4; + return i; + } + + @Override + public long readLong() throws IOException { + long l = delegate.readLong(); + count += 8; + return l; + } + + @Override + public float readFloat() throws IOException { + float f = delegate.readFloat(); + count += 4; + return f; + } + + @Override + public double readDouble() throws IOException { + double d = delegate.readDouble(); + count += 8; + return d; + } + + @Override + public String readLine() { + throw new RuntimeException("not implemented"); + } + + @Override + public String readUTF() throws IOException { + return DataInputStream.readUTF(this); + } + } + /** * Returns an InvalidModuleDescriptorException with the given detail * message */ - private static InvalidModuleDescriptorException - invalidModuleDescriptor(String msg) { + private static InvalidModuleDescriptorException invalidModuleDescriptor(String msg) { return new InvalidModuleDescriptorException(msg); } diff --git a/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/Driver.java b/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/Driver.java new file mode 100644 index 0000000000000..36e28f87777ec --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/Driver.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020, 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 8255542 + * @summary Module attribute has incorrect length + * @library .. + * @build module-info + * @run main CheckBadModuleInfo + */ diff --git a/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/module-info.jcod b/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/module-info.jcod new file mode 100644 index 0000000000000..9940498583d13 --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModuleAttributeLength/module-info.jcod @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, 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. + */ + +module { + 0xCAFEBABE; + 0; // minor version + 55; // version + [] { // Constant Pool + ; // first element is empty + Utf8 "module-info"; // #1 + class #1; // #2 + Utf8 "module-info.java"; // #3 + Utf8 "m"; // #4 + Module #4; // #5 + Utf8 "ModuleMainClass"; // #6 + Utf8 "p/C"; // #7 + class #7; // #8 + Utf8 "ModulePackages"; // #9 + Utf8 "p"; // #10 + Package #10; // #11 + Utf8 "java.base"; // #12 + Module #12; // #13 + Utf8 "11.0.2"; // #14 + Utf8 "SourceFile"; // #15 + Utf8 "Module"; // #16 + } // Constant Pool + + 0x8000; // access + #2;// this_cpx + #0;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // Fields + } // Fields + + [] { // Methods + } // Methods + + [] { // Attributes + Attr(#15) { // SourceFile + #3; + } // end SourceFile + ; + Attr(#16, 256) { // Module incorrect attribute length + #5; // name_index + 0x0000; // flags + #0; // version + [] { // requires + #13 0x8000 #14; + } // requires + + [] { // exports + } // exports + + [] { // opens + } // opens + + [] { // uses + } // uses + + [] { // provides + } // provides + + } // end Module + ; + Attr(#6) { // ModuleMainClass + 0x0008; + } // end ModuleMainClass + ; + Attr(#9) { // ModulePackages + [] { + #11; + } + } // end ModulePackages + } // Attributes +} // end module m diff --git a/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/Driver.java b/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/Driver.java new file mode 100644 index 0000000000000..5ea4261cc52a7 --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/Driver.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020, 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 8255542 + * @summary ModuleMain attribute has incorrect length + * @library .. + * @build module-info + * @run main CheckBadModuleInfo + */ diff --git a/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/module-info.jcod b/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/module-info.jcod new file mode 100644 index 0000000000000..499e02d54cf77 --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModuleMainAttributeLength/module-info.jcod @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, 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. + */ + +module { + 0xCAFEBABE; + 0; // minor version + 55; // version + [] { // Constant Pool + ; // first element is empty + Utf8 "module-info"; // #1 + class #1; // #2 + Utf8 "module-info.java"; // #3 + Utf8 "m"; // #4 + Module #4; // #5 + Utf8 "ModuleMainClass"; // #6 + Utf8 "p/C"; // #7 + class #7; // #8 + Utf8 "ModulePackages"; // #9 + Utf8 "p"; // #10 + Package #10; // #11 + Utf8 "java.base"; // #12 + Module #12; // #13 + Utf8 "11.0.2"; // #14 + Utf8 "SourceFile"; // #15 + Utf8 "Module"; // #16 + } // Constant Pool + + 0x8000; // access + #2;// this_cpx + #0;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // Fields + } // Fields + + [] { // Methods + } // Methods + + [] { // Attributes + Attr(#15) { // SourceFile + #3; + } // end SourceFile + ; + Attr(#16) { // Module + #5; // name_index + 0x0000; // flags + #0; // version + [] { // requires + #13 0x8000 #14; + } // requires + + [] { // exports + } // exports + + [] { // opens + } // opens + + [] { // uses + } // uses + + [] { // provides + } // provides + + } // end Module + ; + Attr(#6, 3) { // ModuleMainClass attribute_length 3 instead of 2 + 0x0008; + } // end ModuleMainClass + ; + Attr(#9) { // ModulePackages + [] { + #11; + } + } // end ModulePackages + } // Attributes +} // end module m diff --git a/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/Driver.java b/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/Driver.java new file mode 100644 index 0000000000000..0df28a110d553 --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/Driver.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020, 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 8255542 + * @summary ModulePackages attribute has incorrect length + * @library .. + * @build module-info + * @run main CheckBadModuleInfo + */ diff --git a/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/module-info.jcod b/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/module-info.jcod new file mode 100644 index 0000000000000..c725085b87d64 --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/BadModulePackagesAttributeLength/module-info.jcod @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, 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. + */ + +module { + 0xCAFEBABE; + 0; // minor version + 55; // version + [] { // Constant Pool + ; // first element is empty + Utf8 "module-info"; // #1 + class #1; // #2 + Utf8 "module-info.java"; // #3 + Utf8 "m"; // #4 + Module #4; // #5 + Utf8 "ModuleMainClass"; // #6 + Utf8 "p/C"; // #7 + class #7; // #8 + Utf8 "ModulePackages"; // #9 + Utf8 "p"; // #10 + Package #10; // #11 + Utf8 "java.base"; // #12 + Module #12; // #13 + Utf8 "11.0.2"; // #14 + Utf8 "SourceFile"; // #15 + Utf8 "Module"; // #16 + } // Constant Pool + + 0x8000; // access + #2;// this_cpx + #0;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // Fields + } // Fields + + [] { // Methods + } // Methods + + [] { // Attributes + Attr(#15) { // SourceFile + #3; + } // end SourceFile + ; + Attr(#16) { // Module + #5; // name_index + 0x0000; // flags + #0; // version + [] { // requires + #13 0x8000 #14; + } // requires + + [] { // exports + } // exports + + [] { // opens + } // opens + + [] { // uses + } // uses + + [] { // provides + } // provides + + } // end Module + ; + Attr(#6) { // ModuleMainClass + 0x0008; + } // end ModuleMainClass + ; + Attr(#9, 6) { // ModulePackages attribute_length 6 instead of 4 + [] { + #11; + } + } // end ModulePackages + } // Attributes +} // end module m diff --git a/test/jdk/java/lang/module/badclasses/CheckBadModuleInfo.java b/test/jdk/java/lang/module/badclasses/CheckBadModuleInfo.java new file mode 100644 index 0000000000000..d6e7d27c556fe --- /dev/null +++ b/test/jdk/java/lang/module/badclasses/CheckBadModuleInfo.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2020, 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.IOException; +import java.io.InputStream; +import java.lang.module.ModuleDescriptor; +import java.lang.module.InvalidModuleDescriptorException; +import java.nio.file.Files; +import java.nio.file.Path; + +/** + * Uses the ModuleDescriptor.read API to read the module-info.class in the + * ${test.classes} directory and expects InvalidModuleDescriptorException + * to be thrown. + */ +public class CheckBadModuleInfo { + public static void main(String[] args) throws IOException { + Path mi = Path.of(System.getProperty("test.classes"), "module-info.class"); + try (InputStream in = Files.newInputStream(mi)) { + try { + ModuleDescriptor descriptor = ModuleDescriptor.read(in); + System.out.println(descriptor); + throw new RuntimeException("InvalidModuleDescriptorException expected"); + } catch (InvalidModuleDescriptorException e) { + // expected + System.out.println(e); + } + } + } +} From d6dd440c767b351cda3f0f0eafa334f776a75a08 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 4 Dec 2020 09:02:20 +0000 Subject: [PATCH 070/504] 8256264: Printed GlyphVector outline with low DPI has bad quality on Windows Reviewed-by: serb --- .../sun/awt/windows/WPathGraphics.java | 4 +- .../classes/sun/awt/windows/WPrinterJob.java | 118 +++++++- .../native/libawt/windows/awt_PrintJob.cpp | 105 ++++++++ .../PathPrecisionScaleFactorTest.java | 254 ++++++++++++++++++ 4 files changed, 470 insertions(+), 11 deletions(-) create mode 100644 test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTest.java diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java b/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java index 6de773eb52e42..d642f73143383 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java @@ -1760,8 +1760,8 @@ private void convertToWPath(PathIterator pathIter) { /* Convert the quad path to a bezier. */ case PathIterator.SEG_QUADTO: - int lastX = wPrinterJob.getPenX(); - int lastY = wPrinterJob.getPenY(); + float lastX = wPrinterJob.getPenX(); + float lastY = wPrinterJob.getPenY(); float c1x = lastX + (segment[0] - lastX) * 2 / 3; float c1y = lastY + (segment[1] - lastY) * 2 / 3; float c2x = segment[2] - (segment[2] - segment[0]) * 2/ 3; diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index a2ca2b7ec8cac..403f960ffe730 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -362,6 +362,10 @@ public void dispose() { private java.awt.peer.ComponentPeer dialogOwnerPeer = null; + private static final float precisionScale = 1000.0f; + private int graphicsMode; + private double[] worldTransform = new double[6]; + /* Static Initializations */ static { @@ -953,11 +957,33 @@ private void setDevNames(long mPrintHDevNames) { } protected void beginPath() { + precisionScaleBegin(); beginPath(getPrintDC()); } protected void endPath() { endPath(getPrintDC()); + precisionScaleEnd(); + } + + protected float precisionScaleUp(float value) { + return value * precisionScale; + } + + protected float precisionScaleDown(float value) { + return value / precisionScale; + } + + protected void precisionScaleBegin() { + graphicsMode = setAdvancedGraphicsMode(); + getWorldTransform(worldTransform); + float invPrecisionScale = 1.0f / precisionScale; + scale(invPrecisionScale, invPrecisionScale); + } + + protected void precisionScaleEnd() { + setWorldTransform(worldTransform); + setGraphicsMode(graphicsMode); } protected void closeFigure() { @@ -969,20 +995,23 @@ protected void fillPath() { } protected void moveTo(float x, float y) { - moveTo(getPrintDC(), x, y); + moveTo(getPrintDC(), + precisionScaleUp(x), precisionScaleUp(y)); } protected void lineTo(float x, float y) { - lineTo(getPrintDC(), x, y); + lineTo(getPrintDC(), + precisionScaleUp(x), precisionScaleUp(y)); } protected void polyBezierTo(float control1x, float control1y, float control2x, float control2y, float endX, float endY) { - polyBezierTo(getPrintDC(), control1x, control1y, - control2x, control2y, - endX, endY); + polyBezierTo(getPrintDC(), + precisionScaleUp(control1x), precisionScaleUp(control1y), + precisionScaleUp(control2x), precisionScaleUp(control2y), + precisionScaleUp(endX), precisionScaleUp(endY)); } /** @@ -995,6 +1024,44 @@ protected void setPolyFillMode(int fillRule) { setPolyFillMode(getPrintDC(), fillRule); } + /** + * Set the GDI graphics mode to {@code GM_ADVANCED}. + */ + private int setAdvancedGraphicsMode() { + return setAdvancedGraphicsMode(getPrintDC()); + } + + /** + * Set the GDI graphics mode. + * The {@code mode} should + * be one of the following Windows constants: + * {@code GM_COMPATIBLE} or {@code GM_ADVANCED}. + */ + private int setGraphicsMode(int mode) { + return setGraphicsMode(getPrintDC(), mode); + } + + /** + * Scale the GDI World Transform. + */ + private void scale(double scaleX, double scaleY) { + scale(getPrintDC(), scaleX, scaleY); + } + + /** + * Get the GDI World Transform. + */ + private void getWorldTransform(double[] transform) { + getWorldTransform(getPrintDC(), transform); + } + + /** + * Set the GDI World Transform. + */ + private void setWorldTransform(double[] transform) { + setWorldTransform(getPrintDC(), transform); + } + /* * Create a Window's solid brush for the color specified * by {@code (red, green, blue)}. Once the brush @@ -1020,9 +1087,9 @@ protected void selectSolidBrush(Color color) { * Return the x coordinate of the current pen * position in the print device context. */ - protected int getPenX() { + protected float getPenX() { - return getPenX(getPrintDC()); + return precisionScaleDown(getPenX(getPrintDC())); } @@ -1030,9 +1097,9 @@ protected int getPenX() { * Return the y coordinate of the current pen * position in the print device context. */ - protected int getPenY() { + protected float getPenY() { - return getPenY(getPrintDC()); + return precisionScaleDown(getPenY(getPrintDC())); } /** @@ -1470,6 +1537,39 @@ protected native void polyBezierTo(long printDC, */ protected native void setPolyFillMode(long printDC, int fillRule); + /** + * Set the GDI graphics mode to {@code GM_ADVANCED} + * into the device context {@code printDC}. + */ + protected native int setAdvancedGraphicsMode(long printDC); + + /** + * Set the GDI graphics mode to {@code GM_ADVANCED} + * into the device context {@code printDC}. + * The {@code mode} should + * be one of the following Windows constants: + * {@code GM_COMPATIBLE} or {@code GM_ADVANCED}. + */ + protected native int setGraphicsMode(long printDC, int mode); + + /** + * Scale the GDI World Transform + * of the device context {@code printDC}. + */ + protected native void scale(long printDC, double scaleX, double scaleY); + + /** + * Get the GDI World Transform + * from the device context {@code printDC}. + */ + protected native void getWorldTransform(long printDC, double[] transform); + + /** + * Set the GDI World Transform + * into the device context {@code printDC}. + */ + protected native void setWorldTransform(long printDC, double[] transform); + /** * Create a Window's solid brush for the color specified * by {@code (red, green, blue)}. Once the brush diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp b/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp index 618ae9e1a827a..925000c256b0e 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp @@ -1932,6 +1932,111 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_setPolyFillMode CATCH_BAD_ALLOC; } +/* + * Class: sun_awt_windows_WPrinterJob + * Method: setAdvancedGraphicsMode + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_sun_awt_windows_WPrinterJob_setAdvancedGraphicsMode +(JNIEnv *env, jobject self, jlong printDC) { + TRY; + + return (jint) ::SetGraphicsMode((HDC)printDC, GM_ADVANCED); + + CATCH_BAD_ALLOC_RET(0); +} + +/* + * Class: sun_awt_windows_WPrinterJob + * Method: setGraphicsMode + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_sun_awt_windows_WPrinterJob_setGraphicsMode +(JNIEnv *env, jobject self, jlong printDC, jint mode) { + TRY; + + return (jint) ::SetGraphicsMode((HDC)printDC, mode); + + CATCH_BAD_ALLOC_RET(0); +} + +/* + * Class: sun_awt_windows_WPrinterJob + * Method: scale + * Signature: (JDD)V + */ +JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_scale +(JNIEnv *env, jobject self, jlong printDC, jdouble scaleX, jdouble scaleY) { + TRY; + + XFORM xForm; + + xForm.eM11 = (FLOAT) scaleX; + xForm.eM12 = (FLOAT) 0; + xForm.eM21 = (FLOAT) 0; + xForm.eM22 = (FLOAT) scaleY; + xForm.eDx = (FLOAT) 0; + xForm.eDy = (FLOAT) 0; + + ::ModifyWorldTransform((HDC)printDC, &xForm, MWT_RIGHTMULTIPLY); + + CATCH_BAD_ALLOC; +} + +/* + * Class: sun_awt_windows_WPrinterJob + * Method: getWorldTransform + * Signature: (J[D)V + */ +JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_getWorldTransform +(JNIEnv* env, jobject self, jlong printDC, jdoubleArray transform) { + TRY; + + double elems[6]; + XFORM xForm; + + ::GetWorldTransform((HDC)printDC, &xForm); + + elems[0] = (double) xForm.eM11; + elems[1] = (double) xForm.eM12; + elems[2] = (double) xForm.eM21; + elems[3] = (double) xForm.eM22; + elems[4] = (double) xForm.eDx; + elems[5] = (double) xForm.eDy; + + env->SetDoubleArrayRegion(transform, 0, 6, elems); + + CATCH_BAD_ALLOC; +} + +/* + * Class: sun_awt_windows_WPrinterJob + * Method: setWorldTransform + * Signature: (J[D)V + */ +JNIEXPORT void JNICALL Java_sun_awt_windows_WPrinterJob_setWorldTransform +(JNIEnv* env, jobject self, jlong printDC, jdoubleArray transform) { + TRY; + + double *elems; + XFORM xForm; + + elems = env->GetDoubleArrayElements(transform, 0); + + xForm.eM11 = (FLOAT) elems[0]; + xForm.eM12 = (FLOAT) elems[1]; + xForm.eM21 = (FLOAT) elems[2]; + xForm.eM22 = (FLOAT) elems[3]; + xForm.eDx = (FLOAT) elems[4]; + xForm.eDy = (FLOAT) elems[5]; + + ::SetWorldTransform((HDC)printDC, &xForm); + + env->ReleaseDoubleArrayElements(transform, elems, 0); + + CATCH_BAD_ALLOC; +} + /* * Class: sun_awt_windows_WPrinterJob * Method: selectSolidBrush diff --git a/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTest.java b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTest.java new file mode 100644 index 0000000000000..2bf2e8e391ec2 --- /dev/null +++ b/test/jdk/java/awt/print/PathPrecisionScaleFactor/PathPrecisionScaleFactorTest.java @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, BELLSOFT. 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 8256264 + * @requires (os.family == "windows") + * @summary Check that a GlyphVector outline is printed with good quility on low dpi printers + * @run main/othervm/manual PathPrecisionScaleFactorTest + */ + +import javax.print.PrintServiceLookup; +import javax.swing.*; +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class PathPrecisionScaleFactorTest { + + private static final String DESCRIPTION = + " 1. Setup 'Microsoft Print to PDF' printer on Windows.\n" + + " 2. Press Print button to print the text to PDF.\n" + + " 3. Choose 'Microsoft Print to PDF' on the print dialog and press OK\n" + + " Two strings should be printed." + + " The first line is printed using drawString() method" + + " and the second line is printed using filling glyph vector outline.\n" + + " 3. Open the PDF file, zoom in the text and check that chars on the second line " + + " (especially 'a' and 's') are not distorted and have the similar quality" + + " as on the first line.\n" + + " 4. If so, press PASS button, otherwise press FAIL button.\n"; + + private static final CountDownLatch testEndedSignal = new CountDownLatch(1); + private static final int testTimeout = 300000; + private static volatile String testFailureMsg; + private static volatile boolean testPassed; + private static volatile boolean testFinished; + + public static void main(String[] args) throws Exception { + + SwingUtilities.invokeLater(() -> createAndShowTestDialog()); + + try { + if (!testEndedSignal.await(testTimeout, TimeUnit.MILLISECONDS)) { + throw new RuntimeException(String.format( + "Test timeout '%d ms' elapsed.", testTimeout)); + } + if (!testPassed) { + String failureMsg = testFailureMsg; + if ((failureMsg != null) && (!failureMsg.trim().isEmpty())) { + throw new RuntimeException(failureMsg); + } else { + throw new RuntimeException("Test failed."); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException(ie); + } finally { + testFinished = true; + } + } + + private static void pass() { + testPassed = true; + testEndedSignal.countDown(); + } + + private static void fail(String failureMsg) { + testFailureMsg = failureMsg; + testPassed = false; + testEndedSignal.countDown(); + } + + private static String convertMillisToTimeStr(int millis) { + if (millis < 0) { + return "00:00:00"; + } + int hours = millis / 3600000; + int minutes = (millis - hours * 3600000) / 60000; + int seconds = (millis - hours * 3600000 - minutes * 60000) / 1000; + return String.format("%02d:%02d:%02d", hours, minutes, seconds); + } + + private static void createAndShowTestDialog() { + + final JDialog dialog = new JDialog(); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + dialog.dispose(); + fail("Main dialog was closed."); + } + }); + + final JLabel testTimeoutLabel = new JLabel(String.format( + "Test timeout: %s", convertMillisToTimeStr(testTimeout))); + final long startTime = System.currentTimeMillis(); + final Timer timer = new Timer(0, null); + timer.setDelay(1000); + timer.addActionListener((e) -> { + int leftTime = testTimeout - (int) (System.currentTimeMillis() - startTime); + if ((leftTime < 0) || testFinished) { + timer.stop(); + dialog.dispose(); + } + testTimeoutLabel.setText(String.format( + "Test timeout: %s", convertMillisToTimeStr(leftTime))); + }); + timer.start(); + + JTextArea textArea = new JTextArea(DESCRIPTION); + textArea.setEditable(false); + + final JButton testButton = new JButton("Print"); + final JButton passButton = new JButton("PASS"); + final JButton failButton = new JButton("FAIL"); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + new Thread(() -> { + try { + doTest(); + + SwingUtilities.invokeLater(() -> { + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + } catch (Throwable t) { + t.printStackTrace(); + dialog.dispose(); + fail("Exception occurred in a thread executing the test."); + } + }).start(); + }); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail("TitledBorder label is cut off"); + }); + + JPanel mainPanel = new JPanel(new BorderLayout()); + JPanel labelPanel = new JPanel(new FlowLayout()); + labelPanel.add(testTimeoutLabel); + mainPanel.add(labelPanel, BorderLayout.NORTH); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + + dialog.pack(); + dialog.setVisible(true); + } + + private static void doTest() throws Exception { + SwingUtilities.invokeAndWait(() -> { + try { + new PathPrecisionScaleFactorPrintable(); + } catch (PrinterException e) { + throw new RuntimeException(e); + } + }); + } + + private static class PathPrecisionScaleFactorPrintable implements Printable { + + PathPrecisionScaleFactorPrintable() throws PrinterException { + PrinterJob job = PrinterJob.getPrinterJob(); + job.setPrintService(PrintServiceLookup.lookupDefaultPrintService()); + job.setPrintable(this); + + if (job.printDialog()) { + job.print(); + } else { + throw new RuntimeException("Printing was canceled!"); + } + } + + void paint(Graphics2D g) { + + String text = "abcdefghijklmnopqrstuvwxyz"; + Font font = new Font("Times New Roman", Font.PLAIN, 8); + drawText(g, font, text); + } + + private static void drawText(Graphics2D g, Font font, String text) { + + g.setFont(font); + FontRenderContext frc = new FontRenderContext(new AffineTransform(), false, true); + + Rectangle clip = g.getClipBounds(); + int cx = (int) clip.getCenterX(); + int cy = (int) clip.getCenterY(); + + FontMetrics metrics = g.getFontMetrics(); + int w = metrics.stringWidth(text); + int h = metrics.getHeight(); + + int x = cx - w / 2; + int y = cy - h / 2; + + g.drawString(text + " [draw string]", x, y); + GlyphVector gv = font.createGlyphVector(frc, text + " [glyph vector]"); + g.fill(gv.getOutline(x, y + h)); + } + + @Override + public int print(Graphics graphics, PageFormat pageFormat, int index) { + if (index == 0) { + paint((Graphics2D) graphics); + return PAGE_EXISTS; + } else { + return NO_SUCH_PAGE; + } + } + } +} From af6b7f9c5570e7901bd841813e92b4aca9469968 Mon Sep 17 00:00:00 2001 From: Hao Sun Date: Fri, 4 Dec 2020 09:12:30 +0000 Subject: [PATCH 071/504] 8257743: Minimal build on AArch64 failed with --disable-precompiled-headers Reviewed-by: shade --- src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index c73b42579205f..2ab37dc37ef99 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" +#include "classfile/javaClasses.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" From fd6756ee2b4c4d459c20e2b2f60c8b717eda584f Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 09:24:08 +0000 Subject: [PATCH 072/504] 8257634: C2: Introduce IncrementalInliningForceCleanup diagnostic flag Reviewed-by: kvn, adityam, thartmann --- src/hotspot/share/compiler/compilerDirectives.hpp | 1 + src/hotspot/share/compiler/compilerOracle.hpp | 1 + src/hotspot/share/opto/c2_globals.hpp | 3 +++ src/hotspot/share/opto/compile.cpp | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 0b4516072db06..4fca75be79bfc 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -70,6 +70,7 @@ NOT_PRODUCT(cflags(PrintIdeal, bool, PrintIdeal, PrintIdeal)) \ cflags(CloneMapDebug, bool, false, CloneMapDebug) \ NOT_PRODUCT(cflags(IGVPrintLevel, intx, PrintIdealGraphLevel, IGVPrintLevel)) \ cflags(VectorizeDebug, uintx, 0, VectorizeDebug) \ + cflags(IncrementalInlineForceCleanup, bool, IncrementalInlineForceCleanup, IncrementalInlineForceCleanup) \ cflags(MaxNodeLimit, intx, MaxNodeLimit, MaxNodeLimit) #else #define compilerdirectives_c2_flags(cflags) diff --git a/src/hotspot/share/compiler/compilerOracle.hpp b/src/hotspot/share/compiler/compilerOracle.hpp index e8f7c2097a420..23cfde6f0625b 100644 --- a/src/hotspot/share/compiler/compilerOracle.hpp +++ b/src/hotspot/share/compiler/compilerOracle.hpp @@ -83,6 +83,7 @@ class methodHandle; option(Vectorize, "Vectorize", Bool) \ option(VectorizeDebug, "VectorizeDebug", Uintx) \ option(CloneMapDebug, "CloneMapDebug", Bool) \ + option(IncrementalInlineForceCleanup, "IncrementalInlineForceCleanup", Bool) \ option(MaxNodeLimit, "MaxNodeLimit", Intx) \ NOT_PRODUCT(option(TestOptionInt, "TestOptionInt", Intx)) \ NOT_PRODUCT(option(TestOptionUint, "TestOptionUint", Uintx)) \ diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index 287d02f20b794..c73696d6ca514 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -716,6 +716,9 @@ develop(bool, AlwaysIncrementalInline, false, \ "do all inlining incrementally") \ \ + product(bool, IncrementalInlineForceCleanup, false, DIAGNOSTIC, \ + "do cleanup after every iteration of incremental inlining") \ + \ product(intx, LiveNodeCountInliningCutoff, 40000, \ "max number of live nodes in a method") \ range(0, max_juint / 8) \ diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index f6f3e427c0efc..77be65465c473 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -1880,7 +1880,9 @@ bool Compile::inline_incrementally_one() { set_inlining_progress(false); set_do_cleanup(false); - return (_late_inlines.length() > 0) && !needs_cleanup; + + bool force_cleanup = directive()->IncrementalInlineForceCleanupOption; + return (_late_inlines.length() > 0) && !needs_cleanup && !force_cleanup; } void Compile::inline_incrementally_cleanup(PhaseIterGVN& igvn) { From fbdc1877e241552755ea208b890029e60a8df08c Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 4 Dec 2020 09:37:18 +0000 Subject: [PATCH 073/504] 8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array Reviewed-by: neliasso, kvn --- src/hotspot/share/opto/macro.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index 47d0d073f99db..3b33547197479 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -2564,7 +2564,10 @@ void PhaseMacroExpand::eliminate_macro_nodes() { while (progress) { progress = false; for (int i = C->macro_count(); i > 0; i--) { - Node * n = C->macro_node(i-1); + if (i > C->macro_count()) { + i = C->macro_count(); // more than 1 element can be eliminated at once + } + Node* n = C->macro_node(i-1); bool success = false; DEBUG_ONLY(int old_macro_count = C->macro_count();) if (n->is_AbstractLock()) { @@ -2580,7 +2583,10 @@ void PhaseMacroExpand::eliminate_macro_nodes() { while (progress) { progress = false; for (int i = C->macro_count(); i > 0; i--) { - Node * n = C->macro_node(i-1); + if (i > C->macro_count()) { + i = C->macro_count(); // more than 1 element can be eliminated at once + } + Node* n = C->macro_node(i-1); bool success = false; DEBUG_ONLY(int old_macro_count = C->macro_count();) switch (n->class_id()) { From c6f93ec9f21f6db64ad7c15c284b39ab6b0a676e Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Fri, 4 Dec 2020 10:19:30 +0000 Subject: [PATCH 074/504] 8257707: Fix incorrect format string in Http1HeaderParser Reviewed-by: shade --- .../classes/jdk/internal/net/http/Http1HeaderParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java index 6de2bbfcf9fe8..2674f0c0ff3c6 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java @@ -96,9 +96,9 @@ public String currentStateMessage() { headerName = headerName.substring(0, headerName.indexOf(':')+1) + "..."; msg = format("parsing HTTP/1.1 header, receiving [%s]", headerName); } else { - msg =format("HTTP/1.1 parser receiving [%s]", state, sb.toString()); + msg = format("HTTP/1.1 parser receiving [%s]", sb.toString()); } - return format("%s, parser state [%s]", msg , state); + return format("%s, parser state [%s]", msg, state); } /** From feabddee560499bfc4ab26cd14cdde33281280d4 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Fri, 4 Dec 2020 10:37:59 +0000 Subject: [PATCH 075/504] 8251843: jfr/tool/TestPrintJSON.java fails intermittently Reviewed-by: mgronlun --- test/jdk/jdk/jfr/tool/EndTicksComparator.java | 44 +++++++++++++++++++ test/jdk/jdk/jfr/tool/TestPrintJSON.java | 10 ++--- test/jdk/jdk/jfr/tool/TestPrintXML.java | 2 +- 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 test/jdk/jdk/jfr/tool/EndTicksComparator.java diff --git a/test/jdk/jdk/jfr/tool/EndTicksComparator.java b/test/jdk/jdk/jfr/tool/EndTicksComparator.java new file mode 100644 index 0000000000000..fb8d97d46e502 --- /dev/null +++ b/test/jdk/jdk/jfr/tool/EndTicksComparator.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020, 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 jdk.jfr.tool; + +import java.util.Comparator; +import jdk.jfr.consumer.RecordedEvent; + +public class EndTicksComparator implements Comparator { + public long readEndTicks(RecordedEvent event) { + long timestamp = event.getLong("startTime"); + if (event.hasField("duration")) { + timestamp += event.getLong("duration"); + } + return timestamp; + } + + @Override + public int compare(RecordedEvent a, RecordedEvent b) { + return Long.compare(readEndTicks(a), readEndTicks(b)); + } +} diff --git a/test/jdk/jdk/jfr/tool/TestPrintJSON.java b/test/jdk/jdk/jfr/tool/TestPrintJSON.java index 2e63a99d3271d..65cf0cff41e30 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintJSON.java +++ b/test/jdk/jdk/jfr/tool/TestPrintJSON.java @@ -65,13 +65,13 @@ public static void main(String... args) throws Throwable { JSONValue recording = o.get("recording"); JSONArray jsonEvents = recording.get("events").asArray(); List events = RecordingFile.readAllEvents(recordingFile); - Collections.sort(events, (e1, e2) -> e1.getEndTime().compareTo(e2.getEndTime())); + Collections.sort(events, new EndTicksComparator()); // Verify events are equal Iterator it = events.iterator(); for (JSONValue jsonEvent : jsonEvents) { RecordedEvent recordedEvent = it.next(); String typeName = recordedEvent.getEventType().getName(); - Asserts.assertEquals(typeName, jsonEvent.get("type").asString()); + Asserts.assertEquals(typeName, jsonEvent.get("type").asString()); assertEquals(jsonEvent, recordedEvent); } Asserts.assertFalse(events.size() != jsonEvents.size(), "Incorrect number of events"); @@ -80,7 +80,7 @@ public static void main(String... args) throws Throwable { private static void assertEquals(Object jsonObject, Object jfrObject) throws Exception { // Check object if (jfrObject instanceof RecordedObject) { - JSONValue values = ((JSONValue)jsonObject).get("values"); + JSONValue values = ((JSONValue) jsonObject).get("values"); RecordedObject recObject = (RecordedObject) jfrObject; Asserts.assertEquals(values.size(), recObject.getFields().size()); for (ValueDescriptor v : recObject.getFields()) { @@ -89,7 +89,7 @@ private static void assertEquals(Object jsonObject, Object jfrObject) throws Exc Object expectedValue = recObject.getValue(name); if (v.getAnnotation(Timestamp.class) != null) { // Make instant of OffsetDateTime - String text = ((JSONValue)jsonValue).asString(); + String text = ((JSONValue) jsonValue).asString(); jsonValue = OffsetDateTime.parse(text).toInstant().toString(); expectedValue = recObject.getInstant(name); } @@ -103,7 +103,7 @@ private static void assertEquals(Object jsonObject, Object jfrObject) throws Exc // Check array if (jfrObject != null && jfrObject.getClass().isArray()) { Object[] jfrArray = (Object[]) jfrObject; - JSONArray jsArray = ((JSONArray)jsonObject); + JSONArray jsArray = ((JSONArray) jsonObject); for (int i = 0; i < jfrArray.length; i++) { assertEquals(jsArray.get(i), jfrArray[i]); } diff --git a/test/jdk/jdk/jfr/tool/TestPrintXML.java b/test/jdk/jdk/jfr/tool/TestPrintXML.java index f84ee1372c4ba..54b32e2b1674f 100644 --- a/test/jdk/jdk/jfr/tool/TestPrintXML.java +++ b/test/jdk/jdk/jfr/tool/TestPrintXML.java @@ -96,7 +96,7 @@ public static void main(String... args) throws Throwable { // Verify that all data was written correctly List events = RecordingFile.readAllEvents(recordingFile); - Collections.sort(events, (e1, e2) -> e1.getEndTime().compareTo(e2.getEndTime())); + Collections.sort(events, new EndTicksComparator()); Iterator it = events.iterator(); for (XMLEvent xmlEvent : handler.events) { RecordedEvent re = it.next(); From 1d2d9815d0f3ba6d42ac1a12b3af77876878bf01 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Fri, 4 Dec 2020 11:24:15 +0000 Subject: [PATCH 076/504] 8257423: [PPC64] Support -XX:-UseInlineCaches Reviewed-by: stuefe, rrich --- src/hotspot/cpu/ppc/macroAssembler_ppc.cpp | 23 ++++++++++++++++++---- src/hotspot/cpu/ppc/ppc.ad | 17 +++++----------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index df1bc17e8934f..72b10dff4aa95 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -3153,10 +3153,25 @@ void MacroAssembler::store_klass_gap(Register dst_oop, Register val) { } int MacroAssembler::instr_size_for_decode_klass_not_null() { - if (!UseCompressedClassPointers) return 0; - int num_instrs = 1; // shift or move - if (CompressedKlassPointers::base() != 0) num_instrs = 7; // shift + load const + add - return num_instrs * BytesPerInstWord; + static int computed_size = -1; + + // Not yet computed? + if (computed_size == -1) { + + if (!UseCompressedClassPointers) { + computed_size = 0; + } else { + // Determine by scratch emit. + ResourceMark rm; + int code_size = 8 * BytesPerInstWord; + CodeBuffer cb("decode_klass_not_null scratch buffer", code_size, 0); + MacroAssembler* a = new MacroAssembler(&cb); + a->decode_klass_not_null(R11_scratch1); + computed_size = a->offset(); + } + } + + return computed_size; } void MacroAssembler::decode_klass_not_null(Register dst, Register src) { diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 339242195f58d..82e0890a94193 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -1100,8 +1100,7 @@ int MachCallStaticJavaNode::ret_addr_offset() { int MachCallDynamicJavaNode::ret_addr_offset() { // Offset is 4 with postalloc expanded calls (bl is one instruction). We use // postalloc expanded calls if we use inline caches and do not update method data. - if (UseInlineCaches) - return 4; + if (UseInlineCaches) return 4; int vtable_index = this->_vtable_index; if (vtable_index < 0) { @@ -1109,8 +1108,7 @@ int MachCallDynamicJavaNode::ret_addr_offset() { assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value"); return 12; } else { - assert(!UseInlineCaches, "expect vtable calls only if not using ICs"); - return 24; + return 24 + MacroAssembler::instr_size_for_decode_klass_not_null(); } } @@ -3635,7 +3633,7 @@ encode %{ int start_offset = __ offset(); Register Rtoc = (ra_) ? $constanttablebase : R2_TOC; -#if 0 + int vtable_index = this->_vtable_index; if (_vtable_index < 0) { // Must be invalid_vtable_index, not nonvirtual_vtable_index. @@ -3656,7 +3654,7 @@ encode %{ __ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr)); emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none); assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset, - "Fix constant in ret_addr_offset()"); + "Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset); } else { assert(!UseInlineCaches, "expect vtable calls only if not using ICs"); // Go thru the vtable. Get receiver klass. Receiver already @@ -3676,14 +3674,9 @@ encode %{ // Call target. Either compiled code or C2I adapter. __ mtctr(R11_scratch1); __ bctrl(); - if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) { - tty->print(" %d, %d\n", ((MachCallDynamicJavaNode*)this)->ret_addr_offset(),__ offset() - start_offset); - } assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset, - "Fix constant in ret_addr_offset()"); + "Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset); } -#endif - Unimplemented(); // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!). %} // a runtime call From dede01eb2010c65419d352e1d45dd7a345247ff3 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 4 Dec 2020 11:46:06 +0000 Subject: [PATCH 077/504] 8257622: MemoryAccess methods are missing @ForceInline annotations Reviewed-by: jvernee, shade --- .../jdk/incubator/foreign/MemoryAccess.java | 82 +++++++++++ .../foreign/LoopOverNonConstantFP.java | 131 ++++++++++++++++++ .../jdk/incubator/foreign/UnrolledAccess.java | 112 +++++++++++++++ 3 files changed, 325 insertions(+) create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNonConstantFP.java create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/foreign/UnrolledAccess.java diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java index 12543f1d7271a..9de681274fccb 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java @@ -95,6 +95,7 @@ private static VarHandle unalignedHandle(ValueLayout elementLayout, Class car * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a byte value read from {@code segment}. */ + @ForceInline public static byte getByteAtOffset(MemorySegment segment, long offset) { Objects.requireNonNull(segment); return (byte)byte_handle.get(segment, offset); @@ -107,6 +108,7 @@ public static byte getByteAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the byte value to be written. */ + @ForceInline public static void setByteAtOffset(MemorySegment segment, long offset, byte value) { Objects.requireNonNull(segment); byte_handle.set(segment, offset, value); @@ -123,6 +125,7 @@ public static void setByteAtOffset(MemorySegment segment, long offset, byte valu * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a char value read from {@code segment}. */ + @ForceInline public static char getCharAtOffset(MemorySegment segment, long offset) { return getCharAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -138,6 +141,7 @@ public static char getCharAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the char value to be written. */ + @ForceInline public static void setCharAtOffset(MemorySegment segment, long offset, char value) { setCharAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -153,6 +157,7 @@ public static void setCharAtOffset(MemorySegment segment, long offset, char valu * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a short value read from {@code segment}. */ + @ForceInline public static short getShortAtOffset(MemorySegment segment, long offset) { return getShortAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -168,6 +173,7 @@ public static short getShortAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the short value to be written. */ + @ForceInline public static void setShortAtOffset(MemorySegment segment, long offset, short value) { setShortAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -183,6 +189,7 @@ public static void setShortAtOffset(MemorySegment segment, long offset, short va * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return an int value read from {@code segment}. */ + @ForceInline public static int getIntAtOffset(MemorySegment segment, long offset) { return getIntAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -198,6 +205,7 @@ public static int getIntAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the int value to be written. */ + @ForceInline public static void setIntAtOffset(MemorySegment segment, long offset, int value) { setIntAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -213,6 +221,7 @@ public static void setIntAtOffset(MemorySegment segment, long offset, int value) * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a float value read from {@code segment}. */ + @ForceInline public static float getFloatAtOffset(MemorySegment segment, long offset) { return getFloatAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -228,6 +237,7 @@ public static float getFloatAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the float value to be written. */ + @ForceInline public static void setFloatAtOffset(MemorySegment segment, long offset, float value) { setFloatAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -243,6 +253,7 @@ public static void setFloatAtOffset(MemorySegment segment, long offset, float va * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a long value read from {@code segment}. */ + @ForceInline public static long getLongAtOffset(MemorySegment segment, long offset) { return getLongAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -258,6 +269,7 @@ public static long getLongAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the long value to be written. */ + @ForceInline public static void setLongAtOffset(MemorySegment segment, long offset, long value) { setLongAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -273,6 +285,7 @@ public static void setLongAtOffset(MemorySegment segment, long offset, long valu * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a double value read from {@code segment}. */ + @ForceInline public static double getDoubleAtOffset(MemorySegment segment, long offset) { return getDoubleAtOffset(segment, offset, ByteOrder.nativeOrder()); } @@ -288,6 +301,7 @@ public static double getDoubleAtOffset(MemorySegment segment, long offset) { * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the double value to be written. */ + @ForceInline public static void setDoubleAtOffset(MemorySegment segment, long offset, double value) { setDoubleAtOffset(segment, offset, ByteOrder.nativeOrder(), value); } @@ -304,6 +318,7 @@ public static void setDoubleAtOffset(MemorySegment segment, long offset, double * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @return a memory address read from {@code segment}. */ + @ForceInline public static MemoryAddress getAddressAtOffset(MemorySegment segment, long offset) { Objects.requireNonNull(segment); return (MemoryAddress)address_handle.get(segment, offset); @@ -321,6 +336,7 @@ public static MemoryAddress getAddressAtOffset(MemorySegment segment, long offse * @param offset offset in bytes (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(offset)}. * @param value the memory address to be written (expressed as an {@link Addressable} instance). */ + @ForceInline public static void setAddressAtOffset(MemorySegment segment, long offset, Addressable value) { Objects.requireNonNull(segment); Objects.requireNonNull(value); @@ -340,6 +356,7 @@ public static void setAddressAtOffset(MemorySegment segment, long offset, Addres * @param order the specified byte order. * @return a char value read from {@code segment}. */ + @ForceInline public static char getCharAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -359,6 +376,7 @@ public static char getCharAtOffset(MemorySegment segment, long offset, ByteOrder * @param order the specified byte order. * @param value the char value to be written. */ + @ForceInline public static void setCharAtOffset(MemorySegment segment, long offset, ByteOrder order, char value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -378,6 +396,7 @@ public static void setCharAtOffset(MemorySegment segment, long offset, ByteOrder * @param order the specified byte order. * @return a short value read from {@code segment}. */ + @ForceInline public static short getShortAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -397,6 +416,7 @@ public static short getShortAtOffset(MemorySegment segment, long offset, ByteOrd * @param order the specified byte order. * @param value the short value to be written. */ + @ForceInline public static void setShortAtOffset(MemorySegment segment, long offset, ByteOrder order, short value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -416,6 +436,7 @@ public static void setShortAtOffset(MemorySegment segment, long offset, ByteOrde * @param order the specified byte order. * @return an int value read from {@code segment}. */ + @ForceInline public static int getIntAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -435,6 +456,7 @@ public static int getIntAtOffset(MemorySegment segment, long offset, ByteOrder o * @param order the specified byte order. * @param value the int value to be written. */ + @ForceInline public static void setIntAtOffset(MemorySegment segment, long offset, ByteOrder order, int value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -454,6 +476,7 @@ public static void setIntAtOffset(MemorySegment segment, long offset, ByteOrder * @param order the specified byte order. * @return a float value read from {@code segment}. */ + @ForceInline public static float getFloatAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -473,6 +496,7 @@ public static float getFloatAtOffset(MemorySegment segment, long offset, ByteOrd * @param order the specified byte order. * @param value the float value to be written. */ + @ForceInline public static void setFloatAtOffset(MemorySegment segment, long offset, ByteOrder order, float value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -492,6 +516,7 @@ public static void setFloatAtOffset(MemorySegment segment, long offset, ByteOrde * @param order the specified byte order. * @return a long value read from {@code segment}. */ + @ForceInline public static long getLongAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -511,6 +536,7 @@ public static long getLongAtOffset(MemorySegment segment, long offset, ByteOrder * @param order the specified byte order. * @param value the long value to be written. */ + @ForceInline public static void setLongAtOffset(MemorySegment segment, long offset, ByteOrder order, long value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -530,6 +556,7 @@ public static void setLongAtOffset(MemorySegment segment, long offset, ByteOrder * @param order the specified byte order. * @return a double value read from {@code segment}. */ + @ForceInline public static double getDoubleAtOffset(MemorySegment segment, long offset, ByteOrder order) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -549,6 +576,7 @@ public static double getDoubleAtOffset(MemorySegment segment, long offset, ByteO * @param order the specified byte order. * @param value the double value to be written. */ + @ForceInline public static void setDoubleAtOffset(MemorySegment segment, long offset, ByteOrder order, double value) { Objects.requireNonNull(segment); Objects.requireNonNull(order); @@ -566,6 +594,7 @@ public static void setDoubleAtOffset(MemorySegment segment, long offset, ByteOrd * @param segment the segment to be dereferenced. * @return a byte value read from {@code segment}. */ + @ForceInline public static byte getByte(MemorySegment segment) { return getByteAtOffset(segment, 0L); } @@ -580,6 +609,7 @@ public static byte getByte(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the byte value to be written. */ + @ForceInline public static void setByte(MemorySegment segment, byte value) { setByteAtOffset(segment, 0L, value); } @@ -594,6 +624,7 @@ public static void setByte(MemorySegment segment, byte value) { * @param segment the segment to be dereferenced. * @return a char value read from {@code segment}. */ + @ForceInline public static char getChar(MemorySegment segment) { return getCharAtOffset(segment, 0L); } @@ -608,6 +639,7 @@ public static char getChar(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the char value to be written. */ + @ForceInline public static void setChar(MemorySegment segment, char value) { setCharAtOffset(segment, 0L, value); } @@ -622,6 +654,7 @@ public static void setChar(MemorySegment segment, char value) { * @param segment the segment to be dereferenced. * @return a short value read from {@code segment}. */ + @ForceInline public static short getShort(MemorySegment segment) { return getShortAtOffset(segment, 0L); } @@ -636,6 +669,7 @@ public static short getShort(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the short value to be written. */ + @ForceInline public static void setShort(MemorySegment segment, short value) { setShortAtOffset(segment, 0L, value); } @@ -650,6 +684,7 @@ public static void setShort(MemorySegment segment, short value) { * @param segment the segment to be dereferenced. * @return an int value read from {@code segment}. */ + @ForceInline public static int getInt(MemorySegment segment) { return getIntAtOffset(segment, 0L); } @@ -664,6 +699,7 @@ public static int getInt(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the int value to be written. */ + @ForceInline public static void setInt(MemorySegment segment, int value) { setIntAtOffset(segment, 0L, value); } @@ -678,6 +714,7 @@ public static void setInt(MemorySegment segment, int value) { * @param segment the segment to be dereferenced. * @return a float value read from {@code segment}. */ + @ForceInline public static float getFloat(MemorySegment segment) { return getFloatAtOffset(segment, 0L); } @@ -692,6 +729,7 @@ public static float getFloat(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the float value to be written. */ + @ForceInline public static void setFloat(MemorySegment segment, float value) { setFloatAtOffset(segment, 0L, value); } @@ -706,6 +744,7 @@ public static void setFloat(MemorySegment segment, float value) { * @param segment the segment to be dereferenced. * @return a long value read from {@code segment}. */ + @ForceInline public static long getLong(MemorySegment segment) { return getLongAtOffset(segment, 0L); } @@ -720,6 +759,7 @@ public static long getLong(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the long value to be written. */ + @ForceInline public static void setLong(MemorySegment segment, long value) { setLongAtOffset(segment, 0L, value); } @@ -734,6 +774,7 @@ public static void setLong(MemorySegment segment, long value) { * @param segment the segment to be dereferenced. * @return a double value read from {@code segment}. */ + @ForceInline public static double getDouble(MemorySegment segment) { return getDoubleAtOffset(segment, 0L); } @@ -748,6 +789,7 @@ public static double getDouble(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the double value to be written. */ + @ForceInline public static void setDouble(MemorySegment segment, double value) { setDoubleAtOffset(segment, 0L, value); } @@ -762,6 +804,7 @@ public static void setDouble(MemorySegment segment, double value) { * @param segment the segment to be dereferenced. * @return a memory address read from {@code segment}. */ + @ForceInline public static MemoryAddress getAddress(MemorySegment segment) { return getAddressAtOffset(segment, 0L); } @@ -776,6 +819,7 @@ public static MemoryAddress getAddress(MemorySegment segment) { * @param segment the segment to be dereferenced. * @param value the memory address to be written (expressed as an {@link Addressable} instance). */ + @ForceInline public static void setAddress(MemorySegment segment, Addressable value) { setAddressAtOffset(segment, 0L, value); } @@ -791,6 +835,7 @@ public static void setAddress(MemorySegment segment, Addressable value) { * @param order the specified byte order. * @return a char value read from {@code segment}. */ + @ForceInline public static char getChar(MemorySegment segment, ByteOrder order) { return getCharAtOffset(segment, 0L, order); } @@ -806,6 +851,7 @@ public static char getChar(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the char value to be written. */ + @ForceInline public static void setChar(MemorySegment segment, ByteOrder order, char value) { setCharAtOffset(segment, 0L, order, value); } @@ -821,6 +867,7 @@ public static void setChar(MemorySegment segment, ByteOrder order, char value) { * @param order the specified byte order. * @return a short value read from {@code segment}. */ + @ForceInline public static short getShort(MemorySegment segment, ByteOrder order) { return getShortAtOffset(segment, 0L, order); } @@ -836,6 +883,7 @@ public static short getShort(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the short value to be written. */ + @ForceInline public static void setShort(MemorySegment segment, ByteOrder order, short value) { setShortAtOffset(segment, 0L, order, value); } @@ -851,6 +899,7 @@ public static void setShort(MemorySegment segment, ByteOrder order, short value) * @param order the specified byte order. * @return an int value read from {@code segment}. */ + @ForceInline public static int getInt(MemorySegment segment, ByteOrder order) { return getIntAtOffset(segment, 0L, order); } @@ -866,6 +915,7 @@ public static int getInt(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the int value to be written. */ + @ForceInline public static void setInt(MemorySegment segment, ByteOrder order, int value) { setIntAtOffset(segment, 0L, order, value); } @@ -881,6 +931,7 @@ public static void setInt(MemorySegment segment, ByteOrder order, int value) { * @param order the specified byte order. * @return a float value read from {@code segment}. */ + @ForceInline public static float getFloat(MemorySegment segment, ByteOrder order) { return getFloatAtOffset(segment, 0L, order); } @@ -896,6 +947,7 @@ public static float getFloat(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the float value to be written. */ + @ForceInline public static void setFloat(MemorySegment segment, ByteOrder order, float value) { setFloatAtOffset(segment, 0L, order, value); } @@ -911,6 +963,7 @@ public static void setFloat(MemorySegment segment, ByteOrder order, float value) * @param order the specified byte order. * @return a long value read from {@code segment}. */ + @ForceInline public static long getLong(MemorySegment segment, ByteOrder order) { return getLongAtOffset(segment, 0L, order); } @@ -926,6 +979,7 @@ public static long getLong(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the long value to be written. */ + @ForceInline public static void setLong(MemorySegment segment, ByteOrder order, long value) { setLongAtOffset(segment, 0L, order, value); } @@ -941,6 +995,7 @@ public static void setLong(MemorySegment segment, ByteOrder order, long value) { * @param order the specified byte order. * @return a double value read from {@code segment}. */ + @ForceInline public static double getDouble(MemorySegment segment, ByteOrder order) { return getDoubleAtOffset(segment, 0L, order); } @@ -956,6 +1011,7 @@ public static double getDouble(MemorySegment segment, ByteOrder order) { * @param order the specified byte order. * @param value the double value to be written. */ + @ForceInline public static void setDouble(MemorySegment segment, ByteOrder order, double value) { setDoubleAtOffset(segment, 0L, order, value); } @@ -971,6 +1027,7 @@ public static void setDouble(MemorySegment segment, ByteOrder order, double valu * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 2)}. * @return a char value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static char getCharAtIndex(MemorySegment segment, long index) { return getCharAtOffset(segment, scale(segment, index, 2)); } @@ -986,6 +1043,7 @@ public static char getCharAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 2)}. * @param value the char value to be written. */ + @ForceInline public static void setCharAtIndex(MemorySegment segment, long index, char value) { setCharAtOffset(segment, scale(segment, index, 2), value); } @@ -1001,6 +1059,7 @@ public static void setCharAtIndex(MemorySegment segment, long index, char value) * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 2)}. * @return a short value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static short getShortAtIndex(MemorySegment segment, long index) { return getShortAtOffset(segment, scale(segment, index, 2)); } @@ -1016,6 +1075,7 @@ public static short getShortAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 2)}. * @param value the short value to be written. */ + @ForceInline public static void setShortAtIndex(MemorySegment segment, long index, short value) { setShortAtOffset(segment, scale(segment, index, 2), value); } @@ -1031,6 +1091,7 @@ public static void setShortAtIndex(MemorySegment segment, long index, short valu * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 4)}. * @return an int value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static int getIntAtIndex(MemorySegment segment, long index) { return getIntAtOffset(segment, scale(segment, index, 4)); } @@ -1046,6 +1107,7 @@ public static int getIntAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 4)}. * @param value the int value to be written. */ + @ForceInline public static void setIntAtIndex(MemorySegment segment, long index, int value) { setIntAtOffset(segment, scale(segment, index, 4), value); } @@ -1061,6 +1123,7 @@ public static void setIntAtIndex(MemorySegment segment, long index, int value) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 4)}. * @return a float value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static float getFloatAtIndex(MemorySegment segment, long index) { return getFloatAtOffset(segment, scale(segment, index, 4)); } @@ -1076,6 +1139,7 @@ public static float getFloatAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 4)}. * @param value the float value to be written. */ + @ForceInline public static void setFloatAtIndex(MemorySegment segment, long index, float value) { setFloatAtOffset(segment, scale(segment, index, 4), value); } @@ -1091,6 +1155,7 @@ public static void setFloatAtIndex(MemorySegment segment, long index, float valu * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @return a long value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static long getLongAtIndex(MemorySegment segment, long index) { return getLongAtOffset(segment, scale(segment, index, 8)); } @@ -1106,6 +1171,7 @@ public static long getLongAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @param value the long value to be written. */ + @ForceInline public static void setLongAtIndex(MemorySegment segment, long index, long value) { setLongAtOffset(segment, scale(segment, index, 8), value); } @@ -1121,6 +1187,7 @@ public static void setLongAtIndex(MemorySegment segment, long index, long value) * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @return a double value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static double getDoubleAtIndex(MemorySegment segment, long index) { return getDoubleAtOffset(segment, scale(segment, index, 8)); } @@ -1136,6 +1203,7 @@ public static double getDoubleAtIndex(MemorySegment segment, long index) { * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @param value the double value to be written. */ + @ForceInline public static void setDoubleAtIndex(MemorySegment segment, long index, double value) { setDoubleAtOffset(segment, scale(segment, index, 8), value); } @@ -1151,6 +1219,7 @@ public static void setDoubleAtIndex(MemorySegment segment, long index, double va * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @return a memory address read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static MemoryAddress getAddressAtIndex(MemorySegment segment, long index) { return getAddressAtOffset(segment, scale(segment, index, (int)MemoryLayouts.ADDRESS.byteSize())); } @@ -1166,6 +1235,7 @@ public static MemoryAddress getAddressAtIndex(MemorySegment segment, long index) * @param index element index (relative to {@code segment}). The final address of this read operation can be expressed as {@code segment.address().addOffset(index * 8)}. * @param value the memory address to be written (expressed as an {@link Addressable} instance). */ + @ForceInline public static void setAddressAtIndex(MemorySegment segment, long index, Addressable value) { setAddressAtOffset(segment, scale(segment, index, (int)MemoryLayouts.ADDRESS.byteSize()), value); } @@ -1182,6 +1252,7 @@ public static void setAddressAtIndex(MemorySegment segment, long index, Addressa * @param order the specified byte order. * @return a char value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static char getCharAtIndex(MemorySegment segment, long index, ByteOrder order) { return getCharAtOffset(segment, scale(segment, index, 2), order); } @@ -1198,6 +1269,7 @@ public static char getCharAtIndex(MemorySegment segment, long index, ByteOrder o * @param order the specified byte order. * @param value the char value to be written. */ + @ForceInline public static void setCharAtIndex(MemorySegment segment, long index, ByteOrder order, char value) { setCharAtOffset(segment, scale(segment, index, 2), order, value); } @@ -1214,6 +1286,7 @@ public static void setCharAtIndex(MemorySegment segment, long index, ByteOrder o * @param order the specified byte order. * @return a short value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static short getShortAtIndex(MemorySegment segment, long index, ByteOrder order) { return getShortAtOffset(segment, scale(segment, index, 2), order); } @@ -1230,6 +1303,7 @@ public static short getShortAtIndex(MemorySegment segment, long index, ByteOrder * @param order the specified byte order. * @param value the short value to be written. */ + @ForceInline public static void setShortAtIndex(MemorySegment segment, long index, ByteOrder order, short value) { setShortAtOffset(segment, scale(segment, index, 2), order, value); } @@ -1246,6 +1320,7 @@ public static void setShortAtIndex(MemorySegment segment, long index, ByteOrder * @param order the specified byte order. * @return an int value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static int getIntAtIndex(MemorySegment segment, long index, ByteOrder order) { return getIntAtOffset(segment, scale(segment, index, 4), order); } @@ -1262,6 +1337,7 @@ public static int getIntAtIndex(MemorySegment segment, long index, ByteOrder ord * @param order the specified byte order. * @param value the int value to be written. */ + @ForceInline public static void setIntAtIndex(MemorySegment segment, long index, ByteOrder order, int value) { setIntAtOffset(segment, scale(segment, index, 4), order, value); } @@ -1278,6 +1354,7 @@ public static void setIntAtIndex(MemorySegment segment, long index, ByteOrder or * @param order the specified byte order. * @return a float value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static float getFloatAtIndex(MemorySegment segment, long index, ByteOrder order) { return getFloatAtOffset(segment, scale(segment, index, 4), order); } @@ -1294,6 +1371,7 @@ public static float getFloatAtIndex(MemorySegment segment, long index, ByteOrder * @param order the specified byte order. * @param value the float value to be written. */ + @ForceInline public static void setFloatAtIndex(MemorySegment segment, long index, ByteOrder order, float value) { setFloatAtOffset(segment, scale(segment, index, 4), order, value); } @@ -1310,6 +1388,7 @@ public static void setFloatAtIndex(MemorySegment segment, long index, ByteOrder * @param order the specified byte order. * @return a long value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static long getLongAtIndex(MemorySegment segment, long index, ByteOrder order) { return getLongAtOffset(segment, scale(segment, index, 8), order); } @@ -1326,6 +1405,7 @@ public static long getLongAtIndex(MemorySegment segment, long index, ByteOrder o * @param order the specified byte order. * @param value the long value to be written. */ + @ForceInline public static void setLongAtIndex(MemorySegment segment, long index, ByteOrder order, long value) { setLongAtOffset(segment, scale(segment, index, 8), order, value); } @@ -1342,6 +1422,7 @@ public static void setLongAtIndex(MemorySegment segment, long index, ByteOrder o * @param order the specified byte order. * @return a double value read from {@code segment} at the element index specified by {@code index}. */ + @ForceInline public static double getDoubleAtIndex(MemorySegment segment, long index, ByteOrder order) { return getDoubleAtOffset(segment, scale(segment, index, 8), order); } @@ -1358,6 +1439,7 @@ public static double getDoubleAtIndex(MemorySegment segment, long index, ByteOrd * @param order the specified byte order. * @param value the double value to be written. */ + @ForceInline public static void setDoubleAtIndex(MemorySegment segment, long index, ByteOrder order, double value) { setDoubleAtOffset(segment, scale(segment, index, 8), order, value); } diff --git a/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNonConstantFP.java b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNonConstantFP.java new file mode 100644 index 0000000000000..d4325c7c5fe41 --- /dev/null +++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNonConstantFP.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2020, 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 org.openjdk.bench.jdk.incubator.foreign; + +import jdk.incubator.foreign.MemoryAccess; +import jdk.incubator.foreign.MemoryAddress; +import jdk.incubator.foreign.MemoryLayout; +import jdk.incubator.foreign.MemorySegment; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.annotations.Warmup; +import sun.misc.Unsafe; + +import java.lang.invoke.VarHandle; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.concurrent.TimeUnit; + +import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement; +import static jdk.incubator.foreign.MemoryLayouts.JAVA_DOUBLE; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(3) +public class LoopOverNonConstantFP { + + static final Unsafe unsafe = Utils.unsafe; + + static final int ELEM_SIZE = 1_000_000; + static final int CARRIER_SIZE = (int)JAVA_DOUBLE.byteSize(); + static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE; + + MemorySegment segmentIn, segmentOut; + long unsafe_addrIn, unsafe_addrOut; + ByteBuffer byteBufferIn, byteBufferOut; + + @Setup + public void setup() { + unsafe_addrIn = unsafe.allocateMemory(ALLOC_SIZE); + unsafe_addrOut = unsafe.allocateMemory(ALLOC_SIZE); + for (int i = 0; i < ELEM_SIZE; i++) { + unsafe.putDouble(unsafe_addrIn + (i * CARRIER_SIZE), i); + } + for (int i = 0; i < ELEM_SIZE; i++) { + unsafe.putDouble(unsafe_addrOut + (i * CARRIER_SIZE), i); + } + segmentIn = MemorySegment.allocateNative(ALLOC_SIZE); + segmentOut = MemorySegment.allocateNative(ALLOC_SIZE); + for (int i = 0; i < ELEM_SIZE; i++) { + MemoryAccess.setDoubleAtIndex(segmentIn, i, i); + } + for (int i = 0; i < ELEM_SIZE; i++) { + MemoryAccess.setDoubleAtIndex(segmentOut, i, i); + } + byteBufferIn = ByteBuffer.allocateDirect(ALLOC_SIZE).order(ByteOrder.nativeOrder()); + byteBufferOut = ByteBuffer.allocateDirect(ALLOC_SIZE).order(ByteOrder.nativeOrder()); + for (int i = 0; i < ELEM_SIZE; i++) { + byteBufferIn.putDouble(i * CARRIER_SIZE , i); + } + for (int i = 0; i < ELEM_SIZE; i++) { + byteBufferOut.putDouble(i * CARRIER_SIZE , i); + } + } + + @TearDown + public void tearDown() { + segmentIn.close(); + segmentOut.close(); + unsafe.invokeCleaner(byteBufferIn); + unsafe.invokeCleaner(byteBufferOut); + unsafe.freeMemory(unsafe_addrIn); + unsafe.freeMemory(unsafe_addrOut); + } + + @Benchmark + public void unsafe_loop() { + for (int i = 0; i < ELEM_SIZE; i ++) { + unsafe.putDouble(unsafe_addrOut + (i * CARRIER_SIZE), + unsafe.getDouble(unsafe_addrIn + (i * CARRIER_SIZE)) + + unsafe.getDouble(unsafe_addrOut + (i * CARRIER_SIZE))); + } + } + + @Benchmark + public void segment_loop() { + for (int i = 0; i < ELEM_SIZE; i ++) { + MemoryAccess.setDoubleAtIndex(segmentOut, i, + MemoryAccess.getDoubleAtIndex(segmentIn, i) + + MemoryAccess.getDoubleAtIndex(segmentOut, i)); + } + } + + @Benchmark + public void BB_loop() { + for (int i = 0; i < ELEM_SIZE; i++) { + byteBufferOut.putDouble(i * CARRIER_SIZE, + byteBufferIn.getDouble(i * CARRIER_SIZE) + + byteBufferOut.getDouble(i * CARRIER_SIZE)); + } + } +} diff --git a/test/micro/org/openjdk/bench/jdk/incubator/foreign/UnrolledAccess.java b/test/micro/org/openjdk/bench/jdk/incubator/foreign/UnrolledAccess.java new file mode 100644 index 0000000000000..8b1374b97a44d --- /dev/null +++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/UnrolledAccess.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020, 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 org.openjdk.bench.jdk.incubator.foreign; + +import static jdk.incubator.foreign.MemoryAccess.*; +import jdk.incubator.foreign.*; +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; +import sun.misc.Unsafe; +import java.util.concurrent.TimeUnit; + +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; +import java.lang.reflect.Field; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MICROSECONDS) +@Fork(3) +public class UnrolledAccess { + + static final Unsafe U = Utils.unsafe; + + final static int SIZE = 1024; + + static final VarHandle LONG_HANDLE = MemoryLayout.ofSequence(SIZE, MemoryLayouts.JAVA_LONG) + .varHandle(long.class, MemoryLayout.PathElement.sequenceElement()); + + @State(Scope.Benchmark) + public static class Data { + + final double[] inputArray; + final double[] outputArray; + final long inputAddress; + final long outputAddress; + final MemorySegment inputSegment; + final MemorySegment outputSegment; + + + public Data() { + this.inputArray = new double[SIZE]; + this.outputArray = new double[SIZE]; + this.inputAddress = U.allocateMemory(8 * SIZE); + this.outputAddress = U.allocateMemory(8 * SIZE); + this.inputSegment = MemoryAddress.ofLong(inputAddress).asSegmentRestricted(8*SIZE); + this.outputSegment = MemoryAddress.ofLong(outputAddress).asSegmentRestricted(8*SIZE); + } + } + + @Benchmark + public void unsafe_loop(Data state) { + final long ia = state.inputAddress; + final long oa = state.outputAddress; + for(int i = 0; i < SIZE; i+=4) { + U.putLong(oa + 8*i, U.getLong(ia + 8*i) + U.getLong(oa + 8*i)); + U.putLong(oa + 8*(i+1), U.getLong(ia + 8*(i+1)) + U.getLong(oa + 8*(i+1))); + U.putLong(oa + 8*(i+2), U.getLong(ia + 8*(i+2)) + U.getLong(oa + 8*(i+2))); + U.putLong(oa + 8*(i+3), U.getLong(ia + 8*(i+3)) + U.getLong(oa + 8*(i+3))); + } + } + + @Benchmark + public void handle_loop(Data state) { + final MemorySegment is = state.inputSegment; + final MemorySegment os = state.outputSegment; + + for(int i = 0; i < SIZE; i+=4) { + LONG_HANDLE.set(os, (long) (i), (long) LONG_HANDLE.get(is, (long) (i)) + (long) LONG_HANDLE.get(os, (long) (i))); + LONG_HANDLE.set(os, (long) (i+1), (long) LONG_HANDLE.get(is, (long) (i+1)) + (long) LONG_HANDLE.get(os, (long) (i+1))); + LONG_HANDLE.set(os, (long) (i+2), (long) LONG_HANDLE.get(is, (long) (i+2)) + (long) LONG_HANDLE.get(os, (long) (i+2))); + LONG_HANDLE.set(os, (long) (i+3), (long) LONG_HANDLE.get(is, (long) (i+3)) + (long) LONG_HANDLE.get(os, (long) (i+3))); + } + } + + @Benchmark + public void static_handle_loop(Data state) { + final MemorySegment is = state.inputSegment; + final MemorySegment os = state.outputSegment; + + for(int i = 0; i < SIZE; i+=4) { + setLongAtIndex(os, i,getLongAtIndex(is, i) + MemoryAccess.getLongAtIndex(os, i)); + setLongAtIndex(os, i+1,getLongAtIndex(is, i+1) + getLongAtIndex(os, i+1)); + setLongAtIndex(os, i+2,getLongAtIndex(is, i+2) + getLongAtIndex(os, i+2)); + setLongAtIndex(os, i+3,getLongAtIndex(is, i+3) + getLongAtIndex(os, i+3)); + } + } +} From 86b65756cbebf1df422b11a72be6c9762b85a702 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Fri, 4 Dec 2020 12:01:53 +0000 Subject: [PATCH 078/504] 8257574: C2: "failed: parsing found no loops but there are some" assert failure Reviewed-by: thartmann, neliasso, chagedorn --- src/hotspot/share/opto/loopnode.cpp | 30 ++++++------ .../TestInfiniteLoopNotInnerMost.java | 46 +++++++++++++++++++ 2 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopNotInnerMost.java diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index dfff14a5d0f1e..0ed49439af000 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -3663,25 +3663,23 @@ bool PhaseIdealLoop::process_expensive_nodes() { #ifdef ASSERT bool PhaseIdealLoop::only_has_infinite_loops() { - for (LoopTreeIterator iter(_ltree_root); !iter.done(); iter.next()) { - IdealLoopTree* lpt = iter.current(); - if (lpt->is_innermost()) { - uint i = 1; - for (; i < C->root()->req(); i++) { - Node* in = C->root()->in(i); - if (in != NULL && - in->Opcode() == Op_Halt && - in->in(0)->is_Proj() && - in->in(0)->in(0)->Opcode() == Op_NeverBranch && - in->in(0)->in(0)->in(0) == lpt->_head) { - break; - } - } - if (i == C->root()->req()) { - return false; + for (IdealLoopTree* l = _ltree_root->_child; l != NULL; l = l->_next) { + uint i = 1; + for (; i < C->root()->req(); i++) { + Node* in = C->root()->in(i); + if (in != NULL && + in->Opcode() == Op_Halt && + in->in(0)->is_Proj() && + in->in(0)->in(0)->Opcode() == Op_NeverBranch && + in->in(0)->in(0)->in(0) == l->_head) { + break; } } + if (i == C->root()->req()) { + return false; + } } + return true; } #endif diff --git a/test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopNotInnerMost.java b/test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopNotInnerMost.java new file mode 100644 index 0000000000000..4e6a897361579 --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestInfiniteLoopNotInnerMost.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, Red Hat, 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 8257574 + * @summary C2: "failed: parsing found no loops but there are some" assert failure + * + * @run main/othervm -Xcomp -XX:CompileOnly=TestInfiniteLoopNotInnerMost::test TestInfiniteLoopNotInnerMost + * + */ +public class TestInfiniteLoopNotInnerMost { + public static void main(String[] args) { + test(false); + } + + private static void test(boolean flag) { + if (flag) { + while (true) { + for (int i = 1; i < 100; i *= 2) { + + } + } + } + } +} From ac54900849304761b8e8a49ed312103eeef92b9c Mon Sep 17 00:00:00 2001 From: Kartik Ohri Date: Fri, 4 Dec 2020 15:15:56 +0000 Subject: [PATCH 079/504] 8257401: Use switch expressions in jdk.internal.net.http and java.net.http Reviewed-by: chegar, dfuchs, pconcannon --- .../internal/net/http/Http1HeaderParser.java | 59 +++++-------------- .../jdk/internal/net/http/Http1Response.java | 11 ++-- .../internal/net/http/Http2Connection.java | 20 ++----- .../jdk/internal/net/http/MultiExchange.java | 11 ++-- .../jdk/internal/net/http/RedirectFilter.java | 54 ++++++----------- .../classes/jdk/internal/net/http/Stream.java | 17 ++---- .../net/http/common/SSLFlowDelegate.java | 12 ++-- .../internal/net/http/frame/DataFrame.java | 13 ++-- .../net/http/frame/FramesEncoder.java | 38 +++++------- .../internal/net/http/frame/HeaderFrame.java | 13 ++-- .../internal/net/http/frame/HeadersFrame.java | 16 +++-- .../internal/net/http/frame/Http2Frame.java | 38 +++++------- .../internal/net/http/frame/PingFrame.java | 9 ++- .../net/http/frame/PushPromiseFrame.java | 13 ++-- .../net/http/frame/SettingsFrame.java | 34 +++++------ .../jdk/internal/net/http/hpack/Decoder.java | 28 +++------ .../net/http/websocket/StatusCodes.java | 30 +++------- 17 files changed, 147 insertions(+), 269 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java index 2674f0c0ff3c6..669c173e3f825 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java @@ -116,42 +116,17 @@ boolean parse(ByteBuffer input) throws ProtocolException { while (canContinueParsing(input)) { switch (state) { - case INITIAL: - state = State.STATUS_LINE; - break; - case STATUS_LINE: - readResumeStatusLine(input); - break; - // fallthrough - case STATUS_LINE_FOUND_CR: - case STATUS_LINE_FOUND_LF: - readStatusLineFeed(input); - break; - case STATUS_LINE_END: - maybeStartHeaders(input); - break; - // fallthrough - case STATUS_LINE_END_CR: - case STATUS_LINE_END_LF: - maybeEndHeaders(input); - break; - case HEADER: - readResumeHeader(input); - break; - // fallthrough - case HEADER_FOUND_CR: - case HEADER_FOUND_LF: - resumeOrLF(input); - break; - case HEADER_FOUND_CR_LF: - resumeOrSecondCR(input); - break; - case HEADER_FOUND_CR_LF_CR: - resumeOrEndHeaders(input); - break; - default: - throw new InternalError( - "Unexpected state: " + String.valueOf(state)); + case INITIAL -> state = State.STATUS_LINE; + case STATUS_LINE -> readResumeStatusLine(input); + case STATUS_LINE_FOUND_CR, STATUS_LINE_FOUND_LF -> readStatusLineFeed(input); + case STATUS_LINE_END -> maybeStartHeaders(input); + case STATUS_LINE_END_CR, STATUS_LINE_END_LF -> maybeEndHeaders(input); + case HEADER -> readResumeHeader(input); + case HEADER_FOUND_CR, HEADER_FOUND_LF -> resumeOrLF(input); + case HEADER_FOUND_CR_LF -> resumeOrSecondCR(input); + case HEADER_FOUND_CR_LF_CR -> resumeOrEndHeaders(input); + + default -> throw new InternalError("Unexpected state: " + state); } } @@ -161,13 +136,11 @@ boolean parse(ByteBuffer input) throws ProtocolException { private boolean canContinueParsing(ByteBuffer buffer) { // some states don't require any input to transition // to the next state. - switch (state) { - case FINISHED: return false; - case STATUS_LINE_FOUND_LF: return true; - case STATUS_LINE_END_LF: return true; - case HEADER_FOUND_LF: return true; - default: return buffer.hasRemaining(); - } + return switch (state) { + case FINISHED -> false; + case STATUS_LINE_FOUND_LF, STATUS_LINE_END_LF, HEADER_FOUND_LF -> true; + default -> buffer.hasRemaining(); + }; } /** diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java index 5cb0b8644076e..8090568c4e451 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java @@ -576,11 +576,12 @@ private State advance(State previous) { } Receiver receiver(State state) { - switch(state) { - case READING_HEADERS: return headersReader; - case READING_BODY: return bodyReader; - default: return null; - } + return switch (state) { + case READING_HEADERS -> headersReader; + case READING_BODY -> bodyReader; + + default -> null; + }; } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java index 9cfc3d3f95ab1..d0a47316970eb 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java @@ -866,20 +866,12 @@ private void handleConnectionFrame(Http2Frame frame) throws IOException { switch (frame.type()) { - case SettingsFrame.TYPE: - handleSettings((SettingsFrame)frame); - break; - case PingFrame.TYPE: - handlePing((PingFrame)frame); - break; - case GoAwayFrame.TYPE: - handleGoAway((GoAwayFrame)frame); - break; - case WindowUpdateFrame.TYPE: - handleWindowUpdate((WindowUpdateFrame)frame); - break; - default: - protocolError(ErrorFrame.PROTOCOL_ERROR); + case SettingsFrame.TYPE -> handleSettings((SettingsFrame) frame); + case PingFrame.TYPE -> handlePing((PingFrame) frame); + case GoAwayFrame.TYPE -> handleGoAway((GoAwayFrame) frame); + case WindowUpdateFrame.TYPE -> handleWindowUpdate((WindowUpdateFrame) frame); + + default -> protocolError(ErrorFrame.PROTOCOL_ERROR); } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index 12eed08a154da..c1f03190380cc 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -476,13 +476,10 @@ private static boolean disableRetryConnect() { /** Returns true is given request has an idempotent method. */ private static boolean isIdempotentRequest(HttpRequest request) { String method = request.method(); - switch (method) { - case "GET" : - case "HEAD" : - return true; - default : - return false; - } + return switch (method) { + case "GET", "HEAD" -> true; + default -> false; + }; } /** Returns true if the given request can be automatically retried. */ diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/RedirectFilter.java b/src/java.net.http/share/classes/jdk/internal/net/http/RedirectFilter.java index 79e2a2fbfc335..32eece7603fe8 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/RedirectFilter.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/RedirectFilter.java @@ -74,19 +74,13 @@ public synchronized HttpRequestImpl response(Response r) throws IOException { } private static String redirectedMethod(int statusCode, String orig) { - switch (statusCode) { - case 301: - case 302: - return orig.equals("POST") ? "GET" : orig; - case 303: - return "GET"; - case 307: - case 308: - return orig; - default: - // unexpected but return orig - return orig; - } + return switch (statusCode) { + case 301, 302 -> orig.equals("POST") ? "GET" : orig; + case 303 -> "GET"; + case 307, 308 -> orig; + + default -> orig; // unexpected but return orig + }; } private static boolean isRedirecting(int statusCode) { @@ -95,23 +89,16 @@ private static boolean isRedirecting(int statusCode) { // 309-399 Unassigned => don't follow // > 399: not a redirect code if (statusCode > 308) return false; - switch (statusCode) { + + return switch (statusCode) { // 300: MultipleChoice => don't follow - case 300: - return false; // 304: Not Modified => don't follow - case 304: - return false; // 305: Proxy Redirect => don't follow. - case 305: - return false; // 306: Unused => don't follow - case 306: - return false; + case 300, 304, 305, 306 -> false; // 301, 302, 303, 307, 308: OK to follow. - default: - return true; - } + default -> true; + }; } /** @@ -158,16 +145,11 @@ private URI getRedirectedURI(HttpHeaders headers) { private boolean canRedirect(URI redir) { String newScheme = redir.getScheme(); String oldScheme = uri.getScheme(); - switch (policy) { - case ALWAYS: - return true; - case NEVER: - return false; - case NORMAL: - return newScheme.equalsIgnoreCase(oldScheme) - || newScheme.equalsIgnoreCase("https"); - default: - throw new InternalError(); - } + return switch (policy) { + case ALWAYS -> true; + case NEVER -> false; + case NORMAL -> newScheme.equalsIgnoreCase(oldScheme) + || newScheme.equalsIgnoreCase("https"); + }; } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java index b288d67ff92a8..1508df73224d6 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java @@ -451,18 +451,11 @@ void incoming(Http2Frame frame) throws IOException { void otherFrame(Http2Frame frame) throws IOException { switch (frame.type()) { - case WindowUpdateFrame.TYPE: - incoming_windowUpdate((WindowUpdateFrame) frame); - break; - case ResetFrame.TYPE: - incoming_reset((ResetFrame) frame); - break; - case PriorityFrame.TYPE: - incoming_priority((PriorityFrame) frame); - break; - default: - String msg = "Unexpected frame: " + frame.toString(); - throw new IOException(msg); + case WindowUpdateFrame.TYPE -> incoming_windowUpdate((WindowUpdateFrame) frame); + case ResetFrame.TYPE -> incoming_reset((ResetFrame) frame); + case PriorityFrame.TYPE -> incoming_priority((PriorityFrame) frame); + + default -> throw new IOException("Unexpected frame: " + frame.toString()); } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java index 573ac85899d5b..a9d3ee967ea42 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java @@ -1021,14 +1021,10 @@ private static String states(AtomicInteger state) { StringBuilder sb = new StringBuilder(); int x = s & ~TASK_BITS; switch (x) { - case NOT_HANDSHAKING: - sb.append(" NOT_HANDSHAKING "); - break; - case HANDSHAKING: - sb.append(" HANDSHAKING "); - break; - default: - throw new InternalError(); + case NOT_HANDSHAKING -> sb.append(" NOT_HANDSHAKING "); + case HANDSHAKING -> sb.append(" HANDSHAKING "); + + default -> throw new InternalError(); } if ((s & DOING_TASKS) > 0) sb.append("|DOING_TASKS"); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/DataFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/DataFrame.java index 4f17547103e3c..635ab44679fd3 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/DataFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/DataFrame.java @@ -71,13 +71,12 @@ int length() { @Override public String flagAsString(int flag) { - switch (flag) { - case END_STREAM: - return "END_STREAM"; - case PADDED: - return "PADDED"; - } - return super.flagAsString(flag); + return switch (flag) { + case END_STREAM -> "END_STREAM"; + case PADDED -> "PADDED"; + + default -> super.flagAsString(flag); + }; } public List getData() { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesEncoder.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesEncoder.java index f94cb20c85249..4fdd4acd6616a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesEncoder.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesEncoder.java @@ -59,30 +59,20 @@ public ByteBuffer encodeConnectionPreface(byte[] preface, SettingsFrame frame) { } public List encodeFrame(Http2Frame frame) { - switch (frame.type()) { - case DataFrame.TYPE: - return encodeDataFrame((DataFrame) frame); - case HeadersFrame.TYPE: - return encodeHeadersFrame((HeadersFrame) frame); - case PriorityFrame.TYPE: - return encodePriorityFrame((PriorityFrame) frame); - case ResetFrame.TYPE: - return encodeResetFrame((ResetFrame) frame); - case SettingsFrame.TYPE: - return encodeSettingsFrame((SettingsFrame) frame); - case PushPromiseFrame.TYPE: - return encodePushPromiseFrame((PushPromiseFrame) frame); - case PingFrame.TYPE: - return encodePingFrame((PingFrame) frame); - case GoAwayFrame.TYPE: - return encodeGoAwayFrame((GoAwayFrame) frame); - case WindowUpdateFrame.TYPE: - return encodeWindowUpdateFrame((WindowUpdateFrame) frame); - case ContinuationFrame.TYPE: - return encodeContinuationFrame((ContinuationFrame) frame); - default: - throw new UnsupportedOperationException("Not supported frame "+frame.type()+" ("+frame.getClass().getName()+")"); - } + return switch (frame.type()) { + case DataFrame.TYPE -> encodeDataFrame((DataFrame) frame); + case HeadersFrame.TYPE -> encodeHeadersFrame((HeadersFrame) frame); + case PriorityFrame.TYPE -> encodePriorityFrame((PriorityFrame) frame); + case ResetFrame.TYPE -> encodeResetFrame((ResetFrame) frame); + case SettingsFrame.TYPE -> encodeSettingsFrame((SettingsFrame) frame); + case PushPromiseFrame.TYPE -> encodePushPromiseFrame((PushPromiseFrame) frame); + case PingFrame.TYPE -> encodePingFrame((PingFrame) frame); + case GoAwayFrame.TYPE -> encodeGoAwayFrame((GoAwayFrame) frame); + case WindowUpdateFrame.TYPE -> encodeWindowUpdateFrame((WindowUpdateFrame) frame); + case ContinuationFrame.TYPE -> encodeContinuationFrame((ContinuationFrame) frame); + + default -> throw new UnsupportedOperationException("Not supported frame " + frame.type() + " (" + frame.getClass().getName() + ")"); + }; } private static final int NO_FLAGS = 0; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeaderFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeaderFrame.java index 44bbace58112a..8a96b97a65630 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeaderFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeaderFrame.java @@ -49,13 +49,12 @@ public HeaderFrame(int streamid, int flags, List headerBlocks) { @Override public String flagAsString(int flag) { - switch (flag) { - case END_HEADERS: - return "END_HEADERS"; - case END_STREAM: - return "END_STREAM"; - } - return super.flagAsString(flag); + return switch (flag) { + case END_HEADERS -> "END_HEADERS"; + case END_STREAM -> "END_STREAM"; + + default -> super.flagAsString(flag); + }; } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeadersFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeadersFrame.java index 6fe08bf9697d6..ab1c6acbd8dd0 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeadersFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/HeadersFrame.java @@ -72,15 +72,13 @@ int length() { @Override public String flagAsString(int flag) { - switch (flag) { - case END_STREAM: - return "END_STREAM"; - case PADDED: - return "PADDED"; - case PRIORITY: - return "PRIORITY"; - } - return super.flagAsString(flag); + return switch (flag) { + case END_STREAM -> "END_STREAM"; + case PADDED -> "PADDED"; + case PRIORITY -> "PRIORITY"; + + default -> super.flagAsString(flag); + }; } public void setPadLength(int padLength) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/Http2Frame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/Http2Frame.java index 3aeb0f4f6727a..36fc0c8dffdda 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/Http2Frame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/Http2Frame.java @@ -80,30 +80,20 @@ int length() { public static String asString(int type) { - switch (type) { - case DataFrame.TYPE: - return "DATA"; - case HeadersFrame.TYPE: - return "HEADERS"; - case ContinuationFrame.TYPE: - return "CONTINUATION"; - case ResetFrame.TYPE: - return "RESET"; - case PriorityFrame.TYPE: - return "PRIORITY"; - case SettingsFrame.TYPE: - return "SETTINGS"; - case GoAwayFrame.TYPE: - return "GOAWAY"; - case PingFrame.TYPE: - return "PING"; - case PushPromiseFrame.TYPE: - return "PUSH_PROMISE"; - case WindowUpdateFrame.TYPE: - return "WINDOW_UPDATE"; - default: - return "UNKNOWN"; - } + return switch (type) { + case DataFrame.TYPE -> "DATA"; + case HeadersFrame.TYPE -> "HEADERS"; + case ContinuationFrame.TYPE -> "CONTINUATION"; + case ResetFrame.TYPE -> "RESET"; + case PriorityFrame.TYPE -> "PRIORITY"; + case SettingsFrame.TYPE -> "SETTINGS"; + case GoAwayFrame.TYPE -> "GOAWAY"; + case PingFrame.TYPE -> "PING"; + case PushPromiseFrame.TYPE -> "PUSH_PROMISE"; + case WindowUpdateFrame.TYPE -> "WINDOW_UPDATE"; + + default -> "UNKNOWN"; + }; } @Override diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/PingFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/PingFrame.java index 34001f3da8c5f..984605dfe6da7 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/PingFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/PingFrame.java @@ -53,11 +53,10 @@ int length() { @Override public String flagAsString(int flag) { - switch (flag) { - case ACK: - return "ACK"; - } - return super.flagAsString(flag); + return switch (flag) { + case ACK -> "ACK"; + default -> super.flagAsString(flag); + }; } public byte[] getData() { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/PushPromiseFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/PushPromiseFrame.java index 7c1d22f1b36ff..13082918936d8 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/PushPromiseFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/PushPromiseFrame.java @@ -65,13 +65,12 @@ public String toString() { @Override public String flagAsString(int flag) { - switch (flag) { - case PADDED: - return "PADDED"; - case END_HEADERS: - return "END_HEADERS"; - } - return super.flagAsString(flag); + return switch (flag) { + case PADDED -> "PADDED"; + case END_HEADERS -> "END_HEADERS"; + + default -> super.flagAsString(flag); + }; } public void setPadLength(int padLength) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java index eef9f615bb3fa..ca68eae8cf684 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java @@ -39,11 +39,10 @@ public class SettingsFrame extends Http2Frame { @Override public String flagAsString(int flag) { - switch (flag) { - case ACK: - return "ACK"; - } - return super.flagAsString(flag); + return switch (flag) { + case ACK -> "ACK"; + default -> super.flagAsString(flag); + }; } @Override @@ -72,21 +71,16 @@ public String toString() { public static final int MAX_HEADER_LIST_SIZE = 0x6; private String name(int i) { - switch (i+1) { - case HEADER_TABLE_SIZE: - return "HEADER_TABLE_SIZE"; - case ENABLE_PUSH: - return "ENABLE_PUSH"; - case MAX_CONCURRENT_STREAMS: - return "MAX_CONCURRENT_STREAMS"; - case INITIAL_WINDOW_SIZE: - return "INITIAL_WINDOW_SIZE"; - case MAX_FRAME_SIZE: - return "MAX_FRAME_SIZE"; - case MAX_HEADER_LIST_SIZE: - return "MAX_HEADER_LIST_SIZE"; - } - return "unknown parameter"; + return switch (i + 1) { + case HEADER_TABLE_SIZE -> "HEADER_TABLE_SIZE"; + case ENABLE_PUSH -> "ENABLE_PUSH"; + case MAX_CONCURRENT_STREAMS -> "MAX_CONCURRENT_STREAMS"; + case INITIAL_WINDOW_SIZE -> "INITIAL_WINDOW_SIZE"; + case MAX_FRAME_SIZE -> "MAX_FRAME_SIZE"; + case MAX_HEADER_LIST_SIZE -> "MAX_HEADER_LIST_SIZE"; + + default -> "unknown parameter"; + }; } public static final int MAX_PARAM = 0x6; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/hpack/Decoder.java b/src/java.net.http/share/classes/jdk/internal/net/http/hpack/Decoder.java index 370677b5e1666..9d57a734ac304 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/hpack/Decoder.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/hpack/Decoder.java @@ -257,26 +257,14 @@ public void decode(ByteBuffer headerBlock, private void proceed(ByteBuffer input, DecodingCallback action) throws IOException { switch (state) { - case READY: - resumeReady(input); - break; - case INDEXED: - resumeIndexed(input, action); - break; - case LITERAL: - resumeLiteral(input, action); - break; - case LITERAL_WITH_INDEXING: - resumeLiteralWithIndexing(input, action); - break; - case LITERAL_NEVER_INDEXED: - resumeLiteralNeverIndexed(input, action); - break; - case SIZE_UPDATE: - resumeSizeUpdate(input, action); - break; - default: - throw new InternalError("Unexpected decoder state: " + state); + case READY -> resumeReady(input); + case INDEXED -> resumeIndexed(input, action); + case LITERAL -> resumeLiteral(input, action); + case LITERAL_WITH_INDEXING -> resumeLiteralWithIndexing(input, action); + case LITERAL_NEVER_INDEXED -> resumeLiteralNeverIndexed(input, action); + case SIZE_UPDATE -> resumeSizeUpdate(input, action); + + default -> throw new InternalError("Unexpected decoder state: " + state); } } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/StatusCodes.java b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/StatusCodes.java index 20110acfa3a4c..f293873ec1d6b 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/StatusCodes.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/StatusCodes.java @@ -49,19 +49,11 @@ static boolean isLegalToSendFromClient(int code) { return false; } // Codes below are not allowed to be sent using a WebSocket client API - switch (code) { - case PROTOCOL_ERROR: - case NOT_CONSISTENT: - case 1003: - case 1009: - case 1010: - case 1012: // code sent by servers - case 1013: // code sent by servers - case 1014: // code sent by servers - return false; - default: - return true; - } + return switch (code) { + // 1012, 1013, 1014: codes sent by servers + case PROTOCOL_ERROR, NOT_CONSISTENT, 1003, 1009, 1010, 1012, 1013, 1014 -> false; + default -> true; + }; } static boolean isLegalToReceiveFromServer(int code) { @@ -84,13 +76,9 @@ private static boolean isLegal(int code) { } // Codes below cannot appear on the wire. It's always an error either // to send a frame with such a code or to receive one. - switch (code) { - case NO_STATUS_CODE: - case CLOSED_ABNORMALLY: - case 1015: - return false; - default: - return true; - } + return switch (code) { + case NO_STATUS_CODE, CLOSED_ABNORMALLY, 1015 -> false; + default -> true; + }; } } From 3eb694605e8d19638f95df597ce9e7eff3c9046f Mon Sep 17 00:00:00 2001 From: Mikhailo Seledtsov Date: Fri, 4 Dec 2020 16:38:21 +0000 Subject: [PATCH 080/504] 8257732: Problem list TestJFRWithJMX for OL 8.2 until the issue is resolved Reviewed-by: hseigel --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 4c45915438d21..4ae9f9c164975 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -87,6 +87,7 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8241293 macosx-x64 runtime/cds/DeterministicDump.java 8253495 generic-all runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64 runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all +containers/docker/TestJFRWithJMX.java 8256417 linux-5.4.17-2011.5.3.el8uek.x86_64 ############################################################################# From d8ac76fa09cbb7d71d928f8d4c24928e3d3fc837 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Fri, 4 Dec 2020 17:07:00 +0000 Subject: [PATCH 081/504] 8257651: LambdaEagerInit.java test failed in 2 different ways Reviewed-by: iklam, lfoltan --- test/hotspot/jtreg/TEST.groups | 1 + test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java | 1 + 2 files changed, 2 insertions(+) diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 7efdfc779492b..1ffd4e5e0491f 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -333,6 +333,7 @@ hotspot_appcds_dynamic = \ -runtime/cds/appcds/DumpClassList.java \ -runtime/cds/appcds/DumpClassListWithLF.java \ -runtime/cds/appcds/ExtraSymbols.java \ + -runtime/cds/appcds/LambdaEagerInit.java \ -runtime/cds/appcds/LambdaProxyClasslist.java \ -runtime/cds/appcds/LongClassListPath.java \ -runtime/cds/appcds/LotsOfClasses.java \ diff --git a/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java b/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java index 79667bc4df1cc..28296d4c90535 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/LambdaEagerInit.java @@ -35,6 +35,7 @@ * from the archive if the property is not set. * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds test-classes + * @compile ../../../../../lib/jdk/test/lib/Asserts.java * @run main/othervm LambdaEagerInit */ From fcc84795f66ce0dee116d5a7f13fe27c5fe4f7d1 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Fri, 4 Dec 2020 18:20:14 +0000 Subject: [PATCH 082/504] 8257724: Incorrect package of the linked class in BaseSSLSocketImpl Reviewed-by: valeriep, wetmore --- .../share/classes/sun/security/ssl/BaseSSLSocketImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java b/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java index d701e403c530a..ba58741d75927 100644 --- a/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2020, 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 @@ -98,8 +98,9 @@ abstract class BaseSSLSocketImpl extends SSLSocket { // /** - * Returns the unique {@link java.nio.SocketChannel SocketChannel} object - * associated with this socket, if any. + * Returns the unique {@link java.nio.channels.SocketChannel SocketChannel} + * object associated with this socket, if any. + * * @see java.net.Socket#getChannel */ @Override From d76039d3dc951f46a45a1ffd1db0f0e0908cfab3 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Fri, 4 Dec 2020 18:29:55 +0000 Subject: [PATCH 083/504] 8257725: No throws of SSLHandshakeException Reviewed-by: jnimeh --- .../share/classes/sun/security/ssl/StatusResponseManager.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java b/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java index 82edec7909760..288f75b268ec6 100644 --- a/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java +++ b/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java @@ -258,9 +258,6 @@ void shutdown() { * * @return an unmodifiable {@code Map} containing the certificate and * its usually - * - * @throws SSLHandshakeException if an unsupported - * {@code CertStatusRequest} is provided. */ Map get(CertStatusRequestType type, CertStatusRequest request, X509Certificate[] chain, long delay, From dd0b9454a20adbe5c002314c6b2c877ae98bae0b Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 4 Dec 2020 19:23:52 +0000 Subject: [PATCH 084/504] 8257531: Super word not applied to a loop of simple Buffer operations Reviewed-by: roland, psandoz --- src/hotspot/share/opto/superword.cpp | 51 ++-- src/hotspot/share/opto/superword.hpp | 20 +- .../TestBufferVectorization.java | 220 ++++++++++++++++++ 3 files changed, 268 insertions(+), 23 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 8c8f47c80a446..b9dfb29dde736 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -645,7 +645,7 @@ void SuperWord::find_adjacent_refs() { create_pack = false; } else { SWPointer p2(best_align_to_mem_ref, this, NULL, false); - if (align_to_ref_p.invar() != p2.invar()) { + if (!align_to_ref_p.invar_equals(p2)) { // Do not vectorize memory accesses with different invariants // if unaligned memory accesses are not allowed. create_pack = false; @@ -3526,6 +3526,11 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { invar = new ConvL2INode(invar); _igvn.register_new_node_with_optimizer(invar); } + Node* invar_scale = align_to_ref_p.invar_scale(); + if (invar_scale != NULL) { + invar = new LShiftINode(invar, invar_scale); + _igvn.register_new_node_with_optimizer(invar); + } Node* aref = new URShiftINode(invar, log2_elt); _igvn.register_new_node_with_optimizer(aref); _phase->set_ctrl(aref, pre_ctrl); @@ -3711,6 +3716,7 @@ int SWPointer::Tracer::_depth = 0; SWPointer::SWPointer(MemNode* mem, SuperWord* slp, Node_Stack *nstack, bool analyze_only) : _mem(mem), _slp(slp), _base(NULL), _adr(NULL), _scale(0), _offset(0), _invar(NULL), _negate_invar(false), + _invar_scale(NULL), _nstack(nstack), _analyze_only(analyze_only), _stack_idx(0) #ifndef PRODUCT @@ -3779,6 +3785,7 @@ SWPointer::SWPointer(MemNode* mem, SuperWord* slp, Node_Stack *nstack, bool anal SWPointer::SWPointer(SWPointer* p) : _mem(p->_mem), _slp(p->_slp), _base(NULL), _adr(NULL), _scale(0), _offset(0), _invar(NULL), _negate_invar(false), + _invar_scale(NULL), _nstack(p->_nstack), _analyze_only(p->_analyze_only), _stack_idx(p->_stack_idx) #ifndef PRODUCT @@ -3896,7 +3903,7 @@ bool SWPointer::scaled_iv(Node* n) { NOT_PRODUCT(_tracer.scaled_iv_7(n);) return true; } - } else if (opc == Op_LShiftL) { + } else if (opc == Op_LShiftL && n->in(2)->is_Con()) { if (!has_iv() && _invar == NULL) { // Need to preserve the current _offset value, so // create a temporary object for this expression subtree. @@ -3906,14 +3913,16 @@ bool SWPointer::scaled_iv(Node* n) { NOT_PRODUCT(_tracer.scaled_iv_8(n, &tmp);) if (tmp.scaled_iv_plus_offset(n->in(1))) { - if (tmp._invar == NULL || _slp->do_vector_loop()) { - int mult = 1 << n->in(2)->get_int(); - _scale = tmp._scale * mult; - _offset += tmp._offset * mult; - _invar = tmp._invar; - NOT_PRODUCT(_tracer.scaled_iv_9(n, _scale, _offset, mult);) - return true; + int scale = n->in(2)->get_int(); + _scale = tmp._scale << scale; + _offset += tmp._offset << scale; + _invar = tmp._invar; + if (_invar != NULL) { + _negate_invar = tmp._negate_invar; + _invar_scale = n->in(2); } + NOT_PRODUCT(_tracer.scaled_iv_9(n, _scale, _offset, _invar, _negate_invar);) + return true; } } } @@ -4012,12 +4021,14 @@ bool SWPointer::offset_plus_k(Node* n, bool negate) { //----------------------------print------------------------ void SWPointer::print() { #ifndef PRODUCT - tty->print("base: %d adr: %d scale: %d offset: %d invar: %c%d\n", + tty->print("base: [%d] adr: [%d] scale: %d offset: %d", _base != NULL ? _base->_idx : 0, _adr != NULL ? _adr->_idx : 0, - _scale, _offset, - _negate_invar?'-':'+', - _invar != NULL ? _invar->_idx : 0); + _scale, _offset); + if (_invar != NULL) { + tty->print(" invar: %c[%d] << [%d]", _negate_invar?'-':'+', _invar->_idx, _invar_scale->_idx); + } + tty->cr(); #endif } @@ -4205,14 +4216,20 @@ void SWPointer::Tracer::scaled_iv_8(Node* n, SWPointer* tmp) { } } -void SWPointer::Tracer::scaled_iv_9(Node* n, int scale, int _offset, int mult) { +void SWPointer::Tracer::scaled_iv_9(Node* n, int scale, int offset, Node* invar, bool negate_invar) { if(_slp->is_trace_alignment()) { - print_depth(); tty->print_cr(" %d SWPointer::scaled_iv: Op_LShiftL PASSED, setting _scale = %d, _offset = %d", n->_idx, scale, _offset); - print_depth(); tty->print_cr(" \\ SWPointer::scaled_iv: in(1) %d is scaled_iv_plus_offset, in(2) %d used to get mult = %d: _scale = %d, _offset = %d", - n->in(1)->_idx, n->in(2)->_idx, mult, scale, _offset); + print_depth(); tty->print_cr(" %d SWPointer::scaled_iv: Op_LShiftL PASSED, setting _scale = %d, _offset = %d", n->_idx, scale, offset); + print_depth(); tty->print_cr(" \\ SWPointer::scaled_iv: in(1) [%d] is scaled_iv_plus_offset, in(2) [%d] used to scale: _scale = %d, _offset = %d", + n->in(1)->_idx, n->in(2)->_idx, scale, offset); + if (invar != NULL) { + print_depth(); tty->print_cr(" \\ SWPointer::scaled_iv: scaled invariant: %c[%d]", (negate_invar?'-':'+'), invar->_idx); + } inc_depth(); inc_depth(); print_depth(); n->in(1)->dump(); print_depth(); n->in(2)->dump(); + if (invar != NULL) { + print_depth(); invar->dump(); + } dec_depth(); dec_depth(); } } diff --git a/src/hotspot/share/opto/superword.hpp b/src/hotspot/share/opto/superword.hpp index b519e516b599d..ddddfc8366375 100644 --- a/src/hotspot/share/opto/superword.hpp +++ b/src/hotspot/share/opto/superword.hpp @@ -579,10 +579,13 @@ class SWPointer { Node* _base; // NULL if unsafe nonheap reference Node* _adr; // address pointer - jint _scale; // multiplier for iv (in bytes), 0 if no loop iv - jint _offset; // constant offset (in bytes) + int _scale; // multiplier for iv (in bytes), 0 if no loop iv + int _offset; // constant offset (in bytes) + Node* _invar; // invariant offset (in bytes), NULL if none bool _negate_invar; // if true then use: (0 - _invar) + Node* _invar_scale; // multiplier for invariant + Node_Stack* _nstack; // stack used to record a swpointer trace of variants bool _analyze_only; // Used in loop unrolling only for swpointer trace uint _stack_idx; // Used in loop unrolling only for swpointer trace @@ -624,17 +627,22 @@ class SWPointer { int scale_in_bytes() { return _scale; } Node* invar() { return _invar; } bool negate_invar() { return _negate_invar; } + Node* invar_scale() { return _invar_scale; } int offset_in_bytes() { return _offset; } int memory_size() { return _mem->memory_size(); } Node_Stack* node_stack() { return _nstack; } // Comparable? + bool invar_equals(SWPointer& q) { + return (_invar == q._invar && + _invar_scale == q._invar_scale && + _negate_invar == q._negate_invar); + } + int cmp(SWPointer& q) { if (valid() && q.valid() && (_adr == q._adr || (_base == _adr && q._base == q._adr)) && - _scale == q._scale && - _invar == q._invar && - _negate_invar == q._negate_invar) { + _scale == q._scale && invar_equals(q)) { bool overlap = q._offset < _offset + memory_size() && _offset < q._offset + q.memory_size(); return overlap ? Equal : (_offset < q._offset ? Less : Greater); @@ -704,7 +712,7 @@ class SWPointer { void scaled_iv_6(Node* n, int scale); void scaled_iv_7(Node* n); void scaled_iv_8(Node* n, SWPointer* tmp); - void scaled_iv_9(Node* n, int _scale, int _offset, int mult); + void scaled_iv_9(Node* n, int _scale, int _offset, Node* _invar, bool _negate_invar); void scaled_iv_10(Node* n); void offset_plus_k_1(Node* n); diff --git a/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java b/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java new file mode 100644 index 0000000000000..6a03b526d2a23 --- /dev/null +++ b/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2020, 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 8257531 + * @summary Test vectorization for Buffer operations. + * @library /test/lib / + * @requires vm.compiler2.enabled & vm.debug == true + * @requires os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" + * @run main compiler.vectorization.TestBufferVectorization array + * @run main compiler.vectorization.TestBufferVectorization arrayOffset + * @run main compiler.vectorization.TestBufferVectorization buffer + * @run main compiler.vectorization.TestBufferVectorization bufferHeap + * @run main compiler.vectorization.TestBufferVectorization bufferDirect + */ + +package compiler.vectorization; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class TestBufferVectorization { + final static int N = 500; + final static int ITER = 1000; + final static IntBuffer buffer = IntBuffer.allocate(N); + final static int offset = buffer.arrayOffset(); + final static IntBuffer heap_buffer_byte_to_int = ByteBuffer.allocate(N * Integer.BYTES).order(ByteOrder.nativeOrder()).asIntBuffer(); + final static IntBuffer direct_buffer_byte_to_int = ByteBuffer.allocateDirect(N * Integer.BYTES).order(ByteOrder.nativeOrder()).asIntBuffer(); + final static String arch = System.getProperty("os.arch"); + + interface Test { + void init(); + void run(); + void verify(); + } + + static class TestArray implements Test { + final int[] array = new int[N]; + + public void init() { + for (int k = 0; k < array.length; k++) { + array[k] = k; + } + } + + public void run() { + for(int k = 0; k < array.length; k++) { + array[k] += 1; + } + } + + public void verify() { + init(); // reset + run(); // run compiled code + for(int k = 0; k < array.length; k++) { + if (array[k] != (k + 1)) { + throw new RuntimeException(" Invalid result: array[" + k + "]: " + array[k] + " != " + (k + 1)); + } + } + } + } + + static class TestArrayOffset implements Test { + final int offset; + final int[] array = new int[N]; + + public TestArrayOffset(int off) { + offset = off; + } + + public void init() { + for (int k = 0; k < array.length; k++) { + array[k] = k; + } + } + + public void run() { + int l = array.length - offset; + for(int k = 0; k < l; k++) { + array[k + offset] += 1; + } + } + + public void verify() { + init(); // reset + run(); // run compiled code + int l = array.length - offset; + for(int k = 0; k < l; k++) { + if (array[k] != (k + 1)) { + throw new RuntimeException(" Invalid result: arrayOffset[" + k + "]: " + array[k] + " != " + (k + 1)); + } + } + for(int k = l; k < array.length; k++) { + if (array[k] != k) { + throw new RuntimeException(" Invalid result: arrayOffset[" + k + "]: " + array[k] + " != " + k); + } + } + } + } + + static class TestBuffer implements Test { + final IntBuffer buffer; + + public TestBuffer(IntBuffer buf) { + buffer = buf; + } + + public void init() { + for (int k = 0; k < buffer.limit(); k++) { + buffer.put(k, k); + } + } + + public void run() { + for (int k = 0; k < buffer.limit(); k++) { + buffer.put(k, buffer.get(k) + 1); + } + } + + public void verify() { + init(); // reset + run(); // run compiled code + for(int k = 0; k < buffer.limit(); k++) { + if (buffer.get(k) != (k + 1)) { + throw new RuntimeException(" Invalid result: buffer.get(" + k + "): " + buffer.get(k) + " != " + (k + 1)); + } + } + } + } + + public static void main(String[] args) { + if (args.length == 0) { + throw new RuntimeException(" Missing test name: array, arrayOffset, buffer, bufferHeap, bufferDirect"); + } + + Test te; + switch (args[0]) { + case "array": + te = new TestArray(); + break; + case "arrayOffset": + te = new TestArrayOffset(offset); + break; + case "buffer": + te = new TestBuffer(buffer); + break; + case "bufferHeap": + te = new TestBuffer(heap_buffer_byte_to_int); + break; + case "bufferDirect": + te = new TestBuffer(direct_buffer_byte_to_int); + break; + default: + throw new RuntimeException(" Unknown test: " + args[0]); + } + + te.init(); + for (int i = 0; i < ITER; i++) { + te.run(); + } + te.verify(); + + if (args.length == 1) { + verify_vectors(te, args[0]); + } + } + + static void verify_vectors(Test t, String testName) { + if (testName.equals("bufferDirect")) { + return; // bufferDirect uses Unsafe memory accesses which are not vectorized currently + } + + if (testName.equals("bufferHeap") && (arch.equals("x86") || arch.equals("i386"))) { + return; // bufferHeap uses Long type for memory accesses which are not vectorized in 32-bit VM + } + + ProcessBuilder pb; + OutputAnalyzer out; + try { + pb = ProcessTools.createJavaProcessBuilder("-XX:-BackgroundCompilation", + "-XX:+TraceNewVectors", + "compiler.vectorization.TestBufferVectorization", + testName, + "skip_verify"); + out = new OutputAnalyzer(pb.start()); + } catch (Exception e) { + throw new RuntimeException(" Exception launching Java process: " + e); + } + out.shouldContain("ReplicateI"); + out.shouldContain("LoadVector"); + out.shouldContain("AddVI"); + out.shouldContain("StoreVector"); + out.shouldHaveExitValue(0); + } +} From e27ea4d12ca4e7a4fae2f4f85ee0f00bd200c903 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 4 Dec 2020 20:32:07 +0000 Subject: [PATCH 085/504] 8257750: writeBuffer field of java.io.DataOutputStream should be final Reviewed-by: lancea, naoto --- src/java.base/share/classes/java/io/DataOutputStream.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/java/io/DataOutputStream.java b/src/java.base/share/classes/java/io/DataOutputStream.java index e5c90a257f975..9a9a687403cb8 100644 --- a/src/java.base/share/classes/java/io/DataOutputStream.java +++ b/src/java.base/share/classes/java/io/DataOutputStream.java @@ -50,6 +50,8 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput { */ private byte[] bytearr = null; + private final byte[] writeBuffer = new byte[8]; + /** * Creates a new data output stream to write data to the specified * underlying output stream. The counter {@code written} is @@ -207,8 +209,6 @@ public final void writeInt(int v) throws IOException { incCount(4); } - private byte writeBuffer[] = new byte[8]; - /** * Writes a {@code long} to the underlying output stream as eight * bytes, high byte first. In no exception is thrown, the counter From 51d325e613bfcf7f8016ba6d8b146afec6f0f85c Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 4 Dec 2020 21:40:39 +0000 Subject: [PATCH 086/504] 8257633: Missing -mmacosx-version-min=X flag when linking libjvm Reviewed-by: mikael --- make/autoconf/flags-ldflags.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index 5867ea1d5ce04..ed6726b1e2af9 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -106,7 +106,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], # Assume clang or gcc. # FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead. OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.." - OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN" + OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN" fi fi @@ -203,14 +203,14 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP], # Export variables according to old definitions, prefix with $2 if present. LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \ - $OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}" + $OS_LDFLAGS $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}" $2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \ ${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS \ $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" $2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \ ${$1_CPU_EXECUTABLE_LDFLAGS} $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" - $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \ + $2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS $OS_LDFLAGS_JVM_ONLY \ $DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \ ${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS} \ $REPRODUCIBLE_LDFLAGS $FILE_MACRO_LDFLAGS" From d3ac1bf16c2e6ffc1f5b1759631750cb7eac2e17 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 4 Dec 2020 23:06:07 +0000 Subject: [PATCH 087/504] 8198390: Test MultiResolutionDrawImageWithTransformTest.java fails when -esa is passed Reviewed-by: kizune --- src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java | 2 -- test/jdk/ProblemList.txt | 1 - .../MultiResolutionDrawImageWithTransformTest.java | 5 ++--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java index e67b8a588d892..eb88a3bfacb44 100644 --- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java +++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java @@ -3180,8 +3180,6 @@ private Boolean drawHiDPIImage(Image img, if (xform != null) { assert dx1 == 0 && dy1 == 0; - assert dx2 == img.getWidth(observer); - assert dy2 == img.getHeight(observer); AffineTransform renderTX = new AffineTransform(xform); renderTX.scale(1 / widthScale, 1 / heightScale); return transformImage(img, renderTX, observer); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 0bd8eb8f5ab6f..c26ad9b9d4337 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -252,7 +252,6 @@ java/awt/FontMetrics/FontCrash.java 8198336 windows-all java/awt/image/BufferedImage/ICMColorDataTest/ICMColorDataTest.java 8233028 generic-all java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java 8056077 linux-all java/awt/image/DrawImage/BlitRotateClippedArea.java 8255724 linux-all -java/awt/image/MultiResolutionImage/MultiResolutionDrawImageWithTransformTest.java 8198390 generic-all java/awt/image/multiresolution/MultiresolutionIconTest.java 8169187 macosx-all,windows-all java/awt/print/Headless/HeadlessPrinterJob.java 8196088 windows-all java/awt/print/PrinterJob/TestPgfmtSetMPA.java 8198343 generic-all diff --git a/test/jdk/java/awt/image/MultiResolutionImage/MultiResolutionDrawImageWithTransformTest.java b/test/jdk/java/awt/image/MultiResolutionImage/MultiResolutionDrawImageWithTransformTest.java index aa4a932d28179..64ab3457e2707 100644 --- a/test/jdk/java/awt/image/MultiResolutionImage/MultiResolutionDrawImageWithTransformTest.java +++ b/test/jdk/java/awt/image/MultiResolutionImage/MultiResolutionDrawImageWithTransformTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,8 +42,7 @@ /** * @test - * @bug 8073320 - * @author Alexander Scherbatiy + * @bug 8073320 8198390 * @summary Windows HiDPI support * @modules java.desktop/sun.java2d java.desktop/sun.java2d.loops * @run main MultiResolutionDrawImageWithTransformTest From c4339c3064190bd10fdba64f85a501a2f3d52685 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Sat, 5 Dec 2020 08:44:22 +0000 Subject: [PATCH 088/504] 8243614: Typo in ReentrantLock's Javadoc Reviewed-by: dholmes, alanb --- .../share/classes/java/util/concurrent/locks/ReentrantLock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java index 415e50e29c2f6..be46131d3e24d 100644 --- a/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java +++ b/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java @@ -84,7 +84,7 @@ * try { * // ... method body * } finally { - * lock.unlock() + * lock.unlock(); * } * } * }} From 78be334c3817a1b5840922a9bf1339a40dcc5185 Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Sat, 5 Dec 2020 23:47:35 +0000 Subject: [PATCH 089/504] 8242332: Add SHA3 support to SunPKCS11 provider Reviewed-by: xuelei --- .../sun/security/pkcs11/P11Digest.java | 9 +- .../sun/security/pkcs11/P11KeyGenerator.java | 209 +++++++++--- .../classes/sun/security/pkcs11/P11Mac.java | 9 +- .../sun/security/pkcs11/P11PSSSignature.java | 153 ++++++--- .../sun/security/pkcs11/P11Signature.java | 152 ++++----- .../sun/security/pkcs11/SunPKCS11.java | 115 ++++++- .../wrapper/CK_RSA_PKCS_PSS_PARAMS.java | 9 +- .../KeyGenerator/HmacDefKeySizeTest.java | 84 +++++ .../pkcs11/KeyGenerator/TestKeyGenerator.java | 14 +- .../sun/security/pkcs11/Mac/MacSameTest.java | 38 ++- .../sun/security/pkcs11/Mac/ReinitMac.java | 52 ++- .../pkcs11/MessageDigest/ByteBuffers.java | 20 +- .../pkcs11/MessageDigest/ReinitDigest.java | 38 ++- .../pkcs11/MessageDigest/TestCloning.java | 43 +-- .../pkcs11/Signature/ByteBuffers.java | 6 +- .../pkcs11/Signature/InitAgainPSS.java | 14 +- .../Signature/KeyAndParamCheckForPSS.java | 30 +- .../pkcs11/Signature/ReinitSignature.java | 305 +----------------- .../pkcs11/Signature/SigInteropPSS.java | 4 +- .../pkcs11/Signature/SigInteropPSS2.java | 98 ++++++ .../pkcs11/Signature/SignatureTestPSS.java | 27 +- .../pkcs11/Signature/SignatureTestPSS2.java | 140 ++++++++ .../security/pkcs11/Signature/TestDSA2.java | 51 +-- .../pkcs11/Signature/TestRSAKeyLength.java | 15 +- test/jdk/sun/security/pkcs11/nss/p11-nss.txt | 21 +- 25 files changed, 1037 insertions(+), 619 deletions(-) create mode 100644 test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java create mode 100644 test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java create mode 100644 test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS2.java diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java index 41fe61b8a1626..daf0bc9f69cce 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Digest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -41,7 +41,8 @@ /** * MessageDigest implementation class. This class currently supports - * MD2, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512. + * MD2, MD5, SHA-1, SHA-2 family (SHA-224, SHA-256, SHA-384, and SHA-512) + * and SHA-3 family (SHA3-224, SHA3-256, SHA3-384, and SHA3-512) of digests. * * Note that many digest operations are on fairly small amounts of data * (less than 100 bytes total). For example, the 2nd hashing in HMAC or @@ -104,16 +105,20 @@ final class P11Digest extends MessageDigestSpi implements Cloneable, break; case (int)CKM_SHA224: case (int)CKM_SHA512_224: + case (int)CKM_SHA3_224: digestLength = 28; break; case (int)CKM_SHA256: case (int)CKM_SHA512_256: + case (int)CKM_SHA3_256: digestLength = 32; break; case (int)CKM_SHA384: + case (int)CKM_SHA3_384: digestLength = 48; break; case (int)CKM_SHA512: + case (int)CKM_SHA3_512: digestLength = 64; break; default: diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java index 4df62de6db1ec..72963628b5977 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,7 +36,9 @@ /** * KeyGenerator implementation class. This class currently supports - * DES, DESede, AES, ARCFOUR, and Blowfish. + * DES, DESede, AES, ARCFOUR, Blowfish, Hmac using MD5, SHA, SHA-2 family + * (SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256), and SHA-3 + * family (SHA3-224, SHA3-256, SHA3-384, SHA3-512) of digests. * * @author Andreas Sterbenz * @since 1.5 @@ -65,6 +67,48 @@ final class P11KeyGenerator extends KeyGeneratorSpi { // are supported. private boolean supportBothKeySizes; + // for determining if the specified key size is valid + private final CK_MECHANISM_INFO range; + + // utility method for query the native key sizes and enforcing the + // java-specific lower limit; returned values are in bits + private static CK_MECHANISM_INFO getSupportedRange(Token token, + long mech) throws ProviderException { + // No need to query for fix-length algorithms + if (mech == CKM_DES_KEY_GEN || mech == CKM_DES2_KEY_GEN || + mech == CKM_DES3_KEY_GEN) { + return null; + } + + // Explicitly disallow keys shorter than 40-bits for security + int lower = 40; + int upper = Integer.MAX_VALUE; + try { + CK_MECHANISM_INFO info = token.getMechanismInfo(mech); + if (info != null) { + boolean isBytes = ((mech != CKM_GENERIC_SECRET_KEY_GEN + && mech != CKM_RC4_KEY_GEN) || info.iMinKeySize < 8); + lower = Math.max(lower, (isBytes? + Math.multiplyExact(info.iMinKeySize, 8) : + info.iMinKeySize)); + // NSS CKM_GENERIC_SECRET_KEY_GEN mech info is not precise; + // its upper limit is too low and does not match its impl + if (mech == CKM_GENERIC_SECRET_KEY_GEN && + info.iMaxKeySize <= 32) { + // ignore and leave upper limit at MAX_VALUE; + } else if (info.iMaxKeySize != Integer.MAX_VALUE) { + upper = (isBytes? + Math.multiplyExact(info.iMaxKeySize, 8) : + info.iMaxKeySize); + } + } + } catch (PKCS11Exception p11e) { + // Should never happen + throw new ProviderException("Cannot retrieve mechanism info", p11e); + } + return new CK_MECHANISM_INFO(lower, upper, 0 /* flags not used */); + } + /** * Utility method for checking if the specified key size is valid * and within the supported range. Return the significant key size @@ -78,8 +122,15 @@ final class P11KeyGenerator extends KeyGeneratorSpi { * @throws ProviderException if this mechanism isn't supported by SunPKCS11 * or underlying native impl. */ + // called by P11SecretKeyFactory to check key size static int checkKeySize(long keyGenMech, int keySize, Token token) throws InvalidAlgorithmParameterException, ProviderException { + CK_MECHANISM_INFO range = getSupportedRange(token, keyGenMech); + return checkKeySize(keyGenMech, keySize, range); + } + + private static int checkKeySize(long keyGenMech, int keySize, + CK_MECHANISM_INFO range) throws InvalidAlgorithmParameterException { int sigKeySize; switch ((int)keyGenMech) { case (int)CKM_DES_KEY_GEN: @@ -102,45 +153,17 @@ static int checkKeySize(long keyGenMech, int keySize, Token token) break; default: // Handle all variable-key-length algorithms here - CK_MECHANISM_INFO info = null; - try { - info = token.getMechanismInfo(keyGenMech); - } catch (PKCS11Exception p11e) { - // Should never happen - throw new ProviderException - ("Cannot retrieve mechanism info", p11e); - } - if (info == null) { - // XXX Unable to retrieve the supported key length from - // the underlying native impl. Skip the checking for now. - return keySize; - } - // PKCS#11 defines these to be in number of bytes except for - // RC4 which is in bits. However, some PKCS#11 impls still use - // bytes for all mechs, e.g. NSS. We try to detect this - // inconsistency if the minKeySize seems unreasonably small. - int minKeySize = info.iMinKeySize; - int maxKeySize = info.iMaxKeySize; - if (keyGenMech != CKM_RC4_KEY_GEN || minKeySize < 8) { - minKeySize = Math.multiplyExact(minKeySize, 8); - if (maxKeySize != Integer.MAX_VALUE) { - maxKeySize = Math.multiplyExact(maxKeySize, 8); - } - } - // Explicitly disallow keys shorter than 40-bits for security - if (minKeySize < 40) minKeySize = 40; - if (keySize < minKeySize || keySize > maxKeySize) { + if (range != null && keySize < range.iMinKeySize + || keySize > range.iMaxKeySize) { throw new InvalidAlgorithmParameterException - ("Key length must be between " + minKeySize + - " and " + maxKeySize + " bits"); + ("Key length must be between " + range.iMinKeySize + + " and " + range.iMaxKeySize + " bits"); } if (keyGenMech == CKM_AES_KEY_GEN) { if ((keySize != 128) && (keySize != 192) && (keySize != 256)) { throw new InvalidAlgorithmParameterException - ("AES key length must be " + minKeySize + - (maxKeySize >= 192? ", 192":"") + - (maxKeySize >= 256? ", or 256":"") + " bits"); + ("AES key length must be 128, 192, or 256 bits"); } } sigKeySize = keySize; @@ -148,6 +171,20 @@ static int checkKeySize(long keyGenMech, int keySize, Token token) return sigKeySize; } + // check the supplied keysize (in bits) and adjust it based on the given + // range + private static int adjustKeySize(int ks, CK_MECHANISM_INFO mi) { + // adjust to fit within the supported range + if (mi != null) { + if (ks < mi.iMinKeySize) { + ks = mi.iMinKeySize; + } else if (ks > mi.iMaxKeySize) { + ks = mi.iMaxKeySize; + } + } + return ks; + } + P11KeyGenerator(Token token, String algorithm, long mechanism) throws PKCS11Exception { super(); @@ -164,50 +201,118 @@ static int checkKeySize(long keyGenMech, int keySize, Token token) (token.provider.config.isEnabled(CKM_DES2_KEY_GEN) && (token.getMechanismInfo(CKM_DES2_KEY_GEN) != null)); } - setDefaultKeySize(); + this.range = getSupportedRange(token, mechanism); + setDefault(); } - // set default keysize and also initialize keyType - private void setDefaultKeySize() { + // set default keysize and keyType + private void setDefault() { + significantKeySize = -1; switch ((int)mechanism) { case (int)CKM_DES_KEY_GEN: keySize = 64; keyType = CKK_DES; + significantKeySize = 56; break; case (int)CKM_DES2_KEY_GEN: keySize = 128; keyType = CKK_DES2; + significantKeySize = 112; break; case (int)CKM_DES3_KEY_GEN: keySize = 192; keyType = CKK_DES3; + significantKeySize = 168; break; case (int)CKM_AES_KEY_GEN: - keySize = 128; + keySize = adjustKeySize(128, range); keyType = CKK_AES; break; case (int)CKM_RC4_KEY_GEN: - keySize = 128; + keySize = adjustKeySize(128, range); keyType = CKK_RC4; break; case (int)CKM_BLOWFISH_KEY_GEN: - keySize = 128; + keySize = adjustKeySize(128, range); keyType = CKK_BLOWFISH; break; + case (int)CKM_SHA_1_KEY_GEN: + keySize = adjustKeySize(160, range); + keyType = CKK_SHA_1_HMAC; + break; + case (int)CKM_SHA224_KEY_GEN: + keySize = adjustKeySize(224, range); + keyType = CKK_SHA224_HMAC; + break; + case (int)CKM_SHA256_KEY_GEN: + keySize = adjustKeySize(256, range); + keyType = CKK_SHA256_HMAC; + break; + case (int)CKM_SHA384_KEY_GEN: + keySize = adjustKeySize(384, range); + keyType = CKK_SHA384_HMAC; + break; + case (int)CKM_SHA512_KEY_GEN: + keySize = adjustKeySize(512, range); + keyType = CKK_SHA512_HMAC; + break; + case (int)CKM_SHA512_224_KEY_GEN: + keySize = adjustKeySize(224, range); + keyType = CKK_SHA512_224_HMAC; + break; + case (int)CKM_SHA512_256_KEY_GEN: + keySize = adjustKeySize(256, range); + keyType = CKK_SHA512_256_HMAC; + break; + case (int)CKM_SHA3_224_KEY_GEN: + keySize = adjustKeySize(224, range); + keyType = CKK_SHA3_224_HMAC; + break; + case (int)CKM_SHA3_256_KEY_GEN: + keySize = adjustKeySize(256, range); + keyType = CKK_SHA3_256_HMAC; + break; + case (int)CKM_SHA3_384_KEY_GEN: + keySize = adjustKeySize(384, range); + keyType = CKK_SHA3_384_HMAC; + break; + case (int)CKM_SHA3_512_KEY_GEN: + keySize = adjustKeySize(512, range); + keyType = CKK_SHA3_512_HMAC; + break; + case (int)CKM_GENERIC_SECRET_KEY_GEN: + if (algorithm.startsWith("Hmac")) { + String digest = algorithm.substring(4); + keySize = adjustKeySize(switch (digest) { + case "MD5" -> 512; + case "SHA1" -> 160; + case "SHA224", "SHA512/224", "SHA3-224" -> 224; + case "SHA256", "SHA512/256", "SHA3-256" -> 256; + case "SHA384", "SHA3-384" -> 384; + case "SHA512", "SHA3-512" -> 512; + default -> { + throw new ProviderException("Unsupported algorithm " + + algorithm); + } + }, range); + } else { + throw new ProviderException("Unsupported algorithm " + + algorithm); + } + keyType = CKK_GENERIC_SECRET; + break; default: throw new ProviderException("Unknown mechanism " + mechanism); } - try { - significantKeySize = checkKeySize(mechanism, keySize, token); - } catch (InvalidAlgorithmParameterException iape) { - throw new ProviderException("Unsupported default key size", iape); + if (significantKeySize == -1) { + significantKeySize = keySize; } } // see JCE spec protected void engineInit(SecureRandom random) { token.ensureValid(); - setDefaultKeySize(); + setDefault(); } // see JCE spec @@ -222,7 +327,7 @@ protected void engineInit(int keySize, SecureRandom random) { token.ensureValid(); int newSignificantKeySize; try { - newSignificantKeySize = checkKeySize(mechanism, keySize, token); + newSignificantKeySize = checkKeySize(mechanism, keySize, range); } catch (InvalidAlgorithmParameterException iape) { throw (InvalidParameterException) (new InvalidParameterException().initCause(iape)); @@ -254,10 +359,11 @@ protected SecretKey engineGenerateKey() { try { session = token.getObjSession(); CK_ATTRIBUTE[] attributes; - switch ((int)keyType) { - case (int)CKK_DES: - case (int)CKK_DES2: - case (int)CKK_DES3: + + switch ((int)mechanism) { + case (int)CKM_DES_KEY_GEN: + case (int)CKM_DES2_KEY_GEN: + case (int)CKM_DES3_KEY_GEN: // fixed length, do not specify CKA_VALUE_LEN attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_CLASS, CKO_SECRET_KEY), @@ -282,5 +388,4 @@ protected SecretKey engineGenerateKey() { token.releaseSession(session); } } - } diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java index 634e0855f0637..0671ce9dc40e8 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Mac.java @@ -39,8 +39,9 @@ /** * MAC implementation class. This class currently supports HMAC using - * MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 and the SSL3 MAC - * using MD5 and SHA-1. + * MD5, SHA-1, SHA-2 family (SHA-224, SHA-256, SHA-384, and SHA-512), + * SHA-3 family (SHA3-224, SHA3-256, SHA3-384, and SHA3-512), and the + * SSL3 MAC using MD5 and SHA-1. * * Note that unlike other classes (e.g. Signature), this does not * composite various operations if the token only supports part of the @@ -92,16 +93,20 @@ final class P11Mac extends MacSpi { break; case (int)CKM_SHA224_HMAC: case (int)CKM_SHA512_224_HMAC: + case (int)CKM_SHA3_224_HMAC: macLength = 28; break; case (int)CKM_SHA256_HMAC: case (int)CKM_SHA512_256_HMAC: + case (int)CKM_SHA3_256_HMAC: macLength = 32; break; case (int)CKM_SHA384_HMAC: + case (int)CKM_SHA3_384_HMAC: macLength = 48; break; case (int)CKM_SHA512_HMAC: + case (int)CKM_SHA3_512_HMAC: macLength = 64; break; case (int)CKM_SSL3_MD5_MAC: diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java index 0a470b932748f..14b6110dfb3cf 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java @@ -38,6 +38,7 @@ import java.security.spec.PSSParameterSpec; import java.security.interfaces.*; import sun.security.pkcs11.wrapper.*; +import sun.security.util.KnownOIDs; import static sun.security.pkcs11.wrapper.PKCS11Constants.*; @@ -52,6 +53,10 @@ * . SHA256withRSASSA-PSS * . SHA384withRSASSA-PSS * . SHA512withRSASSA-PSS + * . SHA3-224withRSASSA-PSS + * . SHA3-256withRSASSA-PSS + * . SHA3-384withRSASSA-PSS + * . SHA3-512withRSASSA-PSS * * Note that the underlying PKCS#11 token may support complete signature * algorithm (e.g. CKM__RSA_PKCS_PSS), or it may just @@ -71,20 +76,28 @@ final class P11PSSSignature extends SignatureSpi { static { DIGEST_LENGTHS.put("SHA-1", 20); - DIGEST_LENGTHS.put("SHA", 20); - DIGEST_LENGTHS.put("SHA1", 20); DIGEST_LENGTHS.put("SHA-224", 28); - DIGEST_LENGTHS.put("SHA224", 28); DIGEST_LENGTHS.put("SHA-256", 32); - DIGEST_LENGTHS.put("SHA256", 32); DIGEST_LENGTHS.put("SHA-384", 48); - DIGEST_LENGTHS.put("SHA384", 48); DIGEST_LENGTHS.put("SHA-512", 64); - DIGEST_LENGTHS.put("SHA512", 64); DIGEST_LENGTHS.put("SHA-512/224", 28); - DIGEST_LENGTHS.put("SHA512/224", 28); DIGEST_LENGTHS.put("SHA-512/256", 32); - DIGEST_LENGTHS.put("SHA512/256", 32); + DIGEST_LENGTHS.put("SHA3-224", 28); + DIGEST_LENGTHS.put("SHA3-256", 32); + DIGEST_LENGTHS.put("SHA3-384", 48); + DIGEST_LENGTHS.put("SHA3-512", 64); + } + + // utility method for looking up the std digest algorithms + private static String toStdName(String givenDigestAlg) { + if (givenDigestAlg == null) return null; + + KnownOIDs given2 = KnownOIDs.findMatch(givenDigestAlg); + if (given2 == null) { + return givenDigestAlg; + } else { + return given2.stdName(); + } } // utility method for comparing digest algorithms @@ -92,24 +105,8 @@ final class P11PSSSignature extends SignatureSpi { private static boolean isDigestEqual(String stdAlg, String givenAlg) { if (stdAlg == null || givenAlg == null) return false; - if (givenAlg.indexOf("-") != -1) { - return stdAlg.equalsIgnoreCase(givenAlg); - } else { - if (stdAlg.equals("SHA-1")) { - return (givenAlg.equalsIgnoreCase("SHA") - || givenAlg.equalsIgnoreCase("SHA1")); - } else { - StringBuilder sb = new StringBuilder(givenAlg); - // case-insensitive check - if (givenAlg.regionMatches(true, 0, "SHA", 0, 3)) { - givenAlg = sb.insert(3, "-").toString(); - return stdAlg.equalsIgnoreCase(givenAlg); - } else { - throw new ProviderException("Unsupported digest algorithm " - + givenAlg); - } - } - } + givenAlg = toStdName(givenAlg); + return stdAlg.equalsIgnoreCase(givenAlg); } // token instance @@ -172,26 +169,57 @@ private static boolean isDigestEqual(String stdAlg, String givenAlg) { this.algorithm = algorithm; this.mechanism = new CK_MECHANISM(mechId); int idx = algorithm.indexOf("with"); - this.mdAlg = (idx == -1? null : algorithm.substring(0, idx)); + // convert to stdName + this.mdAlg = (idx == -1? + null : toStdName(algorithm.substring(0, idx))); + switch ((int)mechId) { case (int)CKM_SHA1_RSA_PKCS_PSS: case (int)CKM_SHA224_RSA_PKCS_PSS: case (int)CKM_SHA256_RSA_PKCS_PSS: case (int)CKM_SHA384_RSA_PKCS_PSS: case (int)CKM_SHA512_RSA_PKCS_PSS: + case (int)CKM_SHA3_224_RSA_PKCS_PSS: + case (int)CKM_SHA3_256_RSA_PKCS_PSS: + case (int)CKM_SHA3_384_RSA_PKCS_PSS: + case (int)CKM_SHA3_512_RSA_PKCS_PSS: type = T_UPDATE; + this.md = null; break; case (int)CKM_RSA_PKCS_PSS: + // check if the digest algo is supported by underlying PKCS11 lib + if (this.mdAlg != null && token.getMechanismInfo + (Functions.getHashMechId(this.mdAlg)) == null) { + throw new NoSuchAlgorithmException("Unsupported algorithm: " + + algorithm); + } + this.md = (this.mdAlg == null? null : + MessageDigest.getInstance(this.mdAlg)); type = T_DIGEST; break; default: throw new ProviderException("Unsupported mechanism: " + mechId); } - this.md = null; + } + + private static PSSParameterSpec genDefaultParams(String digestAlg, + P11Key key) throws SignatureException { + int mdLen; + try { + mdLen = DIGEST_LENGTHS.get(digestAlg); + } catch (NullPointerException npe) { + throw new SignatureException("Unsupported digest: " + + digestAlg); + } + int saltLen = Integer.min(mdLen, (key.length() >> 3) - mdLen -2); + return new PSSParameterSpec(digestAlg, + "MGF1", new MGF1ParameterSpec(digestAlg), + saltLen, PSSParameterSpec.TRAILER_FIELD_BC); } private void ensureInitialized() throws SignatureException { token.ensureValid(); + if (this.p11Key == null) { throw new SignatureException("Missing key"); } @@ -200,20 +228,19 @@ private void ensureInitialized() throws SignatureException { // PSS Parameters are required for signature verification throw new SignatureException ("Parameters required for RSASSA-PSS signature"); - } else { - int saltLen = DIGEST_LENGTHS.get(this.mdAlg).intValue(); - // generate default params for both sign and verify? - this.sigParams = new PSSParameterSpec(this.mdAlg, - "MGF1", new MGF1ParameterSpec(this.mdAlg), - saltLen, PSSParameterSpec.TRAILER_FIELD_BC); - this.mechanism.setParameter(new CK_RSA_PKCS_PSS_PARAMS( - this.mdAlg, "MGF1", this.mdAlg, - DIGEST_LENGTHS.get(this.mdAlg).intValue())); } + // generate default params for both sign and verify? + this.sigParams = genDefaultParams(this.mdAlg, this.p11Key); + this.mechanism.setParameter(new CK_RSA_PKCS_PSS_PARAMS( + this.mdAlg, "MGF1", this.mdAlg, sigParams.getSaltLength())); } if (initialized == false) { - initialize(); + try { + initialize(); + } catch (ProviderException pe) { + throw new SignatureException(pe); + } } } @@ -279,7 +306,7 @@ private void cancelOperation() { } // assumes current state is initialized == false - private void initialize() { + private void initialize() throws ProviderException { if (DEBUG) System.out.println("Initializing"); if (p11Key == null) { @@ -356,7 +383,8 @@ private void checkKeySize(Key key) throws InvalidKeyException { if (this.sigParams != null) { String digestAlg = this.sigParams.getDigestAlgorithm(); int sLen = this.sigParams.getSaltLength(); - int hLen = DIGEST_LENGTHS.get(digestAlg).intValue(); + + int hLen = DIGEST_LENGTHS.get(toStdName(digestAlg)).intValue(); int minKeyLen = Math.addExact(Math.addExact(sLen, hLen), 2); if (keySize < minKeyLen) { @@ -380,12 +408,24 @@ private void setSigParams(AlgorithmParameterSpec p) if (params == this.sigParams) return; String digestAlgorithm = params.getDigestAlgorithm(); - if (this.mdAlg != null && !isDigestEqual(digestAlgorithm, this.mdAlg)) { + if (this.mdAlg != null && !isDigestEqual(this.mdAlg, digestAlgorithm)) { throw new InvalidAlgorithmParameterException ("Digest algorithm in Signature parameters must be " + this.mdAlg); } - Integer digestLen = DIGEST_LENGTHS.get(digestAlgorithm); + + try { + if (token.getMechanismInfo(Functions.getHashMechId + (digestAlgorithm)) == null) { + throw new InvalidAlgorithmParameterException + ("Unsupported digest algorithm: " + digestAlgorithm); + } + } catch (PKCS11Exception pe) { + // should not happen + throw new InvalidAlgorithmParameterException(pe); + } + + Integer digestLen = DIGEST_LENGTHS.get(toStdName(digestAlgorithm)); if (digestLen == null) { throw new InvalidAlgorithmParameterException ("Unsupported digest algorithm in Signature parameters: " + @@ -458,8 +498,14 @@ protected void engineInitVerify(PublicKey publicKey) mode = M_VERIFY; p11Key = P11KeyFactory.convertKey(token, publicKey, KEY_ALGO); - // For PSS, defer PKCS11 initialization calls to update/doFinal as it - // needs both key and params + // attempt initialization when key and params are both available + if (this.p11Key != null && this.sigParams != null) { + try { + initialize(); + } catch (ProviderException pe) { + throw new InvalidKeyException(pe); + } + } } // see JCA spec @@ -480,8 +526,14 @@ protected void engineInitSign(PrivateKey privateKey) mode = M_SIGN; p11Key = P11KeyFactory.convertKey(token, privateKey, KEY_ALGO); - // For PSS, defer PKCS11 initialization calls to update/doFinal as it - // needs both key and params + // attempt initialization when key and params are both available + if (this.p11Key != null && this.sigParams != null) { + try { + initialize(); + } catch (ProviderException pe) { + throw new InvalidKeyException(pe); + } + } } // see JCA spec @@ -686,6 +738,15 @@ protected void engineSetParameter(AlgorithmParameterSpec params) throw new InvalidAlgorithmParameterException(nsae); } } + + // attempt initialization when key and params are both available + if (this.p11Key != null && this.sigParams != null) { + try { + initialize(); + } catch (ProviderException pe) { + throw new InvalidAlgorithmParameterException(pe); + } + } } // see JCA spec diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java index f41538cdaea4a..c8616e26e499e 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Signature.java @@ -51,8 +51,15 @@ * . DSA * . NONEwithDSA (RawDSA) * . SHA1withDSA - * . NONEwithDSAinP1363Format (RawDSAinP1363Format) - * . SHA1withDSAinP1363Format + * . SHA224withDSA + * . SHA256withDSA + * . SHA384withDSA + * . SHA512withDSA + * . SHA3-224withDSA + * . SHA3-256withDSA + * . SHA3-384withDSA + * . SHA3-512withDSA + * . inP1363Format * . RSA: * . MD2withRSA * . MD5withRSA @@ -61,6 +68,10 @@ * . SHA256withRSA * . SHA384withRSA * . SHA512withRSA + * . SHA3-224withRSA + * . SHA3-256withRSA + * . SHA3-384withRSA + * . SHA3-512withRSA * . ECDSA * . NONEwithECDSA * . SHA1withECDSA @@ -68,12 +79,11 @@ * . SHA256withECDSA * . SHA384withECDSA * . SHA512withECDSA - * . NONEwithECDSAinP1363Format - * . SHA1withECDSAinP1363Format - * . SHA224withECDSAinP1363Format - * . SHA256withECDSAinP1363Format - * . SHA384withECDSAinP1363Format - * . SHA512withECDSAinP1363Format + * . SHA3_224withECDSA + * . SHA3_256withECDSA + * . SHA3_384withECDSA + * . SHA3_512withECDSA + * . inP1363Format * * Note that the underlying PKCS#11 token may support complete signature * algorithm (e.g. CKM_DSA_SHA1, CKM_MD5_RSA_PKCS), or it may just @@ -144,10 +154,11 @@ final class P11Signature extends SignatureSpi { // constant for type raw, used with RawDSA and NONEwithECDSA only private final static int T_RAW = 3; - // XXX PKCS#11 v2.20 says "should not be longer than 1024 bits", - // but this is a little arbitrary + // PKCS#11 spec for CKM_ECDSA states that the length should not be longer + // than 1024 bits", but this is a little arbitrary private final static int RAW_ECDSA_MAX = 128; + P11Signature(Token token, String algorithm, long mechanism) throws NoSuchAlgorithmException, PKCS11Exception { super(); @@ -165,16 +176,36 @@ final class P11Signature extends SignatureSpi { case (int)CKM_SHA256_RSA_PKCS: case (int)CKM_SHA384_RSA_PKCS: case (int)CKM_SHA512_RSA_PKCS: + case (int)CKM_SHA3_224_RSA_PKCS: + case (int)CKM_SHA3_256_RSA_PKCS: + case (int)CKM_SHA3_384_RSA_PKCS: + case (int)CKM_SHA3_512_RSA_PKCS: keyAlgorithm = "RSA"; type = T_UPDATE; buffer = new byte[1]; break; case (int)CKM_DSA_SHA1: + case (int)CKM_DSA_SHA224: + case (int)CKM_DSA_SHA256: + case (int)CKM_DSA_SHA384: + case (int)CKM_DSA_SHA512: + case (int)CKM_DSA_SHA3_224: + case (int)CKM_DSA_SHA3_256: + case (int)CKM_DSA_SHA3_384: + case (int)CKM_DSA_SHA3_512: keyAlgorithm = "DSA"; type = T_UPDATE; buffer = new byte[1]; break; case (int)CKM_ECDSA_SHA1: + case (int)CKM_ECDSA_SHA224: + case (int)CKM_ECDSA_SHA256: + case (int)CKM_ECDSA_SHA384: + case (int)CKM_ECDSA_SHA512: + case (int)CKM_ECDSA_SHA3_224: + case (int)CKM_ECDSA_SHA3_256: + case (int)CKM_ECDSA_SHA3_384: + case (int)CKM_ECDSA_SHA3_512: keyAlgorithm = "EC"; type = T_UPDATE; buffer = new byte[1]; @@ -200,57 +231,18 @@ final class P11Signature extends SignatureSpi { type = T_RAW; buffer = new byte[RAW_ECDSA_MAX]; } else { - String digestAlg; - if (algorithm.equals("SHA1withECDSA") || - algorithm.equals("SHA1withECDSAinP1363Format")) { - digestAlg = "SHA-1"; - } else if (algorithm.equals("SHA224withECDSA") || - algorithm.equals("SHA224withECDSAinP1363Format")) { - digestAlg = "SHA-224"; - } else if (algorithm.equals("SHA256withECDSA") || - algorithm.equals("SHA256withECDSAinP1363Format")) { - digestAlg = "SHA-256"; - } else if (algorithm.equals("SHA384withECDSA") || - algorithm.equals("SHA384withECDSAinP1363Format")) { - digestAlg = "SHA-384"; - } else if (algorithm.equals("SHA512withECDSA") || - algorithm.equals("SHA512withECDSAinP1363Format")) { - digestAlg = "SHA-512"; - } else { - throw new ProviderException(algorithm); - } type = T_DIGEST; - md = MessageDigest.getInstance(digestAlg); + md = MessageDigest.getInstance + (getDigestEnum(algorithm).stdName()); } break; case (int)CKM_RSA_PKCS: case (int)CKM_RSA_X_509: keyAlgorithm = "RSA"; type = T_DIGEST; - if (algorithm.equals("MD5withRSA")) { - md = MessageDigest.getInstance("MD5"); - digestOID = AlgorithmId.MD5_oid; - } else if (algorithm.equals("SHA1withRSA")) { - md = MessageDigest.getInstance("SHA-1"); - digestOID = AlgorithmId.SHA_oid; - } else if (algorithm.equals("MD2withRSA")) { - md = MessageDigest.getInstance("MD2"); - digestOID = AlgorithmId.MD2_oid; - } else if (algorithm.equals("SHA224withRSA")) { - md = MessageDigest.getInstance("SHA-224"); - digestOID = AlgorithmId.SHA224_oid; - } else if (algorithm.equals("SHA256withRSA")) { - md = MessageDigest.getInstance("SHA-256"); - digestOID = AlgorithmId.SHA256_oid; - } else if (algorithm.equals("SHA384withRSA")) { - md = MessageDigest.getInstance("SHA-384"); - digestOID = AlgorithmId.SHA384_oid; - } else if (algorithm.equals("SHA512withRSA")) { - md = MessageDigest.getInstance("SHA-512"); - digestOID = AlgorithmId.SHA512_oid; - } else { - throw new ProviderException("Unknown signature: " + algorithm); - } + KnownOIDs digestAlg = getDigestEnum(algorithm); + md = MessageDigest.getInstance(digestAlg.stdName()); + digestOID = ObjectIdentifier.of(digestAlg); break; default: throw new ProviderException("Unknown mechanism: " + mechanism); @@ -304,8 +296,8 @@ private void cancelOperation() { } } else { // M_VERIFY byte[] signature; - if (keyAlgorithm.equals("DSA")) { - signature = new byte[40]; + if (mechanism == CKM_DSA) { + signature = new byte[64]; // assume N = 256 } else { signature = new byte[(p11Key.length() + 7) >> 3]; } @@ -436,23 +428,17 @@ private void checkRSAKeyLength(int len) throws InvalidKeyException { throw new InvalidKeyException(iape.getMessage()); } int maxDataSize = padding.getMaxDataSize(); - int encodedLength; - if (algorithm.equals("MD5withRSA") || - algorithm.equals("MD2withRSA")) { - encodedLength = 34; - } else if (algorithm.equals("SHA1withRSA")) { - encodedLength = 35; - } else if (algorithm.equals("SHA224withRSA")) { - encodedLength = 47; - } else if (algorithm.equals("SHA256withRSA")) { - encodedLength = 51; - } else if (algorithm.equals("SHA384withRSA")) { - encodedLength = 67; - } else if (algorithm.equals("SHA512withRSA")) { - encodedLength = 83; - } else { - throw new ProviderException("Unknown signature algo: " + algorithm); - } + int encodedLength = switch (algorithm) { + case "MD5withRSA", "MD2withRSA" -> 34; + case "SHA1withRSA" -> 35; + case "SHA224withRSA", "SHA3-224withRSA" -> 47; + case "SHA256withRSA", "SHA3-256withRSA" -> 51; + case "SHA384withRSA", "SHA3-384withRSA" -> 67; + case "SHA512withRSA", "SHA3-512withRSA" -> 83; + default -> + throw new ProviderException("Unknown signature algo: " + + algorithm); + }; if (encodedLength > maxDataSize) { throw new InvalidKeyException ("Key is too short for this signature algorithm"); @@ -624,8 +610,7 @@ protected byte[] engineSign() throws SignatureException { try { byte[] signature; if (type == T_UPDATE) { - int len = keyAlgorithm.equals("DSA") ? 40 : 0; - signature = token.p11.C_SignFinal(session.id(), len); + signature = token.p11.C_SignFinal(session.id(), 0); } else { byte[] digest; if (type == T_DIGEST) { @@ -769,6 +754,23 @@ private byte[] encodeSignature(byte[] digest) throws SignatureException { } } + private static KnownOIDs getDigestEnum(String algorithm) + throws NoSuchAlgorithmException { + try { + String digAlg = SignatureUtil.extractDigestAlgFromDwithE(algorithm); + KnownOIDs k = KnownOIDs.findMatch(digAlg); + if (k == null) { + throw new NoSuchAlgorithmException + ("Unsupported digest algorithm: " + digAlg); + } + return k; + } catch (IllegalArgumentException iae) { + // should never happen + throw new NoSuchAlgorithmException("Unknown signature: " + + algorithm, iae); + } + } + // private static byte[] decodeSignature(byte[] signature) throws IOException { // return RSASignature.decodeSignature(digestOID, signature); // } diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java index c4b41f7de6d14..5cf3381d9617b 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java @@ -543,6 +543,14 @@ private static void register(Descriptor d) { m(CKM_SHA512_224)); dA(MD, "SHA-512/256", P11Digest, m(CKM_SHA512_256)); + dA(MD, "SHA3-224", P11Digest, + m(CKM_SHA3_224)); + dA(MD, "SHA3-256", P11Digest, + m(CKM_SHA3_256)); + dA(MD, "SHA3-384", P11Digest, + m(CKM_SHA3_384)); + dA(MD, "SHA3-512", P11Digest, + m(CKM_SHA3_512)); d(MAC, "HmacMD5", P11MAC, m(CKM_MD5_HMAC)); @@ -560,7 +568,14 @@ private static void register(Descriptor d) { m(CKM_SHA512_224_HMAC)); dA(MAC, "HmacSHA512/256", P11MAC, m(CKM_SHA512_256_HMAC)); - + dA(MAC, "HmacSHA3-224", P11MAC, + m(CKM_SHA3_224_HMAC)); + dA(MAC, "HmacSHA3-256", P11MAC, + m(CKM_SHA3_256_HMAC)); + dA(MAC, "HmacSHA3-384", P11MAC, + m(CKM_SHA3_384_HMAC)); + dA(MAC, "HmacSHA3-512", P11MAC, + m(CKM_SHA3_512_HMAC)); d(MAC, "SslMacMD5", P11MAC, m(CKM_SSL3_MD5_MAC)); d(MAC, "SslMacSHA1", P11MAC, @@ -590,6 +605,30 @@ private static void register(Descriptor d) { m(CKM_AES_KEY_GEN)); d(KG, "Blowfish", P11KeyGenerator, m(CKM_BLOWFISH_KEY_GEN)); + d(KG, "HmacMD5", P11KeyGenerator, // 1.3.6.1.5.5.8.1.1 + m(CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA1", P11KeyGenerator, + m(CKM_SHA_1_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA224", P11KeyGenerator, + m(CKM_SHA224_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA256", P11KeyGenerator, + m(CKM_SHA256_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA384", P11KeyGenerator, + m(CKM_SHA384_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA512", P11KeyGenerator, + m(CKM_SHA512_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA512/224", P11KeyGenerator, + m(CKM_SHA512_224_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA512/256", P11KeyGenerator, + m(CKM_SHA512_256_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA3-224", P11KeyGenerator, + m(CKM_SHA3_224_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA3-256", P11KeyGenerator, + m(CKM_SHA3_256_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA3-384", P11KeyGenerator, + m(CKM_SHA3_384_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); + dA(KG, "HmacSHA3-512", P11KeyGenerator, + m(CKM_SHA3_512_KEY_GEN, CKM_GENERIC_SECRET_KEY_GEN)); // register (Secret)KeyFactories if there are any mechanisms // for a particular algorithm that we support @@ -711,37 +750,77 @@ private static void register(Descriptor d) { m(CKM_DSA_SHA384)); dA(SIG, "SHA512withDSA", P11Signature, m(CKM_DSA_SHA512)); + dA(SIG, "SHA3-224withDSA", P11Signature, + m(CKM_DSA_SHA3_224)); + dA(SIG, "SHA3-256withDSA", P11Signature, + m(CKM_DSA_SHA3_256)); + dA(SIG, "SHA3-384withDSA", P11Signature, + m(CKM_DSA_SHA3_384)); + dA(SIG, "SHA3-512withDSA", P11Signature, + m(CKM_DSA_SHA3_512)); d(SIG, "RawDSAinP1363Format", P11Signature, List.of("NONEwithDSAinP1363Format"), m(CKM_DSA)); d(SIG, "DSAinP1363Format", P11Signature, List.of("SHA1withDSAinP1363Format"), m(CKM_DSA_SHA1, CKM_DSA)); - + d(SIG, "SHA224withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA224)); + d(SIG, "SHA256withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA256)); + d(SIG, "SHA384withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA384)); + d(SIG, "SHA512withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA512)); + d(SIG, "SHA3-224withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA3_224)); + d(SIG, "SHA3-256withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA3_256)); + d(SIG, "SHA3-384withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA3_384)); + d(SIG, "SHA3-512withDSAinP1363Format", P11Signature, + m(CKM_DSA_SHA3_512)); d(SIG, "NONEwithECDSA", P11Signature, m(CKM_ECDSA)); dA(SIG, "SHA1withECDSA", P11Signature, m(CKM_ECDSA_SHA1, CKM_ECDSA)); dA(SIG, "SHA224withECDSA", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA224, CKM_ECDSA)); dA(SIG, "SHA256withECDSA", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA256, CKM_ECDSA)); dA(SIG, "SHA384withECDSA", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA384, CKM_ECDSA)); dA(SIG, "SHA512withECDSA", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA512, CKM_ECDSA)); + dA(SIG, "SHA3-224withECDSA", P11Signature, + m(CKM_ECDSA_SHA3_224, CKM_ECDSA)); + dA(SIG, "SHA3-256withECDSA", P11Signature, + m(CKM_ECDSA_SHA3_256, CKM_ECDSA)); + dA(SIG, "SHA3-384withECDSA", P11Signature, + m(CKM_ECDSA_SHA3_384, CKM_ECDSA)); + dA(SIG, "SHA3-512withECDSA", P11Signature, + m(CKM_ECDSA_SHA3_512, CKM_ECDSA)); d(SIG, "NONEwithECDSAinP1363Format", P11Signature, m(CKM_ECDSA)); d(SIG, "SHA1withECDSAinP1363Format", P11Signature, m(CKM_ECDSA_SHA1, CKM_ECDSA)); d(SIG, "SHA224withECDSAinP1363Format", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA224, CKM_ECDSA)); d(SIG, "SHA256withECDSAinP1363Format", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA256, CKM_ECDSA)); d(SIG, "SHA384withECDSAinP1363Format", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA384, CKM_ECDSA)); d(SIG, "SHA512withECDSAinP1363Format", P11Signature, - m(CKM_ECDSA)); + m(CKM_ECDSA_SHA512, CKM_ECDSA)); + d(SIG, "SHA3-224withECDSAinP1363Format", P11Signature, + m(CKM_ECDSA_SHA3_224, CKM_ECDSA)); + d(SIG, "SHA3-256withECDSAinP1363Format", P11Signature, + m(CKM_ECDSA_SHA3_256, CKM_ECDSA)); + d(SIG, "SHA3-384withECDSAinP1363Format", P11Signature, + m(CKM_ECDSA_SHA3_384, CKM_ECDSA)); + d(SIG, "SHA3-512withECDSAinP1363Format", P11Signature, + m(CKM_ECDSA_SHA3_512, CKM_ECDSA)); + dA(SIG, "MD2withRSA", P11Signature, m(CKM_MD2_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); dA(SIG, "MD5withRSA", P11Signature, @@ -756,6 +835,14 @@ private static void register(Descriptor d) { m(CKM_SHA384_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); dA(SIG, "SHA512withRSA", P11Signature, m(CKM_SHA512_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); + dA(SIG, "SHA3-224withRSA", P11Signature, + m(CKM_SHA3_224_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); + dA(SIG, "SHA3-256withRSA", P11Signature, + m(CKM_SHA3_256_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); + dA(SIG, "SHA3-384withRSA", P11Signature, + m(CKM_SHA3_384_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); + dA(SIG, "SHA3-512withRSA", P11Signature, + m(CKM_SHA3_512_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509)); dA(SIG, "RSASSA-PSS", P11PSSSignature, m(CKM_RSA_PKCS_PSS)); d(SIG, "SHA1withRSASSA-PSS", P11PSSSignature, @@ -768,6 +855,14 @@ private static void register(Descriptor d) { m(CKM_SHA384_RSA_PKCS_PSS)); d(SIG, "SHA512withRSASSA-PSS", P11PSSSignature, m(CKM_SHA512_RSA_PKCS_PSS)); + d(SIG, "SHA3-224withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA3_224_RSA_PKCS_PSS)); + d(SIG, "SHA3-256withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA3_256_RSA_PKCS_PSS)); + d(SIG, "SHA3-384withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA3_384_RSA_PKCS_PSS)); + d(SIG, "SHA3-512withRSASSA-PSS", P11PSSSignature, + m(CKM_SHA3_512_RSA_PKCS_PSS)); d(KG, "SunTlsRsaPremasterSecret", "sun.security.pkcs11.P11TlsRsaPremasterSecretGenerator", diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java index e077943bbc2a8..cb04b95304d69 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/wrapper/CK_RSA_PKCS_PSS_PARAMS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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,12 @@ public CK_RSA_PKCS_PSS_PARAMS(String hashAlg, String mgfAlg, throw new ProviderException("Only MGF1 is supported"); } // no dash in PKCS#11 mechanism names - this.mgf = Functions.getMGFId("CKG_MGF1_" + mgfHash.replaceFirst("-", "")); + if (mgfHash.startsWith("SHA3-")) { + mgfHash = mgfHash.replaceFirst("-", "_"); + } else { + mgfHash = mgfHash.replaceFirst("-", ""); + } + this.mgf = Functions.getMGFId("CKG_MGF1_" + mgfHash); this.sLen = sLen; } diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java b/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java new file mode 100644 index 0000000000000..d6707028d96ef --- /dev/null +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/HmacDefKeySizeTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2020, 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 8242332 + * @summary Check that PKCS11 Hamc KeyGenerator picks appropriate default size + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main/othervm HmacDefKeySizeTest + * @run main/othervm HmacDefKeySizeTest sm + */ + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.Provider; +import java.util.List; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; + +public class HmacDefKeySizeTest extends PKCS11Test { + + /** + * Request a KeyGenerator object from PKCS11 provider for Hmac algorithm, + * and generate the SecretKey. + * + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + main(new HmacDefKeySizeTest(), args); + } + + @Override + public void main(Provider p) { + List algorithms = getSupportedAlgorithms("KeyGenerator", + "Hmac", p); + boolean success = true; + + for (String alg : algorithms) { + System.out.println("Testing " + alg); + try { + KeyGenerator kg = KeyGenerator.getInstance(alg, p); + SecretKey k1 = kg.generateKey(); + int keysize = k1.getEncoded().length << 3; + System.out.println("=> default key size = " + keysize); + kg.init(keysize); + SecretKey k2 = kg.generateKey(); + if ((k2.getEncoded().length << 3) != keysize) { + success = false; + System.out.println("keysize check failed"); + } + } catch (Exception e) { + System.out.println("Unexpected exception: " + e); + e.printStackTrace(); + success = false; + } + } + + if (!success) { + throw new RuntimeException("One or more tests failed"); + } + } +} diff --git a/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java b/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java index 2f63ca4b201c8..ae0e01e1ad5aa 100644 --- a/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java +++ b/test/jdk/sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4917233 6461727 6490213 6720456 + * @bug 4917233 6461727 6490213 6720456 8242332 * @summary test the KeyGenerator * @author Andreas Sterbenz * @library /test/lib .. @@ -127,6 +127,18 @@ public void main(Provider p) throws Exception { test("ARCFOUR", 40, p, TestResult.PASS); test("ARCFOUR", 128, p, TestResult.PASS); + String[] HMAC_ALGS = { + "HmacSHA1", "HmacSHA224", "HmacSHA256", "HmacSHA384", "HmacSHA512", + "HmacSHA512/224", "HmacSHA512/256", "HmacSHA3-224", "HmacSHA3-256", + "HmacSHA3-384", "HmacSHA3-512", + }; + + for (String hmacAlg : HMAC_ALGS) { + test(hmacAlg, 0, p, TestResult.FAIL); + test(hmacAlg, 128, p, TestResult.PASS); + test(hmacAlg, 224, p, TestResult.PASS); + } + if (p.getName().equals("SunPKCS11-NSS")) { test("ARCFOUR", 1024, p, TestResult.PASS); test("ARCFOUR", 2048, p, TestResult.PASS); diff --git a/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java b/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java index 8638b5048f254..b44b2f4a5b970 100644 --- a/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java +++ b/test/jdk/sun/security/pkcs11/Mac/MacSameTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8048603 + * @bug 8048603 8242332 * @summary Check if doFinal and update operation result in same Mac * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin * @library /test/lib .. @@ -40,13 +40,15 @@ import java.security.SecureRandom; import java.util.List; import javax.crypto.Mac; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class MacSameTest extends PKCS11Test { private static final int MESSAGE_SIZE = 25; private static final int OFFSET = 5; - private static final int KEY_SIZE = 70; + private static final int KEY_SIZE = 128; /** * Initialize a message, instantiate a Mac object, @@ -67,9 +69,30 @@ public static void main(String[] args) throws Exception { public void main(Provider p) { List algorithms = getSupportedAlgorithms("Mac", "Hmac", p); boolean success = true; + SecureRandom srdm = new SecureRandom(); + for (String alg : algorithms) { + // first try w/ java secret key object + byte[] keyVal = new byte[KEY_SIZE]; + srdm.nextBytes(keyVal); + SecretKey skey = new SecretKeySpec(keyVal, alg); + + try { + doTest(alg, skey, p); + } catch (Exception e) { + System.out.println("Unexpected exception: " + e); + e.printStackTrace(); + success = false; + } + try { - doTest(alg, p); + KeyGenerator kg = KeyGenerator.getInstance(alg, p); + kg.init(KEY_SIZE); + skey = kg.generateKey(); + doTest(alg, skey, p); + } catch (NoSuchAlgorithmException nsae) { + System.out.println("Skip test using native key for " + alg); + continue; } catch (Exception e) { System.out.println("Unexpected exception: " + e); e.printStackTrace(); @@ -82,7 +105,7 @@ public void main(Provider p) { } } - private void doTest(String algo, Provider provider) + private void doTest(String algo, SecretKey key, Provider provider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException { System.out.println("Test " + algo); @@ -96,12 +119,7 @@ private void doTest(String algo, Provider provider) byte[] tail = new byte[plain.length - OFFSET]; System.arraycopy(plain, OFFSET, tail, 0, tail.length); - SecureRandom srdm = new SecureRandom(); - byte[] keyVal = new byte[KEY_SIZE]; - srdm.nextBytes(keyVal); - SecretKeySpec keySpec = new SecretKeySpec(keyVal, "HMAC"); - - mac.init(keySpec); + mac.init(key); byte[] result1 = mac.doFinal(plain); mac.reset(); diff --git a/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java b/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java index 5cad8859840f3..7e045232e3a87 100644 --- a/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java +++ b/test/jdk/sun/security/pkcs11/Mac/ReinitMac.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,7 +23,7 @@ /* * @test - * @bug 4856966 + * @bug 4856966 8242332 * @summary * @author Andreas Sterbenz * @library /test/lib .. @@ -35,6 +35,7 @@ import java.security.Provider; import java.util.Random; +import java.util.List; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -46,32 +47,49 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { - if (p.getService("Mac", "HmacMD5") == null) { - System.out.println(p + " does not support HmacMD5, skipping"); - return; - } + List algorithms = getSupportedAlgorithms("Mac", "Hmac", p); Random random = new Random(); - byte[] data1 = new byte[10 * 1024]; - random.nextBytes(data1); - byte[] keyData = new byte[16]; - random.nextBytes(keyData); - SecretKeySpec key = new SecretKeySpec(keyData, "Hmac"); - Mac mac = Mac.getInstance("HmacMD5", p); + byte[] data = new byte[10 * 1024]; + random.nextBytes(data); + byte[] keyVal = new byte[16]; + random.nextBytes(keyVal); + + boolean success = true; + for (String alg : algorithms) { + try { + doTest(alg, p, keyVal, data); + } catch (Exception e) { + System.out.println("Unexpected exception: " + e); + e.printStackTrace(); + success = false; + } + } + + if (!success) { + throw new RuntimeException("Test failed"); + } else { + System.out.println("All tests passed"); + } + } + + private void doTest(String alg, Provider p, byte[] keyVal, byte[] data) + throws Exception { + System.out.println("Testing " + alg); + SecretKeySpec key = new SecretKeySpec(keyVal, alg); + Mac mac = Mac.getInstance(alg, p); mac.init(key); mac.init(key); - mac.update(data1); + mac.update(data); mac.init(key); mac.doFinal(); mac.doFinal(); - mac.update(data1); + mac.update(data); mac.doFinal(); mac.reset(); mac.reset(); mac.init(key); mac.reset(); - mac.update(data1); + mac.update(data); mac.reset(); - - System.out.println("All tests passed"); } } diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java b/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java index 7ced00630cc1d..a7a72e8ea3dd1 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,7 +23,7 @@ /* * @test - * @bug 4856966 8080462 + * @bug 4856966 8080462 8242332 * @summary Test the MessageDigest.update(ByteBuffer) method * @author Andreas Sterbenz * @library /test/lib .. @@ -36,13 +36,10 @@ import java.security.*; import java.util.Arrays; import java.util.Random; +import java.util.List; public class ByteBuffers extends PKCS11Test { - static final String[] ALGS = { - "SHA-224", "SHA-256", "SHA-384", "SHA-512", "SHA-512/224", "SHA-512/256" - }; - private static Random random = new Random(); public static void main(String[] args) throws Exception { @@ -51,6 +48,9 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { + List ALGS = getSupportedAlgorithms("MessageDigest", + "SHA", p); + int n = 10 * 1024; byte[] t = new byte[n]; random.nextBytes(t); @@ -62,13 +62,7 @@ public void main(Provider p) throws Exception { private void runTest(Provider p, String alg, byte[] data) throws Exception { System.out.println("Test against " + p.getName() + " and " + alg); - MessageDigest md; - try { - md = MessageDigest.getInstance(alg, p); - } catch (NoSuchAlgorithmException e) { - System.out.println("Skip " + alg + " due to no support"); - return; - } + MessageDigest md = MessageDigest.getInstance(alg, p); byte[] d1 = md.digest(data); diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java b/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java index ea7909bc3971d..268f698276be7 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/ReinitDigest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,7 +23,7 @@ /* * @test - * @bug 4856966 + * @bug 4856966 8242332 * @summary * @author Andreas Sterbenz * @library /test/lib .. @@ -37,6 +37,7 @@ import java.security.Provider; import java.util.Arrays; import java.util.Random; +import java.util.List; public class ReinitDigest extends PKCS11Test { @@ -46,19 +47,37 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { - if (p.getService("MessageDigest", "MD5") == null) { - System.out.println("Provider does not support MD5, skipping"); - return; - } + List ALGS = getSupportedAlgorithms("MessageDigest", + "SHA", p); Random r = new Random(); byte[] data1 = new byte[10 * 1024]; byte[] data2 = new byte[10 * 1024]; r.nextBytes(data1); r.nextBytes(data2); - MessageDigest md; - md = MessageDigest.getInstance("MD5", "SUN"); + + boolean success = true; + for (String alg : ALGS) { + try { + doTest(alg, p, data1, data2); + } catch (Exception e) { + System.out.println("Unexpected exception: " + e); + e.printStackTrace(); + success = false; + } + } + + if (!success) { + throw new RuntimeException("Test failed"); + } + System.out.println("All tests passed"); + } + + private void doTest(String alg, Provider p, byte[] data1, byte[] data2) + throws Exception { + System.out.println("Testing " + alg); + MessageDigest md = MessageDigest.getInstance(alg, "SUN"); byte[] d1 = md.digest(data1); - md = MessageDigest.getInstance("MD5", p); + md = MessageDigest.getInstance(alg, p); byte[] d2 = md.digest(data1); check(d1, d2); byte[] d3 = md.digest(data1); @@ -68,7 +87,6 @@ public void main(Provider p) throws Exception { md.reset(); byte[] d4 = md.digest(data1); check(d1, d4); - System.out.println("All tests passed"); } private static void check(byte[] d1, byte[] d2) throws Exception { diff --git a/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java b/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java index b931c8564b294..ace601c723354 100644 --- a/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java +++ b/test/jdk/sun/security/pkcs11/MessageDigest/TestCloning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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,7 +23,7 @@ /* * @test - * @bug 6414899 + * @bug 6414899 8242332 * @summary Ensure the cloning functionality works. * @author Valerie Peng * @library /test/lib .. @@ -37,13 +37,10 @@ import java.security.Provider; import java.util.Arrays; import java.util.Random; +import java.util.List; public class TestCloning extends PKCS11Test { - private static final String[] ALGOS = { - "MD2", "MD5", "SHA1", "SHA-224", "SHA-256", "SHA-384", "SHA-512" - }; - public static void main(String[] args) throws Exception { main(new TestCloning(), args); } @@ -51,44 +48,28 @@ public static void main(String[] args) throws Exception { private static final byte[] data1 = new byte[10]; private static final byte[] data2 = new byte[10*1024]; - @Override public void main(Provider p) throws Exception { + List ALGS = getSupportedAlgorithms("MessageDigest", "SHA", p); Random r = new Random(); byte[] data1 = new byte[10]; byte[] data2 = new byte[2*1024]; r.nextBytes(data1); r.nextBytes(data2); System.out.println("Testing against provider " + p.getName()); - for (int i = 0; i < ALGOS.length; i++) { - if (p.getService("MessageDigest", ALGOS[i]) == null) { - System.out.println(ALGOS[i] + " is not supported, skipping"); - continue; - } else { - System.out.println("Testing " + ALGOS[i] + " of " + p.getName()); - MessageDigest md = MessageDigest.getInstance(ALGOS[i], p); - try { - md = testCloning(md, p); - // repeat the test again after generating digest once - for (int j = 0; j < 10; j++) { - md = testCloning(md, p); - } - } catch (Exception ex) { - if (ALGOS[i] == "MD2" && - p.getName().equalsIgnoreCase("SunPKCS11-NSS")) { - // known bug in NSS; ignore for now - System.out.println("Ignore Known bug in MD2 of NSS"); - continue; - } - throw ex; - } + for (String alg : ALGS) { + System.out.println("Testing " + alg); + MessageDigest md = MessageDigest.getInstance(alg, p); + md = testCloning(md, p); + // repeat the test again after generating digest once + for (int j = 0; j < 10; j++) { + md = testCloning(md, p); } } } private static MessageDigest testCloning(MessageDigest mdObj, Provider p) - throws Exception { - + throws Exception { // copy#0: clone at state BLANK w/o any data MessageDigest mdCopy0 = (MessageDigest) mdObj.clone(); diff --git a/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java b/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java index 0a6e1a11fd102..5416b04debf90 100644 --- a/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java +++ b/test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4856966 + * @bug 4856966 8242332 * @summary Test the Signature.update(ByteBuffer) method * @author Andreas Sterbenz * @library /test/lib .. @@ -55,10 +55,10 @@ public void main(Provider p) throws Exception { random.nextBytes(t); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); - kpg.initialize(512); + kpg.initialize(2048); KeyPair kp = kpg.generateKeyPair(); - Signature sig = Signature.getInstance("MD5withRSA", p); + Signature sig = Signature.getInstance("SHA256withRSA", p); sig.initSign(kp.getPrivate()); sig.update(t); byte[] signature = sig.sign(); diff --git a/test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java b/test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java index ccd66599fb052..a2fa72949779d 100644 --- a/test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java +++ b/test/jdk/sun/security/pkcs11/Signature/InitAgainPSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 8080462 + * @bug 8080462 8242332 * @summary Make sure old state is cleared when init is called again * @library /test/lib .. * @modules jdk.crypto.cryptoki @@ -38,18 +38,22 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { + test("RSASSA-PSS", p); + } + + private void test(String sigAlg, Provider p) throws Exception { Signature s1; try { - s1 = Signature.getInstance("RSASSA-PSS", p); + s1 = Signature.getInstance(sigAlg, p); } catch (NoSuchAlgorithmException e) { - System.out.println("Skip testing RSASSA-PSS" + + System.out.println("Skip testing " + sigAlg + " due to no support"); return; } byte[] msg = "hello".getBytes(); - Signature s2 = Signature.getInstance("RSASSA-PSS", p); + Signature s2 = Signature.getInstance(sigAlg, p); PSSParameterSpec params = new PSSParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), 32, diff --git a/test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java b/test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java index 2e4fedbf1d510..f1c0492b5fc24 100644 --- a/test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java +++ b/test/jdk/sun/security/pkcs11/Signature/KeyAndParamCheckForPSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ /** * @test - * @bug 8080462 8226651 + * @bug 8080462 8226651 8242332 * @summary Ensure that PSS key and params check are implemented properly * regardless of call sequence * @library /test/lib .. @@ -55,6 +55,7 @@ public void main(Provider p) throws Exception { " due to no support"); return; } + // NOTE: key length >= (digest length + 2) in bytes // otherwise, even salt length = 0 would not work runTest(p, 1024, "SHA-256", "SHA-256"); @@ -66,10 +67,30 @@ public void main(Provider p) throws Exception { runTest(p, 1040, "SHA-512", "SHA-256"); runTest(p, 1040, "SHA-512", "SHA-384"); runTest(p, 1040, "SHA-512", "SHA-512"); + runTest(p, 1024, "SHA3-256", "SHA3-256"); + runTest(p, 1024, "SHA3-256", "SHA3-384"); + runTest(p, 1024, "SHA3-256", "SHA3-512"); + runTest(p, 1024, "SHA3-384", "SHA3-256"); + runTest(p, 1024, "SHA3-384", "SHA3-384"); + runTest(p, 1024, "SHA3-384", "SHA3-512"); + runTest(p, 1040, "SHA3-512", "SHA3-256"); + runTest(p, 1040, "SHA3-512", "SHA3-384"); + runTest(p, 1040, "SHA3-512", "SHA3-512"); } private void runTest(Provider p, int keySize, String hashAlg, String mgfHashAlg) throws Exception { + + // skip further test if this provider does not support hashAlg or + // mgfHashAlg + try { + MessageDigest.getInstance(hashAlg, p); + MessageDigest.getInstance(mgfHashAlg, p); + } catch (NoSuchAlgorithmException nsae) { + System.out.println("No support for " + hashAlg + ", skip"); + return; + } + System.out.println("Testing [" + keySize + " " + hashAlg + "]"); // create a key pair with the supplied size @@ -95,6 +116,7 @@ private void runTest(Provider p, int keySize, String hashAlg, } catch (InvalidKeyException ike) { System.out.println("test#1: got expected IKE"); } + sig.setParameter(paramsGood); sig.initSign(priv); System.out.println("test#1: pass"); @@ -108,8 +130,10 @@ private void runTest(Provider p, int keySize, String hashAlg, } catch (InvalidKeyException ike) { System.out.println("test#2: got expected IKE"); } + sig.setParameter(paramsGood); sig.initVerify(pub); + System.out.println("test#2: pass"); // test#3 - initSign, then setParameter @@ -121,6 +145,7 @@ private void runTest(Provider p, int keySize, String hashAlg, } catch (InvalidAlgorithmParameterException iape) { System.out.println("test#3: got expected IAPE"); } + sig.setParameter(paramsGood); System.out.println("test#3: pass"); @@ -133,6 +158,7 @@ private void runTest(Provider p, int keySize, String hashAlg, } catch (InvalidAlgorithmParameterException iape) { System.out.println("test#4: got expected IAPE"); } + sig.setParameter(paramsGood); System.out.println("test#4: pass"); } diff --git a/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java b/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java index 1c61aceb5adfb..4eef23559b811 100644 --- a/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java +++ b/test/jdk/sun/security/pkcs11/Signature/ReinitSignature.java @@ -23,312 +23,13 @@ /* * @test - * @bug 4856966 + * @bug 4856966 8242332 * @summary test that reinitializing Signatures works correctly * @author Andreas Sterbenz * @library /test/lib .. * @key randomness * @modules jdk.crypto.cryptoki * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature - * @run main ReinitSignature */ import java.security.KeyPair; @@ -348,11 +49,11 @@ public static void main(String[] args) throws Exception { public void main(Provider p) throws Exception { KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); - kpg.initialize(512); + kpg.initialize(2048); KeyPair kp = kpg.generateKeyPair(); PrivateKey privateKey = kp.getPrivate(); PublicKey publicKey = kp.getPublic(); - Signature sig = Signature.getInstance("MD5withRSA", p); + Signature sig = Signature.getInstance("SHA256withRSA", p); byte[] data = new byte[10 * 1024]; new Random().nextBytes(data); sig.initSign(privateKey); diff --git a/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java index 3c3edb5aa6a58..1114702277179 100644 --- a/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java +++ b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ -27,7 +27,7 @@ /* * @test - * @bug 8080462 8226651 + * @bug 8080462 8226651 8242332 * @summary testing interoperability of PSS signatures of PKCS11 provider * against SunRsaSign provider * @library /test/lib .. diff --git a/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java new file mode 100644 index 0000000000000..b8ea986332780 --- /dev/null +++ b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2020, 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.security.*; +import java.security.spec.*; +import java.security.interfaces.*; + +/* + * @test + * @bug 8080462 8226651 8242332 + * @summary testing interoperability of PSS signatures of PKCS11 provider + * against SunRsaSign provider + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main/othervm SigInteropPSS2 + */ +public class SigInteropPSS2 extends PKCS11Test { + + private static final byte[] MSG = + "Interoperability test between SunRsaSign and SunPKCS11".getBytes(); + + private static final String[] DIGESTS = { + "SHA224", "SHA256", "SHA384", "SHA512", + "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512" + }; + + public static void main(String[] args) throws Exception { + main(new SigInteropPSS2(), args); + } + + @Override + public void main(Provider p) throws Exception { + + Signature sigPkcs11; + Signature sigSunRsaSign = + Signature.getInstance("RSASSA-PSS", "SunRsaSign"); + + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); + kpg.initialize(3072); + KeyPair kp = kpg.generateKeyPair(); + + for (String digest : DIGESTS) { + try { + sigPkcs11 = Signature.getInstance(digest + "withRSASSA-PSS", p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing " + digest + "withRSASSA-PSS" + + " due to no support"); + continue; + } + + runTest(sigPkcs11, sigSunRsaSign, kp); + } + System.out.println("Test passed"); + } + + static void runTest(Signature signer, Signature verifier, KeyPair kp) + throws Exception { + System.out.println("\tSign: " + signer.getProvider().getName()); + System.out.println("\tVerify: " + verifier.getProvider().getName()); + + signer.initSign(kp.getPrivate()); + signer.update(MSG); + byte[] sigBytes = signer.sign(); + + AlgorithmParameters signParams = signer.getParameters(); + verifier.setParameter(signParams.getParameterSpec + (PSSParameterSpec.class)); + verifier.initVerify(kp.getPublic()); + + verifier.update(MSG); + boolean isValid = verifier.verify(sigBytes); + if (isValid) { + System.out.println("\tPSS Signature verified"); + } else { + throw new RuntimeException("ERROR verifying PSS Signature"); + } + } +} diff --git a/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java b/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java index 3a6dbe345e98f..4c1f7284bbc25 100644 --- a/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java +++ b/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ -27,7 +27,7 @@ /** * @test - * @bug 8080462 8226651 + * @bug 8080462 8226651 8242332 * @summary Generate a RSASSA-PSS signature and verify it using PKCS11 provider * @library /test/lib .. * @modules jdk.crypto.cryptoki @@ -40,8 +40,10 @@ public class SignatureTestPSS extends PKCS11Test { private static final String SIGALG = "RSASSA-PSS"; private static final int[] KEYSIZES = { 2048, 3072 }; - private static final String[] DIGESTS = { "SHA-224", "SHA-256", - "SHA-384" , "SHA-512" }; + private static final String[] DIGESTS = { + "SHA-224", "SHA-256", "SHA-384" , "SHA-512", + "SHA3-224", "SHA3-256", "SHA3-384" , "SHA3-512", + }; private Provider prov; /** @@ -115,7 +117,22 @@ private void checkSignature(byte[] data, PublicKey pub, throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, NoSuchProviderException, InvalidAlgorithmParameterException { - System.out.println("Testing against " + hash + " and MGF1_" + mgfHash); + + String testName = hash + " and MGF1_" + mgfHash; + // only test RSASSA-PSS signature against the supplied hash/mgfHash + // if they are supported; otherwise PKCS11 library will throw + // CKR_MECHANISM_PARAM_INVALID at Signature.initXXX calls + try { + MessageDigest md = MessageDigest.getInstance(hash, prov); + if (!hash.equalsIgnoreCase(mgfHash)) { + md = MessageDigest.getInstance(mgfHash, prov); + } + } catch (NoSuchAlgorithmException nsae) { + System.out.println("Skip testing " + hash + "/" + mgfHash); + return; + } + + System.out.println("Testing against " + testName); Signature sig = Signature.getInstance(SIGALG, prov); AlgorithmParameterSpec params = new PSSParameterSpec( hash, "MGF1", new MGF1ParameterSpec(mgfHash), 0, 1); diff --git a/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS2.java b/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS2.java new file mode 100644 index 0000000000000..516b17972e589 --- /dev/null +++ b/test/jdk/sun/security/pkcs11/Signature/SignatureTestPSS2.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2020, 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.security.*; +import java.security.interfaces.*; +import java.security.spec.*; +import java.util.stream.IntStream; + +/** + * @test + * @bug 8244154 8242332 + * @summary Generate a withRSASSA-PSS signature and verify it using + * PKCS11 provider + * @library /test/lib .. + * @modules jdk.crypto.cryptoki + * @run main SignatureTestPSS2 + */ +public class SignatureTestPSS2 extends PKCS11Test { + + // PKCS11 does not support RSASSA-PSS keys yet + private static final String KEYALG = "RSA"; + private static final String[] SIGALGS = { + "SHA224withRSASSA-PSS", "SHA256withRSASSA-PSS", + "SHA384withRSASSA-PSS", "SHA512withRSASSA-PSS", + "SHA3-224withRSASSA-PSS", "SHA3-256withRSASSA-PSS", + "SHA3-384withRSASSA-PSS", "SHA3-512withRSASSA-PSS" + }; + + private static final int[] KEYSIZES = { 2048, 3072 }; + + /** + * How much times signature updated. + */ + private static final int UPDATE_TIMES = 2; + + public static void main(String[] args) throws Exception { + main(new SignatureTestPSS2(), args); + } + + @Override + public void main(Provider p) throws Exception { + for (String sa : SIGALGS) { + Signature sig; + try { + sig = Signature.getInstance(sa, p); + } catch (NoSuchAlgorithmException e) { + System.out.println("Skip testing " + sa + + " due to no support"); + return; + } + for (int i : KEYSIZES) { + runTest(sig, i); + } + } + } + + private static void runTest(Signature s, int keySize) throws Exception { + byte[] data = new byte[100]; + IntStream.range(0, data.length).forEach(j -> { + data[j] = (byte) j; + }); + System.out.println("[KEYSIZE = " + keySize + "]"); + + // create a key pair + KeyPair kpair = generateKeys(KEYALG, keySize, s.getProvider()); + test(s, kpair.getPrivate(), kpair.getPublic(), data); + } + + private static void test(Signature sig, PrivateKey privKey, + PublicKey pubKey, byte[] data) throws RuntimeException { + // For signature algorithm, create and verify a signature + try { + checkSignature(sig, privKey, pubKey, data); + } catch (NoSuchAlgorithmException | InvalidKeyException | + SignatureException | NoSuchProviderException ex) { + throw new RuntimeException(ex); + } catch (InvalidAlgorithmParameterException ex2) { + System.out.println("Skip test due to " + ex2); + } + } + + private static KeyPair generateKeys(String keyalg, int size, Provider p) + throws NoSuchAlgorithmException { + KeyPairGenerator kpg = KeyPairGenerator.getInstance(keyalg, p); + kpg.initialize(size); + return kpg.generateKeyPair(); + } + + private static void checkSignature(Signature sig, PrivateKey priv, + PublicKey pub, byte[] data) throws NoSuchAlgorithmException, + InvalidKeyException, SignatureException, NoSuchProviderException, + InvalidAlgorithmParameterException { + System.out.println("Testing against " + sig.getAlgorithm()); + sig.initSign(priv); + for (int i = 0; i < UPDATE_TIMES; i++) { + sig.update(data); + } + byte[] signedData = sig.sign(); + + // Make sure signature verifies with original data + // do we need to call sig.setParameter(params) again? + sig.initVerify(pub); + for (int i = 0; i < UPDATE_TIMES; i++) { + sig.update(data); + } + if (!sig.verify(signedData)) { + throw new RuntimeException("Failed to verify signature"); + } + + // Make sure signature does NOT verify when the original data + // has changed + sig.initVerify(pub); + for (int i = 0; i < UPDATE_TIMES + 1; i++) { + sig.update(data); + } + + if (sig.verify(signedData)) { + throw new RuntimeException("Failed to detect bad signature"); + } + } +} diff --git a/test/jdk/sun/security/pkcs11/Signature/TestDSA2.java b/test/jdk/sun/security/pkcs11/Signature/TestDSA2.java index 222f8a2a5eda3..3161de6fc5084 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestDSA2.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSA2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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,7 +22,7 @@ */ /* * @test - * @bug 8080462 + * @bug 8080462 8242332 * @library /test/lib .. * @modules jdk.crypto.cryptoki * @run main/othervm/timeout=250 TestDSA2 @@ -40,8 +40,12 @@ public class TestDSA2 extends PKCS11Test { private static final String[] SIG_ALGOS = { "SHA224withDSA", "SHA256withDSA", - //"SHA384withDSA", - //"SHA512withDSA", + "SHA3-224withDSA", + "SHA3-256withDSA", + "SHA384withDSA", + "SHA512withDSA", + "SHA3-384withDSA", + "SHA3-512withDSA", }; private static final int KEYSIZE = 2048; @@ -59,25 +63,33 @@ public void main(Provider p) throws Exception { kp = kpg.generateKeyPair(); } catch (Exception ex) { System.out.println("Skip due to no 2048-bit DSA support: " + ex); - ex.printStackTrace(); return; } + boolean allPass = true; for (String sigAlg : SIG_ALGOS) { - test(sigAlg, kp, p); + System.out.println("Testing " + sigAlg); + try { + Signature sig = Signature.getInstance(sigAlg, p); + test(sig, kp, p); + } catch (NoSuchAlgorithmException nsae) { + System.out.println("=>Skip due to no support"); + } catch (Exception ex) { + System.out.println("Unexpected exception when testing " + + sigAlg); + ex.printStackTrace(); + allPass = false; + } + } + if (allPass) { + System.out.println("Tests Passed"); + } else { + throw new RuntimeException("One or more tests failed"); } } - private static void test(String sigAlg, KeyPair kp, Provider p) + private static void test(Signature sig, KeyPair kp, Provider p) throws Exception { - Signature sig; - try { - sig = Signature.getInstance(sigAlg, p); - } catch (Exception ex) { - System.out.println("Skip due to no support: " + sigAlg); - ex.printStackTrace(); - return; - } byte[] data = "anything will do".getBytes(); @@ -85,9 +97,10 @@ private static void test(String sigAlg, KeyPair kp, Provider p) sig.update(data); byte[] signature = sig.sign(); - sig.initVerify(kp.getPublic()); - sig.update(data); - boolean verifies = sig.verify(signature); - System.out.println(sigAlg + ": Passed"); + Signature sigV = Signature.getInstance(sig.getAlgorithm() , p); + sigV.initVerify(kp.getPublic()); + sigV.update(data); + boolean verifies = sigV.verify(signature); + System.out.println("=> Passed"); } } diff --git a/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java b/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java index f553dcbe6db4a..004cb99d6013b 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestRSAKeyLength.java @@ -22,8 +22,8 @@ */ /* - * @test %W% %E% - * @bug 6695485 + * @test + * @bug 6695485 8242332 * @summary Make sure initSign/initVerify() check RSA key lengths * @author Yu-Ching Valerie Peng * @library /test/lib .. @@ -50,9 +50,14 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { - boolean isValidKeyLength[] = { true, true, true, false, false }; - String algos[] = { "SHA1withRSA", "SHA224withRSA", "SHA256withRSA", - "SHA384withRSA", "SHA512withRSA" }; + boolean isValidKeyLength[] = { + true, true, true, false, false, true, true, false, false + }; + String algos[] = { + "SHA1withRSA", "SHA224withRSA", "SHA256withRSA", + "SHA384withRSA", "SHA512withRSA", "SHA3-224withRSA", + "SHA3-256withRSA", "SHA3-384withRSA", "SHA3-512withRSA" + }; KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); kpg.initialize(512); KeyPair kp = kpg.generateKeyPair(); diff --git a/test/jdk/sun/security/pkcs11/nss/p11-nss.txt b/test/jdk/sun/security/pkcs11/nss/p11-nss.txt index 49778ea954c81..576b1dc4d69db 100644 --- a/test/jdk/sun/security/pkcs11/nss/p11-nss.txt +++ b/test/jdk/sun/security/pkcs11/nss/p11-nss.txt @@ -11,12 +11,23 @@ library = ${pkcs11test.nss.lib} nssArgs = "configdir='${pkcs11test.nss.db}' certPrefix='' keyPrefix='' secmod='secmod.db' flags=readOnly" -# HMAC_SHA256/384/512 broken until NSS 3.10.2 -# see https://bugzilla.mozilla.org/show_bug.cgi?id=291858 disabledMechanisms = { - CKM_SHA256_HMAC - CKM_SHA384_HMAC - CKM_SHA512_HMAC + CKM_DSA_SHA224 + CKM_DSA_SHA256 + CKM_DSA_SHA384 + CKM_DSA_SHA512 + CKM_DSA_SHA3_224 + CKM_DSA_SHA3_256 + CKM_DSA_SHA3_384 + CKM_DSA_SHA3_512 + CKM_ECDSA_SHA224 + CKM_ECDSA_SHA256 + CKM_ECDSA_SHA384 + CKM_ECDSA_SHA512 + CKM_ECDSA_SHA3_224 + CKM_ECDSA_SHA3_256 + CKM_ECDSA_SHA3_384 + CKM_ECDSA_SHA3_512 } attributes = compatibility From 972bc3b408251b0566f1f488382e66b8cee3c8dd Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Sun, 6 Dec 2020 00:08:22 +0000 Subject: [PATCH 090/504] 8256167: Convert JDK use of `Reference::get` to `Reference::refersTo` Reviewed-by: sspitsyn, shade, dfuchs, alanb, kbarrett --- .../classes/java/io/ObjectStreamClass.java | 6 ++-- .../share/classes/java/lang/Thread.java | 4 +-- .../share/classes/java/lang/ThreadLocal.java | 31 ++++++++----------- .../java/lang/invoke/DirectMethodHandle.java | 5 ++- .../classes/java/lang/ref/Reference.java | 2 +- .../java/lang/reflect/AccessibleObject.java | 4 +-- .../classes/java/util/ResourceBundle.java | 4 +-- .../share/classes/java/util/WeakHashMap.java | 24 ++++++++------ .../jdk/internal/logger/BootstrapLogger.java | 8 ++--- .../classes/java/util/logging/LogManager.java | 2 +- .../classes/java/util/logging/Logger.java | 3 +- .../jmx/mbeanserver/WeakIdentityHashMap.java | 9 +++--- 12 files changed, 49 insertions(+), 53 deletions(-) diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java index 89d9c739aa743..fc1c708cdd9e3 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -2411,7 +2411,7 @@ public boolean equals(Object obj) { Class referent; return (nullClass ? other.nullClass : ((referent = get()) != null) && - (referent == other.get())) && + (other.refersTo(referent))) && Arrays.equals(sigs, other.sigs); } else { return false; @@ -2532,9 +2532,9 @@ public boolean equals(Object obj) { } if (obj instanceof WeakClassKey) { - Object referent = get(); + Class referent = get(); return (referent != null) && - (referent == ((WeakClassKey) obj).get()); + (((WeakClassKey) obj).refersTo(referent)); } else { return false; } diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index f50b024f9d201..a825a52e35197 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -2044,9 +2044,9 @@ public boolean equals(Object obj) { return true; if (obj instanceof WeakClassKey) { - Object referent = get(); + Class referent = get(); return (referent != null) && - (referent == ((WeakClassKey) obj).get()); + (((WeakClassKey) obj).refersTo(referent)); } else { return false; } diff --git a/src/java.base/share/classes/java/lang/ThreadLocal.java b/src/java.base/share/classes/java/lang/ThreadLocal.java index 35529d4a1422b..ae696768395e8 100644 --- a/src/java.base/share/classes/java/lang/ThreadLocal.java +++ b/src/java.base/share/classes/java/lang/ThreadLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ package java.lang; import jdk.internal.misc.TerminatingThreadLocal; -import java.lang.ref.*; +import java.lang.ref.WeakReference; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; @@ -433,7 +433,7 @@ private ThreadLocalMap(ThreadLocalMap parentMap) { private Entry getEntry(ThreadLocal key) { int i = key.threadLocalHashCode & (table.length - 1); Entry e = table[i]; - if (e != null && e.get() == key) + if (e != null && e.refersTo(key)) return e; else return getEntryAfterMiss(key, i, e); @@ -453,10 +453,9 @@ private Entry getEntryAfterMiss(ThreadLocal key, int i, Entry e) { int len = tab.length; while (e != null) { - ThreadLocal k = e.get(); - if (k == key) + if (e.refersTo(key)) return e; - if (k == null) + if (e.refersTo(null)) expungeStaleEntry(i); else i = nextIndex(i, len); @@ -485,14 +484,12 @@ private void set(ThreadLocal key, Object value) { for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { - ThreadLocal k = e.get(); - - if (k == key) { + if (e.refersTo(key)) { e.value = value; return; } - if (k == null) { + if (e.refersTo(null)) { replaceStaleEntry(key, value, i); return; } @@ -514,7 +511,7 @@ private void remove(ThreadLocal key) { for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { - if (e.get() == key) { + if (e.refersTo(key)) { e.clear(); expungeStaleEntry(i); return; @@ -551,7 +548,7 @@ private void replaceStaleEntry(ThreadLocal key, Object value, for (int i = prevIndex(staleSlot, len); (e = tab[i]) != null; i = prevIndex(i, len)) - if (e.get() == null) + if (e.refersTo(null)) slotToExpunge = i; // Find either the key or trailing null slot of run, whichever @@ -559,14 +556,12 @@ private void replaceStaleEntry(ThreadLocal key, Object value, for (int i = nextIndex(staleSlot, len); (e = tab[i]) != null; i = nextIndex(i, len)) { - ThreadLocal k = e.get(); - // If we find key, then we need to swap it // with the stale entry to maintain hash table order. // The newly stale slot, or any other stale slot // encountered above it, can then be sent to expungeStaleEntry // to remove or rehash all of the other entries in run. - if (k == key) { + if (e.refersTo(key)) { e.value = value; tab[i] = tab[staleSlot]; @@ -582,7 +577,7 @@ private void replaceStaleEntry(ThreadLocal key, Object value, // If we didn't find stale entry on backward scan, the // first stale entry seen while scanning for key is the // first still present in the run. - if (k == null && slotToExpunge == staleSlot) + if (e.refersTo(null) && slotToExpunge == staleSlot) slotToExpunge = i; } @@ -673,7 +668,7 @@ private boolean cleanSomeSlots(int i, int n) { do { i = nextIndex(i, len); Entry e = tab[i]; - if (e != null && e.get() == null) { + if (e != null && e.refersTo(null)) { n = len; removed = true; i = expungeStaleEntry(i); @@ -733,7 +728,7 @@ private void expungeStaleEntries() { int len = tab.length; for (int j = 0; j < len; j++) { Entry e = tab[j]; - if (e != null && e.get() == null) + if (e != null && e.refersTo(null)) expungeStaleEntry(j); } } diff --git a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java index a9ce7622e9b04..46d8c3b33ef96 100644 --- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java +++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, 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 @@ -402,9 +402,8 @@ private static boolean checkInitialized(MemberName member) { if (ref == null) { return true; // the final state } - Thread clinitThread = ref.get(); // Somebody may still be running defc.. - if (clinitThread == Thread.currentThread()) { + if (ref.refersTo(Thread.currentThread())) { // If anybody is running defc., it is this thread. if (UNSAFE.shouldBeInitialized(defc)) // Yes, we are running it; keep the barrier for now. diff --git a/src/java.base/share/classes/java/lang/ref/Reference.java b/src/java.base/share/classes/java/lang/ref/Reference.java index c2dfd803cbee8..386cb99fbcddd 100644 --- a/src/java.base/share/classes/java/lang/ref/Reference.java +++ b/src/java.base/share/classes/java/lang/ref/Reference.java @@ -337,7 +337,7 @@ public void runFinalization() { * * @return The object to which this reference refers, or * {@code null} if this reference object has been cleared - * @see refersTo + * @see #refersTo */ @IntrinsicCandidate public T get() { diff --git a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java index 1b20c627d78e7..a3346b8c3f80f 100644 --- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java +++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java @@ -642,7 +642,7 @@ private static class Cache { } boolean isCacheFor(Class caller, Class refc) { - return callerRef.get() == caller && targetRef.get() == refc; + return callerRef.refersTo(caller) && targetRef.refersTo(refc); } static Object protectedMemberCallerCache(Class caller, Class refc) { @@ -674,7 +674,7 @@ private boolean isAccessChecked(Class caller) { if (cache instanceof WeakReference) { @SuppressWarnings("unchecked") WeakReference> ref = (WeakReference>) cache; - return ref.get() == caller; + return ref.refersTo(caller); } return false; } diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index 89f7821b3d4a4..1bf84f683a5ee 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2020, 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 @@ -1755,7 +1755,7 @@ private static ResourceBundle findBundle(Module callerModule, // Otherwise, remove the cached one since we can't keep // the same bundles having different parents. BundleReference bundleRef = cacheList.get(cacheKey); - if (bundleRef != null && bundleRef.get() == bundle) { + if (bundleRef != null && bundleRef.refersTo(bundle)) { cacheList.remove(cacheKey, bundleRef); } } diff --git a/src/java.base/share/classes/java/util/WeakHashMap.java b/src/java.base/share/classes/java/util/WeakHashMap.java index 7a3b3dd3f4e24..1f4a445eb12e2 100644 --- a/src/java.base/share/classes/java/util/WeakHashMap.java +++ b/src/java.base/share/classes/java/util/WeakHashMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, 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 @@ -27,7 +27,6 @@ import java.lang.ref.WeakReference; import java.lang.ref.ReferenceQueue; -import java.util.concurrent.ThreadLocalRandom; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; @@ -283,8 +282,14 @@ static Object unmaskNull(Object key) { * Checks for equality of non-null reference x and possibly-null y. By * default uses Object.equals. */ - private static boolean eq(Object x, Object y) { - return x == y || x.equals(y); + private boolean matchesKey(Entry e, Object key) { + // check if the given entry refers to the given key without + // keeping a strong reference to the entry's referent + if (e.refersTo(key)) return true; + + // then check for equality if the referent is not cleared + Object k = e.get(); + return k != null && key.equals(k); } /** @@ -399,7 +404,7 @@ public V get(Object key) { int index = indexFor(h, tab.length); Entry e = tab[index]; while (e != null) { - if (e.hash == h && eq(k, e.get())) + if (e.hash == h && matchesKey(e, k)) return e.value; e = e.next; } @@ -428,7 +433,7 @@ Entry getEntry(Object key) { Entry[] tab = getTable(); int index = indexFor(h, tab.length); Entry e = tab[index]; - while (e != null && !(e.hash == h && eq(k, e.get()))) + while (e != null && !(e.hash == h && matchesKey(e, k))) e = e.next; return e; } @@ -452,7 +457,7 @@ public V put(K key, V value) { int i = indexFor(h, tab.length); for (Entry e = tab[i]; e != null; e = e.next) { - if (h == e.hash && eq(k, e.get())) { + if (h == e.hash && matchesKey(e, k)) { V oldValue = e.value; if (value != oldValue) e.value = value; @@ -515,8 +520,7 @@ private void transfer(Entry[] src, Entry[] dest) { src[j] = null; while (e != null) { Entry next = e.next; - Object key = e.get(); - if (key == null) { + if (e.refersTo(null)) { e.next = null; // Help GC e.value = null; // " " size--; @@ -597,7 +601,7 @@ public V remove(Object key) { while (e != null) { Entry next = e.next; - if (h == e.hash && eq(k, e.get())) { + if (h == e.hash && matchesKey(e, k)) { modCount++; size--; if (prev == e) diff --git a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java index ee98b92ea635c..6012e11b780e1 100644 --- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java +++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -181,12 +181,10 @@ static void awaitPendingTasks() { // This is used by tests. static boolean isAlive() { WeakReference ref = executorRef; - ExecutorService executor = ref == null ? null : ref.get(); - if (executor != null) return true; + if (ref != null && !ref.refersTo(null)) return true; synchronized (BootstrapExecutors.class) { ref = executorRef; - executor = ref == null ? null : ref.get(); - return executor != null; + return ref != null && !ref.refersTo(null); } } diff --git a/src/java.logging/share/classes/java/util/logging/LogManager.java b/src/java.logging/share/classes/java/util/logging/LogManager.java index a181910e94be3..070d76b480506 100644 --- a/src/java.logging/share/classes/java/util/logging/LogManager.java +++ b/src/java.logging/share/classes/java/util/logging/LogManager.java @@ -777,7 +777,7 @@ synchronized boolean addLocalLogger(Logger logger, boolean addDefaultLoggersIfNe } LoggerWeakRef ref = namedLoggers.get(name); if (ref != null) { - if (ref.get() == null) { + if (ref.refersTo(null)) { // It's possible that the Logger was GC'ed after a // drainLoggerRefQueueBounded() call above so allow // a new one to be registered. diff --git a/src/java.logging/share/classes/java/util/logging/Logger.java b/src/java.logging/share/classes/java/util/logging/Logger.java index a271dcc902ddc..dea029a90bf6b 100644 --- a/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/src/java.logging/share/classes/java/util/logging/Logger.java @@ -2404,8 +2404,7 @@ private void doSetParent(Logger newParent) { // assert parent.kids != null; for (Iterator iter = parent.kids.iterator(); iter.hasNext(); ) { ref = iter.next(); - Logger kid = ref.get(); - if (kid == this) { + if (ref.refersTo(this)) { // ref is used down below to complete the reparenting iter.remove(); break; diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java index 887ebe96455e0..53c1796352637 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -120,9 +120,10 @@ public boolean equals(Object o) { return true; if (!(o instanceof IdentityWeakReference)) return false; - IdentityWeakReference wr = (IdentityWeakReference) o; - Object got = get(); - return (got != null && got == wr.get()); + @SuppressWarnings("unchecked") + IdentityWeakReference wr = (IdentityWeakReference) o; + T got = get(); + return got != null && wr.refersTo(got); } public int hashCode() { From e590618962edc0d4d21ac05f813257bcef0a867f Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Sun, 6 Dec 2020 17:43:34 +0000 Subject: [PATCH 091/504] 8252505: C1/C2 compiler support for blackholes Reviewed-by: vlivanov, aph --- src/hotspot/share/c1/c1_Compiler.cpp | 2 + src/hotspot/share/c1/c1_GraphBuilder.cpp | 2 +- src/hotspot/share/c1/c1_LIRGenerator.cpp | 21 ++ src/hotspot/share/c1/c1_LIRGenerator.hpp | 1 + src/hotspot/share/ci/ciMethod.cpp | 4 + src/hotspot/share/ci/ciMethod.hpp | 9 + .../share/classfile/classFileParser.cpp | 5 + src/hotspot/share/classfile/vmIntrinsics.cpp | 1 + src/hotspot/share/classfile/vmIntrinsics.hpp | 3 + src/hotspot/share/classfile/vmSymbols.hpp | 1 + src/hotspot/share/compiler/compilerOracle.cpp | 12 + src/hotspot/share/compiler/compilerOracle.hpp | 4 + src/hotspot/share/opto/c2compiler.cpp | 2 + src/hotspot/share/opto/classes.hpp | 1 + src/hotspot/share/opto/compile.cpp | 2 + src/hotspot/share/opto/library_call.cpp | 35 +- src/hotspot/share/opto/library_call.hpp | 2 + src/hotspot/share/opto/memnode.cpp | 23 ++ src/hotspot/share/opto/memnode.hpp | 20 ++ src/hotspot/share/opto/node.hpp | 1 + src/hotspot/share/opto/regmask.cpp | 7 + src/hotspot/share/opto/regmask.hpp | 1 + src/hotspot/share/runtime/vmStructs.cpp | 1 + .../BlackholeInstanceReturnTest.java | 183 ++++++++++ .../blackhole/BlackholeInstanceTest.java | 314 ++++++++++++++++++ .../blackhole/BlackholeNonVoidWarning.java | 95 ++++++ .../blackhole/BlackholeNullCheckTest.java | 173 ++++++++++ .../blackhole/BlackholeStaticReturnTest.java | 174 ++++++++++ .../blackhole/BlackholeStaticTest.java | 287 ++++++++++++++++ .../compiler/blackhole/BlackholeTarget.java | 136 ++++++++ 30 files changed, 1520 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeTarget.java diff --git a/src/hotspot/share/c1/c1_Compiler.cpp b/src/hotspot/share/c1/c1_Compiler.cpp index f245594c5a689..a3ffcdb785f92 100644 --- a/src/hotspot/share/c1/c1_Compiler.cpp +++ b/src/hotspot/share/c1/c1_Compiler.cpp @@ -230,6 +230,8 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) { break; case vmIntrinsics::_getObjectSize: break; + case vmIntrinsics::_blackhole: + break; default: return false; // Intrinsics not on the previous list are not available. } diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index 102333cea3244..a981c1fd461be 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -3415,7 +3415,7 @@ bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, bool ignore_r // handle intrinsics if (callee->intrinsic_id() != vmIntrinsics::_none && - (CheckIntrinsics ? callee->intrinsic_candidate() : true)) { + callee->check_intrinsic_candidate()) { if (try_inline_intrinsics(callee, ignore_return)) { print_inlining(callee, "intrinsic"); if (callee->has_reserved_stack_access()) { diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp index c6e23d3ce17df..ef57876273dfe 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.cpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp @@ -3206,6 +3206,10 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { do_vectorizedMismatch(x); break; + case vmIntrinsics::_blackhole: + do_blackhole(x); + break; + default: ShouldNotReachHere(); break; } } @@ -3625,6 +3629,23 @@ void LIRGenerator::do_RangeCheckPredicate(RangeCheckPredicate *x) { } } +void LIRGenerator::do_blackhole(Intrinsic *x) { + // If we have a receiver, then null-check and handle it separately + bool handle_receiver = x->needs_null_check(); + if (handle_receiver) { + CodeEmitInfo* info = state_for(x); + LIRItem vitem(x->receiver(), this); + vitem.load_item(); + __ null_check(vitem.result(), info); + } + + for (int c = (handle_receiver ? 1 : 0); c < x->number_of_arguments(); c++) { + // Load the argument + LIRItem vitem(x->argument_at(c), this); + vitem.load_item(); + // ...and leave it unused. + } +} LIR_Opr LIRGenerator::call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info) { LIRItemList args(1); diff --git a/src/hotspot/share/c1/c1_LIRGenerator.hpp b/src/hotspot/share/c1/c1_LIRGenerator.hpp index f1b89e542fc02..8817efc148c7a 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.hpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp @@ -265,6 +265,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { void do_update_CRC32(Intrinsic* x); void do_update_CRC32C(Intrinsic* x); void do_vectorizedMismatch(Intrinsic* x); + void do_blackhole(Intrinsic* x); public: LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info); diff --git a/src/hotspot/share/ci/ciMethod.cpp b/src/hotspot/share/ci/ciMethod.cpp index 7c60456f7019b..bdfe57a8b81be 100644 --- a/src/hotspot/share/ci/ciMethod.cpp +++ b/src/hotspot/share/ci/ciMethod.cpp @@ -155,6 +155,10 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) : ciReplay::initialize(this); } #endif + + if (CompilerOracle::should_blackhole(h_m)) { + h_m->set_intrinsic_id(vmIntrinsics::_blackhole); + } } diff --git a/src/hotspot/share/ci/ciMethod.hpp b/src/hotspot/share/ci/ciMethod.hpp index 4507598afbf24..ae79a4e0e8d21 100644 --- a/src/hotspot/share/ci/ciMethod.hpp +++ b/src/hotspot/share/ci/ciMethod.hpp @@ -201,6 +201,15 @@ class ciMethod : public ciMetadata { bool intrinsic_candidate() const { return get_Method()->intrinsic_candidate(); } bool is_static_initializer() const { return get_Method()->is_static_initializer(); } + bool check_intrinsic_candidate() const { + if (intrinsic_id() == vmIntrinsics::_blackhole) { + // This is the intrinsic without an associated method, so no intrinsic_candidate + // flag is set. The intrinsic is still correct. + return true; + } + return (CheckIntrinsics ? intrinsic_candidate() : true); + } + int highest_osr_comp_level(); Bytecodes::Code java_code_at_bci(int bci) { diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index f0463f2c3bbfb..124cee2ca8a54 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -5295,6 +5295,11 @@ static void check_methods_for_intrinsics(const InstanceKlass* ik, // is defined for it. continue; } + if (vmIntrinsics::_blackhole == id) { + // The _blackhole intrinsic is a special marker. No explicit method + // is defined for it. + continue; + } if (vmIntrinsics::class_for(id) == klass_id) { // Check if the current class contains a method with the same diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index ae1e5249fa358..a686c05022463 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -151,6 +151,7 @@ bool vmIntrinsics::should_be_pinned(vmIntrinsics::ID id) { #endif case vmIntrinsics::_currentTimeMillis: case vmIntrinsics::_nanoTime: + case vmIntrinsics::_blackhole: return true; default: return false; diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index 9bef6e8b045ef..9b6ecde2e3957 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -533,6 +533,9 @@ class methodHandle; do_name( getObjectSize_name, "getObjectSize0") \ do_alias( getObjectSize_signature, long_object_long_signature) \ \ + /* special marker for blackholed methods: */ \ + do_intrinsic(_blackhole, java_lang_Object, blackhole_name, star_name, F_S) \ + \ /* unsafe memory references (there are a lot of them...) */ \ do_signature(getReference_signature, "(Ljava/lang/Object;J)Ljava/lang/Object;") \ do_signature(putReference_signature, "(Ljava/lang/Object;JLjava/lang/Object;)V") \ diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index c85bc1583c6a6..de399d809cc4e 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.hpp @@ -282,6 +282,7 @@ template(signature_name, "signature") \ template(slot_name, "slot") \ template(trusted_final_name, "trustedFinal") \ + template(blackhole_name, "") /*fake name*/ \ \ /* Support for annotations (JDK 1.5 and above) */ \ \ diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 193c791df7457..091839aa4acef 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -409,6 +409,18 @@ bool CompilerOracle::should_break_at(const methodHandle& method) { return check_predicate(CompileCommand::Break, method); } +bool CompilerOracle::should_blackhole(const methodHandle& method) { + if (check_predicate(CompileCommand::Blackhole, method)) { + if (method->result_type() == T_VOID) { + return true; + } else { + warning("blackhole compile command only works for methods with void type: %s", + method->name_and_sig_as_C_string()); + } + } + return false; +} + static enum CompileCommand parse_option_name(const char* line, int* bytes_read, char* errorbuf, int bufsize) { assert(ARRAY_SIZE(option_names) == static_cast(CompileCommand::Count), "option_names size mismatch"); diff --git a/src/hotspot/share/compiler/compilerOracle.hpp b/src/hotspot/share/compiler/compilerOracle.hpp index 23cfde6f0625b..0ca960d9eba52 100644 --- a/src/hotspot/share/compiler/compilerOracle.hpp +++ b/src/hotspot/share/compiler/compilerOracle.hpp @@ -51,6 +51,7 @@ class methodHandle; option(Print, "print", Bool) \ option(Inline, "inline", Bool) \ option(DontInline, "dontinline", Bool) \ + option(Blackhole, "blackhole", Bool) \ option(CompileOnly, "compileonly", Bool)\ option(Exclude, "exclude", Bool) \ option(Break, "break", Bool) \ @@ -141,6 +142,9 @@ class CompilerOracle : AllStatic { // Tells whether to break when compiling method static bool should_break_at(const methodHandle& method); + // Tells whether to blackhole when compiling method + static bool should_blackhole(const methodHandle& method); + // Tells whether there are any methods to print for print_method_statistics() static bool should_print_methods(); diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index 36ab93124d99e..4becb5bedc169 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -675,6 +675,8 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_VectorInsert: case vmIntrinsics::_VectorExtract: return EnableVectorSupport; + case vmIntrinsics::_blackhole: + break; default: return false; diff --git a/src/hotspot/share/opto/classes.hpp b/src/hotspot/share/opto/classes.hpp index 7359df5689515..74be3d0e08c38 100644 --- a/src/hotspot/share/opto/classes.hpp +++ b/src/hotspot/share/opto/classes.hpp @@ -44,6 +44,7 @@ macro(ArrayCopy) macro(AryEq) macro(AtanD) macro(Binary) +macro(Blackhole) macro(Bool) macro(BoxLock) macro(ReverseBytesI) diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 77be65465c473..65061c8b769ac 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -3466,6 +3466,8 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f } break; } + case Op_Blackhole: + break; case Op_RangeCheck: { RangeCheckNode* rc = n->as_RangeCheck(); Node* iff = new IfNode(rc->in(0), rc->in(1), rc->_prob, rc->_fcnt); diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 77363b1592b70..e51fa2c76852b 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -110,7 +110,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) { const int bci = kit.bci(); // Try to inline the intrinsic. - if ((CheckIntrinsics ? callee->intrinsic_candidate() : true) && + if (callee->check_intrinsic_candidate() && kit.try_to_inline(_last_predicate)) { const char *inline_msg = is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"; @@ -667,6 +667,9 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_getObjectSize: return inline_getObjectSize(); + case vmIntrinsics::_blackhole: + return inline_blackhole(); + default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. @@ -6848,3 +6851,33 @@ bool LibraryCallKit::inline_getObjectSize() { return true; } + +//------------------------------- inline_blackhole -------------------------------------- +// +// Make sure all arguments to this node are alive. +// This matches methods that were requested to be blackholed through compile commands. +// +bool LibraryCallKit::inline_blackhole() { + // To preserve the semantics of Java call, we need to null-check the receiver, + // if present. Shortcut if receiver is unconditionally null. + Node* receiver = NULL; + bool has_receiver = !callee()->is_static(); + if (has_receiver) { + receiver = null_check_receiver(); + if (stopped()) { + return true; + } + } + + // Bind call arguments as blackhole arguments to keep them alive + Node* bh = insert_mem_bar(Op_Blackhole); + if (has_receiver) { + bh->add_req(receiver); + } + uint nargs = callee()->arg_size(); + for (uint i = has_receiver ? 1 : 0; i < nargs; i++) { + bh->add_req(argument(i)); + } + + return true; +} diff --git a/src/hotspot/share/opto/library_call.hpp b/src/hotspot/share/opto/library_call.hpp index 021f7dd79d0a6..6395a29f38e4b 100644 --- a/src/hotspot/share/opto/library_call.hpp +++ b/src/hotspot/share/opto/library_call.hpp @@ -344,5 +344,7 @@ class LibraryCallKit : public GraphKit { } bool inline_getObjectSize(); + + bool inline_blackhole(); }; diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index 90d221964cd34..dbec14a171dc0 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -33,6 +33,7 @@ #include "opto/addnode.hpp" #include "opto/arraycopynode.hpp" #include "opto/cfgnode.hpp" +#include "opto/regalloc.hpp" #include "opto/compile.hpp" #include "opto/connode.hpp" #include "opto/convertnode.hpp" @@ -3221,6 +3222,7 @@ MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { case Op_OnSpinWait: return new OnSpinWaitNode(C, atp, pn); case Op_Initialize: return new InitializeNode(C, atp, pn); case Op_MemBarStoreStore: return new MemBarStoreStoreNode(C, atp, pn); + case Op_Blackhole: return new BlackholeNode(C, atp, pn); default: ShouldNotReachHere(); return NULL; } } @@ -3455,6 +3457,27 @@ MemBarNode* MemBarNode::leading_membar() const { return mb; } +#ifndef PRODUCT +void BlackholeNode::format(PhaseRegAlloc* ra, outputStream* st) const { + st->print("blackhole "); + bool first = true; + for (uint i = 0; i < req(); i++) { + Node* n = in(i); + if (n != NULL && OptoReg::is_valid(ra->get_reg_first(n))) { + if (first) { + first = false; + } else { + st->print(", "); + } + char buf[128]; + ra->dump_register(n, buf); + st->print("%s", buf); + } + } + st->cr(); +} +#endif + //===========================InitializeNode==================================== // SUMMARY: // This node acts as a memory barrier on raw memory, after some raw stores. diff --git a/src/hotspot/share/opto/memnode.hpp b/src/hotspot/share/opto/memnode.hpp index b9ee30fe30c55..275165c75f046 100644 --- a/src/hotspot/share/opto/memnode.hpp +++ b/src/hotspot/share/opto/memnode.hpp @@ -1335,6 +1335,26 @@ class OnSpinWaitNode: public MemBarNode { virtual int Opcode() const; }; +//------------------------------BlackholeNode---------------------------- +// Blackhole all arguments. This node would survive through the compiler +// the effects on its arguments, and would be finally matched to nothing. +class BlackholeNode : public MemBarNode { +public: + BlackholeNode(Compile* C, int alias_idx, Node* precedent) + : MemBarNode(C, alias_idx, precedent) {} + virtual int Opcode() const; + virtual uint ideal_reg() const { return 0; } // not matched in the AD file + const RegMask &in_RegMask(uint idx) const { + // Fake the incoming arguments mask for blackholes: accept all registers + // and all stack slots. This would avoid moving the arguments for the + // call that never happens. + return RegMask::All; + } +#ifndef PRODUCT + virtual void format(PhaseRegAlloc* ra, outputStream* st) const; +#endif +}; + // Isolation of object setup after an AllocateNode and before next safepoint. // (See comment in memnode.cpp near InitializeNode::InitializeNode for semantics.) class InitializeNode: public MemBarNode { diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index 35192e27f7005..32f1cc02cadce 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -44,6 +44,7 @@ class AllocateNode; class ArrayCopyNode; class BaseCountedLoopNode; class BaseCountedLoopEndNode; +class BlackholeNode; class Block; class BoolNode; class BoxLockNode; diff --git a/src/hotspot/share/opto/regmask.cpp b/src/hotspot/share/opto/regmask.cpp index 88a744f9f7f30..9710ed3cb22c9 100644 --- a/src/hotspot/share/opto/regmask.cpp +++ b/src/hotspot/share/opto/regmask.cpp @@ -51,6 +51,13 @@ void OptoReg::dump(int r, outputStream *st) { //============================================================================= const RegMask RegMask::Empty; +const RegMask RegMask::All( +# define BODY(I) -1, + FORALL_BODY +# undef BODY + 0 +); + //============================================================================= bool RegMask::is_vector(uint ireg) { return (ireg == Op_VecA || ireg == Op_VecS || ireg == Op_VecD || diff --git a/src/hotspot/share/opto/regmask.hpp b/src/hotspot/share/opto/regmask.hpp index 2d4d19caf107a..8d862eb128cf0 100644 --- a/src/hotspot/share/opto/regmask.hpp +++ b/src/hotspot/share/opto/regmask.hpp @@ -356,6 +356,7 @@ class RegMask { #endif static const RegMask Empty; // Common empty mask + static const RegMask All; // Common all mask static bool can_represent(OptoReg::Name reg) { // NOTE: -1 in computation reflects the usage of the last diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 52601520bc598..7edf022af64ce 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -1594,6 +1594,7 @@ typedef HashtableEntry KlassHashtableEntry; declare_c2_type(MemBarVolatileNode, MemBarNode) \ declare_c2_type(MemBarCPUOrderNode, MemBarNode) \ declare_c2_type(OnSpinWaitNode, MemBarNode) \ + declare_c2_type(BlackholeNode, MemBarNode) \ declare_c2_type(InitializeNode, MemBarNode) \ declare_c2_type(ThreadLocalNode, Node) \ declare_c2_type(Opaque1Node, Node) \ diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java new file mode 100644 index 0000000000000..d6e067d26819b --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2020, Red Hat, 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 id=c1 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceReturnTest + */ + +/** + * @test id=c2 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceReturnTest + */ + +/** + * @test id=c1-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceReturnTest + */ + +/** + * @test id=c2-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceReturnTest + */ + +package compiler.blackhole; + +public class BlackholeInstanceReturnTest { + + public static void main(String[] args) { + runTries(BlackholeInstanceReturnTest::test_boolean); + runTries(BlackholeInstanceReturnTest::test_byte); + runTries(BlackholeInstanceReturnTest::test_char); + runTries(BlackholeInstanceReturnTest::test_short); + runTries(BlackholeInstanceReturnTest::test_int); + runTries(BlackholeInstanceReturnTest::test_float); + runTries(BlackholeInstanceReturnTest::test_long); + runTries(BlackholeInstanceReturnTest::test_double); + runTries(BlackholeInstanceReturnTest::test_Object); + } + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void runTries(Runnable r) { + for (int t = 0; t < TRIES; t++) { + BlackholeTarget.clear(); + r.run(); + BlackholeTarget.shouldBeEntered(); + } + } + + private static void test_boolean() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_boolean((c & 0x1) == 0) != false) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_byte() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_byte((byte)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_char() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_char((char)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_short() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_short((short)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_int() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_int(c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_float() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_float(c) != 0F) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_long() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_long(c) != 0L) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_double() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + if (t.bh_ir_double(c) != 0D) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_Object() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + Object o = new Object(); + if (t.bh_ir_Object(o) != null) { + throw new AssertionError("Return value error"); + } + } + } + +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java new file mode 100644 index 0000000000000..010df2a371625 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2020, Red Hat, 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 id=c1 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceTest + */ + +/** + * @test id=c2 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceTest + */ + +/** + * @test id=c1-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceTest + */ + +/** + * @test id=c2-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeInstanceTest + */ + +package compiler.blackhole; + +public class BlackholeInstanceTest { + + public static void main(String[] args) { + runTries(BlackholeInstanceTest::test_boolean_0); + runTries(BlackholeInstanceTest::test_byte_0); + runTries(BlackholeInstanceTest::test_char_0); + runTries(BlackholeInstanceTest::test_short_0); + runTries(BlackholeInstanceTest::test_int_0); + runTries(BlackholeInstanceTest::test_float_0); + runTries(BlackholeInstanceTest::test_long_0); + runTries(BlackholeInstanceTest::test_double_0); + runTries(BlackholeInstanceTest::test_Object_0); + + runTries(BlackholeInstanceTest::test_boolean_1); + runTries(BlackholeInstanceTest::test_byte_1); + runTries(BlackholeInstanceTest::test_char_1); + runTries(BlackholeInstanceTest::test_short_1); + runTries(BlackholeInstanceTest::test_int_1); + runTries(BlackholeInstanceTest::test_float_1); + runTries(BlackholeInstanceTest::test_long_1); + runTries(BlackholeInstanceTest::test_double_1); + runTries(BlackholeInstanceTest::test_Object_1); + + runTries(BlackholeInstanceTest::test_boolean_2); + runTries(BlackholeInstanceTest::test_byte_2); + runTries(BlackholeInstanceTest::test_char_2); + runTries(BlackholeInstanceTest::test_short_2); + runTries(BlackholeInstanceTest::test_int_2); + runTries(BlackholeInstanceTest::test_float_2); + runTries(BlackholeInstanceTest::test_long_2); + runTries(BlackholeInstanceTest::test_double_2); + runTries(BlackholeInstanceTest::test_Object_2); + } + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void runTries(Runnable r) { + for (int t = 0; t < TRIES; t++) { + BlackholeTarget.clear(); + r.run(); + if (t == TRIES - 1) { + BlackholeTarget.shouldNotBeEntered(); + } + } + } + + private static void test_boolean_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_boolean_0(); + } + } + + private static void test_byte_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_byte_0(); + } + } + + private static void test_char_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_char_0(); + } + } + + private static void test_short_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_short_0(); + } + } + + private static void test_int_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_int_0(); + } + } + + private static void test_float_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_float_0(); + } + } + + private static void test_long_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_long_0(); + } + } + + private static void test_double_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_double_0(); + } + } + + private static void test_Object_0() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_Object_0(); + } + } + + private static void test_boolean_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_boolean_1((c & 0x1) == 0); + } + } + + private static void test_byte_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_byte_1((byte)c); + } + } + + private static void test_char_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_char_1((char)c); + } + } + + private static void test_short_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_short_1((short)c); + } + } + + private static void test_int_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_int_1(c); + } + } + + private static void test_float_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_float_1(c); + } + } + + private static void test_long_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_long_1(c); + } + } + + private static void test_double_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_double_1(c); + } + } + + private static void test_Object_1() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + Object o = new Object(); + t.bh_i_Object_1(o); + } + } + + private static void test_boolean_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_boolean_2((c & 0x1) == 0, (c & 0x2) == 0); + } + } + + private static void test_byte_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_byte_2((byte)c, (byte)(c + 1)); + } + } + + private static void test_char_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_char_2((char)c, (char)(c + 1)); + } + } + + private static void test_short_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_short_2((short)c, (short)(c + 1)); + } + } + + private static void test_int_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_int_2(c, c + 1); + } + } + + private static void test_float_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_float_2(c, c + 1); + } + } + + private static void test_long_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_long_2(c, c + 1); + } + } + + private static void test_double_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + t.bh_i_double_2(c, c + 1); + } + } + + private static void test_Object_2() { + BlackholeTarget t = new BlackholeTarget(); + for (int c = 0; c < CYCLES; c++) { + Object o1 = new Object(); + Object o2 = new Object(); + t.bh_i_Object_2(o1, o2); + } + } +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java new file mode 100644 index 0000000000000..2d7ed7ed8c9d1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2020, Red Hat, 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 + * @library /test/lib + * @build compiler.blackhole.BlackholeTarget + * @run driver compiler.blackhole.BlackholeNonVoidWarning + */ + +package compiler.blackhole; + +import java.io.IOException; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class BlackholeNonVoidWarning { + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void main(String[] args) throws IOException { + if (args.length == 0) { + driver(); + } else { + runner(); + } + } + + public static void driver() throws IOException { + final String msg = "blackhole compile command only works for methods with void type: compiler.blackhole.BlackholeTarget.bh_sr_int(I)I"; + + { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx128m", + "-XX:CompileCommand=quiet", + "-XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_*", + "compiler.blackhole.BlackholeNonVoidWarning", + "run" + ); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + output.shouldContain(msg); + } + + { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx128m", + "-XX:-PrintWarnings", + "-XX:CompileCommand=quiet", + "-XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_*", + "compiler.blackhole.BlackholeNonVoidWarning", + "run" + ); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + output.shouldNotContain(msg); + } + } + + public static void runner() { + for (int t = 0; t < TRIES; t++) { + run(); + } + } + + public static void run() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_int(c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java new file mode 100644 index 0000000000000..ccf572e43e674 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2020, Red Hat, 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 id=c1 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeNullCheckTest + */ + +/** + * @test id=c2 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeNullCheckTest + */ + +/** + * @test id=c1-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeNullCheckTest + */ + +/** + * @test id=c2-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeNullCheckTest + */ + +package compiler.blackhole; + +public class BlackholeNullCheckTest { + + public static void main(String[] args) { + BlackholeNullCheckTest t = new BlackholeNullCheckTest(); + runTries(t::test_local_sf); + runTries(t::test_local_s); + runTries(t::test_local); + runTries(t::test_field_sf); + runTries(t::test_field_s); + runTries(t::test_field); + } + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void runTries(Runnable r) { + for (int t = 0; t < TRIES; t++) { + r.run(); + } + } + + static final BlackholeTarget BH_SF_TARGET = null; + static BlackholeTarget BH_S_TARGET = null; + BlackholeTarget BH_TARGET = null; + + private void test_local_sf() { + test_with(BH_SF_TARGET); + } + + private void test_local_s() { + test_with(BH_S_TARGET); + } + + private void test_local() { + test_with(BH_TARGET); + } + + private void test_with(BlackholeTarget t) { + try { + t.bh_i_boolean_1(false); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + } + + try { + t.call_for_null_check(); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + // Expected + } + } + + private void test_field_sf() { + try { + BH_SF_TARGET.bh_i_boolean_1(false); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + } + + try { + BH_SF_TARGET.call_for_null_check(); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + // Expected + } + } + + private void test_field_s() { + try { + BH_S_TARGET.bh_i_boolean_1(false); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + } + + try { + BH_S_TARGET.call_for_null_check(); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + // Expected + } + } + + private void test_field() { + try { + BH_TARGET.bh_i_boolean_1(false); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + } + + try { + BH_TARGET.call_for_null_check(); + throw new IllegalStateException("Expected NPE"); + } catch (NullPointerException npe) { + // Expected + } + } + +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java new file mode 100644 index 0000000000000..fb554d7a6d4d2 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2020, Red Hat, 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 id=c1 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticReturnTest + */ + +/** + * @test id=c2 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticReturnTest + */ + +/** + * @test id=c1-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticReturnTest + */ + +/** + * @test id=c2-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticReturnTest + */ + +package compiler.blackhole; + +public class BlackholeStaticReturnTest { + + public static void main(String[] args) { + runTries(BlackholeStaticReturnTest::test_boolean); + runTries(BlackholeStaticReturnTest::test_byte); + runTries(BlackholeStaticReturnTest::test_char); + runTries(BlackholeStaticReturnTest::test_short); + runTries(BlackholeStaticReturnTest::test_int); + runTries(BlackholeStaticReturnTest::test_float); + runTries(BlackholeStaticReturnTest::test_long); + runTries(BlackholeStaticReturnTest::test_double); + runTries(BlackholeStaticReturnTest::test_Object); + } + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void runTries(Runnable r) { + for (int t = 0; t < TRIES; t++) { + BlackholeTarget.clear(); + r.run(); + BlackholeTarget.shouldBeEntered(); + } + } + + private static void test_boolean() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_boolean((c & 0x1) == 0) != false) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_byte() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_byte((byte)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_char() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_char((char)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_short() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_short((short)c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_int() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_int(c) != 0) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_float() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_float(c) != 0F) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_long() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_long(c) != 0L) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_double() { + for (int c = 0; c < CYCLES; c++) { + if (BlackholeTarget.bh_sr_double(c) != 0D) { + throw new AssertionError("Return value error"); + } + } + } + + private static void test_Object() { + for (int c = 0; c < CYCLES; c++) { + Object o = new Object(); + if (BlackholeTarget.bh_sr_Object(o) != null) { + throw new AssertionError("Return value error"); + } + } + } + +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java new file mode 100644 index 0000000000000..17f413054c3fb --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2020, Red Hat, 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 id=c1 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticTest + */ + +/** + * @test id=c2 + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticTest + */ + +/** + * @test id=c1-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:TieredStopAtLevel=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticTest + */ + +/** + * @test id=c2-no-coops + * @requires vm.bits == "64" + * @build compiler.blackhole.BlackholeTarget + * + * @run main/othervm + * -Xmx1g -XX:-UseCompressedOops + * -XX:-TieredCompilation + * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure + * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* + * compiler.blackhole.BlackholeStaticTest + */ + +package compiler.blackhole; + +public class BlackholeStaticTest { + + public static void main(String[] args) { + runTries(BlackholeStaticTest::test_boolean_0); + runTries(BlackholeStaticTest::test_byte_0); + runTries(BlackholeStaticTest::test_char_0); + runTries(BlackholeStaticTest::test_short_0); + runTries(BlackholeStaticTest::test_int_0); + runTries(BlackholeStaticTest::test_float_0); + runTries(BlackholeStaticTest::test_long_0); + runTries(BlackholeStaticTest::test_double_0); + runTries(BlackholeStaticTest::test_Object_0); + + runTries(BlackholeStaticTest::test_boolean_1); + runTries(BlackholeStaticTest::test_byte_1); + runTries(BlackholeStaticTest::test_char_1); + runTries(BlackholeStaticTest::test_short_1); + runTries(BlackholeStaticTest::test_int_1); + runTries(BlackholeStaticTest::test_float_1); + runTries(BlackholeStaticTest::test_long_1); + runTries(BlackholeStaticTest::test_double_1); + runTries(BlackholeStaticTest::test_Object_1); + + runTries(BlackholeStaticTest::test_boolean_2); + runTries(BlackholeStaticTest::test_byte_2); + runTries(BlackholeStaticTest::test_char_2); + runTries(BlackholeStaticTest::test_short_2); + runTries(BlackholeStaticTest::test_int_2); + runTries(BlackholeStaticTest::test_float_2); + runTries(BlackholeStaticTest::test_long_2); + runTries(BlackholeStaticTest::test_double_2); + runTries(BlackholeStaticTest::test_Object_2); + } + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void runTries(Runnable r) { + for (int t = 0; t < TRIES; t++) { + BlackholeTarget.clear(); + r.run(); + if (t == TRIES - 1) { + BlackholeTarget.shouldNotBeEntered(); + } + } + } + + private static void test_boolean_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_boolean_0(); + } + } + + private static void test_byte_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_byte_0(); + } + } + + private static void test_char_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_char_0(); + } + } + + private static void test_short_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_short_0(); + } + } + + private static void test_int_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_int_0(); + } + } + + private static void test_float_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_float_0(); + } + } + + private static void test_long_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_long_0(); + } + } + + private static void test_double_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_double_0(); + } + } + + private static void test_Object_0() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_Object_0(); + } + } + + private static void test_boolean_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_boolean_1((c & 0x1) == 0); + } + } + + private static void test_byte_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_byte_1((byte)c); + } + } + + private static void test_char_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_char_1((char)c); + } + } + + private static void test_short_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_short_1((short)c); + } + } + + private static void test_int_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_int_1(c); + } + } + + private static void test_float_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_float_1(c); + } + } + + private static void test_long_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_long_1(c); + } + } + + private static void test_double_1() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_double_1(c); + } + } + + private static void test_Object_1() { + for (int c = 0; c < CYCLES; c++) { + Object o = new Object(); + BlackholeTarget.bh_s_Object_1(o); + } + } + + private static void test_boolean_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_boolean_2((c & 0x1) == 0, (c & 0x2) == 0); + } + } + + private static void test_byte_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_byte_2((byte)c, (byte)(c + 1)); + } + } + + private static void test_char_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_char_2((char)c, (char)(c + 1)); + } + } + + private static void test_short_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_short_2((short)c, (short)(c + 1)); + } + } + + private static void test_int_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_int_2(c, c + 1); + } + } + + private static void test_float_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_float_2(c, c + 1); + } + } + + private static void test_long_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_long_2(c, c + 1); + } + } + + private static void test_double_2() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_double_2(c, c + 1); + } + } + + private static void test_Object_2() { + for (int c = 0; c < CYCLES; c++) { + Object o1 = new Object(); + Object o2 = new Object(); + BlackholeTarget.bh_s_Object_2(o1, o2); + } + } +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeTarget.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeTarget.java new file mode 100644 index 0000000000000..3d2c888210239 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeTarget.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2020, Red Hat, 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. + */ + +package compiler.blackhole; + +import java.lang.reflect.*; + +public class BlackholeTarget { + private static String entered; + + private static void registerEntered(String label) { + if (entered == null) { + entered = label; + } else if (!entered.equals(label)) { + throw new IllegalStateException("Trying to register enter with overwrite: " + entered + " -> " + label); + } + } + + public static void clear() { + entered = null; + } + + public static void shouldBeEntered() { + if (entered == null) { + throw new IllegalStateException("Should have been entered"); + } + } + + public static void shouldNotBeEntered() { + if (entered != null) { + throw new IllegalStateException("Should not have been entered: " + entered); + } + } + + public void call_for_null_check() {} + + public static void bh_s_boolean_0() { registerEntered("bh_s_boolean_0"); } + public static void bh_s_byte_0() { registerEntered("bh_s_byte_0"); } + public static void bh_s_short_0() { registerEntered("bh_s_short_0"); } + public static void bh_s_char_0() { registerEntered("bh_s_char_0"); } + public static void bh_s_int_0() { registerEntered("bh_s_int_0"); } + public static void bh_s_float_0() { registerEntered("bh_s_float_0"); } + public static void bh_s_long_0() { registerEntered("bh_s_long_0"); } + public static void bh_s_double_0() { registerEntered("bh_s_double_0"); } + public static void bh_s_Object_0() { registerEntered("bh_s_Object_0"); } + + public void bh_i_boolean_0() { registerEntered("bh_i_boolean_0"); } + public void bh_i_byte_0() { registerEntered("bh_i_byte_0"); } + public void bh_i_short_0() { registerEntered("bh_i_short_0"); } + public void bh_i_char_0() { registerEntered("bh_i_char_0"); } + public void bh_i_int_0() { registerEntered("bh_i_int_0"); } + public void bh_i_float_0() { registerEntered("bh_i_float_0"); } + public void bh_i_long_0() { registerEntered("bh_i_long_0"); } + public void bh_i_double_0() { registerEntered("bh_i_double_0"); } + public void bh_i_Object_0() { registerEntered("bh_i_Object_0"); } + + public static void bh_s_boolean_1(boolean v) { registerEntered("bh_s_boolean_1"); } + public static void bh_s_byte_1(byte v) { registerEntered("bh_s_byte_1"); } + public static void bh_s_short_1(short v) { registerEntered("bh_s_short_1"); } + public static void bh_s_char_1(char v) { registerEntered("bh_s_char_1"); } + public static void bh_s_int_1(int v) { registerEntered("bh_s_int_1"); } + public static void bh_s_float_1(float v) { registerEntered("bh_s_float_1"); } + public static void bh_s_long_1(long v) { registerEntered("bh_s_long_1"); } + public static void bh_s_double_1(double v) { registerEntered("bh_s_double_1"); } + public static void bh_s_Object_1(Object v) { registerEntered("bh_s_Object_1"); } + + public void bh_i_boolean_1(boolean v) { registerEntered("bh_i_boolean_1"); } + public void bh_i_byte_1(byte v) { registerEntered("bh_i_byte_1"); } + public void bh_i_short_1(short v) { registerEntered("bh_i_short_1"); } + public void bh_i_char_1(char v) { registerEntered("bh_i_char_1"); } + public void bh_i_int_1(int v) { registerEntered("bh_i_int_1"); } + public void bh_i_float_1(float v) { registerEntered("bh_i_float_1"); } + public void bh_i_long_1(long v) { registerEntered("bh_i_long_1"); } + public void bh_i_double_1(double v) { registerEntered("bh_i_double_1"); } + public void bh_i_Object_1(Object v) { registerEntered("bh_i_Object_1"); } + + public static void bh_s_boolean_2(boolean v1, boolean v2) { registerEntered("bh_s_boolean_2"); } + public static void bh_s_byte_2(byte v1, byte v2) { registerEntered("bh_s_byte_2"); } + public static void bh_s_short_2(short v1, short v2) { registerEntered("bh_s_short_2"); } + public static void bh_s_char_2(char v1, char v2) { registerEntered("bh_s_char_2"); } + public static void bh_s_int_2(int v1, int v2) { registerEntered("bh_s_int_2"); } + public static void bh_s_float_2(float v1, float v2) { registerEntered("bh_s_float_2"); } + public static void bh_s_long_2(long v1, long v2) { registerEntered("bh_s_long_2"); } + public static void bh_s_double_2(double v1, double v2) { registerEntered("bh_s_double_2"); } + public static void bh_s_Object_2(Object v1, Object v2) { registerEntered("bh_s_Object_2"); } + + public void bh_i_boolean_2(boolean v1, boolean v2) { registerEntered("bh_i_boolean_2"); } + public void bh_i_byte_2(byte v1, byte v2) { registerEntered("bh_i_byte_2"); } + public void bh_i_short_2(short v1, short v2) { registerEntered("bh_i_short_2"); } + public void bh_i_char_2(char v1, char v2) { registerEntered("bh_i_char_2"); } + public void bh_i_int_2(int v1, int v2) { registerEntered("bh_i_int_2"); } + public void bh_i_float_2(float v1, float v2) { registerEntered("bh_i_float_2"); } + public void bh_i_long_2(long v1, long v2) { registerEntered("bh_i_long_2"); } + public void bh_i_double_2(double v1, double v2) { registerEntered("bh_i_double_2"); } + public void bh_i_Object_2(Object v1, Object v2) { registerEntered("bh_i_Object_2"); } + + public static boolean bh_sr_boolean(boolean v) { registerEntered("bh_sr_boolean"); return false; } + public static byte bh_sr_byte(byte v) { registerEntered("bh_sr_byte"); return 0; } + public static short bh_sr_short(short v) { registerEntered("bh_sr_short"); return 0; } + public static char bh_sr_char(char v) { registerEntered("bh_sr_char"); return 0; } + public static int bh_sr_int(int v) { registerEntered("bh_sr_int"); return 0; } + public static float bh_sr_float(float v) { registerEntered("bh_sr_float"); return 0; } + public static long bh_sr_long(long v) { registerEntered("bh_sr_long"); return 0; } + public static double bh_sr_double(double v) { registerEntered("bh_sr_double"); return 0; } + public static Object bh_sr_Object(Object v) { registerEntered("bh_sr_Object"); return null; } + + public boolean bh_ir_boolean(boolean v) { registerEntered("bh_ir_boolean"); return false; } + public byte bh_ir_byte(byte v) { registerEntered("bh_ir_byte"); return 0; } + public short bh_ir_short(short v) { registerEntered("bh_ir_short"); return 0; } + public char bh_ir_char(char v) { registerEntered("bh_ir_char"); return 0; } + public int bh_ir_int(int v) { registerEntered("bh_ir_int"); return 0; } + public float bh_ir_float(float v) { registerEntered("bh_ir_float"); return 0; } + public long bh_ir_long(long v) { registerEntered("bh_ir_long"); return 0; } + public double bh_ir_double(double v) { registerEntered("bh_ir_double"); return 0; } + public Object bh_ir_Object(Object v) { registerEntered("bh_ir_Object"); return null; } +} From 29a09c8911f93bc8061382df1ddd9bc63a6a402a Mon Sep 17 00:00:00 2001 From: Lin Zang Date: Mon, 7 Dec 2020 04:01:51 +0000 Subject: [PATCH 092/504] 8257668: SA JMap - skip non-java thread stack dump for heap dump Reviewed-by: cjplummer, sspitsyn, phh --- .../share/classes/sun/jvm/hotspot/runtime/ThreadStackTrace.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadStackTrace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadStackTrace.java index 65ba5c29ebe73..6d3a8109f1b71 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadStackTrace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadStackTrace.java @@ -47,7 +47,6 @@ public StackFrameInfo stackFrameAt(int index) { public void dumpStack(int maxDepth) { if (!thread.isJavaThread()) { - System.out.println("dumpStack: not java Thread."); return; } try { From 05dac03f36a593c3e838552639ebf6820fd6c504 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 7 Dec 2020 06:43:34 +0000 Subject: [PATCH 093/504] 8257803: Add -Xbatch to compiler/blackhole tests Reviewed-by: dholmes --- .../compiler/blackhole/BlackholeInstanceReturnTest.java | 8 ++++---- .../jtreg/compiler/blackhole/BlackholeInstanceTest.java | 8 ++++---- .../jtreg/compiler/blackhole/BlackholeNonVoidWarning.java | 1 + .../jtreg/compiler/blackhole/BlackholeNullCheckTest.java | 8 ++++---- .../compiler/blackhole/BlackholeStaticReturnTest.java | 8 ++++---- .../jtreg/compiler/blackhole/BlackholeStaticTest.java | 8 ++++---- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java index d6e067d26819b..35cb7b467e884 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceReturnTest.java @@ -27,7 +27,7 @@ * * @run main/othervm * -Xmx1g - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceReturnTest @@ -39,7 +39,7 @@ * * @run main/othervm * -Xmx1g - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceReturnTest @@ -52,7 +52,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceReturnTest @@ -65,7 +65,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceReturnTest diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java index 010df2a371625..b832ae15c75e2 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeInstanceTest.java @@ -27,7 +27,7 @@ * * @run main/othervm * -Xmx1g - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceTest @@ -39,7 +39,7 @@ * * @run main/othervm * -Xmx1g - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceTest @@ -52,7 +52,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceTest @@ -65,7 +65,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeInstanceTest diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java index 2d7ed7ed8c9d1..00a173f054d9f 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java @@ -53,6 +53,7 @@ public static void driver() throws IOException { { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xmx128m", + "-Xbatch", "-XX:CompileCommand=quiet", "-XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_*", "compiler.blackhole.BlackholeNonVoidWarning", diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java index ccf572e43e674..645fcd61dfc8b 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNullCheckTest.java @@ -27,7 +27,7 @@ * * @run main/othervm * -Xmx1g - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeNullCheckTest @@ -39,7 +39,7 @@ * * @run main/othervm * -Xmx1g - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeNullCheckTest @@ -52,7 +52,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeNullCheckTest @@ -65,7 +65,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeNullCheckTest diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java index fb554d7a6d4d2..722ba0b327908 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticReturnTest.java @@ -27,7 +27,7 @@ * * @run main/othervm * -Xmx1g - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticReturnTest @@ -39,7 +39,7 @@ * * @run main/othervm * -Xmx1g - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticReturnTest @@ -52,7 +52,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticReturnTest @@ -65,7 +65,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticReturnTest diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java index 17f413054c3fb..9ef4d3923371c 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeStaticTest.java @@ -27,7 +27,7 @@ * * @run main/othervm * -Xmx1g - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticTest @@ -39,7 +39,7 @@ * * @run main/othervm * -Xmx1g - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticTest @@ -52,7 +52,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:TieredStopAtLevel=1 + * -Xbatch -XX:TieredStopAtLevel=1 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticTest @@ -65,7 +65,7 @@ * * @run main/othervm * -Xmx1g -XX:-UseCompressedOops - * -XX:-TieredCompilation + * -Xbatch -XX:-TieredCompilation * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure * -XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_* * compiler.blackhole.BlackholeStaticTest From 7620124ee91f5be78356b5817d46eaf78c1e7b04 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Mon, 7 Dec 2020 09:27:33 +0000 Subject: [PATCH 094/504] 8257230: assert(InitialHeapSize >= MinHeapSize) failed: Ergonomics decided on incompatible initial and minimum heap sizes Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/runtime/arguments.cpp | 3 +- .../jtreg/gc/ergonomics/TestMinHeapSize.java | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 3b62a67deec49..680951b5b94ea 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1802,12 +1802,11 @@ void Arguments::set_heap_size() { if (InitialHeapSize == 0) { julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100); + reasonable_initial = limit_by_allocatable_memory(reasonable_initial); reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)MinHeapSize); reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); - reasonable_initial = limit_by_allocatable_memory(reasonable_initial); - FLAG_SET_ERGO(InitialHeapSize, (size_t)reasonable_initial); log_trace(gc, heap)(" Initial heap size " SIZE_FORMAT, InitialHeapSize); } diff --git a/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java b/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java new file mode 100644 index 0000000000000..9f20196cf1c14 --- /dev/null +++ b/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 THL A29 Limited, a Tencent company. 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 gc.ergonomics; + +/* + * @test TestMinHeapSize + * @bug 8257230 + * @summary Check ergonomics decided on compatible initial and minimum heap sizes + * @library /test/lib + * @requires os.family == "linux" + * @run main/othervm gc.ergonomics.TestMinHeapSize + */ + +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; + + +public class TestMinHeapSize { + + public static void main(String[] args) throws Throwable { + String cmd = ProcessTools.getCommandLine(ProcessTools.createJavaProcessBuilder( + "-XX:MinHeapSize=1537m", "-XX:CompressedClassSpaceSize=64m", "-version")); + + int ulimitV = 3145728; // 3G + var pb = new ProcessBuilder( + "sh", "-c", + "ulimit -v " + ulimitV + "; " + cmd); + + // lower MALLOC_ARENA_MAX b/c we limited virtual memory, see JDK-8043516 + pb.environment().put("MALLOC_ARENA_MAX", "4"); + + var oa = ProcessTools.executeCommand(pb); + + oa.shouldNotContain("hs_err") + .shouldNotContain("Internal Error") + .shouldHaveExitValue(0); + } +} From d05401d886125815f2e5704eef79667bd9be8ec0 Mon Sep 17 00:00:00 2001 From: Julia Boes Date: Mon, 7 Dec 2020 09:30:52 +0000 Subject: [PATCH 095/504] 8256679: Update serialization javadoc once JOSS changes for records are complete Reviewed-by: chegar, rriggs --- .../classes/java/io/ObjectInputStream.java | 39 ++++--------------- .../classes/java/io/ObjectOutputStream.java | 6 +-- .../classes/java/io/ObjectStreamClass.java | 17 +++----- .../share/classes/java/io/Serializable.java | 6 +++ .../share/classes/java/lang/Record.java | 6 ++- 5 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java b/src/java.base/share/classes/java/io/ObjectInputStream.java index 953131dfe62b6..03d3aa8dc45ee 100644 --- a/src/java.base/share/classes/java/io/ObjectInputStream.java +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java @@ -223,39 +223,14 @@ * Similarly, any serialPersistentFields or serialVersionUID field declarations * are also ignored--all enum types have a fixed serialVersionUID of 0L. * - * @implSpec * - * Records are serialized differently than ordinary serializable or externalizable - * objects. The serialized form of a record object is a sequence of values derived - * from the record components. The stream format of a record object is the same as - * that of an ordinary object in the stream. During deserialization, if the local - * class equivalent of the specified stream class descriptor is a record class, - * then first the stream fields are read and reconstructed to serve as the record's - * component values; and second, a record object is created by invoking the - * record's canonical constructor with the component values as arguments (or the - * default value for component's type if a component value is absent from the - * stream). - * Like other serializable or externalizable objects, record objects can function - * as the target of back references appearing subsequently in the serialization - * stream. However, a cycle in the graph where the record object is referred to, - * either directly or transitively, by one of its components, is not preserved. - * The record components are deserialized prior to the invocation of the record - * constructor, hence this limitation (see - * - * Java Object Serialization Specification, - * Section 1.14, "Circular References" for additional information). - * The process by which record objects are serialized or externalized cannot be - * customized; any class-specific writeObject, readObject, readObjectNoData, - * writeExternal, and readExternal methods defined by record classes are - * ignored during serialization and deserialization. However, a substitute object - * to be serialized or a designate replacement may be specified, by the - * writeReplace and readResolve methods, respectively. Any - * serialPersistentFields field declaration is ignored. Documenting serializable - * fields and data for record classes is unnecessary, since there is no variation - * in the serial form, other than whether a substitute or replacement object is - * used. The serialVersionUID of a record class is 0L unless explicitly - * declared. The requirement for matching serialVersionUID values is waived for - * record classes. + *

      Records are serialized differently than ordinary serializable or externalizable + * objects. During deserialization the record's canonical constructor is invoked + * to construct the record object. Certain serialization-related methods, such + * as readObject and writeObject, are ignored for serializable records. See + * + * Java Object Serialization Specification, Section 1.13, + * "Serialization of Records" for additional information. * * @author Mike Warres * @author Roger Riggs diff --git a/src/java.base/share/classes/java/io/ObjectOutputStream.java b/src/java.base/share/classes/java/io/ObjectOutputStream.java index 2bc0fc31f36e2..b10e380ca5741 100644 --- a/src/java.base/share/classes/java/io/ObjectOutputStream.java +++ b/src/java.base/share/classes/java/io/ObjectOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2020, 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 @@ -150,8 +150,7 @@ * defaultWriteObject and writeFields initially terminate any existing * block-data record. * - * @implSpec - * Records are serialized differently than ordinary serializable or externalizable + *

      Records are serialized differently than ordinary serializable or externalizable * objects, see record serialization. * * @author Mike Warres @@ -1483,7 +1482,6 @@ private void writeExternalData(Externalizable obj) throws IOException { } /** Writes the record component values for the given record object. */ - @SuppressWarnings("preview") private void writeRecordData(Object obj, ObjectStreamClass desc) throws IOException { diff --git a/src/java.base/share/classes/java/io/ObjectStreamClass.java b/src/java.base/share/classes/java/io/ObjectStreamClass.java index fc1c708cdd9e3..806de0aa22672 100644 --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -490,11 +490,6 @@ Thread getOwner() { } } - @SuppressWarnings("preview") - private static boolean isRecord(Class cls) { - return cls.isRecord(); - } - /** * Creates local class descriptor representing given class. */ @@ -503,7 +498,7 @@ private ObjectStreamClass(final Class cl) { name = cl.getName(); isProxy = Proxy.isProxyClass(cl); isEnum = Enum.class.isAssignableFrom(cl); - isRecord = isRecord(cl); + isRecord = cl.isRecord(); serializable = Serializable.class.isAssignableFrom(cl); externalizable = Externalizable.class.isAssignableFrom(cl); @@ -718,7 +713,7 @@ void initNonProxy(ObjectStreamClass model, } if (model.serializable == osc.serializable && - !cl.isArray() && !isRecord(cl) && + !cl.isArray() && !cl.isRecord() && suid != osc.getSerialVersionUID()) { throw new InvalidClassException(osc.name, "local class incompatible: " + @@ -780,7 +775,7 @@ void initNonProxy(ObjectStreamClass model, deserializeEx = localDesc.deserializeEx; } domains = localDesc.domains; - assert isRecord(cl) ? localDesc.cons == null : true; + assert cl.isRecord() ? localDesc.cons == null : true; cons = localDesc.cons; } @@ -1590,9 +1585,8 @@ private static Constructor getSerializableConstructor(Class cl) { * the not found ( which should never happen for correctly generated record * classes ). */ - @SuppressWarnings("preview") private static MethodHandle canonicalRecordCtr(Class cls) { - assert isRecord(cls) : "Expected record, got: " + cls; + assert cls.isRecord() : "Expected record, got: " + cls; PrivilegedAction pa = () -> { Class[] paramTypes = Arrays.stream(cls.getRecordComponents()) .map(RecordComponent::getType) @@ -1743,7 +1737,7 @@ private static ObjectStreamField[] getSerialFields(Class cl) return NO_FIELDS; ObjectStreamField[] fields; - if (isRecord(cl)) { + if (cl.isRecord()) { fields = getDefaultSerialFields(cl); Arrays.sort(fields); } else if (!Externalizable.class.isAssignableFrom(cl) && @@ -2663,7 +2657,6 @@ static final class RecordSupport { * and return * {@code Object} */ - @SuppressWarnings("preview") static MethodHandle deserializationCtr(ObjectStreamClass desc) { // check the cached value 1st MethodHandle mh = desc.deserializationCtr; diff --git a/src/java.base/share/classes/java/io/Serializable.java b/src/java.base/share/classes/java/io/Serializable.java index deab67a710ea0..680853abe2801 100644 --- a/src/java.base/share/classes/java/io/Serializable.java +++ b/src/java.base/share/classes/java/io/Serializable.java @@ -139,6 +139,12 @@ * serialization and deserialization. Any declarations of the special * handling methods discussed above are ignored for enum types.

      * + * Record classes can implement {@code Serializable} and receive treatment defined + * by the + * Java Object Serialization Specification, Section 1.13, + * "Serialization of Records". Any declarations of the special + * handling methods discussed above are ignored for record types.

      + * * The serialization runtime associates with each serializable class a version * number, called a serialVersionUID, which is used during deserialization to * verify that the sender and receiver of a serialized object have loaded diff --git a/src/java.base/share/classes/java/lang/Record.java b/src/java.base/share/classes/java/lang/Record.java index 121fc7ce73c50..67e538978d2f6 100644 --- a/src/java.base/share/classes/java/lang/Record.java +++ b/src/java.base/share/classes/java/lang/Record.java @@ -74,8 +74,10 @@ * deserialization the record's canonical constructor is invoked to construct * the record object. Certain serialization-related methods, such as readObject * and writeObject, are ignored for serializable records. More information about - * serializable records can be found in - * record serialization. + * serializable records can be found in the + * + * Java Object Serialization Specification, Section 1.13, + * "Serialization of Records". * * @jls 8.10 Record Types * @since 16 From f5a582c2871ef2a64e6860665ae1ce2ae05ae829 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 7 Dec 2020 09:38:22 +0000 Subject: [PATCH 096/504] 8257575: C2: "failed: only phis" assert failure in loop strip mining verification Reviewed-by: thartmann, neliasso --- src/hotspot/share/opto/loopnode.cpp | 20 ++- .../TestEliminatedLoadPinnedOnBackedge.java | 156 ++++++++++++++++++ 2 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/compiler/loopstripmining/TestEliminatedLoadPinnedOnBackedge.java diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 0ed49439af000..66c63f4a7d850 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -1792,12 +1792,28 @@ void LoopNode::verify_strip_mined(int expect_skeleton) const { } else { assert(expect_skeleton == 0 || expect_skeleton == -1, "no skeleton node?"); uint phis = 0; + uint be_loads = 0; + Node* be = inner->in(LoopNode::LoopBackControl); for (DUIterator_Fast imax, i = inner->fast_outs(imax); i < imax; i++) { Node* u = inner->fast_out(i); if (u->is_Phi()) { phis++; + for (DUIterator_Fast jmax, j = be->fast_outs(jmax); j < jmax; j++) { + Node* n = be->fast_out(j); + if (n->is_Load()) { + assert(n->in(0) == be, "should be on the backedge"); + do { + n = n->raw_out(0); + } while (!n->is_Phi()); + if (n == u) { + be_loads++; + break; + } + } + } } } + assert(be_loads <= phis, "wrong number phis that depends on a pinned load"); for (DUIterator_Fast imax, i = outer->fast_outs(imax); i < imax; i++) { Node* u = outer->fast_out(i); assert(u == outer || u == inner || u->is_Phi(), "nothing between inner and outer loop"); @@ -1809,7 +1825,9 @@ void LoopNode::verify_strip_mined(int expect_skeleton) const { stores++; } } - assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1, "only phis"); + // Late optimization of loads on backedge can cause Phi of outer loop to be eliminated but Phi of inner loop is + // not guaranteed to be optimized out. + assert(outer->outcnt() >= phis + 2 - be_loads && outer->outcnt() <= phis + 2 + stores + 1, "only phis"); } assert(sfpt->outcnt() == 1, "no data node"); assert(outer_tail->outcnt() == 1 || !has_skeleton, "no data node"); diff --git a/test/hotspot/jtreg/compiler/loopstripmining/TestEliminatedLoadPinnedOnBackedge.java b/test/hotspot/jtreg/compiler/loopstripmining/TestEliminatedLoadPinnedOnBackedge.java new file mode 100644 index 0000000000000..cf3110224901b --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopstripmining/TestEliminatedLoadPinnedOnBackedge.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2020, Red Hat, 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 8257575 + * @summary C2: "failed: only phis" assert failure in loop strip mining verfication + * + * @run main/othervm -XX:LoopUnrollLimit=0 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestEliminatedLoadPinnedOnBackedge::notInlined + * -XX:CompileCommand=inline,TestEliminatedLoadPinnedOnBackedge::inlined TestEliminatedLoadPinnedOnBackedge + * + */ + +public class TestEliminatedLoadPinnedOnBackedge { + private static Object field2; + + final static int iters = 2000; + + public static void main(String[] args) { + boolean[] flags = new boolean[iters]; + for (int i = 0; i < iters; i++) { + flags[i] = i < iters/2; + } + for (int i = 0; i < 20_000; i++) { + test1(flags); + test2(flags, 1); + test3(flags); + inlined(new Object(), 1); + inlined(new Object(), 4); + inlined2(42); + inlined2(0x42); + } + } + + static int field; + + private static int test1(boolean[] flags) { + int k = 2; + for (; k < 4; k *= 2) { + } + int[] array = new int[10]; + notInlined(array); + // This load commons with the load on the backedge after the + // outer strip mined loop is expanded. + int v = array[0]; + array[1] = 42; + // No use for o. Allocation removed at macro expansion time. + Object o = new Object(); + inlined(o, k); + int i = 0; + for (; ; ) { + synchronized (array) { + } + if (i >= iters) { + break; + } + v = array[0]; // This load ends up on the backedge + if (flags[i]) { + inlined2(array[1]); + } + i++; + } + return v; + } + + private static int test2(boolean[] flags, int d) { + int k = 2; + for (; k < 4; k *= 2) { + } + int[] array = new int[10]; + notInlined(array); + int v = array[0]; + array[1] = 42; + Object o = new Object(); + inlined(o, k); + int i = 0; + for (; ; ) { + synchronized (array) { + } + if (d == 0) {} + if (i >= iters) { + break; + } + v = (array[0] + array[2]) / d; + if (flags[i]) { + inlined2(array[1]); + } + i++; + } + return v; + } + + private static int test3(boolean[] flags) { + int k = 2; + for (; k < 4; k *= 2) { + } + int[] array = new int[10]; + notInlined(array); + int v1 = array[0]; + int v2 = array[2]; + array[1] = 42; + Object o = new Object(); + inlined(o, k); + int i = 0; + for (; ; ) { + synchronized (array) { + } + if (i >= iters) { + break; + } + v1 = array[0]; + v2 = array[2]; + if (flags[i]) { + inlined2(array[1]); + } + i++; + } + return v1 + v2; + } + + private static void inlined2(int i) { + if (i != 42) { + field = 42; + } + } + + private static void inlined(Object o, int i) { + if (i != 4) { + field2 = o; + } + } + + private static void notInlined(int[] array) { + java.util.Arrays.fill(array, 1); + } +} From 566d77a2ae4ee8830c989ea03f7bc6923df061cd Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Mon, 7 Dec 2020 09:58:16 +0000 Subject: [PATCH 097/504] 8254802: ThrowingPushPromisesAsStringCustom.java fails in "try throwing in GET_BODY" Reviewed-by: michaelm --- .../server/Http2TestServerConnection.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java b/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java index 49d02ede54150..02d769a7766b5 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java +++ b/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java @@ -723,6 +723,8 @@ void readLoop() { } //System.err.printf("TestServer: received frame %s\n", frame); int stream = frame.streamid(); + int next = nextstream; + int nextPush = nextPushStreamId; if (stream == 0) { if (frame.type() == WindowUpdateFrame.TYPE) { WindowUpdateFrame wup = (WindowUpdateFrame) frame; @@ -770,6 +772,16 @@ void readLoop() { // but the continuation, even after a reset // should be handle gracefully by the client // anyway. + } else if (isClientStreamId(stream) && stream < next) { + // We may receive a reset on a client stream that has already + // been closed. Just ignore it. + System.err.println("TestServer: received ResetFrame on closed stream: " + stream); + System.err.println(frame); + } else if (isServerStreamId(stream) && stream < nextPush) { + // We may receive a reset on a push stream that has already + // been closed. Just ignore it. + System.err.println("TestServer: received ResetFrame on closed push stream: " + stream); + System.err.println(frame); } else { System.err.println("TestServer: Unexpected frame on: " + stream); System.err.println(frame); @@ -790,6 +802,14 @@ void readLoop() { } } + static boolean isClientStreamId(int streamid) { + return (streamid & 0x01) == 0x01; + } + + static boolean isServerStreamId(int streamid) { + return (streamid & 0x01) == 0x00; + } + /** Encodes an group of headers, without any ordering guarantees. */ List encodeHeaders(HttpHeaders headers) { List buffers = new LinkedList<>(); From 8e8e58455201b0158b3099c64824987d2e9d42d0 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Mon, 7 Dec 2020 10:32:05 +0000 Subject: [PATCH 098/504] 8257588: Make os::_page_sizes a bitmask Reviewed-by: tschatzl, stefank --- src/hotspot/os/aix/os_aix.cpp | 2 +- src/hotspot/os/bsd/os_bsd.cpp | 2 +- src/hotspot/os/linux/os_linux.cpp | 6 +- src/hotspot/os/windows/os_windows.cpp | 7 +- src/hotspot/share/runtime/os.cpp | 91 +++++++++++++++++---- src/hotspot/share/runtime/os.hpp | 38 ++++++--- test/hotspot/gtest/runtime/test_os.cpp | 109 +++++++++++++++++++++---- 7 files changed, 198 insertions(+), 57 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 6871f6bd6a816..15c7160fdcdcd 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -2441,7 +2441,7 @@ void os::init(void) { // For now UseLargePages is just ignored. FLAG_SET_ERGO(UseLargePages, false); - _page_sizes[0] = 0; + _page_sizes.add(Aix::_page_size); // debug trace trcVerbose("os::vm_page_size %s", describe_pagesize(os::vm_page_size())); diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 733e2b7e0e72d..c9aec705b9ffa 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -2093,7 +2093,7 @@ void os::init(void) { if (Bsd::page_size() == -1) { fatal("os_bsd.cpp: os::init: sysconf failed (%s)", os::strerror(errno)); } - init_page_sizes((size_t) Bsd::page_size()); + _page_sizes.add(Bsd::page_size()); Bsd::initialize_system_info(); diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 15d1dff4d84c8..78ad6492c0594 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3769,9 +3769,7 @@ size_t os::Linux::setup_large_page_size() { const size_t default_page_size = (size_t)Linux::page_size(); if (_large_page_size > default_page_size) { - _page_sizes[0] = _large_page_size; - _page_sizes[1] = default_page_size; - _page_sizes[2] = 0; + _page_sizes.add(_large_page_size); } return _large_page_size; @@ -4399,7 +4397,7 @@ void os::init(void) { fatal("os_linux.cpp: os::init: sysconf failed (%s)", os::strerror(errno)); } - init_page_sizes((size_t) Linux::page_size()); + _page_sizes.add(Linux::page_size()); Linux::initialize_system_info(); diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 32020da916db7..a39b74e29d864 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3118,12 +3118,9 @@ void os::large_page_init() { } _large_page_size = large_page_init_decide_size(); - const size_t default_page_size = (size_t) vm_page_size(); if (_large_page_size > default_page_size) { - _page_sizes[0] = _large_page_size; - _page_sizes[1] = default_page_size; - _page_sizes[2] = 0; + _page_sizes.add(_large_page_size); } UseLargePages = _large_page_size != 0; @@ -4167,7 +4164,7 @@ void os::init(void) { win32::initialize_system_info(); win32::setmode_streams(); - init_page_sizes((size_t) win32::vm_page_size()); + _page_sizes.add(win32::vm_page_size()); // This may be overridden later when argument processing is done. FLAG_SET_ERGO(UseLargePagesIndividualAllocation, false); diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index b228a0eecd33b..d00847ce16a52 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -64,8 +64,10 @@ #include "services/nmtCommon.hpp" #include "services/threadService.hpp" #include "utilities/align.hpp" +#include "utilities/count_trailing_zeros.hpp" #include "utilities/defaultStream.hpp" #include "utilities/events.hpp" +#include "utilities/powerOfTwo.hpp" # include # include @@ -75,7 +77,7 @@ address os::_polling_page = NULL; volatile unsigned int os::_rand_seed = 1234567; int os::_processor_count = 0; int os::_initial_active_processor_count = 0; -size_t os::_page_sizes[os::page_sizes_max]; +os::PageSizes os::_page_sizes; #ifndef PRODUCT julong os::num_mallocs = 0; // # of calls to malloc/realloc @@ -1390,8 +1392,8 @@ size_t os::page_size_for_region(size_t region_size, size_t min_pages, bool must_ if (UseLargePages) { const size_t max_page_size = region_size / min_pages; - for (size_t i = 0; _page_sizes[i] != 0; ++i) { - const size_t page_size = _page_sizes[i]; + for (size_t page_size = page_sizes().largest(); page_size != 0; + page_size = page_sizes().next_smaller(page_size)) { if (page_size <= max_page_size) { if (!must_be_aligned || is_aligned(region_size, page_size)) { return page_size; @@ -1536,19 +1538,6 @@ const char* os::errno_name(int e) { return errno_to_string(e, true); } -void os::trace_page_sizes(const char* str, const size_t* page_sizes, int count) { - LogTarget(Info, pagesize) log; - if (log.is_enabled()) { - LogStream out(log); - - out.print("%s: ", str); - for (int i = 0; i < count; ++i) { - out.print(" " SIZE_FORMAT, page_sizes[i]); - } - out.cr(); - } -} - #define trace_page_size_params(size) byte_size_in_exact_unit(size), exact_unit_for_byte_size(size) void os::trace_page_sizes(const char* str, @@ -1862,3 +1851,73 @@ void os::naked_sleep(jlong millis) { } naked_short_sleep(millis); } + + +////// Implementation of PageSizes + +void os::PageSizes::add(size_t page_size) { + assert(is_power_of_2(page_size), "page_size must be a power of 2: " SIZE_FORMAT_HEX, page_size); + _v |= page_size; +} + +bool os::PageSizes::contains(size_t page_size) const { + assert(is_power_of_2(page_size), "page_size must be a power of 2: " SIZE_FORMAT_HEX, page_size); + return (_v & page_size) != 0; +} + +size_t os::PageSizes::next_smaller(size_t page_size) const { + assert(is_power_of_2(page_size), "page_size must be a power of 2: " SIZE_FORMAT_HEX, page_size); + size_t v2 = _v & (page_size - 1); + if (v2 == 0) { + return 0; + } + return round_down_power_of_2(v2); +} + +size_t os::PageSizes::next_larger(size_t page_size) const { + assert(is_power_of_2(page_size), "page_size must be a power of 2: " SIZE_FORMAT_HEX, page_size); + if (page_size == max_power_of_2()) { // Shift by 32/64 would be UB + return 0; + } + // Remove current and smaller page sizes + size_t v2 = _v & ~(page_size + (page_size - 1)); + if (v2 == 0) { + return 0; + } + return (size_t)1 << count_trailing_zeros(v2); +} + +size_t os::PageSizes::largest() const { + const size_t max = max_power_of_2(); + if (contains(max)) { + return max; + } + return next_smaller(max); +} + +size_t os::PageSizes::smallest() const { + // Strictly speaking the set should not contain sizes < os::vm_page_size(). + // But this is not enforced. + return next_larger(1); +} + +void os::PageSizes::print_on(outputStream* st) const { + bool first = true; + for (size_t sz = smallest(); sz != 0; sz = next_larger(sz)) { + if (first) { + first = false; + } else { + st->print_raw(", "); + } + if (sz < M) { + st->print(SIZE_FORMAT "k", sz / K); + } else if (sz < G) { + st->print(SIZE_FORMAT "M", sz / M); + } else { + st->print(SIZE_FORMAT "G", sz / G); + } + } + if (first) { + st->print("empty"); + } +} diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 56afb9d1ec021..df4fd68d3e51c 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -100,19 +100,30 @@ class os: AllStatic { #endif public: - enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel) + + // A simple value class holding a set of page sizes (similar to sigset_t) + class PageSizes { + size_t _v; // actually a bitmap. + public: + PageSizes() : _v(0) {} + void add(size_t pagesize); + bool contains(size_t pagesize) const; + // Given a page size, return the next smaller page size in this set, or 0. + size_t next_smaller(size_t pagesize) const; + // Given a page size, return the next larger page size in this set, or 0. + size_t next_larger(size_t pagesize) const; + // Returns the largest page size in this set, or 0 if set is empty. + size_t largest() const; + // Returns the smallest page size in this set, or 0 if set is empty. + size_t smallest() const; + // Prints one line of comma separated, human readable page sizes, "empty" if empty. + void print_on(outputStream* st) const; + }; private: static OSThread* _starting_thread; static address _polling_page; - public: - static size_t _page_sizes[page_sizes_max]; - - private: - static void init_page_sizes(size_t default_page_size) { - _page_sizes[0] = default_page_size; - _page_sizes[1] = 0; // sentinel - } + static PageSizes _page_sizes; static char* pd_reserve_memory(size_t bytes); @@ -274,6 +285,10 @@ class os: AllStatic { // Return the default page size. static int vm_page_size(); + // The set of page sizes which the VM is allowed to use (may be a subset of + // the page sizes actually available on the platform). + static const PageSizes& page_sizes() { return _page_sizes; } + // Returns the page size to use for a region of memory. // region_size / min_pages will always be greater than or equal to the // returned value. The returned value will divide region_size. @@ -285,10 +300,7 @@ class os: AllStatic { static size_t page_size_for_region_unaligned(size_t region_size, size_t min_pages); // Return the largest page size that can be used - static size_t max_page_size() { - // The _page_sizes array is sorted in descending order. - return _page_sizes[0]; - } + static size_t max_page_size() { return page_sizes().largest(); } // Return a lower bound for page sizes. Also works before os::init completed. static size_t min_page_size() { return 4 * K; } diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index e7605baf6ef59..85a71f1fe802d 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -86,29 +86,29 @@ TEST_VM(os, page_size_for_region_alignment) { TEST_VM(os, page_size_for_region_unaligned) { if (UseLargePages) { // Given exact page size, should return that page size. - for (size_t i = 0; os::_page_sizes[i] != 0; i++) { - size_t expected = os::_page_sizes[i]; - size_t actual = os::page_size_for_region_unaligned(expected, 1); - ASSERT_EQ(expected, actual); + for (size_t s = os::page_sizes().largest(); s != 0; s = os::page_sizes().next_smaller(s)) { + size_t actual = os::page_size_for_region_unaligned(s, 1); + ASSERT_EQ(s, actual); } // Given slightly larger size than a page size, return the page size. - for (size_t i = 0; os::_page_sizes[i] != 0; i++) { - size_t expected = os::_page_sizes[i]; - size_t actual = os::page_size_for_region_unaligned(expected + 17, 1); - ASSERT_EQ(expected, actual); + for (size_t s = os::page_sizes().largest(); s != 0; s = os::page_sizes().next_smaller(s)) { + size_t actual = os::page_size_for_region_unaligned(s + 17, 1); + ASSERT_EQ(s, actual); } // Given a slightly smaller size than a page size, // return the next smaller page size. - if (os::_page_sizes[1] > os::_page_sizes[0]) { - size_t expected = os::_page_sizes[0]; - size_t actual = os::page_size_for_region_unaligned(os::_page_sizes[1] - 17, 1); - ASSERT_EQ(actual, expected); + for (size_t s = os::page_sizes().largest(); s != 0; s = os::page_sizes().next_smaller(s)) { + const size_t expected = os::page_sizes().next_smaller(s); + if (expected != 0) { + size_t actual = os::page_size_for_region_unaligned(expected - 17, 1); + ASSERT_EQ(actual, expected); + } } // Return small page size for values less than a small page. - size_t small_page = small_page_size(); + size_t small_page = os::page_sizes().smallest(); size_t actual = os::page_size_for_region_unaligned(small_page - 17, 1); ASSERT_EQ(small_page, actual); } @@ -364,7 +364,7 @@ static address reserve_multiple(int num_stripes, size_t stripe_len) { // .. release it... EXPECT_TRUE(os::release_memory((char*)p, total_range_len)); // ... re-reserve in the same spot multiple areas... - for (int stripe = 0; stripe < num_stripes; stripe ++) { + for (int stripe = 0; stripe < num_stripes; stripe++) { address q = p + (stripe * stripe_len); q = (address)os::attempt_reserve_memory_at((char*)q, stripe_len); EXPECT_NE(q, (address)NULL); @@ -384,7 +384,7 @@ static address reserve_one_commit_multiple(int num_stripes, size_t stripe_len) { size_t total_range_len = num_stripes * stripe_len; address p = (address)os::reserve_memory(total_range_len); EXPECT_NE(p, (address)NULL); - for (int stripe = 0; stripe < num_stripes; stripe ++) { + for (int stripe = 0; stripe < num_stripes; stripe++) { address q = p + (stripe * stripe_len); if (stripe % 2 == 0) { EXPECT_TRUE(os::commit_memory((char*)q, stripe_len, false)); @@ -397,7 +397,7 @@ static address reserve_one_commit_multiple(int num_stripes, size_t stripe_len) { // Release a range allocated with reserve_multiple carefully, to not trip mapping // asserts on Windows in os::release_memory() static void carefully_release_multiple(address start, int num_stripes, size_t stripe_len) { - for (int stripe = 0; stripe < num_stripes; stripe ++) { + for (int stripe = 0; stripe < num_stripes; stripe++) { address q = start + (stripe * stripe_len); EXPECT_TRUE(os::release_memory((char*)q, stripe_len)); } @@ -607,7 +607,7 @@ TEST_VM(os, find_mapping_3) { address p = reserve_multiple(4, stripe_len); ASSERT_NE(p, (address)NULL); PRINT_MAPPINGS("E"); - for (int stripe = 0; stripe < 4; stripe ++) { + for (int stripe = 0; stripe < 4; stripe++) { ASSERT_TRUE(os::win32::find_mapping(p + (stripe * stripe_len), &mapping_info)); ASSERT_EQ(mapping_info.base, p + (stripe * stripe_len)); ASSERT_EQ(mapping_info.regions, 1); @@ -620,3 +620,78 @@ TEST_VM(os, find_mapping_3) { } } #endif // _WIN32 + +TEST_VM(os, os_pagesizes) { + ASSERT_EQ(os::min_page_size(), 4 * K); + ASSERT_LE(os::min_page_size(), (size_t)os::vm_page_size()); + // The vm_page_size should be the smallest in the set of allowed page sizes + // (contract says "default" page size but a lot of code actually assumes + // this to be the smallest page size; notable, deliberate exception is + // AIX which can have smaller page sizes but those are not part of the + // page_sizes() set). + ASSERT_EQ(os::page_sizes().smallest(), (size_t)os::vm_page_size()); + // The large page size, if it exists, shall be part of the set + if (UseLargePages) { + ASSERT_GT(os::large_page_size(), (size_t)os::vm_page_size()); + ASSERT_TRUE(os::page_sizes().contains(os::large_page_size())); + } + os::page_sizes().print_on(tty); + tty->cr(); +} + +static const int min_page_size_log2 = exact_log2(os::min_page_size()); +static const int max_page_size_log2 = (int)BitsPerWord; + +TEST_VM(os, pagesizes_test_range) { + for (int bit = min_page_size_log2; bit < max_page_size_log2; bit++) { + for (int bit2 = min_page_size_log2; bit2 < max_page_size_log2; bit2++) { + const size_t s = (size_t)1 << bit; + const size_t s2 = (size_t)1 << bit2; + os::PageSizes pss; + ASSERT_EQ((size_t)0, pss.smallest()); + ASSERT_EQ((size_t)0, pss.largest()); + // one size set + pss.add(s); + ASSERT_TRUE(pss.contains(s)); + ASSERT_EQ(s, pss.smallest()); + ASSERT_EQ(s, pss.largest()); + ASSERT_EQ(pss.next_larger(s), (size_t)0); + ASSERT_EQ(pss.next_smaller(s), (size_t)0); + // two set + pss.add(s2); + ASSERT_TRUE(pss.contains(s2)); + if (s2 < s) { + ASSERT_EQ(s2, pss.smallest()); + ASSERT_EQ(s, pss.largest()); + ASSERT_EQ(pss.next_larger(s2), (size_t)s); + ASSERT_EQ(pss.next_smaller(s2), (size_t)0); + ASSERT_EQ(pss.next_larger(s), (size_t)0); + ASSERT_EQ(pss.next_smaller(s), (size_t)s2); + } else if (s2 > s) { + ASSERT_EQ(s, pss.smallest()); + ASSERT_EQ(s2, pss.largest()); + ASSERT_EQ(pss.next_larger(s), (size_t)s2); + ASSERT_EQ(pss.next_smaller(s), (size_t)0); + ASSERT_EQ(pss.next_larger(s2), (size_t)0); + ASSERT_EQ(pss.next_smaller(s2), (size_t)s); + } + for (int bit3 = min_page_size_log2; bit3 < max_page_size_log2; bit3++) { + const size_t s3 = (size_t)1 << bit3; + ASSERT_EQ(s3 == s || s3 == s2, pss.contains(s3)); + } + } + } +} + +TEST_VM(os, pagesizes_test_print) { + os::PageSizes pss; + const size_t sizes[] = { 16 * K, 64 * K, 128 * K, 1 * M, 4 * M, 1 * G, 2 * G, 0 }; + static const char* const expected = "16k, 64k, 128k, 1M, 4M, 1G, 2G"; + for (int i = 0; sizes[i] != 0; i++) { + pss.add(sizes[i]); + } + char buffer[256]; + stringStream ss(buffer, sizeof(buffer)); + pss.print_on(&ss); + ASSERT_EQ(strcmp(expected, buffer), 0); +} From 5a03e47605a75e517230c31ccd9f6870310ec029 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Mon, 7 Dec 2020 11:02:52 +0000 Subject: [PATCH 099/504] 8255560: Class::isRecord should check that the current class is final and not abstract Reviewed-by: mchung, darcy --- .../share/classes/java/lang/Class.java | 11 +- .../lang/reflect/records/IsRecordTest.java | 189 ++++++++++++++++++ test/lib/jdk/test/lib/ByteCodeLoader.java | 49 +++-- 3 files changed, 227 insertions(+), 22 deletions(-) create mode 100644 test/jdk/java/lang/reflect/records/IsRecordTest.java diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 3a8cae6e2a69b..c430e9b413b85 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -3662,9 +3662,10 @@ public boolean isEnum() { * Returns {@code true} if and only if this class is a record class. * *

      The {@linkplain #getSuperclass() direct superclass} of a record - * class is {@code java.lang.Record}. A record class has (possibly zero) - * record components, that is, {@link #getRecordComponents()} returns a - * non-null value. + * class is {@code java.lang.Record}. A record class is {@linkplain + * Modifier#FINAL final}. A record class has (possibly zero) record + * components; {@link #getRecordComponents()} returns a non-null but + * possibly empty value for a record. * *

      Note that class {@link Record} is not a record type and thus invoking * this method on class {@code Record} returns {@code false}. @@ -3674,7 +3675,9 @@ public boolean isEnum() { * @since 16 */ public boolean isRecord() { - return getSuperclass() == java.lang.Record.class && isRecord0(); + return getSuperclass() == java.lang.Record.class && + (this.getModifiers() & Modifier.FINAL) != 0 && + isRecord0(); } // Fetches the factory for reflective objects diff --git a/test/jdk/java/lang/reflect/records/IsRecordTest.java b/test/jdk/java/lang/reflect/records/IsRecordTest.java new file mode 100644 index 0000000000000..12893c2e9966d --- /dev/null +++ b/test/jdk/java/lang/reflect/records/IsRecordTest.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2020, 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 8255560 + * @summary Class::isRecord should check that the current class is final and not abstract + * @modules java.base/jdk.internal.org.objectweb.asm + * @library /test/lib + * @run testng/othervm IsRecordTest + * @run testng/othervm/java.security.policy=allPermissions.policy IsRecordTest + */ + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.List; +import java.util.Map; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.test.lib.ByteCodeLoader; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static java.lang.System.out; +import static jdk.internal.org.objectweb.asm.ClassWriter.*; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +public class IsRecordTest { + + @DataProvider(name = "scenarios") + public Object[][] scenarios() { + return new Object[][] { + // isFinal, isAbstract, extendJLR, withRecAttr, expectIsRecord + { false, false, false, true, false }, + { false, false, true, true, false }, + { false, true, false, true, false }, + { false, true, true, true, false }, + { true, false, false, true, false }, + { true, false, true, true, true }, + + { false, false, false, false, false }, + { false, false, true, false, false }, + { false, true, false, false, false }, + { false, true, true, false, false }, + { true, false, false, false, false }, + { true, false, true, false, false }, + }; + } + + /** + * Tests the valid combinations of i) final/non-final, ii) abstract/non-abstract, + * iii) direct subclass of j.l.Record (or not), along with the presence or + * absence of a record attribute. + */ + @Test(dataProvider = "scenarios") + public void testDirectSubClass(boolean isFinal, + boolean isAbstract, + boolean extendsJLR, + boolean withRecordAttr, + boolean expectIsRecord) throws Exception { + out.println("\n--- testDirectSubClass isFinal=%s, isAbstract=%s, extendsJLR=%s, withRecordAttr=%s, expectIsRecord=%s ---" + .formatted(isFinal, isAbstract, extendsJLR, withRecordAttr, expectIsRecord)); + + List rc = null; + if (withRecordAttr) + rc = List.of(new RecordComponentEntry("x", "I")); + String superName = extendsJLR ? "java/lang/Record" : "java/lang/Object"; + var classBytes = generateClassBytes("C", isFinal, isAbstract, superName, rc); + Class cls = ByteCodeLoader.load("C", classBytes); + out.println("cls=%s, Record::isAssignable=%s, isRecord=%s" + .formatted(cls, Record.class.isAssignableFrom(cls), cls.isRecord())); + assertEquals(cls.isRecord(), expectIsRecord); + var getRecordComponents = cls.getRecordComponents(); + assertTrue(expectIsRecord ? getRecordComponents != null : getRecordComponents == null); + } + + /** + * Tests the valid combinations of i) final/non-final, ii) abstract/non-abstract, + * along with the presence or absence of a record attribute, where the class has + * a superclass whose superclass is j.l.Record. + */ + @Test(dataProvider = "scenarios") + public void testIndirectSubClass(boolean isFinal, + boolean isAbstract, + boolean unused1, + boolean withRecordAttr, + boolean unused2) throws Exception { + out.println("\n--- testIndirectSubClass isFinal=%s, isAbstract=%s withRecordAttr=%s ---" + .formatted(isFinal, isAbstract, withRecordAttr)); + + List rc = null; + if (withRecordAttr) + rc = List.of(new RecordComponentEntry("x", "I")); + var supFooClassBytes = generateClassBytes("SupFoo", false, isAbstract, "java/lang/Record", rc); + var subFooClassBytes = generateClassBytes("SubFoo", isFinal, isAbstract, "SupFoo", rc); + var allClassBytes = Map.of("SupFoo", supFooClassBytes, + "SubFoo", subFooClassBytes); + + ClassLoader loader = new ByteCodeLoader(allClassBytes, null); + Class supFooCls = loader.loadClass("SupFoo"); + Class subFooCls = loader.loadClass("SubFoo"); + for (var cls : List.of(supFooCls, subFooCls)) + out.println("cls=%s, Record::isAssignable=%s, isRecord=%s" + .formatted(cls, Record.class.isAssignableFrom(cls), cls.isRecord())); + assertFalse(supFooCls.isRecord()); + assertFalse(subFooCls.isRecord()); + assertEquals(supFooCls.getRecordComponents(), null); + assertEquals(subFooCls.getRecordComponents(), null); + } + + /** Tests record-ness properties of traditionally compiled classes. */ + @Test + public void testBasicRecords() { + out.println("\n--- testBasicRecords ---"); + record EmptyRecord () { } + assertTrue(EmptyRecord.class.isRecord()); + assertEquals(EmptyRecord.class.getRecordComponents().length, 0); + + record FooRecord (int x) { } + assertTrue(FooRecord.class.isRecord()); + assertTrue(FooRecord.class.getRecordComponents() != null); + + final record FinalFooRecord (int x) { } + assertTrue(FinalFooRecord.class.isRecord()); + assertTrue(FinalFooRecord.class.getRecordComponents() != null); + + class A { } + assertFalse(A.class.isRecord()); + assertFalse(A.class.getRecordComponents() != null); + + final class B { } + assertFalse(B.class.isRecord()); + assertFalse(B.class.getRecordComponents() != null); + } + + // -- infra + + // Generates a class with the given properties. + byte[] generateClassBytes(String className, + boolean isFinal, + boolean isAbstract, + String superName, + List components) { + ClassWriter cw = new ClassWriter(COMPUTE_MAXS | COMPUTE_FRAMES); + + int access = 0; + if (isFinal) + access = access | Opcodes.ACC_FINAL; + if (isAbstract) + access = access | Opcodes.ACC_ABSTRACT; + + cw.visit(Opcodes.V16, + access, + className, + null, + superName, + null); + + if (components != null) + components.forEach(rc -> cw.visitRecordComponent(rc.name(), rc.descriptor(), null)); + + cw.visitEnd(); + return cw.toByteArray(); + } + + record RecordComponentEntry (String name, String descriptor) { } + +} diff --git a/test/lib/jdk/test/lib/ByteCodeLoader.java b/test/lib/jdk/test/lib/ByteCodeLoader.java index 345f93bf96b11..ee66e84b87083 100644 --- a/test/lib/jdk/test/lib/ByteCodeLoader.java +++ b/test/lib/jdk/test/lib/ByteCodeLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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,8 @@ package jdk.test.lib; import java.security.SecureClassLoader; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * {@code ByteCodeLoader} can be used for easy loading of byte code already @@ -35,9 +37,14 @@ * @see InMemoryCompiler */ public class ByteCodeLoader extends SecureClassLoader { - private final String className; - private final byte[] byteCode; - private volatile Class holder; + private final Map classBytesMap; + private final Map> cache; + + public ByteCodeLoader(Map classBytesMap, ClassLoader parent) { + super(parent); + this.classBytesMap = classBytesMap; + cache = new ConcurrentHashMap<>(); + } /** * Creates a new {@code ByteCodeLoader} ready to load a class with the @@ -48,8 +55,9 @@ public class ByteCodeLoader extends SecureClassLoader { * @param byteCode The byte code of the class */ public ByteCodeLoader(String className, byte[] byteCode) { - this.className = className; - this.byteCode = byteCode; + super(); + classBytesMap = Map.of(className, byteCode); + cache = new ConcurrentHashMap<>(); } /** @@ -59,34 +67,39 @@ public ByteCodeLoader(String className, byte[] byteCode) { * * @param className The name of the class * @param byteCode The byte code of the class + * @param parent The parent class loader for delegation */ public ByteCodeLoader(String className, byte[] byteCode, ClassLoader parent) { - super(parent); - this.className = className; - this.byteCode = byteCode; + this(Map.of(className, byteCode), parent); } + private static final Object lock = new Object(); + @Override public Class loadClass(String name) throws ClassNotFoundException { - if (!name.equals(className)) { + if (classBytesMap.get(name) == null) { return super.loadClass(name); } - if (holder == null) { - synchronized(this) { - if (holder == null) { - holder = findClass(name); - } + Class cls = cache.get(name); + if (cls != null) { + return cls; + } + synchronized (lock) { + cls = cache.get(name); + if (cls == null) { + cls = findClass(name); + cache.put(name, cls); } } - return holder; + return cls; } @Override protected Class findClass(String name) throws ClassNotFoundException { - if (!name.equals(className)) { + byte[] byteCode = classBytesMap.get(name); + if (byteCode == null) { throw new ClassNotFoundException(name); } - return defineClass(name, byteCode, 0, byteCode.length); } From 04ce8e38405c35aa6433c9b74c3ddd99781e1d27 Mon Sep 17 00:00:00 2001 From: Jorn Vernee Date: Mon, 7 Dec 2020 11:08:24 +0000 Subject: [PATCH 100/504] 8257184: Upstream 8252504: Add a method to MemoryLayout which returns a offset-computing method handle Reviewed-by: mcimadamore, chegar --- .../jdk/incubator/foreign/MemoryLayout.java | 97 +++++++- .../jdk/internal/foreign/LayoutPath.java | 29 ++- .../classes/jdk/internal/foreign/Utils.java | 12 +- test/jdk/java/foreign/TestLayoutPaths.java | 233 ++++++++++++++---- 4 files changed, 314 insertions(+), 57 deletions(-) diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java index 2bac629f0a137..6666b9c8bab77 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java @@ -31,10 +31,11 @@ import java.lang.constant.Constable; import java.lang.constant.DynamicConstantDesc; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.nio.ByteOrder; import java.util.EnumSet; -import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.OptionalLong; @@ -173,6 +174,19 @@ * it follows that the memory access var handle {@code valueHandle} will feature an additional {@code long} * access coordinate. * + *

      A layout path with free dimensions can also be used to create an offset-computing method handle, using the + * {@link #bitOffset(PathElement...)} or {@link #byteOffsetHandle(PathElement...)} method. Again, free dimensions are + * translated into {@code long} parameters of the created method handle. The method handle can be used to compute the + * offsets of elements of a sequence at different indices, by supplying these indices when invoking the method handle. + * For instance: + * + *

      {@code
      +MethodHandle offsetHandle = taggedValues.byteOffsetHandle(PathElement.sequenceElement(),
      +                                                          PathElement.groupElement("kind"));
      +long offset1 = (long) offsetHandle.invokeExact(1L); // 8
      +long offset2 = (long) offsetHandle.invokeExact(2L); // 16
      + * }
      + * *

      Layout attributes

      * * Layouts can be optionally associated with one or more attributes. A layout attribute forms a name/value @@ -337,9 +351,6 @@ default long byteAlignment() { * Computes the offset, in bits, of the layout selected by a given layout path, where the path is considered rooted in this * layout. * - * @apiNote if the layout path has one (or more) free dimensions, - * the offset is computed as if all the indices corresponding to such dimensions were set to {@code 0}. - * * @param elements the layout path elements. * @return The offset, in bits, of the layout selected by the layout path in {@code elements}. * @throws IllegalArgumentException if the layout path does not select any layout nested in this layout, or if the @@ -348,16 +359,46 @@ default long byteAlignment() { * @throws UnsupportedOperationException if one of the layouts traversed by the layout path has unspecified size. */ default long bitOffset(PathElement... elements) { - return computePathOp(LayoutPath.rootPath(this, MemoryLayout::bitSize), LayoutPath::offset, EnumSet.of(PathKind.SEQUENCE_ELEMENT, PathKind.SEQUENCE_RANGE), elements); + return computePathOp(LayoutPath.rootPath(this, MemoryLayout::bitSize), LayoutPath::offset, + EnumSet.of(PathKind.SEQUENCE_ELEMENT, PathKind.SEQUENCE_RANGE), elements); + } + + /** + * Creates a method handle that can be used to compute the offset, in bits, of the layout selected + * by a given layout path, where the path is considered rooted in this layout. + * + *

      The returned method handle has a return type of {@code long}, and features as many {@code long} + * parameter types as there are free dimensions in the provided layout path (see {@link PathElement#sequenceElement()}, + * where the order of the parameters corresponds to the order of the path elements. + * The returned method handle can be used to compute a layout offset similar to {@link #bitOffset(PathElement...)}, + * but where some sequence indices are specified only when invoking the method handle. + * + *

      The final offset returned by the method handle is computed as follows: + * + *

      {@code
      +    offset = c_1 + c_2 + ... + c_m + (x_1 * s_1) + (x_2 * s_2) + ... + (x_n * s_n)
      +     * }
      + * + * where {@code x_1}, {@code x_2}, ... {@code x_n} are dynamic values provided as {@code long} + * arguments, whereas {@code c_1}, {@code c_2}, ... {@code c_m} and {@code s_0}, {@code s_1}, ... {@code s_n} are + * static stride constants which are derived from the layout path. + * + * @param elements the layout path elements. + * @return a method handle that can be used to compute the bit offset of the layout element + * specified by the given layout path elements, when supplied with the missing sequence element indices. + * @throws IllegalArgumentException if the layout path contains one or more path elements that select + * multiple sequence element indices (see {@link PathElement#sequenceElement(long, long)}). + * @throws UnsupportedOperationException if one of the layouts traversed by the layout path has unspecified size. + */ + default MethodHandle bitOffsetHandle(PathElement... elements) { + return computePathOp(LayoutPath.rootPath(this, MemoryLayout::bitSize), LayoutPath::offsetHandle, + EnumSet.of(PathKind.SEQUENCE_RANGE), elements); } /** * Computes the offset, in bytes, of the layout selected by a given layout path, where the path is considered rooted in this * layout. * - * @apiNote if the layout path has one (or more) free dimensions, - * the offset is computed as if all the indices corresponding to such dimensions were set to {@code 0}. - * * @param elements the layout path elements. * @return The offset, in bytes, of the layout selected by the layout path in {@code elements}. * @throws IllegalArgumentException if the layout path does not select any layout nested in this layout, or if the @@ -367,8 +408,44 @@ default long bitOffset(PathElement... elements) { * or if {@code bitOffset(elements)} is not a multiple of 8. */ default long byteOffset(PathElement... elements) { - return Utils.bitsToBytesOrThrow(bitOffset(elements), - () -> new UnsupportedOperationException("Cannot compute byte offset; bit offset is not a multiple of 8")); + return Utils.bitsToBytesOrThrow(bitOffset(elements), Utils.bitsToBytesThrowOffset); + } + + /** + * Creates a method handle that can be used to compute the offset, in bytes, of the layout selected + * by a given layout path, where the path is considered rooted in this layout. + * + *

      The returned method handle has a return type of {@code long}, and features as many {@code long} + * parameter types as there are free dimensions in the provided layout path (see {@link PathElement#sequenceElement()}, + * where the order of the parameters corresponds to the order of the path elements. + * The returned method handle can be used to compute a layout offset similar to {@link #byteOffset(PathElement...)}, + * but where some sequence indices are specified only when invoking the method handle. + * + *

      The final offset returned by the method handle is computed as follows: + * + *

      {@code
      +    bitOffset = c_1 + c_2 + ... + c_m + (x_1 * s_1) + (x_2 * s_2) + ... + (x_n * s_n)
      +    offset = bitOffset / 8
      +     * }
      + * + * where {@code x_1}, {@code x_2}, ... {@code x_n} are dynamic values provided as {@code long} + * arguments, whereas {@code c_1}, {@code c_2}, ... {@code c_m} and {@code s_0}, {@code s_1}, ... {@code s_n} are + * static stride constants which are derived from the layout path. + * + *

      The method handle will throw an {@link UnsupportedOperationException} if the computed + * offset in bits is not a multiple of 8. + * + * @param elements the layout path elements. + * @return a method handle that can be used to compute the byte offset of the layout element + * specified by the given layout path elements, when supplied with the missing sequence element indices. + * @throws IllegalArgumentException if the layout path contains one or more path elements that select + * multiple sequence element indices (see {@link PathElement#sequenceElement(long, long)}). + * @throws UnsupportedOperationException if one of the layouts traversed by the layout path has unspecified size. + */ + default MethodHandle byteOffsetHandle(PathElement... elements) { + MethodHandle mh = bitOffsetHandle(elements); + mh = MethodHandles.filterReturnValue(mh, Utils.MH_bitsToBytesOrThrowForOffset); + return mh; } /** diff --git a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/LayoutPath.java b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/LayoutPath.java index 393a05e6ff225..6a8d4e9236d38 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/LayoutPath.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/LayoutPath.java @@ -61,11 +61,17 @@ public class LayoutPath { private static final JavaLangInvokeAccess JLI = SharedSecrets.getJavaLangInvokeAccess(); private static final MethodHandle ADD_STRIDE; + private static final MethodHandle MH_ADD_SCALED_OFFSET; + + private static final int UNSPECIFIED_ELEM_INDEX = -1; static { try { - ADD_STRIDE = MethodHandles.lookup().findStatic(LayoutPath.class, "addStride", + MethodHandles.Lookup lookup = MethodHandles.lookup(); + ADD_STRIDE = lookup.findStatic(LayoutPath.class, "addStride", MethodType.methodType(long.class, MemorySegment.class, long.class, long.class, long.class)); + MH_ADD_SCALED_OFFSET = lookup.findStatic(LayoutPath.class, "addScaledOffset", + MethodType.methodType(long.class, long.class, long.class, long.class)); } catch (Throwable ex) { throw new ExceptionInInitializerError(ex); } @@ -93,7 +99,7 @@ public LayoutPath sequenceElement() { check(SequenceLayout.class, "attempting to select a sequence element from a non-sequence layout"); SequenceLayout seq = (SequenceLayout)layout; MemoryLayout elem = seq.elementLayout(); - return LayoutPath.nestedPath(elem, offset, addStride(sizeFunc.applyAsLong(elem)), -1, this); + return LayoutPath.nestedPath(elem, offset, addStride(sizeFunc.applyAsLong(elem)), UNSPECIFIED_ELEM_INDEX, this); } public LayoutPath sequenceElement(long start, long step) { @@ -102,7 +108,8 @@ public LayoutPath sequenceElement(long start, long step) { checkSequenceBounds(seq, start); MemoryLayout elem = seq.elementLayout(); long elemSize = sizeFunc.applyAsLong(elem); - return LayoutPath.nestedPath(elem, offset + (start * elemSize), addStride(elemSize * step), -1, this); + return LayoutPath.nestedPath(elem, offset + (start * elemSize), addStride(elemSize * step), + UNSPECIFIED_ELEM_INDEX, this); } public LayoutPath sequenceElement(long index) { @@ -177,6 +184,22 @@ public VarHandle dereferenceHandle(Class carrier) { return handle; } + private static long addScaledOffset(long base, long index, long stride) { + return base + (stride * index); + } + + public MethodHandle offsetHandle() { + MethodHandle mh = MethodHandles.identity(long.class); + for (int i = strides.length - 1; i >=0; i--) { + MethodHandle collector = MethodHandles.insertArguments(MH_ADD_SCALED_OFFSET, 2, strides[i]); + // (J, ...) -> J to (J, J, ...) -> J + // i.e. new coord is prefixed. Last coord will correspond to innermost layout + mh = MethodHandles.collectArguments(mh, 0, collector); + } + mh = MethodHandles.insertArguments(mh, 0, offset); + return mh; + } + public MemoryLayout layout() { return layout; } diff --git a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java index 7e87ab00a96cc..4aea34250e71d 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java @@ -53,11 +53,21 @@ public final class Utils { .orElse("deny"); private static final MethodHandle SEGMENT_FILTER; + public static final MethodHandle MH_bitsToBytesOrThrowForOffset; + + public static final Supplier bitsToBytesThrowOffset + = () -> new UnsupportedOperationException("Cannot compute byte offset; bit offset is not a multiple of 8"); static { try { - SEGMENT_FILTER = MethodHandles.lookup().findStatic(Utils.class, "filterSegment", + MethodHandles.Lookup lookup = MethodHandles.lookup(); + SEGMENT_FILTER = lookup.findStatic(Utils.class, "filterSegment", MethodType.methodType(MemorySegmentProxy.class, MemorySegment.class)); + MH_bitsToBytesOrThrowForOffset = MethodHandles.insertArguments( + lookup.findStatic(Utils.class, "bitsToBytesOrThrow", + MethodType.methodType(long.class, long.class, Supplier.class)), + 1, + bitsToBytesThrowOffset); } catch (Throwable ex) { throw new ExceptionInInitializerError(ex); } diff --git a/test/jdk/java/foreign/TestLayoutPaths.java b/test/jdk/java/foreign/TestLayoutPaths.java index 121942bdfc9e9..39291f6437b24 100644 --- a/test/jdk/java/foreign/TestLayoutPaths.java +++ b/test/jdk/java/foreign/TestLayoutPaths.java @@ -35,127 +35,182 @@ import org.testng.annotations.*; +import java.lang.invoke.MethodHandle; +import java.nio.ByteOrder; +import java.util.ArrayList; import java.util.List; +import static jdk.incubator.foreign.MemoryLayout.PathElement.groupElement; +import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement; +import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT; import static org.testng.Assert.*; public class TestLayoutPaths { @Test(expectedExceptions = IllegalArgumentException.class) public void testBadBitSelectFromSeq() { - SequenceLayout seq = MemoryLayout.ofSequence(MemoryLayouts.JAVA_INT); + SequenceLayout seq = MemoryLayout.ofSequence(JAVA_INT); seq.bitOffset(PathElement.groupElement("foo")); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadByteSelectFromSeq() { - SequenceLayout seq = MemoryLayout.ofSequence(MemoryLayouts.JAVA_INT); + SequenceLayout seq = MemoryLayout.ofSequence(JAVA_INT); seq.byteOffset(PathElement.groupElement("foo")); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadBitSelectFromStruct() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT); - g.bitOffset(PathElement.sequenceElement()); + GroupLayout g = MemoryLayout.ofStruct(JAVA_INT); + g.bitOffset(sequenceElement()); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadByteSelectFromStruct() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT); - g.byteOffset(PathElement.sequenceElement()); + GroupLayout g = MemoryLayout.ofStruct(JAVA_INT); + g.byteOffset(sequenceElement()); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadBitSelectFromValue() { - SequenceLayout seq = MemoryLayout.ofSequence(MemoryLayouts.JAVA_INT); - seq.bitOffset(PathElement.sequenceElement(), PathElement.sequenceElement()); + SequenceLayout seq = MemoryLayout.ofSequence(JAVA_INT); + seq.bitOffset(sequenceElement(), sequenceElement()); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadByteSelectFromValue() { - SequenceLayout seq = MemoryLayout.ofSequence(MemoryLayouts.JAVA_INT); - seq.byteOffset(PathElement.sequenceElement(), PathElement.sequenceElement()); + SequenceLayout seq = MemoryLayout.ofSequence(JAVA_INT); + seq.byteOffset(sequenceElement(), sequenceElement()); } @Test(expectedExceptions = IllegalArgumentException.class) public void testUnknownBitStructField() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT); + GroupLayout g = MemoryLayout.ofStruct(JAVA_INT); g.bitOffset(PathElement.groupElement("foo")); } @Test(expectedExceptions = IllegalArgumentException.class) public void testUnknownByteStructField() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT); + GroupLayout g = MemoryLayout.ofStruct(JAVA_INT); g.byteOffset(PathElement.groupElement("foo")); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBitOutOfBoundsSeqIndex() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.bitOffset(PathElement.sequenceElement(6)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.bitOffset(sequenceElement(6)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testByteOutOfBoundsSeqIndex() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.byteOffset(PathElement.sequenceElement(6)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.byteOffset(sequenceElement(6)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeSeqIndex() { - PathElement.sequenceElement(-2); + sequenceElement(-2); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBitNegativeSeqIndex() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.bitOffset(PathElement.sequenceElement(-2)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.bitOffset(sequenceElement(-2)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testByteNegativeSeqIndex() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.byteOffset(PathElement.sequenceElement(-2)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.byteOffset(sequenceElement(-2)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testOutOfBoundsSeqRange() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.bitOffset(PathElement.sequenceElement(6, 2)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.bitOffset(sequenceElement(6, 2)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeSeqRange() { - PathElement.sequenceElement(-2, 2); + sequenceElement(-2, 2); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBitNegativeSeqRange() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.bitOffset(PathElement.sequenceElement(-2, 2)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.bitOffset(sequenceElement(-2, 2)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testByteNegativeSeqRange() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayouts.JAVA_INT); - seq.byteOffset(PathElement.sequenceElement(-2, 2)); + SequenceLayout seq = MemoryLayout.ofSequence(5, JAVA_INT); + seq.byteOffset(sequenceElement(-2, 2)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testIncompleteAccess() { - SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT)); - seq.varHandle(int.class, PathElement.sequenceElement()); + SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayout.ofStruct(JAVA_INT)); + seq.varHandle(int.class, sequenceElement()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testBitOffsetHandleBadRange() { + SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayout.ofStruct(JAVA_INT)); + seq.bitOffsetHandle(sequenceElement(0, 1)); // ranges not accepted + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testByteOffsetHandleBadRange() { + SequenceLayout seq = MemoryLayout.ofSequence(5, MemoryLayout.ofStruct(JAVA_INT)); + seq.byteOffsetHandle(sequenceElement(0, 1)); // ranges not accepted } @Test(expectedExceptions = UnsupportedOperationException.class) public void testBadMultiple() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayout.ofPaddingBits(3), MemoryLayouts.JAVA_INT.withName("foo")); + GroupLayout g = MemoryLayout.ofStruct(MemoryLayout.ofPaddingBits(3), JAVA_INT.withName("foo")); g.byteOffset(PathElement.groupElement("foo")); } + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testBitOffsetBadUnboundedSequenceTraverse() { + MemoryLayout layout = MemoryLayout.ofSequence(MemoryLayout.ofSequence(JAVA_INT)); + layout.bitOffset(sequenceElement(1), sequenceElement(0)); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testByteOffsetBadUnboundedSequenceTraverse() { + MemoryLayout layout = MemoryLayout.ofSequence(MemoryLayout.ofSequence(JAVA_INT)); + layout.byteOffset(sequenceElement(1), sequenceElement(0)); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testBitOffsetHandleBadUnboundedSequenceTraverse() { + MemoryLayout layout = MemoryLayout.ofSequence(MemoryLayout.ofSequence(JAVA_INT)); + layout.bitOffsetHandle(sequenceElement(1), sequenceElement(0)); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testByteOffsetHandleBadUnboundedSequenceTraverse() { + MemoryLayout layout = MemoryLayout.ofSequence(MemoryLayout.ofSequence(JAVA_INT)); + layout.byteOffsetHandle(sequenceElement(1), sequenceElement(0)); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testBadByteOffsetNoMultipleOf8() { + MemoryLayout layout = MemoryLayout.ofStruct(MemoryLayout.ofPaddingBits(7), JAVA_INT.withName("x")); + layout.byteOffset(groupElement("x")); + } + + @Test(expectedExceptions = UnsupportedOperationException.class) + public void testBadByteOffsetHandleNoMultipleOf8() throws Throwable { + MemoryLayout layout = MemoryLayout.ofStruct(MemoryLayout.ofPaddingBits(7), JAVA_INT.withName("x")); + MethodHandle handle = layout.byteOffsetHandle(groupElement("x")); + handle.invoke(); + } + @Test public void testBadContainerAlign() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.JAVA_INT.withBitAlignment(16).withName("foo")).withBitAlignment(8); + GroupLayout g = MemoryLayout.ofStruct(JAVA_INT.withBitAlignment(16).withName("foo")).withBitAlignment(8); try { g.bitOffset(PathElement.groupElement("foo")); g.byteOffset(PathElement.groupElement("foo")); @@ -174,7 +229,7 @@ public void testBadContainerAlign() { @Test public void testBadAlignOffset() { - GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.PAD_8, MemoryLayouts.JAVA_INT.withBitAlignment(16).withName("foo")); + GroupLayout g = MemoryLayout.ofStruct(MemoryLayouts.PAD_8, JAVA_INT.withBitAlignment(16).withName("foo")); try { g.bitOffset(PathElement.groupElement("foo")); g.byteOffset(PathElement.groupElement("foo")); @@ -193,9 +248,9 @@ public void testBadAlignOffset() { @Test public void testBadSequencePathInOffset() { - SequenceLayout seq = MemoryLayout.ofSequence(10, MemoryLayouts.JAVA_INT); + SequenceLayout seq = MemoryLayout.ofSequence(10, JAVA_INT); // bad path elements - for (PathElement e : List.of( PathElement.sequenceElement(), PathElement.sequenceElement(0, 2) )) { + for (PathElement e : List.of( sequenceElement(), sequenceElement(0, 2) )) { try { seq.bitOffset(e); fail(); @@ -213,8 +268,8 @@ public void testBadSequencePathInOffset() { @Test public void testBadSequencePathInSelect() { - SequenceLayout seq = MemoryLayout.ofSequence(10, MemoryLayouts.JAVA_INT); - for (PathElement e : List.of( PathElement.sequenceElement(0), PathElement.sequenceElement(0, 2) )) { + SequenceLayout seq = MemoryLayout.ofSequence(10, JAVA_INT); + for (PathElement e : List.of( sequenceElement(0), sequenceElement(0, 2) )) { try { seq.select(e); fail(); @@ -226,8 +281,8 @@ public void testBadSequencePathInSelect() { @Test public void testBadSequencePathInMap() { - SequenceLayout seq = MemoryLayout.ofSequence(10, MemoryLayouts.JAVA_INT); - for (PathElement e : List.of( PathElement.sequenceElement(0), PathElement.sequenceElement(0, 2) )) { + SequenceLayout seq = MemoryLayout.ofSequence(10, JAVA_INT); + for (PathElement e : List.of( sequenceElement(0), sequenceElement(0, 2) )) { try { seq.map(l -> l, e); fail(); @@ -326,22 +381,114 @@ public void testSequencePaths() { // test select - MemoryLayout selected = g.select(PathElement.sequenceElement()); + MemoryLayout selected = g.select(sequenceElement()); assertTrue(selected == MemoryLayouts.JAVA_BYTE); // test offset for (int i = 0 ; i < 4 ; i++) { - long bitOffset = g.bitOffset(PathElement.sequenceElement(i)); + long bitOffset = g.bitOffset(sequenceElement(i)); assertEquals(offsets[i], bitOffset); - long byteOffset = g.byteOffset(PathElement.sequenceElement(i)); + long byteOffset = g.byteOffset(sequenceElement(i)); assertEquals((offsets[i]) >>> 3, byteOffset); } // test map - SequenceLayout seq2 = (SequenceLayout)g.map(l -> MemoryLayouts.JAVA_DOUBLE, PathElement.sequenceElement()); + SequenceLayout seq2 = (SequenceLayout)g.map(l -> MemoryLayouts.JAVA_DOUBLE, sequenceElement()); assertTrue(seq2.elementLayout() == MemoryLayouts.JAVA_DOUBLE); } + + @Test(dataProvider = "offsetHandleCases") + public void testOffsetHandle(MemoryLayout layout, PathElement[] pathElements, long[] indexes, + long expectedBitOffset) throws Throwable { + MethodHandle bitOffsetHandle = layout.bitOffsetHandle(pathElements); + bitOffsetHandle = bitOffsetHandle.asSpreader(long[].class, indexes.length); + long actualBitOffset = (long) bitOffsetHandle.invokeExact(indexes); + assertEquals(actualBitOffset, expectedBitOffset); + if (expectedBitOffset % 8 == 0) { + MethodHandle byteOffsetHandle = layout.byteOffsetHandle(pathElements); + byteOffsetHandle = byteOffsetHandle.asSpreader(long[].class, indexes.length); + long actualByteOffset = (long) byteOffsetHandle.invokeExact(indexes); + assertEquals(actualByteOffset, expectedBitOffset / 8); + } + } + + @DataProvider + public static Object[][] offsetHandleCases() { + List testCases = new ArrayList<>(); + + testCases.add(new Object[] { + MemoryLayout.ofSequence(10, JAVA_INT), + new PathElement[] { sequenceElement() }, + new long[] { 4 }, + JAVA_INT.bitSize() * 4 + }); + testCases.add(new Object[] { + MemoryLayout.ofSequence(10, MemoryLayout.ofStruct(JAVA_INT, JAVA_INT.withName("y"))), + new PathElement[] { sequenceElement(), groupElement("y") }, + new long[] { 4 }, + (JAVA_INT.bitSize() * 2) * 4 + JAVA_INT.bitSize() + }); + testCases.add(new Object[] { + MemoryLayout.ofSequence(10, MemoryLayout.ofStruct(MemoryLayout.ofPaddingBits(5), JAVA_INT.withName("y"))), + new PathElement[] { sequenceElement(), groupElement("y") }, + new long[] { 4 }, + (JAVA_INT.bitSize() + 5) * 4 + 5 + }); + testCases.add(new Object[] { + MemoryLayout.ofSequence(10, JAVA_INT), + new PathElement[] { sequenceElement() }, + new long[] { 4 }, + JAVA_INT.bitSize() * 4 + }); + testCases.add(new Object[] { + MemoryLayout.ofStruct( + MemoryLayout.ofSequence(10, JAVA_INT).withName("data") + ), + new PathElement[] { groupElement("data"), sequenceElement() }, + new long[] { 4 }, + JAVA_INT.bitSize() * 4 + }); + + MemoryLayout complexLayout = MemoryLayout.ofStruct( + MemoryLayout.ofSequence(10, + MemoryLayout.ofSequence(10, + MemoryLayout.ofStruct( + JAVA_INT.withName("x"), + JAVA_INT.withName("y") + ) + ) + ).withName("data") + ); + + testCases.add(new Object[] { + complexLayout, + new PathElement[] { groupElement("data"), sequenceElement(), sequenceElement(), groupElement("x") }, + new long[] { 0, 1 }, + (JAVA_INT.bitSize() * 2) + }); + testCases.add(new Object[] { + complexLayout, + new PathElement[] { groupElement("data"), sequenceElement(), sequenceElement(), groupElement("x") }, + new long[] { 1, 0 }, + (JAVA_INT.bitSize() * 2) * 10 + }); + testCases.add(new Object[] { + complexLayout, + new PathElement[] { groupElement("data"), sequenceElement(), sequenceElement(), groupElement("y") }, + new long[] { 0, 1 }, + (JAVA_INT.bitSize() * 2) + JAVA_INT.bitSize() + }); + testCases.add(new Object[] { + complexLayout, + new PathElement[] { groupElement("data"), sequenceElement(), sequenceElement(), groupElement("y") }, + new long[] { 1, 0 }, + (JAVA_INT.bitSize() * 2) * 10 + JAVA_INT.bitSize() + }); + + return testCases.toArray(Object[][]::new); + } + } From 09707dd4f27b28980bf55030d36b5f3ec4a96831 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Mon, 7 Dec 2020 11:09:25 +0000 Subject: [PATCH 101/504] 8252807: The jdk.jfr.Recording.getStream does not work when toDisk is disabled Reviewed-by: mgronlun --- src/jdk.jfr/share/classes/jdk/jfr/Recording.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java index 84b22227a4c65..04d33f5104f3c 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java @@ -577,6 +577,9 @@ public void setToDisk(boolean disk) { * Creates a data stream for a specified interval. *

      * The stream may contain some data outside the specified range. + *

      + * If the recording is not to disk, a stream can't be created + * and {@code null} is returned. * * @param start the start time for the stream, or {@code null} to get data from * start time of the recording @@ -585,12 +588,14 @@ public void setToDisk(boolean disk) { * present time. * * @return an input stream, or {@code null} if no data is available in the - * interval. + * interval, or the recording was not recorded to disk * * @throws IllegalArgumentException if {@code end} happens before * {@code start} * * @throws IOException if a stream can't be opened + * + * @see #setToDisk(boolean) */ public InputStream getStream(Instant start, Instant end) throws IOException { if (start != null && end != null && end.isBefore(start)) { From 637b0c64b0a5d67d31b4b61dee55e8d682790da0 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 7 Dec 2020 11:11:31 +0000 Subject: [PATCH 102/504] 8246778: Compiler implementation for Sealed Classes (Second Preview) Co-authored-by: Vicente Romero Co-authored-by: Harold Seigel Reviewed-by: lfoltan, mchung, alanb, mcimadamore, chegar --- src/hotspot/share/prims/jvm.cpp | 28 +- .../share/classes/java/lang/Class.java | 117 +++++-- src/java.base/share/native/libjava/Class.c | 2 +- .../com/sun/tools/javac/code/Types.java | 43 ++- .../com/sun/tools/javac/comp/Check.java | 5 +- .../sun/tools/javac/parser/JavacParser.java | 12 +- .../sealedClasses/GetPermittedSubclasses.jcod | 72 ++++- .../GetPermittedSubclassesTest.java | 27 +- .../sealedClasses/noSubclass/BaseC.java | 26 ++ .../sealedClasses/noSubclass/BaseI.java | 26 ++ .../sealedClasses/noSubclass/Impl1.java | 36 +++ .../sealedClasses/noSubclass/Impl2.java | 36 +++ .../SealedClassesReflectionTest.java | 18 +- .../TestSecurityManagerChecks.java | 275 ++++++++++++++++ .../sealed/BinaryCompatibilityTests.java | 187 +++++++++-- .../javac/sealed/SealedCompilationTests.java | 300 +++++++++++++++++- 16 files changed, 1127 insertions(+), 83 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseC.java create mode 100644 test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseI.java create mode 100644 test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl1.java create mode 100644 test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl2.java create mode 100644 test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 909961a17c92b..9bb29a8993cf8 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -2128,16 +2128,32 @@ JVM_ENTRY(jobjectArray, JVM_GetPermittedSubclasses(JNIEnv* env, jclass current)) JvmtiVMObjectAllocEventCollector oam; Array* subclasses = ik->permitted_subclasses(); int length = subclasses == NULL ? 0 : subclasses->length(); - objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), + objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), length, CHECK_NULL); objArrayHandle result(THREAD, r); + int count = 0; for (int i = 0; i < length; i++) { int cp_index = subclasses->at(i); - // This returns /. - Symbol* klass_name = ik->constants()->klass_name_at(cp_index); - assert(klass_name != NULL, "Unexpected null klass_name"); - Handle perm_subtype_h = java_lang_String::create_from_symbol(klass_name, CHECK_NULL); - result->obj_at_put(i, perm_subtype_h()); + Klass* k = ik->constants()->klass_at(cp_index, THREAD); + if (HAS_PENDING_EXCEPTION) { + if (PENDING_EXCEPTION->is_a(SystemDictionary::VirtualMachineError_klass())) { + return NULL; // propagate VMEs + } + CLEAR_PENDING_EXCEPTION; + continue; + } + if (k->is_instance_klass()) { + result->obj_at_put(count++, k->java_mirror()); + } + } + if (count < length) { + objArrayOop r2 = oopFactory::new_objArray(SystemDictionary::Class_klass(), + count, CHECK_NULL); + objArrayHandle result2(THREAD, r2); + for (int i = 0; i < count; i++) { + result2->obj_at_put(i, result->obj_at(i)); + } + return (jobjectArray)JNIHandles::make_local(THREAD, result2()); } return (jobjectArray)JNIHandles::make_local(THREAD, result()); } diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index c430e9b413b85..2657667bea222 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -58,12 +58,14 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import jdk.internal.loader.BootLoader; @@ -200,8 +202,6 @@ public final class Class implements java.io.Serializable, private static final int ENUM = 0x00004000; private static final int SYNTHETIC = 0x00001000; - private static final ClassDesc[] EMPTY_CLASS_DESC_ARRAY = new ClassDesc[0]; - private static native void registerNatives(); static { registerNatives(); @@ -3020,6 +3020,37 @@ private void checkPackageAccess(SecurityManager sm, final ClassLoader ccl, } } + /* + * Checks if a client loaded in ClassLoader ccl is allowed to access the provided + * classes under the current package access policy. If access is denied, + * throw a SecurityException. + * + * NOTE: this method should only be called if a SecurityManager is active + * classes must be non-empty + * all classes provided must be loaded by the same ClassLoader + * NOTE: this method does not support Proxy classes + */ + private static void checkPackageAccessForPermittedSubclasses(SecurityManager sm, + final ClassLoader ccl, Class[] subClasses) { + final ClassLoader cl = subClasses[0].getClassLoader0(); + + if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { + Set packages = new HashSet<>(); + + for (Class c : subClasses) { + if (Proxy.isProxyClass(c)) + throw new InternalError("a permitted subclass should not be a proxy class: " + c); + String pkg = c.getPackageName(); + if (pkg != null && !pkg.isEmpty()) { + packages.add(pkg); + } + } + for (String pkg : packages) { + sm.checkPackageAccess(pkg); + } + } + } + /** * Add a package name prefix if the name is not absolute Remove leading "/" * if name is absolute @@ -4357,47 +4388,87 @@ public Optional describeConstable() { * may be removed in a future release, or upgraded to permanent * features of the Java language.} * - * Returns an array containing {@code ClassDesc} objects representing all the - * direct subclasses or direct implementation classes permitted to extend or + * Returns an array containing {@code Class} objects representing the + * direct subinterfaces or subclasses permitted to extend or * implement this class or interface if it is sealed. The order of such elements * is unspecified. If this {@code Class} object represents a primitive type, * {@code void}, an array type, or a class or interface that is not sealed, * an empty array is returned. * - * @return an array of class descriptors of all the permitted subclasses of this class or interface + * For each class or interface {@code C} which is recorded as a permitted + * direct subinterface or subclass of this class or interface, + * this method attempts to obtain the {@code Class} + * object for {@code C} (using {@linkplain #getClassLoader() the defining class + * loader} of the current {@code Class} object). + * The {@code Class} objects which can be obtained and which are direct + * subinterfaces or subclasses of this class or interface, + * are indicated by elements of the returned array. If a {@code Class} object + * cannot be obtained, it is silently ignored, and not included in the result + * array. + * + * @return an array of {@code Class} objects of the permitted subclasses of this class or interface + * + * @throws SecurityException + * If a security manager, s, is present and the caller's + * class loader is not the same as or an ancestor of the class + * loader for that returned class and invocation of {@link + * SecurityManager#checkPackageAccess s.checkPackageAccess()} + * denies access to the package of any class in the returned array. * * @jls 8.1 Class Declarations * @jls 9.1 Interface Declarations * @since 15 */ @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SEALED_CLASSES, essentialAPI=false) - public ClassDesc[] permittedSubclasses() { - String[] subclassNames; - if (isArray() || isPrimitive() || (subclassNames = getPermittedSubclasses0()).length == 0) { - return EMPTY_CLASS_DESC_ARRAY; - } - ClassDesc[] constants = new ClassDesc[subclassNames.length]; - int i = 0; - for (String subclassName : subclassNames) { - try { - constants[i++] = ClassDesc.of(subclassName.replace('/', '.')); - } catch (IllegalArgumentException iae) { - throw new InternalError("Invalid type in permitted subclasses information: " + subclassName, iae); + @CallerSensitive + public Class[] getPermittedSubclasses() { + Class[] subClasses; + if (isArray() || isPrimitive() || (subClasses = getPermittedSubclasses0()).length == 0) { + return EMPTY_CLASS_ARRAY; + } + if (subClasses.length > 0) { + if (Arrays.stream(subClasses).anyMatch(c -> !isDirectSubType(c))) { + subClasses = Arrays.stream(subClasses) + .filter(this::isDirectSubType) + .toArray(s -> new Class[s]); } } - return constants; + if (subClasses.length > 0) { + // If we return some classes we need a security check: + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + checkPackageAccessForPermittedSubclasses(sm, + ClassLoader.getClassLoader(Reflection.getCallerClass()), + subClasses); + } + } + return subClasses; + } + + private boolean isDirectSubType(Class c) { + if (isInterface()) { + for (Class i : c.getInterfaces(/* cloneArray */ false)) { + if (i == this) { + return true; + } + } + } else { + return c.getSuperclass() == this; + } + return false; } /** - * * {@preview Associated with sealed classes, a preview feature of the Java language. + * {@preview Associated with sealed classes, a preview feature of the Java language. * * This method is associated with sealed classes, a preview * feature of the Java language. Preview features * may be removed in a future release, or upgraded to permanent * features of the Java language.} * - * Returns {@code true} if and only if this {@code Class} object represents a sealed class or interface. - * If this {@code Class} object represents a primitive type, {@code void}, or an array type, this method returns + * Returns {@code true} if and only if this {@code Class} object represents + * a sealed class or interface. If this {@code Class} object represents a + * primitive type, {@code void}, or an array type, this method returns * {@code false}. * * @return {@code true} if and only if this {@code Class} object represents a sealed class or interface. @@ -4412,8 +4483,8 @@ public boolean isSealed() { if (isArray() || isPrimitive()) { return false; } - return permittedSubclasses().length != 0; + return getPermittedSubclasses().length != 0; } - private native String[] getPermittedSubclasses0(); + private native Class[] getPermittedSubclasses0(); } diff --git a/src/java.base/share/native/libjava/Class.c b/src/java.base/share/native/libjava/Class.c index 1be1e24333bff..8e0870cadeee7 100644 --- a/src/java.base/share/native/libjava/Class.c +++ b/src/java.base/share/native/libjava/Class.c @@ -81,7 +81,7 @@ static JNINativeMethod methods[] = { {"getNestMembers0", "()[" CLS, (void *)&JVM_GetNestMembers}, {"getRecordComponents0", "()[" RC, (void *)&JVM_GetRecordComponents}, {"isRecord0", "()Z", (void *)&JVM_IsRecord}, - {"getPermittedSubclasses0", "()[" STR, (void *)&JVM_GetPermittedSubclasses}, + {"getPermittedSubclasses0", "()[" CLS, (void *)&JVM_GetPermittedSubclasses}, }; #undef OBJ diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java index aa9b2305412a6..e6fe7e88f5172 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java @@ -1629,32 +1629,69 @@ public boolean isCastable(Type t, Type s) { } /** - * Is t is castable to s?
      + * Is t castable to s?
      * s is assumed to be an erased type.
      * (not defined for Method and ForAll types). */ public boolean isCastable(Type t, Type s, Warner warn) { + // if same type if (t == s) return true; + // if one of the types is primitive if (t.isPrimitive() != s.isPrimitive()) { t = skipTypeVars(t, false); return (isConvertible(t, s, warn) || (s.isPrimitive() && isSubtype(boxedClass(s).type, t))); } + boolean result; if (warn != warnStack.head) { try { warnStack = warnStack.prepend(warn); checkUnsafeVarargsConversion(t, s, warn); - return isCastable.visit(t,s); + result = isCastable.visit(t,s); } finally { warnStack = warnStack.tail; } } else { - return isCastable.visit(t,s); + result = isCastable.visit(t,s); } + if (result && (t.tsym.isSealed() || s.tsym.isSealed())) { + return (t.isCompound() || s.isCompound()) ? + false : + !areDisjoint((ClassSymbol)t.tsym, (ClassSymbol)s.tsym); + } + return result; } // where + private boolean areDisjoint(ClassSymbol ts, ClassSymbol ss) { + if (isSubtype(ts.type, ss.type)) { + return false; + } + // if both are classes or both are interfaces, shortcut + if (ts.isInterface() == ss.isInterface() && isSubtype(ss.type, ts.type)) { + return false; + } + if (ts.isInterface() && !ss.isInterface()) { + /* so ts is interface but ss is a class + * an interface is disjoint from a class if the class is disjoint form the interface + */ + return areDisjoint(ss, ts); + } + // a final class that is not subtype of ss is disjoint + if (!ts.isInterface() && ts.isFinal()) { + return true; + } + // if at least one is sealed + if (ts.isSealed() || ss.isSealed()) { + // permitted subtypes have to be disjoint with the other symbol + ClassSymbol sealedOne = ts.isSealed() ? ts : ss; + ClassSymbol other = sealedOne == ts ? ss : ts; + return sealedOne.permitted.stream().allMatch(sym -> areDisjoint((ClassSymbol)sym, other)); + } + return false; + } + private TypeRelation isCastable = new TypeRelation() { public Boolean visitType(Type t, Type s) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 18c4c2b8658f2..fc81424a5904a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -1303,7 +1303,10 @@ && checkDisjoint(pos, flags, SEALED | NON_SEALED) && checkDisjoint(pos, flags, SEALED, - FINAL | NON_SEALED)) { + FINAL | NON_SEALED) + && checkDisjoint(pos, flags, + SEALED, + ANNOTATION)) { // skip } return flags & (mask | ~ExtendedStandardFlags) | implicit; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java index ceeee890720af..0014bc21ae5d4 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -4264,11 +4264,19 @@ protected boolean isSealedClassStart(boolean local) { private boolean allowedAfterSealedOrNonSealed(Token next, boolean local, boolean currentIsNonSealed) { return local ? switch (next.kind) { - case MONKEYS_AT, ABSTRACT, FINAL, STRICTFP, CLASS, INTERFACE, ENUM -> true; + case MONKEYS_AT -> { + Token afterNext = S.token(2); + yield afterNext.kind != INTERFACE || currentIsNonSealed; + } + case ABSTRACT, FINAL, STRICTFP, CLASS, INTERFACE, ENUM -> true; default -> false; } : switch (next.kind) { - case MONKEYS_AT, PUBLIC, PROTECTED, PRIVATE, ABSTRACT, STATIC, FINAL, STRICTFP, CLASS, INTERFACE, ENUM -> true; + case MONKEYS_AT -> { + Token afterNext = S.token(2); + yield afterNext.kind != INTERFACE || currentIsNonSealed; + } + case PUBLIC, PROTECTED, PRIVATE, ABSTRACT, STATIC, FINAL, STRICTFP, CLASS, INTERFACE, ENUM -> true; case IDENTIFIER -> isNonSealedIdentifier(next, currentIsNonSealed ? 3 : 1) || next.name() == names.sealed; default -> false; }; diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod index 0d0162d040a27..ba42c193518e8 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod @@ -21,11 +21,10 @@ * questions. */ -// This class has entries in its PermittedSubclasses attribute that do not exist. -// Test that this does not prevent JVM_GetPermittedSubclasses() from returning -// their names. +// This class has an entry in its PermittedSubclasses attribute that does not exist. +// Test that JVM_GetPermittedSubclasses() only returns the existing class. // -// sealed class NoLoadSubclasses permits iDontExist, I/Dont/Exist/Either { } +// sealed class NoLoadSubclasses permits ExistingClassFile, I/Dont/Exist/Either { } // class NoLoadSubclasses { 0xCAFEBABE; @@ -47,7 +46,7 @@ class NoLoadSubclasses { Utf8 "NoLoadSubclasses.java"; // #12 at 0x73 Utf8 "PermittedSubclasses"; // #13 at 0x89 class #15; // #14 at 0x9D - Utf8 "iDontExist"; // #15 at 0xA0 + Utf8 "ExistingClassFile"; // #15 at 0xA0 class #17; // #16 at 0xAA Utf8 "I/Dont/Exist/Either"; // #17 at 0xAD } // Constant Pool @@ -99,7 +98,70 @@ class NoLoadSubclasses { } // Attributes } // end class NoLoadSubclasses +// class ExistingClassFile extends NoLoadSubclasses { } +// +class ExistingClassFile { + 0xCAFEBABE; + 0; // minor version + 55; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #10; // #1 + class #11; // #2 + class #12; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "LineNumberTable"; // #7 + Utf8 "SourceFile"; // #8 + Utf8 "ExistingClassFile.java"; // #9 + NameAndType #4 #5; // #10 + Utf8 "ExistingClassFile"; // #11 + Utf8 "NoLoadSubclasses"; // #12 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // Fields + } // Fields + [] { // Methods + { // method + 0x0001; // access + #4; // name_index + #5; // descriptor_index + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + } + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#7) { // LineNumberTable + [] { // line_number_table + 0 1; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } + } // Methods + + [] { // Attributes + Attr(#8) { // SourceFile + #9; + } // end SourceFile + } // Attributes +} // end class ExistingClassFile // This class contains an empty PermittedSubclasses attribute. Test that // this causes an exception to get thrown. diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java index b6c461a4f34d6..67b0f0d2ec15a 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java @@ -25,11 +25,12 @@ * @test * @bug 8225056 * @compile GetPermittedSubclasses.jcod + * @compile --enable-preview -source ${jdk.version} noSubclass/BaseC.java noSubclass/BaseI.java noSubclass/Impl1.java + * @compile --enable-preview -source ${jdk.version} noSubclass/Impl2.java * @compile --enable-preview -source ${jdk.version} GetPermittedSubclassesTest.java * @run main/othervm --enable-preview GetPermittedSubclassesTest */ -import java.lang.constant.ClassDesc; import java.util.ArrayList; // Test Class GetPermittedSubtpes() and Class.isSealed() APIs. @@ -50,11 +51,11 @@ final class NotSealed implements SealedI1 {} final class Final4 {} public static void testSealedInfo(Class c, String[] expected) { - Object[] permitted = c.permittedSubclasses(); + var permitted = c.getPermittedSubclasses(); if (permitted.length != expected.length) { throw new RuntimeException( - "Unexpected number of permitted subclasses for: " + c.toString()); + "Unexpected number of permitted subclasses for: " + c.toString() + "(" + java.util.Arrays.asList(permitted)); } if (permitted.length > 0) { @@ -65,7 +66,7 @@ public static void testSealedInfo(Class c, String[] expected) { // Create ArrayList of permitted subclasses class names. ArrayList permittedNames = new ArrayList(); for (int i = 0; i < permitted.length; i++) { - permittedNames.add(((ClassDesc)permitted[i]).descriptorString()); + permittedNames.add(permitted[i].getName()); } if (permittedNames.size() != expected.length) { @@ -102,10 +103,11 @@ public static void testBadSealedClass(String className, String expectedCFEMessag } public static void main(String... args) throws Throwable { - testSealedInfo(SealedI1.class, new String[] {"LGetPermittedSubclassesTest$NotSealed;", - "LGetPermittedSubclassesTest$Sub1;", - "LGetPermittedSubclassesTest$Extender;"}); - testSealedInfo(Sealed1.class, new String[] {"LGetPermittedSubclassesTest$Sub1;"}); + testSealedInfo(SealedI1.class, new String[] {"GetPermittedSubclassesTest$NotSealed", + "GetPermittedSubclassesTest$Sub1", + "GetPermittedSubclassesTest$Extender"}); + + testSealedInfo(Sealed1.class, new String[] {"GetPermittedSubclassesTest$Sub1"}); testSealedInfo(Final4.class, new String[] { }); testSealedInfo(NotSealed.class, new String[] { }); @@ -115,8 +117,8 @@ public static void main(String... args) throws Throwable { // Test class with an empty PermittedSubclasses attribute. testBadSealedClass("NoSubclasses", "PermittedSubclasses attribute is empty"); - // Test returning names of non-existing classes. - testSealedInfo(NoLoadSubclasses.class, new String[]{"LiDontExist;", "LI/Dont/Exist/Either;"}); + // Test returning only names of existing classes. + testSealedInfo(NoLoadSubclasses.class, new String[]{"ExistingClassFile" }); // Test that loading a class with a corrupted PermittedSubclasses attribute // causes a ClassFormatError. @@ -134,5 +136,10 @@ public static void main(String... args) throws Throwable { // Test that loading a sealed class with an empty class name in its PermittedSubclasses // attribute causes a ClassFormatError. testBadSealedClass("EmptyPermittedSubclassEntry", "Illegal class name \"\" in class file"); + + //test type enumerated in the PermittedSubclasses attribute, + //which are not direct subtypes of the current class are not returned: + testSealedInfo(noSubclass.BaseC.class, new String[] {"noSubclass.ImplCIntermediate"}); + testSealedInfo(noSubclass.BaseI.class, new String[] {"noSubclass.ImplIIntermediateI", "noSubclass.ImplIIntermediateC"}); } } diff --git a/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseC.java b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseC.java new file mode 100644 index 0000000000000..21dafef2f3c40 --- /dev/null +++ b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseC.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020, 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 noSubclass; + +public sealed class BaseC permits ImplC, ImplCIntermediate, ImplCIndirect {} diff --git a/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseI.java b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseI.java new file mode 100644 index 0000000000000..6fcbd5bc1c81f --- /dev/null +++ b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/BaseI.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020, 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 noSubclass; + +public sealed interface BaseI permits ImplII, ImplIIntermediateI, ImplIIndirectI, ImplIC, ImplIIntermediateC, ImplIIndirectC {} diff --git a/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl1.java b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl1.java new file mode 100644 index 0000000000000..ade575793adcc --- /dev/null +++ b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl1.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020, 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 noSubclass; + +final class ImplC extends BaseC {} +non-sealed class ImplCIntermediate extends BaseC {} +final class ImplCIndirect extends BaseC {} + +non-sealed interface ImplII extends BaseI {} +non-sealed interface ImplIIntermediateI extends BaseI {} +non-sealed interface ImplIIndirectI extends ImplIIntermediateI, BaseI {} + +final class ImplIC implements BaseI {} +non-sealed class ImplIIntermediateC implements BaseI {} +final class ImplIIndirectC extends ImplIIntermediateC implements BaseI {} diff --git a/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl2.java b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl2.java new file mode 100644 index 0000000000000..0938a93d3db23 --- /dev/null +++ b/test/hotspot/jtreg/runtime/sealedClasses/noSubclass/Impl2.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020, 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 noSubclass; + +final class ImplC {} +non-sealed class ImplCIntermediate extends BaseC {} +final class ImplCIndirect extends ImplCIntermediate {} + +interface ImplII {} +non-sealed interface ImplIIntermediateI extends BaseI {} +interface ImplIIndirectI extends ImplIIntermediateI {} + +final class ImplIC {} +non-sealed class ImplIIntermediateC implements BaseI {} +final class ImplIIndirectC extends ImplIIntermediateC {} diff --git a/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java b/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java index 656c04c415639..abecc2b0215ac 100644 --- a/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java +++ b/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java @@ -86,8 +86,8 @@ public Object[][] sealedClassesData() { public void testSealedClasses(Class cls) { assertTrue(cls.isSealed()); assertTrue(!Modifier.isFinal(cls.getModifiers())); - assertTrue(cls.permittedSubclasses() != null); - assertTrue(cls.permittedSubclasses().length > 0); + assertTrue(cls.getPermittedSubclasses() != null); + assertTrue(cls.getPermittedSubclasses().length > 0); } @DataProvider(name = "notSealedClasses") @@ -110,8 +110,8 @@ public Object[][] notSealedClassesData() { @Test(dataProvider = "notSealedClasses") public void testNotSealedClasses(Class cls) { assertTrue(!cls.isSealed()); - assertTrue(cls.permittedSubclasses() != null); - assertTrue(cls.permittedSubclasses().length == 0); + assertTrue(cls.getPermittedSubclasses() != null); + assertTrue(cls.getPermittedSubclasses().length == 0); } @DataProvider(name = "non_sealedClasses") @@ -128,8 +128,8 @@ public void testnon_sealedClasses(Class cls) { assertTrue(!cls.isSealed()); assertTrue(!Modifier.isFinal(cls.getModifiers())); assertTrue((cls.getSuperclass() != null && cls.getSuperclass().isSealed()) || Arrays.stream(cls.getInterfaces()).anyMatch(Class::isSealed)); - assertTrue(cls.permittedSubclasses() != null); - assertTrue(cls.permittedSubclasses().length == 0); + assertTrue(cls.getPermittedSubclasses() != null); + assertTrue(cls.getPermittedSubclasses().length == 0); } @DataProvider(name = "reflectionData") @@ -215,10 +215,10 @@ public void testSealedReflection(Class sealedClass, throws ReflectiveOperationException { assertTrue(sealedClass.isSealed()); - assertTrue(sealedClass.permittedSubclasses().length == numberOfSubclasses); + assertTrue(sealedClass.getPermittedSubclasses().length == numberOfSubclasses); int i = 0; - for (ClassDesc cd : sealedClass.permittedSubclasses()) { - assertTrue(cd.displayName().equals(subclassDescriptors[i]), "expected: " + subclassDescriptors[i] + " found: " + cd.displayName()); + for (Class cd : sealedClass.getPermittedSubclasses()) { + assertTrue(cd.getName().equals(subclassDescriptors[i]), "expected: " + subclassDescriptors[i] + " found: " + cd.getName()); i++; } i = 0; diff --git a/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java b/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java new file mode 100644 index 0000000000000..43ffc520be101 --- /dev/null +++ b/test/jdk/java/lang/reflect/sealed_classes/TestSecurityManagerChecks.java @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2020, 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 8246778 + * @summary Test that security checks occur for getPermittedSubclasses + * @library /test/lib + * @modules java.compiler + * @build jdk.test.lib.compiler.CompilerUtils jdk.test.lib.compiler.ModuleInfoMaker TestSecurityManagerChecks + * @run main/othervm --enable-preview TestSecurityManagerChecks named + * @run main/othervm --enable-preview TestSecurityManagerChecks unnamed + */ + +import java.io.IOException; +import java.lang.module.Configuration; +import java.lang.module.ModuleFinder; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import jdk.test.lib.compiler.*; + +public class TestSecurityManagerChecks { + + private static final ClassLoader OBJECT_CL = null; + + public static void main(String[] args) throws Throwable { + if ("named".equals(args[0])) { + runNamedModuleTest(); + } else { + runUnnamedModuleTest(); + } + } + + private static void runNamedModuleTest() throws Throwable { + Path classes = compileNamedModuleTest(); + URL[] testClassPath = getTestClassPath(); + + //need to use a different ClassLoader to run the test, so that the checks are performed: + ClassLoader testCL = new URLClassLoader(testClassPath, OBJECT_CL); + testCL.loadClass("TestSecurityManagerChecks") + .getDeclaredMethod("doRunNamedModuleTest", Path.class) + .invoke(null, classes); + } + + public static void doRunNamedModuleTest(Path classes) throws Throwable { + Configuration testConfig = ModuleLayer.boot() + .configuration() + .resolve(ModuleFinder.of(), + ModuleFinder.of(classes), + List.of("test")); + ModuleLayer testLayer = ModuleLayer.boot() + .defineModulesWithOneLoader(testConfig, + OBJECT_CL); + + // First get hold of the target classes before we enable security + Class sealed = Class.forName(testLayer.findModule("test").get(), "test.Base"); + + //try without a SecurityManager: + checkPermittedSubclasses(sealed, "test.a.ImplA1", + "test.a.ImplA2", + "test.b.ImplB"); + + String[] denyPackageAccess = new String[1]; + int[] checkPackageAccessCallCount = new int[1]; + + //try with a SecurityManager: + SecurityManager sm = new SecurityManager() { + @Override + public void checkPackageAccess(String pkg) { + if (pkg.startsWith("test.")) { + checkPackageAccessCallCount[0]++; + } + if (Objects.equals(denyPackageAccess[0], pkg)) { + throw new SecurityException(); + } + } + }; + + System.setSecurityManager(sm); + + denyPackageAccess[0] = "test"; + + //passes - does not return a class from package "test": + checkPermittedSubclasses(sealed, "test.a.ImplA1", + "test.a.ImplA2", + "test.b.ImplB"); + + if (checkPackageAccessCallCount[0] != 2) { + throw new AssertionError("Unexpected call count: " + + checkPackageAccessCallCount[0]); + } + + denyPackageAccess[0] = "test.a"; + + try { + sealed.getPermittedSubclasses(); + throw new Error("getPermittedSubclasses incorrectly succeeded for " + + sealed.getName()); + } catch (SecurityException e) { + System.out.println("OK - getPermittedSubclasses for " + sealed.getName() + + " got expected exception: " + e); + } + } + + private static Path compileNamedModuleTest() throws IOException { + Path base = Paths.get(".", "named"); + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + + ModuleInfoMaker maker = new ModuleInfoMaker(src); + maker.writeJavaFiles("test", + "module test {}", + "package test; public sealed interface Base permits test.a.ImplA1, test.a.ImplA2, test.b.ImplB, test.c.ImplC {}", + "package test.a; public final class ImplA1 implements test.Base {}", + "package test.a; public final class ImplA2 implements test.Base {}", + "package test.b; public final class ImplB implements test.Base {}", + "package test.c; public final class ImplC implements test.Base {}" + ); + + if (!CompilerUtils.compile(src, classes.resolve("test"), "--enable-preview", "-source", System.getProperty("java.specification.version"))) { + throw new AssertionError("Compilation didn't succeed!"); + } + + Files.delete(classes.resolve("test").resolve("test").resolve("c").resolve("ImplC.class")); + + return classes; + } + + private static void runUnnamedModuleTest() throws Throwable { + Path classes = compileUnnamedModuleTest(); + URL[] testClassPath = getTestClassPath(); + + //need to use a different ClassLoader to run the test, so that the checks are performed: + ClassLoader testCL = new URLClassLoader(testClassPath, OBJECT_CL); + testCL.loadClass("TestSecurityManagerChecks") + .getDeclaredMethod("doRunUnnamedModuleTest", Path.class) + .invoke(null, classes); + } + + public static void doRunUnnamedModuleTest(Path classes) throws Throwable { + ClassLoader unnamedModuleCL = + new URLClassLoader(new URL[] {classes.toUri().toURL()}, OBJECT_CL); + + // First get hold of the target classes before we enable security + Class sealed = unnamedModuleCL.loadClass("test.Base"); + + //try without a SecurityManager: + checkPermittedSubclasses(sealed, "test.ImplA1", + "test.ImplA2", + "test.ImplB"); + + String[] denyPackageAccess = new String[1]; + int[] checkPackageAccessCallCount = new int[1]; + + //try with a SecurityManager: + SecurityManager sm = new SecurityManager() { + @Override + public void checkPackageAccess(String pkg) { + if (pkg.equals("test")) { + checkPackageAccessCallCount[0]++; + } + if (Objects.equals(denyPackageAccess[0], pkg)) { + throw new SecurityException(); + } + } + }; + + System.setSecurityManager(sm); + + denyPackageAccess[0] = "test.unknown"; + + //passes - does not return a class from package "test.unknown": + checkPermittedSubclasses(sealed, "test.ImplA1", + "test.ImplA2", + "test.ImplB"); + + if (checkPackageAccessCallCount[0] != 1) { + throw new AssertionError("Unexpected call count: " + + checkPackageAccessCallCount[0]); + } + + denyPackageAccess[0] = "test"; + + try { + sealed.getPermittedSubclasses(); + throw new Error("getPermittedSubclasses incorrectly succeeded for " + + sealed.getName()); + } catch (SecurityException e) { + System.out.println("OK - getPermittedSubclasses for " + sealed.getName() + + " got expected exception: " + e); + } + } + + private static Path compileUnnamedModuleTest() throws IOException { + Path base = Paths.get(".", "unnamed"); + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + + ModuleInfoMaker maker = new ModuleInfoMaker(src); + maker.writeJavaFiles("test", + "module test {}", + "package test; public sealed interface Base permits ImplA1, ImplA2, ImplB, ImplC {}", + "package test; public final class ImplA1 implements test.Base {}", + "package test; public final class ImplA2 implements test.Base {}", + "package test; public final class ImplB implements test.Base {}", + "package test; public final class ImplC implements test.Base {}" + ); + + Files.delete(src.resolve("test").resolve("module-info.java")); + + if (!CompilerUtils.compile(src.resolve("test"), classes, "--enable-preview", "-source", System.getProperty("java.specification.version"))) { + throw new AssertionError("Compilation didn't succeed!"); + } + + Files.delete(classes.resolve("test").resolve("ImplC.class")); + + return classes; + } + + private static void checkPermittedSubclasses(Class c, String... expected) { + Class[] subclasses = c.getPermittedSubclasses(); + List subclassesNames = Arrays.stream(subclasses) + .map(Class::getName) + .collect(Collectors.toList()); + if (!subclassesNames.equals(Arrays.asList(expected))) { + throw new AssertionError("Incorrect permitted subclasses: " + + subclassesNames); + } + } + + private static URL[] getTestClassPath() { + return Arrays.stream(System.getProperty("test.class.path") + .split(System.getProperty("path.separator"))) + .map(TestSecurityManagerChecks::path2URL) + .toArray(s -> new URL[s]); + } + + private static URL path2URL(String p) { + try { + return Path.of(p).toUri().toURL(); + } catch (MalformedURLException ex) { + throw new AssertionError(ex); + } + } + +} diff --git a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java index 3759aee602794..68b1ecee31622 100644 --- a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java +++ b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java @@ -77,9 +77,13 @@ Path[] findJavaFiles(Path... paths) throws IOException { @Test public void testCompatibilityAfterMakingSuperclassSealed(Path base) throws Exception { - // sealing a super class which was not sealed, should fail with IncompatibleClassChangeError + /* If a class that was not declared sealed is changed to be declared sealed, then an + * IncompatibleClassChangeError is thrown if a binary of a pre-existing subclass of + * this class is loaded that is not contained in its permits clause + */ testCompatibilityAfterModifyingSupertype( base, + true, """ package pkg; public class Super { @@ -103,16 +107,16 @@ final class Sub1 extends Super {} """ package pkg; class Sub extends Super {} - """, - true + """ ); } @Test public void testCompatibilityAfterMakingSuperInterfaceSealed(Path base) throws Exception { - // sealing a super interface which was not sealed, should fail with IncompatibleClassChangeError + // test similar to testCompatibilityAfterMakingSuperclassSealed but with interfaces testCompatibilityAfterModifyingSupertype( base, + true, """ package pkg; public interface Super { @@ -136,8 +140,7 @@ final class Sub1 implements Super {} """ package pkg; class Sub implements Super {} - """, - true + """ ); } @@ -149,18 +152,17 @@ class Sub implements Super {} */ private void testCompatibilityAfterModifyingSupertype( Path base, + boolean shouldFail, String superClassCode1, String superClassCode2, - String subClassCode, - boolean shouldFail) throws Exception { + String... subClassesCode) throws Exception { Path src = base.resolve("src"); Path pkg = src.resolve("pkg"); Path superClass = pkg.resolve("Super"); Path sub = pkg.resolve("Sub"); - // super class initially not sealed tb.writeJavaFiles(superClass, superClassCode1); - tb.writeJavaFiles(sub, subClassCode); + tb.writeJavaFiles(sub, subClassesCode); Path out = base.resolve("out"); Files.createDirectories(out); @@ -220,9 +222,12 @@ private void testCompatibilityAfterModifyingSupertype( @Test public void testRemoveSealedModifierToClass(Path base) throws Exception { - // should execute without error + /* Changing a class that is declared sealed to no longer be declared + * sealed does not break compatibility with pre-existing binaries. + */ testCompatibilityAfterModifyingSupertype( base, + false, """ package pkg; public sealed class Super permits pkg.Sub { @@ -244,16 +249,16 @@ public static void main(String... args) { """ package pkg; final class Sub extends Super {} - """, - false + """ ); } @Test public void testRemoveSealedModifierToInterface(Path base) throws Exception { - // should execute without error + // same as testRemoveSealedModifierToClass but with an interface testCompatibilityAfterModifyingSupertype( base, + false, """ package pkg; public sealed interface Super permits pkg.Sub { @@ -275,14 +280,15 @@ public static void main(String... args) { """ package pkg; final class Sub implements Super {} - """, - false + """ ); } @Test public void testAddNonSealedModifierToClass(Path base) throws Exception { - // should execute without error + /* Changing a class that is not declared non-sealed to be declared + * non-sealed does not break compatibility with pre-existing binaries + */ testCompatibilityOKAfterSubclassChange( base, """ @@ -307,7 +313,7 @@ non-sealed class Sub extends Super {} @Test public void testAddNonSealedModifierToInterface(Path base) throws Exception { - // should execute without error + // same as `testAddNonSealedModifierToClass` but with interfaces testCompatibilityOKAfterSubclassChange( base, """ @@ -332,7 +338,9 @@ non-sealed class Sub implements Super {} @Test public void testRemoveNonSealedModifier(Path base) throws Exception { - // should execute without error + /* Changing a class that is declared non-sealed to no longer be declared + * non-sealed does not break compatibility with pre-existing binaries + */ testCompatibilityOKAfterSubclassChange( base, """ @@ -357,7 +365,7 @@ final class Sub extends Super {} @Test public void testRemoveNonSealedModifierFromInterface(Path base) throws Exception { - // should execute without error + // same as `testRemoveNonSealedModifier` but with interfaces testCompatibilityOKAfterSubclassChange( base, """ @@ -452,9 +460,13 @@ private void testCompatibilityOKAfterSubclassChange( @Test public void testAfterChangingPermitsClause(Path base) throws Exception { - // the VM will throw IncompatibleClassChangeError + /* If a class is removed from the set of permitted direct subclasses of + * a sealed class then an IncompatibleClassChangeError is thrown if the + * pre-existing binary of the removed class is loaded + */ testCompatibilityAfterModifyingSupertype( base, + true, """ package pkg; public sealed class Super permits pkg.Sub1, Sub2 { @@ -480,8 +492,139 @@ final class Sub2 extends Super {} """ package pkg; final class Sub1 extends Super {} + """ + ); + } + + @Test + public void testAfterChangingPermitsClause2(Path base) throws Exception { + /* If a class is removed from the set of permitted direct subclasses of + * a sealed class then an IncompatibleClassChangeError is thrown if the + * pre-existing binary of the removed class is loaded + */ + testCompatibilityAfterModifyingSupertype( + base, + true, + """ + package pkg; + public sealed class Super permits pkg.Sub1, pkg.Sub2 { + public static void main(String... args) { + pkg.Sub1 sub1 = new pkg.Sub1(); + pkg.Sub2 sub2 = new pkg.Sub2(); + System.out.println("done"); + } + } """, - true + """ + package pkg; + public sealed class Super permits pkg.Sub1 { + public static void main(String... args) { + pkg.Sub1 sub1 = new pkg.Sub1(); + pkg.Sub2 sub2 = new pkg.Sub2(); + System.out.println("done"); + } + } + """, + """ + package pkg; + final class Sub1 extends Super {} + """, + """ + package pkg; + final class Sub2 extends Super {} + """ ); } + + @Test + public void testAfterChangingPermitsClause3(Path base) throws Exception { + /* Changing the set of permitted direct subclasses of a sealed class will + * not break compatibility with pre-existing binaries, provided that the + * total set of permitted direct subclasses of the sealed class loses no + * members + */ + String superClassCode1 = + """ + package pkg; + public sealed class Super permits pkg.Sub1 { + public static void main(String... args) { + pkg.Sub1 sub1 = new pkg.Sub1(); + System.out.println("done"); + } + } + """; + String subClass1Code = + """ + package pkg; + final class Sub1 extends Super {} + """; + + String superClassCode2 = + """ + package pkg; + public sealed class Super permits pkg.Sub1, pkg.Sub2 { + public static void main(String... args) { + pkg.Sub1 sub1 = new pkg.Sub1(); + pkg.Sub2 sub2 = new pkg.Sub2(); + System.out.println("done"); + } + } + """; + String subClass2Code = + """ + package pkg; + final class Sub2 extends Super {} + """; + + Path src = base.resolve("src"); + Path pkg = src.resolve("pkg"); + Path superClass = pkg.resolve("Super"); + Path sub1 = pkg.resolve("Sub1"); + + tb.writeJavaFiles(superClass, superClassCode1); + tb.writeJavaFiles(sub1, subClass1Code); + + Path out = base.resolve("out"); + Files.createDirectories(out); + + new JavacTask(tb) + .options("--enable-preview", + "-source", Integer.toString(Runtime.version().feature())) + .outdir(out) + .files(findJavaFiles(pkg)) + .run(); + + // let's execute to check that it's working + String output = new JavaTask(tb) + .vmOptions("--enable-preview") + .classpath(out.toString()) + .classArgs("pkg.Super") + .run() + .writeAll() + .getOutput(Task.OutputKind.STDOUT); + + // let's first check that it runs wo issues + if (!output.contains("done")) { + throw new AssertionError("execution of Super didn't finish"); + } + + // now lets change the super class + tb.writeJavaFiles(superClass, superClassCode2); + Path sub2 = pkg.resolve("Sub2"); + tb.writeJavaFiles(sub2, subClass2Code); + + new JavacTask(tb) + .options("--enable-preview", + "-source", Integer.toString(Runtime.version().feature())) + .classpath(out) + .outdir(out) + .files(findJavaFiles(superClass)[0], findJavaFiles(sub2)[0]) + .run(); + + new JavaTask(tb) + .vmOptions("--enable-preview") + .classpath(out.toString()) + .classArgs("pkg.Super") + .run(Task.Expect.SUCCESS); + } } diff --git a/test/langtools/tools/javac/sealed/SealedCompilationTests.java b/test/langtools/tools/javac/sealed/SealedCompilationTests.java index 5313d5a127535..005fd13708232 100644 --- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java +++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java @@ -468,6 +468,26 @@ void m() { final class D extends C { } } } + """, + """ + sealed class C { + void m() { + class L { + final class D extends C { } + } + } + } + """, + """ + sealed class C { + void m() { + class L { + void foo() { + final class D extends C { } + } + } + } + } """)) assertFail("compiler.err.local.classes.cant.extend.sealed", s); } @@ -613,7 +633,7 @@ public void testAPIForPrimitiveAndArrayClasses() { float.class, float[].class, double.class, double[].class, char.class, char[].class, boolean.class, boolean[].class, void.class, String[].class}) { Assert.check(!c.isSealed()); - Assert.check(c.permittedSubclasses().length == 0); + Assert.check(c.getPermittedSubclasses().length == 0); } } @@ -956,4 +976,282 @@ sealed static class Super permits Outer.Sub {} assertOK(s); } } + + public void testDoNotAllowSealedAnnotation() { + for (String s : List.of( + """ + sealed @interface A {} + non-sealed interface I extends A {} + """ + )) { + assertFail("compiler.err.expected4", s); + } + } + + public void testNarrowConversion() { + for (String s : List.of( + """ + interface I {} + sealed class C permits D {} + final class D extends C {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + sealed interface I permits C {} + final class C implements I {} + interface J {} + + class Test { + void test () { + I i = null; + J j = (J) i; + } + } + """, + """ + interface I {} + sealed interface J permits C {} + final class C implements J {} + + class Test { + void test () { + I i = null; + J j = (J) i; + } + } + """, + """ + sealed interface I permits A {} + sealed interface J permits B {} + final class A implements I {} + final class B implements J {} + + class Test { + void test () { + I i = null; + J j = (J) i; + } + } + """, + """ + class C {} + sealed interface I permits A {} + final class A implements I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + final class C {} + interface I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + final class C {} + sealed interface I permits D {} + final class D implements I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + sealed class C permits D {} + final class D extends C {} + non-sealed interface I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + sealed class C permits D {} + final class D {} + sealed interface I permits E {} + final class E {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + sealed class C permits D {} + sealed class D permits NS {} + non-sealed class NS extends D {} + sealed interface I permits E {} + final class E {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + interface I {} + final class C {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """, + """ + interface I {} + sealed class C permits D {} + final class D {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """, + """ + sealed interface I permits D {} + final class D {} + class C {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """, + """ + sealed interface I permits D {} + final class D implements I {} + final class C {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """, + """ + sealed interface I permits D {} + final class D implements I {} + sealed class C permits E {} + final class E extends C {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """ + )) { + assertFail("compiler.err.prob.found.req", s); + } + + for (String s : List.of( + """ + interface I {} + sealed class C permits D, E {} + non-sealed class D extends C {} + final class E extends C {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + interface I {} + interface J {} + + class Test { + void test () { + I i = null; + J j = (J) i; + } + } + """, + """ + class C {} + interface I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + interface I {} + class C {} + + class Test { + void test () { + I i = null; + C c = (C) i; + } + } + """, + """ + sealed class C permits D {} + sealed class D extends C permits NS {} + non-sealed class NS extends D {} + interface I {} + + class Test { + void test () { + C c = null; + I i = (I) c; + } + } + """, + """ + sealed interface A permits B { } + non-sealed interface B extends A { } + interface C { } + + class D implements C, B { } + + class Test { + void m(A a, C c) { + a = (A)c; + } + } + """ + )) { + assertOK(s); + } + } } From e08b9ed0be09b6553925843467cc9d6f928f08d5 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 7 Dec 2020 12:43:35 +0000 Subject: [PATCH 103/504] 8257820: Remove gc/ergonomics/TestMinHeapSize.java as it is too brittle Reviewed-by: jiefu, kbarrett --- .../jtreg/gc/ergonomics/TestMinHeapSize.java | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java diff --git a/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java b/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java deleted file mode 100644 index 9f20196cf1c14..0000000000000 --- a/test/hotspot/jtreg/gc/ergonomics/TestMinHeapSize.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2020 THL A29 Limited, a Tencent company. 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 gc.ergonomics; - -/* - * @test TestMinHeapSize - * @bug 8257230 - * @summary Check ergonomics decided on compatible initial and minimum heap sizes - * @library /test/lib - * @requires os.family == "linux" - * @run main/othervm gc.ergonomics.TestMinHeapSize - */ - -import jdk.test.lib.Platform; -import jdk.test.lib.process.ProcessTools; - - -public class TestMinHeapSize { - - public static void main(String[] args) throws Throwable { - String cmd = ProcessTools.getCommandLine(ProcessTools.createJavaProcessBuilder( - "-XX:MinHeapSize=1537m", "-XX:CompressedClassSpaceSize=64m", "-version")); - - int ulimitV = 3145728; // 3G - var pb = new ProcessBuilder( - "sh", "-c", - "ulimit -v " + ulimitV + "; " + cmd); - - // lower MALLOC_ARENA_MAX b/c we limited virtual memory, see JDK-8043516 - pb.environment().put("MALLOC_ARENA_MAX", "4"); - - var oa = ProcessTools.executeCommand(pb); - - oa.shouldNotContain("hs_err") - .shouldNotContain("Internal Error") - .shouldHaveExitValue(0); - } -} From ecd7e476f838d6585d352488905a671bf2e41df3 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Mon, 7 Dec 2020 13:18:02 +0000 Subject: [PATCH 104/504] 8257793: Shenandoah: SATB barrier should only filter out already strongly marked oops Reviewed-by: shade, rkennke --- src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index 6c49253e2c9fc..0891da8336d39 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -328,7 +328,7 @@ inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) { inline bool ShenandoahHeap::requires_marking(const void* entry) const { oop obj = oop(entry); - return !_marking_context->is_marked(obj); + return !_marking_context->is_marked_strong(obj); } inline bool ShenandoahHeap::in_collection_set(oop p) const { From 46b35acfcbc717891fec4822292628716fb35bac Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Mon, 7 Dec 2020 13:45:19 +0000 Subject: [PATCH 105/504] 8257798: [PPC64] undefined reference to Klass::vtable_start_offset() Reviewed-by: goetz --- src/hotspot/cpu/ppc/ppc.ad | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 82e0890a94193..ed51f054128a3 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -980,6 +980,8 @@ source_hpp %{ source %{ +#include "oops/klass.inline.hpp" + void PhaseOutput::pd_perform_mach_node_analysis() { } @@ -3635,9 +3637,9 @@ encode %{ Register Rtoc = (ra_) ? $constanttablebase : R2_TOC; int vtable_index = this->_vtable_index; - if (_vtable_index < 0) { + if (vtable_index < 0) { // Must be invalid_vtable_index, not nonvirtual_vtable_index. - assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value"); + assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value"); Register ic_reg = as_Register(Matcher::inline_cache_reg_encode()); // Virtual call relocation will point to ic load. @@ -3663,7 +3665,7 @@ encode %{ __ load_klass(R11_scratch1, R3); - int entry_offset = in_bytes(Klass::vtable_start_offset()) + _vtable_index * vtableEntry::size_in_bytes(); + int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index * vtableEntry::size_in_bytes(); int v_off = entry_offset + vtableEntry::method_offset_in_bytes(); __ li(R19_method, v_off); __ ldx(R19_method/*method*/, R19_method/*method offset*/, R11_scratch1/*class*/); From 2c04fc02c929a117ce620ac70e3b957c4afc3c40 Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Mon, 7 Dec 2020 13:51:33 +0000 Subject: [PATCH 106/504] 8257037: No javac warning when calling deprecated constructor with diamond Reviewed-by: mcimadamore --- .../com/sun/tools/javac/comp/Resolve.java | 25 ++++++++++++++++++- .../tools/javac/T8257037/T8257037.java | 15 +++++++++++ .../tools/javac/T8257037/T8257037.out | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test/langtools/tools/javac/T8257037/T8257037.java create mode 100644 test/langtools/tools/javac/T8257037/T8257037.out diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index abf883d71062c..5d9a6bb23e35a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -2919,7 +2919,7 @@ Symbol resolveDiamond(DiagnosticPosition pos, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) { @Override Symbol doLookup(Env env, MethodResolutionPhase phase) { - return findDiamond(env, site, argtypes, typeargtypes, + return findDiamond(pos, env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); } @@ -2942,6 +2942,29 @@ Symbol access(Env env, DiagnosticPosition pos, Symbol location, Sym }}); } + /** Find the constructor using diamond inference and do some checks(deprecated and preview). + * @param pos The position to use for error reporting. + * @param env The environment current at the constructor invocation. + * @param site The type of class for which a constructor is searched. + * The scope of this class has been touched in attribution. + * @param argtypes The types of the constructor invocation's value arguments. + * @param typeargtypes The types of the constructor invocation's type arguments. + * @param allowBoxing Allow boxing conversions of arguments. + * @param useVarargs Box trailing arguments into an array for varargs. + */ + private Symbol findDiamond(DiagnosticPosition pos, + Env env, + Type site, + List argtypes, + List typeargtypes, + boolean allowBoxing, + boolean useVarargs) { + Symbol sym = findDiamond(env, site, argtypes, typeargtypes, allowBoxing, useVarargs); + chk.checkDeprecated(pos, env.info.scope.owner, sym); + chk.checkPreview(pos, sym); + return sym; + } + /** This method scans all the constructor symbol in a given class scope - * assuming that the original scope contains a constructor of the kind: * {@code Foo(X x, Y y)}, where X,Y are class type-variables declared in Foo, diff --git a/test/langtools/tools/javac/T8257037/T8257037.java b/test/langtools/tools/javac/T8257037/T8257037.java new file mode 100644 index 0000000000000..cb2730c683892 --- /dev/null +++ b/test/langtools/tools/javac/T8257037/T8257037.java @@ -0,0 +1,15 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8257307 + * @summary No javac warning when calling deprecated constructor with diamond + * @run compile/ref=T8257037.out -Xlint -XDrawDiagnostics T8257037.java + */ + +public class T8257037 { + T8257037_GenericClass test = new T8257037_GenericClass<>(); // use diamond +} + +class T8257037_GenericClass { + @Deprecated + public T8257037_GenericClass() {} +} diff --git a/test/langtools/tools/javac/T8257037/T8257037.out b/test/langtools/tools/javac/T8257037/T8257037.out new file mode 100644 index 0000000000000..b5def45e5c37d --- /dev/null +++ b/test/langtools/tools/javac/T8257037/T8257037.out @@ -0,0 +1,2 @@ +T8257037.java:9:42: compiler.warn.has.been.deprecated: T8257037_GenericClass(), T8257037_GenericClass +1 warning From 74be819088e13e244131cfb32d7d498ab213d075 Mon Sep 17 00:00:00 2001 From: Eric Caspole Date: Mon, 7 Dec 2020 15:41:03 +0000 Subject: [PATCH 107/504] 8257517: LogCompilation: Add -z to the help messages Reviewed-by: redestad --- .../main/java/com/sun/hotspot/tools/compiler/LogCompilation.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogCompilation.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogCompilation.java index d042b860cb65d..b62c4c5069234 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogCompilation.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogCompilation.java @@ -60,6 +60,7 @@ public static void usage(int exitcode) { System.out.println(" -s: sort events by start time (default)"); System.out.println(" -e: sort events by elapsed time"); System.out.println(" -n: sort events by name and start"); + System.out.println(" -z: sort events by compiled code size"); System.out.println(" -C: compare logs (give files to compare on command line)"); System.out.println(" -d: do not print compilation IDs"); System.exit(exitcode); From d29c78da19ba78214efe9e7856cde30fdd9ba8ab Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 7 Dec 2020 15:55:53 +0000 Subject: [PATCH 108/504] 8257679: Improved unix compatibility layer in Windows build (winenv) Reviewed-by: erikj, jvernee, burban --- .github/workflows/submit.yml | 9 +- make/GenerateLinkOptData.gmk | 4 +- make/InterimImage.gmk | 4 +- make/RunTests.gmk | 17 +- make/RunTestsPrebuilt.gmk | 9 +- make/RunTestsPrebuiltSpec.gmk | 6 +- make/TestImage.gmk | 20 +- make/autoconf/basic.m4 | 49 +- make/autoconf/basic_tools.m4 | 107 ++-- make/autoconf/basic_windows.m4 | 283 +++++---- make/autoconf/boot-jdk.m4 | 73 ++- make/autoconf/bootcycle-spec.gmk.in | 17 +- make/autoconf/build-aux/config.guess | 4 +- make/autoconf/build-aux/config.sub | 12 +- make/autoconf/build-performance.m4 | 2 +- make/autoconf/compare.sh.in | 10 +- make/autoconf/configure.ac | 6 +- make/autoconf/flags-cflags.m4 | 6 +- make/autoconf/flags-ldflags.m4 | 2 +- make/autoconf/flags.m4 | 24 +- make/autoconf/help.m4 | 32 +- make/autoconf/jdk-options.m4 | 25 +- make/autoconf/platform.m4 | 4 +- make/autoconf/source-dirs.m4 | 5 +- make/autoconf/spec.gmk.in | 91 ++- make/autoconf/toolchain.m4 | 300 ++++----- ...hain_windows.m4 => toolchain_microsoft.m4} | 532 ++++++---------- make/autoconf/util.m4 | 149 ----- make/autoconf/util_paths.m4 | 486 +++++++++++--- make/autoconf/util_windows.m4 | 451 ------------- make/common/JavaCompilation.gmk | 18 +- make/common/MakeBase.gmk | 34 +- make/common/NativeCompilation.gmk | 19 +- make/common/Utils.gmk | 2 +- make/common/modules/GensrcCommonLangtools.gmk | 8 +- make/conf/jib-profiles.js | 23 +- make/hotspot/test/GtestImage.gmk | 2 +- make/ide/idea/jdk/idea.gmk | 2 +- .../visualstudio/hotspot/CreateVSProject.gmk | 16 +- .../vscode/hotspot/CreateVSCodeProject.gmk | 2 +- .../generatecharacter/GenerateCharacter.java | 2 +- make/modules/java.base/Copy.gmk | 7 +- .../java.base/gensrc/GensrcCharacterData.gmk | 9 +- .../java.base/gensrc/GensrcCharsetCoder.gmk | 10 +- ...indowsShortName.bat => extract-vs-env.cmd} | 27 +- make/scripts/fixpath.sh | 498 +++++++++++++++ make/src/native/fixpath.c | 594 ------------------ src/hotspot/share/adlc/main.cpp | 2 +- 48 files changed, 1715 insertions(+), 2299 deletions(-) rename make/autoconf/{toolchain_windows.m4 => toolchain_microsoft.m4} (55%) delete mode 100644 make/autoconf/util_windows.m4 rename make/scripts/{windowsShortName.bat => extract-vs-env.cmd} (59%) create mode 100644 make/scripts/fixpath.sh delete mode 100644 make/src/native/fixpath.c diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index a2cc911e5f8dd..f0b27f39bc35c 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -938,15 +938,18 @@ jobs: run: > $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ; + $env:JT_HOME = cygpath "$HOME/jtreg" ; + $env:GTEST = cygpath "$env:GITHUB_WORKSPACE/gtest" ; & bash configure --with-conf-name=windows-x64 --with-msvc-toolset-version=14.27 ${{ matrix.flags }} --with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA" --with-version-build=0 - --with-boot-jdk="$HOME/bootjdk/$env:BOOT_JDK_VERSION" - --with-jtreg="$HOME/jtreg" - --with-gtest="$env:GITHUB_WORKSPACE/gtest" + --with-boot-jdk="$env:BOOT_JDK" + --with-jtreg="$env:JT_HOME" + --with-gtest="$env:GTEST" --with-default-make-target="product-bundles test-bundles" --enable-jtreg-failure-handler working-directory: jdk diff --git a/make/GenerateLinkOptData.gmk b/make/GenerateLinkOptData.gmk index dd92bddc560dc..0de28d643fc5f 100644 --- a/make/GenerateLinkOptData.gmk +++ b/make/GenerateLinkOptData.gmk @@ -61,7 +61,7 @@ endif # Save the stderr output of the command and print it along with stdout in case # something goes wrong. -$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) +$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR) $(call MakeDir, $(LINK_OPT_DIR)) $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@)) $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE))) @@ -94,7 +94,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) # dependencies, make will correctly rebuild both jli trace and classlist # incrementally using the single recipe above. $(CLASSLIST_FILE): $(JLI_TRACE_FILE) -$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) +$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR) TARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE) diff --git a/make/InterimImage.gmk b/make/InterimImage.gmk index 22d3db365aae3..bb4b1fc6fd3ee 100644 --- a/make/InterimImage.gmk +++ b/make/InterimImage.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2020, 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,7 @@ include Modules.gmk ################################################################################ # Use this file inside the image as target for make rule -JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX) +JIMAGE_TARGET_FILE := bin/java$(EXECUTABLE_SUFFIX) INTERIM_MODULES_LIST := $(call CommaList, $(INTERIM_IMAGE_MODULES)) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 97fd016b36109..8b9fea85d32fa 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -60,19 +60,14 @@ define SetTestOpt endif endef -# Setup _NT_SYMBOL_PATH on Windows +# Setup _NT_SYMBOL_PATH on Windows, which points to our pdb files. ifeq ($(call isTargetOs, windows), true) ifndef _NT_SYMBOL_PATH - # Can't use PathList here as it adds quotes around the value. - _NT_SYMBOL_PATH := \ - $(subst $(SPACE),;,$(strip \ - $(foreach p, $(sort $(dir $(wildcard \ - $(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), \ - $(call FixPath, $p) \ - ) \ - )) - export _NT_SYMBOL_PATH - $(call LogDebug, Rewriting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH)) + SYMBOL_PATH := $(call PathList, $(sort $(patsubst %/, %, $(dir $(wildcard \ + $(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))))) + export _NT_SYMBOL_PATH := $(subst \\,\, $(call FixPath, \ + $(subst $(DQUOTE),, $(SYMBOL_PATH)))) + $(call LogDebug, Setting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH)) endif endif diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk index 3468ca4daf191..1cbd8f2273a82 100644 --- a/make/RunTestsPrebuilt.gmk +++ b/make/RunTestsPrebuilt.gmk @@ -189,15 +189,9 @@ ifeq ($(OPENJDK_TARGET_CPU), x86_64) endif ifeq ($(OPENJDK_TARGET_OS), windows) - ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), ) - $(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)') - $(error Cannot continue.) - endif - FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c - PATH_SEP:=; + FIXPATH := $(BASH) $(TOPDIR)/make/scripts/fixpath.sh exec else FIXPATH := - PATH_SEP:=: endif # Check number of cores and memory in MB @@ -280,7 +274,6 @@ $(call CreateNewSpec, $(NEW_SPEC), \ BASH := $(BASH), \ JIB_JAR := $(JIB_JAR), \ FIXPATH := $(FIXPATH), \ - PATH_SEP := $(PATH_SEP), \ OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \ OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \ OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \ diff --git a/make/RunTestsPrebuiltSpec.gmk b/make/RunTestsPrebuiltSpec.gmk index a12a5383c6bbd..f423fea719816 100644 --- a/make/RunTestsPrebuiltSpec.gmk +++ b/make/RunTestsPrebuiltSpec.gmk @@ -116,16 +116,13 @@ JAVAC_CMD := $(BOOT_JDK)/bin/javac JAR_CMD := $(BOOT_JDK)/bin/jar JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod -JARSIGNER_CMD := $(BOOT_JDK)/bin/jarsigner JAVA := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS) JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS) -JAVA_DETACH := $(FIXPATH) $(FIXPATH_DETACH_FLAG) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS) JAVAC := $(FIXPATH) $(JAVAC_CMD) JAR := $(FIXPATH) $(JAR_CMD) JLINK := $(FIXPATH) $(JLINK_CMD) JMOD := $(FIXPATH) $(JMOD_CMD) -JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD) BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA ################################################################################ @@ -166,7 +163,6 @@ TAIL := tail TEE := tee TR := tr TOUCH := touch -UNIQ := uniq WC := wc XARGS := xargs ZIPEXE := zip @@ -177,7 +173,7 @@ HG := hg ULIMIT := ulimit ifeq ($(OPENJDK_BUILD_OS), windows) - CYGPATH := cygpath + PATHTOOL := cygpath endif ################################################################################ diff --git a/make/TestImage.gmk b/make/TestImage.gmk index 8511c5dc87f8d..36ba5ba400744 100644 --- a/make/TestImage.gmk +++ b/make/TestImage.gmk @@ -30,29 +30,15 @@ include MakeBase.gmk ############################################################################ -ifeq ($(call isTargetOs, windows), true) - FIXPATH_COPY := $(TEST_IMAGE_DIR)/bin/fixpath.exe - - $(FIXPATH_COPY): $(firstword $(FIXPATH)) - $(call install-file) - - FIXPATH_WORKSPACE_ROOT := $(call FixPath, $(WORKSPACE_ROOT)) - FIXPATH_OUTPUTDIR := $(call FixPath, $(OUTPUTDIR)) -else - FIXPATH_WORKSPACE_ROOT := $(WORKSPACE_ROOT) - FIXPATH_OUTPUTDIR := $(OUTPUTDIR) -endif - - BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties $(BUILD_INFO_PROPERTIES): $(call MakeTargetDir) $(ECHO) "# Build info properties for JDK tests" > $@ - $(ECHO) "build.workspace.root=$(FIXPATH_WORKSPACE_ROOT)" >> $@ - $(ECHO) "build.output.root=$(FIXPATH_OUTPUTDIR)" >> $@ + $(ECHO) "build.workspace.root=$(call FixPath, $(WORKSPACE_ROOT))" >> $@ + $(ECHO) "build.output.root=$(call FixPath, $(OUTPUTDIR))" >> $@ -prepare-test-image: $(FIXPATH_COPY) $(BUILD_INFO_PROPERTIES) +prepare-test-image: $(BUILD_INFO_PROPERTIES) $(call MakeDir, $(TEST_IMAGE_DIR)) $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4 index fb06fa5426a18..60b4097cba90e 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -70,27 +70,18 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], fi if test "x$OPENJDK_TARGET_OS" = "xwindows"; then - PATH_SEP=";" - EXE_SUFFIX=".exe" - BASIC_CHECK_PATHS_WINDOWS - else - PATH_SEP=":" - EXE_SUFFIX="" + BASIC_SETUP_PATHS_WINDOWS fi - AC_SUBST(PATH_SEP) - AC_SUBST(EXE_SUFFIX) # We get the top-level directory from the supporting wrappers. + BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source) + UTIL_FIXUP_PATH(TOPDIR) AC_MSG_CHECKING([for top-level directory]) AC_MSG_RESULT([$TOPDIR]) AC_SUBST(TOPDIR) - AC_SUBST(CONFIGURE_START_DIR) - - # We can only call UTIL_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. - UTIL_FIXUP_PATH(TOPDIR) - UTIL_FIXUP_PATH(CONFIGURE_START_DIR) if test "x$CUSTOM_ROOT" != x; then + BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root) UTIL_FIXUP_PATH(CUSTOM_ROOT) WORKSPACE_ROOT="${CUSTOM_ROOT}" else @@ -98,6 +89,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], fi AC_SUBST(WORKSPACE_ROOT) + UTIL_FIXUP_PATH(CONFIGURE_START_DIR) + AC_SUBST(CONFIGURE_START_DIR) + # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/make/autoconf @@ -234,9 +228,12 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], # if no Xcode installed, xcodebuild exits with 1 # if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0 if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then - # We need to use xcodebuild in the toolchain dir provided by the user, this will - # fall back on the stub binary in /usr/bin/xcodebuild - AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH]) + # We need to use xcodebuild in the toolchain dir provided by the user + UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH) + if test x$XCODEBUILD = x; then + # fall back on the stub binary in /usr/bin/xcodebuild + XCODEBUILD=/usr/bin/xcodebuild + fi else # this should result in SYSROOT being empty, unless --with-sysroot is provided # when only the command line tools are installed there are no SDKs, so headers @@ -306,6 +303,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], AC_MSG_RESULT([$SYSROOT]) AC_MSG_CHECKING([for toolchain path]) AC_MSG_RESULT([$TOOLCHAIN_PATH]) + AC_SUBST(TOOLCHAIN_PATH) AC_MSG_CHECKING([for extra path]) AC_MSG_RESULT([$EXTRA_PATH]) ]) @@ -380,6 +378,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], AC_MSG_CHECKING([what configuration name to use]) AC_MSG_RESULT([$CONF_NAME]) + BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output) UTIL_FIXUP_PATH(OUTPUTDIR) CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support" @@ -416,26 +415,16 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK], # df -l lists only local disks; if the given directory is not found then # a non-zero exit code is given if test "x$DF" = x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - # msys does not have df; use Windows "net use" instead. - IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:` - if test "x$IS_NETWORK_DISK" = x; then - $2 - else - $3 - fi - else - # No df here, say it's local - $2 - fi + # No df here, say it's local + $2 else # JDK-8189619 # df on AIX does not understand -l. On modern AIXes it understands "-T local" which # is the same. On older AIXes we just continue to live with a "not local build" warning. if test "x$OPENJDK_TARGET_OS" = xaix; then DF_LOCAL_ONLY_OPTION='-T local' - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - # In WSL, we can only build on a drvfs file system (that is, a mounted real Windows drive) + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then + # In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive) DF_LOCAL_ONLY_OPTION='-t drvfs' else DF_LOCAL_ONLY_OPTION='-l' diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4 index dd1cd3935c4cb..820d2f4924d9b 100644 --- a/make/autoconf/basic_tools.m4 +++ b/make/autoconf/basic_tools.m4 @@ -28,38 +28,37 @@ # but is used by much of the early bootstrap code. AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], [ - # Start with tools that do not need have cross compilation support - # and can be expected to be found in the default PATH. These tools are - # used by configure. - - # First are all the simple required tools. - UTIL_REQUIRE_PROGS(BASENAME, basename) + # Bootstrapping: These tools are needed by UTIL_LOOKUP_PROGS + AC_PATH_PROGS(BASENAME, basename) + UTIL_CHECK_NONEMPTY(BASENAME) + AC_PATH_PROGS(DIRNAME, dirname) + UTIL_CHECK_NONEMPTY(DIRNAME) + AC_PATH_PROGS(FILE, file) + UTIL_CHECK_NONEMPTY(FILE) + AC_PATH_PROGS(LDD, ldd) + + # First are all the fundamental required tools. UTIL_REQUIRE_PROGS(BASH, bash) UTIL_REQUIRE_PROGS(CAT, cat) UTIL_REQUIRE_PROGS(CHMOD, chmod) - UTIL_REQUIRE_PROGS(CMP, cmp) - UTIL_REQUIRE_PROGS(COMM, comm) UTIL_REQUIRE_PROGS(CP, cp) UTIL_REQUIRE_PROGS(CUT, cut) UTIL_REQUIRE_PROGS(DATE, date) - UTIL_REQUIRE_PROGS(DIFF, [gdiff diff]) - UTIL_REQUIRE_PROGS(DIRNAME, dirname) + UTIL_REQUIRE_PROGS(DIFF, gdiff diff) UTIL_REQUIRE_PROGS(ECHO, echo) UTIL_REQUIRE_PROGS(EXPR, expr) - UTIL_REQUIRE_PROGS(FILE, file) UTIL_REQUIRE_PROGS(FIND, find) - UTIL_REQUIRE_PROGS(HEAD, head) UTIL_REQUIRE_PROGS(GUNZIP, gunzip) UTIL_REQUIRE_PROGS(GZIP, pigz gzip) + UTIL_REQUIRE_PROGS(HEAD, head) UTIL_REQUIRE_PROGS(LN, ln) UTIL_REQUIRE_PROGS(LS, ls) # gmkdir is known to be safe for concurrent invocations with -p flag. - UTIL_REQUIRE_PROGS(MKDIR, [gmkdir mkdir]) + UTIL_REQUIRE_PROGS(MKDIR, gmkdir mkdir) UTIL_REQUIRE_PROGS(MKTEMP, mktemp) UTIL_REQUIRE_PROGS(MV, mv) - UTIL_REQUIRE_PROGS(AWK, [gawk nawk awk]) + UTIL_REQUIRE_PROGS(AWK, gawk nawk awk) UTIL_REQUIRE_PROGS(PRINTF, printf) - UTIL_REQUIRE_PROGS(READLINK, [greadlink readlink]) UTIL_REQUIRE_PROGS(RM, rm) UTIL_REQUIRE_PROGS(RMDIR, rmdir) UTIL_REQUIRE_PROGS(SH, sh) @@ -70,7 +69,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], UTIL_REQUIRE_PROGS(TOUCH, touch) UTIL_REQUIRE_PROGS(TR, tr) UTIL_REQUIRE_PROGS(UNAME, uname) - UTIL_REQUIRE_PROGS(UNIQ, uniq) UTIL_REQUIRE_PROGS(WC, wc) UTIL_REQUIRE_PROGS(XARGS, xargs) @@ -80,22 +78,22 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], UTIL_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP]) UTIL_REQUIRE_SPECIAL(SED, [AC_PROG_SED]) - # Always force rm. - RM="$RM -f" + # Optional tools, we can do without them + UTIL_LOOKUP_PROGS(DF, df) + UTIL_LOOKUP_PROGS(NICE, nice) + UTIL_LOOKUP_PROGS(READLINK, greadlink readlink) - # pwd behaves differently on various platforms and some don't support the -L flag. - # Always use the bash builtin pwd to get uniform behavior. - THEPWDCMD=pwd + # These are only needed on some platforms + UTIL_LOOKUP_PROGS(PATHTOOL, cygpath wslpath) + UTIL_LOOKUP_PROGS(LSB_RELEASE, lsb_release) + UTIL_LOOKUP_PROGS(CMD, cmd.exe, $PATH:/cygdrive/c/windows/system32:/mnt/c/windows/system32:/c/windows/system32) - # These are not required on all platforms - UTIL_PATH_PROGS(CYGPATH, cygpath) - UTIL_PATH_PROGS(WSLPATH, wslpath) - UTIL_PATH_PROGS(DF, df) - UTIL_PATH_PROGS(CPIO, [cpio bsdcpio]) - UTIL_PATH_PROGS(NICE, nice) + # For compare.sh only + UTIL_LOOKUP_PROGS(CMP, cmp) + UTIL_LOOKUP_PROGS(UNIQ, uniq) - UTIL_PATH_PROGS(LSB_RELEASE, lsb_release) - UTIL_PATH_PROGS(CMD, cmd.exe, $PATH /cygdrive/c/Windows/System32 /mnt/c/Windows/System32) + # Always force rm. + RM="$RM -f" ]) ############################################################################### @@ -130,10 +128,14 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION], if test "x$OPENJDK_BUILD_OS" = "xwindows"; then if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then MAKE_EXPECTED_ENV='cygwin' - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then MAKE_EXPECTED_ENV='msys' - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - MAKE_EXPECTED_ENV='x86_64-.*-linux-gnu' + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then + if test "x$OPENJDK_BUILD_CPU" = "xaarch64"; then + MAKE_EXPECTED_ENV='aarch64-.*-linux-gnu' + else + MAKE_EXPECTED_ENV='x86_64-.*-linux-gnu' + fi else AC_MSG_ERROR([Unknown Windows environment]) fi @@ -185,14 +187,14 @@ AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC], # Goes looking for a usable version of GNU make. AC_DEFUN([BASIC_CHECK_GNU_MAKE], [ - UTIL_SETUP_TOOL([MAKE], + UTIL_SETUP_TOOL(MAKE, [ # Try our hardest to locate a correct version of GNU make - AC_PATH_PROGS(CHECK_GMAKE, gmake) + UTIL_LOOKUP_PROGS(CHECK_GMAKE, gmake) BASIC_CHECK_MAKE_VERSION("$CHECK_GMAKE", [gmake in PATH]) if test "x$FOUND_MAKE" = x; then - AC_PATH_PROGS(CHECK_MAKE, make) + UTIL_LOOKUP_PROGS(CHECK_MAKE, make) BASIC_CHECK_MAKE_VERSION("$CHECK_MAKE", [make in PATH]) fi @@ -201,10 +203,10 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE], # We have a toolchain path, check that as well before giving up. OLD_PATH=$PATH PATH=$TOOLCHAIN_PATH:$PATH - AC_PATH_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) + UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_GMAKE, gmake) BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_GMAKE", [gmake in tools-dir]) if test "x$FOUND_MAKE" = x; then - AC_PATH_PROGS(CHECK_TOOLSDIR_MAKE, make) + UTIL_LOOKUP_PROGS(CHECK_TOOLSDIR_MAKE, make) BASIC_CHECK_MAKE_VERSION("$CHECK_TOOLSDIR_MAKE", [make in tools-dir]) fi PATH=$OLD_PATH @@ -334,24 +336,17 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], # Non-required basic tools - UTIL_PATH_PROGS(LDD, ldd) - if test "x$LDD" = "x"; then - # List shared lib dependencies is used for - # debug output and checking for forbidden dependencies. - # We can build without it. - LDD="true" - fi - UTIL_PATH_PROGS(READELF, [greadelf readelf]) - UTIL_PATH_PROGS(DOT, dot) - UTIL_PATH_PROGS(HG, hg) - UTIL_PATH_PROGS(GIT, git) - UTIL_PATH_PROGS(STAT, stat) - UTIL_PATH_PROGS(TIME, time) - UTIL_PATH_PROGS(FLOCK, flock) + UTIL_LOOKUP_PROGS(READELF, greadelf readelf) + UTIL_LOOKUP_PROGS(DOT, dot) + UTIL_LOOKUP_PROGS(HG, hg) + UTIL_LOOKUP_PROGS(GIT, git) + UTIL_LOOKUP_PROGS(STAT, stat) + UTIL_LOOKUP_PROGS(TIME, time) + UTIL_LOOKUP_PROGS(FLOCK, flock) # Dtrace is usually found in /usr/sbin, but that directory may not # be in the user path. - UTIL_PATH_PROGS(DTRACE, dtrace, $PATH:/usr/sbin) - UTIL_PATH_PROGS(PATCH, [gpatch patch]) + UTIL_LOOKUP_PROGS(DTRACE, dtrace, $PATH:/usr/sbin) + UTIL_LOOKUP_PROGS(PATCH, gpatch patch) # Check if it's GNU time IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'` if test "x$IS_GNU_TIME" != x; then @@ -365,7 +360,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], UTIL_REQUIRE_PROGS(DSYMUTIL, dsymutil) UTIL_REQUIRE_PROGS(MIG, mig) UTIL_REQUIRE_PROGS(XATTR, xattr) - UTIL_PATH_PROGS(CODESIGN, codesign) + UTIL_LOOKUP_PROGS(CODESIGN, codesign) if test "x$CODESIGN" != "x"; then # Check for user provided code signing identity. @@ -406,7 +401,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], UTIL_REQUIRE_PROGS(SETFILE, SetFile) fi if ! test "x$OPENJDK_TARGET_OS" = "xwindows"; then - UTIL_REQUIRE_BUILTIN_PROGS(ULIMIT, ulimit) + UTIL_REQUIRE_PROGS(ULIMIT, ulimit) fi ]) @@ -452,7 +447,7 @@ AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS], # AC_DEFUN_ONCE([BASIC_SETUP_PANDOC], [ - UTIL_PATH_PROGS(PANDOC, pandoc) + UTIL_LOOKUP_PROGS(PANDOC, pandoc) PANDOC_MARKDOWN_FLAG="markdown" if test -n "$PANDOC"; then diff --git a/make/autoconf/basic_windows.m4 b/make/autoconf/basic_windows.m4 index cadc53b6754d5..8681442fe612a 100644 --- a/make/autoconf/basic_windows.m4 +++ b/make/autoconf/basic_windows.m4 @@ -24,97 +24,160 @@ # # Setup basic configuration paths, and platform-specific stuff related to PATHs. -AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS], +AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS], [ - SRC_ROOT_LENGTH=`$THEPWDCMD -L|$WC -m` - if test $SRC_ROOT_LENGTH -gt 100; then - AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then + # Clarify if it is wsl1 or wsl2, and use that as OS_ENV from this point forward + $PATHTOOL -w / > /dev/null 2>&1 + if test $? -ne 0; then + # Without Windows access to our root, it's definitely WSL1 + OPENJDK_BUILD_OS_ENV=windows.wsl1 + else + # This test is not guaranteed, but there is no documented way of + # distinguishing between WSL1 and WSL2. Assume only WSL2 has WSL_INTEROP + # in /run/WSL + if test -d "/run/WSL" ; then + OPENJDK_BUILD_OS_ENV=windows.wsl2 + else + OPENJDK_BUILD_OS_ENV=windows.wsl1 + fi + fi + # This is a bit silly since we really don't have a target env as such, + # but do it to keep consistency. + OPENJDK_TARGET_OS_ENV=$OPENJDK_BUILD_OS_ENV fi + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then + # Must be done prior to calling any commands to avoid mangling of command line + export MSYS2_ARG_CONV_EXCL="*" + fi + + AC_MSG_CHECKING([Windows environment type]) + WINENV_VENDOR=${OPENJDK_BUILD_OS_ENV#windows.} + AC_MSG_RESULT([$WINENV_VENDOR]) + + if test "x$WINENV_VENDOR" = x; then + AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys2, wsl1 nor wsl2 was detected.]) + fi + + if test "x$PATHTOOL" = x; then + AC_MSG_ERROR([Incorrect $WINENV_VENDOR installation. Neither cygpath nor wslpath was found]) + fi + + if test "x$CMD" = x; then + AC_MSG_ERROR([Incorrect Windows/$WINENV_VENDOR setup. Could not locate cmd.exe]) + fi + + AC_MSG_CHECKING([$WINENV_VENDOR drive prefix]) + WINENV_PREFIX=`$PATHTOOL -u c:/ | $SED -e 's!/c/!!'` + AC_MSG_RESULT(['$WINENV_PREFIX']) + AC_SUBST(WINENV_PREFIX) + + AC_MSG_CHECKING([$WINENV_VENDOR root directory as Windows path]) + if test "x$OPENJDK_BUILD_OS_ENV" != "xwindows.wsl1"; then + WINENV_ROOT=`$PATHTOOL -w / 2> /dev/null` + # msys2 has a trailing backslash; strip it + WINENV_ROOT=${WINENV_ROOT%\\} + else + WINENV_ROOT='[[unavailable]]' + fi + AC_MSG_RESULT(['$WINENV_ROOT']) + AC_SUBST(WINENV_ROOT) + + AC_MSG_CHECKING([$WINENV_VENDOR temp directory]) + WINENV_TEMP_DIR=$($PATHTOOL -u $($CMD /q /c echo %TEMP% 2> /dev/null) | $TR -d '\r\n') + AC_MSG_RESULT([$WINENV_TEMP_DIR]) + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then + # Don't trust the current directory for WSL2, but change to an OK temp dir + cd "$WINENV_TEMP_DIR" + # Bring along confdefs.h or autoconf gets all confused + cp "$CONFIGURE_START_DIR/confdefs.h" "$WINENV_TEMP_DIR" + fi + + AC_MSG_CHECKING([$WINENV_VENDOR release]) + WINENV_UNAME_RELEASE=`$UNAME -r` + AC_MSG_RESULT([$WINENV_UNAME_RELEASE]) + + AC_MSG_CHECKING([$WINENV_VENDOR version]) + WINENV_UNAME_VERSION=`$UNAME -v` + AC_MSG_RESULT([$WINENV_UNAME_VERSION]) + + WINENV_VERSION="$WINENV_UNAME_RELEASE, $WINENV_UNAME_VERSION" + AC_MSG_CHECKING([Windows version]) + + # We must change directory to one guaranteed to work, otherwise WSL1 + # can complain (since it does not have a WINENV_ROOT so it can't access + # unix-style paths from Windows. # Additional [] needed to keep m4 from mangling shell constructs. - [ WINDOWS_VERSION=`$CMD /c ver.exe | $EGREP -o '([0-9]+\.)+[0-9]+'` ] + [ WINDOWS_VERSION=`cd $WINENV_TEMP_DIR && $CMD /c ver | $EGREP -o '([0-9]+\.)+[0-9]+'` ] AC_MSG_RESULT([$WINDOWS_VERSION]) + # Additional handling per specific env if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - AC_MSG_CHECKING([cygwin release]) - CYGWIN_RELEASE=`$UNAME -r` - AC_MSG_RESULT([$CYGWIN_RELEASE]) - - AC_MSG_CHECKING([cygwin version]) - CYGWIN_VERSION=`$UNAME -v` - AC_MSG_RESULT([$CYGWIN_VERSION]) - # Additional [] needed to keep m4 from mangling shell constructs. - [ CYGWIN_VERSION_OLD=`$ECHO $CYGWIN_RELEASE | $GREP -e '^1\.[0-6]'` ] + [ CYGWIN_VERSION_OLD=`$ECHO $WINENV_UNAME_RELEASE | $GREP -e '^1\.[0-6]'` ] if test "x$CYGWIN_VERSION_OLD" != x; then AC_MSG_NOTICE([Your cygwin is too old. You are running $CYGWIN_RELEASE, but at least cygwin 1.7 is required. Please upgrade.]) AC_MSG_ERROR([Cannot continue]) fi - - WINDOWS_ENV_VENDOR='cygwin' - WINDOWS_ENV_VERSION="$CYGWIN_RELEASE, $CYGWIN_VERSION" - - if test "x$CYGPATH" = x; then - AC_MSG_ERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) + if test "x$LDD" = x; then + AC_MSG_ERROR([ldd is missing, which is needed on cygwin]) fi - AC_MSG_CHECKING([cygwin root directory as unix-style path]) - # The cmd output ends with Windows line endings (CR/LF) - cygwin_winpath_root=`cd / ; cmd /c cd | $TR -d '\r\n'` - # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. - CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "` - AC_MSG_RESULT([$CYGWIN_ROOT_PATH]) - WINDOWS_ENV_ROOT_PATH="$CYGWIN_ROOT_PATH" - test_cygdrive_prefix=`$ECHO $CYGWIN_ROOT_PATH | $GREP ^/cygdrive/` - if test "x$test_cygdrive_prefix" = x; then - AC_MSG_ERROR([Your cygdrive prefix is not /cygdrive. This is currently not supported. Change with mount -c.]) + WINENV_MARKER_DLL=cygwin1.dll + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then + if test "x$LDD" = x; then + AC_MSG_ERROR([ldd is missing, which is needed on msys2]) fi - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - AC_MSG_CHECKING([msys release]) - MSYS_RELEASE=`$UNAME -r` - AC_MSG_RESULT([$MSYS_RELEASE]) - - AC_MSG_CHECKING([msys version]) - MSYS_VERSION=`$UNAME -v` - AC_MSG_RESULT([$MSYS_VERSION]) - - WINDOWS_ENV_VENDOR='msys' - WINDOWS_ENV_VERSION="$MSYS_RELEASE, $MSYS_VERSION" - - AC_MSG_CHECKING([msys root directory as unix-style path]) - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"` - UTIL_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH) - AC_MSG_RESULT([$MSYS_ROOT_PATH]) - WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - - AC_MSG_CHECKING([WSL kernel version]) - WSL_KERNEL_VERSION=`$UNAME -v` - AC_MSG_RESULT([$WSL_KERNEL_VERSION]) - - AC_MSG_CHECKING([WSL kernel release]) - WSL_KERNEL_RELEASE=`$UNAME -r` - AC_MSG_RESULT([$WSL_KERNEL_RELEASE]) - - AC_MSG_CHECKING([WSL distribution]) + WINENV_MARKER_DLL=msys-2.0.dll + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then + AC_MSG_CHECKING([wsl distribution]) WSL_DISTRIBUTION=`$LSB_RELEASE -d | sed 's/Description:\t//'` AC_MSG_RESULT([$WSL_DISTRIBUTION]) - WINDOWS_ENV_VENDOR='wsl' - WINDOWS_ENV_VERSION="$WSL_KERNEL_RELEASE, $WSL_KERNEL_VERSION ($WSL_DISTRIBUTION)" + WINENV_VERSION="$WINENV_VERSION ($WSL_DISTRIBUTION)" + + # Tell WSL to automatically translate the PATH variable + export WSLENV=PATH/l + fi + + # Chicken and egg: FIXPATH is needed for UTIL_FIXUP_PATH to work. So for the + # first run we use the auto-detect abilities of fixpath.sh. + FIXPATH_DIR="$TOPDIR/make/scripts" + FIXPATH="$BASH $FIXPATH_DIR/fixpath.sh exec" + FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh" + FIXPATH_SAVED_PATH="$PATH" + UTIL_FIXUP_PATH(FIXPATH_DIR) + + # Now we can use FIXPATH_DIR to rewrite path to fixpath.sh properly. + if test "x$WINENV_PREFIX" = x; then + # On msys the prefix is empty, but we need to pass something to have the + # fixpath.sh options parser happy. + WINENV_PREFIX_ARG="NONE" else - AC_MSG_ERROR([Unknown Windows environment. Neither cygwin, msys, nor wsl was detected.]) + WINENV_PREFIX_ARG="$WINENV_PREFIX" fi + FIXPATH_ARGS="-e $PATHTOOL -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR -c $CMD -q" + FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh $FIXPATH_ARGS" + FIXPATH="$FIXPATH_BASE exec" - # Test if windows or unix (cygwin/msys) find is first in path. + AC_SUBST(FIXPATH_BASE) + AC_SUBST(FIXPATH) + + SRC_ROOT_LENGTH=`$ECHO "$TOPDIR" | $WC -m` + if test $SRC_ROOT_LENGTH -gt 100; then + AC_MSG_ERROR([Your base path is too long. It is $SRC_ROOT_LENGTH characters long, but only 100 is supported]) + fi + + # Test if windows or unix "find" is first in path. AC_MSG_CHECKING([what kind of 'find' is first on the PATH]) FIND_BINARY_OUTPUT=`find --version 2>&1` if test "x`echo $FIND_BINARY_OUTPUT | $GREP GNU`" != x; then AC_MSG_RESULT([unix style]) elif test "x`echo $FIND_BINARY_OUTPUT | $GREP FIND`" != x; then AC_MSG_RESULT([Windows]) - AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix (cygwin or msys) tools.]) + AC_MSG_NOTICE([Your path contains Windows tools (C:\Windows\system32) before your unix tools.]) AC_MSG_NOTICE([This will not work. Please correct and make sure /usr/bin (or similar) is first in path.]) AC_MSG_ERROR([Cannot continue]) else @@ -123,73 +186,39 @@ AC_DEFUN([BASIC_CHECK_PATHS_WINDOWS], fi ]) -AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH], +# Verify that the directory is usable on Windows +AC_DEFUN([BASIC_WINDOWS_VERIFY_DIR], [ - # When using cygwin or msys, we need a wrapper binary that renames - # /cygdrive/c/ arguments into c:/ arguments and peeks into - # @files and rewrites these too! This wrapper binary is - # called fixpath. - FIXPATH= - if test "x$OPENJDK_BUILD_OS" = xwindows; then - AC_MSG_CHECKING([if fixpath can be created]) - FIXPATH_SRC="$TOPDIR/make/src/native/fixpath.c" - FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe" - FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath" - if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then - # Important to keep the .exe suffix on Cygwin for Hotspot makefiles - FIXPATH="$FIXPATH_BIN -c" - elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then - # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line - # @ was chosen as separator to minimize risk of other tools messing around with it - all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \ - | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ` - fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'` - FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list" - elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.wsl; then - FIXPATH="$FIXPATH_BIN -w" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then + OUTPUTDIR_WIN=`$FIXPATH_BASE print $1` + if test "x$OUTPUTDIR_WIN" = x; then + AC_MSG_NOTICE([For wsl1, the $2 dir must be located on a Windows drive. Please see doc/building.md for details.]) + AC_MSG_ERROR([Cannot continue]) fi - FIXPATH_SRC_W="$FIXPATH_SRC" - FIXPATH_BIN_W="$FIXPATH_BIN" - $RM -rf $FIXPATH_BIN $FIXPATH_DIR - $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W]) - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W]) - cd $FIXPATH_DIR - $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1 - cd $CONFIGURE_START_DIR + fi +]) - if test ! -x $FIXPATH_BIN; then - AC_MSG_RESULT([no]) - cat $FIXPATH_DIR/fixpath1.log - AC_MSG_ERROR([Could not create $FIXPATH_BIN]) - fi - AC_MSG_RESULT([yes]) - - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - OLD_WSLENV="$WSLENV" - WSLENV=`$ECHO $WSLENV | $SED 's/PATH\/l://'` - UTIL_APPEND_TO_PATH(WSLENV, "FIXPATH_PATH") - export WSLENV - export FIXPATH_PATH=$VS_PATH_WINDOWS - AC_MSG_NOTICE([FIXPATH_PATH is $FIXPATH_PATH]) - AC_MSG_NOTICE([Rewriting WSLENV from $OLD_WSLENV to $WSLENV]) - fi +# Create fixpath wrapper +AC_DEFUN([BASIC_WINDOWS_FINALIZE_FIXPATH], +[ + if test "x$OPENJDK_BUILD_OS" = xwindows; then + FIXPATH_CMDLINE=". $TOPDIR/make/scripts/fixpath.sh -e $PATHTOOL \ + -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR \ + -c $CMD -q" + $ECHO > $OUTPUTDIR/fixpath '#!/bin/bash' + $ECHO >> $OUTPUTDIR/fixpath export PATH='"[$]PATH:'$PATH'"' + $ECHO >> $OUTPUTDIR/fixpath $FIXPATH_CMDLINE '"[$]@"' + $CHMOD +x $OUTPUTDIR/fixpath + FIXPATH_BASE="$OUTPUTDIR/fixpath" + FIXPATH="$FIXPATH_BASE exec" + fi +]) - AC_MSG_CHECKING([if fixpath.exe works]) - cd $FIXPATH_DIR - $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \ - > $FIXPATH_DIR/fixpath2.log 2>&1 +# Platform-specific finalization +AC_DEFUN([BASIC_WINDOWS_FINALIZE], +[ + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then + # Change back from temp dir cd $CONFIGURE_START_DIR - if test ! -x $FIXPATH_DIR/fixpath2.exe; then - AC_MSG_RESULT([no]) - cat $FIXPATH_DIR/fixpath2.log - AC_MSG_ERROR([fixpath did not work!]) - fi - AC_MSG_RESULT([yes]) - - FIXPATH_DETACH_FLAG="--detach" fi - - AC_SUBST(FIXPATH) - AC_SUBST(FIXPATH_DETACH_FLAG) ]) diff --git a/make/autoconf/boot-jdk.m4 b/make/autoconf/boot-jdk.m4 index c78b4432f2a87..a7a9f1aba2832 100644 --- a/make/autoconf/boot-jdk.m4 +++ b/make/autoconf/boot-jdk.m4 @@ -63,19 +63,23 @@ AC_DEFUN([BOOTJDK_DO_CHECK], # If previous step claimed to have found a JDK, check it to see if it seems to be valid. if test "x$BOOT_JDK_FOUND" = xmaybe; then # Do we have a bin/java? - if test ! -x "$BOOT_JDK/bin/java$EXE_SUFFIX"; then + if test ! -x "$BOOT_JDK/bin/java" && test ! -x "$BOOT_JDK/bin/java.exe"; then AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring]) BOOT_JDK_FOUND=no else # Do we have a bin/javac? - if test ! -x "$BOOT_JDK/bin/javac$EXE_SUFFIX"; then + if test ! -x "$BOOT_JDK/bin/javac" && test ! -x "$BOOT_JDK/bin/javac.exe"; then AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring]) AC_MSG_NOTICE([(This might be an JRE instead of an JDK)]) BOOT_JDK_FOUND=no else # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version? + java_to_test="$BOOT_JDK/bin/java" + UTIL_FIXUP_EXECUTABLE(java_to_test) + BOOT_JDK_VERSION_OUTPUT=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1` # Additional [] needed to keep m4 from mangling shell constructs. - [ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ] + [ BOOT_JDK_VERSION=`echo $BOOT_JDK_VERSION_OUTPUT | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ] + if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.]) AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".]) @@ -91,7 +95,12 @@ AC_DEFUN([BOOTJDK_DO_CHECK], # Extra M4 quote needed to protect [] in grep expression. [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \ | $EGREP "\"(${DEFAULT_ACCEPTABLE_BOOT_VERSIONS// /|})([\.+-].*)?\""`] - if test "x$FOUND_CORRECT_VERSION" = x; then + + if test "x$BOOT_JDK_VERSION" = x; then + AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is not a working JDK; ignoring]) + AC_MSG_NOTICE([Output from java -version was: $BOOT_JDK_VERSION_OUTPUT]) + BOOT_JDK_FOUND=no + elif test "x$FOUND_CORRECT_VERSION" = x; then AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring]) AC_MSG_NOTICE([(Your Boot JDK version must be one of: $DEFAULT_ACCEPTABLE_BOOT_VERSIONS)]) BOOT_JDK_FOUND=no @@ -102,7 +111,9 @@ AC_DEFUN([BOOTJDK_DO_CHECK], AC_MSG_CHECKING([for Boot JDK]) AC_MSG_RESULT([$BOOT_JDK]) AC_MSG_CHECKING([Boot JDK version]) - BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' ' '` + BOOT_JDK_VERSION=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR -d '\r'` + # This is not a no-op; it will portably convert newline to space + BOOT_JDK_VERSION=`$ECHO $BOOT_JDK_VERSION` AC_MSG_RESULT([$BOOT_JDK_VERSION]) fi # end check jdk version fi # end check javac @@ -151,8 +162,8 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME], [ if test "x$JAVA_HOME" != x; then JAVA_HOME_PROCESSED="$JAVA_HOME" - UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED) - if test ! -d "$JAVA_HOME_PROCESSED"; then + UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED, NOFAIL) + if test "x$JAVA_HOME_PROCESSED" = x || test ! -d "$JAVA_HOME_PROCESSED"; then AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!]) else # Aha, the user has set a JAVA_HOME @@ -167,8 +178,8 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME], # Test: Is there a java or javac in the PATH, which is a symlink to the JDK? AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK], [ - AC_PATH_PROG(JAVAC_CHECK, javac) - AC_PATH_PROG(JAVA_CHECK, java) + UTIL_LOOKUP_PROGS(JAVAC_CHECK, javac, , NOFIXPATH) + UTIL_LOOKUP_PROGS(JAVA_CHECK, java, , NOFIXPATH) BINARY="$JAVAC_CHECK" if test "x$JAVAC_CHECK" = x; then BINARY="$JAVA_CHECK" @@ -207,9 +218,9 @@ AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR], # First check at user selected default BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()]) # If that did not work out (e.g. too old), try explicit versions instead - BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])]) - BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])]) - BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])]) + for ver in $DEFAULT_ACCEPTABLE_BOOT_VERSIONS ; do + BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v $ver])]) + done fi ]) @@ -242,8 +253,10 @@ AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY], [ if test "x[$]$1" != x; then VIRTUAL_DIR="[$]$1/Java" - UTIL_REWRITE_AS_UNIX_PATH(VIRTUAL_DIR) - BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR) + UTIL_FIXUP_PATH(VIRTUAL_DIR, NOFAIL) + if test "x$VIRTUAL_DIR" != x; then + BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR) + fi fi ]) @@ -270,16 +283,17 @@ 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. - UTIL_SETUP_TOOL($1, + UTIL_REQUIRE_SPECIAL($1, [ - AC_MSG_CHECKING([for $2 in Boot JDK]) + AC_MSG_CHECKING([for $2 [[Boot JDK]]]) $1=$BOOT_JDK/bin/$2 - if test ! -x [$]$1; then + if test ! -x [$]$1 && test ! -x [$]$1.exe; then AC_MSG_RESULT(not found) AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk]) AC_MSG_ERROR([Could not find $2 in the Boot JDK]) fi - AC_MSG_RESULT(ok) + AC_MSG_RESULT(\[$]BOOT_JDK/bin/$2) + UTIL_FIXUP_EXECUTABLE($1) AC_SUBST($1) ]) ]) @@ -313,12 +327,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK]) fi - # Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home? - BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR]) - # Test: Is $JAVA_HOME set? BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME]) + # Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home? + BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR]) + # Test: Is there a java or javac in the PATH, which is a symlink to the JDK? BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK]) @@ -336,11 +350,10 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], AC_SUBST(BOOT_JDK) # Setup tools from the Boot JDK. - BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java$EXE_SUFFIX) - BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac$EXE_SUFFIX) - BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc$EXE_SUFFIX) - BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar$EXE_SUFFIX) - BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner$EXE_SUFFIX) + BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java) + BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac) + BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc) + BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar) # Finally, set some other options... @@ -353,7 +366,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], AC_SUBST(BOOT_JDK_SOURCETARGET) # Check if the boot jdk is 32 or 64 bit - if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then + if $JAVA -version 2>&1 | $GREP -q "64-Bit"; then BOOT_JDK_BITS="64" else BOOT_JDK_BITS="32" @@ -368,7 +381,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], if test "x$boot_jdk_cds_args" != x; then # Try creating a CDS archive - "$JAVA" $boot_jdk_cds_args -Xshare:dump > /dev/null 2>&1 + $JAVA $boot_jdk_cds_args -Xshare:dump > /dev/null 2>&1 if test $? -eq 0; then BOOTJDK_USE_LOCAL_CDS=true AC_MSG_RESULT([yes, created]) @@ -574,8 +587,12 @@ AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK], fi fi + # Since these tools do not yet exist, we cannot use UTIL_FIXUP_EXECUTABLE to + # detect the need of fixpath JMOD="$BUILD_JDK/bin/jmod" + UTIL_ADD_FIXPATH(JMOD) JLINK="$BUILD_JDK/bin/jlink" + UTIL_ADD_FIXPATH(JLINK) AC_SUBST(JMOD) AC_SUBST(JLINK) diff --git a/make/autoconf/bootcycle-spec.gmk.in b/make/autoconf/bootcycle-spec.gmk.in index 590a9170c6c86..d46621fd891c8 100644 --- a/make/autoconf/bootcycle-spec.gmk.in +++ b/make/autoconf/bootcycle-spec.gmk.in @@ -28,14 +28,6 @@ # First include the real base spec.gmk file include @SPEC@ -# Check that the user did not try to specify a different java to use for compiling. -# On windows we need to account for fixpath being first word. -ifeq ($(firstword $(JAVA)),$(FIXPATH)) - JAVA_EXEC_POS=2 -else - JAVA_EXEC_POS=1 -endif - # Override specific values to do a boot cycle build # Use a different Boot JDK @@ -47,10 +39,9 @@ OUTPUTDIR:=$(OLD_OUTPUTDIR)/bootcycle-build # No spaces in patsubst to avoid leading space in variable JAVAC_SERVER_DIR:=$(patsubst $(OLD_OUTPUTDIR)%,$(OUTPUTDIR)%,$(JAVAC_SERVER_DIR)) -JAVA_CMD:=$(BOOT_JDK)/bin/java -JAVAC_CMD:=$(BOOT_JDK)/bin/javac -JAR_CMD:=$(BOOT_JDK)/bin/jar -JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner +JAVA_CMD := $(FIXPATH) $(BOOT_JDK)/bin/java +JAVAC_CMD := $(FIXPATH) $(BOOT_JDK)/bin/javac +JAR_CMD := $(FIXPATH) $(BOOT_JDK)/bin/jar # The bootcycle JVM arguments may differ from the original boot jdk. JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@ # Any CDS settings generated for the bootjdk are invalid in the bootcycle build. @@ -58,5 +49,3 @@ JAVA_FLAGS_BIG := @BOOTCYCLE_JVM_ARGS_BIG@ # settings for CDS. JAVA_FLAGS := $(filter-out -XX:SharedArchiveFile% -Xshare%, $(JAVA_FLAGS)) -# Pandoc cannot be used without the jjs plugin, which was removed with Nashorn. -ENABLE_PANDOC := false diff --git a/make/autoconf/build-aux/config.guess b/make/autoconf/build-aux/config.guess index 14f21a25e8fd7..916a464142b53 100644 --- a/make/autoconf/build-aux/config.guess +++ b/make/autoconf/build-aux/config.guess @@ -56,11 +56,11 @@ if test $? = 0; then fi # Test and fix wsl -echo $OUT | grep x86_64-unknown-linux-gnu > /dev/null 2> /dev/null +echo $OUT | grep unknown-linux-gnu > /dev/null 2> /dev/null if test $? = 0; then uname -r | grep -i microsoft > /dev/null 2> /dev/null if test $? = 0; then - OUT="x86_64-pc-wsl" + OUT=`echo $OUT | sed -e 's/unknown-linux-gnu/pc-wsl/'` fi fi diff --git a/make/autoconf/build-aux/config.sub b/make/autoconf/build-aux/config.sub index d0dd001abdf54..8f5a5cf524492 100644 --- a/make/autoconf/build-aux/config.sub +++ b/make/autoconf/build-aux/config.sub @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2020, 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 @@ -35,7 +35,13 @@ if echo $* | grep linux-musl >/dev/null ; then fi # Allow wsl -if echo $* | grep x86_64-pc-wsl >/dev/null ; then +if echo $* | grep pc-wsl >/dev/null ; then + echo $* + exit +fi + +# Allow msys2 +if echo $* | grep pc-msys >/dev/null ; then echo $* exit fi @@ -49,7 +55,7 @@ if ! echo $* | grep '^aarch64-' >/dev/null ; then fi while test $# -gt 0 ; do - case $1 in + case $1 in -- ) # Stop option processing shift; break ;; aarch64-* ) diff --git a/make/autoconf/build-performance.m4 b/make/autoconf/build-performance.m4 index 065b3027d6f07..52d143e5ab989 100644 --- a/make/autoconf/build-performance.m4 +++ b/make/autoconf/build-performance.m4 @@ -175,7 +175,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE], if test "x$TOOLCHAIN_PATH" != x; then PATH=$TOOLCHAIN_PATH:$PATH fi - UTIL_PATH_PROGS(CCACHE, ccache) + UTIL_LOOKUP_PROGS(CCACHE, ccache) PATH="$OLD_PATH" AC_MSG_CHECKING([if ccache is available]) diff --git a/make/autoconf/compare.sh.in b/make/autoconf/compare.sh.in index e5f5ba679a1b8..1c48f800c8a34 100644 --- a/make/autoconf/compare.sh.in +++ b/make/autoconf/compare.sh.in @@ -43,7 +43,7 @@ export CMP="@CMP@" export CP="@CP@" export CUT="@CUT@" export DIFF="@DIFF@" -export DUMPBIN="@FIXPATH@ @DUMPBIN@" +export DUMPBIN="@DUMPBIN@" export EXPR="@EXPR@" export FILE="@FILE@" export FIND="@FIND@" @@ -86,12 +86,10 @@ else fi if [ "$OPENJDK_TARGET_OS" = "windows" ]; then - if [ "$OPENJDK_BUILD_OS_ENV" = "windows.wsl" ]; then - export FIXPATH_PATH="@VS_PATH_WINDOWS@" - export WSLENV="$WSLENV:FIXPATH_PATH:DEBUG_FIXPATH" - else - export PATH="@VS_PATH@" + if [[ $OPENJDK_BUILD_OS_ENV =~ ^windows.wsl ]]; then + export WSLENV=PATH/l fi + export PATH="$PATH:@TOOLCHAIN_PATH@" fi export HOTSPOT_BUILD_TIME="@HOTSPOT_BUILD_TIME@" diff --git a/make/autoconf/configure.ac b/make/autoconf/configure.ac index 695dd57f2085f..a2fe84a1fb2bc 100644 --- a/make/autoconf/configure.ac +++ b/make/autoconf/configure.ac @@ -106,6 +106,8 @@ BASIC_SETUP_DEVKIT # To properly create a configuration name, we need to have the OpenJDK target # and options (variants and debug level) parsed. BASIC_SETUP_OUTPUT_DIR +# After we have the output dir we can finalize the fixpath wrapper +BASIC_WINDOWS_FINALIZE_FIXPATH # Must be done before we can call HELP_MSG_MISSING_DEPENDENCY. HELP_SETUP_DEPENDENCY_HELP @@ -220,9 +222,6 @@ JDKOPT_SETUP_ADDRESS_SANITIZER # ############################################################################### -# After we have toolchain, we can compile fixpath. It's needed by the lib checks. -BASIC_COMPILE_FIXPATH - LIB_DETERMINE_DEPENDENCIES LIB_SETUP_LIBRARIES @@ -294,6 +293,7 @@ BASIC_CHECK_LEFTOVER_OVERRIDDEN CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status" # Create the actual output files. Now the main work of configure is done. +BASIC_WINDOWS_FINALIZE AC_OUTPUT # After AC_OUTPUT, we need to do final work diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 385828e3bb293..2cddaad65c647 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -130,6 +130,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], case "${TOOLCHAIN_TYPE}" in microsoft) DISABLE_WARNING_PREFIX="-wd" + BUILD_CC_DISABLE_WARNING_PREFIX="-wd" CFLAGS_WARNINGS_ARE_ERRORS="-WX" WARNINGS_ENABLE_ALL="-W3" @@ -142,6 +143,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], gcc) DISABLE_WARNING_PREFIX="-Wno-" + BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-" CFLAGS_WARNINGS_ARE_ERRORS="-Werror" # Additional warnings that are not activated by -Wall and -Wextra @@ -153,7 +155,6 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX" DISABLED_WARNINGS="unused-parameter unused" - BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-" ;; clang) @@ -784,8 +785,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then # There is a known issue with the pathmap if the mapping is made to the # empty string. Add a minimal string "s" as prefix to work around this. - workspace_root_win="${WORKSPACE_ROOT%/}" - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([workspace_root_win]) + workspace_root_win=`$FIXPATH_BASE print "${WORKSPACE_ROOT%/}"` # PATHMAP_FLAGS is also added to LDFLAGS in flags-ldflags.m4. PATHMAP_FLAGS="-pathmap:${workspace_root_win//\//\\\\}=s \ -pathmap:${workspace_root_win}=s" diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index ed6726b1e2af9..1f57577a2e8eb 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -195,7 +195,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP], # JVM_VARIANT_PATH depends on if this is build or target... if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - $1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base" + $1_LDFLAGS_JDK_LIBPATH="-libpath:\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base" else $1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \ -L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}" diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4 index 0301e64dc1711..ddd6118830617 100644 --- a/make/autoconf/flags.m4 +++ b/make/autoconf/flags.m4 @@ -226,6 +226,14 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS], fi fi + # For the microsoft toolchain, we need to get the SYSROOT flags from the + # Visual Studio environment. Currently we cannot handle this as a separate + # build toolchain. + if test "x$1" = x && test "x$OPENJDK_BUILD_OS" = "xwindows" \ + && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then + TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV + fi + AC_SUBST($1SYSROOT_CFLAGS) AC_SUBST($1SYSROOT_LDFLAGS) ]) @@ -234,6 +242,7 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN], [ # We should always include user supplied flags FLAGS_SETUP_USER_SUPPLIED_FLAGS + # The sysroot flags are needed for configure to be able to run the compilers FLAGS_SETUP_SYSROOT_FLAGS @@ -258,10 +267,6 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN], GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS" # FIXME: Don't really know how to do with this, but this was the old behavior GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS" - AC_SUBST(GLOBAL_CFLAGS) - AC_SUBST(GLOBAL_CXXFLAGS) - AC_SUBST(GLOBAL_LDFLAGS) - AC_SUBST(GLOBAL_CPPFLAGS) # FIXME: For compatilibity, export this as EXTRA_CFLAGS for now. EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS" @@ -280,6 +285,14 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN], CXXFLAGS="$GLOBAL_CXXFLAGS" LDFLAGS="$GLOBAL_LDFLAGS" CPPFLAGS="$GLOBAL_CPPFLAGS" + + if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then + # When autoconf sends both compiler and linker flags to cl.exe at the same + # time, linker flags must be last at the command line. Achieve this by + # moving them to LIBS. + LIBS="$LIBS -link $LDFLAGS" + LDFLAGS="" + fi ]) AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL], @@ -370,9 +383,6 @@ AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN], BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" fi fi - AC_SUBST(BUILD_SYSROOT_CFLAGS) - AC_SUBST(BUILD_SYSROOT_LDFLAGS) - ]) AC_DEFUN([FLAGS_SETUP_FLAGS], diff --git a/make/autoconf/help.m4 b/make/autoconf/help.m4 index d2966579ab1fd..7de6398bbd6e0 100644 --- a/make/autoconf/help.m4 +++ b/make/autoconf/help.m4 @@ -25,7 +25,7 @@ AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP], [ - AC_CHECK_PROGS(PKGHANDLER, zypper apt-get yum brew port pkgutil pkgadd) + UTIL_LOOKUP_PROGS(PKGHANDLER, zypper apt-get yum brew port pkgutil pkgadd pacman) ]) AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY], @@ -38,8 +38,6 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY], HELP_MSG="OpenJDK distributions are available at http://jdk.java.net/." elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then cygwin_help $MISSING_DEPENDENCY - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - msys_help $MISSING_DEPENDENCY else PKGHANDLER_COMMAND= @@ -58,6 +56,8 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY], pkgadd_help $MISSING_DEPENDENCY ;; zypper) zypper_help $MISSING_DEPENDENCY ;; + pacman) + pacman_help $MISSING_DEPENDENCY ;; esac if test "x$PKGHANDLER_COMMAND" != x; then @@ -83,10 +83,6 @@ cygwin_help() { esac } -msys_help() { - PKGHANDLER_COMMAND="" -} - apt_help() { case $1 in reduced) @@ -165,6 +161,17 @@ brew_help() { esac } +pacman_help() { + case $1 in + unzip) + PKGHANDLER_COMMAND="sudo pacman -S unzip" ;; + zip) + PKGHANDLER_COMMAND="sudo pacman -S zip" ;; + make) + PKGHANDLER_COMMAND="sudo pacman -S make" ;; + esac +} + port_help() { PKGHANDLER_COMMAND="" } @@ -257,16 +264,13 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS], printf "\n" printf "Tools summary:\n" if test "x$OPENJDK_BUILD_OS" = "xwindows"; then - printf "* Environment: $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION. Windows version $WINDOWS_VERSION" - if test "x$WINDOWS_ENV_ROOT_PATH" != "x"; then - printf ". Root at $WINDOWS_ENV_ROOT_PATH" - fi - printf "\n" + printf "* Environment: %s version %s; windows version %s; prefix \"%s\"; root \"%s\"\n" \ + "$WINENV_VENDOR" "$WINENV_VERSION" "$WINDOWS_VERSION" "$WINENV_PREFIX" "$WINENV_ROOT" fi printf "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)\n" printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n" - printf "* C Compiler: Version $CC_VERSION_NUMBER (at $CC)\n" - printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at $CXX)\n" + printf "* C Compiler: Version $CC_VERSION_NUMBER (at ${CC#"$FIXPATH "})\n" + printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at ${CXX#"$FIXPATH "})\n" printf "\n" printf "Build performance summary:\n" diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index a112a78d624bc..c87522ffa2eb9 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -388,9 +388,9 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], UTIL_FIXUP_PATH(JCOV_HOME) if test "x$with_jcov_input_jdk" != "x" ; then JCOV_INPUT_JDK="$with_jcov_input_jdk" - if test ! -f "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX"; then + if test ! -f "$JCOV_INPUT_JDK/bin/java" && test ! -f "$JCOV_INPUT_JDK/bin/java.exe"; then AC_MSG_RESULT([fail]) - AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX" does not exist]) + AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java" does not exist]) fi UTIL_FIXUP_PATH(JCOV_INPUT_JDK) fi @@ -664,10 +664,27 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_REPRODUCIBLE_BUILD], fi fi - UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $with_source_date_present, + REPRODUCIBLE_BUILD_DEFAULT=$with_source_date_present + + if test "x$OPENJDK_BUILD_OS" = xwindows && \ + test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse; then + # To support banning absolute paths on Windows, we must use the -pathmap + # method, which requires reproducible builds. + REPRODUCIBLE_BUILD_DEFAULT=true + fi + + UTIL_ARG_ENABLE(NAME: reproducible-build, DEFAULT: $REPRODUCIBLE_BUILD_DEFAULT, RESULT: ENABLE_REPRODUCIBLE_BUILD, DESC: [enable reproducible builds (not yet fully functional)], - DEFAULT_DESC: [enabled if --with-source-date is given]) + DEFAULT_DESC: [enabled if --with-source-date is given or on Windows without absolute paths]) + + if test "x$OPENJDK_BUILD_OS" = xwindows && \ + test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = xfalse && \ + test "x$ENABLE_REPRODUCIBLE_BUILD" = xfalse; then + AC_MSG_NOTICE([On Windows it is not possible to combine --disable-reproducible-builds]) + AC_MSG_NOTICE([with --disable-absolute-paths-in-output.]) + AC_MSG_ERROR([Cannot continue]) + fi AC_SUBST(SOURCE_DATE) AC_SUBST(ENABLE_REPRODUCIBLE_BUILD) diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4 index 2f39d2b0ca7c7..1890491773bf2 100644 --- a/make/autoconf/platform.m4 +++ b/make/autoconf/platform.m4 @@ -206,9 +206,9 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], VAR_OS=windows VAR_OS_ENV=windows.wsl ;; - *mingw*) + *msys*) VAR_OS=windows - VAR_OS_ENV=windows.msys + VAR_OS_ENV=windows.msys2 ;; *aix*) VAR_OS=aix diff --git a/make/autoconf/source-dirs.m4 b/make/autoconf/source-dirs.m4 index 8ac7c542cabfa..ea7d583fba2d9 100644 --- a/make/autoconf/source-dirs.m4 +++ b/make/autoconf/source-dirs.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2020, 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,9 +28,6 @@ AC_DEFUN_ONCE([SRCDIRS_SETUP_DIRS], OUTPUTDIR="$OUTPUTDIR" AC_SUBST(OUTPUTDIR) JDK_OUTPUTDIR="$OUTPUTDIR/jdk" - - # Where are the sources. - AC_SUBST(TOPDIR) ]) ################################################################################ diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index a1a574464351d..9e0d03e6f6cc9 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -131,20 +131,24 @@ ENABLE_REPRODUCIBLE_BUILD := @ENABLE_REPRODUCIBLE_BUILD@ LIBM:=@LIBM@ LIBDL:=@LIBDL@ -# colon or semicolon -PATH_SEP:=@PATH_SEP@ +WINENV_ROOT := @WINENV_ROOT@ +WINENV_PREFIX := @WINENV_PREFIX@ + +ifneq ($(findstring windows.wsl, @OPENJDK_BUILD_OS_ENV@), ) + # Tell WSL to convert PATH between linux and windows + export WSLENV := PATH/l +else ifeq (@OPENJDK_BUILD_OS_ENV@, windows.msys2) + # Prohibit msys2 from attemping any path wrangling + export MSYS2_ARG_CONV_EXCL := "*" +endif # Save the original path before replacing it with the Visual Studio tools -ORIGINAL_PATH:=@ORIGINAL_PATH@ -ifeq ($(OPENJDK_TARGET_OS), windows) - # On Windows, the Visual Studio toolchain needs the PATH to be adjusted - # to include Visual Studio tools (this needs to be in cygwin/msys style). - ifeq ($(OPENJDK_TARGET_OS_ENV), windows.wsl) - export FIXPATH_PATH:=@VS_PATH_WINDOWS@ - export WSLENV:=$(WSLENV):FIXPATH_PATH:DEBUG_FIXPATH - else - export PATH:=@VS_PATH@ - endif +ORIGINAL_PATH := @ORIGINAL_PATH@ + +ifeq (@TOOLCHAIN_TYPE@, microsoft) + # The Visual Studio toolchain needs the PATH to be adjusted to include + # Visual Studio tools. + export PATH := @TOOLCHAIN_PATH@:$(PATH) endif SYSROOT_CFLAGS := @SYSROOT_CFLAGS@ @@ -488,7 +492,7 @@ ADLC_LANGSTD_CXXFLAGS=@ADLC_LANGSTD_CXXFLAGS@ ADLC_LDFLAGS=@ADLC_LDFLAGS@ # Tools that potentially need to be cross compilation aware. -CC:=@FIXPATH@ @CCACHE@ @ICECC@ @CC@ +CC := @CCACHE@ @ICECC@ @CC@ # CFLAGS used to compile the jdk native libraries (C-code) CFLAGS_JDKLIB:=@CFLAGS_JDKLIB@ @@ -510,12 +514,12 @@ EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@ EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ EXTRA_ASFLAGS = @EXTRA_ASFLAGS@ -CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@ +CXX := @CCACHE@ @ICECC@ @CXX@ -CPP:=@FIXPATH@ @CPP@ +CPP := @CPP@ # The linker can be gcc or ld on unix systems, or link.exe on windows systems. -LD:=@FIXPATH@ @LD@ +LD := @LD@ # Linker used by the jaotc tool for AOT compilation. LD_JAOTC:=@LD_JAOTC@ @@ -535,7 +539,7 @@ JDKEXE_LIBS:=@JDKEXE_LIBS@ LDFLAGS_CXX_JDK:=@LDFLAGS_CXX_JDK@ # Sometimes a different linker is needed for c++ libs -LDCXX:=@FIXPATH@ @LDCXX@ +LDCXX := @LDCXX@ # The flags for linking libstdc++ linker. LIBCXX:=@LIBCXX@ @@ -544,22 +548,22 @@ LDFLAGS_TESTEXE:=@LDFLAGS_TESTEXE@ # BUILD_CC/BUILD_LD is a compiler/linker that generates code that is runnable on the # build platform. -BUILD_CC:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CC@ -BUILD_CXX:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CXX@ -BUILD_LD:=@FIXPATH@ @BUILD_LD@ -BUILD_LDCXX:=@FIXPATH@ @BUILD_LDCXX@ -BUILD_AS:=@FIXPATH@ @BUILD_AS@ -BUILD_AR:=@FIXPATH@ @BUILD_AR@ -BUILD_NM:=@FIXPATH@ @BUILD_NM@ +BUILD_CC := @BUILD_ICECC@ @BUILD_CC@ +BUILD_CXX := @BUILD_ICECC@ @BUILD_CXX@ +BUILD_LD := @BUILD_LD@ +BUILD_LDCXX := @BUILD_LDCXX@ +BUILD_AS := @BUILD_AS@ +BUILD_AR := @BUILD_AR@ +BUILD_NM := @BUILD_NM@ BUILD_OBJCOPY:=@BUILD_OBJCOPY@ BUILD_STRIP:=@BUILD_STRIP@ BUILD_SYSROOT_CFLAGS:=@BUILD_SYSROOT_CFLAGS@ BUILD_SYSROOT_LDFLAGS:=@BUILD_SYSROOT_LDFLAGS@ -AS:=@FIXPATH@ @AS@ +AS := @AS@ # AR is used to create a static library (is ar in unix, lib.exe in windows) -AR:=@FIXPATH@ @AR@ +AR := @AR@ ARFLAGS:=@ARFLAGS@ NM:=@NM@ @@ -608,7 +612,7 @@ STATIC_LIBRARY=@STATIC_LIBRARY@ LIBRARY_PREFIX:=@LIBRARY_PREFIX@ SHARED_LIBRARY_SUFFIX:=@SHARED_LIBRARY_SUFFIX@ STATIC_LIBRARY_SUFFIX:=@STATIC_LIBRARY_SUFFIX@ -EXE_SUFFIX:=@EXE_SUFFIX@ +EXECUTABLE_SUFFIX:=@EXECUTABLE_SUFFIX@ OBJ_SUFFIX:=@OBJ_SUFFIX@ STATIC_BUILD:=@STATIC_BUILD@ @@ -629,18 +633,15 @@ JAVADOC_CMD:=@JAVADOC@ JAR_CMD:=@JAR@ JLINK_CMD := @JLINK@ JMOD_CMD := @JMOD@ -JARSIGNER_CMD:=@JARSIGNER@ # These variables are meant to be used. They are defined with = instead of := to make # it possible to override only the *_CMD variables. -JAVA=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS) -JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS) -JAVA_DETACH =@FIXPATH@ @FIXPATH_DETACH_FLAG@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS) -JAVAC=@FIXPATH@ $(JAVAC_CMD) -JAVADOC=@FIXPATH@ $(JAVADOC_CMD) -JAR=@FIXPATH@ $(JAR_CMD) -JLINK = @FIXPATH@ $(JLINK_CMD) -JMOD = @FIXPATH@ $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL) -JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD) +JAVA = $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS) +JAVA_SMALL = $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS) +JAVAC = $(JAVAC_CMD) +JAVADOC = $(JAVADOC_CMD) +JAR = $(JAR_CMD) +JLINK = $(JLINK_CMD) +JMOD = $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL) BUILD_JAVA_FLAGS := @BOOTCYCLE_JVM_ARGS_BIG@ BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS) @@ -685,9 +686,7 @@ CCACHE:=@CCACHE@ CD:=cd CHMOD:=@CHMOD@ CODESIGN:=@CODESIGN@ -COMM:=@COMM@ CP:=@CP@ -CPIO:=@CPIO@ CUT:=@CUT@ DATE:=@DATE@ DIFF:=@DIFF@ @@ -708,7 +707,7 @@ MIG:=@MIG@ MKDIR:=@MKDIR@ MV:=@MV@ NICE:=@NICE@ -PANDOC:=@FIXPATH@ @PANDOC@ +PANDOC:=@PANDOC@ PATCH:=@PATCH@ PRINTF:=@PRINTF@ READLINK:=@READLINK@ @@ -724,15 +723,14 @@ TIME:=@TIME@ IS_GNU_TIME:=@IS_GNU_TIME@ TR:=@TR@ TOUCH:=@TOUCH@ -UNIQ:=@UNIQ@ WC:=@WC@ XARGS:=@XARGS@ ZIPEXE:=@ZIPEXE@ UNZIP:=@UNZIP@ -MT:=@FIXPATH@ @MT@ -RC:=@FIXPATH@ @RC@ -DUMPBIN:=@FIXPATH@ @DUMPBIN@ -CYGPATH:=@CYGPATH@ +MT:=@MT@ +RC:=@RC@ +DUMPBIN:=@DUMPBIN@ +PATHTOOL:=@PATHTOOL@ WSLPATH:=@WSLPATH@ LDD:=@LDD@ OTOOL:=@OTOOL@ @@ -749,7 +747,8 @@ JT_HOME:=@JT_HOME@ JIB_HOME:=@JIB_HOME@ XCODEBUILD=@XCODEBUILD@ DTRACE := @DTRACE@ -FIXPATH:=@FIXPATH@ +FIXPATH := @FIXPATH@ +FIXPATH_BASE := @FIXPATH_BASE@ ULIMIT:=@ULIMIT@ TAR_TYPE:=@TAR_TYPE@ diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 6687cb6cd37bc..09a7963659370 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -32,7 +32,7 @@ # compilers and related tools that are used. ######################################################################## -m4_include([toolchain_windows.m4]) +m4_include([toolchain_microsoft.m4]) # All valid toolchains, regardless of platform (used by help.m4) VALID_TOOLCHAINS_all="gcc clang xlc microsoft" @@ -179,6 +179,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS], SHARED_LIBRARY='[$]1.dll' STATIC_LIBRARY='[$]1.lib' OBJ_SUFFIX='.obj' + EXECUTABLE_SUFFIX='.exe' else LIBRARY_PREFIX=lib SHARED_LIBRARY_SUFFIX='.so' @@ -186,6 +187,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS], SHARED_LIBRARY='lib[$]1.so' STATIC_LIBRARY='lib[$]1.a' OBJ_SUFFIX='.o' + EXECUTABLE_SUFFIX='' if test "x$OPENJDK_TARGET_OS" = xmacosx; then # For full static builds, we're overloading the SHARED_LIBRARY # variables in order to limit the amount of changes required. @@ -209,6 +211,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS], AC_SUBST(SHARED_LIBRARY) AC_SUBST(STATIC_LIBRARY) AC_SUBST(OBJ_SUFFIX) + AC_SUBST(EXECUTABLE_SUFFIX) ]) # Determine which toolchain type to use, and make sure it is valid for this @@ -292,12 +295,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE], TOOLCHAIN_CC_BINARY_clang="clang" TOOLCHAIN_CC_BINARY_gcc="gcc" - TOOLCHAIN_CC_BINARY_microsoft="cl$EXE_SUFFIX" + TOOLCHAIN_CC_BINARY_microsoft="cl" TOOLCHAIN_CC_BINARY_xlc="xlclang" TOOLCHAIN_CXX_BINARY_clang="clang++" TOOLCHAIN_CXX_BINARY_gcc="g++" - TOOLCHAIN_CXX_BINARY_microsoft="cl$EXE_SUFFIX" + TOOLCHAIN_CXX_BINARY_microsoft="cl" TOOLCHAIN_CXX_BINARY_xlc="xlclang++" # Use indirect variable referencing @@ -325,9 +328,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE], # special setup, e.g. additional paths etc. AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], [ - # FIXME: Is this needed? - AC_LANG(C++) - # Store the CFLAGS etc passed to the configure script. ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" @@ -335,52 +335,26 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION], # autoconf magic only relies on PATH, so update it if tools dir is specified OLD_PATH="$PATH" - # On Windows, we need to detect the visual studio installation first. - # This will change the PATH, but we need to keep that new PATH even - # after toolchain detection is done, since the compiler (on x86) uses - # it for DLL resolution in runtime. - if test "x$OPENJDK_BUILD_OS" = "xwindows" \ - && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then - TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - # Append VS_PATH. In WSL, VS_PATH will not contain the WSL env path needed - # for using basic Unix tools, so need to keep the original PATH. - UTIL_APPEND_TO_PATH(PATH, $VS_PATH) - UTIL_APPEND_TO_PATH(WSLENV, "PATH/l:LIB:INCLUDE") - export WSLENV - else - # Reset path to VS_PATH. It will include everything that was on PATH at the time we - # ran TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV. - PATH="$VS_PATH" - fi - # The microsoft toolchain also requires INCLUDE and LIB to be set. - export INCLUDE="$VS_INCLUDE" - export LIB="$VS_LIB" - else - if test "x$XCODE_VERSION_OUTPUT" != x; then - # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION - TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '` - TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION" - else - # Currently we do not define this for other toolchains. This might change as the need arise. - TOOLCHAIN_VERSION= - fi + if test "x$XCODE_VERSION_OUTPUT" != x; then + # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION + TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '` + TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION" fi AC_SUBST(TOOLCHAIN_VERSION) - # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to + # Finally prepend TOOLCHAIN_PATH to the PATH, to allow --with-tools-dir to # override all other locations. if test "x$TOOLCHAIN_PATH" != x; then - PATH=$TOOLCHAIN_PATH:$PATH + export PATH=$TOOLCHAIN_PATH:$PATH fi ]) # Restore path, etc AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], [ - # Restore old path, except for the microsoft toolchain, which requires VS_PATH - # to remain in place. Otherwise the compiler will not work in some siutations - # in later configure checks. + # Restore old path, except for the microsoft toolchain, which requires the + # toolchain path to remain in place. Otherwise the compiler will not work in + # some siutations in later configure checks. if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then PATH="$OLD_PATH" fi @@ -427,7 +401,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION], # First line typically looks something like: # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 # but the compiler name may vary depending on locale. - COMPILER_VERSION_OUTPUT=`"$COMPILER" 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'` + COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'` # Check that this is likely to be Microsoft CL.EXE. $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null if test $? -ne 0; then @@ -506,7 +480,7 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER], if test "x`basename [$]$1`" = "x[$]$1"; then # A command without a complete path is provided, search $PATH. - AC_PATH_PROGS(POTENTIAL_$1, [$]$1) + UTIL_LOOKUP_PROGS(POTENTIAL_$1, [$]$1) if test "x$POTENTIAL_$1" != x; then $1=$POTENTIAL_$1 else @@ -528,34 +502,16 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER], # If we are not cross compiling, then the default compiler name will be # used. - $1= - # If TOOLCHAIN_PATH is set, check for all compiler names in there first - # before checking the rest of the PATH. - # FIXME: Now that we prefix the TOOLS_DIR to the PATH in the PRE_DETECTION - # step, this should not be necessary. - if test -n "$TOOLCHAIN_PATH"; then - PATH_save="$PATH" - PATH="$TOOLCHAIN_PATH" - AC_PATH_TOOL(TOOLCHAIN_PATH_$1, $SEARCH_LIST) - $1=$TOOLCHAIN_PATH_$1 - PATH="$PATH_save" - fi - - # AC_PATH_TOOL can't be run multiple times with the same variable, - # so create a new name for this run. - if test "x[$]$1" = x; then - AC_PATH_TOOL(POTENTIAL_$1, $SEARCH_LIST) + UTIL_LOOKUP_TOOLCHAIN_PROGS(POTENTIAL_$1, $SEARCH_LIST) + if test "x$POTENTIAL_$1" != x; then $1=$POTENTIAL_$1 - fi - - if test "x[$]$1" = x; then + else HELP_MSG_MISSING_DEPENDENCY([devkit]) AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG]) fi fi # Now we have a compiler binary in $1. Make sure it's okay. - UTIL_FIXUP_EXECUTABLE($1) TEST_COMPILER="[$]$1" AC_MSG_CHECKING([resolved symbolic links for $1]) @@ -596,12 +552,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION], # There is no specific version flag, but all output starts with a version string. # First line typically looks something like: # Microsoft (R) Incremental Linker Version 12.00.31101.0 - # Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS, - # which, in combination with WSLENV, will make the WSL layer complain - old_path="$PATH" - PATH= - LINKER_VERSION_STRING=`$LD 2>&1 | $HEAD -n 1 | $TR -d '\r'` - PATH="$old_path" + LINKER_VERSION_STRING=`$LINKER 2>&1 | $HEAD -n 1 | $TR -d '\r'` # Extract version number [ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \ $SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ] @@ -612,7 +563,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION], # This program is free software; [...] # If using gold it will look like: # GNU gold (GNU Binutils 2.30) 1.15 - LINKER_VERSION_STRING=`$LD -Wl,--version 2> /dev/null | $HEAD -n 1` + LINKER_VERSION_STRING=`$LINKER -Wl,--version 2> /dev/null | $HEAD -n 1` # Extract version number if [ [[ "$LINKER_VERSION_STRING" == *gold* ]] ]; then [ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \ @@ -629,7 +580,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION], # or # GNU ld (GNU Binutils for Ubuntu) 2.26.1 - LINKER_VERSION_STRING=`$LD -Wl,-v 2>&1 | $HEAD -n 1` + LINKER_VERSION_STRING=`$LINKER -Wl,-v 2>&1 | $HEAD -n 1` # Check if we're using the GNU ld $ECHO "$LINKER_VERSION_STRING" | $GREP "GNU" > /dev/null if test $? -eq 0; then @@ -649,6 +600,23 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION], AC_MSG_NOTICE([Using $TOOLCHAIN_TYPE $LINKER_NAME version $LINKER_VERSION_NUMBER @<:@$LINKER_VERSION_STRING@:>@]) ]) +# Make sure we did not pick up /usr/bin/link, which is the unix-style link +# executable. +# +# $1 = linker to test (LD or BUILD_LD) +AC_DEFUN(TOOLCHAIN_VERIFY_LINK_BINARY, +[ + LINKER=[$]$1 + + AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) + $LINKER --version > /dev/null + if test $? -eq 0 ; then + AC_MSG_RESULT([no]) + AC_MSG_ERROR([$LINKER is the winenv link tool. Please check your PATH and rerun configure.]) + else + AC_MSG_RESULT([yes]) + fi +]) # Detect the core components of the toolchain, i.e. the compilers (CC and CXX), # preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the # archiver (AR). Verify that the compilers are correct according to the @@ -693,39 +661,18 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then # In the Microsoft toolchain we have a separate LD command "link". - # Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is - # a cygwin program for something completely different. - AC_CHECK_PROG([LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK]) - UTIL_FIXUP_EXECUTABLE(LD) - # Verify that we indeed succeeded with this trick. - AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) - - # Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS, - # which, in combination with WSLENV, will make the WSL layer complain - old_path="$PATH" - PATH= - - "$LD" --version > /dev/null - - if test $? -eq 0 ; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.]) - else - AC_MSG_RESULT([yes]) - fi - - PATH="$old_path" - + UTIL_LOOKUP_TOOLCHAIN_PROGS(LD, link) + TOOLCHAIN_VERIFY_LINK_BINARY(LD) LDCXX="$LD" - # jaotc being a windows program expects the linker to be supplied with exe suffix. - LD_JAOTC="$LD$EXE_SUFFIX" + # jaotc being a windows program expects the linker to be supplied with exe suffix.but without + # fixpath + LD_JAOTC="${LD##$FIXPATH }" else # All other toolchains use the compiler to link. LD="$CC" LDCXX="$CXX" # jaotc expects 'ld' as the linker rather than the compiler. - UTIL_CHECK_TOOLS([LD_JAOTC], ld) - UTIL_FIXUP_EXECUTABLE(LD_JAOTC) + UTIL_LOOKUP_TOOLCHAIN_PROGS(LD_JAOTC, ld) fi AC_SUBST(LD) AC_SUBST(LD_JAOTC) @@ -746,8 +693,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], # # Setup the assembler (AS) # - # FIXME: is this correct for microsoft? - AS="$CC -c" + if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then + AS="$CC -c" + else + # On windows, the assember is "ml.exe" + UTIL_LOOKUP_TOOLCHAIN_PROGS(AS, ml) + fi AC_SUBST(AS) # @@ -755,13 +706,12 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], # if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then # The corresponding ar tool is lib.exe (used to create static libraries) - AC_CHECK_PROG([AR], [lib$EXE_SUFFIX],[lib$EXE_SUFFIX],,,) + UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, lib) elif test "x$TOOLCHAIN_TYPE" = xgcc; then - UTIL_CHECK_TOOLS(AR, ar gcc-ar) + UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar gcc-ar) else - UTIL_CHECK_TOOLS(AR, ar) + UTIL_LOOKUP_TOOLCHAIN_PROGS(AR, ar) fi - UTIL_FIXUP_EXECUTABLE(AR) ]) # Setup additional tools that is considered a part of the toolchain, but not the @@ -770,41 +720,26 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE], AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA], [ if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - UTIL_PATH_PROGS(LIPO, lipo) - UTIL_FIXUP_EXECUTABLE(LIPO) + UTIL_LOOKUP_PROGS(LIPO, lipo) UTIL_REQUIRE_PROGS(OTOOL, otool) - UTIL_FIXUP_EXECUTABLE(OTOOL) UTIL_REQUIRE_PROGS(INSTALL_NAME_TOOL, install_name_tool) - UTIL_FIXUP_EXECUTABLE(INSTALL_NAME_TOOL) fi if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - AC_CHECK_PROG([MT], [mt$EXE_SUFFIX], [mt$EXE_SUFFIX],,, [/usr/bin/mt]) - UTIL_FIXUP_EXECUTABLE(MT) + # Setup the manifest tool (MT) + UTIL_LOOKUP_TOOLCHAIN_PROGS(MT, mt) # Setup the resource compiler (RC) - AC_CHECK_PROG([RC], [rc$EXE_SUFFIX], [rc$EXE_SUFFIX],,, [/usr/bin/rc]) - UTIL_FIXUP_EXECUTABLE(RC) - AC_CHECK_PROG([DUMPBIN], [dumpbin$EXE_SUFFIX], [dumpbin$EXE_SUFFIX],,,) - UTIL_FIXUP_EXECUTABLE(DUMPBIN) - # We need to check for 'msbuild.exe' because at the place where we expect to - # find 'msbuild.exe' there's also a directory called 'msbuild' and configure - # won't find the 'msbuild.exe' executable in that case (and the - # 'ac_executable_extensions' is unusable due to performance reasons). - # Notice that we intentionally don't fix up the path to MSBUILD because we - # will call it in a DOS shell during freetype detection on Windows (see - # 'LIB_SETUP_FREETYPE' in "libraries.m4" - AC_CHECK_PROG([MSBUILD], [msbuild$EXE_SUFFIX], [msbuild$EXE_SUFFIX],,,) + UTIL_LOOKUP_TOOLCHAIN_PROGS(RC, rc) + UTIL_LOOKUP_TOOLCHAIN_PROGS(DUMPBIN, dumpbin) fi if test "x$OPENJDK_TARGET_OS" != xwindows; then - UTIL_CHECK_TOOLS(STRIP, strip) - UTIL_FIXUP_EXECUTABLE(STRIP) + UTIL_LOOKUP_TOOLCHAIN_PROGS(STRIP, strip) if test "x$TOOLCHAIN_TYPE" = xgcc; then - UTIL_CHECK_TOOLS(NM, nm gcc-nm) + UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm gcc-nm) else - UTIL_CHECK_TOOLS(NM, nm) + UTIL_LOOKUP_TOOLCHAIN_PROGS(NM, nm) fi - UTIL_FIXUP_EXECUTABLE(NM) GNM="$NM" AC_SUBST(GNM) fi @@ -812,25 +747,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA], # objcopy is used for moving debug symbols to separate files when # full debug symbols are enabled. if test "x$OPENJDK_TARGET_OS" = xlinux; then - UTIL_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy]) - # Only call fixup if objcopy was found. - if test -n "$OBJCOPY"; then - UTIL_FIXUP_EXECUTABLE(OBJCOPY) - fi + UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJCOPY, gobjcopy objcopy) fi - UTIL_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) - if test "x$OBJDUMP" != x; then - # Only used for compare.sh; we can live without it. UTIL_FIXUP_EXECUTABLE - # bails if argument is missing. - UTIL_FIXUP_EXECUTABLE(OBJDUMP) - fi + UTIL_LOOKUP_TOOLCHAIN_PROGS(OBJDUMP, gobjdump objdump) case $TOOLCHAIN_TYPE in gcc|clang) - UTIL_CHECK_TOOLS(CXXFILT, [c++filt]) - UTIL_CHECK_NONEMPTY(CXXFILT) - UTIL_FIXUP_EXECUTABLE(CXXFILT) + UTIL_REQUIRE_TOOLCHAIN_PROGS(CXXFILT, c++filt) ;; esac ]) @@ -902,63 +826,57 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT" if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - BUILD_VS_INCLUDE="$BUILD_DEVKIT_VS_INCLUDE" - BUILD_VS_LIB="$BUILD_DEVKIT_VS_LIB" + # For historical reasons, paths are separated by ; in devkit.info + BUILD_VS_INCLUDE="${BUILD_DEVKIT_VS_INCLUDE//;/:}" + BUILD_VS_LIB="${BUILD_DEVKIT_VS_LIB//;/:}" - TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS([BUILD_]) + TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_, BUILD_) fi fi - fi - - # FIXME: we should list the discovered compilers as an exclude pattern! - # If we do that, we can do this detection before POST_DETECTION, and still - # find the build compilers in the tools dir, if needed. - if test "x$OPENJDK_BUILD_OS" = xmacosx; then - UTIL_REQUIRE_PROGS(BUILD_CC, [clang cl cc gcc]) - UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) else - UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) - UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) + if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then + # If we got no devkit, we need to go hunting for the proper env + TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_BUILD_CPU, [$TOOLCHAIN_VERSION]) + TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_BUILD_CPU, BUILD_) + + # We cannot currently export the VS_PATH to spec.gmk. This is probably + # strictly not correct, but seems to work anyway. + + # Convert VS_INCLUDE and VS_LIB into sysroot flags + TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS(BUILD_) + fi fi - UTIL_FIXUP_EXECUTABLE(BUILD_CC) - UTIL_FIXUP_EXECUTABLE(BUILD_CXX) - UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) - UTIL_FIXUP_EXECUTABLE(BUILD_NM) - UTIL_PATH_PROGS(BUILD_AR, ar gcc-ar) - UTIL_FIXUP_EXECUTABLE(BUILD_AR) - UTIL_PATH_PROGS(BUILD_OBJCOPY, objcopy) - UTIL_FIXUP_EXECUTABLE(BUILD_OBJCOPY) - UTIL_PATH_PROGS(BUILD_STRIP, strip) - UTIL_FIXUP_EXECUTABLE(BUILD_STRIP) - # Assume the C compiler is the assembler - BUILD_AS="$BUILD_CC -c" + if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - # In the Microsoft toolchain we have a separate LD command "link". - # Make sure we reject /usr/bin/link (as determined in CYGWIN_LINK), which is - # a cygwin program for something completely different. - AC_CHECK_PROG([BUILD_LD], [link$EXE_SUFFIX],[link$EXE_SUFFIX],,, [$CYGWIN_LINK]) - UTIL_FIXUP_EXECUTABLE(BUILD_LD) - # Verify that we indeed succeeded with this trick. - AC_MSG_CHECKING([if the found link.exe is actually the Visual Studio linker]) - - # Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS, - # which, in combination with WSLENV, will make the WSL layer complain - old_path="$PATH" - PATH= - - "$BUILD_LD" --version > /dev/null - - if test $? -eq 0 ; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([This is the Cygwin link tool. Please check your PATH and rerun configure.]) - else - AC_MSG_RESULT([yes]) - fi + UTIL_REQUIRE_PROGS(BUILD_CC, cl, [$VS_PATH]) + UTIL_REQUIRE_PROGS(BUILD_CXX, cl, [$VS_PATH]) + + # On windows, the assember is "ml.exe". We currently don't need this so + # do not require. + UTIL_LOOKUP_PROGS(BUILD_AS, ml, [$VS_PATH]) - PATH="$old_path" + # On windows, the ar tool is lib.exe (used to create static libraries). + # We currently don't need this so do not require. + UTIL_LOOKUP_PROGS(BUILD_AR, lib, [$VS_PATH]) + # In the Microsoft toolchain we have a separate LD command "link". + UTIL_REQUIRE_PROGS(BUILD_LD, link, [$VS_PATH]) + TOOLCHAIN_VERIFY_LINK_BINARY(BUILD_LD) BUILD_LDCXX="$BUILD_LD" else + if test "x$OPENJDK_BUILD_OS" = xmacosx; then + UTIL_REQUIRE_PROGS(BUILD_CC, clang cc gcc) + UTIL_REQUIRE_PROGS(BUILD_CXX, clang++ CC g++) + else + UTIL_REQUIRE_PROGS(BUILD_CC, cc gcc) + UTIL_REQUIRE_PROGS(BUILD_CXX, CC g++) + fi + UTIL_LOOKUP_PROGS(BUILD_NM, nm gcc-nm) + UTIL_LOOKUP_PROGS(BUILD_AR, ar gcc-ar lib) + UTIL_LOOKUP_PROGS(BUILD_OBJCOPY, objcopy) + UTIL_LOOKUP_PROGS(BUILD_STRIP, strip) + # Assume the C compiler is the assembler + BUILD_AS="$BUILD_CC -c" # Just like for the target compiler, use the compiler as linker BUILD_LD="$BUILD_CC" BUILD_LDCXX="$BUILD_CXX" @@ -1003,7 +921,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS], # Check for extra potential brokenness. if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then # On Windows, double-check that we got the right compiler. - CC_VERSION_OUTPUT=`$CC 2>&1 | $GREP -v 'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'` + CC_VERSION_OUTPUT=`$CC 2>&1 1>/dev/null | $HEAD -n 1 | $TR -d '\r'` COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"` if test "x$OPENJDK_TARGET_CPU" = "xx86"; then if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then @@ -1099,7 +1017,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG], if test "x$JT_HOME" = x; then # JT_HOME is not set in environment, or was deemed invalid. # Try to find jtreg on path - UTIL_PATH_PROGS(JTREGEXE, jtreg) + UTIL_LOOKUP_PROGS(JTREGEXE, jtreg) if test "x$JTREGEXE" != x; then # That's good, now try to derive JT_HOME JT_HOME=`(cd $($DIRNAME $JTREGEXE)/.. && pwd)` diff --git a/make/autoconf/toolchain_windows.m4 b/make/autoconf/toolchain_microsoft.m4 similarity index 55% rename from make/autoconf/toolchain_windows.m4 rename to make/autoconf/toolchain_microsoft.m4 index 4644c0a9d7c77..940f73a9d22c7 100644 --- a/make/autoconf/toolchain_windows.m4 +++ b/make/autoconf/toolchain_microsoft.m4 @@ -61,30 +61,32 @@ VS_TOOLSET_SUPPORTED_2019=true AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], [ if test "x$VS_ENV_CMD" = x; then - VS_VERSION="$1" - VS_BASE="$2" - METHOD="$3" - - UTIL_REWRITE_AS_UNIX_PATH(VS_BASE) - # In VS 2017 and VS 2019, the default installation is in a subdir named after the edition. - # Find the first one present and use that. - if test "x$VS_EDITIONS" != x; then - for edition in $VS_EDITIONS; do - if test -d "$VS_BASE/$edition"; then - VS_BASE="$VS_BASE/$edition" - break - fi - done - fi + TARGET_CPU="$1" + VS_VERSION="$2" + VS_BASE="$3" + METHOD="$4" + + UTIL_FIXUP_PATH(VS_BASE, NOFAIL) + + if test "x$VS_BASE" != x && test -d "$VS_BASE"; then + # In VS 2017 and VS 2019, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi - if test -d "$VS_BASE"; then AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) - if test "x$OPENJDK_TARGET_CPU" = xx86; then + if test "x$TARGET_CPU" = xx86; then VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" - elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then + elif test "x$TARGET_CPU" = xx86_64; then VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ - VC/Auxiliary/Build/vcvarsx86_amd64.bat VC/Auxiliary/Build/vcvars64.bat" - elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + elif test "x$TARGET_CPU" = xaarch64; then # for host x86-64, target aarch64 VCVARSFILES="vc/auxiliary/build/vcvarsamd64_arm64.bat \ vc/auxiliary/build/vcvarsx86_arm64.bat" @@ -114,24 +116,27 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT], [ if test "x$VS_ENV_CMD" = x; then - VS_VERSION="$1" - WIN_SDK_BASE="$2" - METHOD="$3" - UTIL_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE) - if test -d "$WIN_SDK_BASE"; then + TARGET_CPU="$1" + VS_VERSION="$2" + WIN_SDK_BASE="$3" + METHOD="$4" + + UTIL_FIXUP_PATH(WIN_SDK_BASE, NOFAIL) + + if test "x$WIN_SDK_BASE" != x && test -d "$WIN_SDK_BASE"; then # There have been cases of partial or broken SDK installations. A missing # lib dir is not going to work. if test ! -d "$WIN_SDK_BASE/lib"; then AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring]) - elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then + elif test -f "$WIN_SDK_BASE/bin/setenv.cmd"; then AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD]) - VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd" - if test "x$OPENJDK_TARGET_CPU" = xx86; then + VS_ENV_CMD="$WIN_SDK_BASE/bin/setenv.cmd" + if test "x$TARGET_CPU" = xx86; then VS_ENV_ARGS="/x86" - elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then + elif test "x$TARGET_CPU" = xx86_64; then VS_ENV_ARGS="/x64" - elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then + elif test "x$TARGET_CPU" = xaarch64; then VS_ENV_ARGS="/arm64" fi # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see @@ -160,7 +165,8 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE], [specific MSVC toolset version to use, passed as -vcvars_ver argument to pass to vcvarsall.bat (Windows only)])]) - VS_VERSION="$1" + TARGET_CPU="$1" + VS_VERSION="$2" eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}" eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}" eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}" @@ -174,9 +180,9 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE], # When using --with-tools-dir, assume it points to the correct and default # version of Visual Studio or that --with-toolchain-version was also set. if test "x$with_tools_dir" != x; then - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], [$with_tools_dir/../..], [--with-tools-dir]) - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], [$with_tools_dir/../../..], [--with-tools-dir]) if test "x$VS_ENV_CMD" = x; then # Having specified an argument which is incorrect will produce an instant failure; @@ -189,45 +195,46 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE], fi if test "x$VS_COMNTOOLS" != x; then - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable]) fi if test "x$PROGRAMFILES" != x; then - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name]) fi # Work around the insanely named ProgramFiles(x86) env variable PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`" if test "x$PROGRAMFILES_X86" != x; then - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name]) fi - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], - [C:/Program Files/$VS_INSTALL_DIR], [well-known name]) - TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], - [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name]) + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], + [c:/program files/$VS_INSTALL_DIR], [well-known name]) + TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$TARGET_CPU], [$VS_VERSION], + [c:/program files (x86)/$VS_INSTALL_DIR], [well-known name]) if test "x$SDK_INSTALL_DIR" != x; then if test "x$ProgramW6432" != x; then - TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION], [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name]) fi if test "x$PROGRAMW6432" != x; then - TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION], [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name]) fi if test "x$PROGRAMFILES" != x; then - TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}], + TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION], [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name]) fi - TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}], - [C:/Program Files/$SDK_INSTALL_DIR], [well-known name]) - TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}], - [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name]) + TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION], + [c:/program files/$SDK_INSTALL_DIR], [well-known name]) + TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$TARGET_CPU], [$VS_VERSION], + [c:/program files (x86)/$SDK_INSTALL_DIR], [well-known name]) fi + VCVARS_VER=auto if test "x$VS_TOOLSET_SUPPORTED" != x; then if test "x$with_msvc_toolset_version" != x; then - VS_ENV_ARGS="$VS_ENV_ARGS -vcvars_ver=$with_msvc_toolset_version" + VCVARS_VER="$with_msvc_toolset_version" fi fi ]) @@ -264,44 +271,9 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO], eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}" eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - # The TOOLCHAIN_PATH from a devkit is in Unix format. In WSL we need a - # windows version of the complete VS_PATH as VS_PATH_WINDOWS - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - # Convert the toolchain path - OLDIFS="$IFS" - IFS=":" - VS_PATH_WINDOWS="" - for i in $TOOLCHAIN_PATH; do - path=$i - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([path]) - VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$path" - done - IFS="$OLDIFS" - # Append the current path from Windows env - WINDOWS_PATH="`$CMD /c echo %PATH%`" - VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$WINDOWS_PATH" - else - VS_PATH="$TOOLCHAIN_PATH:$PATH" - fi - - # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it - # can still be exported as INCLUDE for compiler invocations without - # SYSROOT_CFLAGS - OLDIFS="$IFS" - IFS=";" - for i in $DEVKIT_VS_INCLUDE; do - ipath=$i - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([ipath]) - VS_INCLUDE="$VS_INCLUDE;$ipath" - done - # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported - # as LIB for compiler invocations without SYSROOT_LDFLAGS - for i in $DEVKIT_VS_LIB; do - libpath=$i - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([libpath]) - VS_LIB="$VS_LIB;$libpath" - done - IFS="$OLDIFS" + # For historical reasons, paths are separated by ; in devkit.info + VS_INCLUDE=${DEVKIT_VS_INCLUDE//;/:} + VS_LIB=${DEVKIT_VS_LIB//;/:} AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION]) @@ -319,7 +291,7 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO], fi for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do - TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION]) + TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE($OPENJDK_TARGET_CPU, [$VS_VERSION]) if test "x$VS_ENV_CMD" != x; then TOOLCHAIN_VERSION=$VS_VERSION eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" @@ -341,206 +313,118 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO], fi ]) +AC_DEFUN([TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV], +[ + TARGET_CPU=$1 + + AC_MSG_NOTICE([Trying to extract Visual Studio environment variables for $TARGET_CPU]) + AC_MSG_NOTICE([using $VS_ENV_CMD $VS_ENV_ARGS]) + + VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env-$TARGET_CPU" + $MKDIR -p $VS_ENV_TMP_DIR + + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). + # Instead create a shell script which will set the relevant variables when run. + + OLDPATH="$PATH" + # Make sure we only capture additions to PATH needed by VS. + # Clear out path, but need system dir present for vsvars cmd file to be able to run + export PATH=$WINENV_PREFIX/c/windows/system32 + # The "| cat" is to stop SetEnv.Cmd to mess with system colors on some systems + # We can't pass -vcvars_ver=$VCVARS_VER here because cmd.exe eats all '=' + # in bat file arguments. :-( + $FIXPATH $CMD /c "$TOPDIR/make/scripts/extract-vs-env.cmd" "$VS_ENV_CMD" \ + "$VS_ENV_TMP_DIR/set-vs-env.sh" $VCVARS_VER $VS_ENV_ARGS \ + > $VS_ENV_TMP_DIR/extract-vs-env.log | $CAT 2>&1 + PATH="$OLDPATH" + + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then + AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.]) + AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.]) + AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in]) + AC_MSG_NOTICE([$VS_ENV_TMP_DIR.]) + AC_MSG_ERROR([Cannot continue]) + fi + + # Remove windows line endings + $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh + + # Now set all paths and other env variables by executing the generated + # shell script. This will allow the rest of the configure script to find + # and run the compiler in the proper way. + AC_MSG_NOTICE([Setting extracted environment variables for $TARGET_CPU]) + . $VS_ENV_TMP_DIR/set-vs-env.sh + + # Extract only what VS_ENV_CMD added to the PATH + VS_PATH=${PATH_AFTER/"$PATH_BEFORE"} + VS_PATH=${VS_PATH//::/:} + + # Remove any paths containing # (typically F#) as that messes up make. This + # is needed if visual studio was installed with F# support. + [ VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[^:#]*#[^:]*://g'` ] + + # Sometimes case is off + if test -z "$WINDOWSSDKDIR"; then + WINDOWSSDKDIR="$WindowsSdkDir" + fi + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we + # also define VCINSTALLDIR and WINDOWSSDKDIR. All are in + # unix style. +]) + ################################################################################ # Check if the VS env variables were setup prior to running configure. # If not, then find vcvarsall.bat and run it automatically, and integrate # the set env variables into the spec file. AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], [ - # Store path to cygwin link.exe to help excluding it when searching for - # VS linker. This must be done before changing the PATH when looking for VS. - AC_PATH_PROG(CYGWIN_LINK, link.exe) - if test "x$CYGWIN_LINK" != x; then - AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool]) - "$CYGWIN_LINK" --version > /dev/null - if test $? -eq 0 ; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - # This might be the VS linker. Don't exclude it later on. - CYGWIN_LINK="" - fi - fi - - # First-hand choice is to locate and run the vsvars bat file. + # Locate the vsvars bat file and save it as VS_ENV_CMD TOOLCHAIN_FIND_VISUAL_STUDIO - # If we have a devkit, skip all of the below. + # If we have a devkit, we don't need to run VS_ENV_CMD if test "x$DEVKIT_VS_VERSION" = x; then if test "x$VS_ENV_CMD" != x; then - # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. - UTIL_FIXUP_EXECUTABLE(VS_ENV_CMD) - - # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat - AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) - - # We need to create a couple of temporary files. - VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" - $MKDIR -p $VS_ENV_TMP_DIR - - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). - # Instead create a shell script which will set the relevant variables when run. - WINPATH_VS_ENV_CMD="$VS_ENV_CMD" - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) + # We have found a Visual Studio environment on disk, let's extract variables + # from the vsvars bat file into shell variables in the configure script. + TOOLCHAIN_EXTRACT_VISUAL_STUDIO_ENV($OPENJDK_TARGET_CPU) - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - WINPATH_BASH="bash" - else - WINPATH_BASH="$BASH" - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) - fi - - # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell - # script (executable by bash) that will setup the important variables. - EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" - $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE - # This will end up something like: - # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat - $ECHO "call \"$WINPATH_VS_ENV_CMD\" $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE - # In some cases, the VS_ENV_CMD will change directory, change back so - # the set-vs-env.sh ends up in the right place. - $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - # These will end up something like: - # echo VS_PATH=\"$PATH\" > set-vs-env.sh - # The trailing space for everyone except PATH is no typo, but is needed due - # to trailing \ in the Windows paths. These will be stripped later. - # Trying pure CMD extract. This results in windows paths that need to - # be converted post extraction, but a simpler script. - $ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo VCToolsRedistDir="%VCToolsRedistDir% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - else - # These will end up something like: - # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh - # The trailing space for everyone except PATH is no typo, but is needed due - # to trailing \ in the Windows paths. These will be stripped later. - $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo VCToolsRedistDir="'\"$VCToolsRedistDir \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ - >> $EXTRACT_VC_ENV_BAT_FILE - fi - - # Now execute the newly created bat file. - # Change directory so we don't need to mess with Windows paths in redirects. - cd $VS_ENV_TMP_DIR - $CMD /c extract-vs-env.bat > extract-vs-env.log 2>&1 - cd $CONFIGURE_START_DIR - - if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then - AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.]) - AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) - AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) - AC_MSG_ERROR([Cannot continue]) - fi - - # Remove windows line endings - $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh - - # Now set all paths and other env variables. This will allow the rest of - # the configure script to find and run the compiler in the proper way. - AC_MSG_NOTICE([Setting extracted environment variables]) - . $VS_ENV_TMP_DIR/set-vs-env.sh # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we - # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. - - # In WSL, the extracted VS_PATH is Windows style. This needs to be - # rewritten as Unix style and the Windows style version is saved - # in VS_PATH_WINDOWS. - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - OLDIFS="$IFS" - IFS=";" - # Convert VS_PATH to unix style - VS_PATH_WINDOWS="$VS_PATH" - VS_PATH="" - for i in $VS_PATH_WINDOWS; do - path=$i - # Only process non-empty elements - if test "x$path" != x; then - IFS="$OLDIFS" - # Check that directory exists before calling fixup_path - testpath=$path - UTIL_REWRITE_AS_UNIX_PATH([testpath]) - if test -d "$testpath"; then - UTIL_FIXUP_PATH([path]) - UTIL_APPEND_TO_PATH(VS_PATH, $path) - fi - IFS=";" - fi - done - IFS="$OLDIFS" - fi - + # also define VCINSTALLDIR and WINDOWSSDKDIR. All are in + # unix style. else - # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. - AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) + # We did not find a vsvars bat file. + AC_MSG_ERROR([Cannot locate a valid Visual Studio installation]) fi fi - # At this point, we should have correct variables in the environment, or we can't continue. - AC_MSG_CHECKING([for Visual Studio variables]) + # At this point, we should have correct variables in the environment + AC_MSG_CHECKING([that Visual Studio variables have been correctly extracted]) - if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \ - || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then + if test "x$VCINSTALLDIR" != x || test "x$WINDOWSSDKDIR" != x \ + || test "x$DEVKIT_NAME" != x; then if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then - AC_MSG_RESULT([present but broken]) + AC_MSG_RESULT([no; Visual Studio present but broken]) AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) else AC_MSG_RESULT([ok]) - # Remove any trailing "\" ";" and " " from the variables. - VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'` - VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'` - VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'` - VCToolsRedistDir=`$ECHO "$VCToolsRedistDir" | $SED 's/\\\\* *$//'` - WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'` - WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'` - if test -z "$WINDOWSSDKDIR"; then - WINDOWSSDKDIR="$WindowsSdkDir" - fi - # Remove any paths containing # (typically F#) as that messes up make. This - # is needed if visual studio was installed with F# support. - VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'` - AC_SUBST(VS_PATH) - AC_SUBST(VS_INCLUDE) - AC_SUBST(VS_LIB) + # Turn VS_PATH into TOOLCHAIN_PATH + TOOLCHAIN_PATH="$TOOLCHAIN_PATH:$VS_PATH" + # Convert VS_INCLUDE and VS_LIB into sysroot flags TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS - - AC_SUBST(VS_PATH_WINDOWS) fi else AC_MSG_RESULT([not found]) if test "x$VS_ENV_CMD" = x; then - AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,]) - AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.]) + AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk]) else - AC_MSG_NOTICE([Running the extraction script failed.]) + AC_MSG_NOTICE([Running the extraction script failed]) fi - AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) - AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) + AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation.]) + AC_MSG_NOTICE([To analyze the problem, see extract-vs-env.log and extract-vs-env.bat in]) + AC_MSG_NOTICE([$VS_ENV_TMP_DIR.]) AC_MSG_ERROR([Cannot continue]) fi ]) @@ -556,25 +440,15 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL], # Need to check if the found msvcr is correct architecture AC_MSG_CHECKING([found $DLL_NAME architecture]) MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" - # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems. - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - CORRECT_MSVCR_ARCH="PE32 executable" - else - CORRECT_MSVCR_ARCH="PE32+ executable" - fi - else - if test "x$OPENJDK_TARGET_CPU" = xx86; then - CORRECT_MSVCR_ARCH=386 - elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then - CORRECT_MSVCR_ARCH=x86-64 - elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then - # The cygwin 'file' command only returns "PE32+ executable (DLL) (console), for MS Windows", - # without specifying which architecture it is for specifically. This has been fixed upstream. - # https://github.com/file/file/commit/b849b1af098ddd530094bf779b58431395db2e10#diff-ff2eced09e6860de75057dd731d092aeR142 - CORRECT_MSVCR_ARCH="PE32+ executable" - fi + if test "x$OPENJDK_TARGET_CPU" = xx86; then + CORRECT_MSVCR_ARCH=386 + elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then + CORRECT_MSVCR_ARCH=x86-64 + elif test "x$OPENJDK_TARGET_CPU" = xaarch64; then + # The cygwin 'file' command only returns "PE32+ executable (DLL) (console), for MS Windows", + # without specifying which architecture it is for specifically. This has been fixed upstream. + # https://github.com/file/file/commit/b849b1af098ddd530094bf779b58431395db2e10#diff-ff2eced09e6860de75057dd731d092aeR142 + CORRECT_MSVCR_ARCH="PE32+ executable" fi if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then AC_MSG_RESULT([ok]) @@ -603,20 +477,15 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], if test "x$MSVC_DLL" = x; then if test "x$VCINSTALLDIR" != x; then - CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" - UTIL_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR) if test "$VS_VERSION" -lt 2017; then # Probe: Using well-known location from Visual Studio 12.0 and older - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/$vs_target_cpu/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + POSSIBLE_MSVC_DLL="$VCINSTALLDIR/redist/$vs_target_cpu/microsoft.vc${VS_VERSION_INTERNAL}.crt/$DLL_NAME" else - CYGWIN_VC_TOOLS_REDIST_DIR="$VCToolsRedistDir" - UTIL_FIXUP_PATH(CYGWIN_VC_TOOLS_REDIST_DIR) # Probe: Using well-known location from VS 2017 and VS 2019 - POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/$vs_target_cpu/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + POSSIBLE_MSVC_DLL="`ls $VCToolsRedistDir/$vs_target_cpu/microsoft.vc${VS_VERSION_INTERNAL}.crt/$DLL_NAME 2> /dev/null`" fi # In case any of the above finds more than one file, loop over them. for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do - $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll" TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll], [well-known location in VCINSTALLDIR]) done @@ -632,40 +501,44 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], if test "x$MSVC_DLL" = x; then # Probe: Look in the Windows system32 directory - CYGWIN_SYSTEMROOT="$SYSTEMROOT" - UTIL_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT) - POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME" - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], - [well-known location in SYSTEMROOT]) + WIN_SYSTEMROOT="$SYSTEMROOT" + UTIL_FIXUP_PATH(WIN_SYSTEMROOT, NOFAIL) + if test "x$WIN_SYSTEMROOT" != x; then + POSSIBLE_MSVC_DLL="$WIN_SYSTEMROOT/system32/$DLL_NAME" + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], + [well-known location in SYSTEMROOT]) + fi fi if test "x$MSVC_DLL" = x; then # Probe: If Visual Studio Express is installed, there is usually one with the debugger if test "x$VS100COMNTOOLS" != x; then - CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.." - UTIL_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR) - POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \ + WIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.." + UTIL_FIXUP_PATH(WIN_VS_TOOLS_DIR, NOFAIL) + if test "x$WIN_VS_TOOLS_DIR" != x; then + POSSIBLE_MSVC_DLL=`$FIND "$WIN_VS_TOOLS_DIR" -name $DLL_NAME \ | $GREP -i /$vs_target_cpu/ | $HEAD --lines 1` - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], - [search of VS100COMNTOOLS]) + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], + [search of VS100COMNTOOLS]) + fi fi fi if test "x$MSVC_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 something up) - if test "x$CYGWIN_VC_INSTALL_DIR" != x; then + if test "x$VCINSTALLDIR" != x; then if test "x$OPENJDK_TARGET_CPU" = xx86; then - POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ + POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $GREP -v arm64 | $HEAD --lines 1` if test "x$POSSIBLE_MSVC_DLL" = x; then # We're grasping at straws now... - POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ + POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ | $HEAD --lines 1` fi else - POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ - | $GREP $vs_target_cpu | $HEAD --lines 1` + POSSIBLE_MSVC_DLL=`$FIND "$VCINSTALLDIR" -name $DLL_NAME \ + | $GREP x64 | $HEAD --lines 1` fi TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], @@ -729,9 +602,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], fi AC_ARG_WITH(vcruntime-1-dll, [AS_HELP_STRING([--with-vcruntime-1-dll], - [path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows 64-bits only) @<:@probed@:>@])]) + [path to microsoft C++ runtime dll (vcruntime*_1.dll) (Windows x64 only) @<:@probed@:>@])]) - if test "x$VCRUNTIME_1_NAME" != "x" -a "x$OPENJDK_TARGET_CPU_BITS" = x64; then + if test "x$VCRUNTIME_1_NAME" != "x" && test "x$OPENJDK_TARGET_CPU" = xx86_64; then if test "x$with_vcruntime_1_dll" != x; then # If given explicitly by user, do not probe. If not present, fail directly. TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($VCRUNTIME_1_NAME, [$with_vcruntime_1_dll], @@ -750,13 +623,13 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], TOOLCHAIN_SETUP_MSVC_DLL([${VCRUNTIME_1_NAME}]) VCRUNTIME_1_DLL="$MSVC_DLL" fi - AC_SUBST(VCRUNTIME_1_DLL) fi + AC_SUBST(VCRUNTIME_1_DLL) AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir], [path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])]) - if test "x$USE_UCRT" = "xtrue"; then + if test "x$USE_UCRT" = "xtrue" && test "x$OPENJDK_TARGET_CPU" != xaarch64; then AC_MSG_CHECKING([for UCRT DLL dir]) if test "x$with_ucrt_dll_dir" != x; then if test -z "$(ls -d "$with_ucrt_dll_dir/"*.dll 2> /dev/null)"; then @@ -771,19 +644,16 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR" AC_MSG_RESULT($UCRT_DLL_DIR) else - CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}" - UTIL_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR]) - if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then + dll_subdir=$OPENJDK_TARGET_CPU + if test "x$dll_subdir" = "xaarch64"; then dll_subdir="arm64" - elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then + elif test "x$dll_subdir" = "xx86_64"; then dll_subdir="x64" - elif test "x$OPENJDK_TARGET_CPU" = "xx86"; then - dll_subdir="x86" fi - UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir" + UCRT_DLL_DIR="$WINDOWSSDKDIR/redist/ucrt/dlls/$dll_subdir" if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then # Try with version subdir - UCRT_DLL_DIR="`ls -d $CYGWIN_WINDOWSSDKDIR/Redist/*/ucrt/DLLs/$dll_subdir \ + UCRT_DLL_DIR="`ls -d $WINDOWSSDKDIR/redist/*/ucrt/dlls/$dll_subdir \ 2> /dev/null | $SORT -d | $HEAD -n1`" if test -z "$UCRT_DLL_DIR" \ || test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then @@ -805,43 +675,23 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], # Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so # that configure can use them while detecting compilers. # TOOLCHAIN_TYPE is available here. -# Param 1 - Optional prefix to all variables. (e.g BUILD_) +# Param 1 - Optional prefix to SYSROOT variables. (e.g BUILD_) +# Param 2 - Optional prefix to VS variables. (e.g BUILD_) AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_SYSROOT_FLAGS], [ OLDIFS="$IFS" - IFS=";" - # Convert $1VS_INCLUDE into $1SYSROOT_CFLAGS - for i in [$]$1VS_INCLUDE; do - ipath=$i - # Only process non-empty elements - if test "x$ipath" != x; then - IFS="$OLDIFS" - # Check that directory exists before calling fixup_path - testpath=$ipath - UTIL_REWRITE_AS_UNIX_PATH([testpath]) - if test -d "$testpath"; then - UTIL_FIXUP_PATH([ipath]) - $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -I$ipath" - fi - IFS=";" - fi + IFS=":" + + # Convert VS_INCLUDE into SYSROOT_CFLAGS + for ipath in [$]$2VS_INCLUDE; do + $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -I$ipath" done - # Convert $1VS_LIB into $1SYSROOT_LDFLAGS - for i in [$]$1VS_LIB; do - libpath=$i - # Only process non-empty elements - if test "x$libpath" != x; then - IFS="$OLDIFS" - # Check that directory exists before calling fixup_path - testpath=$libpath - UTIL_REWRITE_AS_UNIX_PATH([testpath]) - if test -d "$testpath"; then - UTIL_FIXUP_PATH([libpath]) - $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -libpath:$libpath" - fi - IFS=";" - fi + + # Convert VS_LIB into SYSROOT_LDFLAGS + for libpath in [$]$2VS_LIB; do + $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -libpath:$libpath" done + IFS="$OLDIFS" AC_SUBST($1SYSROOT_CFLAGS) diff --git a/make/autoconf/util.m4 b/make/autoconf/util.m4 index 0addb9c3a1620..9ececc55e5ee8 100644 --- a/make/autoconf/util.m4 +++ b/make/autoconf/util.m4 @@ -24,7 +24,6 @@ # m4_include([util_paths.m4]) -m4_include([util_windows.m4]) ############################################################################### # Create a function/macro that takes a series of named arguments. The call is @@ -462,151 +461,3 @@ UTIL_DEFUN_NAMED([UTIL_ARG_ENABLE], fi ]) -############################################################################### -# Test that variable $1 denoting a program is not empty. If empty, exit with an error. -# $1: variable to check -AC_DEFUN([UTIL_CHECK_NONEMPTY], -[ - if test "x[$]$1" = x; then - AC_MSG_ERROR([Could not find required tool for $1]) - fi -]) - -############################################################################### -# 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 -# $3: code snippet to call if variable was used to find tool -AC_DEFUN([UTIL_SETUP_TOOL], -[ - # Publish this variable in the help. - AC_ARG_VAR($1, [Override default value for $1]) - - if [[ -z "${$1+x}" ]]; then - # The variable is not set by user, try to locate tool using the code snippet - $2 - else - # The variable is set, but is it from the command line or the environment? - - # Try to remove the string !$1! from our list. - try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/} - if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then - # If it failed, the variable was not from the command line. Ignore it, - # but warn the user (except for BASH, which is always set by the calling BASH). - if test "x$1" != xBASH; then - AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.]) - fi - # Try to locate tool using the code snippet - $2 - else - # If it succeeded, then it was overridden by the user. We will use it - # for the tool. - - # First remove it from the list of overridden variables, so we can test - # for unknown variables in the end. - CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" - - tool_override=[$]$1 - AC_MSG_NOTICE([User supplied override $1="$tool_override"]) - - # Check if we try to supply an empty value - if test "x$tool_override" = x; then - AC_MSG_CHECKING([for $1]) - AC_MSG_RESULT([disabled]) - else - # Split up override in command part and argument part - tool_and_args=($tool_override) - [ tool_command=${tool_and_args[0]} ] - [ unset 'tool_and_args[0]' ] - [ tool_args=${tool_and_args[@]} ] - - # Check if the provided tool contains a complete path. - tool_basename="${tool_command##*/}" - if test "x$tool_basename" = "x$tool_command"; then - # A command without a complete path is provided, search $PATH. - AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"]) - AC_PATH_PROG($1, $tool_basename) - if test "x[$]$1" = x; then - AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found]) - fi - else - # Otherwise we believe it is a complete path. Use it as it is. - AC_MSG_NOTICE([Will use user supplied tool "$tool_command"]) - AC_MSG_CHECKING([for $tool_command]) - if test ! -x "$tool_command" && test ! -x "$tool_command.exe"; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable]) - fi - $1="$tool_command" - AC_MSG_RESULT([found]) - fi - if test "x$tool_args" != x; then - # If we got arguments, re-append them to the command after the fixup. - $1="[$]$1 $tool_args" - fi - fi - fi - $3 - fi -]) - -############################################################################### -# Call UTIL_SETUP_TOOL with AC_PATH_PROGS to locate the tool -# $1: variable to set -# $2: executable name (or list of names) to look for -# $3: [path] -AC_DEFUN([UTIL_PATH_PROGS], -[ - UTIL_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)]) -]) - -############################################################################### -# Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool -# $1: variable to set -# $2: executable name (or list of names) to look for -AC_DEFUN([UTIL_CHECK_TOOLS], -[ - UTIL_SETUP_TOOL($1, [AC_CHECK_TOOLS($1, $2)]) -]) - -############################################################################### -# Like UTIL_PATH_PROGS but fails if no tool was found. -# $1: variable to set -# $2: executable name (or list of names) to look for -# $3: [path] -AC_DEFUN([UTIL_REQUIRE_PROGS], -[ - UTIL_PATH_PROGS($1, $2, , $3) - UTIL_CHECK_NONEMPTY($1) -]) - -############################################################################### -# Like UTIL_SETUP_TOOL but fails if no tool was found. -# $1: variable to set -# $2: autoconf macro to call to look for the special tool -AC_DEFUN([UTIL_REQUIRE_SPECIAL], -[ - UTIL_SETUP_TOOL($1, [$2]) - UTIL_CHECK_NONEMPTY($1) -]) - -############################################################################### -# Like UTIL_REQUIRE_PROGS but also allows for bash built-ins -# $1: variable to set -# $2: executable name (or list of names) to look for -# $3: [path] -AC_DEFUN([UTIL_REQUIRE_BUILTIN_PROGS], -[ - UTIL_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)]) - if test "x[$]$1" = x; then - AC_MSG_NOTICE([Required tool $2 not found in PATH, checking built-in]) - if type -p $2 > /dev/null 2>&1; then - AC_MSG_NOTICE([Found $2 as shell built-in. Using it]) - $1="$2" - else - AC_MSG_ERROR([Required tool $2 also not found as built-in.]) - fi - fi - UTIL_CHECK_NONEMPTY($1) -]) diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 9a3d3e2bb0452..497332f4509c2 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -23,6 +23,7 @@ # questions. # +############################################################################### # Appends a string to a path variable, only adding the : when needed. AC_DEFUN([UTIL_APPEND_TO_PATH], [ @@ -35,6 +36,7 @@ AC_DEFUN([UTIL_APPEND_TO_PATH], fi ]) +############################################################################### # Prepends a string to a path variable, only adding the : when needed. AC_DEFUN([UTIL_PREPEND_TO_PATH], [ @@ -47,34 +49,6 @@ AC_DEFUN([UTIL_PREPEND_TO_PATH], fi ]) -################################################################################ -# This will make a path absolute. Assumes it's already a unix path. Also -# resolves ~ to homedir. -AC_DEFUN([UTIL_ABSOLUTE_PATH], -[ - if test "x[$]$1" != x; then - new_path="[$]$1" - - # Use eval to expand a potential ~. This technique does not work if there - # are spaces in the path (which is valid at this point on Windows), so only - # try to apply it if there is an actual ~ first in the path. - if [ [[ "$new_path" = "~"* ]] ]; then - eval new_path="$new_path" - if test ! -f "$new_path" && test ! -d "$new_path"; then - AC_MSG_ERROR([The new_path of $1, which resolves as "$new_path", is not found.]) - fi - fi - - if test -d "$new_path"; then - $1="`cd "$new_path"; $THEPWDCMD -L`" - else - dir="`$DIRNAME "$new_path"`" - base="`$BASENAME "$new_path"`" - $1="`cd "$dir"; $THEPWDCMD -L`/$base" - fi - fi -]) - ############################################################################### # This will make sure the given variable points to a full and proper # path. This means: @@ -84,31 +58,100 @@ AC_DEFUN([UTIL_ABSOLUTE_PATH], # 2) The path will be absolute, and it will be in unix-style (on # cygwin). # $1: The name of the variable to fix +# $2: if NOFAIL, errors will be silently ignored AC_DEFUN([UTIL_FIXUP_PATH], [ # Only process if variable expands to non-empty - if test "x[$]$1" != x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - UTIL_FIXUP_PATH_CYGWIN($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - UTIL_FIXUP_PATH_MSYS($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - UTIL_FIXUP_PATH_WSL($1) + path="[$]$1" + if test "x$path" != x; then + if test "x$OPENJDK_BUILD_OS" = "xwindows"; then + if test "x$2" = "xNOFAIL"; then + quiet_option="-q" + fi + imported_path=`$FIXPATH_BASE $quiet_option import "$path"` + $FIXPATH_BASE verify "$imported_path" + if test $? -ne 0; then + if test "x$2" != "xNOFAIL"; then + AC_MSG_ERROR([The path of $1, which resolves as "$path", could not be imported.]) + else + imported_path="" + fi + fi + if test "x$imported_path" != "x$path"; then + $1="$imported_path" + fi else - # We're on a unix platform. Hooray! :) - path="[$]$1" - has_space=`$ECHO "$path" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) - AC_MSG_ERROR([Spaces are not allowed in this path.]) + [ if [[ "$path" =~ " " ]]; then ] + if test "x$2" != "xNOFAIL"; then + AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) + AC_MSG_ERROR([Spaces are not allowed in this path.]) + else + path="" + fi + fi + + # Use eval to expand a potential ~. + eval new_path="$path" + if test ! -e "$new_path"; then + if test "x$2" != "xNOFAIL"; then + AC_MSG_ERROR([The path of $1, which resolves as "$new_path", is not found.]) + else + new_path="" + fi + fi + + # Make the path absolute + if test "x$new_path" != x; then + if test -d "$new_path"; then + path="`cd "$new_path"; pwd -L`" + else + dir="`$DIRNAME "$new_path"`" + base="`$BASENAME "$new_path"`" + path="`cd "$dir"; pwd -L`/$base" + fi + else + path="" fi - UTIL_ABSOLUTE_PATH(path) $1="$path" fi fi ]) +############################################################################### +# Check if the given file is a unix-style or windows-style executable, that is, +# if it expects paths in unix-style or windows-style. +# Returns "windows" or "unix" in $RESULT. +AC_DEFUN([UTIL_CHECK_WINENV_EXEC_TYPE], +[ + # For cygwin and msys2, if it's linked with the correct helper lib, it + # accept unix paths + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin" || \ + test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then + linked_libs=`$LDD $1 2>&1` + if test $? -ne 0; then + # Non-binary files (e.g. shell scripts) are unix files + RESULT=unix + else + [ if [[ "$linked_libs" =~ $WINENV_MARKER_DLL ]]; then ] + RESULT=unix + else + RESULT=windows + fi + fi + elif test "x$OPENJDK_BUILD_OS" = "xwindows"; then + # On WSL, we can check if it is a PE file + file_type=`$FILE -b $1 2>&1` + [ if [[ $file_type =~ PE.*Windows ]]; then ] + RESULT=windows + else + RESULT=unix + fi + else + RESULT=unix + fi +]) + ############################################################################### # This will make sure the given variable points to a executable # with a full and proper path. This means: @@ -121,65 +164,331 @@ AC_DEFUN([UTIL_FIXUP_PATH], # If the input variable does not have a directory specification, then # it need to be in the PATH. # $1: The name of the variable to fix +# $2: Where to look for the command (replaces $PATH) +# $3: set to NOFIXPATH to skip prefixing FIXPATH, even if needed on platform AC_DEFUN([UTIL_FIXUP_EXECUTABLE], [ - # Only process if variable expands to non-empty + input="[$]$1" - if test "x[$]$1" != x; then - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - UTIL_FIXUP_EXECUTABLE_CYGWIN($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - UTIL_FIXUP_EXECUTABLE_MSYS($1) - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - UTIL_FIXUP_EXECUTABLE_WSL($1) + # Only process if variable expands to non-empty + if test "x$input" != x; then + # First separate the path from the arguments. This will split at the first + # space. + [ if [[ "$OPENJDK_BUILD_OS" = "windows" && input =~ ^$FIXPATH ]]; then + line="${input#$FIXPATH }" + prefix="$FIXPATH " else - # We're on a unix platform. Hooray! :) - # First separate the path from the arguments. This will split at the first - # space. - complete="[$]$1" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Cannot rely on the command "which" here since it doesn't always work. - is_absolute_path=`$ECHO "$path" | $GREP ^/` - if test -z "$is_absolute_path"; then - # Path to executable is not absolute. Find it. - IFS_save="$IFS" - IFS=: - for p in $PATH; do - if test -f "$p/$path" && test -x "$p/$path"; then - new_path="$p/$path" - break - fi - done - IFS="$IFS_save" - else - # This is an absolute path, we can use it without further modifications. + line="$input" + prefix="" + fi ] + path="${line%% *}" + arguments="${line#"$path"}" + + [ if ! [[ "$path" =~ /|\\ ]]; then ] + # This is a command without path (e.g. "gcc" or "echo") + command_type=`type -t "$path"` + if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then + # Shell builtin or keyword; we're done here new_path="$path" + else + # Search in $PATH using bash built-in 'type -p'. + saved_path="$PATH" + if test "x$2" != x; then + PATH="$2" + fi + new_path=`type -p "$path"` + if test "x$new_path" = x && test "x$OPENJDK_BUILD_OS" = "xwindows"; then + # Try again with .exe + new_path="`type -p "$path.exe"`" + fi + PATH="$saved_path" + + if test "x$new_path" = x; then + AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found in the PATH.]) + AC_MSG_ERROR([Cannot locate $path]) + fi fi + else + # This is a path with slashes, don't look at $PATH + if test "x$OPENJDK_BUILD_OS" = "xwindows"; then + # fixpath.sh import will do all heavy lifting for us + new_path=`$FIXPATH_BASE import "$path"` + + if test ! -e $new_path; then + # It failed, but maybe spaces were part of the path and not separating + # the command and argument. Retry using that assumption. + new_path=`$FIXPATH_BASE import "$input"` + if test ! -e $new_path; then + AC_MSG_NOTICE([The command for $1, which resolves as "$input", can not be found.]) + AC_MSG_ERROR([Cannot locate $input]) + fi + # It worked, clear all "arguments" + arguments="" + fi + else # on unix + # Make absolute + $1="$path" + UTIL_FIXUP_PATH($1, NOFAIL) + new_path="[$]$1" + + if test ! -e $new_path; then + AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not found]) + [ if [[ "$path" =~ " " ]]; then ] + AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) + fi + AC_MSG_ERROR([Cannot locate $path]) + fi + if test ! -x $new_path; then + AC_MSG_NOTICE([The command for $1, which resolves as "$input", is not executable.]) + AC_MSG_ERROR([Cannot execute command at $path]) + fi + fi # end on unix + fi # end with or without slashes - if test "x$new_path" = x; then - AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) + # Now we have a usable command as new_path, with arguments in arguments + if test "x$OPENJDK_BUILD_OS" = "xwindows"; then + if test "x$prefix" = x; then + # Only mess around if prefix was not given + UTIL_CHECK_WINENV_EXEC_TYPE("$new_path") + if test "x$RESULT" = xwindows; then + prefix="$FIXPATH " + # make sure we have an .exe suffix (but not two) + new_path="${new_path%.exe}.exe" + else + # If we have gotten a .exe suffix, remove it + new_path="${new_path%.exe}" fi - AC_MSG_ERROR([Cannot locate the the path of $1]) fi fi + if test "x$3" = xNOFIXPATH; then + prefix="" + fi + # Now join together the path and the arguments once again - if test "x$arguments" != xEOL; then - new_complete="$new_path ${arguments% *}" + new_complete="$prefix$new_path$arguments" + $1="$new_complete" + fi +]) + +############################################################################### +# 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 +# $3: code snippet to call if variable was used to find tool +AC_DEFUN([UTIL_SETUP_TOOL], +[ + # Publish this variable in the help. + AC_ARG_VAR($1, [Override default value for $1]) + + if [[ -z "${$1+x}" ]]; then + # The variable is not set by user, try to locate tool using the code snippet + $2 + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !$1! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/} + if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then + # If it failed, the variable was not from the command line. Ignore it, + # but warn the user (except for BASH, which is always set by the calling BASH). + if test "x$1" != xBASH; then + AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.]) + fi + # Try to locate tool using the code snippet + $2 else - new_complete="$new_path" + # If it succeeded, then it was overridden by the user. We will use it + # for the tool. + + # First remove it from the list of overridden variables, so we can test + # for unknown variables in the end. + CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var" + + tool_override=[$]$1 + + # Check if we try to supply an empty value + if test "x$tool_override" = x; then + AC_MSG_CHECKING([for $1]) + AC_MSG_RESULT([[[disabled by user]]]) + else + # Split up override in command part and argument part + tool_and_args=($tool_override) + [ tool_command=${tool_and_args[0]} ] + [ unset 'tool_and_args[0]' ] + [ tool_args=${tool_and_args[@]} ] + + # Check if the provided tool contains a complete path. + tool_basename="${tool_command##*/}" + if test "x$tool_basename" = "x$tool_command"; then + # A command without a complete path is provided, search $PATH. + AC_MSG_NOTICE([Will search for user supplied tool "$tool_basename"]) + AC_PATH_PROGS($1, $tool_basename ${tool_basename}.exe) + tool_command="[$]$1" + if test "x$tool_command" = x; then + AC_MSG_ERROR([User supplied tool $1="$tool_basename" could not be found in PATH]) + fi + else + # Otherwise we believe it is a complete path. Use it as it is. + if test ! -x "$tool_command" && test ! -x "${tool_command}.exe"; then + AC_MSG_ERROR([User supplied tool $1="$tool_command" does not exist or is not executable]) + fi + if test ! -x "$tool_command"; then + tool_command="${tool_command}.exe" + fi + $1="$tool_command" + fi + if test "x$tool_args" != x; then + # If we got arguments, re-append them to the command after the fixup. + $1="[$]$1 $tool_args" + fi + AC_MSG_CHECKING([for $1]) + AC_MSG_RESULT([[$]$1 [[user supplied]]]) + fi + fi + $3 + fi +]) + +############################################################################### +# Locate a tool using proper methods. +# $1: variable to set +# $2: executable name (or list of names) to look for +# $3: [path] +# $4: set to NOFIXPATH to skip prefixing FIXPATH, even if needed on platform +AC_DEFUN([UTIL_LOOKUP_PROGS], +[ + UTIL_SETUP_TOOL($1, [ + $1="" + + if test "x$3" != x; then + old_path="$PATH" + PATH="$3" fi - if test "x$complete" != "x$new_complete"; then - $1="$new_complete" - AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) + for name in $2; do + AC_MSG_CHECKING(for $name) + + command_type=`type -t "$name"` + if test "x$command_type" = xbuiltin || test "x$command_type" = xkeyword; then + # Shell builtin or keyword; we're done here + full_path="$name" + $1="$full_path" + AC_MSG_RESULT([[$full_path [builtin]]]) + break + else + # Search in $PATH + old_ifs="$IFS" + IFS=":" + for elem in $PATH; do + IFS="$old_ifs" + if test "x$elem" = x; then + continue + fi + full_path="$elem/$name" + if test ! -e "$full_path" && test "x$OPENJDK_BUILD_OS" = "xwindows"; then + # Try again with .exe + full_path="$elem/$name.exe" + fi + if test -e "$full_path"; then + $1="$full_path" + UTIL_FIXUP_EXECUTABLE($1, $3, $4) + result="[$]$1" + + # If we have FIXPATH enabled, strip all instances of it and prepend + # a single one, to avoid double fixpath prefixing. + if test "x$4" != xNOFIXPATH; then + [ if [[ $FIXPATH != "" && $result =~ ^"$FIXPATH " ]]; then ] + result="\$FIXPATH ${result#"$FIXPATH "}" + fi + fi + AC_MSG_RESULT([$result]) + break 2; + fi + done + IFS="$old_ifs" + fi + AC_MSG_RESULT([[[not found]]]) + done + + if test "x$3" != x; then + PATH="$old_path" fi + ]) +]) + +############################################################################### +# Call UTIL_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool. This will look +# first for cross-compilation tools. +# $1: variable to set +# $2: executable name (or list of names) to look for +# $3: [path] +AC_DEFUN([UTIL_LOOKUP_TOOLCHAIN_PROGS], +[ + if test "x$ac_tool_prefix" = x; then + UTIL_LOOKUP_PROGS($1, $2, $3) + else + prefixed_names=$(for name in $2; do echo ${ac_tool_prefix}${name} $name; done) + UTIL_LOOKUP_PROGS($1, $prefixed_names, $3) + fi +]) + +############################################################################### +# Test that variable $1 denoting a program is not empty. If empty, exit with an error. +# $1: variable to check +AC_DEFUN([UTIL_CHECK_NONEMPTY], +[ + if test "x[$]$1" = x; then + AC_MSG_ERROR([Could not find required tool for $1]) + fi +]) + +############################################################################### +# Like UTIL_LOOKUP_PROGS but fails if no tool was found. +# $1: variable to set +# $2: executable name (or list of names) to look for +# $3: [path] +AC_DEFUN([UTIL_REQUIRE_PROGS], +[ + UTIL_LOOKUP_PROGS($1, $2, $3) + UTIL_CHECK_NONEMPTY($1) +]) + +############################################################################### +# Like UTIL_LOOKUP_PROGS but fails if no tool was found. +# $1: variable to set +# $2: executable name (or list of names) to look for +# $3: [path] +AC_DEFUN([UTIL_REQUIRE_TOOLCHAIN_PROGS], +[ + UTIL_LOOKUP_TOOLCHAIN_PROGS($1, $2, $3) + UTIL_CHECK_NONEMPTY($1) +]) + + +############################################################################### +# Like UTIL_SETUP_TOOL but fails if no tool was found. +# $1: variable to set +# $2: autoconf macro to call to look for the special tool +AC_DEFUN([UTIL_REQUIRE_SPECIAL], +[ + UTIL_SETUP_TOOL($1, [$2]) + UTIL_CHECK_NONEMPTY($1) + # The special macro will return an absolute path, and is only used for + # unix tools. No further processing needed. +]) + +############################################################################### +# Add FIXPATH prefix to variable. Normally this is done by UTIL_LOOKUP_PROGS +# or UTIL_FIXUP_EXECUTABLE, but in some circumstances this has to be done +# explicitly, such as when the command in question does not exist yet. +# +# $1: variable to add fixpath to +AC_DEFUN([UTIL_ADD_FIXPATH], +[ + if test "x$FIXPATH" != x; then + $1="$FIXPATH [$]$1" fi ]) @@ -208,8 +517,8 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS], sym_link_file=`$BASENAME [$]$1` cd $sym_link_dir # Use -P flag to resolve symlinks in directories. - cd `$THEPWDCMD -P` - sym_link_dir=`$THEPWDCMD -P` + cd `pwd -P` + sym_link_dir=`pwd -P` # Resolve file symlinks while test $COUNTER -lt 20; do ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` @@ -220,7 +529,7 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS], # Again resolve directory symlinks since the target of the just found # link could be in a different directory cd `$DIRNAME $ISLINK` - sym_link_dir=`$THEPWDCMD -P` + sym_link_dir=`pwd -P` sym_link_file=`$BASENAME $ISLINK` let COUNTER=COUNTER+1 done @@ -229,4 +538,3 @@ AC_DEFUN([UTIL_REMOVE_SYMBOLIC_LINKS], fi fi ]) - diff --git a/make/autoconf/util_windows.m4 b/make/autoconf/util_windows.m4 deleted file mode 100644 index 868c436bcb394..0000000000000 --- a/make/autoconf/util_windows.m4 +++ /dev/null @@ -1,451 +0,0 @@ -# -# Copyright (c) 2011, 2020, 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. -# - -AC_DEFUN([UTIL_REWRITE_AS_UNIX_PATH], -[ - windows_path="[$]$1" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - unix_path=`$CYGPATH -u "$windows_path"` - $1="$unix_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` - $1="$unix_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - # wslpath does not check the input, only call if an actual windows path was - # given. - if $ECHO "$windows_path" | $GREP -q ["^[a-zA-Z]:[\\\\/]"]; then - unix_path=`$WSLPATH -u "$windows_path"` - $1="$unix_path" - fi - fi -]) - -AC_DEFUN([UTIL_REWRITE_AS_WINDOWS_MIXED_PATH], -[ - unix_path="[$]$1" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - windows_path=`$CYGPATH -m "$unix_path"` - $1="$windows_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then - windows_path=`cmd //c echo $unix_path` - $1="$windows_path" - elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then - windows_path=`$WSLPATH -m "$unix_path" 2>/dev/null` - if test $? -ne 0; then - dir=`dirname "$unix_path"` - base=`basename "$unix_path"` - windows_path=`$WSLPATH -m "$dir"`/"$base" - if test $? -ne 0; then - AC_MSG_ERROR([Cannot convert "$unix_path" to Windows path]) - fi - fi - $1="$windows_path" - fi -]) - -# Helper function which possibly converts a path using DOS-style short mode. -# If so, the updated path is stored in $new_path. -# $1: The path to check -AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN], -[ - input_path="$1" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-._/a-zA-Z0-9@:>@` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - shortmode_path=`$CYGPATH -s -m -a "$input_path"` - path_after_shortmode=`$CYGPATH -u "$shortmode_path"` - if test "x$path_after_shortmode" != "x$input_to_shortpath"; then - # Going to short mode and back again did indeed matter. Since short mode is - # case insensitive, let's make it lowercase to improve readability. - shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Now convert it back to Unix-style (cygpath) - input_path=`$CYGPATH -u "$shortmode_path"` - new_path="$input_path" - fi - fi - - test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` - if test "x$test_cygdrive_prefix" = x; then - # As a simple fix, exclude /usr/bin since it's not a real path. - if test "x`$ECHO $1 | $GREP ^/usr/bin/`" = x; then - # The path is in a Cygwin special directory (e.g. /home). We need this converted to - # a path prefixed by /cygdrive for fixpath to work. - new_path="$CYGWIN_ROOT_PATH$input_path" - fi - fi -]) - -# Helper function which possibly converts a path using DOS-style short mode. -# If so, the updated path is stored in $new_path. -# $1: The path to check -AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS], -[ - input_path="$1" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP @<:@^-_/:a-zA-Z0-9@:>@` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - fi -]) - -# Helper function which possibly converts a path using DOS-style short mode. -# If so, the updated path is stored in $new_path. -# $1: The path to check -AC_DEFUN([UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL], -[ - input_path="$1" - # Check if we need to convert this using DOS-style short mode. If the path - # contains just simple characters, use it. Otherwise (spaces, weird characters), - # take no chances and rewrite it. - # Note: m4 eats our [], so we need to use @<:@ and @:>@ instead. - has_forbidden_chars=`$ECHO "$input_path" | $GREP [[^-_/:a-zA-Z0-9\\.]]` - if test "x$has_forbidden_chars" != x; then - # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) - TOPDIR_windows="$TOPDIR" - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([TOPDIR_windows]) - # First convert to Windows path to make input valid for cmd - UTIL_REWRITE_AS_WINDOWS_MIXED_PATH([input_path]) - # Reset PATH since it can contain a mix of WSL/linux paths and Windows paths from VS, - # which, in combination with WSLENV, will make the WSL layer complain - old_path="$PATH" - PATH= - new_path=`$CMD /c $TOPDIR_windows/make/scripts/windowsShortName.bat "$input_path" \ - | $SED -e 's|\r||g' \ - | $TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Rewrite back to unix style - PATH="$old_path" - UTIL_REWRITE_AS_UNIX_PATH([new_path]) - fi -]) - -# FIXME: The UTIL_FIXUP_*_CYGWIN/MSYS is most likely too convoluted -# and could probably be heavily simplified. However, all changes in this -# area tend to need lot of testing in different scenarios, and in lack of -# proper unit testing, cleaning this up has not been deemed worth the effort -# at the moment. - -AC_DEFUN([UTIL_FIXUP_PATH_CYGWIN], -[ - # Input might be given as Windows format, start by converting to - # unix format. - path="[$]$1" - new_path=`$CYGPATH -u "$path"` - - UTIL_ABSOLUTE_PATH(new_path) - - # Cygwin tries to hide some aspects of the Windows file system, such that binaries are - # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered - # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then - # "foo.exe" is OK but "foo" is an error. - # - # This test is therefore slightly more accurate than "test -f" to check for file precense. - # It is also a way to make sure we got the proper file name for the real test later on. - test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` - if test "x$test_shortpath" = x; then - AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$new_path]) - - if test "x$path" != "x$new_path"; then - $1="$new_path" - AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) - fi -]) - -AC_DEFUN([UTIL_FIXUP_PATH_MSYS], -[ - path="[$]$1" - has_colon=`$ECHO $path | $GREP ^.:` - new_path="$path" - if test "x$has_colon" = x; then - # Not in mixed or Windows style, start by that. - new_path=`cmd //c echo $path` - fi - - UTIL_ABSOLUTE_PATH(new_path) - - UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path]) - UTIL_REWRITE_AS_UNIX_PATH(new_path) - if test "x$path" != "x$new_path"; then - $1="$new_path" - AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) - fi - - # Save the first 10 bytes of this path to the storage, so fixpath can work. - all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}") -]) - -AC_DEFUN([UTIL_FIXUP_PATH_WSL], -[ - # Input might be given as Windows format, start by converting to - # unix format. - new_path="[$]$1" - UTIL_REWRITE_AS_UNIX_PATH([new_path]) - - UTIL_ABSOLUTE_PATH(new_path) - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL([$new_path]) - - if test "x$path" != "x$new_path"; then - $1="$new_path" - AC_MSG_NOTICE([Rewriting $1 to "$new_path"]) - fi -]) - -AC_DEFUN([UTIL_FIXUP_EXECUTABLE_CYGWIN], -[ - # First separate the path from the arguments. This will split at the first - # space. - complete="[$]$1" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Input might be given as Windows format, start by converting to - # unix format. - new_path=`$CYGPATH -u "$path"` - - # Now try to locate executable using which - new_path=`type -p "$new_path" 2> /dev/null` - # bat and cmd files are not always considered executable in cygwin causing which - # to not find them - if test "x$new_path" = x \ - && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ - && test "x`$LS \"$path\" 2>/dev/null`" != x; then - new_path=`$CYGPATH -u "$path"` - fi - if test "x$new_path" = x; then - # Oops. Which didn't find the executable. - # The splitting of arguments from the executable at a space might have been incorrect, - # since paths with space are more likely in Windows. Give it another try with the whole - # argument. - path="$complete" - arguments="EOL" - new_path=`$CYGPATH -u "$path"` - new_path=`type -p "$new_path" 2> /dev/null` - # bat and cmd files are not always considered executable in cygwin causing which - # to not find them - if test "x$new_path" = x \ - && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ - && test "x`$LS \"$path\" 2>/dev/null`" != x; then - new_path=`$CYGPATH -u "$path"` - fi - if test "x$new_path" = x; then - # It's still not found. Now this is an unrecoverable error. - AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.]) - fi - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - fi - - # Cygwin tries to hide some aspects of the Windows file system, such that binaries are - # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered - # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then - # "foo.exe" is OK but "foo" is an error. - # - # This test is therefore slightly more accurate than "test -f" to check for file presence. - # It is also a way to make sure we got the proper file name for the real test later on. - test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` - if test "x$test_shortpath" = x; then - # Short path failed, file does not exist as specified. - # Try adding .exe or .cmd - if test -f "${new_path}.exe"; then - input_to_shortpath="${new_path}.exe" - elif test -f "${new_path}.cmd"; then - input_to_shortpath="${new_path}.cmd" - else - AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.]) - AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found]) - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - else - input_to_shortpath="$new_path" - fi - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - new_path="$input_to_shortpath" - UTIL_MAKE_WINDOWS_SPACE_SAFE_CYGWIN([$input_to_shortpath]) - # remove trailing .exe if any - new_path="${new_path/%.exe/}" -]) - -AC_DEFUN([UTIL_FIXUP_EXECUTABLE_MSYS], -[ - # First separate the path from the arguments. This will split at the first - # space. - complete="[$]$1" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Input might be given as Windows format, start by converting to - # unix format. - new_path="$path" - UTIL_REWRITE_AS_UNIX_PATH(new_path) - - # Now try to locate executable using which - new_path=`type -p "$new_path" 2> /dev/null` - - if test "x$new_path" = x; then - # Oops. Which didn't find the executable. - # The splitting of arguments from the executable at a space might have been incorrect, - # since paths with space are more likely in Windows. Give it another try with the whole - # argument. - path="$complete" - arguments="EOL" - new_path="$path" - UTIL_REWRITE_AS_UNIX_PATH(new_path) - - new_path=`type -p "$new_path" 2> /dev/null` - # bat and cmd files are not always considered executable in MSYS causing which - # to not find them - if test "x$new_path" = x \ - && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ - && test "x`$LS \"$path\" 2>/dev/null`" != x; then - new_path="$path" - UTIL_REWRITE_AS_UNIX_PATH(new_path) - fi - - if test "x$new_path" = x; then - # It's still not found. Now this is an unrecoverable error. - AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.]) - fi - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - fi - - # Now new_path has a complete unix path to the binary - if test "x`$ECHO $new_path | $GREP ^/bin/`" != x; then - # Keep paths in /bin as-is, but remove trailing .exe if any - new_path="${new_path/%.exe/}" - # Do not save /bin paths to all_fixpath_prefixes! - else - # Not in mixed or Windows style, start by that. - new_path=`cmd //c echo $new_path` - UTIL_MAKE_WINDOWS_SPACE_SAFE_MSYS([$new_path]) - # Output is in $new_path - UTIL_REWRITE_AS_UNIX_PATH(new_path) - # remove trailing .exe if any - new_path="${new_path/%.exe/}" - - # Save the first 10 bytes of this path to the storage, so fixpath can work. - all_fixpath_prefixes=("${all_fixpath_prefixes@<:@@@:>@}" "${new_path:0:10}") - fi -]) - -AC_DEFUN([UTIL_FIXUP_EXECUTABLE_WSL], -[ - # First separate the path from the arguments. This will split at the first - # space. - complete="[$]$1" - path="${complete%% *}" - tmp="$complete EOL" - arguments="${tmp#* }" - - # Input might be given as Windows format, start by converting to - # unix format. - new_path="$path" - UTIL_REWRITE_AS_UNIX_PATH([new_path]) - - # Now try to locate executable using which - new_path_bak="$new_path" - new_path=`type -p "$new_path" 2> /dev/null` - # bat and cmd files are not considered executable in WSL - if test "x$new_path" = x \ - && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ - && test "x`$LS \"$path\" 2>/dev/null`" != x; then - new_path="$new_path_back" - fi - if test "x$new_path" = x; then - # Oops. Which didn't find the executable. - # The splitting of arguments from the executable at a space might have been incorrect, - # since paths with space are more likely in Windows. Give it another try with the whole - # argument. - path="$complete" - arguments="EOL" - new_path="$path" - UTIL_REWRITE_AS_UNIX_PATH([new_path]) - new_path_bak="$new_path" - new_path=`type -p "$new_path" 2> /dev/null` - # bat and cmd files are not considered executable in WSL - if test "x$new_path" = x \ - && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \ - && test "x`$LS \"$path\" 2>/dev/null`" != x; then - new_path="$new_path_bak" - fi - if test "x$new_path" = x; then - # It's still not found. Now this is an unrecoverable error. - AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) - has_space=`$ECHO "$complete" | $GREP " "` - if test "x$has_space" != x; then - AC_MSG_NOTICE([You might be mixing spaces in the path and extra arguments, which is not allowed.]) - fi - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - fi - - # In WSL, suffixes must be present for Windows executables - if test ! -f "$new_path"; then - # Try adding .exe or .cmd - if test -f "${new_path}.exe"; then - input_to_shortpath="${new_path}.exe" - elif test -f "${new_path}.cmd"; then - input_to_shortpath="${new_path}.cmd" - else - AC_MSG_NOTICE([The path of $1, which resolves as "$new_path", is invalid.]) - AC_MSG_NOTICE([Neither "$new_path" nor "$new_path.exe/cmd" can be found]) - AC_MSG_ERROR([Cannot locate the the path of $1]) - fi - else - input_to_shortpath="$new_path" - fi - - # Call helper function which possibly converts this using DOS-style short mode. - # If so, the updated path is stored in $new_path. - new_path="$input_to_shortpath" - UTIL_MAKE_WINDOWS_SPACE_SAFE_WSL([$input_to_shortpath]) -]) - diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 00affb4ea02c3..1d25dc6dbeba3 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -227,25 +227,19 @@ define SetupJavaCompilationBody # The portfile contains the tcp/ip on which the server listens # and the cookie necessary to talk to the server. - $1_JAVAC_PORT_FILE := $$(JAVAC_SERVER_DIR)/server.port + $1_JAVAC_PORT_FILE := $$(call FixPath, $$(JAVAC_SERVER_DIR)/server.port) - # The servercmd specified how to launch the server. This must use - # JAVA_DETACH, which is the "big" java with an ability to detach from - # fixpath (on Windows) This will be executed by the client, if needed. - $1_JAVAC_SERVER_CMD := $$(JAVA_DETACH) $$($1_JAVA_FLAGS) $$($1_JAVAC) + # The servercmd specifies how to launch the server. This will be executed + # by the client, if needed. + $1_JAVAC_SERVER_CMD := $$(call FixPath, $$(JAVA) $$($1_JAVA_FLAGS) $$($1_JAVAC)) $1_CONFIG_VARDEPS := $$($1_JAVAC_PORT_FILE) $$($1_JAVAC_SERVER_CMD) $1_CONFIG_VARDEPS_FILE := $$(call DependOnVariable, $1_CONFIG_VARDEPS, \ $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.config_vardeps) - ifeq ($(call isBuildOs, windows), true) - $1_ECHO_COMMAND := $(FIXPATH) cmd /c echo - else - $1_ECHO_COMMAND := $(ECHO) - endif $$($1_JAVAC_SERVER_CONFIG): $$($1_CONFIG_VARDEPS_FILE) - $$($1_ECHO_COMMAND) portfile=$$($1_JAVAC_PORT_FILE) > $$@ - $$($1_ECHO_COMMAND) servercmd=$$($1_JAVAC_SERVER_CMD) >> $$@ + $(ECHO) portfile=$$($1_JAVAC_PORT_FILE) > $$@ + $(ECHO) servercmd=$$($1_JAVAC_SERVER_CMD) >> $$@ # Always use small java to launch client $1_JAVAC_CMD := $$(JAVA_SMALL) $$($1_JAVA_FLAGS) $$($1_JAVAC) \ diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 7efd9009eb6e5..a9d806da0c070 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -64,6 +64,9 @@ define NEWLINE endef +# Make sure we have a value (could be overridden on command line by caller) +CREATING_BUILDJDK ?= false + # Certain features only work in newer version of GNU Make. The build will still # function in 3.81, but will be less performant. ifeq (4.0, $(firstword $(sort 4.0 $(MAKE_VERSION)))) @@ -436,38 +439,15 @@ endif # On Windows, converts a path from cygwin/unix style (e.g. /bin/foo) into # "mixed mode" (e.g. c:/cygwin/bin/foo). On other platforms, return the path # unchanged. +# This also converts a colon-separated list of paths to a semicolon-separated +# list. # This is normally not needed since we use the FIXPATH prefix for command lines, # but might be needed in certain circumstances. ifeq ($(call isTargetOs, windows), true) - FixPathArgs = \ - $(shell $(FIXPATH) cmd /c echo $1) - ifeq ($(call isBuildOsEnv, windows.wsl), true) - FixPath = \ - $(shell $(WSLPATH) -m $1) - else - FixPath = \ - $(shell $(CYGPATH) -m $1) - endif -else - FixPathArgs = \ - $1 FixPath = \ - $1 -endif - -################################################################################ -# FixPathList -# -# On Windows, converts a cygwin/unix style path list (colon-separated) into -# the native format (mixed mode, semicolon-separated). On other platforms, -# return the path list unchanged. -################################################################################ -ifeq ($(call isTargetOs, windows), true) - FixPathList = \ - $(subst @,$(SPACE),$(subst $(SPACE),;,$(foreach entry,$(subst :,$(SPACE),\ - $(subst $(SPACE),@,$(strip $1))),$(call FixPath, $(entry))))) + $(strip $(subst \,\\, $(shell $(FIXPATH_BASE) print $(patsubst $(FIXPATH), , $1)))) else - FixPathList = \ + FixPath = \ $1 endif diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 6901d6d003f54..db2a0ba115642 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -72,10 +72,10 @@ define WriteCompileCommandsFragment $(call LogInfo, Creating compile commands fragment for $(notdir $3)) $(call MakeDir, $(dir $1)) $(call WriteFile,{ \ - "directory": "$(strip $(call FixPathArgs, $2))"$(COMMA) \ - "file": "$(strip $(call FixPathArgs, $3))"$(COMMA) \ + "directory": "$(strip $(call FixPath, $2))"$(COMMA) \ + "file": "$(strip $(call FixPath, $3))"$(COMMA) \ "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\ - $(subst $(FIXPATH),,$(call FixPathArgs, $4)))))" \ + $(subst $(FIXPATH),,$(call FixPath, $4)))))" \ }$(COMMA), \ $1) endef @@ -175,12 +175,6 @@ $(strip \ ) endef -ifeq ($(call isBuildOsEnv, windows.cygwin), true) - UNIX_PATH_PREFIX := /cygdrive -else ifeq ($(call isBuildOsEnv, windows.msys), true) - UNIX_PATH_PREFIX := -endif - # This pattern is used to transform the output of the microsoft CL compiler # into a make syntax dependency file (.d) WINDOWS_SHOWINCLUDE_SED_PATTERN := \ @@ -188,7 +182,7 @@ WINDOWS_SHOWINCLUDE_SED_PATTERN := \ -e 's|Note: including file: *||' \ -e 's|\r||g' \ -e 's|\\|/|g' \ - -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \ + -e 's|^\([a-zA-Z]\):|$(WINENV_PREFIX)/\1|g' \ -e '\|$(TOPDIR)|I !d' \ -e 's|$$$$| \\|g' \ # @@ -542,7 +536,7 @@ define SetupNativeCompilationBody ifeq ($$($1_TYPE), EXECUTABLE) $1_PREFIX := ifeq ($$($1_SUFFIX), ) - $1_SUFFIX := $(EXE_SUFFIX) + $1_SUFFIX := $(EXECUTABLE_SUFFIX) endif else $1_PREFIX := $(LIBRARY_PREFIX) @@ -1163,6 +1157,9 @@ define SetupNativeCompilationBody test "$$$$?" = "1" ; \ $$($1_CREATE_DEBUGINFO_CMDS) $$($1_STRIP_CMD) + ifeq ($(call isBuildOsEnv, windows.wsl2), true) + $$(CHMOD) +x $$($1_TARGET) + endif else $$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \ $$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \ diff --git a/make/common/Utils.gmk b/make/common/Utils.gmk index 8f6f40c26570d..a7df32065aeab 100644 --- a/make/common/Utils.gmk +++ b/make/common/Utils.gmk @@ -278,7 +278,7 @@ FindExecutableDirForModule = \ # param 1 : A space separated list of classpath entries # The surrounding strip is needed to keep additional whitespace out PathList = \ - "$(subst $(SPACE),$(PATH_SEP),$(strip $(subst $(DQUOTE),,$1)))" + "$(subst $(SPACE),:,$(strip $(subst $(DQUOTE),,$1)))" ################################################################################ # Check if a specified hotspot variant is being built, or at least one of a diff --git a/make/common/modules/GensrcCommonLangtools.gmk b/make/common/modules/GensrcCommonLangtools.gmk index 44e46aa525396..fc4be63335142 100644 --- a/make/common/modules/GensrcCommonLangtools.gmk +++ b/make/common/modules/GensrcCommonLangtools.gmk @@ -85,14 +85,16 @@ define SetupCompileProperties $$(addprefix _SPACE_, $$(PROPJAVAS))))) # Now setup the rule for the generation of the resource bundles. - $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES) + PROPS_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props + $$(PROPS_BASE): $$(PROPSOURCES) $$(call MakeDir, $$(@D) $$(PROPDIRS)) $(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE) $(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE) - $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE) + $$(call ExecuteWithLog, $$(PROPS_BASE)_exec, \ + $(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)) $(TOUCH) $$@ - $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props + $$(strip $1) += $$(PROPS_BASE) endef ################################################################################ diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 6d68964a0fde1..2bd8ac926d577 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -240,7 +240,7 @@ var getJibProfilesCommon = function (input, data) { // List of the main profile names used for iteration common.main_profile_names = [ "linux-x64", "linux-x86", "macosx-x64", - "windows-x64", "windows-x86", + "windows-x64", "windows-x86", "windows-aarch64", "linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x" ]; @@ -461,6 +461,15 @@ var getJibProfilesProfiles = function (input, common, data) { configure_args: concat(common.configure_args_32bit), }, + "windows-aarch64": { + target_os: "windows", + target_cpu: "aarch64", + dependencies: ["devkit", "gtest", "build_devkit"], + configure_args: [ + "--openjdk-target=aarch64-unknown-cygwin", + ], + }, + "linux-aarch64": { target_os: "linux", target_cpu: "aarch64", @@ -673,6 +682,10 @@ var getJibProfilesProfiles = function (input, common, data) { platform: "windows-x86", jdk_suffix: "zip", }, + "windows-aarch64": { + platform: "windows-aarch64", + jdk_suffix: "zip", + }, "linux-aarch64": { platform: "linux-aarch64", }, @@ -1014,7 +1027,7 @@ var getJibProfilesDependencies = function (input, common) { var devkit_platform_revisions = { linux_x64: "gcc10.2.0-OL6.4+1.0", macosx_x64: "Xcode11.3.1-MacOSX10.15+1.1", - windows_x64: "VS2019-16.7.2+1.0", + windows_x64: "VS2019-16.7.2+1.1", linux_aarch64: "gcc10.2.0-OL7.6+1.0", linux_arm: "gcc8.2.0-Fedora27+1.0", linux_ppc64le: "gcc8.2.0-Fedora27+1.0", @@ -1024,9 +1037,11 @@ var getJibProfilesDependencies = function (input, common) { var devkit_platform = (input.target_cpu == "x86" ? input.target_os + "_x64" : input.target_platform); - + if (input.target_platform == "windows_aarch64") { + devkit_platform = "windows_x64"; + } var devkit_cross_prefix = ""; - if (!(input.target_os == "windows" && isWsl(input))) { + if (!(input.target_os == "windows")) { if (input.build_platform != input.target_platform && input.build_platform != devkit_platform) { devkit_cross_prefix = input.build_platform + "-to-"; diff --git a/make/hotspot/test/GtestImage.gmk b/make/hotspot/test/GtestImage.gmk index 74077e4798721..322a90b3d1061 100644 --- a/make/hotspot/test/GtestImage.gmk +++ b/make/hotspot/test/GtestImage.gmk @@ -32,7 +32,7 @@ $(foreach v, $(JVM_VARIANTS), \ $(eval $(call SetupCopyFiles, COPY_GTEST_$v, \ SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \ DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ - FILES := $(call SHARED_LIBRARY,jvm) gtestLauncher$(EXE_SUFFIX), \ + FILES := $(call SHARED_LIBRARY,jvm) gtestLauncher$(EXECUTABLE_SUFFIX), \ )) \ $(eval TARGETS += $$(COPY_GTEST_$v)) \ ) diff --git a/make/ide/idea/jdk/idea.gmk b/make/ide/idea/jdk/idea.gmk index 9d286c961d1c2..310b582591c91 100644 --- a/make/ide/idea/jdk/idea.gmk +++ b/make/ide/idea/jdk/idea.gmk @@ -51,7 +51,7 @@ else #with SPEC $(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT) $(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT) $(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT) - $(ECHO) "CYGPATH=\"$(CYGPATH)\"" >> $(OUT) + $(ECHO) "CYGPATH=\"$(PATHTOOL)\"" >> $(OUT) $(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT) $(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT) diff --git a/make/ide/visualstudio/hotspot/CreateVSProject.gmk b/make/ide/visualstudio/hotspot/CreateVSProject.gmk index b463beec435df..f60f7c62489ac 100644 --- a/make/ide/visualstudio/hotspot/CreateVSProject.gmk +++ b/make/ide/visualstudio/hotspot/CreateVSProject.gmk @@ -44,18 +44,10 @@ ifeq ($(call isTargetOs, windows), true) # Reset targets so we don't build libjvm. TARGETS := - # Helper macro to convert a unix path to a Windows path, suitable for - # inclusion in a command line. - ifeq ($(call isBuildOsEnv, windows.cygwin), true) - FixPath = \ - $(strip $(subst \,\\,$(shell $(CYGPATH) -w $1))) - FixLinuxExecutable = \ - $(call FixPath, $1) - else ifeq ($(call isBuildOsEnv, windows.wsl), true) - FixPath = \ - $(strip $(subst \,\\,$(shell $(WSLPATH) -w $1))) - FixLinuxExecutable = \ - "%windir%\Sysnative\wsl.exe $1" + ifeq ($(call isBuildOsEnv, windows.cygwin windows.msys2), true) + FixLinuxExecutable = $(call FixPath, $1) + else ifeq ($(call isBuildOsEnv, windows.wsl1 windows.wsl2), true) + FixLinuxExecutable = "%windir%\Sysnative\wsl.exe $1" endif JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS))) diff --git a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk index 4405b31004e72..8b82c38a7518e 100644 --- a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk +++ b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk @@ -86,7 +86,7 @@ define CreateFromTemplate -e 's!{{CONF_NAME}}!$(CONF_NAME)!g' \ -e 's!{{COMPILER}}!$(call FixPath,$(CXX)) $(SYSROOT_CFLAGS)!g' \ -e 's!{{MAKE}}!$(call FixPath,$(MAKE))!g' \ - -e 's!{{PATH}}!$(call FixPathList,$(PATH))!g' \ + -e 's!{{PATH}}!$(call FixPath,$(PATH))!g' \ -e 's!{{DEBUGENGINENAME}}!$(call DebugEngineName)!g' \ -e '/{{INDEXER_EXTENSIONS}}/d' \ -e '/{{INDEXER_SETTINGS}}/d' \ diff --git a/make/jdk/src/classes/build/tools/generatecharacter/GenerateCharacter.java b/make/jdk/src/classes/build/tools/generatecharacter/GenerateCharacter.java index 432cd654eb35c..a21b662e2acec 100644 --- a/make/jdk/src/classes/build/tools/generatecharacter/GenerateCharacter.java +++ b/make/jdk/src/classes/build/tools/generatecharacter/GenerateCharacter.java @@ -1841,7 +1841,7 @@ else if (args[j].equals("-latin1")) { } commentStart = (Csyntax ? "/*" : "//"); commentEnd = (Csyntax ? " */" : ""); - commandLineDescription = desc.toString(); + commandLineDescription = desc.toString().replace("\\", "\\\\"); } private static void searchBins(long[] map, int binsOccupied) throws Exception { diff --git a/make/modules/java.base/Copy.gmk b/make/modules/java.base/Copy.gmk index 040b7588ba1fe..dfa2a54f63af3 100644 --- a/make/modules/java.base/Copy.gmk +++ b/make/modules/java.base/Copy.gmk @@ -44,8 +44,11 @@ ifeq ($(call isTargetOs, aix), true) endif ################################################################################ -# Copy the microsoft runtime libraries on windows -ifeq ($(call isTargetOs, windows), true) +# Copy the microsoft runtime libraries on windows, but only if we are not +# creating a buildjdk. If we are, the provided runtime librareis are made for +# the target platform, not the build platform (and we should not need to bundle +# anything with the minimalistic, locally-only buildjdk.) +ifeq ($(call isTargetOs, windows)+$(CREATING_BUILDJDK), true+false) # Chmod to avoid permission issues if bundles are unpacked on unix platforms. define copy-and-chmod diff --git a/make/modules/java.base/gensrc/GensrcCharacterData.gmk b/make/modules/java.base/gensrc/GensrcCharacterData.gmk index cdfc8a64c96db..868397f0c9ad5 100644 --- a/make/modules/java.base/gensrc/GensrcCharacterData.gmk +++ b/make/modules/java.base/gensrc/GensrcCharacterData.gmk @@ -32,13 +32,18 @@ GENSRC_CHARACTERDATA := CHARACTERDATA = $(TOPDIR)/make/data/characterdata UNICODEDATA = $(TOPDIR)/make/data/unicodedata +ifneq ($(DEBUG_LEVEL), release) + ifeq ($(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true) + DEBUG_OPTION := -d + endif +endif + define SetupCharacterData $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \ $(CHARACTERDATA)/$1.java.template $$(call LogInfo, Generating $1.java) $$(call MakeDir, $$(@D)) - $(TOOL_GENERATECHARACTER) $2 \ - $(if $(call equals, $(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT), true), -d) \ + $(TOOL_GENERATECHARACTER) $2 $(DEBUG_OPTION) \ -template $(CHARACTERDATA)/$1.java.template \ -spec $(UNICODEDATA)/UnicodeData.txt \ -specialcasing $(UNICODEDATA)/SpecialCasing.txt \ diff --git a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk index 7622c1069a4bd..79fa54b19cc00 100644 --- a/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk +++ b/make/modules/java.base/gensrc/GensrcCharsetCoder.gmk @@ -36,7 +36,8 @@ GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Cod $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) $(call MakeTargetDir) $(RM) $@.tmp - $(TOOL_SPP) -i$< -o$@.tmp \ + $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_decoder, \ + $(TOOL_SPP) -i$< -o$@.tmp \ -Kdecoder \ -DA='A' \ -Da='a' \ @@ -61,7 +62,7 @@ $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) -DItypesPerOtype='CharsPerByte' \ -DnotLegal='not legal for this charset' \ -Dotypes-per-itype='chars-per-byte' \ - -DoutSequence='Unicode character' + -DoutSequence='Unicode character') $(MV) $@.tmp $@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java @@ -71,7 +72,8 @@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) $(call MakeTargetDir) $(RM) $@.tmp - $(TOOL_SPP) -i$< -o$@.tmp \ + $(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_charset_encoder, \ + $(TOOL_SPP) -i$< -o$@.tmp \ -Kencoder \ -DA='An' \ -Da='an' \ @@ -96,7 +98,7 @@ $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE) -DItypesPerOtype='BytesPerChar' \ -DnotLegal='not a legal sixteen-bit Unicode sequence' \ -Dotypes-per-itype='bytes-per-char' \ - -DoutSequence='byte sequence in the given charset' + -DoutSequence='byte sequence in the given charset') $(MV) $@.tmp $@ GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java diff --git a/make/scripts/windowsShortName.bat b/make/scripts/extract-vs-env.cmd similarity index 59% rename from make/scripts/windowsShortName.bat rename to make/scripts/extract-vs-env.cmd index 7730593e6c24a..096eb0dca57f6 100644 --- a/make/scripts/windowsShortName.bat +++ b/make/scripts/extract-vs-env.cmd @@ -1,6 +1,6 @@ @echo off REM -REM Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +REM Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. REM REM This code is free software; you can redistribute it and/or modify it @@ -21,4 +21,27 @@ REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA REM or visit www.oracle.com if you need additional information or have any REM questions. REM -if '%1' NEQ '' echo %~s1 + +set vcvarscmd=%1 +set output=%2 +if not "%3" == "auto" set version=-vcvars_ver=%3 + +set PATH_BEFORE=%PATH% + +call %vcvarscmd% %version% %4 %5 %6 %7 %8 %9 +if exist %output% del %output% + +call :extract "%PATH_BEFORE%", PATH_BEFORE +call :extract "%PATH%", PATH_AFTER +call :extract "%INCLUDE%", VS_INCLUDE +call :extract "%LIB%", VS_LIB +call :extract "%VCINSTALLDIR%", VCINSTALLDIR +call :extract "%VCToolsRedistDir%", VCToolsRedistDir +call :extract "%WindowsSdkDir%", WindowsSdkDir +call :extract "%WINDOWSSDKDIR%", WINDOWSSDKDIR + +exit /b 0 + +:extract +echo %~2=$($BASH $TOPDIR/make/scripts/fixpath.sh -i import '%~1 ') >> %output% +exit /b 0 diff --git a/make/scripts/fixpath.sh b/make/scripts/fixpath.sh new file mode 100644 index 0000000000000..dfee8c7c56249 --- /dev/null +++ b/make/scripts/fixpath.sh @@ -0,0 +1,498 @@ +#!/bin/bash +# +# Copyright (c) 2020, 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. +# + +# Setup the environment fixpath assumes. Read from command line options if +# available, or extract values automatically from the environment if missing. +# This is robust, but slower. +function setup() { + while getopts "e:p:r:t:c:qmi" opt; do + case "$opt" in + e) PATHTOOL="$OPTARG" ;; + p) DRIVEPREFIX="$OPTARG" ;; + r) ENVROOT="$OPTARG" ;; + t) WINTEMP="$OPTARG" ;; + c) CMD="$OPTARG" ;; + q) QUIET=true ;; + m) MIXEDMODE=true ;; + i) IGNOREFAILURES=true ;; + ?) + # optargs found argument error + exit 2 + ;; + esac + done + + shift $((OPTIND-1)) + ACTION="$1" + + # Locate variables ourself if not giving from caller + if [[ -z ${PATHTOOL+x} ]]; then + PATHTOOL="$(type -p cygpath)" + if [[ $PATHTOOL == "" ]]; then + PATHTOOL="$(type -p wslpath)" + if [[ $PATHTOOL == "" ]]; then + if [[ $QUIET != true ]]; then + echo fixpath: failure: Cannot locate cygpath or wslpath >&2 + fi + exit 2 + fi + fi + fi + + if [[ -z ${DRIVEPREFIX+x} ]]; then + winroot="$($PATHTOOL -u c:/)" + DRIVEPREFIX="${winroot%/c/}" + else + if [[ $DRIVEPREFIX == "NONE" ]]; then + DRIVEPREFIX="" + fi + fi + + if [[ -z ${ENVROOT+x} ]]; then + unixroot="$($PATHTOOL -w / 2> /dev/null)" + # Remove trailing backslash + ENVROOT="${unixroot%\\}" + elif [[ "$ENVROOT" == "[unavailable]" ]]; then + ENVROOT="" + fi + + if [[ -z ${CMD+x} ]]; then + CMD="$DRIVEPREFIX/c/windows/system32/cmd.exe" + fi + + if [[ -z ${WINTEMP+x} ]]; then + wintemp_win="$($CMD /q /c echo %TEMP% 2>/dev/null | tr -d \\n\\r)" + WINTEMP="$($PATHTOOL -u "$wintemp_win")" + fi + + # Make regexp tests case insensitive + shopt -s nocasematch + # Prohibit msys2 from meddling with paths + export MSYS2_ARG_CONV_EXCL="*" + # Make sure WSL gets a copy of the path + export WSLENV=PATH/l +} + +# Cleanup handling +TEMPDIRS="" +trap "cleanup" EXIT +function cleanup() { + if [[ "$TEMPDIRS" != "" ]]; then + rm -rf $TEMPDIRS + fi +} + +# Import a single path +# Result: imported path returned in $result +function import_path() { + path="$1" + # Strip trailing and leading space + path="${path#"${path%%[![:space:]]*}"}" + path="${path%"${path##*[![:space:]]}"}" + + if [[ $path =~ ^.:[/\\].*$ ]] || [[ "$path" =~ ^"$ENVROOT"\\.*$ ]] ; then + # We got a Windows path as input; use pathtool to convert to unix path + path="$($PATHTOOL -u "$path")" + # Path will now be absolute + else + # Make path absolute, and resolve embedded '..' in path + dirpart="$(dirname "$path")" + dirpart="$(cd "$dirpart" 2>&1 > /dev/null && pwd)" + if [[ $? -ne 0 ]]; then + if [[ $QUIET != true ]]; then + echo fixpath: failure: Directory containing path "'"$path"'" does not exist >&2 + fi + if [[ $IGNOREFAILURES != true ]]; then + exit 1 + else + path="" + fi + else + basepart="$(basename "$path")" + if [[ $dirpart == / ]]; then + # Avoid double leading / + dirpart="" + fi + if [[ $basepart == / ]]; then + # Avoid trailing / + basepart="" + fi + path="$dirpart/$basepart" + fi + fi + + if [[ "$path" != "" ]]; then + # Now turn it into a windows path + winpath="$($PATHTOOL -w "$path" 2>/dev/null)" + # If it fails, try again with an added .exe (needed on WSL) + if [[ $? -ne 0 ]]; then + winpath="$($PATHTOOL -w "$path.exe" 2>/dev/null)" + fi + if [[ $? -eq 0 ]]; then + if [[ ! "$winpath" =~ ^"$ENVROOT"\\.*$ ]] ; then + # If it is not in envroot, it's a generic windows path + if [[ ! $winpath =~ ^[-_.:\\a-zA-Z0-9]*$ ]] ; then + # Path has forbidden characters, rewrite as short name + # This monster of a command uses the %~s support from cmd.exe to + # reliably convert to short paths on all winenvs. + shortpath="$($CMD /q /c for %I in \( "$winpath" \) do echo %~sI 2>/dev/null | tr -d \\n\\r)" + path="$($PATHTOOL -u "$shortpath")" + # Path is now unix style, based on short name + fi + # Make it lower case + path="$(echo "$path" | tr [:upper:] [:lower:])" + fi + else + # On WSL1, PATHTOOL will fail for files in envroot. If the unix path + # exists, we assume that $path is a valid unix path. + + if [[ ! -e $path ]]; then + if [[ -e $path.exe ]]; then + path="$path.exe" + else + if [[ $QUIET != true ]]; then + echo fixpath: warning: Path "'"$path"'" does not exist >&2 + fi + # This is not a fatal error, maybe the path will be created later on + fi + fi + fi + fi + + if [[ "$path" =~ " " ]]; then + # Our conversion attempts failed. Perhaps the path did not exists, and thus + # we could not convert it to short name. + if [[ $QUIET != true ]]; then + echo fixpath: failure: Path "'"$path"'" contains space >&2 + fi + if [[ $IGNOREFAILURES != true ]]; then + exit 1 + else + path="" + fi + fi + + result="$path" +} + +# Import a single path, or a pathlist in Windows style (i.e. ; separated) +# Incoming paths can be in Windows or unix style. +# Returns in $result a converted path or path list +function import_command_line() { + imported="" + + old_ifs="$IFS" + IFS=";" + for arg in $1; do + if ! [[ $arg =~ ^" "+$ ]]; then + import_path "$arg" + + if [[ "$result" != "" && "$imported" = "" ]]; then + imported="$result" + else + imported="$imported:$result" + fi + fi + done + IFS="$old_ifs" + + result="$imported" +} + +# If argument seems to be colon separated path list, and all elements +# are possible to convert to paths, make a windows path list +# Return 0 if successful with converted path list in $result, or +# 1 if it was not a path list. +function convert_pathlist() { + converted_list="" + pathlist_args="$1" + + IFS=':' read -r -a arg_array <<< "$pathlist_args" + for arg in "${arg_array[@]}"; do + winpath="" + # Start looking for drive prefix + if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then + winpath="${BASH_REMATCH[2]}:${BASH_REMATCH[3]}" + # Change slash to backslash (or vice versa if mixed mode) + if [[ $MIXEDMODE != true ]]; then + winpath="${winpath//'/'/'\'}" + else + winpath="${winpath//'\'/'/'}" + fi + elif [[ $arg =~ ^(/[-_.*a-zA-Z0-9]+(/[-_.*a-zA-Z0-9]+)+.*$) ]] ; then + # This looks like a unix path, like /foo/bar + pathmatch="${BASH_REMATCH[1]}" + if [[ $ENVROOT == "" ]]; then + if [[ $QUIET != true ]]; then + echo fixpath: failure: Path "'"$pathmatch"'" cannot be converted to Windows path >&2 + fi + exit 1 + fi + winpath="$ENVROOT$pathmatch" + # Change slash to backslash (or vice versa if mixed mode) + if [[ $MIXEDMODE != true ]]; then + winpath="${winpath//'/'/'\'}" + else + winpath="${winpath//'\'/'/'}" + fi + else + # This does not look like a path, so assume this is not a proper pathlist. + # Flag this to caller. + result="" + return 1 + fi + + if [[ "$converted_list" = "" ]]; then + converted_list="$winpath" + else + converted_list="$converted_list;$winpath" + fi + done + + result="$converted_list" + return 0 +} + +# The central conversion function. Convert a single argument, so that any +# contained paths are converted to Windows style paths. Result is returned +# in $result. If it is a path list, convert it as one. +function convert_path() { + if [[ $1 =~ : ]]; then + convert_pathlist "$1" + if [[ $? -eq 0 ]]; then + return 0 + fi + # Not all elements was possible to convert to Windows paths, so we + # presume it is not a pathlist. Continue using normal conversion. + fi + + arg="$1" + winpath="" + # Start looking for drive prefix. Also allow /xxxx prefixes (typically options + # for Visual Studio tools), and embedded file:// URIs. + if [[ $arg =~ ^([^/]*|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then + prefix="${BASH_REMATCH[1]}" + winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}" + # Change slash to backslash (or vice versa if mixed mode) + if [[ $MIXEDMODE != true ]]; then + winpath="${winpath//'/'/'\'}" + else + winpath="${winpath//'\'/'/'}" + fi + elif [[ $arg =~ ^([^/]*|(.*file://))(/([-_.a-zA-Z0-9]+)(/[-_.a-zA-Z0-9]+)+)(.*)?$ ]] ; then + # This looks like a unix path, like /foo/bar. Also embedded file:// URIs. + prefix="${BASH_REMATCH[1]}" + pathmatch="${BASH_REMATCH[3]}" + firstdir="${BASH_REMATCH[4]}" + suffix="${BASH_REMATCH[6]}" + + # We only believe this is a path if the first part is an existing directory + if [[ -d "/$firstdir" ]]; then + if [[ $ENVROOT == "" ]]; then + if [[ $QUIET != true ]]; then + echo fixpath: failure: Path "'"$pathmatch"'" cannot be converted to Windows path >&2 + fi + exit 1 + fi + winpath="$ENVROOT$pathmatch" + # Change slash to backslash (or vice versa if mixed mode) + if [[ $MIXEDMODE != true ]]; then + winpath="${winpath//'/'/'\'}" + else + winpath="${winpath//'\'/'/'}" + fi + winpath="$winpath$suffix" + fi + fi + + if [[ $winpath != "" ]]; then + result="$prefix$winpath" + else + # Return the arg unchanged + result="$arg" + fi +} + +# Treat $1 as name of a file containg paths. Convert those paths to Windows style, +# in a new temporary file, and return a string "@" pointing to that +# new file. +function convert_at_file() { + infile="$1" + if [[ -e $infile ]] ; then + tempdir=$(mktemp -dt fixpath.XXXXXX -p "$WINTEMP") + TEMPDIRS="$TEMPDIRS $tempdir" + + while read line; do + convert_path "$line" + echo "$result" >> $tempdir/atfile + done < $infile + convert_path "$tempdir/atfile" + result="@$result" + else + result="@$infile" + fi +} + +# Convert an entire command line, replacing all unix paths with Windows paths, +# and all unix-style path lists (colon separated) with Windows-style (semicolon +# separated). +function print_command_line() { + converted_args="" + for arg in "$@" ; do + if [[ $arg =~ ^@(.*$) ]] ; then + # This is an @-file with paths that need converting + convert_at_file "${BASH_REMATCH[1]}" + else + convert_path "$arg" + fi + converted_args="$converted_args$result " + done + result="${converted_args% }" +} + +# Check if the winenv will allow us to start a Windows program when we are +# standing in the current directory +function verify_current_dir() { + arg="$PWD" + if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then + return 0 + elif [[ $arg =~ ^(/[^/]+.*$) ]] ; then + if [[ $ENVROOT == "" || $ENVROOT =~ ^\\\\.* ]]; then + # This is a WSL1 or WSL2 environment + return 1 + fi + return 0 + fi + # This should not happen + return 1 +} + +# The core functionality of fixpath. Take the given command line, and convert +# it and execute it, so that all paths are converted to Windows style. +# The return code is the return code of the executed command. +function exec_command_line() { + # Check that Windows can handle our current directory (only an issue for WSL) + verify_current_dir + + if [[ $? -ne 0 ]]; then + # WSL1 will just forcefully put us in C:\Windows\System32 if we execute this from + # a unix directory. WSL2 will do the same, and print a warning. In both cases, + # we prefer to take control. + cd "$WINTEMP" + if [[ $QUIET != true ]]; then + echo fixpath: warning: Changing directory to $WINTEMP >&2 + fi + fi + + collected_args=() + command="" + for arg in "$@" ; do + if [[ $command == "" ]]; then + # We have not yet located the command to run + if [[ $arg =~ ^(.*)=(.*)$ ]]; then + # It's a leading env variable assignment (FOO=bar) + key="${BASH_REMATCH[1]}" + arg="${BASH_REMATCH[2]}" + convert_path "$arg" + # Set the variable to the converted result + export $key="$result" + # While this is only needed on WSL, it does not hurt to do everywhere + export WSLENV=$WSLENV:$key/w + else + # The actual command will be executed by bash, so don't convert it + command="$arg" + fi + else + # Now we are collecting arguments; they all need converting + if [[ $arg =~ ^@(.*$) ]] ; then + # This is an @-file with paths that need converting + convert_at_file "${BASH_REMATCH[1]}" + else + convert_path "$arg" + fi + collected_args=("${collected_args[@]}" "$result") + fi + done + + # Now execute it + if [[ -v DEBUG_FIXPATH ]]; then + echo fixpath: debug: input: "$@" >&2 + echo fixpath: debug: output: "$command" "${collected_args[@]}" >&2 + fi + + if [[ ! -e "$command" ]]; then + if [[ -e "$command.exe" ]]; then + command="$command.exe" + fi + fi + + if [[ $ENVROOT != "" || ! -x /bin/grep ]]; then + "$command" "${collected_args[@]}" + else + # For WSL1, automatically strip away warnings from WSLENV=PATH/l + "$command" "${collected_args[@]}" 2> >(/bin/grep -v "ERROR: UtilTranslatePathList" 1>&2) + fi +} + +# Check that the input represents a path that is reachable from Windows +function verify_command_line() { + arg="$1" + if [[ $arg =~ ^($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then + return 0 + elif [[ $arg =~ ^(/[^/]+/[^/]+.*$) ]] ; then + if [[ $ENVROOT != "" ]]; then + return 0 + fi + fi + return 1 +} + +#### MAIN FUNCTION + +setup "$@" +# Shift away the options processed in setup +shift $((OPTIND)) + +if [[ "$ACTION" == "import" ]] ; then + import_command_line "$@" + echo "$result" +elif [[ "$ACTION" == "print" ]] ; then + print_command_line "$@" + echo "$result" +elif [[ "$ACTION" == "exec" ]] ; then + exec_command_line "$@" + # Propagate exit code + exit $? +elif [[ "$ACTION" == "verify" ]] ; then + verify_command_line "$@" + exit $? +else + if [[ $QUIET != true ]]; then + echo Unknown operation: "$ACTION" >&2 + echo Supported operations: import print exec verify >&2 + fi + exit 2 +fi diff --git a/make/src/native/fixpath.c b/make/src/native/fixpath.c deleted file mode 100644 index 73927d4fccaf0..0000000000000 --- a/make/src/native/fixpath.c +++ /dev/null @@ -1,594 +0,0 @@ -/* - * Copyright (c) 2011, 2020, 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. - */ - -#include -#include -#include -#include -#include -#include - -void report_error(char const * msg) -{ - LPTSTR lpMsgBuf; - DWORD dw = GetLastError(); - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, - NULL); - - fprintf(stderr, - "%s Failed with error %d: %s\n", - msg, dw, lpMsgBuf); - - LocalFree(lpMsgBuf); -} - -/* - * Test if pos points to /prefix/_/ where _ can - * be any character. - */ -int is_prefix_here(int pos, char const *in, int len, const char* prefix) -{ - // Length of c/ is 2 - int prefix_size = strlen(prefix); - if (pos+prefix_size+2 > len) return 0; - if (in[pos+prefix_size+1]=='/') { - return strncmp(in + pos, prefix, prefix_size) == 0; - } - return 0; -} - -/* - * Replace /cygdrive/_/ with _:/ - * Works in place since drive letter is always - * shorter than /cygdrive/ - */ -char *replace_cygdrive_cygwin(char const *in) -{ - size_t len = strlen(in); - char *out = (char*) malloc(len+1); - int i,j; - - if (len < 12) { - memmove(out, in, len + 1); - return out; - } - - for (i = 0, j = 0; i *bl) { - *bl *= 2; - *b = (char*) realloc(*b, *bl); - } - memcpy(*b+*u, add, addlen); - *u += addlen; -} - -/* - * Creates a new string from in where the first occurrence of sub is - * replaced by rep. - */ -char *replace_substring(char *in, char *sub, char *rep) -{ - int in_len = strlen(in); - int sub_len = strlen(sub); - int rep_len = strlen(rep); - char *out = (char *) malloc(in_len - sub_len + rep_len + 1); - char *p; - - if (!(p = strstr(in, sub))) { - // If sub isn't a substring of in, just return in. - return in; - } - - // Copy characters from beginning of in to start of sub. - strncpy(out, in, p - in); - out[p - in] = '\0'; - - sprintf(out + (p - in), "%s%s", rep, p + sub_len); - - return out; -} - -char* msys_path_list; // @-separated list of paths prefix to look for -char* msys_path_list_end; // Points to last \0 in msys_path_list. - -void setup_msys_path_list(char const * argument) -{ - char* p; - char* drive_letter_pos; - - msys_path_list = strdup(&argument[2]); - msys_path_list_end = &msys_path_list[strlen(msys_path_list)]; - - // Convert all at-sign (@) in path list to \0. - // @ was chosen as separator to minimize risk of other tools messing around with it - p = msys_path_list; - do { - if (p[1] == ':') { - // msys has mangled our path list, restore it from c:/... to /c/... - drive_letter_pos = p+1; - *drive_letter_pos = *p; - *p = '/'; - } - - // Look for an @ in the list - p = strchr(p, '@'); - if (p != NULL) { - *p = '\0'; - p++; - } - } while (p != NULL); -} - -char *replace_cygdrive_msys(char const *in) -{ - char* str; - char* prefix; - char* p; - - str = strdup(in); - - // For each prefix in the path list, search for it and replace /c/... with c:/... - for (prefix = msys_path_list; prefix < msys_path_list_end && prefix != NULL; prefix += strlen(prefix)+1) { - p=str; - while ((p = strstr(p, prefix))) { - char* drive_letter = p+1; - *p = *drive_letter; - *drive_letter = ':'; - p++; - } - } - - return str; -} - -/* - * Replace /mnt/_/ with _:/ - * Works in place since drive letter is always - * shorter than /mnt/ - */ -char *replace_cygdrive_wsl(char const *in) -{ - size_t len = strlen(in); - char *out = (char*) malloc(len+1); - int i,j; - - if (len < 7) { - memmove(out, in, len + 1); - return out; - } - - for (i = 0, j = 0; i 0) { - append(&buffer, &buflen, &used, block, blocklen); - } - buffer[used] = 0; - if (debug_fixpath) { - fprintf(stderr, "fixpath input from @-file %s: %s\n", &in[1], buffer); - } - fixed = replace_cygdrive(buffer); - if (debug_fixpath) { - fprintf(stderr, "fixpath converted to @-file %s is: %s\n", name, fixed); - } - fwrite(fixed, strlen(fixed), 1, atout); - fclose(atin); - fclose(atout); - free(fixed); - free(buffer); - files_to_delete[num_files_to_delete] = (char*) malloc(strlen(name)+1); - strcpy(files_to_delete[num_files_to_delete], name); - num_files_to_delete++; - atname = (char*) malloc(strlen(name)+2); - atname[0] = '@'; - strcpy(atname+1, name); - return atname; -} - -// given an argument, convert it to the windows command line safe quoted version -// using rules from: -// http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx -// caller is responsible for freeing both input and output. -char * quote_arg(char const * in_arg) { - char *quoted = NULL; - char *current = quoted; - int pass; - - if (strlen(in_arg) == 0) { - // empty string? explicitly quote it. - return _strdup("\"\""); - } - - if (strpbrk(in_arg, " \t\n\v\r\\\"") == NULL) { - return _strdup(in_arg); - } - - // process the arg twice. Once to calculate the size and then to copy it. - for (pass=1; pass<=2; pass++) { - char const *arg = in_arg; - - // initial " - if (pass == 2) { - *current = '\"'; - } - current++; - - // process string to be quoted until NUL - do { - int escapes = 0; - - while (*arg == '\\') { - // count escapes. - escapes++; - arg++; - } - - if (*arg == '\0') { - // escape the escapes before final " - escapes *= 2; - } else if (*arg == '"') { - // escape the escapes and the " - escapes = escapes * 2 + 1; - } else { - // escapes aren't special, just echo them. - } - - // emit some escapes - while (escapes > 0) { - if (pass == 2) { - *current = '\\'; - } - current++; - escapes--; - } - - // and the current char - if (pass == 2) { - *current = *arg; - } - current++; - } while (*arg++ != '\0'); - - // allocate the buffer - if (pass == 1) { - size_t alloc = (size_t) (current - quoted + (ptrdiff_t) 2); - current = quoted = (char*) calloc(alloc, sizeof(char)); - } - } - - // final " and \0 - *(current - 1) = '"'; - *current = '\0'; - - return quoted; -} - -int main(int argc, char const ** argv) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - unsigned short rc; - - char *line; - char *current; - int i, cmd; - DWORD exitCode = 0; - DWORD processFlags = 0; - BOOL processInheritHandles = TRUE; - BOOL waitForChild = TRUE; - char* fixpathPath; - - debug_fixpath = (getenv("DEBUG_FIXPATH") != NULL); - - if (argc<2 || argv[1][0] != '-' || (argv[1][1] != 'c' && argv[1][1] != 'm' && argv[1][1] != 'w')) { - fprintf(stderr, "Usage: fixpath -c|m|w [--detach] /cygdrive/c/WINDOWS/notepad.exe [/cygdrive/c/x/test.txt|@/cygdrive/c/x/atfile]\n"); - exit(0); - } - - if (debug_fixpath) { - char const * cmdline = GetCommandLine(); - fprintf(stderr, "fixpath input line >%s<\n", strstr(cmdline, argv[1])); - } - - if (argv[1][1] == 'c' && argv[1][2] == '\0') { - if (debug_fixpath) { - fprintf(stderr, "fixpath using cygwin mode\n"); - } - replace_cygdrive = replace_cygdrive_cygwin; - } else if (argv[1][1] == 'm') { - if (debug_fixpath) { - fprintf(stderr, "fixpath using msys mode, with path list: %s\n", &argv[1][2]); - } - setup_msys_path_list(argv[1]); - replace_cygdrive = replace_cygdrive_msys; - } else if (argv[1][1] == 'w') { - if (debug_fixpath) { - fprintf(stderr, "fixpath using wsl mode, with path list: %s\n", &argv[1][2]); - } - replace_cygdrive = replace_cygdrive_wsl; - } else { - fprintf(stderr, "fixpath Unknown mode: %s\n", argv[1]); - exit(-1); - } - - if (argv[2][0] == '-') { - if (strcmp(argv[2], "--detach") == 0) { - if (debug_fixpath) { - fprintf(stderr, "fixpath in detached mode\n"); - } - processFlags |= DETACHED_PROCESS; - processInheritHandles = FALSE; - waitForChild = FALSE; - } else { - fprintf(stderr, "fixpath Unknown argument: %s\n", argv[2]); - exit(-1); - } - i = 3; - } else { - i = 2; - } - - // handle assignments - while (i < argc) { - char const * assignment = strchr(argv[i], '='); - if (assignment != NULL && assignment != argv[i]) { - size_t var_len = (size_t) (assignment - argv[i] + (ptrdiff_t) 1); - char *var = (char *) calloc(var_len, sizeof(char)); - char *val = replace_cygdrive(assignment + 1); - memmove(var, argv[i], var_len); - var[var_len - 1] = '\0'; - strupr(var); - - if (debug_fixpath) { - fprintf(stderr, "fixpath setting var >%s< to >%s<\n", var, val); - } - - rc = SetEnvironmentVariable(var, val); - if (!rc) { - // Could not set var for some reason. Try to report why. - const int msg_len = 80 + var_len + strlen(val); - char * msg = (char *) alloca(msg_len); - _snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [%s=%s]", var, val); - report_error(msg); - exit(1); - } - free(var); - free(val); - } else { - // no more assignments; - break; - } - i++; - } - - // remember index of the command - cmd = i; - - // handle command and it's args. - while (i < argc) { - char const *replaced = replace_cygdrive(argv[i]); - if (replaced[0] == '@') { - if (waitForChild == FALSE) { - fprintf(stderr, "fixpath Cannot use @-files in detached mode: %s\n", replaced); - exit(1); - } - // Found at-file! Fix it! - replaced = fix_at_file(replaced); - } - argv[i] = quote_arg(replaced); - i++; - } - - // determine the length of the line - line = NULL; - // args - for (i = cmd; i < argc; i++) { - line += (ptrdiff_t) strlen(argv[i]); - } - // spaces and null - line += (ptrdiff_t) (argc - cmd + 1); - // allocate - line = (char*) calloc(line - (char*) NULL, sizeof(char)); - - // copy in args. - current = line; - for (i = cmd; i < argc; i++) { - ptrdiff_t len = strlen(argv[i]); - if (i != cmd) { - *current++ = ' '; - } - memmove(current, argv[i], len); - current += len; - } - *current = '\0'; - - if (debug_fixpath) { - fprintf(stderr, "fixpath converted line >%s<\n", line); - } - - if (cmd == argc) { - if (debug_fixpath) { - fprintf(stderr, "fixpath no command provided!\n"); - } - exit(0); - } - - ZeroMemory(&si, sizeof(si)); - si.cb=sizeof(si); - ZeroMemory(&pi, sizeof(pi)); - - fflush(stderr); - fflush(stdout); - - fixpathPath = calloc(32767, sizeof(char)); - rc = GetEnvironmentVariable("FIXPATH_PATH", fixpathPath, 32767); - if (rc) { - if (debug_fixpath) { - fprintf(stderr, "Setting Path to FIXPATH_PATH: %s\n", fixpathPath); - } - rc = SetEnvironmentVariable("Path", fixpathPath); - if (!rc) { - // Could not set Path for some reason. Try to report why. - const int msg_len = 80 + strlen(fixpathPath); - char * msg = (char *)alloca(msg_len); - _snprintf_s(msg, msg_len, _TRUNCATE, "Could not set environment variable [Path=%s]", fixpathPath); - report_error(msg); - exit(1); - } - } - - rc = CreateProcess(NULL, - line, - 0, - 0, - processInheritHandles, - processFlags, - NULL, - NULL, - &si, - &pi); - if (!rc) { - // Could not start process for some reason. Try to report why: - report_error("Could not start process!"); - exit(126); - } - - if (waitForChild == TRUE) { - WaitForSingleObject(pi.hProcess, INFINITE); - GetExitCodeProcess(pi.hProcess, &exitCode); - - if (debug_fixpath) { - for (i=0; i Date: Mon, 7 Dec 2020 16:35:01 +0000 Subject: [PATCH 109/504] 8257788: Class fields could be local in the SunJSSE provider Reviewed-by: shade --- .../share/classes/sun/security/ssl/CertStatusExtension.java | 6 ++---- src/java.base/share/classes/sun/security/ssl/HKDF.java | 3 +-- .../share/classes/sun/security/ssl/SSLSecretDerivation.java | 6 +----- .../classes/sun/security/ssl/SSLTrafficKeyDerivation.java | 4 ---- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java index e11e4b96f6bf7..7919ff18d8af4 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java @@ -323,8 +323,6 @@ static final class OCSPStatusRequest extends CertStatusRequest { final List responderIds; final List extensions; - private final int ridListLen; - private final int extListLen; static { OCSPStatusRequest ocspReq = null; @@ -360,7 +358,7 @@ private OCSPStatusRequest(byte statusType, List exts = new ArrayList<>(); ByteBuffer m = ByteBuffer.wrap(encoded); - this.ridListLen = Record.getInt16(m); + int ridListLen = Record.getInt16(m); if (m.remaining() < (ridListLen + 2)) { throw new SSLProtocolException( "Invalid OCSP status request: insufficient data"); @@ -384,7 +382,7 @@ private OCSPStatusRequest(byte statusType, } byte[] extListBytes = Record.getBytes16(m); - this.extListLen = extListBytes.length; + int extListLen = extListBytes.length; if (extListLen > 0) { try { DerInputStream dis = new DerInputStream(extListBytes); diff --git a/src/java.base/share/classes/sun/security/ssl/HKDF.java b/src/java.base/share/classes/sun/security/ssl/HKDF.java index b9fd29b7c8969..1ea46807d7523 100644 --- a/src/java.base/share/classes/sun/security/ssl/HKDF.java +++ b/src/java.base/share/classes/sun/security/ssl/HKDF.java @@ -44,7 +44,6 @@ * derivation process. */ final class HKDF { - private final String hmacAlg; private final Mac hmacObj; private final int hmacLen; @@ -61,7 +60,7 @@ final class HKDF { HKDF(String hashAlg) throws NoSuchAlgorithmException { Objects.requireNonNull(hashAlg, "Must provide underlying HKDF Digest algorithm."); - hmacAlg = "Hmac" + hashAlg.replace("-", ""); + String hmacAlg = "Hmac" + hashAlg.replace("-", ""); hmacObj = Mac.getInstance(hmacAlg); hmacLen = hmacObj.getMacLength(); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java index d37d7eacd80cd..bdbf7f8dba4db 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSecretDerivation.java @@ -60,19 +60,15 @@ final class SSLSecretDerivation implements SSLKeyDerivation { (byte)0x48, (byte)0x98, (byte)0xB9, (byte)0x5B }; - private final HandshakeContext context; - private final String hkdfAlg; private final HashAlg hashAlg; private final SecretKey secret; private final byte[] transcriptHash; // handshake messages transcript hash SSLSecretDerivation( HandshakeContext context, SecretKey secret) { - this.context = context; this.secret = secret; this.hashAlg = context.negotiatedCipherSuite.hashAlg; - this.hkdfAlg = - "HKDF-Expand/Hmac" + hashAlg.name.replace("-", ""); + String hkdfAlg = "HKDF-Expand/Hmac" + hashAlg.name.replace("-", ""); context.handshakeHash.update(); this.transcriptHash = context.handshakeHash.digest(); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java index 90b021b878f3e..ac39cbb16fbd9 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java @@ -203,14 +203,10 @@ String getAlgorithm(CipherSuite cs, String algorithm) { @SuppressWarnings("deprecation") static final class LegacyTrafficKeyDerivation implements SSLKeyDerivation { - private final HandshakeContext context; - private final SecretKey masterSecret; private final TlsKeyMaterialSpec keyMaterialSpec; LegacyTrafficKeyDerivation( HandshakeContext context, SecretKey masterSecret) { - this.context = context; - this.masterSecret = masterSecret; CipherSuite cipherSuite = context.negotiatedCipherSuite; ProtocolVersion protocolVersion = context.negotiatedProtocol; From b4b9828cb0e7e890b244b16fdd44754a616af201 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Mon, 7 Dec 2020 16:45:51 +0000 Subject: [PATCH 110/504] 8254784: javac should reject records with @SafeVarargs applied to varargs record component Reviewed-by: mcimadamore --- .../com/sun/tools/javac/comp/Check.java | 15 +++++++--- .../tools/javac/resources/compiler.properties | 4 +++ ...VarargsNotApplicableToRecordAccessors.java | 30 +++++++++++++++++++ .../javac/records/RecordCompilationTests.java | 17 +++++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index fc81424a5904a..1ca0645ad6515 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -3003,11 +3003,11 @@ private void validateAnnotation(JCAnnotation a, JCTree declarationTree, Symbol s Set applicableTargets = applicableTargetsOp.get(); boolean notApplicableOrIsTypeUseOnly = applicableTargets.isEmpty() || applicableTargets.size() == 1 && applicableTargets.contains(names.TYPE_USE); - boolean isRecordMemberWithNonApplicableDeclAnno = - isRecordMember && (s.flags_field & Flags.GENERATED_MEMBER) != 0 && notApplicableOrIsTypeUseOnly; + boolean isCompGeneratedRecordElement = isRecordMember && (s.flags_field & Flags.GENERATED_MEMBER) != 0; + boolean isCompRecordElementWithNonApplicableDeclAnno = isCompGeneratedRecordElement && notApplicableOrIsTypeUseOnly; - if (applicableTargets.isEmpty() || isRecordMemberWithNonApplicableDeclAnno) { - if (isRecordMemberWithNonApplicableDeclAnno) { + if (applicableTargets.isEmpty() || isCompRecordElementWithNonApplicableDeclAnno) { + if (isCompRecordElementWithNonApplicableDeclAnno) { /* so we have found an annotation that is not applicable to a record member that was generated by the * compiler. This was intentionally done at TypeEnter, now is the moment strip away the annotations * that are not applicable to the given record member @@ -3031,6 +3031,13 @@ private void validateAnnotation(JCAnnotation a, JCTree declarationTree, Symbol s log.error(a.pos(), Errors.AnnotationTypeNotApplicable); } } + /* if we are seeing the @SafeVarargs annotation applied to a compiler generated accessor, + * then this is an error as we know that no compiler generated accessor will be a varargs + * method, better to fail asap + */ + if (isCompGeneratedRecordElement && !isRecordField && a.type.tsym == syms.trustMeType.tsym && declarationTree.hasTag(METHODDEF)) { + log.error(a.pos(), Errors.VarargsInvalidTrustmeAnno(syms.trustMeType.tsym, Fragments.VarargsTrustmeOnNonVarargsAccessor(s))); + } } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index bc8d30086793c..77339ec8a416c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1419,6 +1419,10 @@ compiler.err.instanceof.pattern.no.subtype=\ compiler.misc.varargs.trustme.on.non.varargs.meth=\ Method {0} is not a varargs method. +# 0: symbol +compiler.misc.varargs.trustme.on.non.varargs.accessor=\ + Accessor {0} is not a varargs method. + # 0: symbol compiler.misc.varargs.trustme.on.virtual.varargs=\ Instance method {0} is neither final nor private. diff --git a/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java b/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java new file mode 100644 index 0000000000000..7b4e5cd772271 --- /dev/null +++ b/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020, 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. + */ + +// key: compiler.err.varargs.invalid.trustme.anno +// key: compiler.misc.varargs.trustme.on.non.varargs.accessor +// key: compiler.note.preview.filename +// key: compiler.note.preview.recompile +// options: --enable-preview -source ${jdk.version} + +record R(@SafeVarargs String... s) {} diff --git a/test/langtools/tools/javac/records/RecordCompilationTests.java b/test/langtools/tools/javac/records/RecordCompilationTests.java index 11940d92a9808..b6ccdcfaf9a59 100644 --- a/test/langtools/tools/javac/records/RecordCompilationTests.java +++ b/test/langtools/tools/javac/records/RecordCompilationTests.java @@ -1825,4 +1825,21 @@ static void test() { """ ); } + + public void testSaveVarargsAnno() { + // the compiler would generate an erronous accessor + assertFail("compiler.err.varargs.invalid.trustme.anno", + """ + record R(@SafeVarargs String... s) {} + """ + ); + // but this is OK + assertOK( + """ + record R(@SafeVarargs String... s) { + public String[] s() { return s; } + } + """ + ); + } } From bbc44f57c4714a49e72a09f0b9d05765d6b41e9b Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Mon, 7 Dec 2020 17:25:23 +0000 Subject: [PATCH 111/504] 8257186: Size of heap segments is not computed correctlyFix overflow in size computation for heap segments Reviewed-by: jvernee, chegar --- .../foreign/HeapMemorySegmentImpl.java | 14 +++++------ test/jdk/java/foreign/TestSegments.java | 23 ++++++++++++++++++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java index 46a0a428d16ea..30e2fc0608bce 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java @@ -98,7 +98,7 @@ byte[] base() { public static MemorySegment fromArray(byte[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_BYTE_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_BYTE_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfByte(Unsafe.ARRAY_BYTE_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -122,7 +122,7 @@ char[] base() { public static MemorySegment fromArray(char[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_CHAR_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_CHAR_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfChar(Unsafe.ARRAY_CHAR_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -146,7 +146,7 @@ short[] base() { public static MemorySegment fromArray(short[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_SHORT_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_SHORT_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfShort(Unsafe.ARRAY_SHORT_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -170,7 +170,7 @@ int[] base() { public static MemorySegment fromArray(int[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_INT_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_INT_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfInt(Unsafe.ARRAY_INT_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -194,7 +194,7 @@ long[] base() { public static MemorySegment fromArray(long[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_LONG_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_LONG_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfLong(Unsafe.ARRAY_LONG_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -218,7 +218,7 @@ float[] base() { public static MemorySegment fromArray(float[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_FLOAT_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_FLOAT_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfFloat(Unsafe.ARRAY_FLOAT_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } @@ -242,7 +242,7 @@ OfDouble dup(long offset, long size, int mask, MemoryScope scope) { public static MemorySegment fromArray(double[] arr) { Objects.requireNonNull(arr); - int byteSize = arr.length * Unsafe.ARRAY_DOUBLE_INDEX_SCALE; + long byteSize = (long)arr.length * Unsafe.ARRAY_DOUBLE_INDEX_SCALE; MemoryScope scope = MemoryScope.createConfined(null, MemoryScope.DUMMY_CLEANUP_ACTION, null); return new OfDouble(Unsafe.ARRAY_DOUBLE_BASE_OFFSET, arr, byteSize, defaultAccessModes(byteSize), scope); } diff --git a/test/jdk/java/foreign/TestSegments.java b/test/jdk/java/foreign/TestSegments.java index 862b55d983f4e..9568830683bbc 100644 --- a/test/jdk/java/foreign/TestSegments.java +++ b/test/jdk/java/foreign/TestSegments.java @@ -23,7 +23,7 @@ /* * @test - * @run testng/othervm -XX:MaxDirectMemorySize=1M TestSegments + * @run testng/othervm -Xmx4G -XX:MaxDirectMemorySize=1M TestSegments */ import jdk.incubator.foreign.MappedMemorySegments; @@ -47,6 +47,8 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.function.IntFunction; import java.util.function.LongFunction; import java.util.function.Supplier; import java.util.stream.Stream; @@ -277,6 +279,13 @@ public void testBadHasAccessModes() { segment.hasAccessModes((1 << AccessActions.values().length) + 1); } + @Test(dataProvider = "heapFactories") + public void testBigHeapSegments(IntFunction heapSegmentFactory, int factor) { + int bigSize = (Integer.MAX_VALUE / factor) + 1; + MemorySegment segment = heapSegmentFactory.apply(bigSize); + assertTrue(segment.byteSize() > 0); + } + @DataProvider(name = "badSizeAndAlignments") public Object[][] sizesAndAlignments() { return new Object[][] { @@ -445,4 +454,16 @@ void run(MemorySegment segment) { abstract void run(MemorySegment segment); } + + @DataProvider(name = "heapFactories") + public Object[][] heapFactories() { + return new Object[][] { + { (IntFunction) size -> MemorySegment.ofArray(new char[size]), 2 }, + { (IntFunction) size -> MemorySegment.ofArray(new short[size]), 2 }, + { (IntFunction) size -> MemorySegment.ofArray(new int[size]), 4 }, + { (IntFunction) size -> MemorySegment.ofArray(new float[size]), 4 }, + { (IntFunction) size -> MemorySegment.ofArray(new long[size]), 8 }, + { (IntFunction) size -> MemorySegment.ofArray(new double[size]), 8 } + }; + } } From e3793e5a608fd44ff479734182af20a06eb0ec14 Mon Sep 17 00:00:00 2001 From: Andy Herrick Date: Mon, 7 Dec 2020 18:04:04 +0000 Subject: [PATCH 112/504] 8257514: Fix the issues in jdk.jpackage identified by SpotBugs Reviewed-by: asemenyuk, almatvee, shade --- .../jdk/jpackage/internal/CfgFile.java | 2 +- .../jdk/jpackage/internal/DeployParams.java | 6 ++- .../jdk/jpackage/internal/IOUtils.java | 39 +++++++++++++++---- .../internal/OverridableResource.java | 2 +- .../jdk/jpackage/internal/PathGroup.java | 2 +- .../jdk/jpackage/internal/ToolValidator.java | 2 +- .../jdk/jpackage/main/CommandLine.java | 2 + .../internal/ExecutableRebrander.java | 2 +- .../jdk/jpackage/internal/WinMsiBundler.java | 2 +- .../internal/WindowsAppImageBuilder.java | 2 +- .../jdk/jpackage/internal/WixPipeline.java | 4 +- .../jpackage/internal/WixSourcesBuilder.java | 8 ++-- 12 files changed, 50 insertions(+), 23 deletions(-) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java index 0826e3970a4c7..b5320ed941b3e 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java @@ -112,7 +112,7 @@ void create(Path appImage) throws IOException { } Path cfgFile = appImagelayout.appDirectory().resolve(launcherName + ".cfg"); - Files.createDirectories(cfgFile.getParent()); + Files.createDirectories(IOUtils.getParent(cfgFile)); boolean[] addLineBreakAtSection = new boolean[1]; Stream lines = content.stream().map(entry -> { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java index 0783c327e115d..cb27d472fbcf6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java @@ -111,7 +111,7 @@ static void validateName(String s, boolean forApp) if (forApp) { return; } else { - throw new PackagerException(exceptionKey, s); + throw new PackagerException(exceptionKey); } } if (s.length() == 0 || s.charAt(s.length() - 1) == '\\') { @@ -208,7 +208,9 @@ public void validate() throws PackagerException { Arguments.CLIOptions.PREDEFINED_APP_IMAGE.getId()); if (appImage != null) { Path appImageDir = Path.of(appImage); - if (!Files.exists(appImageDir) || appImageDir.toFile().list().length == 0) { + if (!Files.exists(appImageDir) + || appImageDir.toFile().list() == null + || appImageDir.toFile().list().length == 0) { throw new PackagerException("ERR_AppImageNotExist", appImage); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java index 414ae2275ee8a..a82f5ff457279 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java @@ -120,7 +120,7 @@ public FileVisitResult visitFile(final Path file, public static void copyFile(Path sourceFile, Path destFile) throws IOException { - Files.createDirectories(destFile.getParent()); + Files.createDirectories(getParent(destFile)); Files.copy(sourceFile, destFile, StandardCopyOption.REPLACE_EXISTING, @@ -140,8 +140,9 @@ public static void run(String launcher, Path paramFile) throws IOException { if (IOUtils.exists(paramFile)) { ProcessBuilder pb = - new ProcessBuilder(launcher, paramFile.getFileName().toString()); - pb = pb.directory(paramFile.getParent().toFile()); + new ProcessBuilder(launcher, + getFileName(paramFile).toString()); + pb = pb.directory(getParent(paramFile).toFile()); exec(pb); } } @@ -254,20 +255,20 @@ static void writableOutputDir(Path outdir) throws PackagerException { public static Path replaceSuffix(Path path, String suffix) { Path parent = path.getParent(); - String filename = path.getFileName().toString().replaceAll("\\.[^.]*$", "") + String filename = getFileName(path).toString().replaceAll("\\.[^.]*$", "") + Optional.ofNullable(suffix).orElse(""); return parent != null ? parent.resolve(filename) : Path.of(filename); } public static Path addSuffix(Path path, String suffix) { Path parent = path.getParent(); - String filename = path.getFileName().toString() + suffix; + String filename = getFileName(path).toString() + suffix; return parent != null ? parent.resolve(filename) : Path.of(filename); } public static String getSuffix(Path path) { - String filename = replaceSuffix(path.getFileName(), null).toString(); - return path.getFileName().toString().substring(filename.length()); + String filename = replaceSuffix(getFileName(path), null).toString(); + return getFileName(path).toString().substring(filename.length()); } @FunctionalInterface @@ -278,7 +279,7 @@ public static interface XmlConsumer { public static void createXml(Path dstFile, XmlConsumer xmlConsumer) throws IOException { XMLOutputFactory xmlFactory = XMLOutputFactory.newInstance(); - Files.createDirectories(dstFile.getParent()); + Files.createDirectories(getParent(dstFile)); try (Writer w = Files.newBufferedWriter(dstFile)) { // Wrap with pretty print proxy XMLStreamWriter xml = (XMLStreamWriter) Proxy.newProxyInstance( @@ -298,6 +299,28 @@ public static void createXml(Path dstFile, XmlConsumer xmlConsumer) throws } } + public static Path getParent(Path p) { + Path parent = p.getParent(); + if (parent == null) { + IllegalArgumentException iae = + new IllegalArgumentException(p.toString()); + Log.verbose(iae); + throw iae; + } + return parent; + } + + public static Path getFileName(Path p) { + Path filename = p.getFileName(); + if (filename == null) { + IllegalArgumentException iae = + new IllegalArgumentException(p.toString()); + Log.verbose(iae); + throw iae; + } + return filename; + } + private static class PrettyPrintHandler implements InvocationHandler { PrettyPrintHandler(XMLStreamWriter target) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/OverridableResource.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/OverridableResource.java index 23ed0ee74770e..2e9c91bd3c894 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/OverridableResource.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/OverridableResource.java @@ -173,7 +173,7 @@ public Path publicName() { @Override public void consume(InputStream in) throws IOException { - Files.createDirectories(dest.getParent()); + Files.createDirectories(IOUtils.getParent(dest)); Files.copy(in, dest, StandardCopyOption.REPLACE_EXISTING); } }); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PathGroup.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PathGroup.java index 2cb44db59f92c..909f8ec592add 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PathGroup.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PathGroup.java @@ -179,7 +179,7 @@ private static void copy(boolean move, List> entries, handler = new TransformHandler() { @Override public void copyFile(Path src, Path dst) throws IOException { - Files.createDirectories(dst.getParent()); + Files.createDirectories(IOUtils.getParent(dst)); if (move) { Files.move(src, dst); } else { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java index 04519ca710ae6..c34e2b3813b51 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java @@ -84,7 +84,7 @@ ConfigException validate() { cmdline.add(toolPath.toString()); cmdline.addAll(args); - String name = toolPath.getFileName().toString(); + String name = IOUtils.getFileName(toolPath).toString(); try { ProcessBuilder pb = new ProcessBuilder(cmdline); AtomicBoolean canUseTool = new AtomicBoolean(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java b/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java index e9ab994624b36..8038be759fdd2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/main/CommandLine.java @@ -170,6 +170,8 @@ public String nextToken() throws IOException { case 'f': ch = '\f'; break; + default: + break; } } sb.append((char) ch); diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/ExecutableRebrander.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/ExecutableRebrander.java index cec106cdd2404..4b11d0f534928 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/ExecutableRebrander.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/ExecutableRebrander.java @@ -181,7 +181,7 @@ private Map createSubstituteData( private void rebrandProperties(long resourceLock, OverridableResource properties, Map data, Path target) throws IOException { - String targetExecutableName = target.getFileName().toString(); + String targetExecutableName = IOUtils.getFileName(target).toString(); data.put("INTERNAL_NAME", targetExecutableName); data.put("ORIGINAL_FILENAME", targetExecutableName); diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java index b7253c4178262..e159bef9d1458 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiBundler.java @@ -426,7 +426,7 @@ private Map prepareMainProjectFile( String licenseFile = LICENSE_FILE.fetchFrom(params); if (licenseFile != null) { - String lname = Path.of(licenseFile).getFileName().toString(); + String lname = IOUtils.getFileName(Path.of(licenseFile)).toString(); Path destFile = CONFIG_ROOT.fetchFrom(params).resolve(lname); data.put("JpLicenseRtf", destFile.toAbsolutePath().toString()); } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java index 79db04d5b5b85..e472da83f4816 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java @@ -75,7 +75,7 @@ public class WindowsAppImageBuilder extends AbstractAppImageBuilder { } private void writeEntry(InputStream in, Path dstFile) throws IOException { - Files.createDirectories(dstFile.getParent()); + Files.createDirectories(IOUtils.getParent(dstFile)); Files.copy(in, dstFile); } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixPipeline.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixPipeline.java index eebfe052505cd..9d2511376ce5e 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixPipeline.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixPipeline.java @@ -95,7 +95,7 @@ void buildMsi(Path msi) throws IOException { lightCmdline.addAll(lightOptions); wixObjs.stream().map(Path::toString).forEach(lightCmdline::add); - Files.createDirectories(msi.getParent()); + Files.createDirectories(IOUtils.getParent(msi)); execute(lightCmdline); } @@ -105,7 +105,7 @@ private Path compile(WixSource wixSource) throws IOException { }; Path wixObj = adjustPath.apply(wixObjDir).resolve(IOUtils.replaceSuffix( - wixSource.source.getFileName(), ".wixobj")); + IOUtils.getFileName(wixSource.source), ".wixobj")); List cmdline = new ArrayList<>(List.of( toolset.get(WixTool.Candle).toString(), diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourcesBuilder.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourcesBuilder.java index e478cfa9c382f..0f750ed00b303 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourcesBuilder.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixSourcesBuilder.java @@ -236,7 +236,7 @@ enum Id { String of(Path path) { if (this == Folder && KNOWN_DIRS.contains(path)) { - return path.getFileName().toString(); + return IOUtils.getFileName(path).toString(); } String result = of(path, prefix, name()); @@ -437,7 +437,7 @@ private String addShortcutComponent(XMLStreamWriter xml, Path launcherPath, } String launcherBasename = IOUtils.replaceSuffix( - launcherPath.getFileName(), "").toString(); + IOUtils.getFileName(launcherPath), "").toString(); Path shortcutPath = folder.getPath(this).resolve(launcherBasename); return addComponent(xml, shortcutPath, Component.Shortcut, unused -> { @@ -612,7 +612,7 @@ public void createDirectory(final Path dir) throws IOException { xml.writeAttribute("Id", Id.Folder.of(dir.getParent())); xml.writeStartElement("Directory"); xml.writeAttribute("Id", Id.Folder.of(dir)); - xml.writeAttribute("Name", dir.getFileName().toString()); + xml.writeAttribute("Name", IOUtils.getFileName(dir).toString()); xml.writeEndElement(); xml.writeEndElement(); } @@ -669,7 +669,7 @@ private void addIconsFragment(XMLStreamWriter xml) throws srcPathGroup.transform(dstPathGroup, new PathGroup.TransformHandler() { @Override public void copyFile(Path src, Path dst) throws IOException { - if (src.getFileName().toString().endsWith(".ico")) { + if (IOUtils.getFileName(src).toString().endsWith(".ico")) { icoFiles.add(Map.entry(src, dst)); } } From a265c2013860f1d3f32a451418842d56ee5d2ec7 Mon Sep 17 00:00:00 2001 From: Alexander Matveev Date: Mon, 7 Dec 2020 18:11:35 +0000 Subject: [PATCH 113/504] 8255619: Localized WinResources.properties have MsiInstallerStrings_en.wxl resource Reviewed-by: herrick, naoto, asemenyuk --- .../jdk/jpackage/internal/resources/WinResources_ja.properties | 2 +- .../jpackage/internal/resources/WinResources_zh_CN.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties index 3d540d5562105..09167bbb6c1f8 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties @@ -34,7 +34,7 @@ resource.executable-properties-template=\u5B9F\u884C\u53EF\u80FD\u306A\u30D7\u30 resource.setup-icon=\u8A2D\u5B9A\u30C0\u30A4\u30A2\u30ED\u30B0\u30FB\u30A2\u30A4\u30B3\u30F3 resource.post-app-image-script=\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u30FB\u30A4\u30E1\u30FC\u30B8\u3092\u79FB\u5165\u3057\u305F\u5F8C\u306B\u5B9F\u884C\u3059\u308B\u30B9\u30AF\u30EA\u30D7\u30C8 resource.post-msi-script=exe\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9\u306Emsi\u30D5\u30A1\u30A4\u30EB\u304C\u4F5C\u6210\u3055\u308C\u305F\u5F8C\u306B\u5B9F\u884C\u3059\u308B\u30B9\u30AF\u30EA\u30D7\u30C8 -resource.wxl-file-name=MsiInstallerStrings_en.wxl +resource.wxl-file-name=MsiInstallerStrings_ja.wxl resource.main-wix-file=\u30E1\u30A4\u30F3WiX\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB resource.overrides-wix-file=WiX\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties index 838a9e482a7d0..70c7b06ce9c9a 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties @@ -34,7 +34,7 @@ resource.executable-properties-template=\u7528\u4E8E\u521B\u5EFA\u53EF\u6267\u88 resource.setup-icon=\u8BBE\u7F6E\u5BF9\u8BDD\u6846\u56FE\u6807 resource.post-app-image-script=\u8981\u5728\u586B\u5145\u5E94\u7528\u7A0B\u5E8F\u6620\u50CF\u4E4B\u540E\u8FD0\u884C\u7684\u811A\u672C resource.post-msi-script=\u5728\u4E3A exe \u5B89\u88C5\u7A0B\u5E8F\u521B\u5EFA msi \u6587\u4EF6\u4E4B\u540E\u8981\u8FD0\u884C\u7684\u811A\u672C -resource.wxl-file-name=MsiInstallerStrings_en.wxl +resource.wxl-file-name=MsiInstallerStrings_zh_CN.wxl resource.main-wix-file=\u4E3B WiX \u9879\u76EE\u6587\u4EF6 resource.overrides-wix-file=\u8986\u76D6 WiX \u9879\u76EE\u6587\u4EF6 From 395b6bdeee2d9c21234bc2ef37b290947b644d1d Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Mon, 7 Dec 2020 19:19:23 +0000 Subject: [PATCH 114/504] 8257817: Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB Reviewed-by: rkennke --- src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index edba82e3886ac..09d8b53318ac9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -2063,9 +2063,6 @@ void ShenandoahHeap::op_weak_roots() { ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_roots_work); ShenandoahConcurrentWeakRootsEvacUpdateTask task(ShenandoahPhaseTimings::conc_weak_roots_work); workers()->run_task(&task); - if (!ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) { - set_concurrent_weak_root_in_progress(false); - } } // Perform handshake to flush out dead oops @@ -2073,6 +2070,10 @@ void ShenandoahHeap::op_weak_roots() { ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_rendezvous); rendezvous_threads(); } + + if (!ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) { + set_concurrent_weak_root_in_progress(false); + } } } From 36c060052358ebe533d79520272627bd7ca50776 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 7 Dec 2020 19:26:40 +0000 Subject: [PATCH 115/504] 8257805: Add compiler/blackhole tests to tier1 Reviewed-by: kvn --- test/hotspot/jtreg/TEST.groups | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 1ffd4e5e0491f..2d3959701ff05 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -97,6 +97,7 @@ hotspot_slow_compiler = \ tier1_compiler_1 = \ compiler/arraycopy/ \ + compiler/blackhole/ \ compiler/c1/ \ compiler/c2/ \ -compiler/c2/Test6850611.java \ From a5297bd0d402d521916e597d7e1671c19f00db92 Mon Sep 17 00:00:00 2001 From: Dean Long Date: Mon, 7 Dec 2020 20:10:07 +0000 Subject: [PATCH 116/504] 8254939: macOS: unused function 'replicate4_imm' Reviewed-by: redestad, thartmann --- src/hotspot/cpu/x86/x86.ad | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index eff37d445c6e5..e5923f772193b 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -2371,19 +2371,6 @@ int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load, return size+offset_size; } -static inline jint replicate4_imm(int con, int width) { - // Load a constant of "width" (in bytes) and replicate it to fill 32bit. - assert(width == 1 || width == 2, "only byte or short types here"); - int bit_width = width * 8; - jint val = con; - val &= (1 << bit_width) - 1; // mask off sign bits - while(bit_width < 32) { - val |= (val << bit_width); - bit_width <<= 1; - } - return val; -} - static inline jlong replicate8_imm(int con, int width) { // Load a constant of "width" (in bytes) and replicate it to fill 64bit. assert(width == 1 || width == 2 || width == 4, "only byte, short or int types here"); From 6937d9f9ddb0a8b6dfeebbeb67e33e454ff10b7b Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 7 Dec 2020 20:46:22 +0000 Subject: [PATCH 117/504] 8257799: Update JLS cross-references in java.compiler Reviewed-by: jjg --- .../share/classes/javax/lang/model/SourceVersion.java | 4 ++-- .../classes/javax/lang/model/element/VariableElement.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java index 6900bf7280ca0..10384b13d7e26 100644 --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java @@ -392,7 +392,7 @@ public static boolean isName(CharSequence name, SourceVersion version) { * literal, or null literal, {@code false} otherwise. * @jls 3.9 Keywords * @jls 3.10.3 Boolean Literals - * @jls 3.10.7 The Null Literal + * @jls 3.10.8 The Null Literal */ public static boolean isKeyword(CharSequence s) { return isKeyword(s, latest()); @@ -410,7 +410,7 @@ public static boolean isKeyword(CharSequence s) { * literal, or null literal, {@code false} otherwise. * @jls 3.9 Keywords * @jls 3.10.3 Boolean Literals - * @jls 3.10.7 The Null Literal + * @jls 3.10.8 The Null Literal * @since 9 */ public static boolean isKeyword(CharSequence s, SourceVersion version) { diff --git a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java index 2b153b1c2b21f..3527898dfe474 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -73,7 +73,7 @@ public interface VariableElement extends Element { * otherwise * * @see Elements#getConstantExpression(Object) - * @jls 15.28 Constant Expression + * @jls 15.29 Constant Expressions * @jls 4.12.4 final Variables */ Object getConstantValue(); From f92745d73e7f16dc1b946c4d104849a2dfb0b55c Mon Sep 17 00:00:00 2001 From: Eric Caspole Date: Mon, 7 Dec 2020 21:31:19 +0000 Subject: [PATCH 118/504] 8257718: LogCompilation: late_inline doesnt work right for JDK 8 logs Reviewed-by: redestad, kvn --- .../main/java/com/sun/hotspot/tools/compiler/LogParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index 5b9c72fafe281..8318c3c6352a6 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -638,9 +638,9 @@ private void reportInternalError(String msg, Exception e) { } } if (e != null) { - throw new Error(msg, e); + throw new InternalError(msg, e); } else { - throw new Error(msg); + throw new InternalError(msg); } } From 149a02f99a10f42431bfa58ad7508f32285c33be Mon Sep 17 00:00:00 2001 From: David Holmes Date: Mon, 7 Dec 2020 21:56:05 +0000 Subject: [PATCH 119/504] 8257572: Deprecate the archaic signal-chaining interfaces: sigset and signal Reviewed-by: ihse, alanb, dcubed, erikj --- make/modules/java.base/Lib.gmk | 1 + src/java.base/unix/native/libjsig/jsig.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk index 40ad7b3de4f03..c48f327420a6a 100644 --- a/make/modules/java.base/Lib.gmk +++ b/make/modules/java.base/Lib.gmk @@ -128,6 +128,7 @@ endif ifeq ($(call isTargetOsType, unix), true) ifeq ($(STATIC_BUILD), false) + LIBJSIG_CFLAGS += -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \ NAME := jsig, \ OPTIMIZATION := LOW, \ diff --git a/src/java.base/unix/native/libjsig/jsig.c b/src/java.base/unix/native/libjsig/jsig.c index cb40a10d04753..1108b2f9ce5a3 100644 --- a/src/java.base/unix/native/libjsig/jsig.c +++ b/src/java.base/unix/native/libjsig/jsig.c @@ -29,6 +29,8 @@ * libthread to interpose the signal handler installation functions: * sigaction(), signal(), sigset(). * Used for signal-chaining. See RFE 4381843. + * Use of signal() and sigset() is now deprecated as these old API's should + * not be used - sigaction is the only truly supported API. */ #include "jni.h" @@ -99,6 +101,10 @@ static sa_handler_t call_os_signal(int sig, sa_handler_t disp, sa_handler_t res; if (os_signal == NULL) { + // Deprecation warning first time through + printf(HOTSPOT_VM_DISTRO " VM warning: the use of signal() and sigset() " + "for signal chaining was deprecated in version 16.0 and will " + "be removed in a future release. Use sigaction() instead.\n"); if (!is_sigset) { os_signal = (signal_function_t)dlsym(RTLD_NEXT, "signal"); } else { From 62c7788b296e0bdf17050b512d5a779c7d68522c Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 7 Dec 2020 22:50:38 +0000 Subject: [PATCH 120/504] 8257211: C2: Enable call devirtualization during post-parse phase Reviewed-by: kvn, neliasso, thartmann --- .../share/compiler/compilerDefinitions.cpp | 4 +- src/hotspot/share/opto/c2_globals.hpp | 6 + src/hotspot/share/opto/callGenerator.cpp | 363 +++++++++++++----- src/hotspot/share/opto/callGenerator.hpp | 33 +- src/hotspot/share/opto/callnode.cpp | 98 ++++- src/hotspot/share/opto/callnode.hpp | 50 ++- src/hotspot/share/opto/compile.cpp | 209 +++++++--- src/hotspot/share/opto/compile.hpp | 12 +- src/hotspot/share/opto/doCall.cpp | 40 +- src/hotspot/share/opto/multnode.cpp | 10 + src/hotspot/share/opto/multnode.hpp | 2 +- src/hotspot/share/opto/node.cpp | 23 +- src/hotspot/share/opto/phaseX.cpp | 31 +- src/hotspot/share/opto/phasetype.hpp | 2 + src/hotspot/share/utilities/growableArray.hpp | 8 + 15 files changed, 627 insertions(+), 264 deletions(-) diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index c12ca9a466cd9..5e3c2ef9052cd 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -494,8 +494,10 @@ void CompilerConfig::ergo_initialize() { if (!EliminateLocks) { EliminateNestedLocks = false; } - if (!Inline) { + if (!Inline || !IncrementalInline) { IncrementalInline = false; + IncrementalInlineMH = false; + IncrementalInlineVirtual = false; } #ifndef PRODUCT if (!IncrementalInline) { diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index c73696d6ca514..acf1d14006c2d 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -713,6 +713,12 @@ product(bool, IncrementalInline, true, \ "do post parse inlining") \ \ + product(bool, IncrementalInlineMH, true, DIAGNOSTIC, \ + "do post parse inlining of method handle calls") \ + \ + product(bool, IncrementalInlineVirtual, true, DIAGNOSTIC, \ + "do post parse inlining of virtual calls") \ + \ develop(bool, AlwaysIncrementalInline, false, \ "do all inlining incrementally") \ \ diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp index f6a2ae3c73ceb..934c445302fdf 100644 --- a/src/hotspot/share/opto/callGenerator.cpp +++ b/src/hotspot/share/opto/callGenerator.cpp @@ -121,6 +121,9 @@ class DirectCallGenerator : public CallGenerator { // paths to facilitate late inlinig. bool _separate_io_proj; +protected: + void set_call_node(CallStaticJavaNode* call) { _call_node = call; } + public: DirectCallGenerator(ciMethod* method, bool separate_io_proj) : CallGenerator(method), @@ -129,7 +132,12 @@ class DirectCallGenerator : public CallGenerator { } virtual JVMState* generate(JVMState* jvms); - CallStaticJavaNode* call_node() const { return _call_node; } + virtual CallNode* call_node() const { return _call_node; } + virtual CallGenerator* with_call_node(CallNode* call) { + DirectCallGenerator* dcg = new DirectCallGenerator(method(), _separate_io_proj); + dcg->set_call_node(call->as_CallStaticJava()); + return dcg; + } }; JVMState* DirectCallGenerator::generate(JVMState* jvms) { @@ -179,15 +187,30 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms) { class VirtualCallGenerator : public CallGenerator { private: int _vtable_index; + bool _separate_io_proj; + CallDynamicJavaNode* _call_node; + +protected: + void set_call_node(CallDynamicJavaNode* call) { _call_node = call; } + public: - VirtualCallGenerator(ciMethod* method, int vtable_index) - : CallGenerator(method), _vtable_index(vtable_index) + VirtualCallGenerator(ciMethod* method, int vtable_index, bool separate_io_proj) + : CallGenerator(method), _vtable_index(vtable_index), _separate_io_proj(separate_io_proj), _call_node(NULL) { assert(vtable_index == Method::invalid_vtable_index || vtable_index >= 0, "either invalid or usable"); } virtual bool is_virtual() const { return true; } virtual JVMState* generate(JVMState* jvms); + + virtual CallNode* call_node() const { return _call_node; } + int vtable_index() const { return _vtable_index; } + + virtual CallGenerator* with_call_node(CallNode* call) { + VirtualCallGenerator* cg = new VirtualCallGenerator(method(), _vtable_index, _separate_io_proj); + cg->set_call_node(call->as_CallDynamicJava()); + return cg; + } }; JVMState* VirtualCallGenerator::generate(JVMState* jvms) { @@ -250,9 +273,11 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms) { // make resolution logic work (see SharedRuntime::resolve_{virtual,opt_virtual}_call_C). call->set_override_symbolic_info(true); } + _call_node = call; // Save the call node in case we need it later + kit.set_arguments_for_java_call(call); - kit.set_edges_for_java_call(call); - Node* ret = kit.set_results_for_java_call(call); + kit.set_edges_for_java_call(call, false /*must_throw*/, _separate_io_proj); + Node* ret = kit.set_results_for_java_call(call, _separate_io_proj); kit.push_node(method()->return_type()->basic_type(), ret); // Represent the effect of an implicit receiver null_check @@ -285,7 +310,7 @@ CallGenerator* CallGenerator::for_direct_call(ciMethod* m, bool separate_io_proj CallGenerator* CallGenerator::for_virtual_call(ciMethod* m, int vtable_index) { assert(!m->is_static(), "for_virtual_call mismatch"); assert(!m->is_method_handle_intrinsic(), "should be a direct call"); - return new VirtualCallGenerator(m, vtable_index); + return new VirtualCallGenerator(m, vtable_index, false /*separate_io_projs*/); } // Allow inlining decisions to be delayed @@ -296,7 +321,9 @@ class LateInlineCallGenerator : public DirectCallGenerator { protected: CallGenerator* _inline_cg; - virtual bool do_late_inline_check(JVMState* jvms) { return true; } + virtual bool do_late_inline_check(Compile* C, JVMState* jvms) { return true; } + virtual CallGenerator* inline_cg() const { return _inline_cg; } + virtual bool is_pure_call() const { return _is_pure_call; } public: LateInlineCallGenerator(ciMethod* method, CallGenerator* inline_cg, bool is_pure_call = false) : @@ -341,11 +368,197 @@ class LateInlineCallGenerator : public DirectCallGenerator { virtual jlong unique_id() const { return _unique_id; } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineCallGenerator* cg = new LateInlineCallGenerator(method(), _inline_cg, _is_pure_call); + cg->set_call_node(call->as_CallStaticJava()); + return cg; + } +}; + +CallGenerator* CallGenerator::for_late_inline(ciMethod* method, CallGenerator* inline_cg) { + return new LateInlineCallGenerator(method, inline_cg); +} + +class LateInlineMHCallGenerator : public LateInlineCallGenerator { + ciMethod* _caller; + bool _input_not_const; + + virtual bool do_late_inline_check(Compile* C, JVMState* jvms); + + public: + LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) : + LateInlineCallGenerator(callee, NULL), _caller(caller), _input_not_const(input_not_const) {} + + virtual bool is_mh_late_inline() const { return true; } + + // Convert the CallStaticJava into an inline + virtual void do_late_inline(); + + virtual JVMState* generate(JVMState* jvms) { + JVMState* new_jvms = LateInlineCallGenerator::generate(jvms); + + Compile* C = Compile::current(); + if (_input_not_const) { + // inlining won't be possible so no need to enqueue right now. + call_node()->set_generator(this); + } else { + C->add_late_inline(this); + } + return new_jvms; + } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineMHCallGenerator* cg = new LateInlineMHCallGenerator(_caller, method(), _input_not_const); + cg->set_call_node(call->as_CallStaticJava()); + return cg; + } +}; + +bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms) { + // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call. + bool allow_inline = C->inlining_incrementally(); + CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), allow_inline, _input_not_const); + assert(!_input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place + + if (cg != NULL) { + assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline, "we're doing late inlining"); + _inline_cg = cg; + C->dec_number_of_mh_late_inlines(); + return true; + } else { + // Method handle call which has a constant appendix argument should be either inlined or replaced with a direct call + // unless there's a signature mismatch between caller and callee. If the failure occurs, there's not much to be improved later, + // so don't reinstall the generator to avoid pushing the generator between IGVN and incremental inlining indefinitely. + return false; + } +} + +CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) { + assert(IncrementalInlineMH, "required"); + Compile::current()->inc_number_of_mh_late_inlines(); + CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const); + return cg; +} + +// Allow inlining decisions to be delayed +class LateInlineVirtualCallGenerator : public VirtualCallGenerator { + private: + jlong _unique_id; // unique id for log compilation + CallGenerator* _inline_cg; + ciMethod* _callee; + bool _is_pure_call; + float _prof_factor; + + protected: + virtual bool do_late_inline_check(Compile* C, JVMState* jvms); + virtual CallGenerator* inline_cg() const { return _inline_cg; } + virtual bool is_pure_call() const { return _is_pure_call; } + + public: + LateInlineVirtualCallGenerator(ciMethod* method, int vtable_index, float prof_factor) + : VirtualCallGenerator(method, vtable_index, true /*separate_io_projs*/), + _unique_id(0), _inline_cg(NULL), _callee(NULL), _is_pure_call(false), _prof_factor(prof_factor) {} + + virtual bool is_late_inline() const { return true; } + + virtual bool is_virtual_late_inline() const { return true; } + + // Convert the CallDynamicJava into an inline + virtual void do_late_inline(); + + virtual void set_callee_method(ciMethod* m) { + assert(_callee == NULL, "repeated inlining attempt"); + _callee = m; + } + + virtual JVMState* generate(JVMState* jvms) { + // Emit the CallDynamicJava and request separate projections so + // that the late inlining logic can distinguish between fall + // through and exceptional uses of the memory and io projections + // as is done for allocations and macro expansion. + JVMState* new_jvms = VirtualCallGenerator::generate(jvms); + if (call_node() != NULL) { + call_node()->set_generator(this); + } + return new_jvms; + } + + virtual void print_inlining_late(const char* msg) { + CallNode* call = call_node(); + Compile* C = Compile::current(); + C->print_inlining_assert_ready(); + C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg); + C->print_inlining_move_to(this); + C->print_inlining_update_delayed(this); + } + + virtual void set_unique_id(jlong id) { + _unique_id = id; + } + + virtual jlong unique_id() const { + return _unique_id; + } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineVirtualCallGenerator* cg = new LateInlineVirtualCallGenerator(method(), vtable_index(), _prof_factor); + cg->set_call_node(call->as_CallDynamicJava()); + return cg; + } }; +bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms) { + // Method handle linker case is handled in CallDynamicJavaNode::Ideal(). + // Unless inlining is performed, _override_symbolic_info bit will be set in DirectCallGenerator::generate(). + + // Even if inlining is not allowed, a virtual call can be strength-reduced to a direct call. + bool allow_inline = C->inlining_incrementally(); + CallGenerator* cg = C->call_generator(_callee, + vtable_index(), + false /*call_does_dispatch*/, + jvms, + allow_inline, + _prof_factor, + NULL /*speculative_receiver_type*/, + true /*allow_intrinsics*/); + + if (cg != NULL) { + assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline, "we're doing late inlining"); + _inline_cg = cg; + return true; + } else { + // Virtual call which provably doesn't dispatch should be either inlined or replaced with a direct call. + assert(false, "no progress"); + return false; + } +} + +CallGenerator* CallGenerator::for_late_inline_virtual(ciMethod* m, int vtable_index, float prof_factor) { + assert(IncrementalInlineVirtual, "required"); + assert(!m->is_static(), "for_virtual_call mismatch"); + assert(!m->is_method_handle_intrinsic(), "should be a direct call"); + return new LateInlineVirtualCallGenerator(m, vtable_index, prof_factor); +} + void LateInlineCallGenerator::do_late_inline() { + CallGenerator::do_late_inline_helper(); +} + +void LateInlineMHCallGenerator::do_late_inline() { + CallGenerator::do_late_inline_helper(); +} + +void LateInlineVirtualCallGenerator::do_late_inline() { + assert(_callee != NULL, "required"); // set up in CallDynamicJavaNode::Ideal + CallGenerator::do_late_inline_helper(); +} + +void CallGenerator::do_late_inline_helper() { + assert(is_late_inline(), "only late inline allowed"); + // Can't inline it - CallStaticJavaNode* call = call_node(); + CallNode* call = call_node(); if (call == NULL || call->outcnt() == 0 || call->in(0) == NULL || call->in(0)->is_top()) { return; @@ -373,14 +586,14 @@ void LateInlineCallGenerator::do_late_inline() { // check for unreachable loop CallProjections callprojs; call->extract_projections(&callprojs, true); - if (callprojs.fallthrough_catchproj == call->in(0) || - callprojs.catchall_catchproj == call->in(0) || - callprojs.fallthrough_memproj == call->in(TypeFunc::Memory) || - callprojs.catchall_memproj == call->in(TypeFunc::Memory) || - callprojs.fallthrough_ioproj == call->in(TypeFunc::I_O) || - callprojs.catchall_ioproj == call->in(TypeFunc::I_O) || + if ((callprojs.fallthrough_catchproj == call->in(0)) || + (callprojs.catchall_catchproj == call->in(0)) || + (callprojs.fallthrough_memproj == call->in(TypeFunc::Memory)) || + (callprojs.catchall_memproj == call->in(TypeFunc::Memory)) || + (callprojs.fallthrough_ioproj == call->in(TypeFunc::I_O)) || + (callprojs.catchall_ioproj == call->in(TypeFunc::I_O)) || (callprojs.resproj != NULL && call->find_edge(callprojs.resproj) != -1) || - (callprojs.exobj != NULL && call->find_edge(callprojs.exobj) != -1)) { + (callprojs.exobj != NULL && call->find_edge(callprojs.exobj) != -1)) { return; } @@ -391,7 +604,7 @@ void LateInlineCallGenerator::do_late_inline() { } bool result_not_used = (callprojs.resproj == NULL || callprojs.resproj->outcnt() == 0); - if (_is_pure_call && result_not_used) { + if (is_pure_call() && result_not_used) { // The call is marked as pure (no important side effects), but result isn't used. // It's safe to remove the call. GraphKit kit(call->jvms()); @@ -434,10 +647,10 @@ void LateInlineCallGenerator::do_late_inline() { C->log_late_inline(this); - // This check is done here because for_method_handle_inline() method - // needs jvms for inlined state. - if (!do_late_inline_check(jvms)) { + // JVMState is ready, so time to perform some checks and prepare for inlining attempt. + if (!do_late_inline_check(C, jvms)) { map->disconnect_inputs(C); + C->print_inlining_update_delayed(this); return; } @@ -449,8 +662,15 @@ void LateInlineCallGenerator::do_late_inline() { C->set_default_node_notes(entry_nn); } + // Virtual call involves a receiver null check which can be made implicit. + if (is_virtual_late_inline()) { + GraphKit kit(jvms); + kit.null_check_receiver(); + jvms = kit.transfer_exceptions_into_jvms(); + } + // Now perform the inlining using the synthesized JVMState - JVMState* new_jvms = _inline_cg->generate(jvms); + JVMState* new_jvms = inline_cg()->generate(jvms); if (new_jvms == NULL) return; // no change if (C->failing()) return; @@ -464,73 +684,16 @@ void LateInlineCallGenerator::do_late_inline() { result = (result_size == 1) ? kit.pop() : kit.pop_pair(); } - C->env()->notice_inlined_method(_inline_cg->method()); + if (inline_cg()->is_inline()) { + C->set_has_loops(C->has_loops() || inline_cg()->method()->has_loops()); + C->env()->notice_inlined_method(inline_cg()->method()); + } C->set_inlining_progress(true); C->set_do_cleanup(kit.stopped()); // path is dead; needs cleanup kit.replace_call(call, result, true); } } - -CallGenerator* CallGenerator::for_late_inline(ciMethod* method, CallGenerator* inline_cg) { - return new LateInlineCallGenerator(method, inline_cg); -} - -class LateInlineMHCallGenerator : public LateInlineCallGenerator { - ciMethod* _caller; - int _attempt; - bool _input_not_const; - - virtual bool do_late_inline_check(JVMState* jvms); - virtual bool already_attempted() const { return _attempt > 0; } - - public: - LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) : - LateInlineCallGenerator(callee, NULL), _caller(caller), _attempt(0), _input_not_const(input_not_const) {} - - virtual bool is_mh_late_inline() const { return true; } - - virtual JVMState* generate(JVMState* jvms) { - JVMState* new_jvms = LateInlineCallGenerator::generate(jvms); - - Compile* C = Compile::current(); - if (_input_not_const) { - // inlining won't be possible so no need to enqueue right now. - call_node()->set_generator(this); - } else { - C->add_late_inline(this); - } - return new_jvms; - } -}; - -bool LateInlineMHCallGenerator::do_late_inline_check(JVMState* jvms) { - - CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const); - - Compile::current()->print_inlining_update_delayed(this); - - if (!_input_not_const) { - _attempt++; - } - - if (cg != NULL && cg->is_inline()) { - assert(!cg->is_late_inline(), "we're doing late inlining"); - _inline_cg = cg; - Compile::current()->dec_number_of_mh_late_inlines(); - return true; - } - - call_node()->set_generator(this); - return false; -} - -CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) { - Compile::current()->inc_number_of_mh_late_inlines(); - CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const); - return cg; -} - class LateInlineStringCallGenerator : public LateInlineCallGenerator { public: @@ -549,6 +712,12 @@ class LateInlineStringCallGenerator : public LateInlineCallGenerator { } virtual bool is_string_late_inline() const { return true; } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineStringCallGenerator* cg = new LateInlineStringCallGenerator(method(), _inline_cg); + cg->set_call_node(call->as_CallStaticJava()); + return cg; + } }; CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGenerator* inline_cg) { @@ -571,6 +740,12 @@ class LateInlineBoxingCallGenerator : public LateInlineCallGenerator { JVMState* new_jvms = DirectCallGenerator::generate(jvms); return new_jvms; } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineBoxingCallGenerator* cg = new LateInlineBoxingCallGenerator(method(), _inline_cg); + cg->set_call_node(call->as_CallStaticJava()); + return cg; + } }; CallGenerator* CallGenerator::for_boxing_late_inline(ciMethod* method, CallGenerator* inline_cg) { @@ -593,6 +768,12 @@ class LateInlineVectorReboxingCallGenerator : public LateInlineCallGenerator { JVMState* new_jvms = DirectCallGenerator::generate(jvms); return new_jvms; } + + virtual CallGenerator* with_call_node(CallNode* call) { + LateInlineVectorReboxingCallGenerator* cg = new LateInlineVectorReboxingCallGenerator(method(), _inline_cg); + cg->set_call_node(call->as_CallStaticJava()); + return cg; + } }; // static CallGenerator* for_vector_reboxing_late_inline(ciMethod* m, CallGenerator* inline_cg); @@ -850,10 +1031,10 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms) { } -CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee) { +CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline) { assert(callee->is_method_handle_intrinsic(), "for_method_handle_call mismatch"); bool input_not_const; - CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, input_not_const); + CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, allow_inline, input_not_const); Compile* C = Compile::current(); if (cg != NULL) { if (AlwaysIncrementalInline) { @@ -866,7 +1047,7 @@ CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* c ciCallProfile profile = caller->call_profile_at_bci(bci); int call_site_count = caller->scale_count(profile.count()); - if (IncrementalInline && call_site_count > 0 && + if (IncrementalInlineMH && call_site_count > 0 && (input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) { return CallGenerator::for_mh_late_inline(caller, callee, input_not_const); } else { @@ -900,12 +1081,15 @@ JVMState* NativeCallGenerator::generate(JVMState* jvms) { return kit.transfer_exceptions_into_jvms(); } -CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) { +CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline, bool& input_not_const) { GraphKit kit(jvms); PhaseGVN& gvn = kit.gvn(); Compile* C = kit.C; vmIntrinsics::ID iid = callee->intrinsic_id(); input_not_const = true; + if (StressMethodHandleLinkerInlining) { + allow_inline = false; + } switch (iid) { case vmIntrinsics::_invokeBasic: { @@ -926,7 +1110,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* CallGenerator* cg = C->call_generator(target, vtable_index, false /* call_does_dispatch */, jvms, - true /* allow_inline */, + allow_inline, PROB_ALWAYS); return cg; } else { @@ -1002,7 +1186,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* // optimize_virtual_call() takes 2 different holder // arguments for a corner case that doesn't apply here (see // Parse::do_call()) - target = C->optimize_virtual_call(caller, jvms->bci(), klass, klass, + target = C->optimize_virtual_call(caller, klass, klass, target, receiver_type, is_virtual, call_does_dispatch, vtable_index, // out-parameters false /* check_access */); @@ -1011,7 +1195,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL; } CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, - !StressMethodHandleLinkerInlining /* allow_inline */, + allow_inline, PROB_ALWAYS, speculative_receiver_type); return cg; @@ -1026,6 +1210,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* { Node* nep = kit.argument(callee->arg_size() - 1); if (nep->Opcode() == Op_ConP) { + input_not_const = false; const TypeOopPtr* oop_ptr = nep->bottom_type()->is_oopptr(); ciNativeEntryPoint* nep = oop_ptr->const_oop()->as_native_entry_point(); return new NativeCallGenerator(callee, nep); @@ -1060,7 +1245,7 @@ class PredicatedIntrinsicGenerator : public CallGenerator { } virtual bool is_virtual() const { return true; } - virtual bool is_inlined() const { return true; } + virtual bool is_inline() const { return true; } virtual bool is_intrinsic() const { return true; } virtual JVMState* generate(JVMState* jvms); diff --git a/src/hotspot/share/opto/callGenerator.hpp b/src/hotspot/share/opto/callGenerator.hpp index 952dcf202c98b..27b11b37a2e28 100644 --- a/src/hotspot/share/opto/callGenerator.hpp +++ b/src/hotspot/share/opto/callGenerator.hpp @@ -42,6 +42,12 @@ class CallGenerator : public ResourceObj { protected: CallGenerator(ciMethod* method) : _method(method) {} + void do_late_inline_helper(); + + virtual bool do_late_inline_check(Compile* C, JVMState* jvms) { ShouldNotReachHere(); return false; } + virtual CallGenerator* inline_cg() const { ShouldNotReachHere(); return NULL; } + virtual bool is_pure_call() const { ShouldNotReachHere(); return false; } + public: // Accessors ciMethod* method() const { return _method; } @@ -65,25 +71,32 @@ class CallGenerator : public ResourceObj { virtual bool does_virtual_dispatch() const { return false; } // is_late_inline: supports conversion of call into an inline - virtual bool is_late_inline() const { return false; } + virtual bool is_late_inline() const { return false; } // same but for method handle calls - virtual bool is_mh_late_inline() const { return false; } - virtual bool is_string_late_inline() const{ return false; } - - // for method handle calls: have we tried inlinining the call already? - virtual bool already_attempted() const { ShouldNotReachHere(); return false; } + virtual bool is_mh_late_inline() const { return false; } + virtual bool is_string_late_inline() const { return false; } + virtual bool is_virtual_late_inline() const { return false; } // Replace the call with an inline version of the code virtual void do_late_inline() { ShouldNotReachHere(); } - virtual CallStaticJavaNode* call_node() const { ShouldNotReachHere(); return NULL; } + virtual CallNode* call_node() const { return NULL; } + virtual CallGenerator* with_call_node(CallNode* call) { return this; } virtual void set_unique_id(jlong id) { fatal("unique id only for late inlines"); }; virtual jlong unique_id() const { fatal("unique id only for late inlines"); return 0; }; + virtual void set_callee_method(ciMethod* callee) { ShouldNotReachHere(); } + // Note: It is possible for a CG to be both inline and virtual. // (The hashCode intrinsic does a vtable check and an inlined fast path.) + // Allocate CallGenerators only in Compile arena since some of them are referenced from CallNodes. + void* operator new(size_t size) throw() { + Compile* C = Compile::current(); + return ResourceObj::operator new(size, C->comp_arena()); + } + // Utilities: const TypeFunc* tf() const; @@ -119,8 +132,8 @@ class CallGenerator : public ResourceObj { static CallGenerator* for_direct_call(ciMethod* m, bool separate_io_projs = false); // static, special static CallGenerator* for_virtual_call(ciMethod* m, int vtable_index); // virtual, interface - static CallGenerator* for_method_handle_call( JVMState* jvms, ciMethod* caller, ciMethod* callee); - static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const); + static CallGenerator* for_method_handle_call( JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline); + static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool allow_inline, bool& input_not_const); // How to generate a replace a direct call with an inline version static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg); @@ -134,6 +147,8 @@ class CallGenerator : public ResourceObj { CallGenerator* if_cold, CallGenerator* if_hot); + static CallGenerator* for_late_inline_virtual(ciMethod* m, int vtable_index, float expected_uses); + // How to make a call that optimistically assumes a receiver type: static CallGenerator* for_predicted_call(ciKlass* predicted_receiver, CallGenerator* if_missed, diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp index edd95b7332db5..a58daa04e23d6 100644 --- a/src/hotspot/share/opto/callnode.cpp +++ b/src/hotspot/share/opto/callnode.cpp @@ -627,7 +627,7 @@ JVMState* JVMState::clone_deep(Compile* C) const { * Reset map for all callers */ void JVMState::set_map_deep(SafePointNode* map) { - for (JVMState* p = this; p->_caller != NULL; p = p->_caller) { + for (JVMState* p = this; p != NULL; p = p->_caller) { p->set_map(map); } } @@ -942,25 +942,15 @@ void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj } } -Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) { +Node* CallNode::Ideal(PhaseGVN* phase, bool can_reshape) { +#ifdef ASSERT + // Validate attached generator CallGenerator* cg = generator(); - if (can_reshape && cg != NULL && cg->is_mh_late_inline() && !cg->already_attempted()) { - // Check whether this MH handle call becomes a candidate for inlining - ciMethod* callee = cg->method(); - vmIntrinsics::ID iid = callee->intrinsic_id(); - if (iid == vmIntrinsics::_invokeBasic) { - if (in(TypeFunc::Parms)->Opcode() == Op_ConP) { - phase->C->prepend_late_inline(cg); - set_generator(NULL); - } - } else { - assert(callee->has_member_arg(), "wrong type of call?"); - if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) { - phase->C->prepend_late_inline(cg); - set_generator(NULL); - } - } + if (cg != NULL) { + assert(is_CallStaticJava() && cg->is_mh_late_inline() || + is_CallDynamicJava() && cg->is_virtual_late_inline(), "mismatch"); } +#endif // ASSERT return SafePointNode::Ideal(phase, can_reshape); } @@ -979,7 +969,7 @@ bool CallJavaNode::cmp( const Node &n ) const { _override_symbolic_info == call._override_symbolic_info; } -void CallJavaNode::copy_call_debug_info(PhaseIterGVN* phase, SafePointNode *sfpt) { +void CallJavaNode::copy_call_debug_info(PhaseIterGVN* phase, SafePointNode* sfpt) { // Copy debug information and adjust JVMState information uint old_dbg_start = sfpt->is_Call() ? sfpt->as_Call()->tf()->domain()->cnt() : (uint)TypeFunc::Parms+1; uint new_dbg_start = tf()->domain()->cnt(); @@ -1034,7 +1024,7 @@ bool CallJavaNode::validate_symbolic_info() const { #endif #ifndef PRODUCT -void CallJavaNode::dump_spec(outputStream *st) const { +void CallJavaNode::dump_spec(outputStream* st) const { if( _method ) _method->print_short_name(st); CallNode::dump_spec(st); } @@ -1055,6 +1045,32 @@ bool CallStaticJavaNode::cmp( const Node &n ) const { return CallJavaNode::cmp(call); } +Node* CallStaticJavaNode::Ideal(PhaseGVN* phase, bool can_reshape) { + CallGenerator* cg = generator(); + if (can_reshape && cg != NULL) { + assert(IncrementalInlineMH, "required"); + assert(cg->call_node() == this, "mismatch"); + assert(cg->is_mh_late_inline(), "not virtual"); + + // Check whether this MH handle call becomes a candidate for inlining. + ciMethod* callee = cg->method(); + vmIntrinsics::ID iid = callee->intrinsic_id(); + if (iid == vmIntrinsics::_invokeBasic) { + if (in(TypeFunc::Parms)->Opcode() == Op_ConP) { + phase->C->prepend_late_inline(cg); + set_generator(NULL); + } + } else { + assert(callee->has_member_arg(), "wrong type of call?"); + if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) { + phase->C->prepend_late_inline(cg); + set_generator(NULL); + } + } + } + return CallNode::Ideal(phase, can_reshape); +} + //----------------------------uncommon_trap_request---------------------------- // If this is an uncommon trap, return the request code, else zero. int CallStaticJavaNode::uncommon_trap_request() const { @@ -1111,6 +1127,48 @@ bool CallDynamicJavaNode::cmp( const Node &n ) const { CallDynamicJavaNode &call = (CallDynamicJavaNode&)n; return CallJavaNode::cmp(call); } + +Node* CallDynamicJavaNode::Ideal(PhaseGVN* phase, bool can_reshape) { + CallGenerator* cg = generator(); + if (can_reshape && cg != NULL) { + assert(IncrementalInlineVirtual, "required"); + assert(cg->call_node() == this, "mismatch"); + assert(cg->is_virtual_late_inline(), "not virtual"); + + // Recover symbolic info for method resolution. + ciMethod* caller = jvms()->method(); + ciBytecodeStream iter(caller); + iter.force_bci(jvms()->bci()); + + bool not_used1; + ciSignature* not_used2; + ciMethod* orig_callee = iter.get_method(not_used1, ¬_used2); // callee in the bytecode + ciKlass* holder = iter.get_declared_method_holder(); + if (orig_callee->is_method_handle_intrinsic()) { + assert(_override_symbolic_info, "required"); + orig_callee = method(); + holder = method()->holder(); + } + + ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder); + + Node* receiver_node = in(TypeFunc::Parms); + const TypeOopPtr* receiver_type = phase->type(receiver_node)->isa_oopptr(); + + int not_used3; + bool call_does_dispatch; + ciMethod* callee = phase->C->optimize_virtual_call(caller, klass, holder, orig_callee, receiver_type, true /*is_virtual*/, + call_does_dispatch, not_used3); // out-parameters + if (!call_does_dispatch) { + // Register for late inlining. + cg->set_callee_method(callee); + phase->C->prepend_late_inline(cg); // MH late inlining prepends to the list, so do the same + set_generator(NULL); + } + } + return CallNode::Ideal(phase, can_reshape); +} + #ifndef PRODUCT void CallDynamicJavaNode::dump_spec(outputStream *st) const { st->print("# Dynamic "); diff --git a/src/hotspot/share/opto/callnode.hpp b/src/hotspot/share/opto/callnode.hpp index 636618066495b..44db1391b4e32 100644 --- a/src/hotspot/share/opto/callnode.hpp +++ b/src/hotspot/share/opto/callnode.hpp @@ -570,14 +570,14 @@ class CallNode : public SafePointNode { friend class VMStructs; protected: - bool may_modify_arraycopy_helper(const TypeOopPtr* dest_t, const TypeOopPtr *t_oop, PhaseTransform *phase); + bool may_modify_arraycopy_helper(const TypeOopPtr* dest_t, const TypeOopPtr* t_oop, PhaseTransform* phase); public: - const TypeFunc *_tf; // Function type - address _entry_point; // Address of method being called - float _cnt; // Estimate of number of times called - CallGenerator* _generator; // corresponding CallGenerator for some late inline calls - const char *_name; // Printable name, if _method is NULL + const TypeFunc* _tf; // Function type + address _entry_point; // Address of method being called + float _cnt; // Estimate of number of times called + CallGenerator* _generator; // corresponding CallGenerator for some late inline calls + const char* _name; // Printable name, if _method is NULL CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type) : SafePointNode(tf->domain()->cnt(), NULL, adr_type), @@ -600,14 +600,14 @@ class CallNode : public SafePointNode { void set_cnt(float c) { _cnt = c; } void set_generator(CallGenerator* cg) { _generator = cg; } - virtual const Type *bottom_type() const; + virtual const Type* bottom_type() const; virtual const Type* Value(PhaseGVN* phase) const; - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); virtual Node* Identity(PhaseGVN* phase) { return this; } - virtual bool cmp( const Node &n ) const; + virtual bool cmp(const Node &n) const; virtual uint size_of() const = 0; - virtual void calling_convention( BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt ) const; - virtual Node *match( const ProjNode *proj, const Matcher *m ); + virtual void calling_convention(BasicType* sig_bt, VMRegPair* parm_regs, uint argcnt) const; + virtual Node* match(const ProjNode* proj, const Matcher* m); virtual uint ideal_reg() const { return NotAMachineReg; } // Are we guaranteed that this node is a safepoint? Not true for leaf calls and // for some macro nodes whose expansion does not have a safepoint on the fast path. @@ -623,16 +623,16 @@ class CallNode : public SafePointNode { } // Returns true if the call may modify n - virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase); + virtual bool may_modify(const TypeOopPtr* t_oop, PhaseTransform* phase); // Does this node have a use of n other than in debug information? - bool has_non_debug_use(Node *n); + bool has_non_debug_use(Node* n); // Returns the unique CheckCastPP of a call // or result projection is there are several CheckCastPP // or returns NULL if there is no one. - Node *result_cast(); + Node* result_cast(); // Does this node returns pointer? bool returns_pointer() const { - const TypeTuple *r = tf()->range(); + const TypeTuple* r = tf()->range(); return (r->cnt() > TypeFunc::Parms && r->field_at(TypeFunc::Parms)->isa_ptr()); } @@ -646,11 +646,11 @@ class CallNode : public SafePointNode { bool is_call_to_arraycopystub() const; - virtual void copy_call_debug_info(PhaseIterGVN* phase, SafePointNode *sfpt) {} + virtual void copy_call_debug_info(PhaseIterGVN* phase, SafePointNode* sfpt) {} #ifndef PRODUCT - virtual void dump_req(outputStream *st = tty) const; - virtual void dump_spec(outputStream *st) const; + virtual void dump_req(outputStream* st = tty) const; + virtual void dump_spec(outputStream* st) const; #endif }; @@ -736,7 +736,7 @@ class CallStaticJavaNode : public CallJavaNode { bool is_boxing_method() const { return is_macro() && (method() != NULL) && method()->is_boxing_method(); } - // Later inlining modifies the JVMState, so we need to clone it + // Late inlining modifies the JVMState, so we need to clone it // when the call node is cloned (because it is macro node). virtual void clone_jvms(Compile* C) { if ((jvms() != NULL) && is_boxing_method()) { @@ -746,6 +746,8 @@ class CallStaticJavaNode : public CallJavaNode { } virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); + #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; virtual void dump_compact_spec(outputStream *st) const; @@ -762,8 +764,18 @@ class CallDynamicJavaNode : public CallJavaNode { init_class_id(Class_CallDynamicJava); } + // Late inlining modifies the JVMState, so we need to clone it + // when the call node is cloned. + virtual void clone_jvms(Compile* C) { + if ((jvms() != NULL) && IncrementalInlineVirtual) { + set_jvms(jvms()->clone_deep(C)); + jvms()->set_map_deep(this); + } + } + int _vtable_index; virtual int Opcode() const; + virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); #ifndef PRODUCT virtual void dump_spec(outputStream *st) const; #endif diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 65061c8b769ac..3468593932499 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -339,26 +339,71 @@ void Compile::remove_useless_late_inlines(GrowableArray* inlines int shift = 0; for (int i = 0; i < inlines->length(); i++) { CallGenerator* cg = inlines->at(i); - CallNode* call = cg->call_node(); - if (shift > 0) { - inlines->at_put(i-shift, cg); + if (useful.member(cg->call_node())) { + if (shift > 0) { + inlines->at_put(i - shift, cg); + } + } else { + shift++; // skip over the dead element } - if (!useful.member(call)) { - shift++; + } + if (shift > 0) { + inlines->trunc_to(inlines->length() - shift); // remove last elements from compacted array + } +} + +void Compile::remove_useless_late_inlines(GrowableArray* inlines, Node* dead) { + assert(dead != NULL && dead->is_Call(), "sanity"); + int found = 0; + for (int i = 0; i < inlines->length(); i++) { + if (inlines->at(i)->call_node() == dead) { + inlines->remove_at(i); + found++; + NOT_DEBUG( break; ) // elements are unique, so exit early } } - inlines->trunc_to(inlines->length()-shift); + assert(found <= 1, "not unique"); } void Compile::remove_useless_nodes(GrowableArray& node_list, Unique_Node_List& useful) { for (int i = node_list.length() - 1; i >= 0; i--) { Node* n = node_list.at(i); if (!useful.member(n)) { - node_list.remove_if_existing(n); + node_list.delete_at(i); // replaces i-th with last element which is known to be useful (already processed) } } } +void Compile::remove_useless_node(Node* dead) { + remove_modified_node(dead); + + // Constant node that has no out-edges and has only one in-edge from + // root is usually dead. However, sometimes reshaping walk makes + // it reachable by adding use edges. So, we will NOT count Con nodes + // as dead to be conservative about the dead node count at any + // given time. + if (!dead->is_Con()) { + record_dead_node(dead->_idx); + } + if (dead->is_macro()) { + remove_macro_node(dead); + } + if (dead->is_expensive()) { + remove_expensive_node(dead); + } + if (dead->for_post_loop_opts_igvn()) { + remove_from_post_loop_opts_igvn(dead); + } + if (dead->is_Call()) { + remove_useless_late_inlines( &_late_inlines, dead); + remove_useless_late_inlines( &_string_late_inlines, dead); + remove_useless_late_inlines( &_boxing_late_inlines, dead); + remove_useless_late_inlines(&_vector_reboxing_late_inlines, dead); + } + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + bs->unregister_potential_barrier_node(dead); +} + // Disconnect all useless nodes by disconnecting those at the boundary. void Compile::remove_useless_nodes(Unique_Node_List &useful) { uint next = 0; @@ -394,9 +439,9 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) { BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); bs->eliminate_useless_gc_barriers(useful, this); // clean up the late inline lists - remove_useless_late_inlines(&_string_late_inlines, useful); - remove_useless_late_inlines(&_boxing_late_inlines, useful); - remove_useless_late_inlines(&_late_inlines, useful); + remove_useless_late_inlines( &_late_inlines, useful); + remove_useless_late_inlines( &_string_late_inlines, useful); + remove_useless_late_inlines( &_boxing_late_inlines, useful); remove_useless_late_inlines(&_vector_reboxing_late_inlines, useful); debug_only(verify_graph_edges(true/*check for no_dead_code*/);) } @@ -1860,21 +1905,34 @@ bool Compile::inline_incrementally_one() { assert(IncrementalInline, "incremental inlining should be on"); TracePhase tp("incrementalInline_inline", &timers[_t_incrInline_inline]); + set_inlining_progress(false); set_do_cleanup(false); - int i = 0; - for (; i <_late_inlines.length() && !inlining_progress(); i++) { - CallGenerator* cg = _late_inlines.at(i); + + for (int i = 0; i < _late_inlines.length(); i++) { _late_inlines_pos = i+1; - cg->do_late_inline(); - if (failing()) return false; - } - int j = 0; - for (; i < _late_inlines.length(); i++, j++) { - _late_inlines.at_put(j, _late_inlines.at(i)); + CallGenerator* cg = _late_inlines.at(i); + bool does_dispatch = cg->is_virtual_late_inline() || cg->is_mh_late_inline(); + if (inlining_incrementally() || does_dispatch) { // a call can be either inlined or strength-reduced to a direct call + cg->do_late_inline(); + assert(_late_inlines.at(i) == cg, "no insertions before current position allowed"); + if (failing()) { + return false; + } else if (inlining_progress()) { + _late_inlines_pos = i+1; // restore the position in case new elements were inserted + print_method(PHASE_INCREMENTAL_INLINE_STEP, cg->call_node(), 3); + break; // process one call site at a time + } + } else { + // Ignore late inline direct calls when inlining is not allowed. + // They are left in the late inline list when node budget is exhausted until the list is fully drained. + } } - _late_inlines.trunc_to(j); - assert(inlining_progress() || _late_inlines.length() == 0, ""); + // Remove processed elements. + _late_inlines.remove_till(_late_inlines_pos); + _late_inlines_pos = 0; + + assert(inlining_progress() || _late_inlines.length() == 0, "no progress"); bool needs_cleanup = do_cleanup() || over_inlining_cutoff(); @@ -1896,6 +1954,7 @@ void Compile::inline_incrementally_cleanup(PhaseIterGVN& igvn) { igvn = PhaseIterGVN(initial_gvn()); igvn.optimize(); } + print_method(PHASE_INCREMENTAL_INLINE_CLEANUP, 3); } // Perform incremental inlining until bound on number of live nodes is reached @@ -1919,6 +1978,18 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) { } if (live_nodes() > (uint)LiveNodeCountInliningCutoff) { + bool do_print_inlining = print_inlining() || print_intrinsics(); + if (do_print_inlining || log() != NULL) { + // Print inlining message for candidates that we couldn't inline for lack of space. + for (int i = 0; i < _late_inlines.length(); i++) { + CallGenerator* cg = _late_inlines.at(i); + const char* msg = "live nodes > LiveNodeCountInliningCutoff"; + if (do_print_inlining) { + cg->print_inlining_late(msg); + } + log_late_inline_failure(cg, msg); + } + } break; // finish } } @@ -1929,7 +2000,6 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) { while (inline_incrementally_one()) { assert(!failing(), "inconsistent"); } - if (failing()) return; inline_incrementally_cleanup(igvn); @@ -1937,6 +2007,10 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) { print_method(PHASE_INCREMENTAL_INLINE_STEP, 3); if (failing()) return; + + if (_late_inlines.length() == 0) { + break; // no more progress + } } assert( igvn._worklist.size() == 0, "should be done with igvn" ); @@ -1955,6 +2029,27 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) { set_inlining_incrementally(false); } +void Compile::process_late_inline_calls_no_inline(PhaseIterGVN& igvn) { + // "inlining_incrementally() == false" is used to signal that no inlining is allowed + // (see LateInlineVirtualCallGenerator::do_late_inline_check() for details). + // Tracking and verification of modified nodes is disabled by setting "_modified_nodes == NULL" + // as if "inlining_incrementally() == true" were set. + assert(inlining_incrementally() == false, "not allowed"); + assert(_modified_nodes == NULL, "not allowed"); + assert(_late_inlines.length() > 0, "sanity"); + + while (_late_inlines.length() > 0) { + for_igvn()->clear(); + initial_gvn()->replace_with(&igvn); + + while (inline_incrementally_one()) { + assert(!failing(), "inconsistent"); + } + if (failing()) return; + + inline_incrementally_cleanup(igvn); + } +} bool Compile::optimize_loops(PhaseIterGVN& igvn, LoopOptsMode mode) { if (_loop_opts_cnt > 0) { @@ -2235,10 +2330,20 @@ void Compile::Optimize() { } DEBUG_ONLY( _modified_nodes = NULL; ) + assert(igvn._worklist.size() == 0, "not empty"); + + assert(_late_inlines.length() == 0 || IncrementalInlineMH || IncrementalInlineVirtual, "not empty"); + + if (_late_inlines.length() > 0) { + // More opportunities to optimize virtual and MH calls. + // Though it's maybe too late to perform inlining, strength-reducing them to direct calls is still an option. + process_late_inline_calls_no_inline(igvn); + } } // (End scope of igvn; run destructor if necessary for asserts.) process_print_inlining(); + // A method with only infinite loops has no edges entering loops from root { TracePhase tp("graphReshape", &timers[_t_graphReshaping]); @@ -2254,8 +2359,6 @@ void Compile::Optimize() { void Compile::inline_vector_reboxing_calls() { if (C->_vector_reboxing_late_inlines.length() > 0) { - PhaseGVN* gvn = C->initial_gvn(); - _late_inlines_pos = C->_late_inlines.length(); while (_vector_reboxing_late_inlines.length() > 0) { CallGenerator* cg = _vector_reboxing_late_inlines.pop(); @@ -3261,25 +3364,17 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f } case Op_Proj: { - if (OptimizeStringConcat) { - ProjNode* p = n->as_Proj(); - if (p->_is_io_use) { + if (OptimizeStringConcat || IncrementalInline) { + ProjNode* proj = n->as_Proj(); + if (proj->_is_io_use) { + assert(proj->_con == TypeFunc::I_O || proj->_con == TypeFunc::Memory, ""); // Separate projections were used for the exception path which // are normally removed by a late inline. If it wasn't inlined // then they will hang around and should just be replaced with - // the original one. - Node* proj = NULL; - // Replace with just one - for (SimpleDUIterator i(p->in(0)); i.has_next(); i.next()) { - Node *use = i.get(); - if (use->is_Proj() && p != use && use->as_Proj()->_con == p->_con) { - proj = use; - break; - } - } - assert(proj != NULL || p->_con == TypeFunc::I_O, "io may be dropped at an infinite loop"); - if (proj != NULL) { - p->subsume_by(proj, this); + // the original one. Merge them. + Node* non_io_proj = proj->in(0)->as_Multi()->proj_out_or_null(proj->_con, false /*is_io_use*/); + if (non_io_proj != NULL) { + proj->subsume_by(non_io_proj , this); } } } @@ -4141,12 +4236,7 @@ Compile::PrintInliningBuffer& Compile::print_inlining_current() { void Compile::print_inlining_update(CallGenerator* cg) { if (print_inlining() || print_intrinsics()) { - if (!cg->is_late_inline()) { - if (print_inlining_current().cg() != NULL) { - print_inlining_push(); - } - print_inlining_commit(); - } else { + if (cg->is_late_inline()) { if (print_inlining_current().cg() != cg && (print_inlining_current().cg() != NULL || print_inlining_current().ss()->size() != 0)) { @@ -4154,6 +4244,11 @@ void Compile::print_inlining_update(CallGenerator* cg) { } print_inlining_commit(); print_inlining_current().set_cg(cg); + } else { + if (print_inlining_current().cg() != NULL) { + print_inlining_push(); + } + print_inlining_commit(); } } } @@ -4161,7 +4256,7 @@ void Compile::print_inlining_update(CallGenerator* cg) { void Compile::print_inlining_move_to(CallGenerator* cg) { // We resume inlining at a late inlining call site. Locate the // corresponding inlining buffer so that we can update it. - if (print_inlining()) { + if (print_inlining() || print_intrinsics()) { for (int i = 0; i < _print_inlining_list->length(); i++) { if (_print_inlining_list->adr_at(i)->cg() == cg) { _print_inlining_idx = i; @@ -4173,7 +4268,7 @@ void Compile::print_inlining_move_to(CallGenerator* cg) { } void Compile::print_inlining_update_delayed(CallGenerator* cg) { - if (print_inlining()) { + if (print_inlining() || print_intrinsics()) { assert(_print_inlining_stream->size() > 0, "missing inlining msg"); assert(print_inlining_current().cg() == cg, "wrong entry"); // replace message with new message @@ -4188,22 +4283,8 @@ void Compile::print_inlining_assert_ready() { } void Compile::process_print_inlining() { - bool do_print_inlining = print_inlining() || print_intrinsics(); - if (do_print_inlining || log() != NULL) { - // Print inlining message for candidates that we couldn't inline - // for lack of space - for (int i = 0; i < _late_inlines.length(); i++) { - CallGenerator* cg = _late_inlines.at(i); - if (!cg->is_mh_late_inline()) { - const char* msg = "live nodes > LiveNodeCountInliningCutoff"; - if (do_print_inlining) { - cg->print_inlining_late(msg); - } - log_late_inline_failure(cg, msg); - } - } - } - if (do_print_inlining) { + assert(_late_inlines.length() == 0, "not drained yet"); + if (print_inlining() || print_intrinsics()) { ResourceMark rm; stringStream ss; assert(_print_inlining_list != NULL, "process_print_inlining should be called only once."); diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index 21cd5e4ca888e..e45d73a21fad1 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -864,12 +864,12 @@ class Compile : public Phase { bool should_delay_vector_reboxing_inlining(ciMethod* call_method, JVMState* jvms); // Helper functions to identify inlining potential at call-site - ciMethod* optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass, + ciMethod* optimize_virtual_call(ciMethod* caller, ciInstanceKlass* klass, ciKlass* holder, ciMethod* callee, const TypeOopPtr* receiver_type, bool is_virtual, bool &call_does_dispatch, int &vtable_index, bool check_access = true); - ciMethod* optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass, + ciMethod* optimize_inlining(ciMethod* caller, ciInstanceKlass* klass, ciMethod* callee, const TypeOopPtr* receiver_type, bool check_access = true); @@ -911,6 +911,8 @@ class Compile : public Phase { void update_dead_node_list(Unique_Node_List &useful); void remove_useless_nodes (Unique_Node_List &useful); + void remove_useless_node(Node* dead); + WarmCallInfo* warm_calls() const { return _warm_calls; } void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; } WarmCallInfo* pop_warm_call(); @@ -941,9 +943,11 @@ class Compile : public Phase { const GrowableArray& native_invokers() const { return _native_invokers; } - void remove_useless_late_inlines(GrowableArray* inlines, Unique_Node_List &useful); void remove_useless_nodes (GrowableArray& node_list, Unique_Node_List &useful); + void remove_useless_late_inlines(GrowableArray* inlines, Unique_Node_List &useful); + void remove_useless_late_inlines(GrowableArray* inlines, Node* dead); + void process_print_inlining(); void dump_print_inlining(); @@ -974,6 +978,8 @@ class Compile : public Phase { void inline_vector_reboxing_calls(); bool has_vbox_nodes(); + void process_late_inline_calls_no_inline(PhaseIterGVN& igvn); + // Matching, CFG layout, allocation, code generation PhaseCFG* cfg() { return _cfg; } bool has_java_calls() const { return _java_calls > 0; } diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index c906b72b9d0a3..eb4762f6e6c5f 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -148,7 +148,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool // MethodHandle.invoke* are native methods which obviously don't // have bytecodes and so normal inlining fails. if (callee->is_method_handle_intrinsic()) { - CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee); + CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, allow_inline); return cg; } @@ -274,7 +274,8 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool } else { // Generate virtual call for class check failure path // in case of polymorphic virtual call site. - miss_cg = CallGenerator::for_virtual_call(callee, vtable_index); + miss_cg = (IncrementalInlineVirtual ? CallGenerator::for_late_inline_virtual(callee, vtable_index, prof_factor) + : CallGenerator::for_virtual_call(callee, vtable_index)); } if (miss_cg != NULL) { if (next_hit_cg != NULL) { @@ -341,15 +342,15 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool } } } - } - } + } // call_does_dispatch && bytecode == Bytecodes::_invokeinterface - // Nothing claimed the intrinsic, we go with straight-forward inlining - // for already discovered intrinsic. - if (allow_inline && allow_intrinsics && cg_intrinsic != NULL) { - assert(cg_intrinsic->does_virtual_dispatch(), "sanity"); - return cg_intrinsic; - } + // Nothing claimed the intrinsic, we go with straight-forward inlining + // for already discovered intrinsic. + if (allow_intrinsics && cg_intrinsic != NULL) { + assert(cg_intrinsic->does_virtual_dispatch(), "sanity"); + return cg_intrinsic; + } + } // allow_inline // There was no special inlining tactic, or it bailed out. // Use a more generic tactic, like a simple call. @@ -359,7 +360,11 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg); } C->log_inline_failure(msg); - return CallGenerator::for_virtual_call(callee, vtable_index); + if (IncrementalInlineVirtual && allow_inline) { + return CallGenerator::for_late_inline_virtual(callee, vtable_index, prof_factor); // attempt to inline through virtual call later + } else { + return CallGenerator::for_virtual_call(callee, vtable_index); + } } else { // Class Hierarchy Analysis or Type Profile reveals a unique target, // or it is a static or special call. @@ -560,7 +565,7 @@ void Parse::do_call() { // finalize() won't be compiled as vtable calls (IC call // resolution will catch the illegal call) and the few legal calls // on array types won't be either. - callee = C->optimize_virtual_call(method(), bci(), klass, holder, orig_callee, + callee = C->optimize_virtual_call(method(), klass, holder, orig_callee, receiver_type, is_virtual, call_does_dispatch, vtable_index); // out-parameters speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL; @@ -1069,7 +1074,7 @@ void Parse::count_compiled_calls(bool at_method_entry, bool is_inline) { #endif //PRODUCT -ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass, +ciMethod* Compile::optimize_virtual_call(ciMethod* caller, ciInstanceKlass* klass, ciKlass* holder, ciMethod* callee, const TypeOopPtr* receiver_type, bool is_virtual, bool& call_does_dispatch, int& vtable_index, @@ -1079,7 +1084,7 @@ ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKl vtable_index = Method::invalid_vtable_index; // Choose call strategy. - ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee, + ciMethod* optimized_virtual_method = optimize_inlining(caller, klass, callee, receiver_type, check_access); // Have the call been sufficiently improved such that it is no longer a virtual? @@ -1094,7 +1099,7 @@ ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKl } // Identify possible target method and inlining style -ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass, +ciMethod* Compile::optimize_inlining(ciMethod* caller, ciInstanceKlass* klass, ciMethod* callee, const TypeOopPtr* receiver_type, bool check_access) { // only use for virtual or interface calls @@ -1185,11 +1190,6 @@ ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* // such method can be changed when its class is redefined. ciMethod* exact_method = callee->resolve_invoke(calling_klass, actual_receiver); if (exact_method != NULL) { - if (PrintOpto) { - tty->print(" Calling method via exact type @%d --- ", bci); - exact_method->print_name(); - tty->cr(); - } return exact_method; } } diff --git a/src/hotspot/share/opto/multnode.cpp b/src/hotspot/share/opto/multnode.cpp index c2c35e3883080..b0a04bdc3eb09 100644 --- a/src/hotspot/share/opto/multnode.cpp +++ b/src/hotspot/share/opto/multnode.cpp @@ -63,6 +63,16 @@ ProjNode* MultiNode::proj_out_or_null(uint which_proj) const { return NULL; } +ProjNode* MultiNode::proj_out_or_null(uint which_proj, bool is_io_use) const { + for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { + ProjNode* proj = fast_out(i)->isa_Proj(); + if (proj != NULL && (proj->_con == which_proj) && (proj->_is_io_use == is_io_use)) { + return proj; + } + } + return NULL; +} + // Get a named projection ProjNode* MultiNode::proj_out(uint which_proj) const { ProjNode* p = proj_out_or_null(which_proj); diff --git a/src/hotspot/share/opto/multnode.hpp b/src/hotspot/share/opto/multnode.hpp index 291578ace2a17..efd43bc03f263 100644 --- a/src/hotspot/share/opto/multnode.hpp +++ b/src/hotspot/share/opto/multnode.hpp @@ -48,7 +48,7 @@ class MultiNode : public Node { virtual uint ideal_reg() const { return NotAMachineReg; } ProjNode* proj_out(uint which_proj) const; // Get a named projection ProjNode* proj_out_or_null(uint which_proj) const; - + ProjNode* proj_out_or_null(uint which_proj, bool is_io_use) const; }; //------------------------------ProjNode--------------------------------------- diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index dae8bbf7acdb2..bcbd700498e8d 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -29,6 +29,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "opto/ad.hpp" +#include "opto/callGenerator.hpp" #include "opto/castnode.hpp" #include "opto/cfgnode.hpp" #include "opto/connode.hpp" @@ -554,9 +555,15 @@ Node *Node::clone() const { to[i] = from[i]->clone(); } } - // cloning CallNode may need to clone JVMState if (n->is_Call()) { + // cloning CallNode may need to clone JVMState n->as_Call()->clone_jvms(C); + // CallGenerator is linked to the original node. + CallGenerator* cg = n->as_Call()->generator(); + if (cg != NULL) { + CallGenerator* cloned_cg = cg->with_call_node(n->as_Call()); + n->as_Call()->set_generator(cloned_cg); + } } if (n->is_SafePoint()) { n->as_SafePoint()->clone_replaced_nodes(); @@ -1403,18 +1410,6 @@ static void kill_dead_code( Node *dead, PhaseIterGVN *igvn ) { igvn->hash_delete(dead); igvn->_worklist.remove(dead); igvn->set_type(dead, Type::TOP); - if (dead->is_macro()) { - igvn->C->remove_macro_node(dead); - } - if (dead->is_expensive()) { - igvn->C->remove_expensive_node(dead); - } - if (dead->for_post_loop_opts_igvn()) { - igvn->C->remove_from_post_loop_opts_igvn(dead); - } - BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); - bs->unregister_potential_barrier_node(dead); - igvn->C->record_dead_node(dead->_idx); // Kill all inputs to the dead guy for (uint i=0; i < dead->req(); i++) { Node *n = dead->in(i); // Get input to dead guy @@ -1437,7 +1432,7 @@ static void kill_dead_code( Node *dead, PhaseIterGVN *igvn ) { } } } - igvn->C->remove_modified_node(dead); + igvn->C->remove_useless_node(dead); } // (dead->outcnt() == 0) } // while (nstack.size() > 0) for outputs return; diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index f0f355c4a8b03..03e0d3ce97b86 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1117,10 +1117,12 @@ void PhaseIterGVN::verify_PhaseIterGVN() { } #ifdef ASSERT - while (modified_list->size()) { - Node* n = modified_list->pop(); - n->dump(); - assert(false, "VerifyIterativeGVN: new modified node was added"); + if (modified_list != NULL) { + while (modified_list->size() > 0) { + Node* n = modified_list->pop(); + n->dump(); + assert(false, "VerifyIterativeGVN: new modified node was added"); + } } #endif } @@ -1409,26 +1411,7 @@ void PhaseIterGVN::remove_globally_dead_node( Node *dead ) { _stack.pop(); // Remove dead node from iterative worklist _worklist.remove(dead); - C->remove_modified_node(dead); - // Constant node that has no out-edges and has only one in-edge from - // root is usually dead. However, sometimes reshaping walk makes - // it reachable by adding use edges. So, we will NOT count Con nodes - // as dead to be conservative about the dead node count at any - // given time. - if (!dead->is_Con()) { - C->record_dead_node(dead->_idx); - } - if (dead->is_macro()) { - C->remove_macro_node(dead); - } - if (dead->is_expensive()) { - C->remove_expensive_node(dead); - } - if (dead->for_post_loop_opts_igvn()) { - C->remove_from_post_loop_opts_igvn(dead); - } - BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); - bs->unregister_potential_barrier_node(dead); + C->remove_useless_node(dead); } } // while (_stack.is_nonempty()) } diff --git a/src/hotspot/share/opto/phasetype.hpp b/src/hotspot/share/opto/phasetype.hpp index 4883ee39e26f5..01380a2797b03 100644 --- a/src/hotspot/share/opto/phasetype.hpp +++ b/src/hotspot/share/opto/phasetype.hpp @@ -60,6 +60,7 @@ enum CompilerPhaseType { PHASE_MATCHING, PHASE_INCREMENTAL_INLINE, PHASE_INCREMENTAL_INLINE_STEP, + PHASE_INCREMENTAL_INLINE_CLEANUP, PHASE_INCREMENTAL_BOXING_INLINE, PHASE_CALL_CATCH_CLEANUP, PHASE_INSERT_BARRIER, @@ -111,6 +112,7 @@ class CompilerPhaseTypeHelper { case PHASE_MATCHING: return "After matching"; case PHASE_INCREMENTAL_INLINE: return "Incremental Inline"; case PHASE_INCREMENTAL_INLINE_STEP: return "Incremental Inline Step"; + case PHASE_INCREMENTAL_INLINE_CLEANUP: return "Incremental Inline Cleanup"; case PHASE_INCREMENTAL_BOXING_INLINE: return "Incremental Boxing Inline"; case PHASE_CALL_CATCH_CLEANUP: return "Call catch cleanup"; case PHASE_INSERT_BARRIER: return "Insert barrier"; diff --git a/src/hotspot/share/utilities/growableArray.hpp b/src/hotspot/share/utilities/growableArray.hpp index edee4c8a431a3..b75283843eb79 100644 --- a/src/hotspot/share/utilities/growableArray.hpp +++ b/src/hotspot/share/utilities/growableArray.hpp @@ -252,6 +252,14 @@ class GrowableArrayView : public GrowableArrayBase { _len--; } + // Remove all elements up to the index (exclusive). The order is preserved. + void remove_till(int idx) { + for (int i = 0, j = idx; j < length(); i++, j++) { + at_put(i, at(j)); + } + trunc_to(length() - idx); + } + // The order is changed. void delete_at(int index) { assert(0 <= index && index < _len, "illegal index"); From c43c224ef9ce91a711ca3ddec6df6479e94309d9 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Mon, 7 Dec 2020 22:59:51 +0000 Subject: [PATCH 121/504] 8257796: [TESTBUG] TestUseSHA512IntrinsicsOptionOnSupportedCPU.java fails on x86_32 Reviewed-by: kvn --- .../sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java index 857c1276feb3a..bbfffa6a3e8e9 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java +++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java @@ -25,6 +25,7 @@ * @test * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on supported CPU. + * @requires os.arch!="x86" & os.arch!="i386" * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management From 39b8a2e68219986d533ae9567fdfaaca753141a7 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Mon, 7 Dec 2020 23:53:17 +0000 Subject: [PATCH 122/504] 8257670: sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java reports leaks Reviewed-by: jnimeh --- test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java index dcca7246bcf78..4fdb2503e087e 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java @@ -30,12 +30,13 @@ /* * @test - * @bug 8256818 + * @bug 8256818 8257670 * @summary Test that creating and closing SSL Sockets without bind/connect * will not leave leaking socket file descriptors * @library /test/lib - * @run main/othervm SSLSocketLeak + * @run main/manual SSLSocketLeak */ +// Note: this test is not reliable, run it manually. public class SSLSocketLeak { private static final int NUM_TEST_SOCK = 500; From cef606feca805c614004357ca691418521f207e1 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Tue, 8 Dec 2020 00:06:20 +0000 Subject: [PATCH 123/504] 8253762: JFR: getField(String) should be able to access subfields Reviewed-by: mgronlun --- .../share/classes/jdk/jfr/EventType.java | 10 +++++++++- .../jdk/jfr/consumer/RecordedObject.java | 3 +++ .../share/classes/jdk/jfr/internal/Type.java | 20 +++++++++++++++++++ .../api/metadata/eventtype/TestGetField.java | 9 +++++++-- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/EventType.java b/src/jdk.jfr/share/classes/jdk/jfr/EventType.java index a2c5e91780e4f..85f94b8769566 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/EventType.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/EventType.java @@ -66,6 +66,9 @@ public List getFields() { /** * Returns the field with the specified name, or {@code null} if it doesn't * exist. + *

      + * It's possible to index into a nested field by using {@code "."} (for + * instance {@code "thread.group.parent.name}"). * * @param name of the field to get, not {@code null} * @@ -82,7 +85,12 @@ public ValueDescriptor getField(String name) { } cache = newCache; } - return cache.get(name); + ValueDescriptor result = cache.get(name); + if (result == null) { + // Cache doesn't contain subfields + result = platformEventType.getField(name); + } + return result; } /** diff --git a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java index 5bab6205db461..bf3d09218c761 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java @@ -189,6 +189,9 @@ final T getTyped(String name, Class clazz, T defaultValue) { /** * Returns {@code true} if a field with the given name exists, {@code false} * otherwise. + *

      + * It's possible to index into a nested field by using {@code "."} (for + * instance {@code "thread.group.parent.name}"). * * @param name name of the field to get, not {@code null} * diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/Type.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/Type.java index bfd4a6ed9efd0..05e76a56c7587 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/Type.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Type.java @@ -191,6 +191,26 @@ public String getLogName() { return getName() + "(" + getId() + ")"; } + public ValueDescriptor getField(String name) { + int dotIndex = name.indexOf("."); + if (dotIndex > 0) { + String pre = name.substring(0, dotIndex); + String post = name.substring(dotIndex + 1); + ValueDescriptor subField = getField(pre); + if (subField != null) { + Type type = PrivateAccess.getInstance().getType(subField); + return type.getField(post); + } + } else { + for (ValueDescriptor v : getFields()) { + if (name.equals(v.getName())) { + return v; + } + } + } + return null; + } + public List getFields() { if (fields instanceof ArrayList) { ((ArrayList) fields).trimToSize(); diff --git a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java index f041c04489a15..dd74c1942b760 100644 --- a/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java +++ b/test/jdk/jdk/jfr/api/metadata/eventtype/TestGetField.java @@ -44,13 +44,17 @@ public static void main(String[] args) throws Throwable { EventType type = EventType.getEventType(MyEvent.class); ValueDescriptor v = type.getField("myByte"); - Asserts.assertNotNull(v, "getFiled(myByte) was null"); + Asserts.assertNotNull(v, "getField(myByte) was null"); Asserts.assertEquals(v.getTypeName(), "byte", "myByte was not type byte"); v = type.getField("myInt"); - Asserts.assertNotNull(v, "getFiled(myInt) was null"); + Asserts.assertNotNull(v, "getField(myInt) was null"); Asserts.assertEquals(v.getTypeName(), "int", "myInt was not type int"); + v = type.getField("eventThread.group.name"); + Asserts.assertNotNull(v, "getField(eventThread.group.name) was null"); + Asserts.assertEquals(v.getTypeName(), "java.lang.String", "eventThread.group.name was not type java.lang.String"); + v = type.getField("myStatic"); Asserts.assertNull(v, "got static field"); @@ -60,6 +64,7 @@ public static void main(String[] args) throws Throwable { v = type.getField(""); Asserts.assertNull(v, "got field for empty name"); + try { v = type.getField(null); Asserts.fail("No Exception when getField(null)"); From 6ff18e38b4969c803197221bb3afbfa6d05cd53d Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Tue, 8 Dec 2020 04:07:38 +0000 Subject: [PATCH 124/504] 8257855: Example SafeVarargsNotApplicableToRecordAccessors breaks test tools/javac/diags/CheckExamples.java Reviewed-by: jjg --- .../examples/SafeVarargsNotApplicableToRecordAccessors.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java b/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java index 7b4e5cd772271..b4144bb5b8d2e 100644 --- a/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java +++ b/test/langtools/tools/javac/diags/examples/SafeVarargsNotApplicableToRecordAccessors.java @@ -23,8 +23,5 @@ // key: compiler.err.varargs.invalid.trustme.anno // key: compiler.misc.varargs.trustme.on.non.varargs.accessor -// key: compiler.note.preview.filename -// key: compiler.note.preview.recompile -// options: --enable-preview -source ${jdk.version} record R(@SafeVarargs String... s) {} From 500ab45770d9544401edf133aaf7cf7236a69cd8 Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Tue, 8 Dec 2020 06:10:10 +0000 Subject: [PATCH 125/504] 8257769: Cipher.getParameters() throws NPE for ChaCha20-Poly1305 Reviewed-by: mullan, valeriep --- .../sun/crypto/provider/ChaCha20Cipher.java | 13 +- .../ChaCha20/ChaCha20Poly1305ParamTest.java | 118 +++++++++++++++++- 2 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java b/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java index e0e1f85140cf4..6d7586d185bb9 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -207,7 +207,7 @@ protected int engineGetOutputSize(int inputLen) { */ @Override protected byte[] engineGetIV() { - return nonce.clone(); + return (nonce != null) ? nonce.clone() : null; } /** @@ -226,11 +226,16 @@ protected byte[] engineGetIV() { protected AlgorithmParameters engineGetParameters() { AlgorithmParameters params = null; if (mode == MODE_AEAD) { + // In a pre-initialized state or any state without a nonce value + // this call should cause a random nonce to be generated, but + // not attached to the object. + byte[] nonceData = (initialized || nonce != null) ? nonce : + createRandomNonce(null); try { // Place the 12-byte nonce into a DER-encoded OCTET_STRING params = AlgorithmParameters.getInstance("ChaCha20-Poly1305"); params.init((new DerValue( - DerValue.tag_OctetString, nonce).toByteArray())); + DerValue.tag_OctetString, nonceData).toByteArray())); } catch (NoSuchAlgorithmException | IOException exc) { throw new RuntimeException(exc); } @@ -504,7 +509,7 @@ protected void engineUpdateAAD(ByteBuffer src) { * * @return a 12-byte array containing the random nonce. */ - private byte[] createRandomNonce(SecureRandom random) { + private static byte[] createRandomNonce(SecureRandom random) { byte[] newNonce = new byte[12]; SecureRandom rand = (random != null) ? random : new SecureRandom(); rand.nextBytes(newNonce); diff --git a/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20Poly1305ParamTest.java b/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20Poly1305ParamTest.java index caad610e1495e..9fc657edb1bc9 100644 --- a/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20Poly1305ParamTest.java +++ b/test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20Poly1305ParamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,7 +23,7 @@ /** * @test - * @bug 8153029 + * @bug 8153029 8257769 * @library /test/lib * @build jdk.test.lib.Convert * @run main ChaCha20Poly1305ParamTest @@ -42,6 +42,10 @@ import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; import java.nio.ByteBuffer; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.spec.InvalidParameterSpecException; +import javax.crypto.spec.IvParameterSpec; import jdk.test.lib.Convert; public class ChaCha20Poly1305ParamTest { @@ -232,6 +236,111 @@ public static void main(String args[]) throws Exception { System.out.println("Caught expected exception: " + ioe); } + // The next set of tests cover cases where ChaCha20-Poly1305 cipher + // objects have the getParameters() call executed after instantiation + // but before initialization. + System.out.println("*** Test: getParameters before init"); + cc20p1305 = Cipher.getInstance("ChaCha20-Poly1305"); + AlgorithmParameters algParams = cc20p1305.getParameters(); + byte[] preInitNonce = getNonceFromParams(algParams); + // A second pre-init getParameters() call should return a new set of + // random parameters. + AlgorithmParameters algParamsTwo = cc20p1305.getParameters(); + byte[] secondNonce = getNonceFromParams(algParamsTwo); + if (MessageDigest.isEqual(preInitNonce, secondNonce)) { + throw new RuntimeException("Unexpected nonce match between " + + "two pre-init getParameters() calls"); + } + + // Next we will initialize the Cipher object using a form of init + // that doesn't take AlgorithmParameters or AlgorithmParameterSpec. + // The nonce created using the pre-init getParameters() call should + // be overwritten by a freshly generated set of random parameters. + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY); + AlgorithmParameters postInitAps = cc20p1305.getParameters(); + byte[] postInitNonce = getNonceFromParams(postInitAps); + if (MessageDigest.isEqual(preInitNonce, postInitNonce)) { + throw new RuntimeException("Unexpected nonce match between " + + "pre and post-init getParameters() calls"); + } + System.out.println("Test Passed"); + + // After an initialization, subsequent calls to getParameters() should + // return the same parameter value until the next initialization takes + // place. + System.out.println("*** Test: getParameters after init"); + AlgorithmParameters postInitApsTwo = cc20p1305.getParameters(); + byte[] postInitNonceTwo = getNonceFromParams(postInitApsTwo); + if (!MessageDigest.isEqual(postInitNonce, postInitNonceTwo)) { + throw new RuntimeException("Unexpected nonce mismatch between " + + "two post-init getParameters() calls"); + } + System.out.println("Test Passed"); + + // Test reinitialization use cases. + // First test: instantiate, init(no param), encrypt. Get params + // and attempt to reinit with same parameters. Should fail. + System.out.println("*** Test: Init w/ random nonce, init 2nd time"); + cc20p1305 = Cipher.getInstance("ChaCha20-Poly1305"); + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY); + algParams = cc20p1305.getParameters(); + preInitNonce = getNonceFromParams(algParams); + // Perform a simple encryption operation + cc20p1305.doFinal(aeadTestList.get(0).input); + try { + // Now try to reinitialize using the same parameters + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY, algParams); + throw new RuntimeException("Illegal key/nonce reuse"); + } catch (InvalidKeyException ike) { + System.out.println("Caught expected exception: " + ike); + } + + // Test the reinit guard using an AlgorithmParameterSpec with the + // Same nonce value. This should also be a failure. + try { + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY, + new IvParameterSpec(preInitNonce)); + throw new RuntimeException("Illegal key/nonce reuse"); + } catch (InvalidKeyException ike) { + System.out.println("Caught expected exception: " + ike); + } + + // Try one more time, this time providing a new 12-byte nonce, which + // should be allowed even if the key is the same. + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY, + new IvParameterSpec(NONCE_OCTET_STR_12, 2, 12)); + System.out.println("Test Passed"); + + // Reinit test: instantiate, init(no param), getParam, encrypt, + // then init(no param). Should work and the parameters should be + // different after each init. + cc20p1305 = Cipher.getInstance("ChaCha20-Poly1305"); + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY); + byte[] paramInitOne = getNonceFromParams(cc20p1305.getParameters()); + // Perform a simple encryption operation + cc20p1305.doFinal(aeadTestList.get(0).input); + // reinit (no params) + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY); + byte[] paramInitTwo = getNonceFromParams(cc20p1305.getParameters()); + if (MessageDigest.isEqual(paramInitOne, paramInitTwo)) { + throw new RuntimeException("Unexpected nonce match between " + + "pre and post-init getParameters() calls"); + } + System.out.println("Test Passed"); + + // Reinit test: instantiate, init(no param), doFinal, then doFinal + // again without intervening init. Should fail due to no-reuse + // protections. + try { + cc20p1305 = Cipher.getInstance("ChaCha20-Poly1305"); + cc20p1305.init(Cipher.ENCRYPT_MODE, DEF_KEY); + cc20p1305.doFinal(aeadTestList.get(0).input); + cc20p1305.doFinal(aeadTestList.get(0).input); + throw new RuntimeException("Illegal key/nonce reuse"); + } catch (IllegalStateException ise) { + System.out.println("Caught expected exception: " + ise); + } + System.out.println("----- AEAD Tests -----"); for (TestData test : aeadTestList) { System.out.println("*** Test " + ++testNumber + ": " + @@ -374,6 +483,11 @@ private static boolean runAEADTest(TestData testData) return result; } + private static byte[] getNonceFromParams(AlgorithmParameters params) + throws InvalidParameterSpecException { + return params.getParameterSpec(IvParameterSpec.class).getIV(); + } + /** * Dump the hex bytes of a buffer into string form. * From 0b6b6eb59a66b0d06ecae104ba14b48b199f8032 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Tue, 8 Dec 2020 08:30:18 +0000 Subject: [PATCH 126/504] 8257813: [redo] C2: Filter type in PhiNode::Value() for induction variables of trip-counted integer loops Reviewed-by: chagedorn, kvn --- src/hotspot/share/opto/cfgnode.cpp | 4 ++-- src/hotspot/share/opto/superword.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index b70d279f270ec..67f02bc9ee71e 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -1105,9 +1105,9 @@ const Type* PhiNode::Value(PhaseGVN* phase) const { if (bt != BoolTest::ne) { if (stride_t->hi_as_long() < 0) { // Down-counter loop swap(lo, hi); - return TypeInteger::make(MIN2(lo->lo_as_long(), hi->lo_as_long()), hi->hi_as_long(), 3, l->bt()); + return TypeInteger::make(MIN2(lo->lo_as_long(), hi->lo_as_long()), hi->hi_as_long(), 3, l->bt())->filter_speculative(_type); } else if (stride_t->lo_as_long() >= 0) { - return TypeInteger::make(lo->lo_as_long(), MAX2(lo->hi_as_long(), hi->hi_as_long()), 3, l->bt()); + return TypeInteger::make(lo->lo_as_long(), MAX2(lo->hi_as_long(), hi->hi_as_long()), 3, l->bt())->filter_speculative(_type); } } } diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index b9dfb29dde736..123153a6187a8 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -1328,7 +1328,7 @@ bool SuperWord::reduction(Node* s1, Node* s2) { bool retValue = false; int d1 = depth(s1); int d2 = depth(s2); - if (d1 + 1 == d2) { + if (d2 > d1) { if (s1->is_reduction() && s2->is_reduction()) { // This is an ordered set, so s1 should define s2 for (DUIterator_Fast imax, i = s1->fast_outs(imax); i < imax; i++) { From 51ac37686c5a9711143131881b146751c9273a73 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Tue, 8 Dec 2020 08:38:24 +0000 Subject: [PATCH 127/504] 8256411: Based anonymous classes have a weird end position Reviewed-by: vromero --- .../com/sun/tools/javac/comp/Attr.java | 2 +- .../tools/javac/parser/JavacParserTest.java | 37 ++++++++++++++++++- .../tools/javac/positions/TreeEndPosTest.java | 4 +- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index df21524229c0e..4f314bfa7c753 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2555,7 +2555,7 @@ public void visitNewClass(final JCNewClass tree) { ((JCIdent) clazzid).name); EndPosTable endPosTable = this.env.toplevel.endPositions; - endPosTable.storeEnd(clazzid1, tree.getEndPosition(endPosTable)); + endPosTable.storeEnd(clazzid1, clazzid.getEndPosition(endPosTable)); if (clazz.hasTag(ANNOTATED_TYPE)) { JCAnnotatedType annoType = (JCAnnotatedType) clazz; List annos = annoType.annotations; diff --git a/test/langtools/tools/javac/parser/JavacParserTest.java b/test/langtools/tools/javac/parser/JavacParserTest.java index e12e40ce4c4b3..59d6607f528b7 100644 --- a/test/langtools/tools/javac/parser/JavacParserTest.java +++ b/test/langtools/tools/javac/parser/JavacParserTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 + * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 * @summary tests error and diagnostics positions * @author Jan Lahoda * @modules jdk.compiler/com.sun.tools.javac.api @@ -84,6 +84,7 @@ import com.sun.source.tree.CaseTree; import com.sun.source.util.TreePathScanner; +import java.util.Objects; public class JavacParserTest extends TestCase { static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); @@ -1611,6 +1612,40 @@ String s() { """); } + @Test //JDK-8256411 + void testBasedAnonymous() throws IOException { + String code = """ + package t; + class Test { + class I {} + static Object I = new Test().new I() {}; + } + """; + StringWriter out = new StringWriter(); + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null, null, + null, Arrays.asList(new MyFileObject(code))); + CompilationUnitTree cut = ct.parse().iterator().next(); + Trees trees = Trees.instance(ct); + SourcePositions sp = trees.getSourcePositions(); + ct.analyze(); + List span = new ArrayList<>(); + new TreeScanner() { + public Void visitClass(ClassTree ct, Void v) { + if (ct.getExtendsClause() != null) { + int start = (int) sp.getStartPosition(cut, + ct.getExtendsClause()); + int end = (int) sp.getEndPosition(cut, + ct.getExtendsClause()); + span.add(code.substring(start, end)); + } + return super.visitClass(ct, v); + } + }.scan(cut, null); + if (!Objects.equals(span, Arrays.asList("I"))) { + throw new AssertionError("Unexpected span: " + span); + } + } + void run(String[] args) throws Exception { int passed = 0, failed = 0; final Pattern p = (args != null && args.length > 0) diff --git a/test/langtools/tools/javac/positions/TreeEndPosTest.java b/test/langtools/tools/javac/positions/TreeEndPosTest.java index 3b3cb6b9990f6..d3454298128e2 100644 --- a/test/langtools/tools/javac/positions/TreeEndPosTest.java +++ b/test/langtools/tools/javac/positions/TreeEndPosTest.java @@ -127,8 +127,8 @@ public static void main(String... args) throws IOException { } static void testUninitializedVariable() throws IOException { - compile(JavaSource.createJavaSource("Object o = new A().new B(); class A { }", - "B()")); + compile(JavaSource.createJavaSource("Object o = new A().new BT(); class A { }", + "BT")); } static void testMissingAnnotationValue() throws IOException { compile(JavaSource.createJavaSource("@Foo(\"vvvv\")", From 1d0adbb812bc4b40fb614f245dd8ed2ef66ff073 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Tue, 8 Dec 2020 08:48:58 +0000 Subject: [PATCH 128/504] 8253644: C2: assert(skeleton_predicate_has_opaque(iff)) failed: unexpected Reviewed-by: roland, kvn --- src/hotspot/share/opto/loopPredicate.cpp | 80 ++++--- src/hotspot/share/opto/loopTransform.cpp | 47 +++- src/hotspot/share/opto/loopnode.hpp | 12 +- .../TestUnswitchCloneSkeletonPredicates.java | 225 ++++++++++++++++++ 4 files changed, 312 insertions(+), 52 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestUnswitchCloneSkeletonPredicates.java diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index dd0fa3e10a2b0..a5091a9cebae4 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -227,19 +227,17 @@ ProjNode* PhaseIdealLoop::clone_predicate_to_unswitched_loop(ProjNode* predicate return new_predicate_proj; } -// Clones skeleton predicates starting at 'old_predicate_proj' to -// 'new_predicate_proj' and rewires the control edges of data nodes in -// the loop from the old predicates to the new cloned predicates. +// Clones skeleton predicates starting at 'old_predicate_proj' by following its control inputs and rewires the control edges of in the loop from +// the old predicates to the new cloned predicates. void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, Deoptimization::DeoptReason reason, - ProjNode* old_predicate_proj, ProjNode* iffast, ProjNode* ifslow) { + ProjNode* old_predicate_proj, ProjNode* iffast_pred, ProjNode* ifslow_pred) { IfNode* iff = old_predicate_proj->in(0)->as_If(); + assert(iffast_pred->in(0)->is_If() && ifslow_pred->in(0)->is_If(), "sanity check"); ProjNode* uncommon_proj = iff->proj_out(1 - old_predicate_proj->as_Proj()->_con); Node* rgn = uncommon_proj->unique_ctrl_out(); assert(rgn->is_Region() || rgn->is_Call(), "must be a region or call uct"); assert(iff->in(1)->in(1)->Opcode() == Op_Opaque1, "unexpected predicate shape"); Node* predicate = iff->in(0); - Node* current_proj = old_predicate_proj; - Node* prev_proj = current_proj; Unique_Node_List list; while (predicate != NULL && predicate->is_Proj() && predicate->in(0)->is_If()) { iff = predicate->in(0)->as_If(); @@ -256,35 +254,33 @@ void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* } Node_List to_process; - // Process in reverse order such that 'create_new_if_for_predicate' can be used and the original order is maintained - for (int i = list.size()-1; i >= 0; i--) { + // Process in reverse order such that 'create_new_if_for_predicate' can be used in 'clone_skeleton_predicate_for_unswitched_loops' + // and the original order is maintained. + for (int i = list.size() - 1; i >= 0; i--) { predicate = list.at(i); assert(predicate->in(0)->is_If(), "must be If node"); iff = predicate->in(0)->as_If(); assert(predicate->is_Proj() && predicate->as_Proj()->is_IfProj(), "predicate must be a projection of an if node"); IfProjNode* predicate_proj = predicate->as_IfProj(); - // cloned_proj is the same type of projection as the original predicate projection (IfTrue or IfFalse) - ProjNode* fast_proj = create_new_if_for_predicate(iffast, NULL, reason, iff->Opcode(), predicate_proj->is_IfTrue()); - ProjNode* slow_proj = create_new_if_for_predicate(ifslow, NULL, reason, iff->Opcode(), predicate_proj->is_IfTrue()); + ProjNode* fast_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, iffast_pred, loop); + assert(skeleton_predicate_has_opaque(fast_proj->in(0)->as_If()), "must find skeleton predicate for fast loop"); + ProjNode* slow_proj = clone_skeleton_predicate_for_unswitched_loops(iff, predicate_proj, uncommon_proj, reason, ifslow_pred, loop); + assert(skeleton_predicate_has_opaque(slow_proj->in(0)->as_If()), "must find skeleton predicate for slow loop"); - // Replace bool input by input from original predicate - _igvn.replace_input_of(fast_proj->in(0), 1, iff->in(1)); - _igvn.replace_input_of(slow_proj->in(0), 1, iff->in(1)); - - for (DUIterator i = predicate->outs(); predicate->has_out(i); i++) { - Node* fast_node = predicate->out(i); + // Update control dependent data nodes. + for (DUIterator j = predicate->outs(); predicate->has_out(j); j++) { + Node* fast_node = predicate->out(j); if (loop->is_member(get_loop(ctrl_or_self(fast_node)))) { assert(fast_node->in(0) == predicate, "only control edge"); Node* slow_node = old_new[fast_node->_idx]; assert(slow_node->in(0) == predicate, "only control edge"); _igvn.replace_input_of(fast_node, 0, fast_proj); to_process.push(slow_node); - --i; + --j; } } - // Have to delay updates to the slow loop so uses of predicate are - // not modified while we iterate on them. + // Have to delay updates to the slow loop so uses of predicate are not modified while we iterate on them. while (to_process.size() > 0) { Node* slow_node = to_process.pop(); _igvn.replace_input_of(slow_node, 0, slow_proj); @@ -292,9 +288,23 @@ void PhaseIdealLoop::clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* } } +// Clone a skeleton predicate for an unswitched loop. OpaqueLoopInit and OpaqueLoopStride nodes are cloned and uncommon +// traps are kept for the predicate (a Halt node is used later when creating pre/main/post loops and copying this cloned +// predicate again). +ProjNode* PhaseIdealLoop::clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj, + Deoptimization::DeoptReason reason, ProjNode* output_proj, + IdealLoopTree* loop) { + Node* bol = clone_skeleton_predicate_bool(iff, NULL, NULL, predicate, uncommon_proj, output_proj, loop); + ProjNode* proj = create_new_if_for_predicate(output_proj, NULL, reason, iff->Opcode(), predicate->is_IfTrue()); + _igvn.replace_input_of(proj->in(0), 1, bol); + _igvn.replace_input_of(output_proj->in(0), 0, proj); + set_idom(output_proj->in(0), proj, dom_depth(proj)); + return proj; +} + //--------------------------clone_loop_predicates----------------------- // Clone loop predicates to cloned loops when unswitching a loop. -void PhaseIdealLoop::clone_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, ProjNode*& iffast, ProjNode*& ifslow) { +void PhaseIdealLoop::clone_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, ProjNode*& iffast_pred, ProjNode*& ifslow_pred) { LoopNode* head = loop->_head->as_Loop(); bool clone_limit_check = !head->is_CountedLoop(); Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl); @@ -318,31 +328,31 @@ void PhaseIdealLoop::clone_predicates_to_unswitched_loop(IdealLoopTree* loop, co } if (predicate_proj != NULL) { // right pattern that can be used by loop predication // clone predicate - iffast = clone_predicate_to_unswitched_loop(predicate_proj, iffast, Deoptimization::Reason_predicate); - ifslow = clone_predicate_to_unswitched_loop(predicate_proj, ifslow, Deoptimization::Reason_predicate); - clone_skeleton_predicates_to_unswitched_loop(loop, old_new, Deoptimization::Reason_predicate, predicate_proj, iffast, ifslow); + iffast_pred = clone_predicate_to_unswitched_loop(predicate_proj, iffast_pred, Deoptimization::Reason_predicate); + ifslow_pred = clone_predicate_to_unswitched_loop(predicate_proj, ifslow_pred, Deoptimization::Reason_predicate); + clone_skeleton_predicates_to_unswitched_loop(loop, old_new, Deoptimization::Reason_predicate, predicate_proj, iffast_pred, ifslow_pred); - check_created_predicate_for_unswitching(iffast); - check_created_predicate_for_unswitching(ifslow); + check_created_predicate_for_unswitching(iffast_pred); + check_created_predicate_for_unswitching(ifslow_pred); } if (profile_predicate_proj != NULL) { // right pattern that can be used by loop predication // clone predicate - iffast = clone_predicate_to_unswitched_loop(profile_predicate_proj, iffast, Deoptimization::Reason_profile_predicate); - ifslow = clone_predicate_to_unswitched_loop(profile_predicate_proj, ifslow, Deoptimization::Reason_profile_predicate); - clone_skeleton_predicates_to_unswitched_loop(loop, old_new, Deoptimization::Reason_profile_predicate, profile_predicate_proj, iffast, ifslow); + iffast_pred = clone_predicate_to_unswitched_loop(profile_predicate_proj, iffast_pred, Deoptimization::Reason_profile_predicate); + ifslow_pred = clone_predicate_to_unswitched_loop(profile_predicate_proj, ifslow_pred, Deoptimization::Reason_profile_predicate); + clone_skeleton_predicates_to_unswitched_loop(loop, old_new, Deoptimization::Reason_profile_predicate, profile_predicate_proj, iffast_pred, ifslow_pred); - check_created_predicate_for_unswitching(iffast); - check_created_predicate_for_unswitching(ifslow); + check_created_predicate_for_unswitching(iffast_pred); + check_created_predicate_for_unswitching(ifslow_pred); } if (limit_check_proj != NULL && clone_limit_check) { // Clone loop limit check last to insert it before loop. // Don't clone a limit check which was already finalized // for this counted loop (only one limit check is needed). - iffast = clone_predicate_to_unswitched_loop(limit_check_proj, iffast, Deoptimization::Reason_loop_limit_check); - ifslow = clone_predicate_to_unswitched_loop(limit_check_proj, ifslow, Deoptimization::Reason_loop_limit_check); + iffast_pred = clone_predicate_to_unswitched_loop(limit_check_proj, iffast_pred, Deoptimization::Reason_loop_limit_check); + ifslow_pred = clone_predicate_to_unswitched_loop(limit_check_proj, ifslow_pred, Deoptimization::Reason_loop_limit_check); - check_created_predicate_for_unswitching(iffast); - check_created_predicate_for_unswitching(ifslow); + check_created_predicate_for_unswitching(iffast_pred); + check_created_predicate_for_unswitching(ifslow_pred); } } diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index ece2fdf36b974..416e369d93306 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -1256,10 +1256,10 @@ void PhaseIdealLoop::copy_skeleton_predicates_to_main_loop_helper(Node* predicat // Clone the skeleton predicate twice and initialize one with the initial // value of the loop induction variable. Leave the other predicate // to be initialized when increasing the stride during loop unrolling. - prev_proj = clone_skeleton_predicate(iff, opaque_init, NULL, predicate, uncommon_proj, current_proj, outer_loop, prev_proj); + prev_proj = clone_skeleton_predicate_for_main_loop(iff, opaque_init, NULL, predicate, uncommon_proj, current_proj, outer_loop, prev_proj); assert(skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), ""); - prev_proj = clone_skeleton_predicate(iff, init, stride, predicate, uncommon_proj, current_proj, outer_loop, prev_proj); + prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, stride, predicate, uncommon_proj, current_proj, outer_loop, prev_proj); assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), ""); // Rewire any control inputs from the cloned skeleton predicates down to the main and post loop for data nodes that are part of the @@ -1333,12 +1333,17 @@ bool PhaseIdealLoop::skeleton_predicate_has_opaque(IfNode* iff) { return false; } -Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, - Node* current_proj, IdealLoopTree* outer_loop, Node* prev_proj) { +// Clone the skeleton predicate bool for a main or unswitched loop: +// Main loop: Set new_init and new_stride nodes as new inputs. +// Unswitched loop: new_init and new_stride are both NULL. Clone OpaqueLoopInit and OpaqueLoopStride instead. +Node* PhaseIdealLoop::clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, + Node* control, IdealLoopTree* outer_loop) { Node_Stack to_clone(2); to_clone.push(iff->in(1), 1); uint current = C->unique(); Node* result = NULL; + bool is_unswitched_loop = new_init == NULL && new_stride == NULL; + assert(new_init != NULL || is_unswitched_loop, "new_init must be set when new_stride is non-null"); // Look for the opaque node to replace with the new value // and clone everything in between. We keep the Opaque4 node // so the duplicated predicates are eliminated once loop @@ -1350,25 +1355,33 @@ Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* new_init, Node* Node* m = n->in(i); int op = m->Opcode(); if (skeleton_follow_inputs(m, op)) { - to_clone.push(m, 1); - continue; + to_clone.push(m, 1); + continue; } if (m->is_Opaque1()) { if (n->_idx < current) { n = n->clone(); - register_new_node(n, current_proj); + register_new_node(n, control); } if (op == Op_OpaqueLoopInit) { + if (is_unswitched_loop && m->_idx < current && new_init == NULL) { + new_init = m->clone(); + register_new_node(new_init, control); + } n->set_req(i, new_init); } else { assert(op == Op_OpaqueLoopStride, "unexpected opaque node"); + if (is_unswitched_loop && m->_idx < current && new_stride == NULL) { + new_stride = m->clone(); + register_new_node(new_stride, control); + } if (new_stride != NULL) { n->set_req(i, new_stride); } } to_clone.set_node(n); } - for (;;) { + while (true) { Node* cur = to_clone.node(); uint j = to_clone.index(); if (j+1 < cur->req()) { @@ -1386,7 +1399,7 @@ Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* new_init, Node* assert(cur->_idx >= current || next->in(j)->Opcode() == Op_Opaque1, "new node or Opaque1 being replaced"); if (next->_idx < current) { next = next->clone(); - register_new_node(next, current_proj); + register_new_node(next, control); to_clone.set_node(next); } next->set_req(j, cur); @@ -1394,21 +1407,29 @@ Node* PhaseIdealLoop::clone_skeleton_predicate(Node* iff, Node* new_init, Node* } } while (result == NULL); assert(result->_idx >= current, "new node expected"); + assert(!is_unswitched_loop || new_init != NULL, "new_init must always be found and cloned"); + return result; +} +// Clone a skeleton predicate for the main loop. new_init and new_stride are set as new inputs. Since the predicates cannot fail at runtime, +// Halt nodes are inserted instead of uncommon traps. +Node* PhaseIdealLoop::clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, + Node* control, IdealLoopTree* outer_loop, Node* input_proj) { + Node* result = clone_skeleton_predicate_bool(iff, new_init, new_stride, predicate, uncommon_proj, control, outer_loop); Node* proj = predicate->clone(); Node* other_proj = uncommon_proj->clone(); Node* new_iff = iff->clone(); new_iff->set_req(1, result); proj->set_req(0, new_iff); other_proj->set_req(0, new_iff); - Node *frame = new ParmNode(C->start(), TypeFunc::FramePtr); + Node* frame = new ParmNode(C->start(), TypeFunc::FramePtr); register_new_node(frame, C->start()); // It's impossible for the predicate to fail at runtime. Use an Halt node. Node* halt = new HaltNode(other_proj, frame, "duplicated predicate failed which is impossible"); C->root()->add_req(halt); - new_iff->set_req(0, prev_proj); + new_iff->set_req(0, input_proj); - register_control(new_iff, outer_loop->_parent, prev_proj); + register_control(new_iff, outer_loop->_parent, input_proj); register_control(proj, outer_loop->_parent, new_iff); register_control(other_proj, _ltree_root, new_iff); register_control(halt, _ltree_root, other_proj); @@ -1904,7 +1925,7 @@ void PhaseIdealLoop::update_main_loop_skeleton_predicates(Node* ctrl, CountedLoo _igvn.replace_input_of(iff, 1, iff->in(1)->in(2)); } else { // Add back predicates updated for the new stride. - prev_proj = clone_skeleton_predicate(iff, init, max_value, entry, proj, ctrl, outer_loop, prev_proj); + prev_proj = clone_skeleton_predicate_for_main_loop(iff, init, max_value, entry, proj, ctrl, outer_loop, prev_proj); assert(!skeleton_predicate_has_opaque(prev_proj->in(0)->as_If()), "unexpected"); } } diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 075073add2ef0..aa89d475ef8ab 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -910,8 +910,10 @@ class PhaseIdealLoop : public PhaseTransform { void copy_skeleton_predicates_to_main_loop(CountedLoopNode* pre_head, Node* init, Node* stride, IdealLoopTree* outer_loop, LoopNode* outer_main_head, uint dd_main_head, const uint idx_before_pre_post, const uint idx_after_post_before_pre, Node* zero_trip_guard_proj_main, Node* zero_trip_guard_proj_post, const Node_List &old_new); - Node* clone_skeleton_predicate(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, - Node* current_proj, IdealLoopTree* outer_loop, Node* prev_proj); + Node* clone_skeleton_predicate_for_main_loop(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control, + IdealLoopTree* outer_loop, Node* input_proj); + Node* clone_skeleton_predicate_bool(Node* iff, Node* new_init, Node* new_stride, Node* predicate, Node* uncommon_proj, Node* control, + IdealLoopTree* outer_loop); bool skeleton_predicate_has_opaque(IfNode* iff); void update_main_loop_skeleton_predicates(Node* ctrl, CountedLoopNode* loop_head, Node* init, int stride_con); void insert_loop_limit_check(ProjNode* limit_check_proj, Node* cmp_limit, Node* bol); @@ -1557,10 +1559,12 @@ class PhaseIdealLoop : public PhaseTransform { } // Clone loop predicates to slow and fast loop when unswitching a loop - void clone_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, ProjNode*& iffast, ProjNode*& ifslow); + void clone_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, ProjNode*& iffast_pred, ProjNode*& ifslow_pred); ProjNode* clone_predicate_to_unswitched_loop(ProjNode* predicate_proj, Node* new_entry, Deoptimization::DeoptReason reason); void clone_skeleton_predicates_to_unswitched_loop(IdealLoopTree* loop, const Node_List& old_new, Deoptimization::DeoptReason reason, - ProjNode* old_predicate_proj, ProjNode* iffast, ProjNode* ifslow); + ProjNode* old_predicate_proj, ProjNode* iffast_pred, ProjNode* ifslow_pred); + ProjNode* clone_skeleton_predicate_for_unswitched_loops(Node* iff, ProjNode* predicate, Node* uncommon_proj, Deoptimization::DeoptReason reason, + ProjNode* output_proj, IdealLoopTree* loop); void check_created_predicate_for_unswitching(const Node* new_entry) const PRODUCT_RETURN; bool _created_loop_node; diff --git a/test/hotspot/jtreg/compiler/loopopts/TestUnswitchCloneSkeletonPredicates.java b/test/hotspot/jtreg/compiler/loopopts/TestUnswitchCloneSkeletonPredicates.java new file mode 100644 index 0000000000000..3564624c2aeaa --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestUnswitchCloneSkeletonPredicates.java @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2020, 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 8253644 + * @summary Test the complete cloning of skeleton predicates to unswitched loops as done when cloning them to the main loop. + * @run main/othervm -Xcomp -XX:CompileCommand=compileonly,compiler.loopopts.TestUnswitchCloneSkeletonPredicates::* + * compiler.loopopts.TestUnswitchCloneSkeletonPredicates + * @run main/othervm -Xcomp -XX:-PartialPeelLoop -XX:CompileCommand=compileonly,compiler.loopopts.TestUnswitchCloneSkeletonPredicates::* + * compiler.loopopts.TestUnswitchCloneSkeletonPredicates + * @run main/othervm -XX:-PartialPeelLoop compiler.loopopts.TestUnswitchCloneSkeletonPredicates + */ +package compiler.loopopts; + +public class TestUnswitchCloneSkeletonPredicates { + + static int x = 0; + static int y = 20; + static int intArr[] = new int[21000]; + static int idx = 0; + static boolean bFld = true; + static int iFld = 20; + static int iFld2 = 0 ; + static int iArrFld[] = new int[50]; + static float fArrFld[] = new float[50]; + + + // Only triggers with -XX:-PartialPeelLoop + /* + * The inner loop is unswitched on (1) which creates a fast and a slow loop that both have (1) removed and instead + * (1) is executed before the loop at (3). With the SplitIf optimization we find that (3) dominates (2) in both loops. + * + * As a result, we can remove (2) from both loops. This, however, has an influence on how the loop tree is built. + * Before the SplitIf optimization, the loop tree looks like this: + * Loop: N0/N0 has_sfpt + * Loop: N338/N314 limit_check profile_predicated predicated counted [0,100),+1 (2 iters) has_sfpt + * Loop: N459/N458 profile_predicated predicated counted [0,10000),+1 (5271 iters) has_sfpt (slow loop) + * Loop: N343/N267 profile_predicated predicated counted [0,10000),+1 (5271 iters) has_sfpt (fast loop) + * + * Both unswitched loop have a copy of the skeleton predicate If node that share the same Opaque4 node with its inputs. + * The inner loop is never exited normally due to always returning on (4). This means that the branch that exits the + * loop on the loop limit check is never taken and has an uncommon trap. Nevertheless, the loop building algorithm still + * identifies the fast and the slow loop as children of N338 because of the condition (2) over which the loop is left. + * However, after the above mentioned SplitIf optimization the condition (2) is removed from both loops. As a result, + * the slow loops (N459) is always exited immediately (x == 100 holds) because the break is executed on the first + * iteration of the loop. The loop can be removed (but these nodes are still part of the parent loop N338). The fast loop + * (N343), however, is now never exited normally and always returns on the 9800th iteration over (4). The normal loop exit + * over the loop limit check is never taken (uncommon trap). Due to the last loop exit (2) being removed, N343 is no longer + * recognized as a child loop of N338 due to not having a backedge to the parent loop. The loop tree looks like this: + * Loop: N0/N0 has_sfpt + * Loop: N338/N314 limit_check profile_predicated predicated counted [0,100),+1 (2 iters) has_sfpt + * Loop: N343/N267 profile_predicated predicated counted [0,10000),+1 (5274 iters) has_sfpt + * + * As a next step, the original parent loop N338 is peeled. The fast and the slow loop still both share skeleton Opaque4 bool + * nodes with all its inputs nodes up to and including the OpaqueLoopInit/Stride nodes. These skeleton predicates are still there + * even though the slow loop N459 could have been removed (the Opaque4 nodes are only removed after loop opts). Let's look at one + * of the skeleton If nodes for the fast loop that uses such a Opaque4 node. The skeleton 'If' is no longer part of the original + * parent loop and is therefore not peeled. But now we need some phi nodes to select the correct nodes either from the peeled + * iteration or from N338 for this skeleton If of the fast loop. This is done in PhaseIdealLoop::clone_iff() which creates + * a new Opaque4 node together with new Bool and Cmp nodes and then inserts some phi nodes to do the selection. + * + * When afterwards creating pre/main/post loops for the fast loop (N343) that is no child anymore, we find these phi nodes on the + * path to the OpaqueLoopInit/Stride nodes which lets the assertion PhaseIdealLoop::skeleton_predicate_has_opaque() fail. These + * phi nodes on the path to the OpaqueLoopInit/Stride nodes are unexpected. + * + * The solution to this problem is to clone the skeleton predicates completely, including clones of all nodes up to and including + * the OpaqueLoopInit/Stride nodes (similar to what is done when copying skeleton predicates to the main loop) instead of just + * sharing Opaque4 nodes. + */ + public static int test1() { + int i = 0; + while (i < 100) { + int j = 0; + // (3) + while (j < 10000) { + if (x == 100) { // (1) Loop is unswitched on this condition -> condition shared with (2) + y = 34; + } + + intArr[idx] = 34; + intArr[2*j + 35] = 45; + + if (x == 100) { // (2) + y = 35; + break; + } + if (j == 9800) { // (4) + return 2; + } + j++; + } + i++; + intArr[i] = 45; + } + return y; + } + + // Only triggers with -XX:-PartialPeelLoop + public static int test2() { + int i = 0; + while (i < 100) { + int j = 0; + while (j < 10000) { + if (x == 100) { + y = 34; + } + + intArr[2*j + 35] = 45; + + if (x == 100) { + y = 35; + break; + } + if (j == 9800) { + return 2; + } + j++; + } + i++; + intArr[i] = 45; + } + return y; + } + + // Only triggers with -XX:-PartialPeelLoop + public static int test3() { + int i = 0; + while (i < 100) { + int j = 0; + while (j < 10000) { + if (x == 100) { + y = 34; + } + + intArr[idx] = 34; + intArr[2*j + 35] = 45; + + if (x == 100) { + y = 35; + break; + } + if (j == 9800) { + return 2; + } + j++; + } + i++; + } + return y; +} + + // Test that has two loop headers for a single loop (limitation of type flow, see JDK-8255663) + // which also triggers the assertion failure of this bug. + public static void test4() { + int unused = 500; // Required, even though unused + boolean b = true; + int i = 1; + while (++i < 35) { + iArrFld[i] = 6; + switch (iFld2) { + case 40: + if (b) { + continue; + } + b = false; + break; + } + } + } + + // Test that has two loop headers for a single loop (limitation of type flow, see JDK-8255663) + // which also triggers the assertion failure of this bug. Only triggers with -XX:-PartialPeelLoop. + public static void test5() { + int j = 50; + int i = 1; + while (++i < 40) { + j = 5; + do { + fArrFld[i] = 46; + iFld = 5; + if (bFld) break; + } while (++j < 5); + j = 2; + do { + try { + iFld = 56; + } catch (ArithmeticException a_e) {} + if (bFld) break; + } while (++j < 2); + } + } + + public static void main(String[] strArr) { + for (int i = 0; i < 5000; i++) { + test1(); + test2(); + test3(); + x++; + x = x % 106; + } + test4(); + test5(); + } +} From 52ab72127ddc3ca6575d9d58503ec39c5dff7ab1 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Tue, 8 Dec 2020 09:25:42 +0000 Subject: [PATCH 129/504] 8254733: HotSpot Style Guide should permit using range-based for loops Reviewed-by: dholmes, pliden, jrose, dcubed, iklam, eosterlund, tschatzl, kvn --- doc/hotspot-style.html | 1 + doc/hotspot-style.md | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index c04ac93dc9138..36d0b098940bf 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -304,6 +304,7 @@

      Additional Permitted Features

    5. Dynamic initialization and destruction with concurrency (n2660)

    6. final virtual specifiers for classes and virtual functions (n2928), (n3206), (n3272)

    7. Local and unnamed types as template parameters (n2657)

    8. +
    9. Range-based for loops (n2930) (range-for)

    10. Excluded Features

        diff --git a/doc/hotspot-style.md b/doc/hotspot-style.md index 0225aac01c861..25c0dbc779321 100644 --- a/doc/hotspot-style.md +++ b/doc/hotspot-style.md @@ -750,6 +750,10 @@ part of the avoidance of the C++ Standard Library in HotSpot code. * Local and unnamed types as template parameters ([n2657](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm)) +* Range-based `for` loops +([n2930](http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html)) +([range-for](https://en.cppreference.com/w/cpp/language/range-for)) + ### Excluded Features * New string and character literals From d2b66196b4509a32613f476d7247f207289a75e3 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Tue, 8 Dec 2020 09:38:38 +0000 Subject: [PATCH 130/504] 8242258: (jrtfs) Path::toUri throws AssertionError for malformed input Reviewed-by: alanb --- .../classes/jdk/internal/jrtfs/JrtPath.java | 151 ++++++++++++++++-- test/jdk/jdk/internal/jrtfs/UriTests.java | 74 +++++++++ 2 files changed, 213 insertions(+), 12 deletions(-) create mode 100644 test/jdk/jdk/internal/jrtfs/UriTests.java diff --git a/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java b/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java index cb19f93a2631a..4720d9c98ad40 100644 --- a/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java +++ b/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java @@ -170,20 +170,16 @@ public final JrtPath toAbsolutePath() { @Override public final URI toUri() { - try { - String p = toAbsolutePath().path; - if (!p.startsWith("/modules") || p.contains("..")) { - throw new IOError(new RuntimeException(p + " cannot be represented as URI")); - } + String p = toAbsolutePath().path; + if (!p.startsWith("/modules") || p.contains("..")) { + throw new IOError(new RuntimeException(p + " cannot be represented as URI")); + } - p = p.substring("/modules".length()); - if (p.isEmpty()) { - p = "/"; - } - return new URI("jrt", p, null); - } catch (URISyntaxException ex) { - throw new AssertionError(ex); + p = p.substring("/modules".length()); + if (p.isEmpty()) { + p = "/"; } + return toUri(p); } private boolean equalsNameAt(JrtPath other, int index) { @@ -825,4 +821,135 @@ private void copyToTarget(JrtPath target, CopyOption... options) } } } + + // adopted from sun.nio.fs.UnixUriUtils + private static URI toUri(String str) { + char[] path = str.toCharArray(); + assert path[0] == '/'; + StringBuilder sb = new StringBuilder(); + sb.append(path[0]); + for (int i = 1; i < path.length; i++) { + char c = (char)(path[i] & 0xff); + if (match(c, L_PATH, H_PATH)) { + sb.append(c); + } else { + sb.append('%'); + sb.append(hexDigits[(c >> 4) & 0x0f]); + sb.append(hexDigits[(c) & 0x0f]); + } + } + + try { + return new URI("jrt:" + sb.toString()); + } catch (URISyntaxException x) { + throw new AssertionError(x); // should not happen + } + } + + // The following is copied from java.net.URI + + // Compute the low-order mask for the characters in the given string + private static long lowMask(String chars) { + int n = chars.length(); + long m = 0; + for (int i = 0; i < n; i++) { + char c = chars.charAt(i); + if (c < 64) + m |= (1L << c); + } + return m; + } + + // Compute the high-order mask for the characters in the given string + private static long highMask(String chars) { + int n = chars.length(); + long m = 0; + for (int i = 0; i < n; i++) { + char c = chars.charAt(i); + if ((c >= 64) && (c < 128)) + m |= (1L << (c - 64)); + } + return m; + } + + // Compute a low-order mask for the characters + // between first and last, inclusive + private static long lowMask(char first, char last) { + long m = 0; + int f = Math.max(Math.min(first, 63), 0); + int l = Math.max(Math.min(last, 63), 0); + for (int i = f; i <= l; i++) + m |= 1L << i; + return m; + } + + // Compute a high-order mask for the characters + // between first and last, inclusive + private static long highMask(char first, char last) { + long m = 0; + int f = Math.max(Math.min(first, 127), 64) - 64; + int l = Math.max(Math.min(last, 127), 64) - 64; + for (int i = f; i <= l; i++) + m |= 1L << i; + return m; + } + + // Tell whether the given character is permitted by the given mask pair + private static boolean match(char c, long lowMask, long highMask) { + if (c < 64) + return ((1L << c) & lowMask) != 0; + if (c < 128) + return ((1L << (c - 64)) & highMask) != 0; + return false; + } + + // digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | + // "8" | "9" + private static final long L_DIGIT = lowMask('0', '9'); + private static final long H_DIGIT = 0L; + + // upalpha = "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" + private static final long L_UPALPHA = 0L; + private static final long H_UPALPHA = highMask('A', 'Z'); + + // lowalpha = "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" + private static final long L_LOWALPHA = 0L; + private static final long H_LOWALPHA = highMask('a', 'z'); + + // alpha = lowalpha | upalpha + private static final long L_ALPHA = L_LOWALPHA | L_UPALPHA; + private static final long H_ALPHA = H_LOWALPHA | H_UPALPHA; + + // alphanum = alpha | digit + private static final long L_ALPHANUM = L_DIGIT | L_ALPHA; + private static final long H_ALPHANUM = H_DIGIT | H_ALPHA; + + // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | + // "(" | ")" + private static final long L_MARK = lowMask("-_.!~*'()"); + private static final long H_MARK = highMask("-_.!~*'()"); + + // unreserved = alphanum | mark + private static final long L_UNRESERVED = L_ALPHANUM | L_MARK; + private static final long H_UNRESERVED = H_ALPHANUM | H_MARK; + + // pchar = unreserved | escaped | + // ":" | "@" | "&" | "=" | "+" | "$" | "," + private static final long L_PCHAR + = L_UNRESERVED | lowMask(":@&=+$,"); + private static final long H_PCHAR + = H_UNRESERVED | highMask(":@&=+$,"); + + // All valid path characters + private static final long L_PATH = L_PCHAR | lowMask(";/"); + private static final long H_PATH = H_PCHAR | highMask(";/"); + + private static final char[] hexDigits = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; } diff --git a/test/jdk/jdk/internal/jrtfs/UriTests.java b/test/jdk/jdk/internal/jrtfs/UriTests.java new file mode 100644 index 0000000000000..be90e2d032fa8 --- /dev/null +++ b/test/jdk/jdk/internal/jrtfs/UriTests.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2020, 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 8242258 + * @summary (jrtfs) Path::toUri throws AssertionError for malformed input + * @run testng UriTests + */ + +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.net.URI; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + +public class UriTests { + private FileSystem theFileSystem; + + @BeforeClass + public void setup() { + theFileSystem = FileSystems.getFileSystem(URI.create("jrt:/")); + } + + @DataProvider(name = "problemStrings") + private Object[][] problemStrings() { + return new Object[][] { + { "[", "jrt:/%5B" }, + { "]", "jrt:/%5D" }, + { "{", "jrt:/%7B" }, + { "}", "jrt:/%7D" }, + { "`", "jrt:/%60" }, + { "%", "jrt:/%25" }, + { " xyz", "jrt:/%20xyz" }, + { "xyz ", "jrt:/xyz%20" }, + { "xy z", "jrt:/xy%20z" }, + }; + } + + @Test(dataProvider = "problemStrings") + public void testPathToURI(String pathSuffix, String uriStr) { + URI uri = theFileSystem.getPath("/modules/" + pathSuffix).toUri(); + assertEquals(uri.toString(), uriStr); + } + + @Test(dataProvider = "problemStrings") + public void testURIToPath(String pathSuffix, String uriStr) { + Path path = theFileSystem.provider().getPath(URI.create(uriStr)); + assertEquals(path.toString(), "/modules/" + pathSuffix); + } +} From 35e81536e79fa31ecd2cf2267d64801f067475b2 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Tue, 8 Dec 2020 10:11:01 +0000 Subject: [PATCH 131/504] 8257848: -XX:CompileCommand=blackhole,* should be diagnostic Reviewed-by: vlivanov --- src/hotspot/share/compiler/compilerOracle.cpp | 22 ++-- .../BlackholeDiagnosticUnlockTest.java | 109 ++++++++++++++++++ ....java => BlackholeNonVoidWarningTest.java} | 12 +- 3 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/blackhole/BlackholeDiagnosticUnlockTest.java rename test/hotspot/jtreg/compiler/blackhole/{BlackholeNonVoidWarning.java => BlackholeNonVoidWarningTest.java} (85%) diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 091839aa4acef..e0d7b2883780c 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -286,6 +286,11 @@ static void register_command(TypedMethodOptionMatcher* matcher, } assert(CompilerOracle::option_matches_type(option, value), "Value must match option type"); + if (option == CompileCommand::Blackhole && !UnlockDiagnosticVMOptions) { + warning("Blackhole compile option is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions"); + return; + } + matcher->init(option, option_list); matcher->set_value(value); option_list = matcher; @@ -410,15 +415,16 @@ bool CompilerOracle::should_break_at(const methodHandle& method) { } bool CompilerOracle::should_blackhole(const methodHandle& method) { - if (check_predicate(CompileCommand::Blackhole, method)) { - if (method->result_type() == T_VOID) { - return true; - } else { - warning("blackhole compile command only works for methods with void type: %s", - method->name_and_sig_as_C_string()); - } + if (!check_predicate(CompileCommand::Blackhole, method)) { + return false; } - return false; + guarantee(UnlockDiagnosticVMOptions, "Checked during initial parsing"); + if (method->result_type() != T_VOID) { + warning("Blackhole compile option only works for methods with void type: %s", + method->name_and_sig_as_C_string()); + return false; + } + return true; } static enum CompileCommand parse_option_name(const char* line, int* bytes_read, char* errorbuf, int bufsize) { diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeDiagnosticUnlockTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeDiagnosticUnlockTest.java new file mode 100644 index 0000000000000..45eb8022fcf97 --- /dev/null +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeDiagnosticUnlockTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2020, Red Hat, 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 + * @library /test/lib + * @build compiler.blackhole.BlackholeTarget + * @run driver compiler.blackhole.BlackholeDiagnosticUnlockTest + */ + +package compiler.blackhole; + +import java.io.IOException; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class BlackholeDiagnosticUnlockTest { + + private static final int CYCLES = 1_000_000; + private static final int TRIES = 10; + + public static void main(String[] args) throws IOException { + if (args.length == 0) { + driver(); + } else { + runner(); + } + } + + public static void driver() throws IOException { + final String msg = "Blackhole compile option is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions"; + + if (!Platform.isDebugBuild()) { // UnlockDiagnosticVMOptions is true in debug + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx128m", + "-Xbatch", + "-XX:CompileCommand=quiet", + "-XX:CompileCommand=option,compiler/blackhole/BlackholeTarget.bh_*,Blackhole", + "compiler.blackhole.BlackholeDiagnosticUnlockTest", + "run" + ); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + output.shouldContain(msg); + } + + { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx128m", + "-XX:-PrintWarnings", + "-XX:CompileCommand=quiet", + "-XX:CompileCommand=option,compiler/blackhole/BlackholeTarget.bh_*,Blackhole", + "compiler.blackhole.BlackholeDiagnosticUnlockTest", + "run" + ); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + output.shouldNotContain(msg); + } + + { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx128m", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:CompileCommand=quiet", + "-XX:CompileCommand=option,compiler/blackhole/BlackholeTarget.bh_*,Blackhole", + "compiler.blackhole.BlackholeDiagnosticUnlockTest", + "run" + ); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + output.shouldNotContain(msg); + } + } + + public static void runner() { + for (int t = 0; t < TRIES; t++) { + run(); + } + } + + public static void run() { + for (int c = 0; c < CYCLES; c++) { + BlackholeTarget.bh_s_int_1(c); + } + } + +} diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java similarity index 85% rename from test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java rename to test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java index 00a173f054d9f..671ab705234ca 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarning.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java @@ -25,7 +25,7 @@ * @test * @library /test/lib * @build compiler.blackhole.BlackholeTarget - * @run driver compiler.blackhole.BlackholeNonVoidWarning + * @run driver compiler.blackhole.BlackholeNonVoidWarningTest */ package compiler.blackhole; @@ -34,7 +34,7 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -public class BlackholeNonVoidWarning { +public class BlackholeNonVoidWarningTest { private static final int CYCLES = 1_000_000; private static final int TRIES = 10; @@ -48,15 +48,16 @@ public static void main(String[] args) throws IOException { } public static void driver() throws IOException { - final String msg = "blackhole compile command only works for methods with void type: compiler.blackhole.BlackholeTarget.bh_sr_int(I)I"; + final String msg = "Blackhole compile option only works for methods with void type: compiler.blackhole.BlackholeTarget.bh_sr_int(I)I"; { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xmx128m", "-Xbatch", + "-XX:+UnlockDiagnosticVMOptions", "-XX:CompileCommand=quiet", "-XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_*", - "compiler.blackhole.BlackholeNonVoidWarning", + "compiler.blackhole.BlackholeNonVoidWarningTest", "run" ); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -68,9 +69,10 @@ public static void driver() throws IOException { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-Xmx128m", "-XX:-PrintWarnings", + "-XX:+UnlockDiagnosticVMOptions", "-XX:CompileCommand=quiet", "-XX:CompileCommand=blackhole,compiler/blackhole/BlackholeTarget.bh_*", - "compiler.blackhole.BlackholeNonVoidWarning", + "compiler.blackhole.BlackholeNonVoidWarningTest", "run" ); OutputAnalyzer output = new OutputAnalyzer(pb.start()); From a70802477eadfa7e799201c9a055fdbec5fb4b66 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 8 Dec 2020 12:15:13 +0000 Subject: [PATCH 132/504] 8257194: Add 'foreign linker API' in 'jdk.incubator.foreign' module desc/summary Reviewed-by: jvernee, shade --- src/jdk.incubator.foreign/share/classes/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jdk.incubator.foreign/share/classes/module-info.java b/src/jdk.incubator.foreign/share/classes/module-info.java index 3c7c0ca74aabd..fd1c26f300efb 100644 --- a/src/jdk.incubator.foreign/share/classes/module-info.java +++ b/src/jdk.incubator.foreign/share/classes/module-info.java @@ -24,7 +24,7 @@ */ /** - * Defines the experimental foreign memory access API. + * Defines an API for accessing foreign memory and calling foreign functions, directly from Java. * * {@Incubating} * From d0c526513d7d82c2a4bb9ef72656cc35de8452e9 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Tue, 8 Dec 2020 13:09:15 +0000 Subject: [PATCH 133/504] 8256149: Weird AST structure for incomplete member select Reviewed-by: vromero --- .../sun/tools/javac/parser/JavacParser.java | 15 ++++++ .../tools/javac/parser/JavacParserTest.java | 47 ++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java index 0014bc21ae5d4..d03fbd52e52ad 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -1327,6 +1327,14 @@ protected JCExpression term3() { } // typeArgs saved for next loop iteration. t = toP(F.at(pos).Select(t, ident())); + if (token.pos <= endPosTable.errorEndPos && + token.kind == MONKEYS_AT) { + //error recovery, case like: + //int i = expr. + //@Deprecated + if (typeArgs != null) illegal(); + return toP(t); + } if (tyannos != null && tyannos.nonEmpty()) { t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t)); } @@ -1534,6 +1542,13 @@ JCExpression term3Rest(JCExpression t, List typeArgs) { tyannos = typeAnnotationsOpt(); } t = toP(F.at(pos1).Select(t, ident(true))); + if (token.pos <= endPosTable.errorEndPos && + token.kind == MONKEYS_AT) { + //error recovery, case like: + //int i = expr. + //@Deprecated + break; + } if (tyannos != null && tyannos.nonEmpty()) { t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t)); } diff --git a/test/langtools/tools/javac/parser/JavacParserTest.java b/test/langtools/tools/javac/parser/JavacParserTest.java index 59d6607f528b7..74b8a84ca6582 100644 --- a/test/langtools/tools/javac/parser/JavacParserTest.java +++ b/test/langtools/tools/javac/parser/JavacParserTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 + * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 8256149 * @summary tests error and diagnostics positions * @author Jan Lahoda * @modules jdk.compiler/com.sun.tools.javac.api @@ -1612,6 +1612,51 @@ String s() { """); } + @Test + void testAtRecovery() throws IOException { + //verify the errors and AST form produced for member selects which are + //missing the selected member name and are followed by an annotation: + String code = """ + package t; + class Test { + int i1 = "". + @Deprecated + void t1() { + } + int i2 = String. + @Deprecated + void t2() { + } + } + """; + StringWriter out = new StringWriter(); + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null, List.of("-XDrawDiagnostics"), + null, Arrays.asList(new MyFileObject(code))); + String ast = ct.parse().iterator().next().toString().replaceAll("\\R", "\n"); + String expected = """ + package t; + \n\ + class Test { + int i1 = "".; + \n\ + @Deprecated + void t1() { + } + int i2 = String.; + \n\ + @Deprecated + void t2() { + } + } """; + assertEquals("Unexpected AST, got:\n" + ast, expected, ast); + assertEquals("Unexpected errors, got:\n" + out.toString(), + out.toString().replaceAll("\\R", "\n"), + """ + Test.java:3:17: compiler.err.expected: token.identifier + Test.java:7:21: compiler.err.expected: token.identifier + """); + } + @Test //JDK-8256411 void testBasedAnonymous() throws IOException { String code = """ From 936a7acf32a9165d4a775beb63dc10c182ef7fb4 Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Tue, 8 Dec 2020 15:49:11 +0000 Subject: [PATCH 134/504] 8252797: Non-PCH build fails on Ubuntu 16.4 when building with gtests Reviewed-by: dholmes --- test/hotspot/gtest/unittest.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/hotspot/gtest/unittest.hpp b/test/hotspot/gtest/unittest.hpp index 3911a1e68364d..8785f39873420 100644 --- a/test/hotspot/gtest/unittest.hpp +++ b/test/hotspot/gtest/unittest.hpp @@ -48,6 +48,10 @@ #undef F1 #undef F2 +// A work around for GCC math header bug leaving isfinite() undefined, +// see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608 +#include "utilities/globalDefinitions.hpp" + #include "gmock/gmock.h" #include "gtest/gtest.h" From fab6158c198dd6b363bfb36e5a18107214bb134d Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 8 Dec 2020 16:36:04 +0000 Subject: [PATCH 135/504] 8236413: AbstractConnectTimeout should tolerate both NoRouteToHostException and UnresolvedAddressException Reviewed-by: aefimov, michaelm --- .../httpclient/AbstractConnectTimeout.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/jdk/java/net/httpclient/AbstractConnectTimeout.java b/test/jdk/java/net/httpclient/AbstractConnectTimeout.java index d066642e40bd2..980c25b944cdc 100644 --- a/test/jdk/java/net/httpclient/AbstractConnectTimeout.java +++ b/test/jdk/java/net/httpclient/AbstractConnectTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; +import java.nio.channels.UnresolvedAddressException; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -142,11 +143,11 @@ private void timeoutSync(Version requestVersion, long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime); out.printf("Client: received in %d millis%n", elapsedTime); Throwable t = e.getCause().getCause(); // blocking thread-specific exception - if (!(t instanceof NoRouteToHostException)) { // tolerate only NRTHE + if (!isAcceptableCause(t)) { // tolerate only NRTHE or UAE e.printStackTrace(out); fail("Unexpected exception:" + e); } else { - out.printf("Caught ConnectException with NoRouteToHostException" + out.printf("Caught ConnectException with " + " cause: %s - skipping%n", t.getCause()); } } @@ -194,10 +195,10 @@ private void timeoutAsync(Version requestVersion, long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime); out.printf("Client: received in %d millis%n", elapsedTime); Throwable t = e.getCause(); - if (t instanceof ConnectException && - t.getCause() instanceof NoRouteToHostException) { // tolerate only NRTHE - out.printf("Caught ConnectException with NoRouteToHostException" - + " cause: %s - skipping%n", t.getCause()); + if (t instanceof ConnectException && isAcceptableCause(t.getCause())) { + // tolerate only NRTHE and UAE + out.printf("Caught ConnectException with " + + "cause: %s - skipping%n", t.getCause()); } else { assertExceptionTypeAndCause(t); } @@ -205,6 +206,12 @@ private void timeoutAsync(Version requestVersion, } } + static boolean isAcceptableCause(Throwable cause) { + if (cause instanceof NoRouteToHostException) return true; + if (cause instanceof UnresolvedAddressException) return true; + return false; + } + static HttpClient newClient(Duration connectTimeout, ProxySelector proxy) { HttpClient.Builder builder = HttpClient.newBuilder().proxy(proxy); if (connectTimeout != NO_DURATION) From 044616bd71ab82f0f67670152cecbabfee83d00c Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 8 Dec 2020 17:02:09 +0000 Subject: [PATCH 136/504] 8252049: Native memory leak in ciMethodData ctor Reviewed-by: kbarrett, coleenp --- src/hotspot/share/ci/ciMethodData.cpp | 52 ++------ src/hotspot/share/ci/ciMethodData.hpp | 20 ++- src/hotspot/share/ci/ciReplay.cpp | 2 +- src/hotspot/share/jvmci/vmStructs_jvmci.cpp | 8 +- src/hotspot/share/oops/methodData.cpp | 20 +-- src/hotspot/share/oops/methodData.hpp | 120 +++++++++++++----- src/hotspot/share/runtime/vmStructs.cpp | 12 +- .../jdk/vm/ci/hotspot/HotSpotVMConfig.java | 8 +- 8 files changed, 132 insertions(+), 110 deletions(-) diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index 76dde0b9f7428..cded7042da10a 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.cpp @@ -37,46 +37,21 @@ // ------------------------------------------------------------------ // ciMethodData::ciMethodData // -ciMethodData::ciMethodData(MethodData* md) : ciMetadata(md) { - assert(md != NULL, "no null method data"); - Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord)); - _data = NULL; - _data_size = 0; - _extra_data_size = 0; - _current_mileage = 0; - _invocation_counter = 0; - _backedge_counter = 0; - _state = empty_state; - _saw_free_extra_data = false; +ciMethodData::ciMethodData(MethodData* md) +: ciMetadata(md), + _data_size(0), _extra_data_size(0), _data(NULL), // Set an initial hint. Don't use set_hint_di() because // first_di() may be out of bounds if data_size is 0. - _hint_di = first_di(); + _hint_di(first_di()), + _state(empty_state), + _saw_free_extra_data(false), // Initialize the escape information (to "don't know."); - _eflags = _arg_local = _arg_stack = _arg_returned = 0; - _parameters = NULL; -} - -// ------------------------------------------------------------------ -// ciMethodData::ciMethodData -// -// No MethodData*. -ciMethodData::ciMethodData() : ciMetadata(NULL) { - Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord)); - _data = NULL; - _data_size = 0; - _extra_data_size = 0; - _current_mileage = 0; - _invocation_counter = 0; - _backedge_counter = 0; - _state = empty_state; - _saw_free_extra_data = false; - // Set an initial hint. Don't use set_hint_di() because - // first_di() may be out of bounds if data_size is 0. - _hint_di = first_di(); - // Initialize the escape information (to "don't know."); - _eflags = _arg_local = _arg_stack = _arg_returned = 0; - _parameters = NULL; -} + _eflags(0), _arg_local(0), _arg_stack(0), _arg_returned(0), + _current_mileage(0), + _invocation_counter(0), + _backedge_counter(0), + _orig(), + _parameters(NULL) {} // Check for entries that reference an unloaded method class PrepareExtraDataClosure : public CleanExtraDataClosure { @@ -226,7 +201,8 @@ void ciMethodData::load_data() { // _extra_data_size = extra_data_limit - extra_data_base // total_size = _data_size + _extra_data_size // args_data_limit = data_base + total_size - parameter_data_size - Copy::disjoint_words_atomic((HeapWord*) mdo, + static_assert(sizeof(_orig) % HeapWordSize == 0, "align"); + Copy::disjoint_words_atomic((HeapWord*) &mdo->_compiler_counters, (HeapWord*) &_orig, sizeof(_orig) / HeapWordSize); Arena* arena = CURRENT_ENV->arena(); diff --git a/src/hotspot/share/ci/ciMethodData.hpp b/src/hotspot/share/ci/ciMethodData.hpp index 2e78e5f3bad54..6b3c01b64faf8 100644 --- a/src/hotspot/share/ci/ciMethodData.hpp +++ b/src/hotspot/share/ci/ciMethodData.hpp @@ -390,10 +390,10 @@ class ciMethodData : public ciMetadata { u_char _saw_free_extra_data; // Support for interprocedural escape analysis - intx _eflags; // flags on escape information - intx _arg_local; // bit set of non-escaping arguments - intx _arg_stack; // bit set of stack-allocatable arguments - intx _arg_returned; // bit set of returned arguments + intx _eflags; // flags on escape information + intx _arg_local; // bit set of non-escaping arguments + intx _arg_stack; // bit set of stack-allocatable arguments + intx _arg_returned; // bit set of returned arguments // Maturity of the oop when the snapshot is taken. int _current_mileage; @@ -405,17 +405,15 @@ class ciMethodData : public ciMetadata { int _backedge_counter; // Coherent snapshot of original header. - MethodData _orig; + MethodData::CompilerCounters _orig; - // Area dedicated to parameters. NULL if no parameter profiling for - // this method. + // Area dedicated to parameters. NULL if no parameter profiling for this method. DataLayout* _parameters; int parameters_size() const { return _parameters == NULL ? 0 : parameters_type_data()->size_in_bytes(); } - ciMethodData(MethodData* md); - ciMethodData(); + ciMethodData(MethodData* md = NULL); // Accessors int data_size() const { return _data_size; } @@ -544,8 +542,8 @@ class ciMethodData : public ciMetadata { uint trap_count(int reason) const { return _orig.trap_count(reason); } - uint trap_reason_limit() const { return _orig.trap_reason_limit(); } - uint trap_count_limit() const { return _orig.trap_count_limit(); } + uint trap_reason_limit() const { return MethodData::trap_reason_limit(); } + uint trap_count_limit() const { return MethodData::trap_count_limit(); } // Helpful query functions that decode trap_state. int has_trap_at(ciProfileData* data, int reason); diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index 1395f24cff0d4..b1b8d5e82ac0e 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -286,7 +286,7 @@ class CompileReplay : public StackObj { return NULL; } - int actual_size = sizeof(MethodData); + int actual_size = sizeof(MethodData::CompilerCounters); char *result = NEW_RESOURCE_ARRAY(char, actual_size); int i = 0; if (read_size != actual_size) { diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index 8b8d3061d573a..9237b235543d6 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -237,10 +237,10 @@ nonstatic_field(MethodData, _data_size, int) \ nonstatic_field(MethodData, _data[0], intptr_t) \ nonstatic_field(MethodData, _parameters_type_data_di, int) \ - nonstatic_field(MethodData, _nof_decompiles, uint) \ - nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \ - nonstatic_field(MethodData, _nof_overflow_traps, uint) \ - nonstatic_field(MethodData, _trap_hist._array[0], u1) \ + nonstatic_field(MethodData, _compiler_counters._nof_decompiles, uint) \ + nonstatic_field(MethodData, _compiler_counters._nof_overflow_recompiles, uint) \ + nonstatic_field(MethodData, _compiler_counters._nof_overflow_traps, uint) \ + nonstatic_field(MethodData, _compiler_counters._trap_hist._array[0], u1) \ nonstatic_field(MethodData, _eflags, intx) \ nonstatic_field(MethodData, _arg_local, intx) \ nonstatic_field(MethodData, _arg_stack, intx) \ diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 058f23890b3b5..a98ec664076e8 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "ci/ciMethodData.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/compilerOracle.hpp" @@ -656,7 +657,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, const methodHandl int size = MethodData::compute_allocation_size_in_words(method); return new (loader_data, size, MetaspaceObj::MethodDataType, THREAD) - MethodData(method, size, THREAD); + MethodData(method); } int MethodData::bytecode_cell_count(Bytecodes::Code code) { @@ -1202,11 +1203,11 @@ void MethodData::post_initialize(BytecodeStream* stream) { } // Initialize the MethodData* corresponding to a given method. -MethodData::MethodData(const methodHandle& method, int size, TRAPS) - : _extra_data_lock(Mutex::leaf, "MDO extra data lock"), +MethodData::MethodData(const methodHandle& method) + : _method(method()), + _extra_data_lock(Mutex::leaf, "MDO extra data lock"), + _compiler_counters(method()), _parameters_type_data_di(parameters_uninitialized) { - // Set the method back-pointer. - _method = method(); initialize(); } @@ -1216,7 +1217,6 @@ void MethodData::initialize() { ResourceMark rm(thread); init(); - set_creation_mileage(mileage_of(method())); // Go through the bytecodes and allocate and initialize the // corresponding data cells. @@ -1318,14 +1318,8 @@ void MethodData::init() { } #endif - // Initialize flags and trap history. - _nof_decompiles = 0; - _nof_overflow_recompiles = 0; - _nof_overflow_traps = 0; + // Initialize escape flags. clear_escape_info(); - assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align"); - Copy::zero_to_words((HeapWord*) &_trap_hist, - sizeof(_trap_hist) / sizeof(HeapWord)); } // Get a measure of how much mileage the method has on it. diff --git a/src/hotspot/share/oops/methodData.hpp b/src/hotspot/share/oops/methodData.hpp index bbac95b6122bc..289593afd94bc 100644 --- a/src/hotspot/share/oops/methodData.hpp +++ b/src/hotspot/share/oops/methodData.hpp @@ -31,6 +31,7 @@ #include "oops/oop.hpp" #include "runtime/atomic.hpp" #include "utilities/align.hpp" +#include "utilities/copy.hpp" class BytecodeStream; @@ -1930,12 +1931,15 @@ class FailedSpeculation: public CHeapObj { }; #endif +class ciMethodData; + class MethodData : public Metadata { friend class VMStructs; friend class JVMCIVMStructs; private: friend class ProfileData; friend class TypeEntriesAtCall; + friend class ciMethodData; // If you add a new field that points to any metaspace object, you // must add this field to MethodData::metaspace_pointers_do(). @@ -1951,10 +1955,9 @@ class MethodData : public Metadata { Mutex _extra_data_lock; - MethodData(const methodHandle& method, int size, TRAPS); + MethodData(const methodHandle& method); public: static MethodData* allocate(ClassLoaderData* loader_data, const methodHandle& method, TRAPS); - MethodData() : _extra_data_lock(Mutex::leaf, "MDO extra data lock") {}; // For ciMethodData virtual bool is_methodData() const { return true; } void initialize(); @@ -1965,14 +1968,75 @@ class MethodData : public Metadata { _trap_hist_mask = max_jubyte, _extra_data_count = 4 // extra DataLayout headers, for trap history }; // Public flag values + + // Compiler-related counters. + class CompilerCounters { + friend class VMStructs; + friend class JVMCIVMStructs; + + int _creation_mileage; // method mileage at MDO creation + uint _nof_decompiles; // count of all nmethod removals + uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits + uint _nof_overflow_traps; // trap count, excluding _trap_hist + union { + intptr_t _align; + u1 _array[JVMCI_ONLY(2 *) MethodData::_trap_hist_limit]; + } _trap_hist; + + CompilerCounters(int current_mileage) : _creation_mileage(current_mileage), _nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) { + static_assert(sizeof(_trap_hist) % HeapWordSize == 0, "align"); + uint size_in_words = sizeof(_trap_hist) / HeapWordSize; + Copy::zero_to_words((HeapWord*) &_trap_hist, size_in_words); + } + public: + CompilerCounters(Method* m) : CompilerCounters(MethodData::mileage_of(m)) {} + CompilerCounters() : CompilerCounters(0) {} // for ciMethodData + + int creation_mileage() const { return _creation_mileage; } + + // Return (uint)-1 for overflow. + uint trap_count(int reason) const { + assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); + return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1; + } + + uint inc_trap_count(int reason) { + // Count another trap, anywhere in this method. + assert(reason >= 0, "must be single trap"); + assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); + uint cnt1 = 1 + _trap_hist._array[reason]; + if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow... + _trap_hist._array[reason] = cnt1; + return cnt1; + } else { + return _trap_hist_mask + (++_nof_overflow_traps); + } + } + + uint overflow_trap_count() const { + return _nof_overflow_traps; + } + uint overflow_recompile_count() const { + return _nof_overflow_recompiles; + } + uint inc_overflow_recompile_count() { + return ++_nof_overflow_recompiles; + } + uint decompile_count() const { + return _nof_decompiles; + } + uint inc_decompile_count() { + return ++_nof_decompiles; + } + + // Support for code generation + static ByteSize trap_history_offset() { + return byte_offset_of(CompilerCounters, _trap_hist._array); + } + }; + private: - uint _nof_decompiles; // count of all nmethod removals - uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits - uint _nof_overflow_traps; // trap count, excluding _trap_hist - union { - intptr_t _align; - u1 _array[JVMCI_ONLY(2 *) _trap_hist_limit]; - } _trap_hist; + CompilerCounters _compiler_counters; // Support for interprocedural escape analysis, from Thomas Kotzmann. intx _eflags; // flags on escape information @@ -1980,8 +2044,6 @@ class MethodData : public Metadata { intx _arg_stack; // bit set of stack-allocatable arguments intx _arg_returned; // bit set of returned arguments - int _creation_mileage; // method mileage at MDO creation - // How many invocations has this MDO seen? // These counters are used to determine the exact age of MDO. // We need those because in tiered a method can be concurrently @@ -2126,8 +2188,7 @@ class MethodData : public Metadata { int size_in_bytes() const { return _size; } int size() const { return align_metadata_size(align_up(_size, BytesPerWord)/BytesPerWord); } - int creation_mileage() const { return _creation_mileage; } - void set_creation_mileage(int x) { _creation_mileage = x; } + int creation_mileage() const { return _compiler_counters.creation_mileage(); } int invocation_count() { if (invocation_counter()->carry()) { @@ -2302,42 +2363,33 @@ class MethodData : public Metadata { // Return (uint)-1 for overflow. uint trap_count(int reason) const { - assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); - return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1; + return _compiler_counters.trap_count(reason); } // For loops: static uint trap_reason_limit() { return _trap_hist_limit; } static uint trap_count_limit() { return _trap_hist_mask; } uint inc_trap_count(int reason) { - // Count another trap, anywhere in this method. - assert(reason >= 0, "must be single trap"); - assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob"); - uint cnt1 = 1 + _trap_hist._array[reason]; - if ((cnt1 & _trap_hist_mask) != 0) { // if no counter overflow... - _trap_hist._array[reason] = cnt1; - return cnt1; - } else { - return _trap_hist_mask + (++_nof_overflow_traps); - } + return _compiler_counters.inc_trap_count(reason); } uint overflow_trap_count() const { - return _nof_overflow_traps; + return _compiler_counters.overflow_trap_count(); } uint overflow_recompile_count() const { - return _nof_overflow_recompiles; + return _compiler_counters.overflow_recompile_count(); } - void inc_overflow_recompile_count() { - _nof_overflow_recompiles += 1; + uint inc_overflow_recompile_count() { + return _compiler_counters.inc_overflow_recompile_count(); } uint decompile_count() const { - return _nof_decompiles; + return _compiler_counters.decompile_count(); } - void inc_decompile_count() { - _nof_decompiles += 1; - if (decompile_count() > (uint)PerMethodRecompilationCutoff) { + uint inc_decompile_count() { + uint dec_count = _compiler_counters.inc_decompile_count(); + if (dec_count > (uint)PerMethodRecompilationCutoff) { method()->set_not_compilable("decompile_count > PerMethodRecompilationCutoff", CompLevel_full_optimization); } + return dec_count; } uint tenure_traps() const { return _tenure_traps; @@ -2363,7 +2415,7 @@ class MethodData : public Metadata { } static ByteSize trap_history_offset() { - return byte_offset_of(MethodData, _trap_hist._array); + return byte_offset_of(MethodData, _compiler_counters) + CompilerCounters::trap_history_offset(); } static ByteSize invocation_counter_offset() { diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 7edf022af64ce..9956cc40e8e4b 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -270,10 +270,10 @@ typedef HashtableEntry KlassHashtableEntry; nonstatic_field(MethodData, _data_size, int) \ nonstatic_field(MethodData, _data[0], intptr_t) \ nonstatic_field(MethodData, _parameters_type_data_di, int) \ - nonstatic_field(MethodData, _nof_decompiles, uint) \ - nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \ - nonstatic_field(MethodData, _nof_overflow_traps, uint) \ - nonstatic_field(MethodData, _trap_hist._array[0], u1) \ + nonstatic_field(MethodData, _compiler_counters._nof_decompiles, uint) \ + nonstatic_field(MethodData, _compiler_counters._nof_overflow_recompiles, uint) \ + nonstatic_field(MethodData, _compiler_counters._nof_overflow_traps, uint) \ + nonstatic_field(MethodData, _compiler_counters._trap_hist._array[0], u1) \ nonstatic_field(MethodData, _eflags, intx) \ nonstatic_field(MethodData, _arg_local, intx) \ nonstatic_field(MethodData, _arg_stack, intx) \ @@ -856,7 +856,7 @@ typedef HashtableEntry KlassHashtableEntry; nonstatic_field(ciMethodData, _arg_stack, intx) \ nonstatic_field(ciMethodData, _arg_returned, intx) \ nonstatic_field(ciMethodData, _current_mileage, int) \ - nonstatic_field(ciMethodData, _orig, MethodData) \ + nonstatic_field(ciMethodData, _orig, MethodData::CompilerCounters) \ \ nonstatic_field(ciField, _holder, ciInstanceKlass*) \ nonstatic_field(ciField, _name, ciSymbol*) \ @@ -1264,6 +1264,8 @@ typedef HashtableEntry KlassHashtableEntry; declare_type(MethodCounters, MetaspaceObj) \ declare_type(ConstMethod, MetaspaceObj) \ \ + declare_toplevel_type(MethodData::CompilerCounters) \ + \ declare_toplevel_type(narrowKlass) \ \ declare_toplevel_type(vtableEntry) \ diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java index a5d9fe08fe2ab..a0221eb97485a 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java @@ -177,12 +177,12 @@ long arrayPrototypeMarkWord() { final int methodDataSize = getFieldOffset("MethodData::_size", Integer.class, "int"); final int methodDataDataSize = getFieldOffset("MethodData::_data_size", Integer.class, "int"); final int methodDataOopDataOffset = getFieldOffset("MethodData::_data[0]", Integer.class, "intptr_t"); - final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1"); + final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_compiler_counters._trap_hist._array[0]", Integer.class, "u1"); final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int"); - final int methodDataDecompiles = getFieldOffset("MethodData::_nof_decompiles", Integer.class, "uint"); - final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_nof_overflow_recompiles", Integer.class, "uint"); - final int methodDataOverflowTraps = getFieldOffset("MethodData::_nof_overflow_traps", Integer.class, "uint"); + final int methodDataDecompiles = getFieldOffset("MethodData::_compiler_counters._nof_decompiles", Integer.class, "uint"); + final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_compiler_counters._nof_overflow_recompiles", Integer.class, "uint"); + final int methodDataOverflowTraps = getFieldOffset("MethodData::_compiler_counters._nof_overflow_traps", Integer.class, "uint"); final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int"); From 264feb35ffee62509cbf00405516bdd40c515858 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 8 Dec 2020 17:59:35 +0000 Subject: [PATCH 137/504] 8257905: Make fixpath.sh more liberal in accepting paths embedded in arguments Reviewed-by: erikj --- make/scripts/fixpath.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/scripts/fixpath.sh b/make/scripts/fixpath.sh index dfee8c7c56249..7cae7183551c4 100644 --- a/make/scripts/fixpath.sh +++ b/make/scripts/fixpath.sh @@ -293,7 +293,7 @@ function convert_path() { winpath="" # Start looking for drive prefix. Also allow /xxxx prefixes (typically options # for Visual Studio tools), and embedded file:// URIs. - if [[ $arg =~ ^([^/]*|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then + if [[ $arg =~ ^([^/]*|-[^:=]*[:=]|.*file://|/[a-zA-Z:]{1,3}:?)($DRIVEPREFIX/)([a-z])(/[^/]+.*$) ]] ; then prefix="${BASH_REMATCH[1]}" winpath="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}" # Change slash to backslash (or vice versa if mixed mode) @@ -302,7 +302,7 @@ function convert_path() { else winpath="${winpath//'\'/'/'}" fi - elif [[ $arg =~ ^([^/]*|(.*file://))(/([-_.a-zA-Z0-9]+)(/[-_.a-zA-Z0-9]+)+)(.*)?$ ]] ; then + elif [[ $arg =~ ^([^/]*|-[^:=]*[:=]|(.*file://))(/([-_.+a-zA-Z0-9]+)(/[-_.+a-zA-Z0-9]+)+)(.*)?$ ]] ; then # This looks like a unix path, like /foo/bar. Also embedded file:// URIs. prefix="${BASH_REMATCH[1]}" pathmatch="${BASH_REMATCH[3]}" From 1a9ed92d6f660c573f619617fcd1b1d0fbc22db6 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Tue, 8 Dec 2020 18:01:04 +0000 Subject: [PATCH 138/504] 8200102: NativeLibraryTest.java fails intermittently, unloaded count is not same as expected Reviewed-by: mchung, naoto --- .../nativeLibrary/NativeLibraryTest.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java b/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java index 893c61510201b..e235f81bece84 100644 --- a/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java +++ b/test/jdk/java/lang/ClassLoader/nativeLibrary/NativeLibraryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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,8 @@ * keeps its value across a GC and the check in Test.java fails. * @requires !vm.musl * @summary verify if the native library is unloaded when the class loader is GC'ed + * @library /test/lib/ + * @build jdk.test.lib.util.ForceGC * @build p.Test * @run main/othervm/native -Xcheck:jni NativeLibraryTest */ @@ -41,6 +43,8 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.util.ForceGC; + public class NativeLibraryTest { static final Path CLASSES = Paths.get("classes"); static int unloadedCount = 0; @@ -58,13 +62,12 @@ public static void main(String... args) throws Exception { for (int count=1; count <= 5; count++) { // create a class loader and load a native library runTest(); - // unloading the class loader and native library - System.gc(); - // give Cleaner thread a chance to unload the native library - Thread.sleep(100); - - // unloadedCount is incremented when the native library is unloaded - if (count != unloadedCount) { + // Unload the class loader and native library, and give the Cleaner + // thread a chance to unload the native library. + // unloadedCount is incremented when the native library is unloaded. + ForceGC gc = new ForceGC(); + final int finalCount = count; + if (!gc.await(() -> finalCount == unloadedCount)) { throw new RuntimeException("Expected unloaded=" + count + " but got=" + unloadedCount); } From f48d5d1b7ee01cff172f8049c7fa1e878f04631d Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 8 Dec 2020 18:45:38 +0000 Subject: [PATCH 139/504] 8257789: Fix incremental build of test-image and bundles Reviewed-by: tbell, ihse --- make/TestImage.gmk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/make/TestImage.gmk b/make/TestImage.gmk index 36ba5ba400744..26d10f95d3bc0 100644 --- a/make/TestImage.gmk +++ b/make/TestImage.gmk @@ -38,12 +38,17 @@ $(BUILD_INFO_PROPERTIES): $(ECHO) "build.workspace.root=$(call FixPath, $(WORKSPACE_ROOT))" >> $@ $(ECHO) "build.output.root=$(call FixPath, $(OUTPUTDIR))" >> $@ -prepare-test-image: $(BUILD_INFO_PROPERTIES) - $(call MakeDir, $(TEST_IMAGE_DIR)) - $(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image' +README := $(TEST_IMAGE_DIR)/Readme.txt + +$(README): + $(call MakeTargetDir) + $(ECHO) > $@ 'JDK test image' + +TARGETS += $(BUILD_INFO_PROPERTIES) $(README) ################################################################################ +prepare-test-image: $(TARGETS) all: prepare-test-image .PHONY: default all prepare-test-image From 291ba97fab29bdd1e423aff8e660d9d6311d7c89 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Tue, 8 Dec 2020 20:00:10 +0000 Subject: [PATCH 140/504] 8251267: CDS tests should use CDSTestUtils.getOutputDir instead of System.getProperty("user.dir") Reviewed-by: minqi, iklam --- test/hotspot/jtreg/runtime/cds/appcds/DirClasspathTest.java | 3 ++- test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java | 2 +- test/hotspot/jtreg/runtime/cds/appcds/RelativePath.java | 5 +++-- test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java | 4 ++-- .../hotspot/jtreg/runtime/cds/appcds/UnusedCPDuringDump.java | 5 +++-- .../cds/appcds/cacheObject/ArchivedIntegerCacheTest.java | 5 +++-- .../cds/appcds/cacheObject/ArchivedModuleComboTest.java | 5 +++-- .../cds/appcds/dynamicArchive/DynamicLotsOfClasses.java | 3 ++- .../runtime/cds/appcds/dynamicArchive/MainModuleOnly.java | 3 ++- .../cds/appcds/dynamicArchive/UnsupportedBaseArchive.java | 3 ++- .../cds/appcds/dynamicArchive/UnusedCPDuringDump.java | 3 ++- .../cds/appcds/javaldr/GCSharedStringsDuringDump.java | 3 ++- .../jtreg/runtime/cds/appcds/jigsaw/NewModuleFinderTest.java | 2 +- .../runtime/cds/appcds/jigsaw/modulepath/AddModules.java | 5 +++-- .../jtreg/runtime/cds/appcds/jigsaw/modulepath/AddOpens.java | 5 +++-- .../jtreg/runtime/cds/appcds/jigsaw/modulepath/AddReads.java | 5 +++-- .../runtime/cds/appcds/jigsaw/modulepath/ExportModule.java | 5 +++-- .../runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java | 5 +++-- .../runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java | 3 ++- .../cds/appcds/jigsaw/modulepath/ModulePathAndCP.java | 5 +++-- .../appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java | 3 ++- .../cds/appcds/sharedStrings/SharedStringsHumongous.java | 3 ++- .../cds/appcds/sharedStrings/SharedStringsStress.java | 5 +++-- test/lib/jdk/test/lib/cds/CDSTestUtils.java | 4 ++++ 24 files changed, 59 insertions(+), 35 deletions(-) diff --git a/test/hotspot/jtreg/runtime/cds/appcds/DirClasspathTest.java b/test/hotspot/jtreg/runtime/cds/appcds/DirClasspathTest.java index a6ed18760a07a..b70ffb9698b0e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/DirClasspathTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/DirClasspathTest.java @@ -33,6 +33,7 @@ */ import jdk.test.lib.Platform; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import java.io.File; import java.nio.file.Files; @@ -52,7 +53,7 @@ static OutputAnalyzer doDump(String path, String classList[], } public static void main(String[] args) throws Exception { - File dir = new File(System.getProperty("user.dir")); + File dir = CDSTestUtils.getOutputDirAsFile(); File emptydir = new File(dir, "emptydir"); emptydir.mkdir(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java b/test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java index 7cfd5b7107c41..fc4ac4ee9be9b 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java @@ -47,7 +47,7 @@ public class MoveJDKTest { public static void main(String[] args) throws Exception { String java_home_src = System.getProperty("java.home"); - String java_home_dst = System.getProperty("user.dir") + File.separator + "moved_jdk"; + String java_home_dst = CDSTestUtils.getOutputDir() + File.separator + "moved_jdk"; TestCommon.startNewArchiveName(); String jsaFile = TestCommon.getCurrentArchiveName(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/RelativePath.java b/test/hotspot/jtreg/runtime/cds/appcds/RelativePath.java index d4f0786dda855..272b02b994c7f 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/RelativePath.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/RelativePath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ -39,11 +39,12 @@ import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import java.util.Arrays; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.Platform; public class RelativePath { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); public static void main(String[] args) throws Exception { String appJar = JarBuilder.getOrCreateHelloJar(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java index ec1ca50fabd6e..d3b52e915a46c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java @@ -68,7 +68,7 @@ * prefix + opts + suffix */ public class TestCommon extends CDSTestUtils { - private static final String JSA_FILE_PREFIX = System.getProperty("user.dir") + + private static final String JSA_FILE_PREFIX = CDSTestUtils.getOutputDir() + File.separator; private static final SimpleDateFormat timeStampFormat = @@ -115,7 +115,7 @@ public static String getNewArchiveName(String stem) { // to the file; in such cases the File.delete() operation will silently fail, w/o // throwing an exception, thus allowing testing to continue. public static void deletePriorArchives() { - File dir = new File(System.getProperty("user.dir")); + File dir = CDSTestUtils.getOutputDirAsFile(); String files[] = dir.list(); for (String name : files) { if (name.startsWith("appcds-") && name.endsWith(".jsa")) { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/UnusedCPDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/UnusedCPDuringDump.java index cf58b285abcf7..853dd6e7f12c7 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/UnusedCPDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/UnusedCPDuringDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -35,12 +35,13 @@ */ import java.io.File; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class UnusedCPDuringDump { public static void main(String[] args) throws Exception { - File dir = new File(System.getProperty("user.dir")); + File dir = CDSTestUtils.getOutputDirAsFile(); File emptydir = new File(dir, "emptydir"); emptydir.mkdir(); String appJar = JarBuilder.getOrCreateHelloJar(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java index 1f130e7e05017..e13ead4563fe1 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,6 +37,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class ArchivedIntegerCacheTest { @@ -46,7 +47,7 @@ public static void main(String[] args) throws Exception { String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar; String appJar = ClassFileInstaller.getJarPath("boxCache.jar"); - Path userDir = Paths.get(System.getProperty("user.dir")); + Path userDir = Paths.get(CDSTestUtils.getOutputDir()); Path moduleDir = Files.createTempDirectory(userDir, "mods"); // diff --git a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleComboTest.java b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleComboTest.java index 128d7212f7429..d95a08b791a8c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleComboTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedModuleComboTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,6 +40,7 @@ import java.nio.file.Paths; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.cds.CDSTestUtils; import sun.hotspot.WhiteBox; public class ArchivedModuleComboTest { @@ -48,7 +49,7 @@ public static void main(String[] args) throws Exception { String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar; String appJar = ClassFileInstaller.getJarPath("app.jar"); - Path userDir = Paths.get(System.getProperty("user.dir")); + Path userDir = Paths.get(CDSTestUtils.getOutputDir()); Path moduleDir = Files.createTempDirectory(userDir, "mods"); // diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java index ce2a214ddea40..81c00bb054af5 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java @@ -29,6 +29,7 @@ import java.nio.file.Paths; import java.util.List; import java.util.ArrayList; +import jdk.test.lib.cds.CDSTestUtils; /* * @test @@ -58,7 +59,7 @@ private static void doTest(String topArchiveName) throws Exception { ArrayList list = new ArrayList<>(); TestCommon.findAllClasses(list); - String classList = System.getProperty("user.dir") + File.separator + + String classList = CDSTestUtils.getOutputDir() + File.separator + "LotsOfClasses.list"; List lines = list; Path file = Paths.get(classList); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java index abf285c050358..1f7361333c84c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java @@ -40,13 +40,14 @@ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; +import jdk.test.lib.cds.CDSTestUtils; import jtreg.SkippedException; import sun.hotspot.code.Compiler; public class MainModuleOnly extends DynamicArchiveTestBase { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String FS = File.separator; private static final String TEST_SRC = System.getProperty("test.src") + diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnsupportedBaseArchive.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnsupportedBaseArchive.java index dfb2e562a9db2..35c68b0291292 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnsupportedBaseArchive.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnsupportedBaseArchive.java @@ -26,6 +26,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; /* * @test @@ -39,7 +40,7 @@ */ public class UnsupportedBaseArchive extends DynamicArchiveTestBase { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String FS = File.separator; private static final String TEST_SRC = System.getProperty("test.src") + diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnusedCPDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnusedCPDuringDump.java index 42396767230e7..da79d62a4d893 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnusedCPDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UnusedCPDuringDump.java @@ -36,6 +36,7 @@ */ import java.io.File; +import jdk.test.lib.cds.CDSTestUtils; public class UnusedCPDuringDump extends DynamicArchiveTestBase { @@ -49,7 +50,7 @@ static void testDefaultBase() throws Exception { } private static void doTest(String topArchiveName) throws Exception { - File dir = new File(System.getProperty("user.dir")); + File dir = CDSTestUtils.getOutputDirAsFile(); File emptydir = new File(dir, "emptydir"); emptydir.mkdir(); String appJar = JarBuilder.getOrCreateHelloJar(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java index 465f5d196fd6c..36604a4d7aa76 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java @@ -39,6 +39,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import jdk.test.lib.cds.CDSOptions; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -63,7 +64,7 @@ public static void main(String[] args) throws Throwable { "-Xlog:gc*=info,gc+region=trace,gc+alloc+region=debug" : "-showversion"; String sharedArchiveCfgFile = - System.getProperty("user.dir") + File.separator + "GCSharedStringDuringDump_gen.txt"; + CDSTestUtils.getOutputDir() + File.separator + "GCSharedStringDuringDump_gen.txt"; try (FileOutputStream fos = new FileOutputStream(sharedArchiveCfgFile)) { PrintWriter out = new PrintWriter(new OutputStreamWriter(fos)); out.println("VERSION: 1.0"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/NewModuleFinderTest.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/NewModuleFinderTest.java index 7f2a3edb3fa6e..49b79ac48f531 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/NewModuleFinderTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/NewModuleFinderTest.java @@ -43,7 +43,7 @@ public class NewModuleFinderTest { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); private static final Path SRC_DIR = Paths.get(TEST_SRC, "modulepath/src"); private static final Path MODS_DIR = Paths.get("mods"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddModules.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddModules.java index 6981445ddfcf2..bd569732ed5db 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddModules.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,11 +36,12 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class AddModules { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddOpens.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddOpens.java index 94423cbaab9e5..fbb9b723a902e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddOpens.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddOpens.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -35,11 +35,12 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class AddOpens { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddReads.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddReads.java index d4753571eeb82..8c5f3f087a4f8 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddReads.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/AddReads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -35,12 +35,13 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Asserts; public class AddReads { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java index b1b76b2fa3ebd..de8219224b991 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -35,13 +35,14 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.compiler.CompilerUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Asserts; public class ExportModule { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java index 79076013e04a4..53087aa86c788 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/JvmtiAddPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,6 +37,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; @@ -50,7 +51,7 @@ public class JvmtiAddPath { "[class,load] ExtraClass source: file:" }; - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java index cf207b8095501..c193f30888541 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java @@ -38,6 +38,7 @@ import java.nio.file.Paths; import java.util.Arrays; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.cds.CDSTestUtils.Result; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; @@ -47,7 +48,7 @@ public class MainModuleOnly { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP.java index a148030f8a482..6c44ad587e397 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,11 +36,12 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class ModulePathAndCP { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java index f16982c7b1e21..189559a46618d 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java @@ -37,11 +37,12 @@ import java.nio.file.Path; import java.nio.file.Paths; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; public class OptimizeModuleHandlingTest { - private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + private static final Path USER_DIR = Paths.get(CDSTestUtils.getOutputDir()); private static final String TEST_SRC = System.getProperty("test.src"); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsHumongous.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsHumongous.java index c05ffc172537d..bf6a84e4fed1e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsHumongous.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsHumongous.java @@ -39,12 +39,13 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import sun.hotspot.WhiteBox; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Asserts; public class SharedStringsHumongous { - static String sharedArchiveConfigFile = System.getProperty("user.dir") + File.separator + "SharedStringsHumongous_gen.txt"; + static String sharedArchiveConfigFile = CDSTestUtils.getOutputDir() + File.separator + "SharedStringsHumongous_gen.txt"; public static void main(String[] args) throws Exception { WhiteBox wb = WhiteBox.getWhiteBox(); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsStress.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsStress.java index d375bc0bb6f6f..13a0bc34f50f4 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsStress.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/SharedStringsStress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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,11 +34,12 @@ import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; +import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; public class SharedStringsStress { - static String sharedArchiveConfigFile = System.getProperty("user.dir") + File.separator + "SharedStringsStress_gen.txt"; + static String sharedArchiveConfigFile = CDSTestUtils.getOutputDir() + File.separator + "SharedStringsStress_gen.txt"; public static void main(String[] args) throws Exception { try (FileOutputStream fos = new FileOutputStream(sharedArchiveConfigFile)) { diff --git a/test/lib/jdk/test/lib/cds/CDSTestUtils.java b/test/lib/jdk/test/lib/cds/CDSTestUtils.java index cfa6bbddfccac..aa3a13e7172c6 100644 --- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java +++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java @@ -494,6 +494,10 @@ public static String getOutputDir() { return outputDir; } + public static File getOutputDirAsFile() { + return outputDirAsFile; + } + // get the file object for the test artifact public static File getTestArtifact(String name, boolean checkExistence) { File file = new File(outputDirAsFile, name); From c47ab5f6b72bd3ad6ab22f5461b4f24d4e816773 Mon Sep 17 00:00:00 2001 From: Marius Volkhart Date: Tue, 8 Dec 2020 20:43:42 +0000 Subject: [PATCH 141/504] 8256515: javax.xml.XMLEventReader produces incorrect START_DOCUMENT event Reviewed-by: joehw --- .../stream/events/StartDocumentEvent.java | 8 ++--- .../stream/events/XMLEventAllocatorImpl.java | 4 +-- .../XMLEventReaderTest/EventReaderTest.java | 29 +++++++++++++++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java index 50950f6410aaa..32dfd3902fc28 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -102,9 +102,9 @@ public String getVersion() { return fVersion; } - public void setStandalone(boolean flag) { - fStandaloneSet = true; - fStandalone = flag; + public void setStandalone(boolean isStandalone, boolean standaloneSet) { + fStandaloneSet = standaloneSet; + fStandalone = isStandalone; } public void setStandalone(String s) { diff --git a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java index 5311cf20ee870..a1e920af0236a 100644 --- a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java +++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -131,7 +131,7 @@ XMLEvent getXMLEvent(XMLStreamReader streamReader) { } else { sdEvent.setDeclaredEncoding(false); } - sdEvent.setStandalone(streamReader.isStandalone()); + sdEvent.setStandalone(streamReader.isStandalone(), streamReader.standaloneSet()); sdEvent.setLocation(streamReader.getLocation()); event = sdEvent; break; diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/EventReaderTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/EventReaderTest.java index ccee3232bb08c..af1ac9770858d 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/EventReaderTest.java +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/EventReaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,12 +28,18 @@ import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.StartDocument; + +import org.testng.annotations.DataProvider; import org.testng.annotations.Listeners; import org.testng.annotations.Test; +import static org.testng.Assert.assertEquals; + /* * @test - * @bug 8204329 + * @bug 8204329 8256515 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng stream.XMLEventReaderTest.EventReaderTest * @summary Tests XMLEventReader @@ -51,4 +57,23 @@ public void testNextEvent() throws Exception { // no more event eventReader.nextEvent(); } + + @DataProvider + Object[][] standaloneSetTestData() { + return new Object[][]{ + {"", false, false}, + {"", false, true}, + {"", true, true} + }; + } + + @Test(dataProvider = "standaloneSetTestData") + void testStandaloneSet(String xml, boolean standalone, boolean standaloneSet) throws XMLStreamException { + XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLEventReader reader = factory.createXMLEventReader(new StringReader(xml)); + StartDocument startDocumentEvent = (StartDocument) reader.nextEvent(); + + assertEquals(startDocumentEvent.isStandalone(), standalone); + assertEquals(startDocumentEvent.standaloneSet(), standaloneSet); + } } From ed4c4ee73b5bc7f08495268a7e8e7bce3f265747 Mon Sep 17 00:00:00 2001 From: Mark Reinhold Date: Tue, 8 Dec 2020 22:12:24 +0000 Subject: [PATCH 142/504] 8256299: Implement JEP 396: Strongly Encapsulate JDK Internals by Default Co-authored-by: Alan Bateman Reviewed-by: mchung, alanb --- src/hotspot/share/runtime/arguments.cpp | 1 + .../internal/module/ArchivedBootLayer.java | 16 +-- .../internal/module/ArchivedModuleGraph.java | 28 +---- .../jdk/internal/module/ModuleBootstrap.java | 101 +++++++----------- .../illegalaccess/IllegalAccessTest.java | 81 +++++++------- 5 files changed, 89 insertions(+), 138 deletions(-) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 680951b5b94ea..68e0ef34b2ebf 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -2461,6 +2461,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m return res; } } else if (match_option(option, "--illegal-access=", &tail)) { + warning("Option --illegal-access is deprecated and will be removed in a future release."); if (!create_module_property("jdk.module.illegalAccess", tail, ExternalProperty)) { return JNI_ENOMEM; } diff --git a/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java b/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java index decf27e8cb7ce..5c806f81dcd71 100644 --- a/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java +++ b/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java @@ -27,35 +27,27 @@ import jdk.internal.misc.CDS; /** - * Used by ModuleBootstrap for archiving the boot layer and the builder needed to - * set the IllegalAccessLogger. + * Used by ModuleBootstrap for archiving the boot layer. */ class ArchivedBootLayer { private static ArchivedBootLayer archivedBootLayer; private final ModuleLayer bootLayer; - private final IllegalAccessLogger.Builder builder; - private ArchivedBootLayer(ModuleLayer bootLayer, - IllegalAccessLogger.Builder builder) { + private ArchivedBootLayer(ModuleLayer bootLayer) { this.bootLayer = bootLayer; - this.builder = builder; } ModuleLayer bootLayer() { return bootLayer; } - IllegalAccessLogger.Builder illegalAccessLoggerBuilder() { - return builder; - } - static ArchivedBootLayer get() { return archivedBootLayer; } - static void archive(ModuleLayer layer, IllegalAccessLogger.Builder builder) { - archivedBootLayer = new ArchivedBootLayer(layer, builder); + static void archive(ModuleLayer layer) { + archivedBootLayer = new ArchivedBootLayer(layer); } static { diff --git a/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java b/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java index 4d9f5eb7f62f5..d3e5dff08c261 100644 --- a/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java +++ b/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java @@ -24,8 +24,6 @@ */ package jdk.internal.module; -import java.util.Map; -import java.util.Set; import java.util.function.Function; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; @@ -33,7 +31,7 @@ /** * Used by ModuleBootstrap for archiving the configuration for the boot layer, - * the system module finder, and the maps used to create the IllegalAccessLogger. + * and the system module finder. */ class ArchivedModuleGraph { private static ArchivedModuleGraph archivedModuleGraph; @@ -43,23 +41,17 @@ class ArchivedModuleGraph { private final ModuleFinder finder; private final Configuration configuration; private final Function classLoaderFunction; - private final Map> concealedPackagesToOpen; - private final Map> exportedPackagesToOpen; private ArchivedModuleGraph(boolean hasSplitPackages, boolean hasIncubatorModules, ModuleFinder finder, Configuration configuration, - Function classLoaderFunction, - Map> concealedPackagesToOpen, - Map> exportedPackagesToOpen) { + Function classLoaderFunction) { this.hasSplitPackages = hasSplitPackages; this.hasIncubatorModules = hasIncubatorModules; this.finder = finder; this.configuration = configuration; this.classLoaderFunction = classLoaderFunction; - this.concealedPackagesToOpen = concealedPackagesToOpen; - this.exportedPackagesToOpen = exportedPackagesToOpen; } ModuleFinder finder() { @@ -74,14 +66,6 @@ Function classLoaderFunction() { return classLoaderFunction; } - Map> concealedPackagesToOpen() { - return concealedPackagesToOpen; - } - - Map> exportedPackagesToOpen() { - return exportedPackagesToOpen; - } - boolean hasSplitPackages() { return hasSplitPackages; } @@ -110,16 +94,12 @@ static void archive(boolean hasSplitPackages, boolean hasIncubatorModules, ModuleFinder finder, Configuration configuration, - Function classLoaderFunction, - Map> concealedPackagesToOpen, - Map> exportedPackagesToOpen) { + Function classLoaderFunction) { archivedModuleGraph = new ArchivedModuleGraph(hasSplitPackages, hasIncubatorModules, finder, configuration, - classLoaderFunction, - concealedPackagesToOpen, - exportedPackagesToOpen); + classLoaderFunction); } static { diff --git a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java index 9d999a80e9bcd..013dec4297639 100644 --- a/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java +++ b/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java @@ -141,14 +141,14 @@ public static ModuleFinder limitedFinder() { private static boolean canUseArchivedBootLayer() { return getProperty("jdk.module.upgrade.path") == null && getProperty("jdk.module.path") == null && - getProperty("jdk.module.patch.0") == null && // --patch-module - getProperty("jdk.module.main") == null && - getProperty("jdk.module.addmods.0") == null && // --add-modules - getProperty("jdk.module.limitmods") == null && + getProperty("jdk.module.patch.0") == null && // --patch-module + getProperty("jdk.module.main") == null && // --module + getProperty("jdk.module.addmods.0") == null && // --add-modules + getProperty("jdk.module.limitmods") == null && // --limit-modules getProperty("jdk.module.addreads.0") == null && // --add-reads getProperty("jdk.module.addexports.0") == null && // --add-exports getProperty("jdk.module.addopens.0") == null && // --add-opens - getProperty("jdk.module.illegalAccess") == null; + getProperty("jdk.module.illegalAccess") == null; // --illegal-access } /** @@ -172,12 +172,6 @@ public static ModuleLayer boot() { // assume boot layer has at least one module providing a service // that is mapped to the application class loader. JLA.bindToLoader(bootLayer, ClassLoaders.appClassLoader()); - - // IllegalAccessLogger needs to be set - var illegalAccessLoggerBuilder = archivedBootLayer.illegalAccessLoggerBuilder(); - if (illegalAccessLoggerBuilder != null) { - illegalAccessLoggerBuilder.complete(); - } } else { bootLayer = boot2(); } @@ -192,10 +186,10 @@ private static ModuleLayer boot2() { ModuleFinder upgradeModulePath = finderFor("jdk.module.upgrade.path"); ModuleFinder appModulePath = finderFor("jdk.module.path"); boolean isPatched = patcher.hasPatches(); - String mainModule = System.getProperty("jdk.module.main"); Set addModules = addModules(); Set limitModules = limitModules(); + String illegalAccess = getAndRemoveProperty("jdk.module.illegalAccess"); PrintStream traceOutput = null; String trace = getAndRemoveProperty("jdk.module.showModuleResolution"); @@ -227,7 +221,8 @@ private static ModuleLayer boot2() { && !haveModulePath && addModules.isEmpty() && limitModules.isEmpty() - && !isPatched) { + && !isPatched + && illegalAccess == null) { systemModuleFinder = archivedModuleGraph.finder(); hasSplitPackages = archivedModuleGraph.hasSplitPackages(); hasIncubatorModules = archivedModuleGraph.hasIncubatorModules(); @@ -464,21 +459,15 @@ private static ModuleLayer boot2() { addExtraReads(bootLayer); boolean extraExportsOrOpens = addExtraExportsAndOpens(bootLayer); - Map> concealedPackagesToOpen; - Map> exportedPackagesToOpen; - if (archivedModuleGraph != null) { - concealedPackagesToOpen = archivedModuleGraph.concealedPackagesToOpen(); - exportedPackagesToOpen = archivedModuleGraph.exportedPackagesToOpen(); - } else { - concealedPackagesToOpen = systemModules.concealedPackagesToOpen(); - exportedPackagesToOpen = systemModules.exportedPackagesToOpen(); - } - IllegalAccessLogger.Builder builder = - addIllegalAccess(upgradeModulePath, - concealedPackagesToOpen, - exportedPackagesToOpen, + if (illegalAccess != null) { + assert systemModules != null; + addIllegalAccess(illegalAccess, + systemModules, + upgradeModulePath, bootLayer, extraExportsOrOpens); + } + Counters.add("jdk.module.boot.7.adjustModulesTime"); // save module finders for later use @@ -495,12 +484,9 @@ private static ModuleLayer boot2() { hasIncubatorModules, systemModuleFinder, cf, - clf, - concealedPackagesToOpen, - exportedPackagesToOpen); - + clf); if (!hasSplitPackages && !hasIncubatorModules) { - ArchivedBootLayer.archive(bootLayer, builder); + ArchivedBootLayer.archive(bootLayer); } } @@ -794,38 +780,32 @@ private static void addExtraExportsOrOpens(ModuleLayer bootLayer, } /** - * Process the --illegal-access option (and its default) to open packages - * of system modules in the boot layer to code in unnamed modules. + * Process the --illegal-access option to open packages of system modules + * in the boot layer to code in unnamed modules. */ - private static IllegalAccessLogger.Builder - addIllegalAccess(ModuleFinder upgradeModulePath, - Map> concealedPackagesToOpen, - Map> exportedPackagesToOpen, - ModuleLayer bootLayer, - boolean extraExportsOrOpens) { - String value = getAndRemoveProperty("jdk.module.illegalAccess"); - IllegalAccessLogger.Mode mode = IllegalAccessLogger.Mode.ONESHOT; - if (value != null) { - switch (value) { - case "deny": - return null; - case "permit": - break; - case "warn": - mode = IllegalAccessLogger.Mode.WARN; - break; - case "debug": - mode = IllegalAccessLogger.Mode.DEBUG; - break; - default: - fail("Value specified to --illegal-access not recognized:" - + " '" + value + "'"); - return null; + private static void addIllegalAccess(String illegalAccess, + SystemModules systemModules, + ModuleFinder upgradeModulePath, + ModuleLayer bootLayer, + boolean extraExportsOrOpens) { + + if (illegalAccess.equals("deny")) + return; // nothing to do + + IllegalAccessLogger.Mode mode = switch (illegalAccess) { + case "permit" -> IllegalAccessLogger.Mode.ONESHOT; + case "warn" -> IllegalAccessLogger.Mode.WARN; + case "debug" -> IllegalAccessLogger.Mode.DEBUG; + default -> { + fail("Value specified to --illegal-access not recognized:" + + " '" + illegalAccess + "'"); + yield null; } - } - IllegalAccessLogger.Builder builder - = new IllegalAccessLogger.Builder(mode, System.err); + }; + var builder = new IllegalAccessLogger.Builder(mode, System.err); + Map> concealedPackagesToOpen = systemModules.concealedPackagesToOpen(); + Map> exportedPackagesToOpen = systemModules.exportedPackagesToOpen(); if (concealedPackagesToOpen.isEmpty() && exportedPackagesToOpen.isEmpty()) { // need to generate (exploded build) IllegalAccessMaps maps = IllegalAccessMaps.generate(limitedFinder()); @@ -887,7 +867,6 @@ private static void addExtraExportsOrOpens(ModuleLayer bootLayer, } builder.complete(); - return builder; } /** diff --git a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java index 37f021e135422..f8be58257518e 100644 --- a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java +++ b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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 @@ -239,15 +239,15 @@ void run(Path jarFile, String action, Result expectedResult, String... vmopts) } @Test(dataProvider = "denyCases") - public void testDeny(String action, Result expectedResult) throws Exception { - run(action, expectedResult, "--illegal-access=deny"); - } - - @Test(dataProvider = "permitCases") public void testDefault(String action, Result expectedResult) throws Exception { run(action, expectedResult); } + @Test(dataProvider = "denyCases") + public void testDeny(String action, Result expectedResult) throws Exception { + run(action, expectedResult, "--illegal-access=deny"); + } + @Test(dataProvider = "permitCases") public void testPermit(String action, Result expectedResult) throws Exception { run(action, expectedResult, "--illegal-access=permit"); @@ -267,41 +267,42 @@ public void testDebug(String action, Result expectedResult) throws Exception { run(action, expectedResult, "--illegal-access=debug"); } - /** * Specify --add-exports to export a package */ public void testWithAddExportsOption() throws Exception { - // warning - run("reflectPublicMemberNonExportedPackage", successWithWarning()); + // not accessible + run("reflectPublicMemberNonExportedPackage", fail("IllegalAccessException")); - // no warning due to --add-exports + // should succeed with --add-exports run("reflectPublicMemberNonExportedPackage", successNoWarning(), "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED"); - // attempt two illegal accesses, one allowed by --add-exports - run("reflectPublicMemberNonExportedPackage" - + ",setAccessibleNonPublicMemberExportedPackage", - successWithWarning(), - "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED"); + // not accessible + run("setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException")); + + // should fail as --add-exports does not open package + run("setAccessibleNonPublicMemberNonExportedPackage", fail("InaccessibleObjectException"), + "--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED"); } /** * Specify --add-open to open a package */ public void testWithAddOpensOption() throws Exception { - // warning - run("setAccessibleNonPublicMemberExportedPackage", successWithWarning()); + // not accessible + run("reflectPublicMemberNonExportedPackage", fail("IllegalAccessException")); + + // should succeed with --add-opens + run("reflectPublicMemberNonExportedPackage", successNoWarning(), + "--add-opens", "java.base/sun.security.x509=ALL-UNNAMED"); + + // not accessible + run("setAccessibleNonPublicMemberExportedPackage", fail("InaccessibleObjectException")); - // no warning due to --add-opens + // should succeed with --add-opens run("setAccessibleNonPublicMemberExportedPackage", successNoWarning(), "--add-opens", "java.base/java.lang=ALL-UNNAMED"); - - // attempt two illegal accesses, one allowed by --add-opens - run("reflectPublicMemberNonExportedPackage" - + ",setAccessibleNonPublicMemberExportedPackage", - successWithWarning(), - "--add-opens", "java.base/java.lang=ALL-UNNAMED"); } /** @@ -373,19 +374,20 @@ public void testWithAddExportsInManifest() throws Exception { Attributes attrs = man.getMainAttributes(); attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); attrs.put(Attributes.Name.MAIN_CLASS, "TryAccess"); - attrs.put(new Attributes.Name("Add-Exports"), "java.base/sun.security.x509"); + attrs.put(new Attributes.Name("Add-Exports"), + "java.base/sun.security.x509 java.base/sun.nio.ch"); Path jarfile = Paths.get("x.jar"); Path classes = Paths.get(TEST_CLASSES); JarUtils.createJarFile(jarfile, man, classes, Paths.get("TryAccess.class")); run(jarfile, "reflectPublicMemberNonExportedPackage", successNoWarning()); - run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successWithWarning()); + run(jarfile, "reflectPublicMemberNonExportedPackage", successNoWarning(), + "--illegal-access=permit"); - // attempt two illegal accesses, one allowed by Add-Exports - run(jarfile, "reflectPublicMemberNonExportedPackage," - + "setAccessibleNonPublicMemberExportedPackage", - successWithWarning()); + // should fail as Add-Exports does not open package + run(jarfile, "setAccessibleNonPublicMemberNonExportedPackage", + fail("InaccessibleObjectException")); } /** @@ -403,29 +405,26 @@ public void testWithAddOpensInManifest() throws Exception { run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successNoWarning()); - run(jarfile, "reflectPublicMemberNonExportedPackage", successWithWarning()); - - // attempt two illegal accesses, one allowed by Add-Opens - run(jarfile, "reflectPublicMemberNonExportedPackage," - + "setAccessibleNonPublicMemberExportedPackage", - successWithWarning()); + run(jarfile, "setAccessibleNonPublicMemberExportedPackage", successNoWarning(), + "--illegal-access=permit"); } /** - * Test that default behavior is to print a warning on the first illegal - * access only. + * Test that --illegal-access=permit behavior is to print a warning on the + * first illegal access only. */ public void testWarnOnFirstIllegalAccess() throws Exception { String action1 = "reflectPublicMemberNonExportedPackage"; String action2 = "setAccessibleNonPublicMemberExportedPackage"; - int warningCount = count(run(action1).asLines(), "WARNING"); + int warningCount = count(run(action1, "--illegal-access=permit").asLines(), "WARNING"); + assertTrue(warningCount > 0); // multi line warning // same illegal access - List output1 = run(action1 + "," + action1).asLines(); + List output1 = run(action1 + "," + action1, "--illegal-access=permit").asLines(); assertTrue(count(output1, "WARNING") == warningCount); // different illegal access - List output2 = run(action1 + "," + action2).asLines(); + List output2 = run(action1 + "," + action2, "--illegal-access=permit").asLines(); assertTrue(count(output2, "WARNING") == warningCount); } From 48d8650ae187821d0e79f7353c2f039518e313b1 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 8 Dec 2020 23:04:01 +0000 Subject: [PATCH 143/504] 8257845: Integrate JEP 390 8254047: [JEP 390] Revise "value-based class" & apply to wrappers 8252181: [JEP 390] Define & apply annotation jdk.internal.ValueBased 8252183: [JEP 390] Add 'lint' warning for @ValueBased classes 8257027: [JEP 390] Diagnose synchronization on @ValueBased classes 8252180: [JEP 390] Deprecate wrapper class constructors for removal Co-authored-by: Roger Riggs Co-authored-by: Srikanth Adayapalam Co-authored-by: Lois Foltan Reviewed-by: rriggs, hseigel, mchung, darcy --- src/hotspot/cpu/aarch64/aarch64.ad | 4 +- .../cpu/aarch64/c1_MacroAssembler_aarch64.cpp | 4 +- .../cpu/aarch64/interp_masm_aarch64.cpp | 4 +- src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp | 4 +- src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp | 4 +- src/hotspot/cpu/arm/interp_masm_arm.cpp | 4 +- src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp | 4 +- src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp | 4 +- src/hotspot/cpu/ppc/macroAssembler_ppc.cpp | 4 +- .../cpu/s390/c1_MacroAssembler_s390.cpp | 4 +- src/hotspot/cpu/s390/interp_masm_s390.cpp | 4 +- src/hotspot/cpu/s390/macroAssembler_s390.cpp | 6 +- src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp | 4 +- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 4 +- src/hotspot/cpu/x86/interp_masm_x86.cpp | 4 +- .../share/classfile/classFileParser.cpp | 17 +++++- .../share/classfile/systemDictionary.cpp | 8 --- src/hotspot/share/classfile/vmSymbols.hpp | 1 + src/hotspot/share/jfr/metadata/metadata.xml | 4 +- src/hotspot/share/logging/logTag.hpp | 2 +- src/hotspot/share/oops/instanceKlass.cpp | 6 ++ src/hotspot/share/oops/klass.hpp | 19 +++++- src/hotspot/share/runtime/arguments.cpp | 6 +- src/hotspot/share/runtime/globals.hpp | 6 +- src/hotspot/share/runtime/synchronizer.cpp | 40 ++++++------ src/hotspot/share/runtime/synchronizer.hpp | 2 +- src/hotspot/share/utilities/accessFlags.hpp | 6 +- .../share/classes/java/lang/Boolean.java | 15 +++-- .../share/classes/java/lang/Byte.java | 11 +++- .../share/classes/java/lang/Character.java | 9 ++- .../share/classes/java/lang/Double.java | 11 +++- .../share/classes/java/lang/Float.java | 13 +++- .../share/classes/java/lang/Integer.java | 11 +++- .../share/classes/java/lang/Long.java | 11 +++- .../classes/java/lang/ProcessHandle.java | 13 ++-- .../classes/java/lang/ProcessHandleImpl.java | 1 + .../share/classes/java/lang/Runtime.java | 11 ++-- .../share/classes/java/lang/Short.java | 11 +++- .../java/lang/constant/ConstantDesc.java | 4 +- .../lang/constant/DynamicCallSiteDesc.java | 4 +- .../lang/constant/DynamicConstantDesc.java | 4 +- .../java/lang/doc-files/ValueBased.html | 61 +++++++++++-------- .../classes/java/lang/invoke/MemberName.java | 2 +- .../share/classes/java/time/Duration.java | 9 +-- .../share/classes/java/time/Instant.java | 9 +-- .../share/classes/java/time/LocalDate.java | 9 +-- .../classes/java/time/LocalDateTime.java | 9 +-- .../share/classes/java/time/LocalTime.java | 9 +-- .../share/classes/java/time/MonthDay.java | 9 +-- .../classes/java/time/OffsetDateTime.java | 9 +-- .../share/classes/java/time/OffsetTime.java | 9 +-- .../share/classes/java/time/Period.java | 9 +-- .../share/classes/java/time/Year.java | 9 +-- .../share/classes/java/time/YearMonth.java | 9 +-- .../share/classes/java/time/ZoneId.java | 9 +-- .../share/classes/java/time/ZoneOffset.java | 9 +-- .../classes/java/time/ZonedDateTime.java | 9 +-- .../classes/java/time/chrono/HijrahDate.java | 9 +-- .../java/time/chrono/JapaneseDate.java | 13 ++-- .../classes/java/time/chrono/MinguoDate.java | 9 +-- .../time/chrono/ThaiBuddhistChronology.java | 1 - .../java/time/chrono/ThaiBuddhistDate.java | 9 +-- .../classes/java/time/format/TextStyle.java | 2 +- .../java/util/ImmutableCollections.java | 10 +++ .../classes/java/util/KeyValueHolder.java | 10 +-- .../share/classes/java/util/List.java | 10 +-- .../share/classes/java/util/Map.java | 20 +++--- .../share/classes/java/util/Optional.java | 10 +-- .../classes/java/util/OptionalDouble.java | 10 +-- .../share/classes/java/util/OptionalInt.java | 10 +-- .../share/classes/java/util/OptionalLong.java | 10 +-- .../share/classes/java/util/Set.java | 10 +-- .../classes/jdk/internal/ValueBased.java | 44 +++++++++++++ .../remote/rmi/RMIConnectionImpl_Stub.java | 5 +- .../impl/xs/traversers/XSDHandler.java | 5 +- .../xml/internal/serialize/HTMLdtd.java | 4 +- .../com/sun/tools/javac/code/Lint.java | 6 ++ .../com/sun/tools/javac/code/Symtab.java | 2 + .../com/sun/tools/javac/comp/Attr.java | 15 +++++ .../tools/javac/resources/compiler.properties | 4 ++ .../tools/javac/resources/javac.properties | 7 ++- .../jdk/incubator/foreign/GroupLayout.java | 8 +-- .../jdk/incubator/foreign/MemoryAddress.java | 6 +- .../jdk/incubator/foreign/MemoryLayout.java | 6 +- .../jdk/incubator/foreign/MemorySegment.java | 6 +- .../jdk/incubator/foreign/PaddingLayout.java | 7 ++- .../jdk/incubator/foreign/SequenceLayout.java | 7 ++- .../jdk/incubator/foreign/ValueLayout.java | 7 ++- .../collections/test/EconomicMapImplTest.java | 2 +- .../collections/test/EconomicSetTest.java | 2 +- .../core/test/ea/EscapeAnalysisTest.java | 8 +-- .../core/test/ea/PEAAssertionsTest.java | 26 ++++---- .../test/ea/PartialEscapeAnalysisTest.java | 2 +- .../test/tutorial/StaticAnalysisTests.java | 4 +- .../hotspot/GraalHotSpotVMConfigAccess.java | 2 +- .../compiler/jtt/hotpath/HP_allocate02.java | 2 +- .../replacements/test/MonitorTest.java | 1 + src/jdk.jfr/share/conf/jfr/default.jfc | 2 +- src/jdk.jfr/share/conf/jfr/profile.jfc | 2 +- ...st.java => SyncOnValueBasedClassTest.java} | 20 +++--- .../metadata/TestLookForUntestedEvents.java | 2 +- ...va => TestSyncOnValueBasedClassEvent.java} | 12 ++-- test/langtools/jdk/jshell/ImportTest.java | 2 +- .../AttemptToSynchronizeOnInstanceOfVbc.java | 32 ++++++++++ .../tools/javac/lambda/8074381/T8074381a.java | 4 +- .../tools/javac/lint/ExternalAbuseOfVbc.java | 23 +++++++ .../tools/javac/lint/ExternalAbuseOfVbc.out | 4 ++ .../javac/lint/JdkInternalAbuseOfVbc.java | 22 +++++++ .../javac/lint/JdkInternalAbuseOfVbc.out | 6 ++ .../javac/lint/LintModeOffAbuseOfVbc.out | 0 test/langtools/tools/javac/lint/SomeVbc.java | 54 ++++++++++++++++ test/lib/jdk/test/lib/hexdump/HexPrinter.java | 7 ++- test/lib/jdk/test/lib/jfr/EventNames.java | 2 +- 113 files changed, 695 insertions(+), 327 deletions(-) create mode 100644 src/java.base/share/classes/jdk/internal/ValueBased.java rename test/hotspot/jtreg/runtime/Monitor/{SyncOnPrimitiveWrapperTest.java => SyncOnValueBasedClassTest.java} (91%) rename test/jdk/jdk/jfr/event/runtime/{TestSyncOnPrimitiveWrapperEvent.java => TestSyncOnValueBasedClassEvent.java} (86%) create mode 100644 test/langtools/tools/javac/diags/examples/AttemptToSynchronizeOnInstanceOfVbc.java create mode 100644 test/langtools/tools/javac/lint/ExternalAbuseOfVbc.java create mode 100644 test/langtools/tools/javac/lint/ExternalAbuseOfVbc.out create mode 100644 test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.java create mode 100644 test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.out create mode 100644 test/langtools/tools/javac/lint/LintModeOffAbuseOfVbc.out create mode 100644 test/langtools/tools/javac/lint/SomeVbc.java diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index d89363099d318..fcd0ce096f90a 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -3893,10 +3893,10 @@ encode %{ // Load markWord from object into displaced_header. __ ldr(disp_hdr, Address(oop, oopDesc::mark_offset_in_bytes())); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { __ load_klass(tmp, oop); __ ldrw(tmp, Address(tmp, Klass::access_flags_offset())); - __ tstw(tmp, JVM_ACC_IS_BOX_CLASS); + __ tstw(tmp, JVM_ACC_IS_VALUE_BASED_CLASS); __ br(Assembler::NE, cont); } diff --git a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp index 42d1c5ee3591f..48759ca7122c8 100644 --- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp @@ -75,10 +75,10 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr null_check_offset = offset(); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(hdr, obj); ldrw(hdr, Address(hdr, Klass::access_flags_offset())); - tstw(hdr, JVM_ACC_IS_BOX_CLASS); + tstw(hdr, JVM_ACC_IS_VALUE_BASED_CLASS); br(Assembler::NE, slow_case); } diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 30a315b20a660..94c379a89e821 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -746,10 +746,10 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) // Load object pointer into obj_reg %c_rarg3 ldr(obj_reg, Address(lock_reg, obj_offset)); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(tmp, obj_reg); ldrw(tmp, Address(tmp, Klass::access_flags_offset())); - tstw(tmp, JVM_ACC_IS_BOX_CLASS); + tstw(tmp, JVM_ACC_IS_VALUE_BASED_CLASS); br(Assembler::NE, slow_case); } diff --git a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp index 7304e3ad15ff5..9d5c82dceb9f1 100644 --- a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp @@ -204,10 +204,10 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, null_check_offset = offset(); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(tmp1, obj); ldr_u32(tmp1, Address(tmp1, Klass::access_flags_offset())); - tst(tmp1, JVM_ACC_IS_BOX_CLASS); + tst(tmp1, JVM_ACC_IS_VALUE_BASED_CLASS); b(slow_case, ne); } diff --git a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp index 0b14d9ebb14a3..2211d5c5fa338 100644 --- a/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c2_MacroAssembler_arm.cpp @@ -90,10 +90,10 @@ void C2_MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratc Label fast_lock, done; - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(Rscratch, Roop); ldr_u32(Rscratch, Address(Rscratch, Klass::access_flags_offset())); - tst(Rscratch, JVM_ACC_IS_BOX_CLASS); + tst(Rscratch, JVM_ACC_IS_VALUE_BASED_CLASS); b(done, ne); } diff --git a/src/hotspot/cpu/arm/interp_masm_arm.cpp b/src/hotspot/cpu/arm/interp_masm_arm.cpp index 01ff3a5d39c98..f754b36a27fd6 100644 --- a/src/hotspot/cpu/arm/interp_masm_arm.cpp +++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp @@ -883,10 +883,10 @@ void InterpreterMacroAssembler::lock_object(Register Rlock) { // Load object pointer ldr(Robj, Address(Rlock, obj_offset)); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(R0, Robj); ldr_u32(R0, Address(R0, Klass::access_flags_offset())); - tst(R0, JVM_ACC_IS_BOX_CLASS); + tst(R0, JVM_ACC_IS_VALUE_BASED_CLASS); b(slow_case, ne); } diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp index 4d1dc267fac75..1dd18861dea95 100644 --- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp @@ -105,10 +105,10 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox // Save object being locked into the BasicObjectLock... std(Roop, BasicObjectLock::obj_offset_in_bytes(), Rbox); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(Rscratch, Roop); lwz(Rscratch, in_bytes(Klass::access_flags_offset()), Rscratch); - testbitdi(CCR0, R0, Rscratch, exact_log2(JVM_ACC_IS_BOX_CLASS)); + testbitdi(CCR0, R0, Rscratch, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS)); bne(CCR0, slow_int); } diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index b59eb97d4471c..6427392469a32 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -910,10 +910,10 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) { // Load markWord from object into displaced_header. ld(displaced_header, oopDesc::mark_offset_in_bytes(), object); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(tmp, object); lwz(tmp, in_bytes(Klass::access_flags_offset()), tmp); - testbitdi(CCR0, R0, tmp, exact_log2(JVM_ACC_IS_BOX_CLASS)); + testbitdi(CCR0, R0, tmp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS)); bne(CCR0, slow_case); } diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index 72b10dff4aa95..5dfb5d6b47156 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -2818,10 +2818,10 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register // Load markWord from object into displaced_header. ld(displaced_header, oopDesc::mark_offset_in_bytes(), oop); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(temp, oop); lwz(temp, in_bytes(Klass::access_flags_offset()), temp); - testbitdi(flag, R0, temp, exact_log2(JVM_ACC_IS_BOX_CLASS)); + testbitdi(flag, R0, temp, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS)); bne(flag, cont); } diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp index 16e7c8997b493..6c040e0bbcbac 100644 --- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp @@ -91,9 +91,9 @@ void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hd // Save object being locked into the BasicObjectLock... z_stg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes())); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(Z_R1_scratch, obj); - testbit(Address(Z_R1_scratch, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_BOX_CLASS)); + testbit(Address(Z_R1_scratch, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS)); z_btrue(slow_case); } diff --git a/src/hotspot/cpu/s390/interp_masm_s390.cpp b/src/hotspot/cpu/s390/interp_masm_s390.cpp index 275d86051bbfa..5c7e959937cf0 100644 --- a/src/hotspot/cpu/s390/interp_masm_s390.cpp +++ b/src/hotspot/cpu/s390/interp_masm_s390.cpp @@ -999,9 +999,9 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) { // Load markWord from object into displaced_header. z_lg(displaced_header, oopDesc::mark_offset_in_bytes(), object); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(Z_R1_scratch, object); - testbit(Address(Z_R1_scratch, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_BOX_CLASS)); + testbit(Address(Z_R1_scratch, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS)); z_btrue(slow_case); } diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.cpp b/src/hotspot/cpu/s390/macroAssembler_s390.cpp index d7c95ee96ee64..9c06a20ae70d0 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp @@ -3326,11 +3326,11 @@ void MacroAssembler::compiler_fast_lock_object(Register oop, Register box, Regis // Load markWord from oop into mark. z_lg(displacedHeader, 0, oop); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(Z_R1_scratch, oop); z_l(Z_R1_scratch, Address(Z_R1_scratch, Klass::access_flags_offset())); - assert((JVM_ACC_IS_BOX_CLASS & 0xFFFF) == 0, "or change following instruction"); - z_nilh(Z_R1_scratch, JVM_ACC_IS_BOX_CLASS >> 16); + assert((JVM_ACC_IS_VALUE_BASED_CLASS & 0xFFFF) == 0, "or change following instruction"); + z_nilh(Z_R1_scratch, JVM_ACC_IS_VALUE_BASED_CLASS >> 16); z_brne(done); } diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp index 0ca3ac105fc01..687a33b253e39 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp @@ -54,10 +54,10 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr null_check_offset = offset(); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(hdr, obj, rklass_decode_tmp); movl(hdr, Address(hdr, Klass::access_flags_offset())); - testl(hdr, JVM_ACC_IS_BOX_CLASS); + testl(hdr, JVM_ACC_IS_VALUE_BASED_CLASS); jcc(Assembler::notZero, slow_case); } diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index f5f712ee8e7c0..c975b4f3b1389 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -485,10 +485,10 @@ void C2_MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmp Label IsInflated, DONE_LABEL; - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(tmpReg, objReg, cx1Reg); movl(tmpReg, Address(tmpReg, Klass::access_flags_offset())); - testl(tmpReg, JVM_ACC_IS_BOX_CLASS); + testl(tmpReg, JVM_ACC_IS_VALUE_BASED_CLASS); jcc(Assembler::notZero, DONE_LABEL); } diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index b6d7bf8185628..19c7f49b7881c 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -1219,10 +1219,10 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) { // Load object pointer into obj_reg movptr(obj_reg, Address(lock_reg, obj_offset)); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { + if (DiagnoseSyncOnValueBasedClasses != 0) { load_klass(tmp_reg, obj_reg, rklass_decode_tmp); movl(tmp_reg, Address(tmp_reg, Klass::access_flags_offset())); - testl(tmp_reg, JVM_ACC_IS_BOX_CLASS); + testl(tmp_reg, JVM_ACC_IS_VALUE_BASED_CLASS); jcc(Assembler::notZero, slow_case); } diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 124cee2ca8a54..9130018b3e390 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -1091,6 +1091,7 @@ class AnnotationCollector : public ResourceObj{ _jdk_internal_vm_annotation_Contended, _field_Stable, _jdk_internal_vm_annotation_ReservedStackAccess, + _jdk_internal_ValueBased, _annotation_LIMIT }; const Location _location; @@ -2147,6 +2148,11 @@ AnnotationCollector::annotation_index(const ClassLoaderData* loader_data, if (RestrictReservedStack && !privileged) break; // honor privileges return _jdk_internal_vm_annotation_ReservedStackAccess; } + case VM_SYMBOL_ENUM_NAME(jdk_internal_ValueBased_signature): { + if (_location != _in_class) break; // only allow for classes + if (!privileged) break; // only allow in priviledged code + return _jdk_internal_ValueBased; + } default: { break; } @@ -2190,7 +2196,16 @@ void MethodAnnotationCollector::apply_to(const methodHandle& m) { void ClassFileParser::ClassAnnotationCollector::apply_to(InstanceKlass* ik) { assert(ik != NULL, "invariant"); - ik->set_is_contended(is_contended()); + if (has_annotation(_jdk_internal_vm_annotation_Contended)) { + ik->set_is_contended(is_contended()); + } + if (has_annotation(_jdk_internal_ValueBased)) { + ik->set_has_value_based_class_annotation(); + if (DiagnoseSyncOnValueBasedClasses) { + ik->set_is_value_based(); + ik->set_prototype_header(markWord::prototype()); + } + } } #define MAX_ARGS_SIZE 255 diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index ab346f7af09ba..9d7f63eb0ea4e 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -2142,14 +2142,6 @@ void SystemDictionary::resolve_well_known_classes(TRAPS) { //_box_klasses[T_OBJECT] = WK_KLASS(object_klass); //_box_klasses[T_ARRAY] = WK_KLASS(object_klass); - if (DiagnoseSyncOnPrimitiveWrappers != 0) { - for (int i = T_BOOLEAN; i < T_LONG + 1; i++) { - assert(_box_klasses[i] != NULL, "NULL box class"); - _box_klasses[i]->set_is_box(); - _box_klasses[i]->set_prototype_header(markWord::prototype()); - } - } - #ifdef ASSERT if (UseSharedSpaces) { JVMTI_ONLY(assert(JvmtiExport::is_early_phase(), diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index de399d809cc4e..495c30cfa6002 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.hpp @@ -249,6 +249,7 @@ template(java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl, "java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl") \ template(jdk_internal_vm_annotation_Contended_signature, "Ljdk/internal/vm/annotation/Contended;") \ template(jdk_internal_vm_annotation_ReservedStackAccess_signature, "Ljdk/internal/vm/annotation/ReservedStackAccess;") \ + template(jdk_internal_ValueBased_signature, "Ljdk/internal/ValueBased;") \ \ /* class symbols needed by intrinsics */ \ VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, template, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \ diff --git a/src/hotspot/share/jfr/metadata/metadata.xml b/src/hotspot/share/jfr/metadata/metadata.xml index 43d980b4e8ac1..d4484f7db364a 100644 --- a/src/hotspot/share/jfr/metadata/metadata.xml +++ b/src/hotspot/share/jfr/metadata/metadata.xml @@ -66,8 +66,8 @@ - - + + has_class_mirror_holder(); } - bool is_box() const { return access_flags().is_box_class(); } - void set_is_box() { _access_flags.set_is_box_class(); } + bool is_value_based() { return _access_flags.is_value_based_class(); } + void set_is_value_based() { _access_flags.set_is_value_based_class(); } bool is_cloneable() const; void set_is_cloneable(); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 68e0ef34b2ebf..732923b51ac53 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -4139,9 +4139,9 @@ jint Arguments::apply_ergo() { } #endif // COMPILER2 - if (FLAG_IS_CMDLINE(DiagnoseSyncOnPrimitiveWrappers)) { - if (DiagnoseSyncOnPrimitiveWrappers == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, primitivewrappers)) { - LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(primitivewrappers)); + if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) { + if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) { + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(valuebasedclasses)); } } return JNI_OK; diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 2814742768093..7efabe34eeb76 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -851,13 +851,13 @@ const intx ObjectAlignmentInBytes = 8; range(500, max_intx) \ constraint(BiasedLockingDecayTimeFunc,AfterErgo) \ \ - product(intx, DiagnoseSyncOnPrimitiveWrappers, 0, DIAGNOSTIC, \ + product(intx, DiagnoseSyncOnValueBasedClasses, 0, DIAGNOSTIC, \ "Detect and take action upon identifying synchronization on " \ - "primitive wrappers. Modes: " \ + "value based classes. Modes: " \ "0: off; " \ "1: exit with fatal error; " \ "2: log message to stdout. Output file can be specified with " \ - " -Xlog:primitivewrappers. If JFR is running it will " \ + " -Xlog:valuebasedclasses. If JFR is running it will " \ " also generate JFR events.") \ range(0, 2) \ \ diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index 17a7ba4f11795..1fd6930d96c3b 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -333,7 +333,7 @@ bool ObjectSynchronizer::quick_enter(oop obj, Thread* self, NoSafepointVerifier nsv; if (obj == NULL) return false; // Need to throw NPE - if (DiagnoseSyncOnPrimitiveWrappers != 0 && obj->klass()->is_box()) { + if (obj->klass()->is_value_based()) { return false; } @@ -387,17 +387,23 @@ bool ObjectSynchronizer::quick_enter(oop obj, Thread* self, return false; // revert to slow-path } -// Handle notifications when synchronizing on primitive wrappers -void ObjectSynchronizer::handle_sync_on_primitive_wrapper(Handle obj, Thread* current) { +// Handle notifications when synchronizing on value based classes +void ObjectSynchronizer::handle_sync_on_value_based_class(Handle obj, Thread* current) { JavaThread* self = current->as_Java_thread(); frame last_frame = self->last_frame(); - if (last_frame.is_interpreted_frame()) { + bool bcp_was_adjusted = false; + // Don't decrement bcp if it points to the frame's first instruction. This happens when + // handle_sync_on_value_based_class() is called because of a synchronized method. There + // is no actual monitorenter instruction in the byte code in this case. + if (last_frame.is_interpreted_frame() && + (last_frame.interpreter_frame_method()->code_base() < last_frame.interpreter_frame_bcp())) { // adjust bcp to point back to monitorenter so that we print the correct line numbers last_frame.interpreter_frame_set_bcp(last_frame.interpreter_frame_bcp() - 1); + bcp_was_adjusted = true; } - if (DiagnoseSyncOnPrimitiveWrappers == FATAL_EXIT) { + if (DiagnoseSyncOnValueBasedClasses == FATAL_EXIT) { ResourceMark rm(self); stringStream ss; self->print_stack_on(&ss); @@ -408,26 +414,26 @@ void ObjectSynchronizer::handle_sync_on_primitive_wrapper(Handle obj, Thread* cu } fatal("Synchronizing on object " INTPTR_FORMAT " of klass %s %s", p2i(obj()), obj->klass()->external_name(), base); } else { - assert(DiagnoseSyncOnPrimitiveWrappers == LOG_WARNING, "invalid value for DiagnoseSyncOnPrimitiveWrappers"); + assert(DiagnoseSyncOnValueBasedClasses == LOG_WARNING, "invalid value for DiagnoseSyncOnValueBasedClasses"); ResourceMark rm(self); - Log(primitivewrappers) pwlog; + Log(valuebasedclasses) vblog; - pwlog.info("Synchronizing on object " INTPTR_FORMAT " of klass %s", p2i(obj()), obj->klass()->external_name()); + vblog.info("Synchronizing on object " INTPTR_FORMAT " of klass %s", p2i(obj()), obj->klass()->external_name()); if (self->has_last_Java_frame()) { - LogStream info_stream(pwlog.info()); + LogStream info_stream(vblog.info()); self->print_stack_on(&info_stream); } else { - pwlog.info("Cannot find the last Java frame"); + vblog.info("Cannot find the last Java frame"); } - EventSyncOnPrimitiveWrapper event; + EventSyncOnValueBasedClass event; if (event.should_commit()) { - event.set_boxClass(obj->klass()); + event.set_valueBasedClass(obj->klass()); event.commit(); } } - if (last_frame.is_interpreted_frame()) { + if (bcp_was_adjusted) { last_frame.interpreter_frame_set_bcp(last_frame.interpreter_frame_bcp() + 1); } } @@ -439,8 +445,8 @@ void ObjectSynchronizer::handle_sync_on_primitive_wrapper(Handle obj, Thread* cu // changed. The implementation is extremely sensitive to race condition. Be careful. void ObjectSynchronizer::enter(Handle obj, BasicLock* lock, TRAPS) { - if (DiagnoseSyncOnPrimitiveWrappers != 0 && obj->klass()->is_box()) { - handle_sync_on_primitive_wrapper(obj, THREAD); + if (obj->klass()->is_value_based()) { + handle_sync_on_value_based_class(obj, THREAD); } if (UseBiasedLocking) { @@ -586,8 +592,8 @@ void ObjectSynchronizer::reenter(Handle obj, intx recursions, TRAPS) { // JNI locks on java objects // NOTE: must use heavy weight monitor to handle jni monitor enter void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { - if (DiagnoseSyncOnPrimitiveWrappers != 0 && obj->klass()->is_box()) { - handle_sync_on_primitive_wrapper(obj, THREAD); + if (obj->klass()->is_value_based()) { + handle_sync_on_value_based_class(obj, THREAD); } // the current locking is from JNI instead of Java code diff --git a/src/hotspot/share/runtime/synchronizer.hpp b/src/hotspot/share/runtime/synchronizer.hpp index 16657c60e6fbc..35fe8def72a7a 100644 --- a/src/hotspot/share/runtime/synchronizer.hpp +++ b/src/hotspot/share/runtime/synchronizer.hpp @@ -161,7 +161,7 @@ class ObjectSynchronizer : AllStatic { static size_t get_gvars_size(); static u_char* get_gvars_stw_random_addr(); - static void handle_sync_on_primitive_wrapper(Handle obj, Thread* current); + static void handle_sync_on_value_based_class(Handle obj, Thread* current); }; // ObjectLocker enforces balanced locking and can never throw an diff --git a/src/hotspot/share/utilities/accessFlags.hpp b/src/hotspot/share/utilities/accessFlags.hpp index 9fe8f7acf3e95..ab2f6a640afcd 100644 --- a/src/hotspot/share/utilities/accessFlags.hpp +++ b/src/hotspot/share/utilities/accessFlags.hpp @@ -67,7 +67,7 @@ enum { JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method JVM_ACC_IS_SHARED_CLASS = 0x02000000, // True if klass is shared JVM_ACC_IS_HIDDEN_CLASS = 0x04000000, // True if klass is hidden - JVM_ACC_IS_BOX_CLASS = 0x08000000, // True if klass is primitive wrapper + JVM_ACC_IS_VALUE_BASED_CLASS = 0x08000000, // True if klass is marked as a ValueBased class // Klass* and Method* flags JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000, @@ -152,7 +152,7 @@ class AccessFlags { bool is_cloneable_fast () const { return (_flags & JVM_ACC_IS_CLONEABLE_FAST ) != 0; } bool is_shared_class () const { return (_flags & JVM_ACC_IS_SHARED_CLASS ) != 0; } bool is_hidden_class () const { return (_flags & JVM_ACC_IS_HIDDEN_CLASS ) != 0; } - bool is_box_class () const { return (_flags & JVM_ACC_IS_BOX_CLASS ) != 0; } + bool is_value_based_class () const { return (_flags & JVM_ACC_IS_VALUE_BASED_CLASS ) != 0; } // Klass* and Method* flags bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; } @@ -226,7 +226,7 @@ class AccessFlags { void set_has_miranda_methods() { atomic_set_bits(JVM_ACC_HAS_MIRANDA_METHODS); } void set_is_shared_class() { atomic_set_bits(JVM_ACC_IS_SHARED_CLASS); } void set_is_hidden_class() { atomic_set_bits(JVM_ACC_IS_HIDDEN_CLASS); } - void set_is_box_class() { atomic_set_bits(JVM_ACC_IS_BOX_CLASS); } + void set_is_value_based_class() { atomic_set_bits(JVM_ACC_IS_VALUE_BASED_CLASS); } public: // field flags diff --git a/src/java.base/share/classes/java/lang/Boolean.java b/src/java.base/share/classes/java/lang/Boolean.java index fc76dfe460f9c..0397277e68fb7 100644 --- a/src/java.base/share/classes/java/lang/Boolean.java +++ b/src/java.base/share/classes/java/lang/Boolean.java @@ -41,16 +41,23 @@ * {@code boolean} in an object. An object of type * {@code Boolean} contains a single field whose type is * {@code boolean}. - *

        - * In addition, this class provides many methods for + * + *

        In addition, this class provides many methods for * converting a {@code boolean} to a {@code String} and a * {@code String} to a {@code boolean}, as well as other * constants and methods useful when dealing with a * {@code boolean}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Arthur van Hoff * @since 1.0 */ +@jdk.internal.ValueBased public final class Boolean implements java.io.Serializable, Comparable, Constable { @@ -98,7 +105,7 @@ public final class Boolean implements java.io.Serializable, * Also consider using the final fields {@link #TRUE} and {@link #FALSE} * if possible. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Boolean(boolean value) { this.value = value; } @@ -118,7 +125,7 @@ public Boolean(boolean value) { * {@code boolean} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Boolean} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Boolean(String s) { this(parseBoolean(s)); } diff --git a/src/java.base/share/classes/java/lang/Byte.java b/src/java.base/share/classes/java/lang/Byte.java index 9b004bfae6d92..c80a6fc9fe074 100644 --- a/src/java.base/share/classes/java/lang/Byte.java +++ b/src/java.base/share/classes/java/lang/Byte.java @@ -48,11 +48,18 @@ * byte}, as well as other constants and methods useful when dealing * with a {@code byte}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Nakul Saraiya * @author Joseph D. Darcy * @see java.lang.Number * @since 1.1 */ +@jdk.internal.ValueBased public final class Byte extends Number implements Comparable, Constable { /** @@ -337,7 +344,7 @@ public static Byte decode(String nm) throws NumberFormatException { * {@link #valueOf(byte)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Byte(byte value) { this.value = value; } @@ -360,7 +367,7 @@ public Byte(byte value) { * {@code byte} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Byte} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Byte(String s) throws NumberFormatException { this.value = parseByte(s, 10); } diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index 96238563354f8..fb2431d045bd8 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -122,6 +122,12 @@ * encoding. For more information on Unicode terminology, refer to the * Unicode Glossary. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Lee Boynton * @author Guy Steele * @author Akira Tanaka @@ -129,6 +135,7 @@ * @author Ulf Zibis * @since 1.0 */ +@jdk.internal.ValueBased public final class Character implements java.io.Serializable, Comparable, Constable { /** @@ -8501,7 +8508,7 @@ public static final UnicodeScript forName(String scriptName) { * {@link #valueOf(char)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Character(char value) { this.value = value; } diff --git a/src/java.base/share/classes/java/lang/Double.java b/src/java.base/share/classes/java/lang/Double.java index 729adcf5b0339..36e9086e1c4a1 100644 --- a/src/java.base/share/classes/java/lang/Double.java +++ b/src/java.base/share/classes/java/lang/Double.java @@ -46,11 +46,18 @@ * constants and methods useful when dealing with a * {@code double}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Lee Boynton * @author Arthur van Hoff * @author Joseph D. Darcy * @since 1.0 */ +@jdk.internal.ValueBased public final class Double extends Number implements Comparable, Constable, ConstantDesc { /** @@ -605,7 +612,7 @@ public static boolean isFinite(double d) { * {@link #valueOf(double)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Double(double value) { this.value = value; } @@ -626,7 +633,7 @@ public Double(double value) { * {@code double} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Double} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Double(String s) throws NumberFormatException { value = parseDouble(s); } diff --git a/src/java.base/share/classes/java/lang/Float.java b/src/java.base/share/classes/java/lang/Float.java index 0cebe7848acb4..478b5a27a7b1c 100644 --- a/src/java.base/share/classes/java/lang/Float.java +++ b/src/java.base/share/classes/java/lang/Float.java @@ -45,11 +45,18 @@ * constants and methods useful when dealing with a * {@code float}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Lee Boynton * @author Arthur van Hoff * @author Joseph D. Darcy * @since 1.0 */ +@jdk.internal.ValueBased public final class Float extends Number implements Comparable, Constable, ConstantDesc { /** @@ -518,7 +525,7 @@ public static boolean isFinite(float f) { * {@link #valueOf(float)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Float(float value) { this.value = value; } @@ -534,7 +541,7 @@ public Float(float value) { * static factory method {@link #valueOf(float)} method as follows: * {@code Float.valueOf((float)value)}. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Float(double value) { this.value = (float)value; } @@ -555,7 +562,7 @@ public Float(double value) { * {@code float} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Float} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Float(String s) throws NumberFormatException { value = parseFloat(s); } diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index f75be73b30702..815ae10e54050 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -50,6 +50,12 @@ * {@code int}, as well as other constants and methods useful when * dealing with an {@code int}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * *

        Implementation note: The implementations of the "bit twiddling" * methods (such as {@link #highestOneBit(int) highestOneBit} and * {@link #numberOfTrailingZeros(int) numberOfTrailingZeros}) are @@ -62,6 +68,7 @@ * @author Joseph D. Darcy * @since 1.0 */ +@jdk.internal.ValueBased public final class Integer extends Number implements Comparable, Constable, ConstantDesc { /** @@ -1085,7 +1092,7 @@ public static Integer valueOf(int i) { * {@link #valueOf(int)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Integer(int value) { this.value = value; } @@ -1107,7 +1114,7 @@ public Integer(int value) { * {@code int} primitive, or use {@link #valueOf(String)} * to convert a string to an {@code Integer} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Integer(String s) throws NumberFormatException { this.value = parseInt(s, 10); } diff --git a/src/java.base/share/classes/java/lang/Long.java b/src/java.base/share/classes/java/lang/Long.java index 15c9ee1cc3197..21323e19de6c5 100644 --- a/src/java.base/share/classes/java/lang/Long.java +++ b/src/java.base/share/classes/java/lang/Long.java @@ -50,6 +50,12 @@ * long}, as well as other constants and methods useful when dealing * with a {@code long}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * *

        Implementation note: The implementations of the "bit twiddling" * methods (such as {@link #highestOneBit(long) highestOneBit} and * {@link #numberOfTrailingZeros(long) numberOfTrailingZeros}) are @@ -62,6 +68,7 @@ * @author Joseph D. Darcy * @since 1.0 */ +@jdk.internal.ValueBased public final class Long extends Number implements Comparable, Constable, ConstantDesc { /** @@ -1316,7 +1323,7 @@ else if (nm.startsWith("0", index) && nm.length() > 1 + index) { * {@link #valueOf(long)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Long(long value) { this.value = value; } @@ -1339,7 +1346,7 @@ public Long(long value) { * {@code long} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Long} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Long(String s) throws NumberFormatException { this.value = parseLong(s, 10); } diff --git a/src/java.base/share/classes/java/lang/ProcessHandle.java b/src/java.base/share/classes/java/lang/ProcessHandle.java index 32b34d1341413..229f98d0b6f33 100644 --- a/src/java.base/share/classes/java/lang/ProcessHandle.java +++ b/src/java.base/share/classes/java/lang/ProcessHandle.java @@ -81,16 +81,17 @@ *

        * The {@code ProcessHandle} static factory methods return instances that are * value-based, - * immutable and thread-safe. - * Use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on these instances of - * {@code ProcessHandle} may have unpredictable results and should be avoided. - * Use {@link #equals(Object) equals} or - * {@link #compareTo(ProcessHandle) compareTo} methods to compare ProcessHandles. + * immutable and thread-safe. Programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may occur. + * For example, in a future release, synchronization may fail. + * Use the {@code equals} or {@link #compareTo(ProcessHandle) compareTo} methods + * to compare ProcessHandles. * * @see Process * @since 9 */ +@jdk.internal.ValueBased public interface ProcessHandle extends Comparable { /** diff --git a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java index f51720d99f588..92634d9b12093 100644 --- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java +++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java @@ -48,6 +48,7 @@ * @see Process * @since 9 */ +@jdk.internal.ValueBased final class ProcessHandleImpl implements ProcessHandle { /** * Default size of stack for reaper processes. diff --git a/src/java.base/share/classes/java/lang/Runtime.java b/src/java.base/share/classes/java/lang/Runtime.java index dae8be95ce693..2519eb88ca614 100644 --- a/src/java.base/share/classes/java/lang/Runtime.java +++ b/src/java.base/share/classes/java/lang/Runtime.java @@ -941,14 +941,15 @@ public static Version version() { * $VNUM(-$PRE)? * * - *

        This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Version} may have unpredictable results and should be avoided. - *

        + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail.

        * * @since 9 */ + @jdk.internal.ValueBased public static final class Version implements Comparable { diff --git a/src/java.base/share/classes/java/lang/Short.java b/src/java.base/share/classes/java/lang/Short.java index 4f293496579ca..00d4a91d37b5d 100644 --- a/src/java.base/share/classes/java/lang/Short.java +++ b/src/java.base/share/classes/java/lang/Short.java @@ -47,11 +47,18 @@ * {@code short}, as well as other constants and methods useful when * dealing with a {@code short}. * + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. + * * @author Nakul Saraiya * @author Joseph D. Darcy * @see java.lang.Number * @since 1.1 */ +@jdk.internal.ValueBased public final class Short extends Number implements Comparable, Constable { /** @@ -342,7 +349,7 @@ public static Short decode(String nm) throws NumberFormatException { * {@link #valueOf(short)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Short(short value) { this.value = value; } @@ -365,7 +372,7 @@ public Short(short value) { * {@code short} primitive, or use {@link #valueOf(String)} * to convert a string to a {@code Short} object. */ - @Deprecated(since="9") + @Deprecated(since="9", forRemoval = true) public Short(String s) throws NumberFormatException { this.value = parseShort(s, 10); } diff --git a/src/java.base/share/classes/java/lang/constant/ConstantDesc.java b/src/java.base/share/classes/java/lang/constant/ConstantDesc.java index 5ffb5b2aded4b..9d410e6774b71 100644 --- a/src/java.base/share/classes/java/lang/constant/ConstantDesc.java +++ b/src/java.base/share/classes/java/lang/constant/ConstantDesc.java @@ -57,8 +57,8 @@ *

        Constants describing various common constants (such as {@link ClassDesc} * instances for platform types) can be found in {@link ConstantDescs}. * - *

        Implementations of {@linkplain ConstantDesc} must be - * value-based classes. + *

        Implementations of {@linkplain ConstantDesc} should be immutable + * and their behavior should not rely on object identity. * *

        Non-platform classes should not implement {@linkplain ConstantDesc} directly. * Instead, they should extend {@link DynamicConstantDesc} (as {@link EnumDesc} diff --git a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java index f336bc5fb4ec0..b57f73c0fb9ce 100644 --- a/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java +++ b/src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java @@ -41,8 +41,8 @@ * A nominal descriptor for an * {@code invokedynamic} call site. * - *

        Concrete subtypes of {@linkplain DynamicCallSiteDesc} must be - * value-based. + *

        Concrete subtypes of {@linkplain DynamicCallSiteDesc} should be immutable + * and their behavior should not rely on object identity. * * @since 12 */ diff --git a/src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java b/src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java index 2ff7a0ebf89ba..4efd3dde3c317 100644 --- a/src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java +++ b/src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java @@ -49,8 +49,8 @@ * dynamic constant (one described in the constant pool with * {@code Constant_Dynamic_info}.) * - *

        Concrete subtypes of {@linkplain DynamicConstantDesc} must be - * value-based. + *

        Concrete subtypes of {@linkplain DynamicConstantDesc} should be immutable + * and their behavior should not rely on object identity. * * @param the type of the dynamic constant * diff --git a/src/java.base/share/classes/java/lang/doc-files/ValueBased.html b/src/java.base/share/classes/java/lang/doc-files/ValueBased.html index fe720a37be780..86d9b35955726 100644 --- a/src/java.base/share/classes/java/lang/doc-files/ValueBased.html +++ b/src/java.base/share/classes/java/lang/doc-files/ValueBased.html @@ -31,36 +31,43 @@

        {@index "Value-based Classes"}

        -Some classes, such as java.util.Optional and -java.time.LocalDateTime, are value-based. Instances of a -value-based class: +Some classes, such as java.lang.Integer and +java.time.LocalDate, are value-based. +A value-based class has the following properties:
          -
        • are final and immutable (though may contain references to mutable - objects);
        • -
        • have implementations of equals, - hashCode, and toString which are computed - solely from the instance's state and not from its identity or the state - of any other object or variable;
        • -
        • make no use of identity-sensitive operations such as reference - equality (==) between instances, identity hash code of - instances, or synchronization on an instances's intrinsic lock;
        • -
        • are considered equal solely based on equals(), not - based on reference equality (==);
        • -
        • do not have accessible constructors, but are instead instantiated - through factory methods which make no commitment as to the identity - of returned instances;
        • -
        • are freely substitutable when equal, meaning that interchanging - any two instances x and y that are equal - according to equals() in any computation or method - invocation should produce no visible change in behavior. -
        • +
        • the class declares only final instance fields (though these may contain references + to mutable objects);
        • +
        • the class's implementations of equals, hashCode, + and toString compute their results solely from the values + of the class's instance fields (and the members of the objects they + reference), not from the instance's identity;
        • +
        • the class's methods treat instances as freely substitutable + when equal, meaning that interchanging any two instances x and + y that are equal according to equals() produces no + visible change in the behavior of the class's methods;
        • +
        • the class performs no synchronization using an instance's monitor;
        • +
        • the class does not declare (or has deprecated any) accessible constructors;
        • +
        • the class does not provide any instance creation mechanism that promises + a unique identity on each method call—in particular, any factory + method's contract must allow for the possibility that if two independently-produced + instances are equal according to equals(), they may also be + equal according to ==;
        • +
        • the class is final, and extends either Object or a hierarchy of + abstract classes that declare no instance fields or instance initializers + and whose constructors are empty.
        -

        A program may produce unpredictable results if it attempts to distinguish two - references to equal values of a value-based class, whether directly via reference +

        When two instances of a value-based class are equal (according to `equals`), a program + should not attempt to distinguish between their identities, whether directly via reference equality or indirectly via an appeal to synchronization, identity hashing, - serialization, or any other identity-sensitive mechanism. Use of such - identity-sensitive operations on instances of value-based classes may have - unpredictable effects and should be avoided.

        + serialization, or any other identity-sensitive mechanism.

        + +

        Synchronization on instances of value-based classes is strongly discouraged, + because the programmer cannot guarantee exclusive ownership of the + associated monitor.

        + +

        Identity-related behavior of value-based classes may change in a future release. + For example, synchronization may fail.

        + diff --git a/src/java.base/share/classes/java/lang/invoke/MemberName.java b/src/java.base/share/classes/java/lang/invoke/MemberName.java index 019f07a788c38..c11e2837c3bf3 100644 --- a/src/java.base/share/classes/java/lang/invoke/MemberName.java +++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java @@ -773,7 +773,7 @@ public MemberName getDefinition() { } @Override - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) public int hashCode() { // Avoid autoboxing getReferenceKind(), since this is used early and will force // early initialization of Byte$ByteCache diff --git a/src/java.base/share/classes/java/time/Duration.java b/src/java.base/share/classes/java/time/Duration.java index 437a63e823cae..ea3a382c69de5 100644 --- a/src/java.base/share/classes/java/time/Duration.java +++ b/src/java.base/share/classes/java/time/Duration.java @@ -117,12 +117,12 @@ * This difference only impacts durations measured near a leap-second and should not affect * most applications. * See {@link Instant} for a discussion as to the meaning of the second and time-scales. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Duration} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -130,6 +130,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class Duration implements TemporalAmount, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/Instant.java b/src/java.base/share/classes/java/time/Instant.java index 80b7ea9fb2531..b129b9c90d56c 100644 --- a/src/java.base/share/classes/java/time/Instant.java +++ b/src/java.base/share/classes/java/time/Instant.java @@ -191,12 +191,12 @@ * The Java time-scale is used for all date-time classes. * This includes {@code Instant}, {@code LocalDate}, {@code LocalTime}, {@code OffsetDateTime}, * {@code ZonedDateTime} and {@code Duration}. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Instant} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -204,6 +204,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class Instant implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/LocalDate.java b/src/java.base/share/classes/java/time/LocalDate.java index be7d47d65e25e..2ed2f98544c23 100644 --- a/src/java.base/share/classes/java/time/LocalDate.java +++ b/src/java.base/share/classes/java/time/LocalDate.java @@ -123,12 +123,12 @@ * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code LocalDate} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -136,6 +136,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class LocalDate implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable { diff --git a/src/java.base/share/classes/java/time/LocalDateTime.java b/src/java.base/share/classes/java/time/LocalDateTime.java index 5838f45e7bc28..0f6022bb659f2 100644 --- a/src/java.base/share/classes/java/time/LocalDateTime.java +++ b/src/java.base/share/classes/java/time/LocalDateTime.java @@ -119,12 +119,12 @@ * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code LocalDateTime} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -132,6 +132,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class LocalDateTime implements Temporal, TemporalAdjuster, ChronoLocalDateTime, Serializable { diff --git a/src/java.base/share/classes/java/time/LocalTime.java b/src/java.base/share/classes/java/time/LocalTime.java index 4fef814b0ca75..a8602b681ca66 100644 --- a/src/java.base/share/classes/java/time/LocalTime.java +++ b/src/java.base/share/classes/java/time/LocalTime.java @@ -109,12 +109,12 @@ * The ISO-8601 calendar system is the modern civil calendar system used today * in most of the world. This API assumes that all calendar systems use the same * representation, this class, for time-of-day. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code LocalTime} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -122,6 +122,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class LocalTime implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/MonthDay.java b/src/java.base/share/classes/java/time/MonthDay.java index 1fe6140101341..e126f2dea75c8 100644 --- a/src/java.base/share/classes/java/time/MonthDay.java +++ b/src/java.base/share/classes/java/time/MonthDay.java @@ -111,12 +111,12 @@ * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code MonthDay} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -124,6 +124,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class MonthDay implements TemporalAccessor, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/OffsetDateTime.java b/src/java.base/share/classes/java/time/OffsetDateTime.java index 1d6f2c489846b..16d47f70de268 100644 --- a/src/java.base/share/classes/java/time/OffsetDateTime.java +++ b/src/java.base/share/classes/java/time/OffsetDateTime.java @@ -112,12 +112,12 @@ * It is intended that {@code ZonedDateTime} or {@code Instant} is used to model data * in simpler applications. This class may be used when modeling date-time concepts in * more detail, or when communicating to a database or in a network protocol. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code OffsetDateTime} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -125,6 +125,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class OffsetDateTime implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/OffsetTime.java b/src/java.base/share/classes/java/time/OffsetTime.java index 290a124366d00..89ea67e4442e0 100644 --- a/src/java.base/share/classes/java/time/OffsetTime.java +++ b/src/java.base/share/classes/java/time/OffsetTime.java @@ -102,12 +102,12 @@ * as well as a zone offset. * For example, the value "13:45:30.123456789+02:00" can be stored * in an {@code OffsetTime}. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code OffsetTime} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -115,6 +115,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class OffsetTime implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/Period.java b/src/java.base/share/classes/java/time/Period.java index b5e1ce5e57143..ba68c5ac9c167 100644 --- a/src/java.base/share/classes/java/time/Period.java +++ b/src/java.base/share/classes/java/time/Period.java @@ -117,12 +117,12 @@ *

        * The period is modeled as a directed amount of time, meaning that individual parts of the * period may be negative. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Period} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -130,6 +130,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class Period implements ChronoPeriod, Serializable { diff --git a/src/java.base/share/classes/java/time/Year.java b/src/java.base/share/classes/java/time/Year.java index 37fd428e7cc54..88096a3960549 100644 --- a/src/java.base/share/classes/java/time/Year.java +++ b/src/java.base/share/classes/java/time/Year.java @@ -119,12 +119,12 @@ * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Year} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -132,6 +132,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class Year implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/YearMonth.java b/src/java.base/share/classes/java/time/YearMonth.java index f65c9d9b9af67..d4874bd90a177 100644 --- a/src/java.base/share/classes/java/time/YearMonth.java +++ b/src/java.base/share/classes/java/time/YearMonth.java @@ -115,12 +115,12 @@ * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code YearMonth} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -128,6 +128,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class YearMonth implements Temporal, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/ZoneId.java b/src/java.base/share/classes/java/time/ZoneId.java index aaec5cdc1a727..cfb3e570cb74c 100644 --- a/src/java.base/share/classes/java/time/ZoneId.java +++ b/src/java.base/share/classes/java/time/ZoneId.java @@ -160,12 +160,12 @@ * However, any call to {@code getRules} will fail with {@code ZoneRulesException}. * This approach is designed to allow a {@link ZonedDateTime} to be loaded and * queried, but not modified, on a Java Runtime with incomplete time-zone information. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code ZoneId} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -175,6 +175,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public abstract class ZoneId implements Serializable { /** diff --git a/src/java.base/share/classes/java/time/ZoneOffset.java b/src/java.base/share/classes/java/time/ZoneOffset.java index 172ca768dda04..f061040b9e2ec 100644 --- a/src/java.base/share/classes/java/time/ZoneOffset.java +++ b/src/java.base/share/classes/java/time/ZoneOffset.java @@ -114,12 +114,12 @@ * Instances of {@code ZoneOffset} must be compared using {@link #equals}. * Implementations may choose to cache certain common offsets, however * applications must not rely on such caching. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code ZoneOffset} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -127,6 +127,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class ZoneOffset extends ZoneId implements TemporalAccessor, TemporalAdjuster, Comparable, Serializable { diff --git a/src/java.base/share/classes/java/time/ZonedDateTime.java b/src/java.base/share/classes/java/time/ZonedDateTime.java index a6a33c6ef69d5..e6bc1d256f024 100644 --- a/src/java.base/share/classes/java/time/ZonedDateTime.java +++ b/src/java.base/share/classes/java/time/ZonedDateTime.java @@ -142,12 +142,12 @@ * of a {@code LocalDateTime} and a {@code ZoneId}. The {@code ZoneOffset} is * a vital, but secondary, piece of information, used to ensure that the class * represents an instant, especially during a daylight savings overlap. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code ZonedDateTime} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -161,6 +161,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class ZonedDateTime implements Temporal, ChronoZonedDateTime, Serializable { diff --git a/src/java.base/share/classes/java/time/chrono/HijrahDate.java b/src/java.base/share/classes/java/time/chrono/HijrahDate.java index 97f47a2606fa2..9f0b6d7a57333 100644 --- a/src/java.base/share/classes/java/time/chrono/HijrahDate.java +++ b/src/java.base/share/classes/java/time/chrono/HijrahDate.java @@ -103,12 +103,12 @@ * to create new HijrahDate instances. * Alternatively, the {@link #withVariant} method can be used to convert * to a new HijrahChronology. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code HijrahDate} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -116,6 +116,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class HijrahDate extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { diff --git a/src/java.base/share/classes/java/time/chrono/JapaneseDate.java b/src/java.base/share/classes/java/time/chrono/JapaneseDate.java index 096bdaed3939d..8fd05d93aa998 100644 --- a/src/java.base/share/classes/java/time/chrono/JapaneseDate.java +++ b/src/java.base/share/classes/java/time/chrono/JapaneseDate.java @@ -110,12 +110,12 @@ * Calling {@code japaneseDate.get(YEAR)} will return 2012.
        * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to * {@code JapaneseChronology.ERA_HEISEI}.
        - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code JapaneseDate} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -123,6 +123,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class JapaneseDate extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { @@ -140,11 +141,11 @@ public final class JapaneseDate /** * The JapaneseEra of this date. */ - private transient JapaneseEra era; + private final transient JapaneseEra era; /** * The Japanese imperial calendar year of this date. */ - private transient int yearOfEra; + private final transient int yearOfEra; /** * The first day supported by the JapaneseChronology is Meiji 6, January 1st. diff --git a/src/java.base/share/classes/java/time/chrono/MinguoDate.java b/src/java.base/share/classes/java/time/chrono/MinguoDate.java index 2b957230172c5..6f3170177a5bc 100644 --- a/src/java.base/share/classes/java/time/chrono/MinguoDate.java +++ b/src/java.base/share/classes/java/time/chrono/MinguoDate.java @@ -90,12 +90,12 @@ * This date operates using the {@linkplain MinguoChronology Minguo calendar}. * This calendar system is primarily used in the Republic of China, often known as Taiwan. * Dates are aligned such that {@code 0001-01-01 (Minguo)} is {@code 1912-01-01 (ISO)}. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code MinguoDate} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -103,6 +103,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class MinguoDate extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { diff --git a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java index ea9218f6cd750..28e3282c4ea87 100644 --- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java +++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java @@ -72,7 +72,6 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; diff --git a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java index 58894d76346aa..865d2731abf10 100644 --- a/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java +++ b/src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java @@ -90,12 +90,12 @@ * This date operates using the {@linkplain ThaiBuddhistChronology Thai Buddhist calendar}. * This calendar system is primarily used in Thailand. * Dates are aligned such that {@code 2484-01-01 (Buddhist)} is {@code 1941-01-01 (ISO)}. - * *

        * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code ThaiBuddhistDate} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * * @implSpec @@ -103,6 +103,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class ThaiBuddhistDate extends ChronoLocalDateImpl implements ChronoLocalDate, Serializable { diff --git a/src/java.base/share/classes/java/time/format/TextStyle.java b/src/java.base/share/classes/java/time/format/TextStyle.java index 27a6f91ad6b48..ec49da271adc7 100644 --- a/src/java.base/share/classes/java/time/format/TextStyle.java +++ b/src/java.base/share/classes/java/time/format/TextStyle.java @@ -81,7 +81,7 @@ * to the word used for month in association with a day and year in a date. * * @implSpec - * This is immutable and thread-safe enum. + * This is an immutable and thread-safe enum. * * @since 1.8 */ diff --git a/src/java.base/share/classes/java/util/ImmutableCollections.java b/src/java.base/share/classes/java/util/ImmutableCollections.java index 4c651250f2e01..52a83552f1479 100644 --- a/src/java.base/share/classes/java/util/ImmutableCollections.java +++ b/src/java.base/share/classes/java/util/ImmutableCollections.java @@ -141,6 +141,7 @@ private ImmutableCollections() { } static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); } + @jdk.internal.ValueBased static abstract class AbstractImmutableCollection extends AbstractCollection { // all mutating methods throw UnsupportedOperationException @Override public boolean add(E e) { throw uoe(); } @@ -247,6 +248,7 @@ static List listFromTrustedArrayNullsAllowed(Object... input) { // ---------- List Implementations ---------- + @jdk.internal.ValueBased static abstract class AbstractImmutableList extends AbstractImmutableCollection implements List, RandomAccess { @@ -540,6 +542,7 @@ public T[] toArray(T[] a) { } } + @jdk.internal.ValueBased static final class List12 extends AbstractImmutableList implements Serializable { @@ -646,6 +649,7 @@ public T[] toArray(T[] a) { } } + @jdk.internal.ValueBased static final class ListN extends AbstractImmutableList implements Serializable { @@ -737,6 +741,7 @@ public int lastIndexOf(Object o) { // ---------- Set Implementations ---------- + @jdk.internal.ValueBased static abstract class AbstractImmutableSet extends AbstractImmutableCollection implements Set { @@ -764,6 +769,7 @@ public boolean equals(Object o) { public abstract int hashCode(); } + @jdk.internal.ValueBased static final class Set12 extends AbstractImmutableSet implements Serializable { @@ -889,6 +895,7 @@ public T[] toArray(T[] a) { * least one null is always present. * @param the element type */ + @jdk.internal.ValueBased static final class SetN extends AbstractImmutableSet implements Serializable { @@ -1055,6 +1062,7 @@ public T[] toArray(T[] a) { // ---------- Map Implementations ---------- + @jdk.internal.ValueBased abstract static class AbstractImmutableMap extends AbstractMap implements Serializable { @Override public void clear() { throw uoe(); } @Override public V compute(K key, BiFunction rf) { throw uoe(); } @@ -1085,6 +1093,7 @@ public V getOrDefault(Object key, V defaultValue) { } } + @jdk.internal.ValueBased static final class Map1 extends AbstractImmutableMap { @Stable private final K k0; @@ -1151,6 +1160,7 @@ public int hashCode() { * @param the key type * @param the value type */ + @jdk.internal.ValueBased static final class MapN extends AbstractImmutableMap { @Stable diff --git a/src/java.base/share/classes/java/util/KeyValueHolder.java b/src/java.base/share/classes/java/util/KeyValueHolder.java index 3b7250ee6aa9e..2333257f59b3d 100644 --- a/src/java.base/share/classes/java/util/KeyValueHolder.java +++ b/src/java.base/share/classes/java/util/KeyValueHolder.java @@ -31,10 +31,11 @@ * An immutable container for a key and a value, suitable for use * in creating and populating {@code Map} instances. * - *

        This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code KeyValueHolder} may have unpredictable results and should be avoided. + *

        This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * * @apiNote * This class is not public. Instances can be created using the @@ -49,6 +50,7 @@ * @see Map#ofEntries Map.ofEntries() * @since 9 */ +@jdk.internal.ValueBased final class KeyValueHolder implements Map.Entry { @Stable final K key; diff --git a/src/java.base/share/classes/java/util/List.java b/src/java.base/share/classes/java/util/List.java index 314fb6af6c156..285aa8b536d4c 100644 --- a/src/java.base/share/classes/java/util/List.java +++ b/src/java.base/share/classes/java/util/List.java @@ -107,10 +107,12 @@ *

      • The lists and their {@link #subList(int, int) subList} views implement the * {@link RandomAccess} interface. *
      • They are value-based. - * Callers should make no assumptions about the identity of the returned instances. - * Factories are free to create new instances or reuse existing ones. Therefore, - * identity-sensitive operations on these instances (reference equality ({@code ==}), - * identity hash code, and synchronization) are unreliable and should be avoided. + * Programmers should treat instances that are {@linkplain #equals(Object) equal} + * as interchangeable and should not use them for synchronization, or + * unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. Callers should make no assumptions about the + * identity of the returned instances. Factories are free to + * create new instances or reuse existing ones. *
      • They are serialized as specified on the * Serialized Form * page. diff --git a/src/java.base/share/classes/java/util/Map.java b/src/java.base/share/classes/java/util/Map.java index b1de34b42a560..e1ec0e4282f80 100644 --- a/src/java.base/share/classes/java/util/Map.java +++ b/src/java.base/share/classes/java/util/Map.java @@ -131,10 +131,12 @@ * passed to a static factory method result in {@code IllegalArgumentException}. *
      • The iteration order of mappings is unspecified and is subject to change. *
      • They are value-based. - * Callers should make no assumptions about the identity of the returned instances. - * Factories are free to create new instances or reuse existing ones. Therefore, - * identity-sensitive operations on these instances (reference equality ({@code ==}), - * identity hash code, and synchronization) are unreliable and should be avoided. + * Programmers should treat instances that are {@linkplain #equals(Object) equal} + * as interchangeable and should not use them for synchronization, or + * unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. Callers should make no assumptions + * about the identity of the returned instances. Factories are free to + * create new instances or reuse existing ones. *
      • They are serialized as specified on the * Serialized Form * page. @@ -1636,10 +1638,12 @@ static Map ofEntries(Entry... entries) { * on a returned {@code Entry} result in {@code UnsupportedOperationException}. *
      • They are not serializable. *
      • They are value-based. - * Callers should make no assumptions about the identity of the returned instances. - * This method is free to create new instances or reuse existing ones. Therefore, - * identity-sensitive operations on these instances (reference equality ({@code ==}), - * identity hash code, and synchronization) are unreliable and should be avoided. + * Programmers should treat instances that are {@linkplain #equals(Object) equal} + * as interchangeable and should not use them for synchronization, or + * unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. Callers should make no assumptions + * about the identity of the returned instances. This method is free to + * create new instances or reuse existing ones. *
      * * @apiNote diff --git a/src/java.base/share/classes/java/util/Optional.java b/src/java.base/share/classes/java/util/Optional.java index af8ea6d1f98bf..efb5bac4dce85 100644 --- a/src/java.base/share/classes/java/util/Optional.java +++ b/src/java.base/share/classes/java/util/Optional.java @@ -42,10 +42,11 @@ * {@link #ifPresent(Consumer) ifPresent()} (performs an * action if a value is present). * - *

      This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code Optional} may have unpredictable results and should be avoided. + *

      This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * * @apiNote * {@code Optional} is primarily intended for use as a method return type where @@ -57,6 +58,7 @@ * @param the type of value * @since 1.8 */ +@jdk.internal.ValueBased public final class Optional { /** * Common instance for {@code empty()}. diff --git a/src/java.base/share/classes/java/util/OptionalDouble.java b/src/java.base/share/classes/java/util/OptionalDouble.java index 7c8ed649cbeea..4e645c1aa7999 100644 --- a/src/java.base/share/classes/java/util/OptionalDouble.java +++ b/src/java.base/share/classes/java/util/OptionalDouble.java @@ -41,10 +41,11 @@ * {@link #ifPresent(DoubleConsumer) ifPresent()} (performs * an action if a value is present). * - *

      This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code OptionalDouble} may have unpredictable results and should be avoided. + *

      This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * * @apiNote * {@code OptionalDouble} is primarily intended for use as a method return type where @@ -54,6 +55,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class OptionalDouble { /** * Common instance for {@code empty()}. diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java index aa8a669d0105c..457273ca4ecf8 100644 --- a/src/java.base/share/classes/java/util/OptionalInt.java +++ b/src/java.base/share/classes/java/util/OptionalInt.java @@ -41,10 +41,11 @@ * {@link #ifPresent(IntConsumer) ifPresent()} (performs an * action if a value is present). * - *

      This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code OptionalInt} may have unpredictable results and should be avoided. + *

      This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * * @apiNote * {@code OptionalInt} is primarily intended for use as a method return type where @@ -54,6 +55,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class OptionalInt { /** * Common instance for {@code empty()}. diff --git a/src/java.base/share/classes/java/util/OptionalLong.java b/src/java.base/share/classes/java/util/OptionalLong.java index c18457358fe74..817b4b6f0580e 100644 --- a/src/java.base/share/classes/java/util/OptionalLong.java +++ b/src/java.base/share/classes/java/util/OptionalLong.java @@ -41,10 +41,11 @@ * {@link #ifPresent(LongConsumer) ifPresent()} (performs an * action if a value is present). * - *

      This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code OptionalLong} may have unpredictable results and should be avoided. + *

      This is a value-based + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * * @apiNote * {@code OptionalLong} is primarily intended for use as a method return type where @@ -54,6 +55,7 @@ * * @since 1.8 */ +@jdk.internal.ValueBased public final class OptionalLong { /** * Common instance for {@code empty()}. diff --git a/src/java.base/share/classes/java/util/Set.java b/src/java.base/share/classes/java/util/Set.java index b8109d0b4fb71..4c703008a87f6 100644 --- a/src/java.base/share/classes/java/util/Set.java +++ b/src/java.base/share/classes/java/util/Set.java @@ -82,10 +82,12 @@ * passed to a static factory method result in {@code IllegalArgumentException}. *

    11. The iteration order of set elements is unspecified and is subject to change. *
    12. They are value-based. - * Callers should make no assumptions about the identity of the returned instances. - * Factories are free to create new instances or reuse existing ones. Therefore, - * identity-sensitive operations on these instances (reference equality ({@code ==}), - * identity hash code, and synchronization) are unreliable and should be avoided. + * Programmers should treat instances that are {@linkplain #equals(Object) equal} + * as interchangeable and should not use them for synchronization, or + * unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. Callers should make no assumptions + * about the identity of the returned instances. Factories are free to + * create new instances or reuse existing ones. *
    13. They are serialized as specified on the * Serialized Form * page. diff --git a/src/java.base/share/classes/jdk/internal/ValueBased.java b/src/java.base/share/classes/jdk/internal/ValueBased.java new file mode 100644 index 0000000000000..587f159854ba3 --- /dev/null +++ b/src/java.base/share/classes/jdk/internal/ValueBased.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2020, 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 jdk.internal; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; + +/** + * Indicates the API declaration in question is associated with a Value Based class. + * References to value-based classes + * should produce warnings about behavior that is inconsistent with value based semantics. + * + * @since 16 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(value={TYPE}) +public @interface ValueBased { +} + diff --git a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.java b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.java index 05e19235e03d5..8cee1e5c5f19b 100644 --- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.java +++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectionImpl_Stub.java @@ -258,7 +258,10 @@ public javax.management.ObjectInstance createMBean(java.lang.String $param_Strin public javax.management.remote.NotificationResult fetchNotifications(long $param_long_1, int $param_int_2, long $param_long_3) throws java.io.IOException { try { - Object $result = ref.invoke(this, $method_fetchNotifications_7, new java.lang.Object[]{new java.lang.Long($param_long_1), new java.lang.Integer($param_int_2), new java.lang.Long($param_long_3)}, -5037523307973544478L); + Object $result = ref.invoke(this, $method_fetchNotifications_7, + new java.lang.Object[]{$param_long_1, + $param_int_2, + $param_long_3}, -5037523307973544478L); return ((javax.management.remote.NotificationResult) $result); } catch (java.lang.RuntimeException e) { throw e; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java index 542c2d10417fc..2faf06ea2da3c 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java @@ -4013,7 +4013,8 @@ else if (componentType.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) { ","+oldName:currSchema.fTargetNamespace+","+oldName; int attGroupRefsCount = changeRedefineGroup(processedBaseName, componentType, newName, child, currSchema); if (attGroupRefsCount > 1) { - reportSchemaError("src-redefine.7.1", new Object []{new Integer(attGroupRefsCount)}, child); + reportSchemaError("src-redefine.7.1", + new Object []{attGroupRefsCount}, child); } else if (attGroupRefsCount == 1) { // return true; @@ -4029,7 +4030,7 @@ else if (componentType.equals(SchemaSymbols.ELT_GROUP)) { ","+oldName:currSchema.fTargetNamespace+","+oldName; int groupRefsCount = changeRedefineGroup(processedBaseName, componentType, newName, child, currSchema); if (groupRefsCount > 1) { - reportSchemaError("src-redefine.6.1.1", new Object []{new Integer(groupRefsCount)}, child); + reportSchemaError("src-redefine.6.1.1", new Object []{groupRefsCount}, child); } else if (groupRefsCount == 1) { // return true; diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java index eb1f99ba8d0ed..21328ef00cd6a 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/HTMLdtd.java @@ -438,8 +438,8 @@ private static void initialize() private static void defineEntity( String name, char value ) { if ( _byName.get( name ) == null ) { - _byName.put( name, new Integer( value ) ); - _byChar.put( new Integer( value ), name ); + _byName.put( name, (int) value); + _byChar.put( (int) value , name ); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java index 2d61cf5fb0b23..6526104b67bb4 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java @@ -125,6 +125,7 @@ protected Lint(Context context) { if (!options.isSet(Option.PREVIEW)) { values.add(LintCategory.PREVIEW); } + values.add(LintCategory.SYNCHRONIZATION); } // Look for specific overrides @@ -282,6 +283,11 @@ public enum LintCategory { */ STATIC("static"), + /** + * Warn about synchronization attempts on instances of @ValueBased classes. + */ + SYNCHRONIZATION("synchronization"), + /** * Warn about issues relating to use of text blocks */ diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java index 5a5d78be3c894..d5eb6aa45eab3 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java @@ -220,6 +220,7 @@ public static Symtab instance(Context context) { public final Type previewFeatureInternalType; public final Type typeDescriptorType; public final Type recordType; + public final Type valueBasedType; /** The symbol representing the length field of an array. */ @@ -584,6 +585,7 @@ public R accept(ElementVisitor v, P p) { previewFeatureInternalType = enterSyntheticAnnotation("jdk.internal.PreviewFeature+Annotation"); typeDescriptorType = enterClass("java.lang.invoke.TypeDescriptor"); recordType = enterClass("java.lang.Record"); + valueBasedType = enterClass("jdk.internal.ValueBased"); synthesizeEmptyInterfaceIfMissing(autoCloseableType); synthesizeEmptyInterfaceIfMissing(cloneableType); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 4f314bfa7c753..84fdf02c053c8 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1740,9 +1740,24 @@ private Symbol enumConstant(JCTree tree, Type enumType) { public void visitSynchronized(JCSynchronized tree) { chk.checkRefType(tree.pos(), attribExpr(tree.lock, env)); + if (env.info.lint.isEnabled(LintCategory.SYNCHRONIZATION) && isValueBased(tree.lock.type)) { + log.warning(LintCategory.SYNCHRONIZATION, tree.pos(), Warnings.AttemptToSynchronizeOnInstanceOfValueBasedClass); + } attribStat(tree.body, env); result = null; } + // where + private boolean isValueBased(Type t) { + if (t != null && t.tsym != null) { + for (Attribute.Compound a: t.tsym.getDeclarationAttributes()) { + if (a.type.tsym == syms.valueBasedType.tsym) { + return true; + } + } + } + return false; + } + public void visitTry(JCTry tree) { // Create a new local environment with a local diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 77339ec8a416c..27909bae1bc6c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -3740,3 +3740,7 @@ compiler.err.preview.not.latest=\ compiler.err.preview.without.source.or.release=\ --enable-preview must be used with either -source or --release + +compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=\ + attempt to synchronize on an instance of a value-based class + diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties index bbca9cae250f3..4bb02bd8a5d73 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties @@ -256,10 +256,13 @@ javac.opt.Xlint.desc.unchecked=\ Warn about unchecked operations. javac.opt.Xlint.desc.varargs=\ - Warn about potentially unsafe vararg methods + Warn about potentially unsafe vararg methods. javac.opt.Xlint.desc.preview=\ - Warn about use of preview language features + Warn about use of preview language features. + +javac.opt.Xlint.desc.synchronization=\ + Warn about synchronization attempts on instances of value-based classes. javac.opt.Xdoclint=\ Enable recommended checks for problems in javadoc comments diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/GroupLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/GroupLayout.java index ed13670cbb67b..6e09a2fc56f01 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/GroupLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/GroupLayout.java @@ -44,12 +44,12 @@ * can be combined: if member layouts are laid out one after the other, the resulting group layout is said to be a struct * (see {@link MemoryLayout#ofStruct(MemoryLayout...)}); conversely, if all member layouts are laid out at the same starting offset, * the resulting group layout is said to be a union (see {@link MemoryLayout#ofUnion(MemoryLayout...)}). - * *

      * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code GroupLayout} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * *

      Unless otherwise specified, passing a {@code null} argument, or an array argument containing one or more {@code null} diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java index 47ff9e29bce23..3348506f8ce13 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java @@ -40,9 +40,9 @@ * when performing memory dereference operations using a memory access var handle (see {@link MemoryHandles}). *

      * All implementations of this interface must be value-based; - * use of identity-sensitive operations (including reference equality ({@code ==}), identity hash code, or synchronization) on - * instances of {@code MemoryAddress} may have unpredictable results and should be avoided. The {@code equals} method should - * be used for comparisons. + * programmers should treat instances that are {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. The {@code equals} method should be used for comparisons. *

      * Non-platform classes should not implement {@linkplain MemoryAddress} directly. * diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java index 6666b9c8bab77..9c9e5ffc679d3 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java @@ -78,9 +78,9 @@ * } *

      * All implementations of this interface must be value-based; - * use of identity-sensitive operations (including reference equality ({@code ==}), identity hash code, or synchronization) on - * instances of {@code MemoryLayout} may have unpredictable results and should be avoided. The {@code equals} method should - * be used for comparisons. + * programmers should treat instances that are {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. The {@code equals} method should be used for comparisons. *

      * Non-platform classes should not implement {@linkplain MemoryLayout} directly. * diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java index 13cef07afa70c..d5360101dd3cd 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java @@ -50,9 +50,9 @@ * operations on a segment cannot occur after a memory segment has been closed (see {@link MemorySegment#close()}). *

      * All implementations of this interface must be value-based; - * use of identity-sensitive operations (including reference equality ({@code ==}), identity hash code, or synchronization) on - * instances of {@code MemorySegment} may have unpredictable results and should be avoided. The {@code equals} method should - * be used for comparisons. + * programmers should treat instances that are {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, + * synchronization may fail. The {@code equals} method should be used for comparisons. *

      * Non-platform classes should not implement {@linkplain MemorySegment} directly. * diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/PaddingLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/PaddingLayout.java index 6f16f206bff4f..db65c48669b31 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/PaddingLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/PaddingLayout.java @@ -38,9 +38,10 @@ * and is typically used for aligning member layouts around word boundaries. *

      * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code PaddingLayout} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * *

      Unless otherwise specified, passing a {@code null} argument, or an array argument containing one or more {@code null} diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SequenceLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SequenceLayout.java index 1df597c4e4041..584c34e93353f 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SequenceLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SequenceLayout.java @@ -55,9 +55,10 @@ * *

      * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code SequenceLayout} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * *

      Unless otherwise specified, passing a {@code null} argument, or an array argument containing one or more {@code null} diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ValueLayout.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ValueLayout.java index feb58bca780ae..26271da07da6f 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ValueLayout.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ValueLayout.java @@ -40,9 +40,10 @@ * *

      * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances of - * {@code ValueLayout} may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * *

      Unless otherwise specified, passing a {@code null} argument, or an array argument containing one or more {@code null} diff --git a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicMapImplTest.java b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicMapImplTest.java index 4beea31edd893..206294bcb653f 100644 --- a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicMapImplTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicMapImplTest.java @@ -133,7 +133,7 @@ public int hashCode(Object o) { Assert.assertTrue(set.add(newInteger(0))); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) private static Integer newInteger(int value) { return new Integer(value); } diff --git a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicSetTest.java b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicSetTest.java index e6cc8a805329d..80fe74517b936 100644 --- a/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicSetTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/jdk.internal.vm.compiler.collections.test/src/jdk/internal/vm/compiler/collections/test/EconomicSetTest.java @@ -161,7 +161,7 @@ public void testSetRemoval() { Assert.assertEquals(newInteger(9), finalList.get(0)); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) private static Integer newInteger(int value) { return new Integer(value); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java index 6c64ecc8dfb3b..938f9f20c494e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java @@ -58,7 +58,7 @@ public void test1() { testEscapeAnalysis("test1Snippet", JavaConstant.forInt(101), false); } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) public static int test1Snippet() { Integer x = new Integer(101); return x.intValue(); @@ -89,7 +89,7 @@ public void testMonitor() { testEscapeAnalysis("testMonitorSnippet", JavaConstant.forInt(0), false); } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal", "synchronization"}) public static int testMonitorSnippet() { Integer x = new Integer(0); Double y = new Double(0); @@ -113,7 +113,7 @@ public void testMonitor2() { * This test case differs from the last one in that it requires inlining within a synchronized * region. */ - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal", "synchronization"}) public static int testMonitor2Snippet() { Integer x = new Integer(0); Double y = new Double(0); @@ -335,7 +335,7 @@ public void testChangeHandling() { public volatile Object field; - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) public int testChangeHandlingSnippet(int a) { Object obj; Integer one = 1; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PEAAssertionsTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PEAAssertionsTest.java index 7a9ff22ed5a9c..68cd79247a104 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PEAAssertionsTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PEAAssertionsTest.java @@ -42,7 +42,7 @@ protected OptimisticOptimizations getOptimisticOptimizations() { public static Object field; - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippet1(int i) { Integer object = new Integer(i); GraalDirectives.ensureVirtualized(object); @@ -53,7 +53,7 @@ public void test1() { test("snippet1", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippet2(int i) { Integer object = new Integer(i); GraalDirectives.ensureVirtualized(object); @@ -65,7 +65,7 @@ public void test2() { test("snippet2", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippet3(int i) { Integer object = new Integer(i); field = object; @@ -77,7 +77,7 @@ public void test3() { test("snippet3", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetHere1(int i) { Integer object = new Integer(i); GraalDirectives.ensureVirtualizedHere(object); @@ -88,7 +88,7 @@ public void testHere1() { test("snippetHere1", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetHere2(int i) { Integer object = new Integer(i); GraalDirectives.ensureVirtualizedHere(object); @@ -100,7 +100,7 @@ public void testHere2() { test("snippetHere2", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetHere3(int i) { Integer object = new Integer(i); field = object; @@ -133,7 +133,7 @@ public void testBoxing2() { test("snippetBoxing2", 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetControlFlow1(boolean b, int i) { Integer object = new Integer(i); if (b) { @@ -148,7 +148,7 @@ public void testControlFlow1() { test("snippetControlFlow1", true, 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetControlFlow2(boolean b, int i) { Integer object = new Integer(i); if (b) { @@ -165,7 +165,7 @@ public void testControlFlow2() { test("snippetControlFlow2", true, 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetControlFlow3(boolean b, int i) { Integer object = new Integer(i); GraalDirectives.ensureVirtualized(object); @@ -183,7 +183,7 @@ public void testControlFlow3() { test("snippetControlFlow3", true, 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetControlFlow4(boolean b, int i) { Integer object = new Integer(i); if (b) { @@ -199,7 +199,7 @@ public void testControlFlow4() { test("snippetControlFlow4", true, 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetControlFlow5(boolean b, int i) { Integer object = new Integer(i); if (b) { @@ -220,7 +220,7 @@ public static final class TestClass { Object b; } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetIndirect1(boolean b, int i) { Integer object = new Integer(i); TestClass t = new TestClass(); @@ -239,7 +239,7 @@ public void testIndirect1() { test("snippetIndirect1", true, 1); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static void snippetIndirect2(boolean b, int i) { Integer object = new Integer(i); TestClass t = new TestClass(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisTest.java index 5093c9805198a..ee02d0d7c4f31 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/PartialEscapeAnalysisTest.java @@ -115,7 +115,7 @@ public void test3() { testPartialEscapeAnalysis("test3Snippet", 0.5, 1, StoreFieldNode.class, LoadFieldNode.class); } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) public static Object test3Snippet(int a) { if (a < 0) { TestObject obj = new TestObject(1, 2); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java index b2c1dc5799913..bf436251e730d 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysisTests.java @@ -114,7 +114,7 @@ public void test02() { assertEquals(m(sa, B.class, "foo").getFormalReturn(), t(Data.class)); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) static void test03Entry() { Data data = new Data(); data.f = new Integer(42); @@ -142,7 +142,7 @@ public void test03() { assertEquals(m(sa, B.class, "foo").getFormalReturn(), t(Data.class), t(Integer.class)); } - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) static void test04Entry() { Data data = null; for (int i = 0; i < 2; i++) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigAccess.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigAccess.java index a9fb5ff7de9d0..b10df1df3599f 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigAccess.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfigAccess.java @@ -373,7 +373,7 @@ public T getFlag(String name, Class type) { /** * @see HotSpotVMConfigAccess#getFlag(String, Class, Object) */ - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) public T getFlag(String name, Class type, T notPresent, boolean expectPresent) { if (expectPresent) { return getFlag(name, type); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/hotpath/HP_allocate02.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/hotpath/HP_allocate02.java index 41e89b8dc1fc7..e51314a5ea4c0 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/hotpath/HP_allocate02.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/hotpath/HP_allocate02.java @@ -32,7 +32,7 @@ */ public class HP_allocate02 extends JTTTest { - @SuppressWarnings({"deprecation", "unused"}) + @SuppressWarnings({"deprecation", "removal", "unused"}) public static int test(int count) { int sum = 0; for (int i = 0; i < count; i++) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MonitorTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MonitorTest.java index fefd6b330ddcf..1fb8c51a472a3 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MonitorTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/MonitorTest.java @@ -212,6 +212,7 @@ public static String copyArr(char[] src, char[] dst, int n) { return new String(dst); } + @SuppressWarnings("synchronization") public static String lockBoxedLong(long value) { Long lock = value; synchronized (lock) { diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index a512e76c5472c..53151be43f076 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -91,7 +91,7 @@ 20 ms - + true true diff --git a/src/jdk.jfr/share/conf/jfr/profile.jfc b/src/jdk.jfr/share/conf/jfr/profile.jfc index fa4522ed023a8..7958f6a1fbeb0 100644 --- a/src/jdk.jfr/share/conf/jfr/profile.jfc +++ b/src/jdk.jfr/share/conf/jfr/profile.jfc @@ -91,7 +91,7 @@ 10 ms - + true true diff --git a/test/hotspot/jtreg/runtime/Monitor/SyncOnPrimitiveWrapperTest.java b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java similarity index 91% rename from test/hotspot/jtreg/runtime/Monitor/SyncOnPrimitiveWrapperTest.java rename to test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java index 667ebd8d44ab3..ad2adf3bcf897 100644 --- a/test/hotspot/jtreg/runtime/Monitor/SyncOnPrimitiveWrapperTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java @@ -29,12 +29,12 @@ /* * @test * @bug 8242263 - * @summary Exercise DiagnoseSyncOnPrimitiveWrappers diagnostic flag + * @summary Exercise DiagnoseSyncOnValueBasedClasses diagnostic flag * @library /test/lib - * @run driver/timeout=180000 SyncOnPrimitiveWrapperTest + * @run driver/timeout=180000 SyncOnValueBasedClassTest */ -public class SyncOnPrimitiveWrapperTest { +public class SyncOnValueBasedClassTest { static final int LOOP_COUNT = 3000; static final int THREAD_COUNT = 2; static String[] fatalTests[]; @@ -64,20 +64,20 @@ private static void initTestObjects() { private static void generateTests() { initTestObjects(); - String[] commonFatalTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash", "-XX:DiagnoseSyncOnPrimitiveWrappers=1"}; + String[] commonFatalTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:-CreateCoredumpOnCrash", "-XX:DiagnoseSyncOnValueBasedClasses=1"}; fatalTests = new String[specificFlags.length * testObjects.size()][]; for (int i = 0; i < specificFlags.length; i++) { for (int j = 0; j < testObjects.size(); j++) { int index = i * testObjects.size() + j; - fatalTests[index] = Stream.of(commonFatalTestsFlags, specificFlags[i], new String[] {"SyncOnPrimitiveWrapperTest$FatalTest", Integer.toString(j)}) + fatalTests[index] = Stream.of(commonFatalTestsFlags, specificFlags[i], new String[] {"SyncOnValueBasedClassTest$FatalTest", Integer.toString(j)}) .flatMap(Stream::of) .toArray(String[]::new); } } - String[] commonLogTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:DiagnoseSyncOnPrimitiveWrappers=2"}; + String[] commonLogTestsFlags = {"-XX:+UnlockDiagnosticVMOptions", "-XX:DiagnoseSyncOnValueBasedClasses=2"}; logTests = new String[specificFlags.length][]; for (int i = 0; i < specificFlags.length; i++) { - logTests[i] = Stream.of(commonLogTestsFlags, specificFlags[i], new String[] {"SyncOnPrimitiveWrapperTest$LogTest"}) + logTests[i] = Stream.of(commonLogTestsFlags, specificFlags[i], new String[] {"SyncOnValueBasedClassTest$LogTest"}) .flatMap(Stream::of) .toArray(String[]::new); } @@ -89,7 +89,7 @@ public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(fatalTests[i]); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain("fatal error: Synchronizing on object"); - output.shouldNotContain("synchronization on primitive wrapper did not fail"); + output.shouldNotContain("synchronization on value based class did not fail"); output.shouldNotHaveExitValue(0); } for (int i = 0; i < logTests.length; i++) { @@ -127,7 +127,7 @@ static class FatalTest { public static void main(String[] args) throws Exception { initTestObjects(); synchronized (testObjects.get(Integer.valueOf(args[0]))) { - throw new RuntimeException("synchronization on primitive wrapper did not fail"); + throw new RuntimeException("synchronization on value based class did not fail"); } } } @@ -164,4 +164,4 @@ public void run() { } } } -} \ No newline at end of file +} diff --git a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java index 8ba887922816c..1a5e893a9162a 100644 --- a/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java +++ b/test/jdk/jdk/jfr/event/metadata/TestLookForUntestedEvents.java @@ -82,7 +82,7 @@ public class TestLookForUntestedEvents { // Experimental events private static final Set experimentalEvents = new HashSet<>( Arrays.asList( - "Flush", "SyncOnPrimitiveWrapper") + "Flush", "SyncOnValueBasedClass") ); diff --git a/test/jdk/jdk/jfr/event/runtime/TestSyncOnPrimitiveWrapperEvent.java b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java similarity index 86% rename from test/jdk/jdk/jfr/event/runtime/TestSyncOnPrimitiveWrapperEvent.java rename to test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java index bf8f31699e46d..85b01e4198ccf 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSyncOnPrimitiveWrapperEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSyncOnValueBasedClassEvent.java @@ -38,10 +38,10 @@ * @requires vm.hasJFR * @key jfr * @library /test/lib - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DiagnoseSyncOnPrimitiveWrappers=2 jdk.jfr.event.runtime.TestSyncOnPrimitiveWrapperEvent + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:DiagnoseSyncOnValueBasedClasses=2 jdk.jfr.event.runtime.TestSyncOnValueBasedClassEvent */ -public class TestSyncOnPrimitiveWrapperEvent { - static final String EVENT_NAME = EventNames.SyncOnPrimitiveWrapper; +public class TestSyncOnValueBasedClassEvent { + static final String EVENT_NAME = EventNames.SyncOnValueBasedClass; static String[] classesWanted = {"java/lang/Character", "java/lang/Boolean", "java/lang/Byte", "java/lang/Short", "java/lang/Integer", "java/lang/Long", "java/lang/Float", "java/lang/Double"}; static List testObjects = new ArrayList(); @@ -74,7 +74,7 @@ public static void main(String[] args) throws Throwable { List events = Events.fromRecording(recording); Events.hasEvents(events); for (RecordedEvent event : Events.fromRecording(recording)) { - String className = Events.assertField(event, "boxClass.name").notEmpty().getValue(); + String className = Events.assertField(event, "valueBasedClass.name").notEmpty().getValue(); RecordedThread jt = event.getThread(); if (Thread.currentThread().getName().equals(jt.getJavaName())) { classesFound.add(className); @@ -82,11 +82,11 @@ public static void main(String[] args) throws Throwable { } for (String classWanted : classesWanted) { if (!classesFound.contains(classWanted)) { - throw new AssertionError("No matching event SyncOnPrimitiveWrapper with \"boxClass=" + classWanted + "\" and current thread as caller"); + throw new AssertionError("No matching event SyncOnValueBasedClass with \"valueBasedClass=" + classWanted + "\" and current thread as caller"); } } if (classesFound.size() != classesWanted.length) { - throw new AssertionError("Invalid number of SyncOnPrimitiveWrapper events for current thread"); + throw new AssertionError("Invalid number of SyncOnValueBasedClass events for current thread"); } } } diff --git a/test/langtools/jdk/jshell/ImportTest.java b/test/langtools/jdk/jshell/ImportTest.java index d5b03c47f4149..e09490052cff5 100644 --- a/test/langtools/jdk/jshell/ImportTest.java +++ b/test/langtools/jdk/jshell/ImportTest.java @@ -68,7 +68,7 @@ public void testImportOnDemand() { public void testImportStatic() { assertImportKeyMatch("import static java.lang.Math.PI;", "PI", SINGLE_STATIC_IMPORT_SUBKIND, added(VALID)); - assertEval("new Double(PI).toString().substring(0, 16).equals(\"3.14159265358979\");", "true"); + assertEval("Double.valueOf(PI).toString().substring(0, 16).equals(\"3.14159265358979\");", "true"); } public void testImportStaticOnDemand() { diff --git a/test/langtools/tools/javac/diags/examples/AttemptToSynchronizeOnInstanceOfVbc.java b/test/langtools/tools/javac/diags/examples/AttemptToSynchronizeOnInstanceOfVbc.java new file mode 100644 index 0000000000000..9d63a2af0a430 --- /dev/null +++ b/test/langtools/tools/javac/diags/examples/AttemptToSynchronizeOnInstanceOfVbc.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020, 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. + */ + +// key: compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class +// options: -Xlint:synchronization + +class AttemptToSynchronizeOnInstanceOfVbc { + void foo(Integer i) { + synchronized(i) { + } + } +} diff --git a/test/langtools/tools/javac/lambda/8074381/T8074381a.java b/test/langtools/tools/javac/lambda/8074381/T8074381a.java index d11944d392698..0b5b4695bcba1 100644 --- a/test/langtools/tools/javac/lambda/8074381/T8074381a.java +++ b/test/langtools/tools/javac/lambda/8074381/T8074381a.java @@ -13,7 +13,7 @@ interface Sub extends Sup { boolean m(String s); } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) void testRaw() { Sub s1 = c -> true; Sub s2 = Boolean::new; @@ -23,7 +23,7 @@ void testRaw() { }; } - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "removal"}) void testNonRaw() { Sub s1 = c -> true; Sub s2 = Boolean::new; diff --git a/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.java b/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.java new file mode 100644 index 0000000000000..6de1138f5279e --- /dev/null +++ b/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.java @@ -0,0 +1,23 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8254274 + * @summary lint should warn when an instance of a value based class is synchronized upon + * @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint ExternalAbuseOfVbc.java + * @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:all ExternalAbuseOfVbc.java + * @compile/fail/ref=ExternalAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:synchronization ExternalAbuseOfVbc.java + * @compile/ref=LintModeOffAbuseOfVbc.out -XDrawDiagnostics -Werror -Xlint:-synchronization ExternalAbuseOfVbc.java + */ + +public final class ExternalAbuseOfVbc { + + final Integer val = Integer.valueOf(42); + final String ref = "String"; + + void abuseVbc() { + synchronized(ref) { // OK + synchronized (val) { // WARN + } + } + } +} + diff --git a/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.out b/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.out new file mode 100644 index 0000000000000..b4292879c152b --- /dev/null +++ b/test/langtools/tools/javac/lint/ExternalAbuseOfVbc.out @@ -0,0 +1,4 @@ +ExternalAbuseOfVbc.java:18:13: compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class +- compiler.err.warnings.and.werror +1 error +1 warning diff --git a/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.java b/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.java new file mode 100644 index 0000000000000..2d384dd324d93 --- /dev/null +++ b/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.java @@ -0,0 +1,22 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8254274 + * @summary lint should warn when an instance of a value based class is synchronized upon + * @compile/fail/ref=JdkInternalAbuseOfVbc.out --patch-module java.base=${test.src} -XDrawDiagnostics -Werror -Xlint SomeVbc.java JdkInternalAbuseOfVbc.java + */ + +package java.lang; + +public final class JdkInternalAbuseOfVbc { + + public JdkInternalAbuseOfVbc() {} + + void abuseVbc(SomeVbc vbc) { + + synchronized(this) { // OK + synchronized (vbc) { // WARN + } + } + } +} + diff --git a/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.out b/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.out new file mode 100644 index 0000000000000..cb66f0bcfa60b --- /dev/null +++ b/test/langtools/tools/javac/lint/JdkInternalAbuseOfVbc.out @@ -0,0 +1,6 @@ +SomeVbc.java:38:13: compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class +- compiler.err.warnings.and.werror +SomeVbc.java:49:13: compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class +JdkInternalAbuseOfVbc.java:17:13: compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class +1 error +3 warnings diff --git a/test/langtools/tools/javac/lint/LintModeOffAbuseOfVbc.out b/test/langtools/tools/javac/lint/LintModeOffAbuseOfVbc.out new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/test/langtools/tools/javac/lint/SomeVbc.java b/test/langtools/tools/javac/lint/SomeVbc.java new file mode 100644 index 0000000000000..b68e4599c8103 --- /dev/null +++ b/test/langtools/tools/javac/lint/SomeVbc.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020, 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; + +@jdk.internal.ValueBased +public final class SomeVbc { + + public SomeVbc() {} + + final String ref = "String"; + + void abuseVbc() { + + synchronized(ref) { // OK + synchronized (this) { // WARN + } + } + } +} + +final class AuxilliaryAbuseOfVbc { + + void abuseVbc(SomeVbc vbc) { + + synchronized(this) { // OK + synchronized (vbc) { // WARN + } + } + } +} + diff --git a/test/lib/jdk/test/lib/hexdump/HexPrinter.java b/test/lib/jdk/test/lib/hexdump/HexPrinter.java index 12f0cfd45b092..901d5859f9292 100644 --- a/test/lib/jdk/test/lib/hexdump/HexPrinter.java +++ b/test/lib/jdk/test/lib/hexdump/HexPrinter.java @@ -143,9 +143,10 @@ * *

      * This is a value-based - * class; use of identity-sensitive operations (including reference equality - * ({@code ==}), identity hash code, or synchronization) on instances - * may have unpredictable results and should be avoided. + * class; programmers should treat instances that are + * {@linkplain #equals(Object) equal} as interchangeable and should not + * use instances for synchronization, or unpredictable behavior may + * occur. For example, in a future release, synchronization may fail. * The {@code equals} method should be used for comparisons. * *

      diff --git a/test/lib/jdk/test/lib/jfr/EventNames.java b/test/lib/jdk/test/lib/jfr/EventNames.java index 19fb9f2352417..482de84d32a72 100644 --- a/test/lib/jdk/test/lib/jfr/EventNames.java +++ b/test/lib/jdk/test/lib/jfr/EventNames.java @@ -61,7 +61,7 @@ public class EventNames { public final static String JavaMonitorEnter = PREFIX + "JavaMonitorEnter"; public final static String JavaMonitorWait = PREFIX + "JavaMonitorWait"; public final static String JavaMonitorInflate = PREFIX + "JavaMonitorInflate"; - public final static String SyncOnPrimitiveWrapper = PREFIX + "SyncOnPrimitiveWrapper"; + public final static String SyncOnValueBasedClass = PREFIX + "SyncOnValueBasedClass"; public final static String ClassLoad = PREFIX + "ClassLoad"; public final static String ClassDefine = PREFIX + "ClassDefine"; public final static String ClassUnload = PREFIX + "ClassUnload"; From b29f9cd7b073a8c5e514efda91aaf7115400a97f Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 8 Dec 2020 23:25:08 +0000 Subject: [PATCH 144/504] 8075778: Add javadoc tag to avoid duplication of return information in simple situations. Reviewed-by: prappo, jlahoda --- .../com/sun/source/doctree/ReturnTree.java | 20 +- .../com/sun/source/util/DocTreeFactory.java | 20 + .../com/sun/tools/javac/api/JavacTrees.java | 14 +- .../tools/javac/parser/DocCommentParser.java | 121 ++++-- .../com/sun/tools/javac/tree/DCTree.java | 16 +- .../com/sun/tools/javac/tree/DocPretty.java | 6 + .../sun/tools/javac/tree/DocTreeMaker.java | 8 +- .../shellsupport/doc/JavadocFormatter.java | 60 ++- .../doc/resources/javadocformatter.properties | 3 +- .../formats/html/HtmlDocletWriter.java | 5 +- .../formats/html/TagletWriterImpl.java | 11 +- .../toolkit/resources/doclets.properties | 1 + .../doclets/toolkit/taglets/ReturnTaglet.java | 56 ++- .../toolkit/taglets/TagletManager.java | 3 +- .../doclets/toolkit/taglets/TagletWriter.java | 5 +- .../jdk/javadoc/internal/doclint/Checker.java | 6 + .../doclint/resources/doclint.properties | 7 +- .../doc/JavadocFormatterTest.java | 4 +- .../doclet/testReturnTag/TestReturnTag.java | 408 +++++++++++++++++- .../doclet/testTaglets/TestTaglets.out | 2 +- .../tools/doclint/EmptyHtmlTest.java | 3 + 21 files changed, 667 insertions(+), 112 deletions(-) diff --git a/src/jdk.compiler/share/classes/com/sun/source/doctree/ReturnTree.java b/src/jdk.compiler/share/classes/com/sun/source/doctree/ReturnTree.java index 73bf87b0c690a..392700a39920d 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/doctree/ReturnTree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/ReturnTree.java @@ -30,13 +30,25 @@ /** * A tree node for an {@code @return} block tag. * - *

      - *    @return description
      - * 
      + *
      {@code
      + *    @return description
      + *    {@return description}
      + * }
      * * @since 1.8 */ -public interface ReturnTree extends BlockTagTree { +public interface ReturnTree extends BlockTagTree, InlineTagTree { + /** + * Returns whether this instance is an inline tag. + * + * @return {@code true} if this instance is an inline tag, and {@code false} otherwise + * @implSpec this implementation returns {@code false}. + * @since 16 + */ + default boolean isInline() { + return false; + } + /** * Returns the description of the return value of a method. * @return the description diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java index 54dc3d259bde5..f5834a577d7a5 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java @@ -265,6 +265,26 @@ DocCommentTree newDocCommentTree(List fullBody, */ ReturnTree newReturnTree(List description); + /** + * Creates a new {@code ReturnTree} object, to represent a {@code @return} tag + * or {@code {@return}} tag. + * + * @implSpec This implementation throws {@code UnsupportedOperationException} if + * {@code isInline} is {@code true}, and calls {@link #newReturnTree(List)} otherwise. + * + * @param description the description of the return value of a method + * @return a {@code ReturnTree} object + * @throws UnsupportedOperationException if inline {@code {@return}} tags are + * not supported + * @since 16 + */ + default ReturnTree newReturnTree(boolean isInline, List description) { + if (isInline) { + throw new UnsupportedOperationException(); + } + return newReturnTree(description); + } + /** * Creates a new {@code SeeTree} object, to represent a {@code @see} tag. * @param reference the reference diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java index 4a1c0702e06dc..6b14e35d93a1d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -300,9 +300,19 @@ public long getEndPosition(CompilationUnitTree file, DocCommentTree comment, Doc return getEndPosition(file, comment, last) + correction; } - DCBlockTag block = (DCBlockTag) tree; + int pos; + String name; + if (tree.getKind() == DocTree.Kind.RETURN) { + DCTree.DCReturn dcReturn = (DCTree.DCReturn) tree; + pos = dcReturn.pos; + name = dcReturn.getTagName(); + } else { + DCBlockTag block = (DCBlockTag) tree; + pos = block.pos; + name = block.getTagName(); + } - return dcComment.comment.getSourcePos(block.pos + block.getTagName().length() + 1); + return dcComment.comment.getSourcePos(pos + name.length() + 1); } case ENTITY: { DCEntity endEl = (DCEntity) tree; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java index 440df2a35fa98..6c89d5c537ea1 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java @@ -269,11 +269,10 @@ protected DCTree blockTag() { List content = blockContent(); return m.at(p).newUnknownBlockTagTree(name, content); } else { - switch (tp.getKind()) { - case BLOCK: - return tp.parse(p); - case INLINE: - return erroneous("dc.bad.inline.tag", p); + if (tp.allowsBlock()) { + return tp.parse(p, TagParser.Kind.BLOCK); + } else { + return erroneous("dc.bad.inline.tag", p); } } } @@ -311,33 +310,29 @@ protected DCTree inlineTag() { int p = bp - 1; try { nextChar(); - if (isIdentifierStart(ch)) { - Name name = readTagName(); - TagParser tp = tagParsers.get(name); - - if (tp == null) { + if (!isIdentifierStart(ch)) { + return erroneous("dc.no.tag.name", p); + } + Name name = readTagName(); + TagParser tp = tagParsers.get(name); + if (tp == null) { + skipWhitespace(); + DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); + nextChar(); + return m.at(p).newUnknownInlineTagTree(name, List.of(text)).setEndPos(bp); + } else { + if (!tp.retainWhiteSpace) { skipWhitespace(); - DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); - if (text != null) { - nextChar(); - return m.at(p).newUnknownInlineTagTree(name, List.of(text)).setEndPos(bp); - } - } else { - if (!tp.retainWhiteSpace) { - skipWhitespace(); - } - if (tp.getKind() == TagParser.Kind.INLINE) { - DCEndPosTree tree = (DCEndPosTree) tp.parse(p); - if (tree != null) { - return tree.setEndPos(bp); - } - } else { // handle block tags (for example, @see) in inline content - inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip content - nextChar(); - } + } + if (tp.allowsInline()) { + DCEndPosTree tree = (DCEndPosTree) tp.parse(p, TagParser.Kind.INLINE); + return tree.setEndPos(bp); + } else { // handle block tags (for example, @see) in inline content + DCTree text = inlineText(WhitespaceRetentionPolicy.REMOVE_ALL); // skip content + nextChar(); + return m.at(p).newUnknownInlineTagTree(name, List.of(text)).setEndPos(bp); } } - return erroneous("dc.no.tag.name", p); } catch (ParseException e) { return erroneous(e.getMessage(), p); } @@ -574,9 +569,21 @@ protected DCText inlineWord() { * Read general text content of an inline tag, including HTML entities and elements. * Matching pairs of { } are skipped; the text is terminated by the first * unmatched }. It is an error if the beginning of the next tag is detected. + * Nested tags are not permitted. */ - @SuppressWarnings("fallthrough") private List inlineContent() { + return inlineContent(false); + } + + /** + * Read general text content of an inline tag, including HTML entities and elements. + * Matching pairs of { } are skipped; the text is terminated by the first + * unmatched }. It is an error if the beginning of the next tag is detected. + * + * @param allowNestedTags whether or not to allow nested tags + */ + @SuppressWarnings("fallthrough") + private List inlineContent(boolean allowNestedTags) { ListBuffer trees = new ListBuffer<>(); skipWhitespace(); @@ -604,14 +611,23 @@ private List inlineContent() { newline = false; addPendingText(trees, bp - 1); trees.add(html()); + textStart = bp; + lastNonWhite = -1; break; case '{': if (textStart == -1) textStart = bp; newline = false; - depth++; nextChar(); + if (ch == '@' && allowNestedTags) { + addPendingText(trees, bp - 2); + trees.add(inlineTag()); + textStart = bp; + lastNonWhite = -1; + } else { + depth++; + } break; case '}': @@ -1071,7 +1087,7 @@ String newString(int start, int end) { } private static abstract class TagParser { - enum Kind { INLINE, BLOCK } + enum Kind { INLINE, BLOCK, EITHER } final Kind kind; final DCTree.Kind treeKind; @@ -1089,19 +1105,32 @@ enum Kind { INLINE, BLOCK } this.retainWhiteSpace = retainWhiteSpace; } - Kind getKind() { - return kind; + boolean allowsBlock() { + return kind != Kind.INLINE; + } + + boolean allowsInline() { + return kind != Kind.BLOCK; } DCTree.Kind getTreeKind() { return treeKind; } - abstract DCTree parse(int pos) throws ParseException; + DCTree parse(int pos, Kind kind) throws ParseException { + if (kind != this.kind && this.kind != Kind.EITHER) { + throw new IllegalArgumentException(kind.toString()); + } + return parse(pos); + } + + DCTree parse(int pos) throws ParseException { + throw new UnsupportedOperationException(); + } } /** - * @see Javadoc Tags + * @see JavaDoc Tags */ private Map createTagParsers() { TagParser[] parsers = { @@ -1271,12 +1300,22 @@ public DCTree parse(int pos) throws ParseException { } }, - // @return description - new TagParser(TagParser.Kind.BLOCK, DCTree.Kind.RETURN) { + // @return description -or- {@return description} + new TagParser(TagParser.Kind.EITHER, DCTree.Kind.RETURN) { @Override - public DCTree parse(int pos) { - List description = blockContent(); - return m.at(pos).newReturnTree(description); + public DCTree parse(int pos, Kind kind) { + List description; + switch (kind) { + case BLOCK: + description = blockContent(); + break; + case INLINE: + description = inlineContent(true); + break; + default: + throw new IllegalArgumentException(kind.toString()); + } + return m.at(pos).newReturnTree(kind == Kind.INLINE, description); } }, diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java index 78b63c6c578c6..71bac2b02d2e0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java @@ -677,13 +677,20 @@ public String getSignature() { } } - public static class DCReturn extends DCBlockTag implements ReturnTree { + public static class DCReturn extends DCEndPosTree implements ReturnTree { + public final boolean inline; public final List description; - DCReturn(List description) { + DCReturn(boolean inline, List description) { + this.inline = inline; this.description = description; } + @Override @DefinedBy(Api.COMPILER_TREE) + public String getTagName() { + return "return"; + } + @Override @DefinedBy(Api.COMPILER_TREE) public Kind getKind() { return Kind.RETURN; @@ -694,6 +701,11 @@ public R accept(DocTreeVisitor v, D d) { return v.visitReturn(this, d); } + @Override @DefinedBy(Api.COMPILER_TREE) + public boolean isInline() { + return inline; + } + @Override @DefinedBy(Api.COMPILER_TREE) public List getDescription() { return description; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java index 9ba26fd44947b..f4d0280ebd319 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java @@ -399,9 +399,15 @@ public Void visitReference(ReferenceTree node, Void p) { @Override @DefinedBy(Api.COMPILER_TREE) public Void visitReturn(ReturnTree node, Void p) { try { + if (node.isInline()) { + print("{"); + } printTagName(node); print(" "); print(node.getDescription()); + if (node.isInline()) { + print("}"); + } } catch (IOException e) { throw new UncheckedIOException(e); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java index 5b382114e48d8..f8d843ee93c19 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java @@ -386,7 +386,12 @@ public DCReference newReferenceTree(String signature, JCTree.JCExpression module @Override @DefinedBy(Api.COMPILER_TREE) public DCReturn newReturnTree(List description) { - DCReturn tree = new DCReturn(cast(description)); + return newReturnTree(false, description); + } + + @Override @DefinedBy(Api.COMPILER_TREE) + public DCReturn newReturnTree(boolean isInline, List description) { + DCReturn tree = new DCReturn(isInline, cast(description)); tree.pos = pos; return tree; } @@ -533,6 +538,7 @@ private Pair, List> splitBody(Collection continue; } switch (dt.getKind()) { + case RETURN: case SUMMARY: foundFirstSentence = true; break; diff --git a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java index 184f451dac28b..b6c11c9b79513 100644 --- a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java +++ b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java @@ -174,22 +174,35 @@ public Object visitDocComment(DocCommentTree node, Object p) { if (current.matches(t)) { if (!seenAny) { seenAny = true; - if (result.charAt(result.length() - 1) != '\n') - result.append("\n"); - result.append("\n"); - result.append(escape(CODE_UNDERLINE)) - .append(docSections.get(current)) - .append(escape(CODE_RESET)) - .append("\n"); + startSection(current); } scan(t, null); } } + if (current == Sections.RETURNS && !seenAny) { + List firstSentence = node.getFirstSentence(); + if (firstSentence.size() == 1 + && firstSentence.get(0).getKind() == DocTree.Kind.RETURN) { + startSection(current); + scan(firstSentence.get(0), true); + } + } } return null; } + private void startSection(Sections current) { + if (result.charAt(result.length() - 1) != '\n') + result.append("\n"); + result.append("\n"); + result.append(escape(CODE_UNDERLINE)) + .append(docSections.get(current)) + .append(escape(CODE_RESET)) + .append("\n"); + + } + @Override @DefinedBy(Api.COMPILER_TREE) public Object visitText(TextTree node, Object p) { String text = node.getBody(); @@ -250,13 +263,34 @@ public Object visitLiteral(LiteralTree node, Object p) { return scan(node.getBody(), p); } + /** + * {@inheritDoc} + * {@code @return} is a bimodal tag and can be used as either a block tag or an inline + * tag. If the parameter {@code p} is {@code null}, the node will be formatted according to + * the value of {@link ReturnTree#isInline()}. If the parameter is not {@code null}, the node will + * be formatted as a block tag. + * @param node {@inheritDoc} + * @param p not {@code null} to force the node to be formatted as a block tag + * @return + */ @Override @DefinedBy(Api.COMPILER_TREE) public Object visitReturn(ReturnTree node, Object p) { - reflownTo = result.length(); - try { - return super.visitReturn(node, p); - } finally { - reflow(result, reflownTo, 0, limit); + if (node.isInline() && p == null) { + String MARKER = "{0}"; + int p0 = inlineReturns.indexOf(MARKER); + result.append(inlineReturns, 0, p0); + try { + return super.visitReturn(node, p); + } finally { + result.append(inlineReturns.substring(p0 + MARKER.length())); + } + } else { + reflownTo = result.length(); + try { + return super.visitReturn(node, p); + } finally { + reflow(result, reflownTo, 0, limit); + } } } @@ -569,6 +603,7 @@ private String escape(String sequence) { } private static final Map docSections = new LinkedHashMap<>(); + private static final String inlineReturns; static { ResourceBundle bundle = @@ -577,6 +612,7 @@ private String escape(String sequence) { docSections.put(Sections.PARAMS, bundle.getString("CAP_Parameters")); docSections.put(Sections.RETURNS, bundle.getString("CAP_Returns")); docSections.put(Sections.THROWS, bundle.getString("CAP_Thrown_Exceptions")); + inlineReturns = bundle.getString("Inline_Returns"); } private static String indentString(int indent) { diff --git a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/resources/javadocformatter.properties b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/resources/javadocformatter.properties index afaaaba6b1891..6d8cc024e54cf 100644 --- a/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/resources/javadocformatter.properties +++ b/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/resources/javadocformatter.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2020, 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 @@ -27,3 +27,4 @@ CAP_TypeParameters=Type Parameters: CAP_Parameters=Parameters: CAP_Returns=Returns: CAP_Thrown_Exceptions=Thrown Exceptions: +Inline_Returns=Returns {0}. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 293e450398f13..fab8442383d0d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -1384,9 +1384,8 @@ private boolean inAnAtag() { StartElementTree st = (StartElementTree)tag; Name name = st.getName(); if (name != null) { - jdk.javadoc.internal.doclint.HtmlTag htag = - jdk.javadoc.internal.doclint.HtmlTag.get(name); - return htag != null && htag.equals(jdk.javadoc.internal.doclint.HtmlTag.A); + HtmlTag htag = HtmlTag.get(name); + return htag != null && htag.equals(HtmlTag.A); } } return false; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java index dc90bf4bf94c3..571676c4d948c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java @@ -210,12 +210,13 @@ public Content paramTagOutput(Element element, ParamTree paramTag, String paramN } @Override - public Content returnTagOutput(Element element, ReturnTree returnTag) { + public Content returnTagOutput(Element element, ReturnTree returnTag, boolean inline) { CommentHelper ch = utils.getCommentHelper(element); - return new ContentBuilder( - HtmlTree.DT(contents.returns), - HtmlTree.DD(htmlWriter.commentTagsToContent( - returnTag, element, ch.getDescription(returnTag), false, inSummary))); + List desc = ch.getDescription(returnTag); + Content content = htmlWriter.commentTagsToContent(returnTag, element, desc , false, inSummary); + return inline + ? new ContentBuilder(contents.getContent("doclet.Returns_0", content)) + : new ContentBuilder(HtmlTree.DT(contents.returns), HtmlTree.DD(content)); } @Override diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties index 4558a7ad13882..33b0fbdf84bb5 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties @@ -100,6 +100,7 @@ doclet.TypeParameters_dup_warn=Type parameter "{0}" is documented more than once doclet.RecordComponents_warn=@param argument "{0}" is not the name of a record component. doclet.RecordComponents_dup_warn=Record component "{0}" is documented more than once. doclet.Returns=Returns: +doclet.Returns_0=Returns {0}. doclet.Return_tag_on_void_method=@return tag cannot be used in method with void return type. doclet.See_Also=See Also: doclet.SerialData=Serial Data: diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java index 15983f904038a..b44f803c712af 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ReturnTaglet.java @@ -44,7 +44,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.Utils; /** - * A taglet that represents the @return tag. + * A taglet that represents the {@code @return} and {@code {@return }} tags. * *

      This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -54,47 +54,77 @@ public class ReturnTaglet extends BaseTaglet implements InheritableTaglet { public ReturnTaglet() { - super(DocTree.Kind.RETURN, false, EnumSet.of(Location.METHOD)); + super(DocTree.Kind.RETURN, true, EnumSet.of(Location.METHOD)); + } + + @Override + public boolean isBlockTag() { + return true; } @Override public void inherit(DocFinder.Input input, DocFinder.Output output) { - List tags = input.utils.getReturnTrees(input.element); - CommentHelper ch = input.utils.getCommentHelper(input.element); + Utils utils = input.utils; + CommentHelper ch = utils.getCommentHelper(input.element); + + ReturnTree tag = null; + List tags = utils.getReturnTrees(input.element); if (!tags.isEmpty()) { + tag = tags.get(0); + } else { + List firstSentence = utils.getFirstSentenceTrees(input.element); + if (firstSentence.size() == 1 && firstSentence.get(0).getKind() == DocTree.Kind.RETURN) { + tag = (ReturnTree) firstSentence.get(0); + } + } + + if (tag != null) { output.holder = input.element; - output.holderTag = tags.get(0); + output.holderTag = tag; output.inlineTags = input.isFirstSentence ? ch.getFirstSentenceTrees(output.holderTag) : ch.getDescription(output.holderTag); } } + @Override + public Content getInlineTagOutput(Element element, DocTree tag, TagletWriter writer) { + return writer.returnTagOutput(element, (ReturnTree) tag, true); + } + @Override public Content getAllBlockTagOutput(Element holder, TagletWriter writer) { Messages messages = writer.configuration().getMessages(); Utils utils = writer.configuration().utils; - TypeMirror returnType = utils.getReturnType(writer.getCurrentPageElement(), (ExecutableElement)holder); List tags = utils.getReturnTrees(holder); - //Make sure we are not using @return tag on method with void return type. + // Make sure we are not using @return tag on method with void return type. + TypeMirror returnType = utils.getReturnType(writer.getCurrentPageElement(), (ExecutableElement)holder); if (returnType != null && utils.isVoid(returnType)) { if (!tags.isEmpty()) { messages.warning(holder, "doclet.Return_tag_on_void_method"); } return null; } - if (!tags.isEmpty()) - return writer.returnTagOutput(holder, tags.get(0)); - //Inherit @return tag if necessary. - List ntags = new ArrayList<>(); + + if (!tags.isEmpty()) { + return writer.returnTagOutput(holder, tags.get(0), false); + } + + // Check for inline tag in first sentence. + List firstSentence = utils.getFirstSentenceTrees(holder); + if (firstSentence.size() == 1 && firstSentence.get(0).getKind() == DocTree.Kind.RETURN) { + return writer.returnTagOutput(holder, (ReturnTree) firstSentence.get(0), false); + } + + // Inherit @return tag if necessary. Input input = new DocFinder.Input(utils, holder, this); DocFinder.Output inheritedDoc = DocFinder.search(writer.configuration(), input); if (inheritedDoc.holderTag != null) { CommentHelper ch = utils.getCommentHelper(input.element); ch.setOverrideElement(inheritedDoc.holder); - ntags.add(inheritedDoc.holderTag); + return writer.returnTagOutput(holder, (ReturnTree) inheritedDoc.holderTag, false); } - return !ntags.isEmpty() ? writer.returnTagOutput(holder, (ReturnTree) ntags.get(0)) : null; + return null; } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java index 343b1b8461516..7fec625c360e9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java @@ -733,7 +733,8 @@ private void showTaglets(PrintStream out) { taglets.addAll(allTaglets.values()); for (Taglet t : taglets) { - String name = t.isInlineTag() ? "{@" + t.getName() + "}" : "@" + t.getName(); + // give preference to simpler block form if a tag can be either + String name = t.isBlockTag() ? "@" + t.getName() : "{@" + t.getName() + "}"; out.println(String.format("%20s", name) + ": " + format(t.isBlockTag(), "block")+ " " + format(t.inOverview(), "overview") + " " diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java index 692022aed9af5..c59f7a5f72fe6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletWriter.java @@ -145,12 +145,13 @@ protected TagletWriter(boolean isFirstSentence) { /** * Returns the output for a {@code @return} tag. * - * @param element The element that owns the doc comment + * @param element the element that owns the doc comment * @param returnTag the return tag to document + * @param inline whether this should be written as an inline instance or block instance * * @return the output */ - protected abstract Content returnTagOutput(Element element, ReturnTree returnTag); + protected abstract Content returnTagOutput(Element element, ReturnTree returnTag, boolean inline); /** * Returns the output for {@code @see} tags. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java index 01e7f01480dc6..f9286d532ce99 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java @@ -939,6 +939,12 @@ public Void visitReturn(ReturnTree tree, Void ignore) { if (foundReturn) { env.messages.warning(REFERENCE, tree, "dc.exists.return"); } + if (tree.isInline()) { + DocCommentTree dct = getCurrentPath().getDocComment(); + if (tree != dct.getFirstSentence().get(0)) { + env.messages.warning(REFERENCE, tree, "dc.return.not.first"); + } + } Element e = env.trees.getElement(env.currPath); if (e.getKind() != ElementKind.METHOD diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/resources/doclint.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/resources/doclint.properties index ed228bd2b6012..aa0881e502e8a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/resources/doclint.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/resources/doclint.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2020, 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,8 +57,9 @@ dc.no.alt.attr.for.image = no "alt" attribute for image dc.no.summary.or.caption.for.table=no summary or caption for table dc.param.name.not.found = @param name not found dc.ref.not.found = reference not found +dc.return.not.first = '{@return} not at beginning of description dc.service.not.found = service-type not found -dc.tag.code.within.code = '{@code'} within +dc.tag.code.within.code = '{@code} within dc.tag.empty = empty <{0}> tag dc.tag.a.within.a = {0} tag, which expands to , within dc.tag.end.not.permitted = invalid end tag: @@ -81,7 +82,7 @@ dc.tag.unknown = unknown tag: {0} dc.tag.not.supported = tag not supported in the generated HTML version: {0} dc.text.not.allowed = text not allowed in <{0}> element dc.unexpected.comment=documentation comment not expected here -dc.value.not.allowed.here='{@value}' not allowed here +dc.value.not.allowed.here='{@value} not allowed here dc.value.not.a.constant=value does not refer to a constant dc.main.ioerror=IO error: {0} diff --git a/test/langtools/jdk/internal/shellsupport/doc/JavadocFormatterTest.java b/test/langtools/jdk/internal/shellsupport/doc/JavadocFormatterTest.java index 043c7e9573245..02915f5cefc06 100644 --- a/test/langtools/jdk/internal/shellsupport/doc/JavadocFormatterTest.java +++ b/test/langtools/jdk/internal/shellsupport/doc/JavadocFormatterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -137,7 +137,7 @@ public void testReflow() { "1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" + "1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" + "1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234\n" + - "1234 1234 1234 1234 1234 1234 1234 1234 1234\n"; + "1234 1234 1234 1234 1234 1234 1234 1234 1234 \n"; if (!Objects.equals(actual, expected)) { throw new AssertionError("Incorrect output: " + actual); diff --git a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java index 6b33ab2c15fe7..ba6bf527149d1 100644 --- a/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java +++ b/test/langtools/jdk/javadoc/doclet/testReturnTag/TestReturnTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,39 +23,409 @@ /* * @test - * @bug 4490068 - * @summary Warn when a return tag is used on a method without a return type. - * @library ../../lib - * @modules jdk.javadoc/jdk.javadoc.internal.tool - * @build javadoc.tester.* + * @bug 4490068 8075778 + * @summary General tests for inline or block at-return tag + * @library /tools/lib ../../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build toolbox.ToolBox javadoc.tester.* * @run main TestReturnTag */ +import java.io.IOException; +import java.nio.file.Path; + import javadoc.tester.JavadocTester; +import toolbox.ToolBox; public class TestReturnTag extends JavadocTester { - /** - * Trigger warning message when return tag is used on a void method. - * - * @return I really don't return anything. - */ - public void method() {} - public static void main(String... args) throws Exception { TestReturnTag tester = new TestReturnTag(); - tester.runTests(); + tester.runTests(m -> new Object[] { Path.of(m.getName()) }); } - @Test - public void tests() { + ToolBox tb = new ToolBox(); + + @Test // 4490068 + public void testInvalidReturn(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * Trigger warning message when return tag is used on a void method. + * + * @return I really don't return anything. + */ + public void method() {} + } + """); + javadoc("-Xdoclint:none", - "-d", "out", - "-sourcepath", testSrc, - testSrc("TestReturnTag.java")); + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); checkExit(Exit.OK); checkOutput(Output.OUT, true, "warning - @return tag cannot be used in method with void return type."); } + + @Test + public void testBlock(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * First sentence. Second sentence. + * @return the result + */ + public int m() { return 0; } + } + """); + + javadoc("-Xdoclint:none", + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +

      +
      +
      Returns:
      +
      the result
      +
      + """); + } + + @Test + public void testInlineShort(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * {@return the result} + */ + public int m() { return 0; } + } + """); + + javadoc("-Xdoclint:none", + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      Returns the result.
      +
      +
      Returns:
      +
      the result
      +
      + """); + } + + @Test + public void testInlineLong(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * {@return the result} More text. + */ + public int m() { return 0; } + } + """); + + javadoc("-Xdoclint:none", + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      Returns the result. More text.
      +
      +
      Returns:
      +
      the result
      +
      + """); + } + + @Test + public void testInlineMarkup(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * {@return abc {@code def} ghi jkl} + */ + public int m() { return 0; } + } + """); + + javadoc("-Xdoclint:none", + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      Returns abc def ghi jkl.
      +
      +
      Returns:
      +
      abc def ghi jkl
      +
      + """); + } + + @Test + public void testBlockMarkup(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * @return abc {@code def} ghi jkl + */ + public int m() { return 0; } + } + """); + + javadoc("-Xdoclint:none", + "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      +
      Returns:
      +
      abc def ghi jkl
      +
      + """); + } + + @Test + public void testEmptyInline(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * {@return} + */ + public int m() { return 0; } + } + """); + + javadoc("-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput(Output.OUT, true, + "C.java:4: warning: no description for @return"); + + checkOutput("C.html", true, + """ +
      Returns .
      +
      +
      Returns:
      +
      + """); + } + + @Test + public void testInlineNotFirst(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * Some text. {@return the result} More text. + */ + public int m() { return 0; } + } + """); + + javadoc("-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput(Output.OUT, true, + "C.java:4: warning: {@return} not at beginning of description"); + + checkOutput("C.html", true, + """ +
      Some text. Returns the result. More text.
      + + """); + } + + @Test + public void testDuplicate(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class C { + /** + * {@return the result} More text. + * @return again + */ + public int m() { return 0; } + } + """); + + javadoc( "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput(Output.OUT, true, + "C.java:5: warning: @return has already been specified"); + + checkOutput("C.html", true, + """ +
      Returns the result. More text.
      +
      +
      Returns:
      +
      again
      + """); + } + + @Test + public void testSimpleInheritBlock(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class Super { + /** + * @return the result + */ + public int m() { return 0; } + } + """, + """ + /** Comment. */ + public class C extends Super { + @Override + public int m() { return 1; } + } + """); + + javadoc( "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      +
      Overrides:
      +
      m in class Super
      +
      Returns:
      +
      the result
      +
      + """); + } + + @Test + public void testSimpleInheritInline(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class Super { + /** + * {@return the result} + */ + public int m() { return 0; } + } + """, + """ + /** Comment. */ + public class C extends Super { + @Override + public int m() { return 1; } + } + """); + + javadoc( "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      Description copied from class: Super
      +
      Returns the result.
      +
      +
      Overrides:
      +
      m in class Super
      +
      Returns:
      +
      the result
      """); + } + + @Test + public void testPreferInlineOverInherit(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, + """ + /** Comment. */ + public class Super { + /** + * {@return the result} + */ + public int m() { return 0; } + } + """, + """ + /** Comment. */ + public class C extends Super { + /** + * {@return the overriding result} + */ + @Override + public int m() { return 1; } + } + """); + + javadoc( "-d", base.resolve("out").toString(), + "-sourcepath", src.toString(), + src.resolve("C.java").toString()); + checkExit(Exit.OK); + + checkOutput("C.html", true, + """ +
      Returns the overriding result.
      +
      +
      Overrides:
      +
      m in class Super
      +
      Returns:
      +
      the overriding result
      +
      + """); + } } diff --git a/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out b/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out index efcf3e20d7b16..a8a82d93cffcc 100644 --- a/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out +++ b/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out @@ -14,7 +14,7 @@ @param: block ........ ...... ....... type constructor method ..... ...... ........ @propertyDescription: block ........ ...... ....... .... ........... method field ...... ........ @provides: block ........ module ....... .... ........... ...... ..... ...... ........ - @return: block ........ ...... ....... .... ........... method ..... ...... ........ + @return: block ........ ...... ....... .... ........... method ..... inline ........ @see: block overview module package type constructor method field ...... ........ @serial: block ........ ...... package type ........... ...... field ...... ........ @serialData: block ........ ...... ....... .... ........... ...... ..... ...... ........ diff --git a/test/langtools/tools/doclint/EmptyHtmlTest.java b/test/langtools/tools/doclint/EmptyHtmlTest.java index 7b07fa588252e..f9df8c61cd309 100644 --- a/test/langtools/tools/doclint/EmptyHtmlTest.java +++ b/test/langtools/tools/doclint/EmptyHtmlTest.java @@ -102,6 +102,9 @@ void testInline(Path base, Class type) throws Exception { case "LiteralTree" -> test(d, type, "{@literal abc}"); + case "ReturnTree" -> + test(d, type, "{@return abc}"); + case "SummaryTree" -> test(d, type, "{@summary First sentence.}"); From 2a62d5d34f641abafe9cf7caca2320cf004fffdd Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 9 Dec 2020 02:37:30 +0000 Subject: [PATCH 145/504] 8256917: Use combo @returns tag in java.compiler javadoc Reviewed-by: jjg, iris --- .../processing/AbstractProcessor.java | 11 ++-- .../annotation/processing/Completion.java | 8 +-- .../annotation/processing/Completions.java | 8 +-- .../processing/ProcessingEnvironment.java | 45 +++++--------- .../annotation/processing/Processor.java | 6 +- .../processing/RoundEnvironment.java | 17 ++---- .../processing/SupportedAnnotationTypes.java | 5 +- .../processing/SupportedOptions.java | 5 +- .../processing/SupportedSourceVersion.java | 5 +- .../javax/lang/model/AnnotatedConstruct.java | 6 +- .../javax/lang/model/SourceVersion.java | 10 +--- .../lang/model/element/AnnotationMirror.java | 6 +- .../lang/model/element/AnnotationValue.java | 10 +--- .../javax/lang/model/element/Element.java | 16 ++--- .../lang/model/element/ExecutableElement.java | 31 +++------- .../lang/model/element/ModuleElement.java | 50 +++++----------- .../lang/model/element/PackageElement.java | 24 +++----- .../lang/model/element/QualifiedNameable.java | 6 +- .../model/element/RecordComponentElement.java | 8 +-- .../model/element/TypeParameterElement.java | 19 +++--- .../lang/model/element/VariableElement.java | 12 +--- .../javax/lang/model/type/ArrayType.java | 6 +- .../javax/lang/model/type/DeclaredType.java | 6 +- .../javax/lang/model/type/ExecutableType.java | 6 +- .../lang/model/type/IntersectionType.java | 6 +- .../javax/lang/model/type/TypeKind.java | 7 +-- .../javax/lang/model/type/TypeMirror.java | 4 +- .../javax/lang/model/type/TypeVariable.java | 10 +--- .../javax/lang/model/type/UnionType.java | 4 +- .../javax/lang/model/type/WildcardType.java | 8 +-- .../javax/lang/model/util/ElementFilter.java | 59 +++++++------------ .../javax/lang/model/util/Elements.java | 39 +++++------- .../classes/javax/lang/model/util/Types.java | 27 +++------ 33 files changed, 161 insertions(+), 329 deletions(-) diff --git a/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java b/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java index b1fe372ea01eb..1db32d48df9fd 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 abstract boolean process(Set annotations, RoundEnvironment roundEnv); /** - * Returns an empty iterable of completions. + * {@return an empty iterable of completions} * * @param element {@inheritDoc} * @param annotation {@inheritDoc} @@ -186,11 +186,8 @@ public Iterable getCompletions(Element element, } /** - * Returns {@code true} if this object has been {@linkplain #init - * initialized}, {@code false} otherwise. - * - * @return {@code true} if this object has been initialized, - * {@code false} otherwise. + * {@return {@code true} if this object has been {@linkplain #init + * initialized}, {@code false} otherwise} */ protected synchronized boolean isInitialized() { return initialized; diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Completion.java b/src/java.compiler/share/classes/javax/annotation/processing/Completion.java index 7df36b768bf61..58c158279d357 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Completion.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Completion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020, 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 @@ -38,14 +38,12 @@ public interface Completion { /** - * Returns the text of the suggested completion. - * @return the text of the suggested completion. + * {@return the text of the suggested completion} */ String getValue(); /** - * Returns an informative message about the completion. - * @return an informative message about the completion. + * {@return an informative message about the completion} */ String getMessage(); } diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Completions.java b/src/java.compiler/share/classes/javax/annotation/processing/Completions.java index 044ae20d503c2..8b7aa2916457b 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Completions.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Completions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020, 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 @@ -65,21 +65,19 @@ public String toString() { } /** - * Returns a completion of the value and message. + * {@return a completion of the value and message} * * @param value the text of the completion * @param message a message about the completion - * @return a completion of the provided value and message */ public static Completion of(String value, String message) { return new SimpleCompletion(value, message); } /** - * Returns a completion of the value and an empty message + * {@return a completion of the value and an empty message} * * @param value the text of the completion - * @return a completion of the value and an empty message */ public static Completion of(String value) { return new SimpleCompletion(value, ""); diff --git a/src/java.compiler/share/classes/javax/annotation/processing/ProcessingEnvironment.java b/src/java.compiler/share/classes/javax/annotation/processing/ProcessingEnvironment.java index 87beca3bfb357..6b1e3b57ce2b2 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/ProcessingEnvironment.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/ProcessingEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -60,8 +60,8 @@ */ public interface ProcessingEnvironment { /** - * Returns the processor-specific options passed to the annotation - * processing tool. Options are returned in the form of a map from + * {@return the processor-specific options passed to the annotation + * processing tool} Options are returned in the form of a map from * option name to option value. For an option with no value, the * corresponding value in the map is {@code null}. * @@ -74,61 +74,46 @@ public interface ProcessingEnvironment { * A given implementation may also provide implementation-specific * ways of finding options passed to the tool in addition to the * processor-specific options. - * - * @return the processor-specific options passed to the tool */ Map getOptions(); /** - * Returns the messager used to report errors, warnings, and other - * notices. - * - * @return the messager + * {@return the messager used to report errors, warnings, and other + * notices} */ Messager getMessager(); /** - * Returns the filer used to create new source, class, or auxiliary - * files. - * - * @return the filer + * {@return the filer used to create new source, class, or auxiliary + * files} */ Filer getFiler(); /** - * Returns an implementation of some utility methods for - * operating on elements - * - * @return element utilities + * {@return an implementation of some utility methods for + * operating on elements} */ Elements getElementUtils(); /** - * Returns an implementation of some utility methods for - * operating on types. - * - * @return type utilities + * {@return an implementation of some utility methods for + * operating on types} */ Types getTypeUtils(); /** - * Returns the source version that any generated {@linkplain + * {@return the source version that any generated {@linkplain * Filer#createSourceFile source} and {@linkplain - * Filer#createClassFile class} files should conform to. + * Filer#createClassFile class} files should conform to} * - * @return the source version to which generated source and class - * files should conform to * @see Processor#getSupportedSourceVersion */ SourceVersion getSourceVersion(); /** - * Returns the current locale or {@code null} if no locale is in - * effect. The locale can be be used to provide localized + * {@return the current locale or {@code null} if no locale is in + * effect} The locale can be be used to provide localized * {@linkplain Messager messages}. - * - * @return the current locale or {@code null} if no locale is in - * effect */ Locale getLocale(); diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Processor.java b/src/java.compiler/share/classes/javax/annotation/processing/Processor.java index 3533eca020b56..0b29faebaa953 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Processor.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Processor.java @@ -305,11 +305,9 @@ public interface Processor { Set getSupportedAnnotationTypes(); /** - * Returns the latest source version supported by this annotation - * processor. + * {@return the latest source version supported by this annotation + * processor} * - * @return the latest source version supported by this annotation - * processor. * @see javax.annotation.processing.SupportedSourceVersion * @see ProcessingEnvironment#getSourceVersion */ diff --git a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java index fe864298e22c2..4b63873a57016 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,22 +45,15 @@ */ public interface RoundEnvironment { /** - * Returns {@code true} if types generated by this round will not + * {@return {@code true} if types generated by this round will not * be subject to a subsequent round of annotation processing; - * returns {@code false} otherwise. - * - * @return {@code true} if types generated by this round will not - * be subject to a subsequent round of annotation processing; - * returns {@code false} otherwise + * returns {@code false} otherwise} */ boolean processingOver(); /** - * Returns {@code true} if an error was raised in the prior round - * of processing; returns {@code false} otherwise. - * - * @return {@code true} if an error was raised in the prior round - * of processing; returns {@code false} otherwise + * {@return {@code true} if an error was raised in the prior round + * of processing; returns {@code false} otherwise} */ boolean errorRaised(); diff --git a/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java b/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java index fe3ee8d158f05..e752bb53db8fb 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -48,8 +48,7 @@ @Retention(RUNTIME) public @interface SupportedAnnotationTypes { /** - * Returns the names of the supported annotation types. - * @return the names of the supported annotation types + * {@return the names of the supported annotation types} */ String [] value(); } diff --git a/src/java.compiler/share/classes/javax/annotation/processing/SupportedOptions.java b/src/java.compiler/share/classes/javax/annotation/processing/SupportedOptions.java index 3a9dd29d128ad..7f8817a011cc0 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/SupportedOptions.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/SupportedOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -47,8 +47,7 @@ @Retention(RUNTIME) public @interface SupportedOptions { /** - * Returns the supported options. - * @return the supported options + * {@return the supported options} */ String [] value(); } diff --git a/src/java.compiler/share/classes/javax/annotation/processing/SupportedSourceVersion.java b/src/java.compiler/share/classes/javax/annotation/processing/SupportedSourceVersion.java index 59c861ce152d4..18fa42075a83c 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/SupportedSourceVersion.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/SupportedSourceVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -48,8 +48,7 @@ @Retention(RUNTIME) public @interface SupportedSourceVersion { /** - * Returns the latest supported source version. - * @return the latest supported source version + * {@return the latest supported source version} */ SourceVersion value(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java b/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java index 196387062cb5c..e0df340275921 100644 --- a/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java +++ b/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java @@ -145,8 +145,8 @@ public interface AnnotatedConstruct { List getAnnotationMirrors(); /** - * Returns this construct's annotation of the specified type if - * such an annotation is present, else {@code null}. + * {@return this construct's annotation of the specified type if + * such an annotation is present, else {@code null}} * *

      The annotation returned by this method could contain an element * whose value is of type {@code Class}. @@ -176,8 +176,6 @@ public interface AnnotatedConstruct { * @param the annotation type * @param annotationType the {@code Class} object corresponding to * the annotation type - * @return this construct's annotation for the specified - * annotation type if present, else {@code null} * * @see #getAnnotationMirrors() * @see java.lang.reflect.AnnotatedElement#getAnnotation diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java index 10384b13d7e26..2399e411e2bc7 100644 --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java @@ -229,9 +229,7 @@ public enum SourceVersion { // behavior of latest() and latestSupported() must be updated too. /** - * Returns the latest source version that can be modeled. - * - * @return the latest source version that can be modeled + * {@return the latest source version that can be modeled} */ public static SourceVersion latest() { return RELEASE_16; @@ -254,8 +252,8 @@ private static SourceVersion getLatestSupported() { } /** - * Returns the latest source version fully supported by the - * current execution environment. {@code RELEASE_9} or later must + * {@return the latest source version fully supported by the + * current execution environment} {@code RELEASE_9} or later must * be returned. * * @apiNote This method is included alongside {@link latest} to @@ -272,8 +270,6 @@ private static SourceVersion getLatestSupported() { * current execution environment, the processor should only use * platform features up to the {@code latestSupported} release, * which may be earlier than the {@code latest} release. - * - * @return the latest source version that is fully supported */ public static SourceVersion latestSupported() { return latestSupported; diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java index c6bb2fc384eae..b59e190a5a769 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -44,9 +44,7 @@ public interface AnnotationMirror { /** - * Returns the type of this annotation. - * - * @return the type of this annotation + * {@return the type of this annotation} */ DeclaredType getAnnotationType(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java index 68b54210c61ed..2a39cab48492c 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,18 +45,14 @@ public interface AnnotationValue { /** - * Returns the value. - * - * @return the value + * {@return the value} */ Object getValue(); /** - * Returns a string representation of this value. + * {@return a string representation of this value} * This is returned in a form suitable for representing this value * in the source code of an annotation. - * - * @return a string representation of this value */ String toString(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/Element.java b/src/java.compiler/share/classes/javax/lang/model/element/Element.java index e90ad0102bf08..cbc4777ba6c36 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/Element.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/Element.java @@ -61,8 +61,7 @@ */ public interface Element extends javax.lang.model.AnnotatedConstruct { /** - * Returns the type defined by this element. - * @return the type defined by this element + * {@return the type defined by this element} * * @see Types * @see ExecutableElement#asType @@ -75,7 +74,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { TypeMirror asType(); /** - * Returns the {@code kind} of this element. + * {@return the {@code kind} of this element} * *

      - * - * @return the kind of this element */ ElementKind getKind(); @@ -128,7 +125,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { Set getModifiers(); /** - * Returns the simple (unqualified) name of this element. The + * {@return the simple (unqualified) name of this element} The * name of a generic type does not include any reference to its * formal type parameters. * @@ -150,7 +147,6 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * instance initializer}, an empty * name is returned. * - * @return the simple name of this element * @see PackageElement#getSimpleName * @see ExecutableElement#getSimpleName * @see TypeElement#getSimpleName @@ -239,8 +235,8 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { List getEnclosedElements(); /** - * Returns {@code true} if the argument represents the same - * element as {@code this}, or {@code false} otherwise. + * {@return {@code true} if the argument represents the same + * element as {@code this}, or {@code false} otherwise} * * @apiNote The identity of an element involves implicit state * not directly accessible from the element's methods, including @@ -252,8 +248,6 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * different class loaders. * * @param obj the object to be compared with this element - * @return {@code true} if the specified object represents the same - * element as this */ @Override boolean equals(Object obj); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java b/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java index 43c11d7a02d52..ff179e0781593 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java @@ -41,10 +41,8 @@ */ public interface ExecutableElement extends Element, Parameterizable { /** - * Returns the {@linkplain ExecutableType executable type} defined - * by this executable element. - * - * @return the executable type defined by this executable element + * {@return the {@linkplain ExecutableType executable type} defined + * by this executable element} * * @see ExecutableType */ @@ -61,12 +59,10 @@ public interface ExecutableElement extends Element, Parameterizable { List getTypeParameters(); /** - * Returns the return type of this executable. + * {@return the return type of this executable} * Returns a {@link NoType} with kind {@link TypeKind#VOID VOID} * if this executable is not a method, or is a method that does not * return a value. - * - * @return the return type of this executable */ TypeMirror getReturnType(); @@ -103,20 +99,14 @@ public interface ExecutableElement extends Element, Parameterizable { TypeMirror getReceiverType(); /** - * Returns {@code true} if this method or constructor accepts a variable - * number of arguments and returns {@code false} otherwise. - * - * @return {@code true} if this method or constructor accepts a variable - * number of arguments and {@code false} otherwise + * {@return {@code true} if this method or constructor accepts a variable + * number of arguments and returns {@code false} otherwise} */ boolean isVarArgs(); /** - * Returns {@code true} if this method is a default method and - * returns {@code false} otherwise. - * - * @return {@code true} if this method is a default method and - * {@code false} otherwise + * {@return {@code true} if this method is a default method and + * returns {@code false} otherwise} * @since 1.8 */ boolean isDefault(); @@ -142,15 +132,12 @@ public interface ExecutableElement extends Element, Parameterizable { AnnotationValue getDefaultValue(); /** - * Returns the simple name of a constructor, method, or - * initializer. For a constructor, the name {@code ""} is + * {@return the simple name of a constructor, method, or + * initializer} For a constructor, the name {@code ""} is * returned, for a static initializer, the name {@code ""} * is returned, and for an anonymous class or instance * initializer, an empty name is * returned. - * - * @return the simple name of a constructor, method, or - * initializer */ @Override Name getSimpleName(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java index aec00f1f26af6..31b9dbd632561 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ModuleElement.java @@ -38,9 +38,8 @@ */ public interface ModuleElement extends Element, QualifiedNameable { /** - * Returns a {@linkplain javax.lang.model.type.NoType pseudo-type} - * for this module. - * @return a pseudo-type for this module + * {@return a {@linkplain javax.lang.model.type.NoType pseudo-type} + * for this module} * * @see javax.lang.model.type.NoType * @see javax.lang.model.type.TypeKind#MODULE @@ -87,27 +86,20 @@ public interface ModuleElement extends Element, QualifiedNameable { Name getSimpleName(); /** - * Returns the packages within this module. - * @return the packages within this module + * {@return the packages within this module} */ @Override List getEnclosedElements(); /** - * Returns {@code true} if this is an open module and {@code - * false} otherwise. - * - * @return {@code true} if this is an open module and {@code - * false} otherwise + * {@return {@code true} if this is an open module and {@code + * false} otherwise} */ boolean isOpen(); /** - * Returns {@code true} if this is an unnamed module and {@code - * false} otherwise. - * - * @return {@code true} if this is an unnamed module and {@code - * false} otherwise + * {@return {@code true} if this is an unnamed module and {@code + * false} otherwise} * * @jls 7.7.5 Unnamed Modules */ @@ -159,7 +151,7 @@ enum DirectiveKind { */ interface Directive { /** - * Returns the {@code kind} of this directive. + * {@return the {@code kind} of this directive} *
        * *
      • The kind of a {@linkplain RequiresDirective requires @@ -178,8 +170,6 @@ interface Directive { * directive} is {@link DirectiveKind#PROVIDES PROVIDES}. * *
      - * - * @return the kind of this directive */ DirectiveKind getKind(); @@ -310,20 +300,17 @@ default R visitUnknown(Directive d, P p) { */ interface RequiresDirective extends Directive { /** - * Returns whether or not this is a static dependency. - * @return whether or not this is a static dependency + * {@return whether or not this is a static dependency} */ boolean isStatic(); /** - * Returns whether or not this is a transitive dependency. - * @return whether or not this is a transitive dependency + * {@return whether or not this is a transitive dependency} */ boolean isTransitive(); /** - * Returns the module that is required - * @return the module that is required + * {@return the module that is required} */ ModuleElement getDependency(); } @@ -335,8 +322,7 @@ interface RequiresDirective extends Directive { interface ExportsDirective extends Directive { /** - * Returns the package being exported. - * @return the package being exported + * {@return the package being exported} */ PackageElement getPackage(); @@ -356,8 +342,7 @@ interface ExportsDirective extends Directive { interface OpensDirective extends Directive { /** - * Returns the package being opened. - * @return the package being opened + * {@return the package being opened} */ PackageElement getPackage(); @@ -376,14 +361,12 @@ interface OpensDirective extends Directive { */ interface ProvidesDirective extends Directive { /** - * Returns the service being provided. - * @return the service being provided + * {@return the service being provided} */ TypeElement getService(); /** - * Returns the implementations of the service being provided. - * @return the implementations of the service being provided + * {@return the implementations of the service being provided} */ List getImplementations(); } @@ -394,8 +377,7 @@ interface ProvidesDirective extends Directive { */ interface UsesDirective extends Directive { /** - * Returns the service that is used. - * @return the service that is used + * {@return the service that is used} */ TypeElement getService(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java b/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java index ef2b3c81b007a..42d62cb289c34 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/PackageElement.java @@ -40,9 +40,8 @@ */ public interface PackageElement extends Element, QualifiedNameable { /** - * Returns a {@linkplain javax.lang.model.type.NoType pseudo-type} - * for this package. - * @return a pseudo-type for this package + * {@return a {@linkplain javax.lang.model.type.NoType pseudo-type} + * for this package} * * @see javax.lang.model.type.NoType * @see javax.lang.model.type.TypeKind#PACKAGE @@ -81,30 +80,25 @@ public interface PackageElement extends Element, QualifiedNameable { Name getSimpleName(); /** - * Returns the {@linkplain NestingKind#TOP_LEVEL top-level} - * classes and interfaces within this package. Note that + * {@return the {@linkplain NestingKind#TOP_LEVEL top-level} + * classes and interfaces within this package} Note that * subpackages are not considered to be enclosed by a * package. - * - * @return the top-level classes and interfaces within this - * package */ @Override List getEnclosedElements(); /** - * Returns {@code true} if this is an unnamed package and {@code - * false} otherwise. + * {@return {@code true} if this is an unnamed package and {@code + * false} otherwise} * - * @return {@code true} if this is an unnamed package and {@code - * false} otherwise * @jls 7.4.2 Unnamed Packages */ boolean isUnnamed(); /** - * Returns the enclosing module if such a module exists; otherwise - * returns {@code null}. + * {@return the enclosing module if such a module exists; otherwise + * {@code null}} * * One situation where a module does not exist for a package is if * the environment does not include modules, such as an annotation @@ -112,8 +106,6 @@ public interface PackageElement extends Element, QualifiedNameable { * javax.annotation.processing.ProcessingEnvironment#getSourceVersion * source version} without modules. * - * @return the enclosing module or {@code null} if no such module exists - * * @revised 9 */ @Override diff --git a/src/java.compiler/share/classes/javax/lang/model/element/QualifiedNameable.java b/src/java.compiler/share/classes/javax/lang/model/element/QualifiedNameable.java index 5a540b7ea0c71..fe7663aa578b1 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/QualifiedNameable.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/QualifiedNameable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2020, 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,9 +33,7 @@ */ public interface QualifiedNameable extends Element { /** - * Returns the fully qualified name of an element. - * - * @return the fully qualified name of an element + * {@return the fully qualified name of an element} */ Name getQualifiedName(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java index c4e781baadebf..c9bb58dd05dc7 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java @@ -32,24 +32,20 @@ */ public interface RecordComponentElement extends Element { /** - * Returns the enclosing element of this record component. + * {@return the enclosing element of this record component} * * The enclosing element of a record component is the type * declaring the record component. - * - * @return the enclosing element of this record component */ @Override Element getEnclosingElement(); /** - * Returns the simple name of this record component. + * {@return the simple name of this record component} * *

      The name of each record component must be distinct from the * names of all other record components of the same record. * - * @return the simple name of this record component - * * @jls 6.2 Names and Identifiers */ @Override diff --git a/src/java.compiler/share/classes/javax/lang/model/element/TypeParameterElement.java b/src/java.compiler/share/classes/javax/lang/model/element/TypeParameterElement.java index 4adbebbd7ada6..bd8e0a3d1f6dc 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/TypeParameterElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/TypeParameterElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,21 +42,17 @@ */ public interface TypeParameterElement extends Element { /** - * Returns the {@linkplain TypeVariable type variable} corresponding to this type parameter element. + * {@return the {@linkplain TypeVariable type variable} + * corresponding to this type parameter element} * * @see TypeVariable - * - * @return the type variable corresponding to this type parameter element */ @Override TypeMirror asType(); /** - * Returns the generic class, interface, method, or constructor that is - * parameterized by this type parameter. - * - * @return the generic class, interface, method, or constructor that is - * parameterized by this type parameter + * {@return the generic class, interface, method, or constructor that is + * parameterized by this type parameter} */ Element getGenericElement(); @@ -73,9 +69,8 @@ public interface TypeParameterElement extends Element { List getBounds(); /** - * Returns the {@linkplain TypeParameterElement#getGenericElement generic element} of this type parameter. - * - * @return the generic element of this type parameter + * {@return the {@linkplain TypeParameterElement#getGenericElement + * generic element} of this type parameter} */ @Override Element getEnclosingElement(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java index 3527898dfe474..ac7a949d9bbea 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java @@ -41,14 +41,12 @@ */ public interface VariableElement extends Element { /** - * Returns the type of this variable. + * {@return the type of this variable} * * Note that the types of variables range over {@linkplain * TypeKind many kinds} of types, including primitive types, * declared types, and array types, among others. * - * @return the type of this variable - * * @see TypeKind */ @Override @@ -79,26 +77,22 @@ public interface VariableElement extends Element { Object getConstantValue(); /** - * Returns the simple name of this variable element. + * {@return the simple name of this variable element} * *

      For method and constructor parameters, the name of each * parameter must be distinct from the names of all other * parameters of the same executable. If the original source * names are not available, an implementation may synthesize names * subject to the distinctness requirement above. - * - * @return the simple name of this variable element */ @Override Name getSimpleName(); /** - * Returns the enclosing element of this variable. + * {@return the enclosing element of this variable} * * The enclosing element of a method or constructor parameter is * the executable declaring the parameter. - * - * @return the enclosing element of this variable */ @Override Element getEnclosingElement(); diff --git a/src/java.compiler/share/classes/javax/lang/model/type/ArrayType.java b/src/java.compiler/share/classes/javax/lang/model/type/ArrayType.java index 85a540508ad86..ac8c96c55f40a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/ArrayType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/ArrayType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -39,9 +39,7 @@ public interface ArrayType extends ReferenceType { /** - * Returns the component type of this array type. - * - * @return the component type of this array type + * {@return the component type of this array type} */ TypeMirror getComponentType(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/type/DeclaredType.java b/src/java.compiler/share/classes/javax/lang/model/type/DeclaredType.java index 80f6cd5be8c32..3f6857049b820 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/DeclaredType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/DeclaredType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -58,9 +58,7 @@ public interface DeclaredType extends ReferenceType { /** - * Returns the element corresponding to this type. - * - * @return the element corresponding to this type + * {@return the element corresponding to this type} */ Element asElement(); diff --git a/src/java.compiler/share/classes/javax/lang/model/type/ExecutableType.java b/src/java.compiler/share/classes/javax/lang/model/type/ExecutableType.java index d7ad743d5af85..f711ebcb79b7e 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/ExecutableType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/ExecutableType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,12 +59,10 @@ public interface ExecutableType extends TypeMirror { List getTypeVariables(); /** - * Returns the return type of this executable. + * {@return the return type of this executable} * Returns a {@link NoType} with kind {@link TypeKind#VOID VOID} * if this executable is not a method, or is a method that does not * return a value. - * - * @return the return type of this executable */ TypeMirror getReturnType(); diff --git a/src/java.compiler/share/classes/javax/lang/model/type/IntersectionType.java b/src/java.compiler/share/classes/javax/lang/model/type/IntersectionType.java index 359200d961e95..98b50a5b988cb 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/IntersectionType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/IntersectionType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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,9 +45,7 @@ public interface IntersectionType extends TypeMirror { /** - * Return the bounds comprising this intersection type. - * - * @return the bounds of this intersection type + * {@return the bounds comprising this intersection type} */ List getBounds(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java b/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java index 34fe240ba30b9..cd6ece8393934 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/TypeKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -161,9 +161,8 @@ public enum TypeKind { MODULE; /** - * Returns {@code true} if this kind corresponds to a primitive - * type and {@code false} otherwise. - * @return {@code true} if this kind corresponds to a primitive type + * {@return {@code true} if this kind corresponds to a primitive + * type and {@code false} otherwise} */ public boolean isPrimitive() { switch(this) { diff --git a/src/java.compiler/share/classes/javax/lang/model/type/TypeMirror.java b/src/java.compiler/share/classes/javax/lang/model/type/TypeMirror.java index f8881f7b04a50..08d7f6fcacad7 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/TypeMirror.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/TypeMirror.java @@ -68,7 +68,7 @@ public interface TypeMirror extends javax.lang.model.AnnotatedConstruct { /** - * Returns the {@code kind} of this type. + * {@return the {@code kind} of this type} * *

        * @@ -109,8 +109,6 @@ public interface TypeMirror extends javax.lang.model.AnnotatedConstruct { * type} is {@link TypeKind#INTERSECTION INTERSECTION}. * *
      - * - * @return the kind of this type */ TypeKind getKind(); diff --git a/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java b/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java index 47d29bd3c0ab7..fbb06d6693443 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java @@ -51,14 +51,12 @@ public interface TypeVariable extends ReferenceType { /** - * Returns the element corresponding to this type variable. - * - * @return the element corresponding to this type variable + * {@return the element corresponding to this type variable} */ Element asElement(); /** - * Returns the upper bound of this type variable. + * {@return the upper bound of this type variable} * *

      If this type variable was declared with no explicit * upper bounds, the result is {@code java.lang.Object}. @@ -67,19 +65,17 @@ public interface TypeVariable extends ReferenceType { * individual bounds can be found by examining the result's * {@linkplain IntersectionType#getBounds() bounds}. * - * @return the upper bound of this type variable * @jls 4.9 Intersection Types */ TypeMirror getUpperBound(); /** - * Returns the lower bound of this type variable. While a type + * {@return the lower bound of this type variable} While a type * parameter cannot include an explicit lower bound declaration, * capture conversion can produce a type variable with a * non-trivial lower bound. Type variables otherwise have a * lower bound of {@link NullType}. * - * @return the lower bound of this type variable * @jls 18.1.3. Bounds */ TypeMirror getLowerBound(); diff --git a/src/java.compiler/share/classes/javax/lang/model/type/UnionType.java b/src/java.compiler/share/classes/javax/lang/model/type/UnionType.java index d33d696b384c7..a7eb2c6af05b8 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/UnionType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/UnionType.java @@ -39,9 +39,7 @@ public interface UnionType extends TypeMirror { /** - * Return the alternatives comprising this union type. - * - * @return the alternatives comprising this union type. + * {@return the alternatives comprising this union type} */ List getAlternatives(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java b/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java index f6d091c8d0089..ee1d0dac5553c 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java @@ -47,20 +47,16 @@ public interface WildcardType extends TypeMirror { /** - * Returns the upper bound of this wildcard. + * {@return the upper bound of this wildcard} * If no upper bound is explicitly declared, * {@code null} is returned. - * - * @return the upper bound of this wildcard */ TypeMirror getExtendsBound(); /** - * Returns the lower bound of this wildcard. + * {@return the lower bound of this wildcard} * If no lower bound is explicitly declared, * {@code null} is returned. - * - * @return the lower bound of this wildcard */ TypeMirror getSuperBound(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java index 270074f0d52c3..b410d811ff7b1 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -92,8 +92,7 @@ private ElementFilter() {} // Do not instantiate. Set.of(ElementKind.RECORD_COMPONENT); /** - * Returns a list of fields in {@code elements}. - * @return a list of fields in {@code elements} + * {@return a list of fields in {@code elements}} * @param elements the elements to filter */ public static List @@ -102,8 +101,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of fields in {@code elements}. - * @return a set of fields in {@code elements} + * {@return a set of fields in {@code elements}} * @param elements the elements to filter */ public static Set @@ -112,8 +110,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of record components in {@code elements}. - * @return a list of record components in {@code elements} + * {@return a list of record components in {@code elements}} * @param elements the elements to filter * @since 16 */ @@ -123,8 +120,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of record components in {@code elements}. - * @return a set of record components in {@code elements} + * {@return a set of record components in {@code elements}} * @param elements the elements to filter * @since 16 */ @@ -134,8 +130,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of constructors in {@code elements}. - * @return a list of constructors in {@code elements} + * {@return a list of constructors in {@code elements}} * @param elements the elements to filter */ public static List @@ -144,8 +139,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of constructors in {@code elements}. - * @return a set of constructors in {@code elements} + * {@return a set of constructors in {@code elements}} * @param elements the elements to filter */ public static Set @@ -154,8 +148,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of methods in {@code elements}. - * @return a list of methods in {@code elements} + * {@return a list of methods in {@code elements}} * @param elements the elements to filter */ public static List @@ -164,8 +157,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of methods in {@code elements}. - * @return a set of methods in {@code elements} + * {@return a set of methods in {@code elements}} * @param elements the elements to filter */ public static Set @@ -174,8 +166,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of types in {@code elements}. - * @return a list of types in {@code elements} + * {@return a list of types in {@code elements}} * @param elements the elements to filter */ public static List @@ -184,8 +175,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of types in {@code elements}. - * @return a set of types in {@code elements} + * {@return a set of types in {@code elements}} * @param elements the elements to filter */ public static Set @@ -194,8 +184,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of packages in {@code elements}. - * @return a list of packages in {@code elements} + * {@return a list of packages in {@code elements}} * @param elements the elements to filter */ public static List @@ -204,8 +193,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of packages in {@code elements}. - * @return a set of packages in {@code elements} + * {@return a set of packages in {@code elements}} * @param elements the elements to filter */ public static Set @@ -214,8 +202,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a list of modules in {@code elements}. - * @return a list of modules in {@code elements} + * {@return a list of modules in {@code elements}} * @param elements the elements to filter * @since 9 */ @@ -225,8 +212,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * Returns a set of modules in {@code elements}. - * @return a set of modules in {@code elements} + * {@return a set of modules in {@code elements}} * @param elements the elements to filter * @since 9 */ @@ -261,8 +247,7 @@ private static Set setFilter(Set eleme } /** - * Returns a list of {@code exports} directives in {@code directives}. - * @return a list of {@code exports} directives in {@code directives} + * {@return a list of {@code exports} directives in {@code directives}} * @param directives the directives to filter * @since 9 */ @@ -272,8 +257,7 @@ private static Set setFilter(Set eleme } /** - * Returns a list of {@code opens} directives in {@code directives}. - * @return a list of {@code opens} directives in {@code directives} + * {@return a list of {@code opens} directives in {@code directives}} * @param directives the directives to filter * @since 9 */ @@ -283,8 +267,7 @@ private static Set setFilter(Set eleme } /** - * Returns a list of {@code provides} directives in {@code directives}. - * @return a list of {@code provides} directives in {@code directives} + * {@return a list of {@code provides} directives in {@code directives}} * @param directives the directives to filter * @since 9 */ @@ -294,8 +277,7 @@ private static Set setFilter(Set eleme } /** - * Returns a list of {@code requires} directives in {@code directives}. - * @return a list of {@code requires} directives in {@code directives} + * {@return a list of {@code requires} directives in {@code directives}} * @param directives the directives to filter * @since 9 */ @@ -305,8 +287,7 @@ private static Set setFilter(Set eleme } /** - * Returns a list of {@code uses} directives in {@code directives}. - * @return a list of {@code uses} directives in {@code directives} + * {@return a list of {@code uses} directives in {@code directives}} * @param directives the directives to filter * @since 9 */ diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java index 95cb8263afa07..ebc078bb31272 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java @@ -266,11 +266,10 @@ default Set getAllModuleElements() { } /** - * Returns the values of an annotation's elements, including defaults. + * {@return the values of an annotation's elements, including defaults} * * @see AnnotationMirror#getElementValues() * @param a annotation to examine - * @return the values of the annotation's elements, including defaults */ Map getElementValuesWithDefaults(AnnotationMirror a); @@ -302,15 +301,14 @@ default Set getAllModuleElements() { String getDocComment(Element e); /** - * Returns {@code true} if the element is deprecated, {@code false} otherwise. + * {@return {@code true} if the element is deprecated, {@code false} otherwise} * * @param e the element being examined - * @return {@code true} if the element is deprecated, {@code false} otherwise */ boolean isDeprecated(Element e); /** - * Returns the origin of the given element. + * {@return the origin of the given element} * *

      Note that if this method returns {@link Origin#EXPLICIT * EXPLICIT} and the element was created from a class file, then @@ -326,7 +324,6 @@ default Set getAllModuleElements() { * {@link Origin#EXPLICIT EXPLICIT}. * * @param e the element being examined - * @return the origin of the given element * @since 9 */ default Origin getOrigin(Element e) { @@ -334,7 +331,7 @@ default Origin getOrigin(Element e) { } /** - * Returns the origin of the given annotation mirror. + * {@return the origin of the given annotation mirror} * * An annotation mirror is {@linkplain Origin#MANDATED mandated} * if it is an implicitly declared container annotation @@ -356,7 +353,6 @@ default Origin getOrigin(Element e) { * * @param c the construct the annotation mirror modifies * @param a the annotation mirror being examined - * @return the origin of the given annotation mirror * @jls 9.6.3 Repeatable Annotation Types * @jls 9.7.5 Multiple Annotations of the Same Type * @since 9 @@ -367,7 +363,7 @@ default Origin getOrigin(AnnotatedConstruct c, } /** - * Returns the origin of the given module directive. + * {@return the origin of the given module directive} * *

      Note that if this method returns {@link Origin#EXPLICIT * EXPLICIT} and the module directive was created from a class @@ -390,7 +386,6 @@ default Origin getOrigin(AnnotatedConstruct c, * * @param m the module of the directive * @param directive the module directive being examined - * @return the origin of the given directive * @since 9 */ default Origin getOrigin(ModuleElement m, @@ -457,14 +452,12 @@ public boolean isDeclared() { } /** - * Returns {@code true} if the executable element is a bridge - * method, {@code false} otherwise. + * {@return {@code true} if the executable element is a bridge + * method, {@code false} otherwise} * * @implSpec The default implementation of this method returns {@code false}. * * @param e the executable being examined - * @return {@code true} if the executable element is a bridge - * method, {@code false} otherwise * @since 9 */ default boolean isBridge(ExecutableElement e) { @@ -472,10 +465,9 @@ default boolean isBridge(ExecutableElement e) { } /** - * Returns the binary name of a type element. + * {@return the binary name of a type element} * * @param type the type element being examined - * @return the binary name * * @see TypeElement#getQualifiedName * @jls 13.1 The Form of a Binary @@ -484,7 +476,7 @@ default boolean isBridge(ExecutableElement e) { /** - * Returns the package of an element. The package of a package is + * {@return the package of an element} The package of a package is * itself. * The package of a module is {@code null}. * @@ -494,12 +486,11 @@ default boolean isBridge(ExecutableElement e) { * {@linkplain Element#getEnclosingElement enclosing element}. * * @param e the element being examined - * @return the package of an element */ PackageElement getPackageOf(Element e); /** - * Returns the module of an element. The module of a module is + * {@return the module of an element} The module of a module is * itself. * * If a package has a module as its {@linkplain @@ -522,7 +513,6 @@ default boolean isBridge(ExecutableElement e) { * {@code null}. * * @param e the element being examined - * @return the module of an element * @since 9 */ default ModuleElement getModuleOf(Element e) { @@ -649,19 +639,18 @@ boolean overrides(ExecutableElement overrider, ExecutableElement overridden, void printElements(java.io.Writer w, Element... elements); /** - * Return a name with the same sequence of characters as the - * argument. + * {@return a name with the same sequence of characters as the + * argument} * * @param cs the character sequence to return as a name - * @return a name with the same sequence of characters as the argument */ Name getName(CharSequence cs); /** - * Returns {@code true} if the type element is a functional interface, {@code false} otherwise. + * {@return {@code true} if the type element is a functional + * interface, {@code false} otherwise} * * @param type the type element being examined - * @return {@code true} if the element is a functional interface, {@code false} otherwise * @jls 9.8 Functional Interfaces * @since 1.8 */ diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Types.java b/src/java.compiler/share/classes/javax/lang/model/util/Types.java index 9f41a57b0bae2..cd1fe050ec5b4 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Types.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Types.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -145,21 +145,19 @@ public interface Types { List directSupertypes(TypeMirror t); /** - * Returns the erasure of a type. + * {@return the erasure of a type} * * @param t the type to be erased - * @return the erasure of the given type * @throws IllegalArgumentException if given a type for a package or module * @jls 4.6 Type Erasure */ TypeMirror erasure(TypeMirror t); /** - * Returns the class of a boxed value of a given primitive type. + * {@return the class of a boxed value of the primitive type argument} * That is, boxing conversion is applied. * * @param p the primitive type to be converted - * @return the class of a boxed value of type {@code p} * @jls 5.1.7 Boxing Conversion */ TypeElement boxedClass(PrimitiveType p); @@ -187,18 +185,15 @@ public interface Types { TypeMirror capture(TypeMirror t); /** - * Returns a primitive type. + * {@return a primitive type} * * @param kind the kind of primitive type to return - * @return a primitive type * @throws IllegalArgumentException if {@code kind} is not a primitive kind */ PrimitiveType getPrimitiveType(TypeKind kind); /** - * Returns the null type. This is the type of {@code null}. - * - * @return the null type + * {@return the null type} This is the type of {@code null}. */ NullType getNullType(); @@ -222,30 +217,28 @@ public interface Types { NoType getNoType(TypeKind kind); /** - * Returns an array type with the specified component type. + * {@return an array type with the specified component type} * * @param componentType the component type - * @return an array type with the specified component type. * @throws IllegalArgumentException if the component type is not valid for * an array */ ArrayType getArrayType(TypeMirror componentType); /** - * Returns a new wildcard type argument. Either of the wildcard's + * {@return a new wildcard type} Either of the wildcard's * bounds may be specified, or neither, but not both. * * @param extendsBound the extends (upper) bound, or {@code null} if none * @param superBound the super (lower) bound, or {@code null} if none - * @return a new wildcard * @throws IllegalArgumentException if bounds are not valid */ WildcardType getWildcardType(TypeMirror extendsBound, TypeMirror superBound); /** - * Returns the type corresponding to a type element and - * actual type arguments. + * {@return the type corresponding to a type element and + * actual type arguments} * Given the type element for {@code Set} and the type mirror * for {@code String}, * for example, this method may be used to get the @@ -265,8 +258,6 @@ WildcardType getWildcardType(TypeMirror extendsBound, * * @param typeElem the type element * @param typeArgs the actual type arguments - * @return the type corresponding to the type element and - * actual type arguments * @throws IllegalArgumentException if too many or too few * type arguments are given, or if an inappropriate type * argument or type element is provided From 10da767c2fd29bbaa00d33083d90e09e4fd34ec9 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 9 Dec 2020 04:28:59 +0000 Subject: [PATCH 146/504] 8257847: Tiered should publish MDO data pointer for interpreter after profile start Reviewed-by: thartmann, kvn, dlong --- .../share/compiler/tieredThresholdPolicy.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/compiler/tieredThresholdPolicy.cpp b/src/hotspot/share/compiler/tieredThresholdPolicy.cpp index a0a0c4d5401bb..b72d604e1d51f 100644 --- a/src/hotspot/share/compiler/tieredThresholdPolicy.cpp +++ b/src/hotspot/share/compiler/tieredThresholdPolicy.cpp @@ -790,7 +790,7 @@ bool TieredThresholdPolicy::is_mature(Method* method) { // start profiling without waiting for the compiled method to arrive. // We also take the load on compilers into the account. bool TieredThresholdPolicy::should_create_mdo(const methodHandle& method, CompLevel cur_level) { - if (cur_level != CompLevel_none || force_comp_at_level_simple(method)) { + if (cur_level != CompLevel_none || force_comp_at_level_simple(method) || !ProfileInterpreter) { return false; } int i = method->invocation_count(); @@ -826,6 +826,18 @@ void TieredThresholdPolicy::create_mdo(const methodHandle& mh, Thread* THREAD) { if (mh->method_data() == NULL) { Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR); } + if (ProfileInterpreter) { + MethodData* mdo = mh->method_data(); + if (mdo != NULL) { + JavaThread* jt = THREAD->as_Java_thread(); + frame last_frame = jt->last_frame(); + if (last_frame.is_interpreted_frame() && mh == last_frame.interpreter_frame_method()) { + int bci = last_frame.interpreter_frame_bci(); + address dp = mdo->bci_to_dp(bci); + last_frame.interpreter_frame_set_mdp(dp); + } + } + } } From 9ce3d806faaa69d954a9e7a9f99f6f296ab0b7ef Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 9 Dec 2020 06:42:38 +0000 Subject: [PATCH 147/504] 8257887: java/foreign/TestSegments.java test fails on 32-bit after JDK-8257186 Reviewed-by: jiefu, adityam, redestad --- test/jdk/java/foreign/TestSegments.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/java/foreign/TestSegments.java b/test/jdk/java/foreign/TestSegments.java index 9568830683bbc..70521378ffb77 100644 --- a/test/jdk/java/foreign/TestSegments.java +++ b/test/jdk/java/foreign/TestSegments.java @@ -23,6 +23,7 @@ /* * @test + * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" * @run testng/othervm -Xmx4G -XX:MaxDirectMemorySize=1M TestSegments */ From 79f1dfb8d3941377da77e73f7bbab93baef29b8e Mon Sep 17 00:00:00 2001 From: Per Liden Date: Wed, 9 Dec 2020 07:46:04 +0000 Subject: [PATCH 148/504] 8255987: JDI tests fail with com.sun.jdi.ObjectCollectedException Reviewed-by: dholmes, cjplummer --- .../share/native/libjdwp/commonRef.c | 144 ++++++++++++++---- .../share/native/libjdwp/commonRef.h | 4 +- .../share/native/libjdwp/threadControl.c | 11 ++ .../share/native/libjdwp/util.h | 3 +- .../ArrayType/newInstance/newinstance004.java | 19 ++- .../instances/instances002/instances002.java | 2 + .../VMOutOfMemoryException001.java | 9 +- .../nsk/share/jdi/sde/SDEDebuggee.java | 9 +- 8 files changed, 168 insertions(+), 33 deletions(-) diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c index 2a8f55014d965..054b736e46b27 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, 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,8 +87,9 @@ static RefNode * createNode(JNIEnv *env, jobject ref) { RefNode *node; - jobject weakRef; + jobject strongOrWeakRef; jvmtiError error; + jboolean pin = gdata->pinAllCount != 0; /* Could allocate RefNode's in blocks, not sure it would help much */ node = (RefNode*)jvmtiAllocate((int)sizeof(RefNode)); @@ -96,29 +97,39 @@ createNode(JNIEnv *env, jobject ref) return NULL; } - /* Create weak reference to make sure we have a reference */ - weakRef = JNI_FUNC_PTR(env,NewWeakGlobalRef)(env, ref); - // NewWeakGlobalRef can throw OOM, clear exception here. - if ((*env)->ExceptionCheck(env)) { - (*env)->ExceptionClear(env); - jvmtiDeallocate(node); - return NULL; + if (pin) { + /* Create strong reference to make sure we have a reference */ + strongOrWeakRef = JNI_FUNC_PTR(env,NewGlobalRef)(env, ref); + } else { + /* Create weak reference to make sure we have a reference */ + strongOrWeakRef = JNI_FUNC_PTR(env,NewWeakGlobalRef)(env, ref); + + // NewWeakGlobalRef can throw OOM, clear exception here. + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + jvmtiDeallocate(node); + return NULL; + } } - /* Set tag on weakRef */ + /* Set tag on strongOrWeakRef */ error = JVMTI_FUNC_PTR(gdata->jvmti, SetTag) - (gdata->jvmti, weakRef, ptr_to_jlong(node)); + (gdata->jvmti, strongOrWeakRef, ptr_to_jlong(node)); if ( error != JVMTI_ERROR_NONE ) { - JNI_FUNC_PTR(env,DeleteWeakGlobalRef)(env, weakRef); + if (pin) { + JNI_FUNC_PTR(env,DeleteGlobalRef)(env, strongOrWeakRef); + } else { + JNI_FUNC_PTR(env,DeleteWeakGlobalRef)(env, strongOrWeakRef); + } jvmtiDeallocate(node); return NULL; } /* Fill in RefNode */ - node->ref = weakRef; - node->isStrong = JNI_FALSE; - node->count = 1; - node->seqNum = newSeqNum(); + node->ref = strongOrWeakRef; + node->count = 1; + node->strongCount = pin ? 1 : 0; + node->seqNum = newSeqNum(); /* Count RefNode's created */ gdata->objectsByIDcount++; @@ -135,7 +146,7 @@ deleteNode(JNIEnv *env, RefNode *node) /* Clear tag */ (void)JVMTI_FUNC_PTR(gdata->jvmti,SetTag) (gdata->jvmti, node->ref, NULL_OBJECT_ID); - if (node->isStrong) { + if (node->strongCount != 0) { JNI_FUNC_PTR(env,DeleteGlobalRef)(env, node->ref); } else { JNI_FUNC_PTR(env,DeleteWeakGlobalRef)(env, node->ref); @@ -149,7 +160,7 @@ deleteNode(JNIEnv *env, RefNode *node) static jobject strengthenNode(JNIEnv *env, RefNode *node) { - if (!node->isStrong) { + if (node->strongCount == 0) { jobject strongRef; strongRef = JNI_FUNC_PTR(env,NewGlobalRef)(env, node->ref); @@ -164,11 +175,12 @@ strengthenNode(JNIEnv *env, RefNode *node) } if (strongRef != NULL) { JNI_FUNC_PTR(env,DeleteWeakGlobalRef)(env, node->ref); - node->ref = strongRef; - node->isStrong = JNI_TRUE; + node->ref = strongRef; + node->strongCount = 1; } return strongRef; } else { + node->strongCount++; return node->ref; } } @@ -177,7 +189,7 @@ strengthenNode(JNIEnv *env, RefNode *node) static jweak weakenNode(JNIEnv *env, RefNode *node) { - if (node->isStrong) { + if (node->strongCount == 1) { jweak weakRef; weakRef = JNI_FUNC_PTR(env,NewWeakGlobalRef)(env, node->ref); @@ -188,11 +200,12 @@ weakenNode(JNIEnv *env, RefNode *node) if (weakRef != NULL) { JNI_FUNC_PTR(env,DeleteGlobalRef)(env, node->ref); - node->ref = weakRef; - node->isStrong = JNI_FALSE; + node->ref = weakRef; + node->strongCount = 0; } return weakRef; } else { + node->strongCount--; return node->ref; } } @@ -372,7 +385,8 @@ void commonRef_initialize(void) { gdata->refLock = debugMonitorCreate("JDWP Reference Table Monitor"); - gdata->nextSeqNum = 1; /* 0 used for error indication */ + gdata->nextSeqNum = 1; /* 0 used for error indication */ + gdata->pinAllCount = 0; initializeObjectsByID(HASH_INIT_SIZE); } @@ -454,7 +468,7 @@ commonRef_idToRef(JNIEnv *env, jlong id) node = findNodeByID(env, id); if (node != NULL) { - if (node->isStrong) { + if (node->strongCount != 0) { saveGlobalRef(env, node->ref, &ref); } else { jobject lref; @@ -544,6 +558,84 @@ commonRef_unpin(jlong id) return error; } +/* Prevent garbage collection of object */ +void +commonRef_pinAll() +{ + debugMonitorEnter(gdata->refLock); { + gdata->pinAllCount++; + + if (gdata->pinAllCount == 1) { + JNIEnv *env; + RefNode *node; + RefNode *prev; + int i; + + env = getEnv(); + + /* + * Walk through the id-based hash table. Detach any nodes + * for which the ref has been collected. + */ + for (i = 0; i < gdata->objectsByIDsize; i++) { + node = gdata->objectsByID[i]; + prev = NULL; + while (node != NULL) { + jobject strongRef; + + strongRef = strengthenNode(env, node); + + /* Has the object been collected? */ + if (strongRef == NULL) { + RefNode *freed; + + /* Detach from the ID list */ + if (prev == NULL) { + gdata->objectsByID[i] = node->next; + } else { + prev->next = node->next; + } + freed = node; + node = node->next; + deleteNode(env, freed); + } else { + prev = node; + node = node->next; + } + } + } + } + } debugMonitorExit(gdata->refLock); +} + +/* Permit garbage collection of objects */ +void +commonRef_unpinAll() +{ + debugMonitorEnter(gdata->refLock); { + gdata->pinAllCount--; + + if (gdata->pinAllCount == 0) { + JNIEnv *env; + RefNode *node; + int i; + + env = getEnv(); + + for (i = 0; i < gdata->objectsByIDsize; i++) { + for (node = gdata->objectsByID[i]; node != NULL; node = node->next) { + jweak weakRef; + + weakRef = weakenNode(env, node); + if (weakRef == NULL) { + EXIT_ERROR(AGENT_ERROR_NULL_POINTER,"NewWeakGlobalRef"); + } + } + } + } + } debugMonitorExit(gdata->refLock); +} + /* Release tracking of an object by ID */ void commonRef_release(JNIEnv *env, jlong id) @@ -582,7 +674,7 @@ commonRef_compact(void) prev = NULL; while (node != NULL) { /* Has the object been collected? */ - if ( (!node->isStrong) && + if ( (node->strongCount == 0) && isSameObject(env, node->ref, NULL)) { RefNode *freed; diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h index 7c76667eb19f6..c3700f8c7437a 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h +++ b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, 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,6 +34,8 @@ jobject commonRef_idToRef(JNIEnv *env, jlong id); void commonRef_idToRef_delete(JNIEnv *env, jobject ref); jvmtiError commonRef_pin(jlong id); jvmtiError commonRef_unpin(jlong id); +void commonRef_pinAll(); +void commonRef_unpinAll(); void commonRef_releaseMultiple(JNIEnv *env, jlong id, jint refCount); void commonRef_release(JNIEnv *env, jlong id); void commonRef_compact(void); diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c index 40dd5d1003c3f..17e991b21de40 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c @@ -1553,6 +1553,12 @@ threadControl_suspendAll(void) } if (error == JVMTI_ERROR_NONE) { + /* + * Pin all objects to prevent objects from being + * garbage collected while the VM is suspended. + */ + commonRef_pinAll(); + suspendAllCount++; } @@ -1604,6 +1610,11 @@ threadControl_resumeAll(void) } if (suspendAllCount > 0) { + /* + * Unpin all objects. + */ + commonRef_unpinAll(); + suspendAllCount--; } diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/util.h b/src/jdk.jdwp.agent/share/native/libjdwp/util.h index 43c4b143471b3..24d8178298c22 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/util.h +++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.h @@ -65,7 +65,7 @@ typedef struct RefNode { jobject ref; /* could be strong or weak */ struct RefNode *next; /* next RefNode* in bucket chain */ jint count; /* count of references */ - unsigned isStrong : 1; /* 1 means this is a string reference */ + unsigned strongCount; /* count of strong reference */ } RefNode; /* Value of a NULL ID */ @@ -128,6 +128,7 @@ typedef struct { /* Common References static data */ jrawMonitorID refLock; jlong nextSeqNum; + unsigned pinAllCount; RefNode **objectsByID; int objectsByIDsize; int objectsByIDcount; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004.java index 2f41b4f01180d..5093afd69193e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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 @@ -144,9 +144,23 @@ private int runThis (String argv[], PrintStream out) { log1(" TESTING BEGINS"); for (int i = 0; ; i++) { - pipe.println("newcheck"); + pipe.println("newcheck"); + + // There are potentially other non-test Java threads allocating objects and triggering + // GC's so we need to suspend the target VM to avoid the objects created in the test + // from being accidentally GC'ed. However, we need the target VM temporary resumed + // while reading its response. Below we resume the target VM (if required) and suspend + // it only after pipe.readln() returns. + + // On the first iteration the target VM is not suspended yet. + if (i > 0) { + debuggee.resume(); + } line = pipe.readln(); + // Suspending target VM to prevent other non-test Java threads from triggering GCs. + debuggee.suspend(); + if (line.equals("checkend")) { log2(" : returned string is 'checkend'"); break ; @@ -230,6 +244,7 @@ private int runThis (String argv[], PrintStream out) { //-------------------------------------------------- test summary section //------------------------------------------------- standard end section + debuggee.resume(); pipe.println("quit"); log2("waiting for the debuggee to finish ..."); debuggee.waitFor(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java index ee28bccba5c26..7fb1ee839145c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java @@ -189,7 +189,9 @@ public void testClassType(String className) { objectReferences.add(classType.newInstance(breakpointEvent.thread(), method, new ArrayList(), 0)); } + debuggee.resume(); checkDebugeeAnswer_instances(className, baseInstances); + debuggee.suspend(); break; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java index 3825d9e815618..b5c7c748a3550 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java @@ -79,7 +79,14 @@ public void doTest() { // create array in debuggee VM till VMOutOfMemoryException while (true) { ArrayReference array = referenceType.newInstance(100000); - array.disableCollection(); + try { + // Since the VM is not suspended, the object may have been collected + // before disableCollection() could be called on it. Just ignore and + // continue doing allocations until we run out of memory. + array.disableCollection(); + } catch (ObjectCollectedException e) { + continue; + } objects.add(array); } } catch (VMOutOfMemoryException e) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebuggee.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebuggee.java index b9bd30b6f2ef2..cafa9d810a88b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebuggee.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebuggee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -67,10 +67,15 @@ public boolean parseCommand(String command) { return false; } + // Keep class loader alive to avoid ObjectCollectedException + // on the debugger side, in case the GC unloads the class and + // invalidates code locations. + private TestClassLoader classLoader; + // create instance of given class and execute all methods which names start // with 'sde_testMethod' private void executeTestMethods(String className) { - TestClassLoader classLoader = new TestClassLoader(); + classLoader = new TestClassLoader(); classLoader.setClassPath(classpath); try { From fae7961a0344685491848f97696878d377814c60 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Wed, 9 Dec 2020 08:12:09 +0000 Subject: [PATCH 149/504] 8257884: Re-enable sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java as automatic test Reviewed-by: xuelei --- .../sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java index 4fdb2503e087e..3a4a9c7be9bdc 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java @@ -26,21 +26,26 @@ import javax.net.SocketFactory; import javax.net.ssl.SSLSocketFactory; +import jdk.test.lib.Platform; import jdk.test.lib.util.FileUtils; /* * @test - * @bug 8256818 8257670 + * @bug 8256818 8257670 8257884 * @summary Test that creating and closing SSL Sockets without bind/connect * will not leave leaking socket file descriptors * @library /test/lib - * @run main/manual SSLSocketLeak + * @run main/othervm SSLSocketLeak */ // Note: this test is not reliable, run it manually. public class SSLSocketLeak { + // number of sockets to open/close private static final int NUM_TEST_SOCK = 500; + // percentage of accepted growth of open handles + private static final int OPEN_HANDLE_GROWTH_THRESHOLD = Platform.isWindows() ? 25 : 10; + public static void main(String[] args) throws IOException { long fds_start = FileUtils.getProcessHandleCount(); System.out.println("FDs at the beginning: " + fds_start); @@ -53,7 +58,7 @@ public static void main(String[] args) throws IOException { long fds_end = FileUtils.getProcessHandleCount(); System.out.println("FDs in the end: " + fds_end); - if ((fds_end - fds_start) > (NUM_TEST_SOCK / 10)) { + if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) { throw new RuntimeException("Too many open file descriptors. Looks leaky."); } } From df55ecd83c70e8962e9037671cd13b104d3e5620 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Wed, 9 Dec 2020 09:01:07 +0000 Subject: [PATCH 150/504] 8257794: Zero: assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1) failed: wrong on Linux/x86_32 Reviewed-by: shade --- src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp index 3f8f5299ad002..8acab4b13303f 100644 --- a/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp +++ b/src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp @@ -419,7 +419,6 @@ void BytecodeInterpreter::run(interpreterState istate) { #ifdef ASSERT if (istate->_msg != initialize) { assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit"); - IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong")); } // Verify linkages. interpreterState l = istate; From b4615c67a314bc818419c5cf4fd63355f2f93012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Wed, 9 Dec 2020 09:21:50 +0000 Subject: [PATCH 151/504] 8256580: Fault in new grid display Reviewed-by: jjg --- .../formats/html/HtmlDocletWriter.java | 2 +- .../doclets/formats/html/markup/Table.java | 3 +- .../testHtmlTableTags/TestHtmlTableTags.java | 310 ++++++++++++++++++ 3 files changed, 313 insertions(+), 2 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index fab8442383d0d..bb7dcc41179c8 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -1253,7 +1253,7 @@ private void addCommentTags(Element element, List tags, boole */ private void addCommentTags(Element element, DocTree holderTag, List tags, boolean depr, boolean first, boolean inSummary, Content htmltree) { - if (options.noComment()){ + if (options.noComment()) { return; } Content div; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java index a160bf95b427d..b14778187a633 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java @@ -318,7 +318,8 @@ public void addRow(Element element, List contents) { HtmlStyle cellStyle = (columnStyles == null || colIndex > columnStyles.size()) ? null : columnStyles.get(colIndex); - HtmlTree cell = HtmlTree.DIV(cellStyle, c); + // Replace empty content with HtmlTree.EMPTY to make sure the cell isn't dropped + HtmlTree cell = HtmlTree.DIV(cellStyle, !c.isEmpty() ? c : HtmlTree.EMPTY); if (rowStyle != null) { cell.addStyle(rowStyle); } diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java index 03d0fa9d5e32b..301669d2e30f9 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java @@ -57,6 +57,22 @@ public void test() { checkHtmlTableTag(); checkHtmlTableCaptions(); checkHtmlTableHeaders(); + checkHtmlTableContents(); + } + + @Test + public void testNoComment() { + javadoc("-d", "out-nocomment", + "-nocomment", + "-sourcepath", testSrc, + "-use", + "pkg1", "pkg2"); + checkExit(Exit.OK); + + checkHtmlTableTag(); + checkHtmlTableCaptions(); + checkHtmlTableHeaders(); + checkHtmlTableContentsNoComment(); } /* @@ -520,4 +536,298 @@ void checkHtmlTableHeaders() {

      Package
      Description
      """); } + + /* + * Test for validating HTML table contents. + */ + void checkHtmlTableContents() { + //Package summary + checkOutput("pkg1/package-summary.html", true, + """ + +
      +
      A sample interface used to test table tags.
      +
      """, + """ + +
      +
      A test class.
      +
      """); + + checkOutput("pkg2/package-summary.html", true, + """ + +
      +
      A sample enum.
      +
      """, + """ + +
      +
      Test Annotation class.
      +
      """); + + // Class documentation + checkOutput("pkg1/C1.html", true, + """ + + +
      +
      Test field for class.
      +
      """, + """ +
      void
      +
      method1​(int a, + int b)
      +
      +
      Method that is implemented.
      +
      """); + + checkOutput("pkg2/C2.html", true, + """ + + +
      +
      A test field.
      +
      """, + """ + +
      method​(C1 param)
      +
      +
      A sample method.
      +
      """); + + checkOutput("pkg2/C2.ModalExclusionType.html", true, + """ + +
      +
      Test comment.
      +
      """); + + checkOutput("pkg2/C3.html", true, + """ + +
      +
      Comment.
      +
      """); + + checkOutput("pkg2/C4.html", true, + """ +
      boolean
      + +
       
      + """); + + // Class use documentation + checkOutput("pkg1/class-use/I1.html", true, + """ + +
      +
      Test package 1 used to test table tags.
      +
      """); + + checkOutput("pkg2/class-use/C2.html", true, + """ + +
      C1.<\ + code>field\ +
      +
      +
      Test field for class.
      +
      """, + """ + +
      C1.<\ + code>method​(C2 \ + ;param)
      +
      +
      Method thats does some processing.
      +
      """); + + // Package use documentation + checkOutput("pkg1/package-use.html", true, + """ + +
      +
      Test package 1 used to test table tags.
      +
      """, + """ + +
      +
      A test class.
      +
      """); + + // Deprecated + checkOutput("deprecated-list.html", true, + """ + +
      +
      don't use this field anymore.
      +
      """, + """ + +
      +
      don't use this anymore.
      +
      """); + + // Constant values + checkOutput("constant-values.html", true, + """ +
      public s\ + tatic final String
      + +
      "C1"
      + """); + + // Overview Summary + checkOutput("index.html", true, + """ + +
      +
      Test package 1 used to test table tags.
      +
      """); + } + + /* + * Test for validating HTML table contents with -nocomment option. + */ + void checkHtmlTableContentsNoComment() { + //Package summary + checkOutput("pkg1/package-summary.html", true, + """ + +
      """, + """ + +
      """); + + checkOutput("pkg2/package-summary.html", true, + """ + +
      """, + """ + +
      """); + + // Class documentation + checkOutput("pkg1/C1.html", true, + """ + + +
      """, + """ +
      void
      +
      method1​(int a, + int b)
      +
      """); + + checkOutput("pkg2/C2.html", true, + """ + + +
      """, + """ + +
      method​(C1 param)
      +
      """); + + checkOutput("pkg2/C2.ModalExclusionType.html", true, + """ + +
      """); + + checkOutput("pkg2/C3.html", true, + """ + +
      """); + + checkOutput("pkg2/C4.html", true, + """ +
      boolean
      + +
      + """); + + // Class use documentation + checkOutput("pkg1/class-use/I1.html", true, + """ + +
      """); + + checkOutput("pkg2/class-use/C2.html", true, + """ + +
      C1.<\ + code>field\ +
      +
      """, + """ + +
      C1.<\ + code>method​(C2 \ + ;param)
      +
      """); + + // Package use documentation + checkOutput("pkg1/package-use.html", true, + """ + +
      """, + """ + +
      """); + + // Deprecated + checkOutput("deprecated-list.html", true, + """ + +
      """, + """ + +
      """); + + // Constant values + checkOutput("constant-values.html", true, + """ +
      public s\ + tatic final String
      + +
      "C1"
      + """); + + // Overview Summary + checkOutput("index.html", true, + """ + +
      """); + } } From 5bdce9b99504f312455f6353d20801b6efbb7665 Mon Sep 17 00:00:00 2001 From: Julia Boes Date: Wed, 9 Dec 2020 09:32:22 +0000 Subject: [PATCH 152/504] 8257639: Update usage of "type" terminology in java.lang.Enum & java.lang.Record Reviewed-by: chegar, dfuchs --- .../share/classes/java/lang/Enum.java | 46 +++++++++---------- .../share/classes/java/lang/Record.java | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Enum.java b/src/java.base/share/classes/java/lang/Enum.java index 4e6b582bb57ff..cc9b3c20b00c5 100644 --- a/src/java.base/share/classes/java/lang/Enum.java +++ b/src/java.base/share/classes/java/lang/Enum.java @@ -40,14 +40,14 @@ import static java.util.Objects.requireNonNull; /** - * This is the common base class of all Java language enumeration types. + * This is the common base class of all Java language enumeration classes. * * More information about enums, including descriptions of the * implicitly declared methods synthesized by the compiler, can be * found in section {@jls 8.9} of The Java Language * Specification. * - * Enumeration types are all serializable and receive special handling + * Enumeration classes are all serializable and receive special handling * by the serialization mechanism. The serialized representation used * for enum constants cannot be customized. Declarations of methods * and fields that would otherwise interact with serialization are @@ -59,7 +59,7 @@ * {@linkplain java.util.EnumSet set} and {@linkplain * java.util.EnumMap map} implementations are available. * - * @param The enum type subclass + * @param The type of the enum subclass * @serial exclude * @author Josh Bloch * @author Neal Gafter @@ -71,7 +71,7 @@ * @since 1.5 */ @SuppressWarnings("serial") // No serialVersionUID needed due to - // special-casing of enum types. + // special-casing of enum classes. public abstract class Enum> implements Constable, Comparable, Serializable { /** @@ -126,7 +126,7 @@ public final int ordinal() { /** * Sole constructor. Programmers cannot invoke this constructor. * It is for use by code emitted by the compiler in response to - * enum type declarations. + * enum class declarations. * * @param name - The name of this enum constant, which is the identifier * used to declare it. @@ -142,7 +142,7 @@ protected Enum(String name, int ordinal) { /** * Returns the name of this enum constant, as contained in the * declaration. This method may be overridden, though it typically - * isn't necessary or desirable. An enum type should override this + * isn't necessary or desirable. An enum class should override this * method when a more "programmer-friendly" string form exists. * * @return the name of this enum constant @@ -236,41 +236,41 @@ public final Optional> describeConstable() { } /** - * Returns the enum constant of the specified enum type with the + * Returns the enum constant of the specified enum class with the * specified name. The name must match exactly an identifier used - * to declare an enum constant in this type. (Extraneous whitespace + * to declare an enum constant in this class. (Extraneous whitespace * characters are not permitted.) * - *

      Note that for a particular enum type {@code T}, the + *

      Note that for a particular enum class {@code T}, the * implicitly declared {@code public static T valueOf(String)} * method on that enum may be used instead of this method to map * from a name to the corresponding enum constant. All the - * constants of an enum type can be obtained by calling the + * constants of an enum class can be obtained by calling the * implicit {@code public static T[] values()} method of that - * type. + * class. * - * @param The enum type whose constant is to be returned - * @param enumType the {@code Class} object of the enum type from which + * @param The enum class whose constant is to be returned + * @param enumClass the {@code Class} object of the enum class from which * to return a constant * @param name the name of the constant to return - * @return the enum constant of the specified enum type with the + * @return the enum constant of the specified enum class with the * specified name - * @throws IllegalArgumentException if the specified enum type has + * @throws IllegalArgumentException if the specified enum class has * no constant with the specified name, or the specified - * class object does not represent an enum type - * @throws NullPointerException if {@code enumType} or {@code name} + * class object does not represent an enum class + * @throws NullPointerException if {@code enumClass} or {@code name} * is null * @since 1.5 */ - public static > T valueOf(Class enumType, + public static > T valueOf(Class enumClass, String name) { - T result = enumType.enumConstantDirectory().get(name); + T result = enumClass.enumConstantDirectory().get(name); if (result != null) return result; if (name == null) throw new NullPointerException("Name is null"); throw new IllegalArgumentException( - "No enum constant " + enumType.getCanonicalName() + "." + name); + "No enum constant " + enumClass.getCanonicalName() + "." + name); } /** @@ -307,13 +307,13 @@ public static final class EnumDesc> /** * Constructs a nominal descriptor for the specified {@code enum} class and name. * - * @param constantType a {@link ClassDesc} describing the {@code enum} class + * @param constantClass a {@link ClassDesc} describing the {@code enum} class * @param constantName the unqualified name of the enum constant * @throws NullPointerException if any argument is null * @jvms 4.2.2 Unqualified Names */ - private EnumDesc(ClassDesc constantType, String constantName) { - super(ConstantDescs.BSM_ENUM_CONSTANT, requireNonNull(constantName), requireNonNull(constantType)); + private EnumDesc(ClassDesc constantClass, String constantName) { + super(ConstantDescs.BSM_ENUM_CONSTANT, requireNonNull(constantName), requireNonNull(constantClass)); } /** diff --git a/src/java.base/share/classes/java/lang/Record.java b/src/java.base/share/classes/java/lang/Record.java index 67e538978d2f6..ee7c1095e6706 100644 --- a/src/java.base/share/classes/java/lang/Record.java +++ b/src/java.base/share/classes/java/lang/Record.java @@ -101,7 +101,7 @@ protected Record() {} * * @implSpec * The implicitly provided implementation returns {@code true} if - * and only if the argument is an instance of the same record type + * and only if the argument is an instance of the same record class * as this record, and each component of this record is equal to * the corresponding component of the argument; otherwise, {@code * false} is returned. Equality of a component {@code c} is From 616b1f12bd60f3d820205d8fdf811abd44c32d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=A0ipka?= Date: Wed, 9 Dec 2020 10:28:04 +0000 Subject: [PATCH 153/504] 8257516: define test group for manual tests Reviewed-by: iignatyev --- test/jdk/TEST.groups | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 23112a48d821a..62160ae5fc27b 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -510,3 +510,54 @@ needs_g1gc = \ jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1FullCollection.java \ jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithG1ConcurrentMark.java \ jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java + +jdk_core_manual = \ + :jdk_core_manual_no_input \ + :jdk_core_manual_no_input_security \ + :jdk_core_manual_requires_human_input + +jdk_core_manual_no_input = \ + java/net/HugeDataTransferTest.java \ + java/net/httpclient/BodyProcessorInputStreamTest.java \ + java/net/httpclient/HttpInputStreamTest.java \ + java/nio/MappedByteBuffer/PmemTest.java \ + java/rmi/activation/nonLocalActivation/NonLocalActivationTest.java \ + java/rmi/registry/nonLocalRegistry/NonLocalRegistryTest.java \ + java/util/zip/ZipFile/TestZipFile.java \ + javax/net/ssl/compatibility/AlpnTest.java \ + javax/net/ssl/compatibility/BasicConnectTest.java \ + javax/net/ssl/compatibility/HrrTest.java \ + javax/net/ssl/compatibility/SniTest.java \ + jdk/nio/zipfs/TestLocOffsetFromZip64EF.java + +jdk_core_manual_no_input_security = \ + com/sun/crypto/provider/Cipher/DES/PerformanceTest.java \ + com/sun/security/auth/callback/TextCallbackHandler/Default.java \ + com/sun/security/auth/callback/TextCallbackHandler/Password.java \ + com/sun/security/sasl/gsskerb/AuthOnly.java \ + com/sun/security/sasl/gsskerb/ConfSecurityLayer.java \ + com/sun/security/sasl/gsskerb/NoSecurityLayer.java \ + sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java \ + sun/security/provider/PolicyParser/ExtDirs.java \ + sun/security/provider/PolicyParser/ExtDirsChange.java \ + sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java \ + sun/security/provider/PolicyParser/PrincipalExpansionError.java \ + sun/security/smartcardio/TestChannel.java \ + sun/security/smartcardio/TestConnect.java \ + sun/security/smartcardio/TestConnectAgain.java \ + sun/security/smartcardio/TestControl.java \ + sun/security/smartcardio/TestDefault.java \ + sun/security/smartcardio/TestDirect.java \ + sun/security/smartcardio/TestExclusive.java \ + sun/security/smartcardio/TestMultiplePresent.java \ + sun/security/smartcardio/TestPresent.java \ + sun/security/smartcardio/TestTransmit.java \ + sun/security/tools/jarsigner/compatibility/Compatibility.java \ + sun/security/tools/keytool/console.sh \ + sun/security/tools/keytool/i18n.java + +jdk_core_manual_requires_human_input = \ + com/sun/jndi/dns/Test6991580.java \ + java/util/TimeZone/DefaultTimeZoneTest.java + + From d3dddb6a56776f8179cadf163510b37536e99ac4 Mon Sep 17 00:00:00 2001 From: Bernhard Urban-Forster Date: Wed, 9 Dec 2020 11:21:37 +0000 Subject: [PATCH 154/504] 8256657: Add cross-compiled build for Windows+Arm64 to submit workflow Reviewed-by: shade, ihse --- .github/workflows/submit.yml | 93 +++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index f0b27f39bc35c..7f6fa10f499cd 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -9,7 +9,7 @@ on: platforms: description: "Platform(s) to execute on" required: true - default: "Linux additional (hotspot only), Linux x64, Linux x86, Windows x64, macOS x64" + default: "Linux additional (hotspot only), Linux x64, Linux x86, Windows aarch64, Windows x64, macOS x64" jobs: prerequisites: @@ -21,6 +21,7 @@ jobs: platform_linux_additional: ${{ steps.check_platforms.outputs.platform_linux_additional }} platform_linux_x64: ${{ steps.check_platforms.outputs.platform_linux_x64 }} platform_linux_x86: ${{ steps.check_platforms.outputs.platform_linux_x86 }} + platform_windows_aarch64: ${{ steps.check_platforms.outputs.platform_windows_aarch64 }} platform_windows_x64: ${{ steps.check_platforms.outputs.platform_windows_x64 }} platform_macos_x64: ${{ steps.check_platforms.outputs.platform_macos_x64 }} dependencies: ${{ steps.check_deps.outputs.dependencies }} @@ -36,6 +37,7 @@ jobs: echo "::set-output name=platform_linux_additional::${{ contains(github.event.inputs.platforms, 'linux additional (hotspot only)') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux additional (hotspot only)'))) }}" echo "::set-output name=platform_linux_x64::${{ contains(github.event.inputs.platforms, 'linux x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux x64'))) }}" echo "::set-output name=platform_linux_x86::${{ contains(github.event.inputs.platforms, 'linux x86') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux x86'))) }}" + echo "::set-output name=platform_windows_aarch64::${{ contains(github.event.inputs.platforms, 'windows aarch64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'windows aarch64'))) }}" echo "::set-output name=platform_windows_x64::${{ contains(github.event.inputs.platforms, 'windows x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'windows x64'))) }}" echo "::set-output name=platform_macos_x64::${{ contains(github.event.inputs.platforms, 'macos x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'macos x64'))) }}" if: steps.check_submit.outputs.should_run != 'false' @@ -846,6 +848,94 @@ jobs: path: ~/linux-x86${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip continue-on-error: true + windows_aarch64_build: + name: Windows aarch64 + runs-on: "windows-2019" + needs: prerequisites + if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_aarch64 != 'false' + + strategy: + fail-fast: false + matrix: + flavor: + - build debug + include: + - flavor: build debug + flags: --enable-debug + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Restore cygwin packages from cache + id: cygwin + uses: actions/cache@v2 + with: + path: ~/cygwin/packages + key: cygwin-packages-${{ runner.os }}-v1 + + - name: Install cygwin + run: | + New-Item -Force -ItemType directory -Path "$HOME\cygwin" + & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe" + Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow + + - name: Checkout the source + uses: actions/checkout@v2 + with: + path: jdk + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash.Hash -eq $env:BOOT_JDK_SHA256 + & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION" + Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Ensure a specific version of MSVC is installed + run: > + Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe' -Wait -NoNewWindow -ArgumentList + 'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" --quiet + --add Microsoft.VisualStudio.Component.VC.14.28.arm64' + + - name: Configure + run: > + $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; + $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ; + & bash configure + --with-conf-name=windows-aarch64 + --with-msvc-toolset-version=14.28 + --openjdk-target=aarch64-unknown-cygwin + ${{ matrix.flags }} + --with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA" + --with-version-build=0 + --with-boot-jdk="$env:BOOT_JDK" + --with-default-make-target="hotspot" + working-directory: jdk + + - name: Build + run: | + $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; + $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + & make CONF_NAME=windows-aarch64 + working-directory: jdk + windows_x64_build: name: Windows x64 runs-on: "windows-2019" @@ -1466,6 +1556,7 @@ jobs: needs: - prerequisites - linux_additional_build + - windows_aarch64_build - linux_x64_test - linux_x86_test - windows_x64_test From 0201a33dd681dc731637fa3f9bf1d197610a9da4 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Wed, 9 Dec 2020 13:17:50 +0000 Subject: [PATCH 155/504] 8255959: Timeouts in VectorConversion tests Reviewed-by: psandoz, stuefe --- .../incubator/vector/Vector64ConversionTests.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/jdk/jdk/incubator/vector/Vector64ConversionTests.java b/test/jdk/jdk/incubator/vector/Vector64ConversionTests.java index 24b67ed245b29..b59e5ff7841ec 100644 --- a/test/jdk/jdk/incubator/vector/Vector64ConversionTests.java +++ b/test/jdk/jdk/incubator/vector/Vector64ConversionTests.java @@ -31,20 +31,30 @@ /** * @test + * @requires (os.arch != "ppc64") & (os.arch != "ppc64le") * @modules jdk.incubator.vector * @modules java.base/jdk.internal.vm.annotation * @run testng/othervm -XX:-TieredCompilation --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED * Vector64ConversionTests */ +/** + * @test VectorConversionHighTimeout + * @requires os.arch == "ppc64" | os.arch == "ppc64le" + * @modules jdk.incubator.vector + * @modules java.base/jdk.internal.vm.annotation + * @run testng/othervm/timeout=1800 -XX:-TieredCompilation --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED + * Vector64ConversionTests + */ + /* * @test VectorConversionPPC64 * @bug 8256479 - * @requires os.arch =="ppc64" | os.arch == "ppc64le" + * @requires os.arch == "ppc64" | os.arch == "ppc64le" * @summary VectorConversion on PPC64 without Vector Register usage * @modules jdk.incubator.vector * @modules java.base/jdk.internal.vm.annotation - * @run testng/othervm -XX:-SuperwordUseVSX -XX:-TieredCompilation --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED + * @run testng/othervm/timeout=1800 -XX:-SuperwordUseVSX -XX:-TieredCompilation --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED * Vector64ConversionTests */ From f148915d549efaa33f16eb02417c799fcd2f94d2 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Wed, 9 Dec 2020 14:36:13 +0000 Subject: [PATCH 156/504] 8245107: Use Unified Logging in trace_method_handle_stub() Reviewed-by: coleenp, mdoerr --- src/hotspot/cpu/arm/methodHandles_arm.cpp | 38 ++++++++++++--------- src/hotspot/cpu/ppc/methodHandles_ppc.cpp | 25 ++++++++------ src/hotspot/cpu/s390/methodHandles_s390.cpp | 22 ++++++------ src/hotspot/cpu/x86/methodHandles_x86.cpp | 31 +++++++++-------- src/hotspot/share/runtime/frame.cpp | 8 ++--- src/hotspot/share/runtime/frame.hpp | 3 +- 6 files changed, 70 insertions(+), 57 deletions(-) diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp index 140d4ea8e699b..81ed67824d4e9 100644 --- a/src/hotspot/cpu/arm/methodHandles_arm.cpp +++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp @@ -32,6 +32,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiExport.hpp" @@ -482,24 +483,29 @@ void trace_method_handle_stub(const char* adaptername, intptr_t mh_reg = (intptr_t)saved_regs[R5_mh->encoding()]; const char* mh_reg_name = "R5_mh"; - if (!has_mh) mh_reg_name = "R5"; - tty->print_cr("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT, - adaptername, mh_reg_name, mh_reg, - (intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); - - if (last_sp != saved_sp && last_sp != NULL) - tty->print_cr("*** last_sp=" INTPTR_FORMAT, p2i(last_sp)); - if (Verbose) { + if (!has_mh) { + mh_reg_name = "R5"; + } + log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT, + adaptername, mh_reg_name, mh_reg, + (intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); + + if (last_sp != saved_sp && last_sp != NULL) { + log_info(methodhandles)("*** last_sp=" INTPTR_FORMAT, p2i(last_sp)); + } + LogTarget(Trace, methodhandles) lt; + if (lt.is_enabled()) { ResourceMark rm; - tty->print(" reg dump: "); + LogStream ls(lt); + ls.print(" reg dump: "); int i; for (i = 0; i < trace_mh_nregs; i++) { if (i > 0 && i % 4 == 0) - tty->print("\n + dump: "); + ls.print("\n + dump: "); const char* reg_name = trace_mh_regs[i]->name(); - tty->print(" %s: " INTPTR_FORMAT, reg_name, p2i((void *)saved_regs[i])); + ls.print(" %s: " INTPTR_FORMAT, reg_name, p2i((void*)saved_regs[i])); } - tty->cr(); + ls.cr(); { // dump last frame (from JavaThread::print_frame_layout) @@ -527,14 +533,14 @@ void trace_method_handle_stub(const char* adaptername, } // Note: the unextended_sp may not be correct - tty->print_cr(" stack layout:"); - values.print(p); + ls.print_cr(" stack layout:"); + values.print_on(p, &ls); } if (has_mh && oopDesc::is_oop(mh)) { - mh->print(); + mh->print_on(&ls); if (java_lang_invoke_MethodHandle::is_instance(mh)) { - java_lang_invoke_MethodHandle::form(mh)->print(); + java_lang_invoke_MethodHandle::form(mh)->print_on(&ls); } } } diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp index ac2fadeaeef4a..f6a49f8a34b07 100644 --- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp +++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp @@ -29,6 +29,7 @@ #include "classfile/javaClasses.inline.hpp" #include "interpreter/interpreter.hpp" #include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiExport.hpp" @@ -490,25 +491,27 @@ void trace_method_handle_stub(const char* adaptername, bool has_mh = (strstr(adaptername, "/static") == NULL && strstr(adaptername, "linkTo") == NULL); // static linkers don't have MH const char* mh_reg_name = has_mh ? "R23_method_handle" : "G23"; - tty->print_cr("MH %s %s=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, + log_info(methodhandles)("MH %s %s=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, adaptername, mh_reg_name, p2i(mh), p2i(entry_sp)); - if (Verbose) { + LogTarget(Trace, methodhandles) lt; + if (lt.is_enabled()) { ResourceMark rm; - tty->print_cr("Registers:"); + LogStream ls(lt); + ls.print_cr("Registers:"); const int abi_offset = frame::abi_reg_args_size / 8; for (int i = R3->encoding(); i <= R12->encoding(); i++) { Register r = as_Register(i); int count = i - R3->encoding(); // The registers are stored in reverse order on the stack (by save_volatile_gprs(R1_SP, abi_reg_args_size)). - tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[abi_offset + count]); + ls.print("%3s=" PTR_FORMAT, r->name(), saved_regs[abi_offset + count]); if ((count + 1) % 4 == 0) { - tty->cr(); + ls.cr(); } else { - tty->print(", "); + ls.print(", "); } } - tty->cr(); + ls.cr(); { // dumping last frame with frame::describe @@ -542,14 +545,14 @@ void trace_method_handle_stub(const char* adaptername, values.describe(-1, saved_regs, "raw top of stack"); - tty->print_cr("Stack layout:"); - values.print(p); + ls.print_cr("Stack layout:"); + values.print_on(p, &ls); } if (has_mh && oopDesc::is_oop(mh)) { - mh->print(); + mh->print_on(&ls); if (java_lang_invoke_MethodHandle::is_instance(mh)) { - java_lang_invoke_MethodHandle::form(mh)->print(); + java_lang_invoke_MethodHandle::form(mh)->print_on(&ls); } } } diff --git a/src/hotspot/cpu/s390/methodHandles_s390.cpp b/src/hotspot/cpu/s390/methodHandles_s390.cpp index 64c16aebf87f6..301b9f6e144d0 100644 --- a/src/hotspot/cpu/s390/methodHandles_s390.cpp +++ b/src/hotspot/cpu/s390/methodHandles_s390.cpp @@ -29,6 +29,7 @@ #include "classfile/javaClasses.inline.hpp" #include "interpreter/interpreter.hpp" #include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiExport.hpp" @@ -555,16 +556,17 @@ void trace_method_handle_stub(const char* adaptername, bool has_mh = (strstr(adaptername, "/static") == NULL && strstr(adaptername, "linkTo") == NULL); // Static linkers don't have MH. const char* mh_reg_name = has_mh ? "Z_R4_mh" : "Z_R4"; - tty->print_cr("MH %s %s=" INTPTR_FORMAT " sender_sp=" INTPTR_FORMAT " args=" INTPTR_FORMAT, - adaptername, mh_reg_name, - p2i(mh), p2i(sender_sp), p2i(args)); + log_info(methodhandles)("MH %s %s=" INTPTR_FORMAT " sender_sp=" INTPTR_FORMAT " args=" INTPTR_FORMAT, + adaptername, mh_reg_name, + p2i(mh), p2i(sender_sp), p2i(args)); - if (Verbose) { + LogTarget(Trace, methodhandles) lt; + if (lt.is_enabled()) { // Dumping last frame with frame::describe. - + ResourceMark rm; + LogStream ls(lt); JavaThread* p = JavaThread::active(); - ResourceMark rm; PRESERVE_EXCEPTION_MARK; // May not be needed by safer and unexpensive here. FrameValues values; @@ -614,12 +616,12 @@ void trace_method_handle_stub(const char* adaptername, } // Note: the unextended_sp may not be correct. - tty->print_cr(" stack layout:"); - values.print(p); + ls.print_cr(" stack layout:"); + values.print_on(p, &ls); if (has_mh && oopDesc::is_oop(mh)) { - mh->print(); + mh->print_on(&ls); if (java_lang_invoke_MethodHandle::is_instance(mh)) { - java_lang_invoke_MethodHandle::form(mh)->print(); + java_lang_invoke_MethodHandle::form(mh)->print_on(&ls); } } } diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp index 298c5144a1575..1cdd27e1cd96a 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.cpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp @@ -30,6 +30,7 @@ #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" #include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiExport.hpp" @@ -506,13 +507,13 @@ void trace_method_handle_stub(const char* adaptername, bool has_mh = (strstr(adaptername, "/static") == NULL && strstr(adaptername, "linkTo") == NULL); // static linkers don't have MH const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx"; - tty->print_cr("MH %s %s=" PTR_FORMAT " sp=" PTR_FORMAT, - adaptername, mh_reg_name, - p2i(mh), p2i(entry_sp)); + log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=" PTR_FORMAT, adaptername, mh_reg_name, p2i(mh), p2i(entry_sp)); - if (Verbose) { + LogTarget(Trace, methodhandles) lt; + if (lt.is_enabled()) { ResourceMark rm; - tty->print_cr("Registers:"); + LogStream ls(lt); + ls.print_cr("Registers:"); const int saved_regs_count = RegisterImpl::number_of_registers; for (int i = 0; i < saved_regs_count; i++) { Register r = as_Register(i); @@ -521,20 +522,20 @@ void trace_method_handle_stub(const char* adaptername, assert(RegisterImpl::number_of_registers == 16, "sanity"); if (r == rsp) { // rsp is actually not stored by pusha(), compute the old rsp from saved_regs (rsp after pusha): saved_regs + 16 = old rsp - tty->print("%3s=" PTR_FORMAT, r->name(), (intptr_t)(&saved_regs[16])); + ls.print("%3s=" PTR_FORMAT, r->name(), (intptr_t)(&saved_regs[16])); } else { - tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]); + ls.print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]); } #else - tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]); + ls.print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]); #endif if ((i + 1) % 4 == 0) { - tty->cr(); + ls.cr(); } else { - tty->print(", "); + ls.print(", "); } } - tty->cr(); + ls.cr(); // Note: We want to allow trace_method_handle from any call site. // While trace_method_handle creates a frame, it may be entered @@ -585,13 +586,13 @@ void trace_method_handle_stub(const char* adaptername, } values.describe(-1, entry_sp, "raw top of stack"); - tty->print_cr("Stack layout:"); - values.print(p); + ls.print_cr("Stack layout:"); + values.print_on(p, &ls); } if (has_mh && oopDesc::is_oop(mh)) { - mh->print(); + mh->print_on(&ls); if (java_lang_invoke_MethodHandle::is_instance(mh)) { - java_lang_invoke_MethodHandle::form(mh)->print(); + java_lang_invoke_MethodHandle::form(mh)->print_on(&ls); } } } diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index f9a516deece31..f9ba174951fa7 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -1288,7 +1288,7 @@ void FrameValues::validate() { } #endif // ASSERT -void FrameValues::print(JavaThread* thread) { +void FrameValues::print_on(JavaThread* thread, outputStream* st) { _values.sort(compare); // Sometimes values like the fp can be invalid values if the @@ -1321,14 +1321,14 @@ void FrameValues::print(JavaThread* thread) { for (int i = max_index; i >= min_index; i--) { FrameValue fv = _values.at(i); while (cur > fv.location) { - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, p2i(cur), *cur); + st->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, p2i(cur), *cur); cur--; } if (last == fv.location) { const char* spacer = " " LP64_ONLY(" "); - tty->print_cr(" %s %s %s", spacer, spacer, fv.description); + st->print_cr(" %s %s %s", spacer, spacer, fv.description); } else { - tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", p2i(fv.location), *fv.location, fv.description); + st->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", p2i(fv.location), *fv.location, fv.description); last = fv.location; cur--; } diff --git a/src/hotspot/share/runtime/frame.hpp b/src/hotspot/share/runtime/frame.hpp index 94b3596b88a0a..e7ce937496721 100644 --- a/src/hotspot/share/runtime/frame.hpp +++ b/src/hotspot/share/runtime/frame.hpp @@ -440,7 +440,8 @@ class FrameValues { #ifdef ASSERT void validate(); #endif - void print(JavaThread* thread); + void print(JavaThread* thread) { print_on(thread, tty); } + void print_on(JavaThread* thread, outputStream* out); }; #endif From 6eff9315e1990f43f896d7416cca4ac87d610840 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 9 Dec 2020 15:05:01 +0000 Subject: [PATCH 157/504] 8256950: Add record attribute support to symbol generator CreateSymbols Reviewed-by: jjg, chegar --- .../tools/symbolgenerator/CreateSymbols.java | 156 ++++++++++- .../com/sun/tools/javac/code/Symbol.java | 19 +- .../com/sun/tools/javac/jvm/ClassReader.java | 11 +- .../javac/processing/PrintingProcessor.java | 6 +- .../com/sun/tools/classfile/ClassWriter.java | 14 +- .../classfile/MethodParameters_attribute.java | 5 + .../sun/tools/classfile/Record_attribute.java | 12 + .../createsymbols}/CreateSymbolsTest.java | 66 +++-- .../createsymbols}/CreateSymbolsTestImpl.java | 255 +++++++++++++----- .../tools/javac/records/RecordReading.java | 129 +++++++++ 10 files changed, 563 insertions(+), 110 deletions(-) rename {make/langtools/test/sym => test/langtools/tools/javac/platform/createsymbols}/CreateSymbolsTest.java (59%) rename {make/langtools/test/sym => test/langtools/tools/javac/platform/createsymbols}/CreateSymbolsTestImpl.java (76%) create mode 100644 test/langtools/tools/javac/records/RecordReading.java diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java index 42cad61852d4f..99fb65d7130ae 100644 --- a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java +++ b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java @@ -122,6 +122,7 @@ import com.sun.tools.classfile.InnerClasses_attribute; import com.sun.tools.classfile.InnerClasses_attribute.Info; import com.sun.tools.classfile.Method; +import com.sun.tools.classfile.MethodParameters_attribute; import com.sun.tools.classfile.ModuleResolution_attribute; import com.sun.tools.classfile.ModuleTarget_attribute; import com.sun.tools.classfile.Module_attribute; @@ -131,6 +132,8 @@ import com.sun.tools.classfile.Module_attribute.RequiresEntry; import com.sun.tools.classfile.NestHost_attribute; import com.sun.tools.classfile.NestMembers_attribute; +import com.sun.tools.classfile.Record_attribute; +import com.sun.tools.classfile.Record_attribute.ComponentInfo; import com.sun.tools.classfile.RuntimeAnnotations_attribute; import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute; import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute; @@ -959,6 +962,22 @@ private void addAttributes(ClassHeaderDescription header, attributes.put(Attribute.NestMembers, new NestMembers_attribute(attributeString, nestMembers)); } + if (header.isRecord) { + assert header.recordComponents != null; + int attributeString = addString(constantPool, Attribute.Record); + ComponentInfo[] recordComponents = new ComponentInfo[header.recordComponents.size()]; + int i = 0; + for (RecordComponentDescription rcd : header.recordComponents) { + int name = addString(constantPool, rcd.name); + Descriptor desc = new Descriptor(addString(constantPool, rcd.descriptor)); + Map nestedAttrs = new HashMap<>(); + addGenericAttributes(rcd, constantPool, nestedAttrs); + Attributes attrs = new Attributes(nestedAttrs); + recordComponents[i++] = new ComponentInfo(name, desc, attrs); + } + attributes.put(Attribute.Record, + new Record_attribute(attributeString, recordComponents)); + } addInnerClassesAttribute(header, constantPool, attributes); } @@ -1017,6 +1036,18 @@ private void addAttributes(MethodDescription desc, List constantPool, Ma new RuntimeVisibleParameterAnnotations_attribute(attributeString, annotations)); } + if (desc.methodParameters != null && !desc.methodParameters.isEmpty()) { + int attributeString = + addString(constantPool, Attribute.MethodParameters); + MethodParameters_attribute.Entry[] entries = + desc.methodParameters + .stream() + .map(p -> new MethodParameters_attribute.Entry(addString(constantPool, p.name), + p.flags)) + .toArray(s -> new MethodParameters_attribute.Entry[s]); + attributes.put(Attribute.MethodParameters, + new MethodParameters_attribute(attributeString, entries)); + } } private void addAttributes(FieldDescription desc, List constantPool, Map attributes) { @@ -1595,7 +1626,9 @@ private void dumpDescriptions(ClassList classes, StringWriter data = new StringWriter(); ModuleDescription module = modules.get(e.getKey()); - module.write(data, desc.basePlatform, desc.version); + if (module != null) { //module == null should only be in tests. + module.write(data, desc.basePlatform, desc.version); + } for (ClassDescription clazz : e.getValue()) { clazz.write(data, desc.basePlatform, desc.version); @@ -2153,6 +2186,37 @@ private boolean readAttribute(ClassFile cf, FeatureDescription feature, Attribut .collect(Collectors.toList()); break; } + case Attribute.Record: { + assert feature instanceof ClassHeaderDescription; + Record_attribute record = (Record_attribute) attr; + List components = new ArrayList<>(); + for (ComponentInfo info : record.component_info_arr) { + RecordComponentDescription rcd = new RecordComponentDescription(); + rcd.name = info.getName(cf.constant_pool); + rcd.descriptor = info.descriptor.getValue(cf.constant_pool); + for (Attribute nestedAttr : info.attributes) { + readAttribute(cf, rcd, nestedAttr); + } + components.add(rcd); + } + ClassHeaderDescription chd = (ClassHeaderDescription) feature; + chd.isRecord = true; + chd.recordComponents = components; + break; + } + case Attribute.MethodParameters: { + assert feature instanceof MethodDescription; + MethodParameters_attribute params = (MethodParameters_attribute) attr; + MethodDescription method = (MethodDescription) feature; + method.methodParameters = new ArrayList<>(); + for (MethodParameters_attribute.Entry e : params.method_parameter_table) { + String name = cf.constant_pool.getUTF8Value(e.name_index); + MethodDescription.MethodParam param = + new MethodDescription.MethodParam(e.flags, name); + method.methodParameters.add(param); + } + break; + } default: throw new IllegalStateException("Unhandled attribute: " + attrName); @@ -2999,6 +3063,8 @@ static class ClassHeaderDescription extends HeaderDescription { List implementsAttr; String nestHost; List nestMembers; + boolean isRecord; + List recordComponents; @Override public int hashCode() { @@ -3007,6 +3073,8 @@ public int hashCode() { hash = 17 * hash + Objects.hashCode(this.implementsAttr); hash = 17 * hash + Objects.hashCode(this.nestHost); hash = 17 * hash + Objects.hashCode(this.nestMembers); + hash = 17 * hash + Objects.hashCode(this.isRecord); + hash = 17 * hash + Objects.hashCode(this.recordComponents); return hash; } @@ -3031,6 +3099,12 @@ public boolean equals(Object obj) { if (!listEquals(this.nestMembers, other.nestMembers)) { return false; } + if (this.isRecord != other.isRecord) { + return false; + } + if (!listEquals(this.recordComponents, other.recordComponents)) { + return false; + } return true; } @@ -3048,8 +3122,12 @@ public void write(Appendable output, String baselineVersion, String version) thr output.append(" nestHost " + nestHost); if (nestMembers != null && !nestMembers.isEmpty()) output.append(" nestMembers " + serializeList(nestMembers)); + if (isRecord) { + output.append(" record true"); + } writeAttributes(output); output.append("\n"); + writeRecordComponents(output, baselineVersion, version); writeInnerClasses(output, baselineVersion, version); } @@ -3065,14 +3143,37 @@ public boolean read(LineBasedReader reader) throws IOException { nestHost = reader.attributes.get("nestHost"); String nestMembersList = reader.attributes.get("nestMembers"); nestMembers = deserializeList(nestMembersList); + isRecord = reader.attributes.containsKey("record"); readAttributes(reader); reader.moveNext(); + if (isRecord) { + readRecordComponents(reader); + } readInnerClasses(reader); return true; } + protected void writeRecordComponents(Appendable output, + String baselineVersion, + String version) throws IOException { + if (recordComponents != null) { + for (RecordComponentDescription rcd : recordComponents) { + rcd.write(output, "", ""); + } + } + } + + protected void readRecordComponents(LineBasedReader reader) throws IOException { + recordComponents = new ArrayList<>(); + + while ("recordcomponent".equals(reader.lineKey)) { + RecordComponentDescription rcd = new RecordComponentDescription(); + rcd.read(reader); + recordComponents.add(rcd); + } + } } static abstract class HeaderDescription extends FeatureDescription { @@ -3145,6 +3246,7 @@ static class MethodDescription extends FeatureDescription { Object annotationDefaultValue; List> classParameterAnnotations; List> runtimeParameterAnnotations; + List methodParameters; public MethodDescription() { flagsNormalization = METHODS_FLAGS_NORMALIZATION; @@ -3221,6 +3323,15 @@ public void write(Appendable output, String baselineVersion, String version) thr output.append(";"); } } + if (methodParameters != null && !methodParameters.isEmpty()) { + Function param2String = + p -> Integer.toHexString(p.flags) + ":" + p.name; + List paramsAsStrings = + methodParameters.stream() + .map(param2String) + .collect(Collectors.toList()); + output.append(" methodParameters " + serializeList(paramsAsStrings)); + } output.append("\n"); } @@ -3268,17 +3379,41 @@ public boolean read(LineBasedReader reader) throws IOException { runtimeParameterAnnotations = annos; } + String inMethodParameters = reader.attributes.get("methodParameters"); + if (inMethodParameters != null) { + Function string2Param = + p -> { + int sep = p.indexOf(':'); + return new MethodParam(Integer.parseInt(p.substring(0, sep)), + p.substring(sep + 1)); + }; + methodParameters = + deserializeList(inMethodParameters).stream() + .map(string2Param) + .collect(Collectors.toList()); + } + reader.moveNext(); return true; } + public static class MethodParam { + public final int flags; + public final String name; + + public MethodParam(int flags, String name) { + this.flags = flags; + this.name = name; + } + } } static class FieldDescription extends FeatureDescription { String name; String descriptor; Object constantValue; + String keyName = "field"; @Override public int hashCode() { @@ -3315,13 +3450,13 @@ public void write(Appendable output, String baselineVersion, String version) thr if (shouldIgnore(baselineVersion, version)) return ; if (!versions.contains(version)) { - output.append("-field"); + output.append("-" + keyName); output.append(" name " + quote(name, false)); output.append(" descriptor " + quote(descriptor, false)); output.append("\n"); return ; } - output.append("field"); + output.append(keyName); output.append(" name " + name); output.append(" descriptor " + descriptor); if (constantValue != null) { @@ -3333,7 +3468,7 @@ public void write(Appendable output, String baselineVersion, String version) thr @Override public boolean read(LineBasedReader reader) throws IOException { - if (!"field".equals(reader.lineKey)) + if (!keyName.equals(reader.lineKey)) return false; name = reader.attributes.get("name"); @@ -3366,6 +3501,19 @@ public boolean read(LineBasedReader reader) throws IOException { } + static final class RecordComponentDescription extends FieldDescription { + + public RecordComponentDescription() { + this.keyName = "recordcomponent"; + } + + @Override + protected boolean shouldIgnore(String baselineVersion, String version) { + return false; + } + + } + static final class AnnotationDescription { String annotationType; Map values; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java index a124bff84c7a6..940ff2bae3827 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java @@ -1516,7 +1516,7 @@ public RecordComponent getRecordComponent(JCVariableDecl var, boolean addIfMissi } RecordComponent rc = null; if (addIfMissing) { - recordComponents = recordComponents.append(rc = new RecordComponent(var, annotations)); + recordComponents = recordComponents.append(rc = new RecordComponent(var.sym, annotations)); } return rc; } @@ -1527,6 +1527,10 @@ public List getRecordComponents() { return recordComponents; } + public void setRecordComponents(List recordComponents) { + this.recordComponents = recordComponents; + } + @DefinedBy(Api.LANGUAGE_MODEL) public NestingKind getNestingKind() { apiComplete(); @@ -1790,10 +1794,17 @@ public static class RecordComponent extends VarSymbol implements RecordComponent /** * Construct a record component, given its flags, name, type and owner. */ - public RecordComponent(JCVariableDecl fieldDecl, List annotations) { - super(PUBLIC, fieldDecl.sym.name, fieldDecl.sym.type, fieldDecl.sym.owner); + public RecordComponent(Name name, Type type, Symbol owner) { + super(PUBLIC, name, type, owner); + pos = -1; + originalAnnos = List.nil(); + isVarargs = false; + } + + public RecordComponent(VarSymbol field, List annotations) { + super(PUBLIC, field.name, field.type, field.owner); this.originalAnnos = annotations; - this.pos = fieldDecl.pos; + this.pos = field.pos; /* it is better to store the original information for this one, instead of relying * on the info in the type of the symbol. This is because on the presence of APs * the symbol will be blown out and we won't be able to know if the original diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 6f22fc9787008..bb3fd28b93045 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1205,7 +1205,16 @@ protected void read(Symbol sym, int attrLen) { if (sym.kind == TYP) { sym.flags_field |= RECORD; } - bp = bp + attrLen; + int componentCount = nextChar(); + ListBuffer components = new ListBuffer<>(); + for (int i = 0; i < componentCount; i++) { + Name name = poolReader.getName(nextChar()); + Type type = poolReader.getType(nextChar()); + RecordComponent c = new RecordComponent(name, type, sym); + readAttrs(c, AttributeKind.MEMBER); + components.add(c); + } + ((ClassSymbol) sym).setRecordComponents(components.toList()); } }, new AttributeReader(names.PermittedSubclasses, V59, CLASS_ATTRIBUTE) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java index 5d3010a11a6a9..f0e47f05d49b3 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java @@ -229,7 +229,7 @@ public PrintingElementVisitor visitType(TypeElement e, Boolean p) { writer.print("("); writer.print(e.getRecordComponents() .stream() - .map(recordDes -> recordDes.asType().toString() + " " + recordDes.getSimpleName()) + .map(recordDes -> annotationsToString(recordDes) + recordDes.asType().toString() + " " + recordDes.getSimpleName()) .collect(Collectors.joining(", "))); writer.print(")"); } @@ -448,7 +448,7 @@ private void printDocComment(Element e) { private void printModifiers(Element e) { ElementKind kind = e.getKind(); - if (kind == PARAMETER) { + if (kind == PARAMETER || kind == RECORD_COMPONENT) { // Print annotation inline writer.print(annotationsToString(e)); } else { @@ -456,7 +456,7 @@ private void printModifiers(Element e) { indent(); } - if (kind == ENUM_CONSTANT) + if (kind == ENUM_CONSTANT || kind == RECORD_COMPONENT) return; Set modifiers = new LinkedHashSet<>(); diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java index badbf90e45323..a24fb837f4309 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java @@ -362,16 +362,14 @@ public void write(Attributes attributes, ClassOutputStream out) { write(a, out); } - // Note: due to the use of shared resources, this method is not reentrant. public void write(Attribute attr, ClassOutputStream out) { out.writeShort(attr.attribute_name_index); - sharedOut.reset(); - attr.accept(this, sharedOut); - out.writeInt(sharedOut.size()); - sharedOut.writeTo(out); + ClassOutputStream nestedOut = new ClassOutputStream(); + attr.accept(this, nestedOut); + out.writeInt(nestedOut.size()); + nestedOut.writeTo(out); } - protected ClassOutputStream sharedOut = new ClassOutputStream(); protected AnnotationWriter annotationWriter = new AnnotationWriter(); @Override @@ -756,8 +754,8 @@ public Void visitSynthetic(Synthetic_attribute attr, ClassOutputStream out) { return null; } - protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) { - sharedOut.writeShort(flags.flags); + protected void writeAccessFlags(AccessFlags flags, ClassOutputStream out) { + out.writeShort(flags.flags); } protected StackMapTableWriter stackMapWriter; diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java index 86a1538625818..942f8f00c049b 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java @@ -76,6 +76,11 @@ public static class Entry { flags = cr.readUnsignedShort(); } + public Entry(int name_index, int flags) { + this.name_index = name_index; + this.flags = flags; + } + public static int length() { return 6; } diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java index 58a3ff967ee04..8d67e6c3016f9 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java @@ -44,6 +44,12 @@ public class Record_attribute extends Attribute { } } + public Record_attribute(int name_index, ComponentInfo[] component_info_arr) { + super(name_index, 2); + this.component_count = component_info_arr.length; + this.component_info_arr = component_info_arr; + } + @Override public R accept(Visitor visitor, D data) { return visitor.visitRecord(this, data); @@ -59,6 +65,12 @@ public static class ComponentInfo { attributes = new Attributes(cr); } + public ComponentInfo(int name_index, Descriptor descriptor, Attributes attributes) { + this.name_index = name_index; + this.descriptor = descriptor; + this.attributes = attributes; + } + public String getName(ConstantPool constant_pool) throws ConstantPoolException { return constant_pool.getUTF8Value(name_index); } diff --git a/make/langtools/test/sym/CreateSymbolsTest.java b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java similarity index 59% rename from make/langtools/test/sym/CreateSymbolsTest.java rename to test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java index 7b0bba038ac76..2f201fd0067da 100644 --- a/make/langtools/test/sym/CreateSymbolsTest.java +++ b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTest.java @@ -25,8 +25,14 @@ * @test * @bug 8072480 * @summary Unit test for CreateSymbols + * @modules java.compiler + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.jvm + * jdk.compiler/com.sun.tools.javac.main + * jdk.compiler/com.sun.tools.javac.util + * jdk.jdeps/com.sun.tools.classfile * @clean * - * @run main CreateSymbolsTest + * @run main/othervm CreateSymbolsTest */ import java.io.IOException; @@ -38,7 +44,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; import javax.tools.JavaCompiler; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; @@ -56,37 +63,58 @@ void doRun() throws Exception { Path compileDir = testClasses.resolve("data"); deleteRecursively(compileDir); Files.createDirectories(compileDir); - Path createSymbols = findFile("../../make/src/classes/build/tools/symbolgenerator/CreateSymbols.java"); + Path createSymbols = findFile("../../make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java"); if (createSymbols == null) { System.err.println("Warning: cannot find CreateSymbols, skipping."); return ; } - Path createTestImpl = findFile("../../make/test/sym/CreateSymbolsTestImpl.java"); + Path createTestImpl = findFile("tools/javac/platform/createsymbols/CreateSymbolsTestImpl.java"); if (createTestImpl == null) { - System.err.println("Warning: cannot find CreateSymbolsTestImpl, skipping."); - return ; + throw new AssertionError("Warning: cannot find CreateSymbolsTestImpl, skipping."); } - Path toolBox = findFile("../../test/tools/lib/ToolBox.java"); + Path toolBox = findFile("tools/lib/toolbox/"); if (toolBox == null) { - System.err.println("Warning: cannot find ToolBox, skipping."); - return ; + throw new AssertionError("Warning: cannot find ToolBox, skipping."); } JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) { - compiler.getTask(null, - null, - null, - Arrays.asList("-d", compileDir.toAbsolutePath().toString()), - null, - fm.getJavaFileObjects(createSymbols, createTestImpl, toolBox) - ).call(); + List files = new ArrayList<>(); + + files.add(createSymbols); + files.add(createTestImpl); + + files.add(toolBox.resolve("AbstractTask.java")); + files.add(toolBox.resolve("JavacTask.java")); + files.add(toolBox.resolve("Task.java")); + files.add(toolBox.resolve("ToolBox.java")); + + Boolean res = + compiler.getTask(null, + null, + null, + List.of("-d", + compileDir.toAbsolutePath().toString(), + "-g", + "--add-modules", "jdk.jdeps", + "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", + "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", + "--add-exports", "jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED"), + null, + fm.getJavaFileObjectsFromPaths(files) + ).call(); + if (!res) { + throw new IllegalStateException("Cannot compile test."); + } } URLClassLoader cl = new URLClassLoader(new URL[] {testClasses.toUri().toURL(), compileDir.toUri().toURL()}); @@ -100,9 +128,9 @@ Path findFile(String path) { for (Path d = testSrc; d != null; d = d.getParent()) { if (Files.exists(d.resolve("TEST.ROOT"))) { - Path createSymbols = d.resolve(path); - if (Files.exists(createSymbols)) { - return createSymbols; + Path file = d.resolve(path); + if (Files.exists(file)) { + return file; } } } diff --git a/make/langtools/test/sym/CreateSymbolsTestImpl.java b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTestImpl.java similarity index 76% rename from make/langtools/test/sym/CreateSymbolsTestImpl.java rename to test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTestImpl.java index 1751a9c6ec93f..83b8f3c7fb754 100644 --- a/make/langtools/test/sym/CreateSymbolsTestImpl.java +++ b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsTestImpl.java @@ -29,7 +29,6 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; -import com.sun.tools.javac.file.ZipFileIndexCache; import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; @@ -37,14 +36,20 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; +import java.util.Enumeration; import java.util.HashSet; import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; import java.util.stream.Collectors; import java.util.stream.Stream; +import toolbox.JavacTask; +import toolbox.Task; +import toolbox.Task.Expect; +import toolbox.ToolBox; import build.tools.symbolgenerator.CreateSymbols; import build.tools.symbolgenerator.CreateSymbols.ClassDescription; import build.tools.symbolgenerator.CreateSymbols.ClassList; -import build.tools.symbolgenerator.CreateSymbols.CtSymKind; import build.tools.symbolgenerator.CreateSymbols.ExcludeIncludeList; import build.tools.symbolgenerator.CreateSymbols.VersionDescription; @@ -59,8 +64,6 @@ public static void main(String... args) throws Exception { void doTest() throws Exception { boolean testRun = false; for (Method m : CreateSymbolsTestImpl.class.getDeclaredMethods()) { - if (!"testIncluded".equals(m.getName())) - continue; if (m.isAnnotationPresent(Test.class)) { m.invoke(this); testRun = true; @@ -76,19 +79,19 @@ void testMethodRemoved() throws Exception { doTest("package t; public class T { public void m() { } }", "package t; public class T { }", "package t; public class Test { { T t = null; t.m(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.FAIL); + Expect.SUCCESS, + Expect.FAIL); doTest("package t; public class T { public void b() { } public void m() { } public void a() { } }", "package t; public class T { public void b() { } public void a() { } }", "package t; public class Test { { T t = null; t.b(); t.a(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); //with additional attribute (need to properly skip the member): doTest("package t; public class T { public void m() throws IllegalStateException { } public void a() { } }", "package t; public class T { public void a() { } }", "package t; public class Test { { T t = null; t.a(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } @Test @@ -96,13 +99,13 @@ void testMethodAdded() throws Exception { doTest("package t; public class T { }", "package t; public class T { public void m() { } }", "package t; public class Test { { T t = null; t.m(); } }", - ToolBox.Expect.FAIL, - ToolBox.Expect.SUCCESS); + Expect.FAIL, + Expect.SUCCESS); doTest("package t; public class T { public void b() { } public void a() { } }", "package t; public class T { public void b() { } public void m() { } public void a() { } }", "package t; public class Test { { T t = null; t.b(); t.a(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } //verify fields added/modified/removed @@ -112,8 +115,8 @@ void testClassAdded() throws Exception { doTest("class Dummy {}", "package t; public class T { }", "package t; public class Test { { T t = new T(); } }", - ToolBox.Expect.FAIL, - ToolBox.Expect.SUCCESS); + Expect.FAIL, + Expect.SUCCESS); } @Test @@ -121,8 +124,8 @@ void testClassModified() throws Exception { doTest("package t; public class T { public void m() { } }", "package t; public class T implements java.io.Serializable { public void m() { } }", "package t; public class Test { { java.io.Serializable t = new T(); } }", - ToolBox.Expect.FAIL, - ToolBox.Expect.SUCCESS); + Expect.FAIL, + Expect.SUCCESS); } @Test @@ -130,17 +133,17 @@ void testClassRemoved() throws Exception { doTest("package t; public class T { }", "class Dummy {}", "package t; public class Test { { T t = new T(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.FAIL); + Expect.SUCCESS, + Expect.FAIL); } @Test void testInnerClassAttributes() throws Exception { doTest("package t; public class T { public static class Inner { } }", - "package t; public class T { public static class Inner { } }", + "package t; public class T { public static class Inner { } public void extra() {} }", "package t; import t.T.Inner; public class Test { Inner i; }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } @Test @@ -148,8 +151,8 @@ void testConstantAdded() throws Exception { doTest("package t; public class T { }", "package t; public class T { public static final int A = 0; }", "package t; public class Test { void t(int i) { switch (i) { case T.A: break;} } }", - ToolBox.Expect.FAIL, - ToolBox.Expect.SUCCESS); + Expect.FAIL, + Expect.SUCCESS); } @Test @@ -173,8 +176,8 @@ void testAnnotationAttributeDefaultvalue() throws Exception { " public SuppressWarnings annotationValue() default @SuppressWarnings(\"cast\");\n" + "}\n", "package t; public @T class Test { }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } @Test @@ -214,7 +217,7 @@ void testConstantTest() throws Exception { void testAnnotations() throws Exception { doPrintElementTest("package t;" + "import java.lang.annotation.*;" + - "public @Visible @Invisible class T { }" + + "public @Visible @Invisible class T { public void extra() { } }" + "@Retention(RetentionPolicy.RUNTIME) @interface Visible { }" + "@Retention(RetentionPolicy.CLASS) @interface Invisible { }", "package t;" + @@ -227,11 +230,12 @@ void testAnnotations() throws Exception { "@t.Invisible\n" + "@t.Visible\n" + "public class T {\n\n" + - " public T();\n" + + " public T();\n\n" + + " public void extra();\n" + "}\n", "t.Visible", "package t;\n\n" + - "@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)\n" + + "@java.lang.annotation.Retention(RUNTIME)\n" + "@interface Visible {\n" + "}\n"); doPrintElementTest("package t;" + @@ -247,6 +251,7 @@ void testAnnotations() throws Exception { "import java.util.*;" + "public class T {" + " public void test(int h, @Invisible int i, @Visible List j, int k) { }" + + " public void extra() { }" + "}" + "@Retention(RetentionPolicy.RUNTIME) @interface Visible { }" + "@Retention(RetentionPolicy.CLASS) @interface Invisible { }", @@ -261,7 +266,7 @@ void testAnnotations() throws Exception { "}\n", "t.Visible", "package t;\n\n" + - "@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)\n" + + "@java.lang.annotation.Retention(RUNTIME)\n" + "@interface Visible {\n" + "}\n"); doPrintElementTest("package t;" + @@ -291,10 +296,10 @@ void testAnnotations() throws Exception { @Test void testStringConstant() throws Exception { doTest("package t; public class T { public static final String C = \"\"; }", - "package t; public class T { public static final String C = \"\"; }", + "package t; public class T { public static final String C = \"\"; public void extra() { } }", "package t; public class Test { { System.err.println(T.C); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } @Test @@ -302,8 +307,8 @@ void testCopyProfileAnnotation() throws Exception { String oldProfileAnnotation = CreateSymbols.PROFILE_ANNOTATION; try { CreateSymbols.PROFILE_ANNOTATION = "Lt/Ann;"; - doTestEquivalence("package t; public class T { public void t() {} } @interface Ann { }", - "package t; public @Ann class T { public void t() {} } @interface Ann { }", + doTestEquivalence("package t; public @Ann class T { public void t() {} } @interface Ann { }", + "package t; public class T { public void t() {} }", "t.T"); } finally { CreateSymbols.PROFILE_ANNOTATION = oldProfileAnnotation; @@ -351,13 +356,13 @@ void testGenerification() throws Exception { doTest("package t; public class T { public class TT { public Object t() { return null; } } }", "package t; public class T { public class TT { public E t() { return null; } } }", "package t; public class Test { { T.TT tt = null; tt.t(); } }", - ToolBox.Expect.SUCCESS, - ToolBox.Expect.SUCCESS); + Expect.SUCCESS, + Expect.SUCCESS); } int i = 0; - void doTest(String code7, String code8, String testCode, ToolBox.Expect result7, ToolBox.Expect result8) throws Exception { + void doTest(String code7, String code8, String testCode, Expect result7, Expect result8) throws Exception { ToolBox tb = new ToolBox(); Path classes = prepareVersionedCTSym(code7, code8); Path output = classes.getParent(); @@ -365,22 +370,24 @@ void doTest(String code7, String code8, String testCode, ToolBox.Expect result7, Files.createDirectories(scratch); - tb.new JavacTask() + new JavacTask(tb) .sources(testCode) - .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "7"), "-XDuseOptimizedZip=false") + .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "7")) .run(result7) .writeAll(); - tb.new JavacTask() + new JavacTask(tb) .sources(testCode) - .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "8"), "-XDuseOptimizedZip=false") + .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "8")) .run(result8) .writeAll(); } private static String computeClassPath(Path classes, String version) throws IOException { try (Stream elements = Files.list(classes)) { - return elements.map(el -> el.toAbsolutePath().toString()) - .collect(Collectors.joining(File.pathSeparator)); + return elements.filter(el -> el.getFileName().toString().contains(version)) + .map(el -> el.resolve("java.base")) + .map(el -> el.toAbsolutePath().toString()) + .collect(Collectors.joining(File.pathSeparator)); } } @@ -393,17 +400,19 @@ void doPrintElementTest(String code7, String code8, String className7, String pr Files.createDirectories(scratch); String out; - out = tb.new JavacTask(ToolBox.Mode.CMDLINE) - .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "7"), "-XDuseOptimizedZip=false", "-Xprint", className7) - .run(ToolBox.Expect.SUCCESS) - .getOutput(ToolBox.OutputKind.STDOUT); + out = new JavacTask(tb, Task.Mode.CMDLINE) + .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "7"), "-Xprint", className7) + .run(Expect.SUCCESS) + .getOutput(Task.OutputKind.STDOUT) + .replaceAll("\\R", "\n"); if (!out.equals(printed7)) { throw new AssertionError("out=" + out + "; printed7=" + printed7); } - out = tb.new JavacTask(ToolBox.Mode.CMDLINE) - .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "8"), "-XDuseOptimizedZip=false", "-Xprint", className8) - .run(ToolBox.Expect.SUCCESS) - .getOutput(ToolBox.OutputKind.STDOUT); + out = new JavacTask(tb, Task.Mode.CMDLINE) + .options("-d", scratch.toAbsolutePath().toString(), "-classpath", computeClassPath(classes, "8"), "-Xprint", className8) + .run(Expect.SUCCESS) + .getOutput(Task.OutputKind.STDOUT) + .replaceAll("\\R", "\n"); if (!out.equals(printed8)) { throw new AssertionError("out=" + out + "; printed8=" + printed8); } @@ -411,7 +420,7 @@ void doPrintElementTest(String code7, String code8, String className7, String pr void doTestEquivalence(String code7, String code8, String testClass) throws Exception { Path classes = prepareVersionedCTSym(code7, code8); - Path classfile = classes.resolve("78").resolve(testClass.replace('.', '/') + ".class"); + Path classfile = classes.resolve("78").resolve("java.base").resolve(testClass.replace('.', '/') + ".class"); if (!Files.isReadable(classfile)) { throw new AssertionError("Cannot find expected class."); @@ -470,12 +479,105 @@ void testIncluded() throws Exception { "t.PPI"); } + @Test + void testRecords() throws Exception { + doPrintElementTest("package t;" + + "public class T {" + + " public record R(int i, java.util.List l) { }" + + "}", + "package t;" + + "public class T {" + + " public record R(@Ann int i, long j, java.util.List l) { }" + + " public @interface Ann {} " + + "}", + "t.T$R", + """ + + public static record R(int i, java.util.List l) { + + public R(int i, + java.util.List l); + + public final java.lang.String toString(); + + public final int hashCode(); + + public final boolean equals(java.lang.Object arg0); + + public int i(); + + public java.util.List l(); + } + """, + "t.T$R", + """ + + public static record R(@t.T.Ann int i, long j, java.util.List l) { + + public final java.lang.String toString(); + + public final int hashCode(); + + public final boolean equals(java.lang.Object arg0); + + public java.util.List l(); + + public R(@t.T.Ann int i, + long j, + java.util.List l); + + @t.T.Ann + public int i(); + + public long j(); + } + """); + doPrintElementTest("package t;" + + "public record R() {" + + "}", + "package t;" + + "public record R(int i) {" + + "}", + "t.R", + """ + package t; + \n\ + public record R() { + \n\ + public R(); + \n\ + public final java.lang.String toString(); + \n\ + public final int hashCode(); + \n\ + public final boolean equals(java.lang.Object arg0); + } + """, + "t.R", + """ + package t; + \n\ + public record R(int i) { + \n\ + public final java.lang.String toString(); + \n\ + public final int hashCode(); + \n\ + public final boolean equals(java.lang.Object arg0); + \n\ + public R(int i); + \n\ + public int i(); + } + """); + } + void doTestIncluded(String code, String... includedClasses) throws Exception { boolean oldIncludeAll = includeAll; try { includeAll = false; Path classes = prepareVersionedCTSym(code, "package other; public class Other {}"); - Path root = classes.resolve("7"); + Path root = classes.resolve("7").resolve("java.base"); try (Stream classFiles = Files.walk(root)) { Set names = classFiles.map(p -> root.relativize(p)) .map(p -> p.toString()) @@ -503,11 +605,7 @@ Path prepareVersionedCTSym(String code7, String code8) throws Exception { Path ver8Jar = output.resolve("8.jar"); compileAndPack(output, ver8Jar, code8); - ZipFileIndexCache.getSharedInstance().clearCache(); - - Path classes = output.resolve("classes"); - - Files.createDirectories(classes); + Path classes = output.resolve("classes.zip"); Path ctSym = output.resolve("ct.sym"); @@ -518,7 +616,21 @@ Path prepareVersionedCTSym(String code7, String code8) throws Exception { testGenerate(ver7Jar, ver8Jar, ctSym, "8", classes.toAbsolutePath().toString()); - return classes; + Path classesDir = output.resolve("classes"); + + try (JarFile jf = new JarFile(classes.toFile())) { + Enumeration en = jf.entries(); + + while (en.hasMoreElements()) { + JarEntry je = en.nextElement(); + if (je.isDirectory()) continue; + Path target = classesDir.resolve(je.getName()); + Files.createDirectories(target.getParent()); + Files.copy(jf.getInputStream(je), target); + } + } + + return classesDir; } boolean includeAll = true; @@ -540,17 +652,18 @@ void testGenerate(Path jar7, Path jar8, Path descDest, String version, String cl protected boolean includeEffectiveAccess(ClassList classes, ClassDescription clazz) { return includeAll ? true : super.includeEffectiveAccess(classes, clazz); } - }.createBaseLine(versions, acceptAll, descDest, null); + }.createBaseLine(versions, acceptAll, descDest, new String[0]); Path symbolsDesc = descDest.resolve("symbols"); - try (Writer symbolsFile = Files.newBufferedWriter(symbolsDesc)) { - symbolsFile.write("generate platforms 7:8"); - symbolsFile.write(System.lineSeparator()); - symbolsFile.write("platform version 7 files java.base-7.sym.txt"); - symbolsFile.write(System.lineSeparator()); - symbolsFile.write("platform version 8 base 7 files java.base-8.sym.txt"); - symbolsFile.write(System.lineSeparator()); + Path systemModules = descDest.resolve("systemModules"); + + Files.newBufferedWriter(systemModules).close(); + + try { + new CreateSymbols().createSymbols(null, symbolsDesc.toAbsolutePath().toString(), classDest, 0, "8", systemModules.toString()); + } catch (Throwable t) { + t.printStackTrace(); + throw t; } - new CreateSymbols().createSymbols(symbolsDesc.toAbsolutePath().toString(), classDest, CtSymKind.JOINED_VERSIONS); } void compileAndPack(Path output, Path outputFile, String... code) throws Exception { @@ -559,7 +672,7 @@ void compileAndPack(Path output, Path outputFile, String... code) throws Excepti deleteRecursively(scratch); Files.createDirectories(scratch); System.err.println(Arrays.asList(code)); - tb.new JavacTask().sources(code).options("-d", scratch.toAbsolutePath().toString()).run(ToolBox.Expect.SUCCESS); + new JavacTask(tb).sources(code).options("-d", scratch.toAbsolutePath().toString()).run(Expect.SUCCESS); List classFiles = collectClassFile(scratch); try (Writer out = Files.newBufferedWriter(outputFile)) { for (String classFile : classFiles) { diff --git a/test/langtools/tools/javac/records/RecordReading.java b/test/langtools/tools/javac/records/RecordReading.java new file mode 100644 index 0000000000000..6133a04fca935 --- /dev/null +++ b/test/langtools/tools/javac/records/RecordReading.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2020, 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 the records can be read by javac properly + * @library /tools/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask + * @run main RecordReading + */ + + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; +import toolbox.TestRunner; +import toolbox.ToolBox; +import toolbox.JavacTask; +import toolbox.Task; + +public class RecordReading extends TestRunner { + ToolBox tb; + + RecordReading() { + super(System.err); + tb = new ToolBox(); + } + + protected void runTests() throws Exception { + runTests(m -> new Object[]{Paths.get(m.getName())}); + } + + public static void main(String... args) throws Exception { + RecordReading t = new RecordReading(); + t.runTests(); + } + + Path[] findJavaFiles(Path... paths) throws IOException { + return tb.findJavaFiles(paths); + } + + @Test + public void testRecordClassFileReading(Path base) throws Exception { + Path src = base.resolve("src"); + + tb.writeJavaFiles(src, + """ + public record R(int i, @A long j, java.util.List l) {} + """, + """ + public @interface A {} + """); + + Path out = base.resolve("out"); + Files.createDirectories(out); + + new JavacTask(tb) + .outdir(out) + .files(findJavaFiles(src)) + .run(); + + //read the class file back, to verify javac's ClassReader + //reads the Record attribute properly: + String output = new JavacTask(tb) + .options("-Xprint") + .classpath(out.toString()) + .classes("R") + .run() + .writeAll() + .getOutput(Task.OutputKind.STDOUT) + .replaceAll("\\R", "\n"); + + String expected = + """ + \n\ + public record R(int i, @A long j, java.util.List l) { + private final int i; + @A + private final long j; + private final java.util.List l; + \n\ + public R(int i, + @A long j, + java.util.List l); + \n\ + public final java.lang.String toString(); + \n\ + public final int hashCode(); + \n\ + public final boolean equals(java.lang.Object arg0); + \n\ + public int i(); + \n\ + @A + public long j(); + \n\ + public java.util.List l(); + } + """; + if (!Objects.equals(expected, output)) { + throw new AssertionError("Unexpected output: " + output); + } + } + +} From 6c69eca380368308ac65a45f353c5d4ac47f3f46 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 9 Dec 2020 15:41:08 +0000 Subject: [PATCH 158/504] 8257973: UTIL_LOOKUP_PROGS should only find executable files Reviewed-by: erikj --- make/autoconf/util_paths.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index 497332f4509c2..7472a8e9be270 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -391,7 +391,7 @@ AC_DEFUN([UTIL_LOOKUP_PROGS], # Try again with .exe full_path="$elem/$name.exe" fi - if test -e "$full_path"; then + if test -x "$full_path" && test ! -d "$full_path" ; then $1="$full_path" UTIL_FIXUP_EXECUTABLE($1, $3, $4) result="[$]$1" From cf62b0ad869979b0ce307d625794dcd05cbec6ec Mon Sep 17 00:00:00 2001 From: Eric Caspole Date: Wed, 9 Dec 2020 15:55:33 +0000 Subject: [PATCH 159/504] 8257518: LogCompilation: java.lang.InternalError with JFR turned on Reviewed-by: kvn, redestad --- .../sun/hotspot/tools/compiler/LogParser.java | 13 +++++- .../tools/compiler/MakeNotEntrantEvent.java | 43 +++++++++++++++++++ .../tools/compiler/TestLogCompilation.java | 15 ++++++- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index 8318c3c6352a6..ab76ab8fae96d 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -716,7 +716,12 @@ public static ArrayList parse(Reader reader, boolean cleanup) throws E Compilation c = log.compiles.get(ble.getId()); if (c == null) { if (!(ble instanceof NMethod)) { - throw new InternalError("only nmethods should have a null compilation, here's a " + ble.getClass()); + if (ble instanceof MakeNotEntrantEvent && ((MakeNotEntrantEvent) ble).getCompileKind().equals("c2n")) { + // this is ok for c2n + assert ((MakeNotEntrantEvent) ble).getLevel().equals("0") : "Should be level 0"; + } else { + throw new InternalError("only nmethods should have a null compilation, here's a " + ble.getClass()); + } } continue; } @@ -1071,8 +1076,12 @@ public void startElement(String uri, String localName, String qname, Attributes String id = makeId(atts); NMethod nm = nmethods.get(id); if (nm == null) reportInternalError("nm == null"); - LogEvent e = new MakeNotEntrantEvent(Double.parseDouble(search(atts, "stamp")), id, + MakeNotEntrantEvent e = new MakeNotEntrantEvent(Double.parseDouble(search(atts, "stamp")), id, atts.getValue("zombie") != null, nm); + String compileKind = atts.getValue("compile_kind"); + e.setCompileKind(compileKind); + String level = atts.getValue("level"); + e.setLevel(level); events.add(e); } else if (qname.equals("uncommon_trap")) { String id = atts.getValue("compile_id"); diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java index 5d73ebaa4cede..b4015537c7420 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java @@ -42,6 +42,16 @@ class MakeNotEntrantEvent extends BasicLogEvent { */ private NMethod nmethod; + /** + * The compilation level. + */ + private String level; + + /** + * The compile kind. + */ + private String compileKind; + MakeNotEntrantEvent(double s, String i, boolean z, NMethod nm) { super(s, i); zombie = z; @@ -63,4 +73,37 @@ public void print(PrintStream stream, boolean printID) { public boolean isZombie() { return zombie; } + + /** + * @return the level + */ + public String getLevel() { + return level; + } + + /** + * @param level the level to set + */ + public void setLevel(String level) { + this.level = level; + } + + /** + * @return the compileKind + */ + public String getCompileKind() { + return compileKind; + } + + /** + * @param compileKind the compileKind to set + */ + public void setCompileKind(String compileKind) { + this.compileKind = compileKind; + } + + public String toString() { + return "MakeNotEntrantEvent zombie:" + isZombie() + ", id:" + getId() + ", kind:" + getCompileKind(); + } + } diff --git a/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestLogCompilation.java b/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestLogCompilation.java index 83762df16d68a..33cda03a30b0f 100644 --- a/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestLogCompilation.java +++ b/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestLogCompilation.java @@ -76,12 +76,22 @@ public class TestLogCompilation { "-Xbatch" }; + static final String setupArgsJFR[] = { + "java", + "-XX:+IgnoreUnrecognizedVMOptions", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+LogCompilation", + "-XX:LogFile=target/jfr.log", + "-XX:StartFlightRecording=dumponexit=true,filename=rwrecording.jfr" + }; + static final String allSetupArgs[][] = { setupArgsTieredVersion, setupArgsTiered, setupArgsTieredBatch, setupArgsNoTiered, - setupArgsNoTieredBatch + setupArgsNoTieredBatch, + setupArgsJFR }; @Parameters @@ -92,7 +102,8 @@ public static Collection data() { {"./target/tiered_short.log"}, {"./target/tiered_short_batch.log"}, {"./target/no_tiered_short.log"}, - {"./target/no_tiered_short_batch.log"} + {"./target/no_tiered_short_batch.log"}, + {"./target/jfr.log"}, }; assert data.length == allSetupArgs.length : "Files dont match args."; return Arrays.asList(data); From bd22aa5e86a3ec847bde6822f87d54b2082b4a1b Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 9 Dec 2020 16:49:50 +0000 Subject: [PATCH 160/504] 8229862: NPE in jdk.compiler/com.sun.tools.javac.jvm.Code.emitop0(Code.java:570) Co-authored-by: Bernard Blaser Reviewed-by: vromero --- .../sun/tools/javac/comp/LambdaToMethod.java | 2 +- .../com/sun/tools/javac/comp/Lower.java | 9 +++- .../tools/javac/lambda/LambdaConv30.java | 54 +++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 test/langtools/tools/javac/lambda/LambdaConv30.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index c416d18833746..f0a27f7b8d548 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -1454,11 +1454,11 @@ public void visitNewClass(JCNewClass tree) { localContext = localContext.prev; } } + super.visitNewClass(tree); if (context() != null && !inReferencedClass && isLocal) { LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context(); captureLocalClassDefs(def, lambdaContext); } - super.visitNewClass(tree); } //where void captureLocalClassDefs(Symbol csym, final LambdaTranslationContext lambdaContext) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index 095e5f68d28e3..9eaa36bc49807 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -2827,7 +2827,14 @@ public void visitNewClass(JCNewClass tree) { // If we have an anonymous class, create its flat version, rather // than the class or interface following new. if (tree.def != null) { - translate(tree.def); + Map prevLambdaTranslationMap = lambdaTranslationMap; + try { + lambdaTranslationMap = null; + translate(tree.def); + } finally { + lambdaTranslationMap = prevLambdaTranslationMap; + } + tree.clazz = access(make_at(tree.clazz.pos()).Ident(tree.def.sym)); tree.def = null; } else { diff --git a/test/langtools/tools/javac/lambda/LambdaConv30.java b/test/langtools/tools/javac/lambda/LambdaConv30.java new file mode 100644 index 0000000000000..52e26fa2b495a --- /dev/null +++ b/test/langtools/tools/javac/lambda/LambdaConv30.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020, 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 8229862 + * @summary Verifying lambdas anonymous classes whose supertype captures works. + * @compile LambdaConv30.java + * @run main LambdaConv30 + */ +public class LambdaConv30 { + + public static void main(String[] args) { + Integer a = 1; + class Inner { + int i; + Inner(int i) { + this.i = i; + } + + public int result() { + return a * 1000 + i; + } + } + SAM s = v -> new Inner(v) { }.result(); + if (s.m(2) != 1002) { + throw new AssertionError("Unexpected value!"); + } + } + + interface SAM { + int m(int v); + } +} From 6dd06add9d6c4a4198541118f4bea209ba995609 Mon Sep 17 00:00:00 2001 From: Patrick Concannon Date: Wed, 9 Dec 2020 17:03:07 +0000 Subject: [PATCH 161/504] 8254996: make jdk.net.UnixDomainPrincipal a record class Reviewed-by: dfuchs, michaelm --- .../classes/jdk/net/UnixDomainPrincipal.java | 56 +++---------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/src/jdk.net/share/classes/jdk/net/UnixDomainPrincipal.java b/src/jdk.net/share/classes/jdk/net/UnixDomainPrincipal.java index 0808204d37389..f3b1c94c9a311 100644 --- a/src/jdk.net/share/classes/jdk/net/UnixDomainPrincipal.java +++ b/src/jdk.net/share/classes/jdk/net/UnixDomainPrincipal.java @@ -34,65 +34,23 @@ * * Unix domain socket. * + * @param user the user identity + * @param group the group identity + * * @since 16 */ - -public final class UnixDomainPrincipal { - private final UserPrincipal user; - private final GroupPrincipal group; +public record UnixDomainPrincipal(UserPrincipal user, GroupPrincipal group) { /** * Creates a UnixDomainPrincipal. * * @param user the user identity - * * @param group the group identity * * @throws NullPointerException if {@code user} or {@code group} are {@code null}. */ - public UnixDomainPrincipal(UserPrincipal user, GroupPrincipal group) { - this.user = Objects.requireNonNull(user); - this.group = Objects.requireNonNull(group); - } - - /** - * Returns true if {@code obj} is a {@code UnixDomainPrincipal} - * and its user and group are equal to this user and group. - * - * @param obj the object to compare with - * @return true if this equal to obj - */ - public boolean equals(Object obj) { - if (obj instanceof UnixDomainPrincipal) { - UnixDomainPrincipal that = (UnixDomainPrincipal) obj; - return Objects.equals(this.user, that.user) - && Objects.equals(this.group, that.group); - } - return false; - } - - /** - * Returns a hashcode calculated from the user and group - */ - public int hashCode() { - return Objects.hash(user, group); - } - - /** - * Returns this object's {@link UserPrincipal} - * - * @return this object's user - */ - public UserPrincipal user() { - return user; - } - - /** - * Returns this object's {@link GroupPrincipal} - * - * @return this object's user - */ - public GroupPrincipal group() { - return group; + public UnixDomainPrincipal { + Objects.requireNonNull(user); + Objects.requireNonNull(group); } } From 5f0334121153332873f952fdc6828b9926171bbe Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Wed, 9 Dec 2020 17:27:02 +0000 Subject: [PATCH 162/504] 8052260: Reference.isEnqueued() spec does not match the long-standing behavior returning true iff it's in the ref queue Reviewed-by: kbarrett, alanb --- .../classes/java/lang/ref/Reference.java | 35 +++++++++++++++---- .../jdk/internal/ref/PhantomCleanable.java | 1 + 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/java.base/share/classes/java/lang/ref/Reference.java b/src/java.base/share/classes/java/lang/ref/Reference.java index 386cb99fbcddd..cc889fd110b95 100644 --- a/src/java.base/share/classes/java/lang/ref/Reference.java +++ b/src/java.base/share/classes/java/lang/ref/Reference.java @@ -411,14 +411,35 @@ void clearInactiveFinalReference() { /* -- Queue operations -- */ /** - * Tells whether or not this reference object has been enqueued, either by - * the program or by the garbage collector. If this reference object was - * not registered with a queue when it was created, then this method will - * always return {@code false}. - * - * @return {@code true} if and only if this reference object has - * been enqueued + * Tests if this reference object is in its associated queue, if any. + * This method returns {@code true} only if all of the following conditions + * are met: + *

        + *
      • this reference object was registered with a queue when it was created; and + *
      • the garbage collector has added this reference object to the queue + * or {@link #enqueue()} is called; and + *
      • this reference object is not yet removed from the queue. + *
      + * Otherwise, this method returns {@code false}. + * This method may return {@code false} if this reference object has been cleared + * but not enqueued due to the race condition. + * + * @deprecated + * This method was originally specified to test if a reference object has + * been cleared and enqueued but was never implemented to do this test. + * This method could be misused due to the inherent race condition + * or without an associated {@code ReferenceQueue}. + * An application relying on this method to release critical resources + * could cause serious performance issue. + * An application should use {@link ReferenceQueue} to reliably determine + * what reference objects that have been enqueued or + * {@link #refersTo(Object) refersTo(null)} to determine if this reference + * object has been cleared. + * + * @return {@code true} if and only if this reference object is + * in its associated queue (if any). */ + @Deprecated(since="16") public boolean isEnqueued() { return (this.queue == ReferenceQueue.ENQUEUED); } diff --git a/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java b/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java index bbcf99483c1ac..24db6d8ef9a07 100644 --- a/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java +++ b/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java @@ -160,6 +160,7 @@ public void clear() { * * @throws UnsupportedOperationException always */ + @SuppressWarnings("deprecation") @Override public final boolean isEnqueued() { throw new UnsupportedOperationException("isEnqueued"); From b977a7b8a52c0677f9dded90170116ebaa27f911 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Wed, 9 Dec 2020 18:59:09 +0000 Subject: [PATCH 163/504] 8257989: Error in gtest os_page_size_for_region_unaligned after 8257588 Reviewed-by: stuefe --- test/hotspot/gtest/runtime/test_os.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 85a71f1fe802d..a16de0e351c06 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -102,7 +102,7 @@ TEST_VM(os, page_size_for_region_unaligned) { for (size_t s = os::page_sizes().largest(); s != 0; s = os::page_sizes().next_smaller(s)) { const size_t expected = os::page_sizes().next_smaller(s); if (expected != 0) { - size_t actual = os::page_size_for_region_unaligned(expected - 17, 1); + size_t actual = os::page_size_for_region_unaligned(s - 17, 1); ASSERT_EQ(actual, expected); } } From e6b4c4d7162e9adf65aff321af08dab52cbde76e Mon Sep 17 00:00:00 2001 From: Alexander Matveev Date: Wed, 9 Dec 2020 19:02:15 +0000 Subject: [PATCH 164/504] 8238781: [macos] jpackage tests failed due to "hdiutil: convert failed" in various ways Reviewed-by: herrick, asemenyuk --- .../classes/jdk/jpackage/internal/MacDmgBundler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java index a1989ec066ebe..2fed52cc834a6 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java @@ -469,7 +469,10 @@ private Path buildDMG( Map params, hdiUtilVerbosityFlag, "-format", "UDZO", "-o", finalDMG.toAbsolutePath().toString()); - IOUtils.exec(pb); + new RetryExecutor() + .setMaxAttemptsCount(10) + .setAttemptTimeoutMillis(3000) + .execute(pb); //add license if needed if (Files.exists(getConfig_LicenseFile(params))) { @@ -480,7 +483,10 @@ private Path buildDMG( Map params, "-xml", getConfig_LicenseFile(params).toAbsolutePath().toString() ); - IOUtils.exec(pb); + new RetryExecutor() + .setMaxAttemptsCount(10) + .setAttemptTimeoutMillis(3000) + .execute(pb); } //Delete the temporary image From d33a689b96f87dea15735655e82194065851f239 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 9 Dec 2020 19:07:11 +0000 Subject: [PATCH 165/504] 8256867: Classes with empty PermittedSubclasses attribute cannot be extended Reviewed-by: lfoltan, mchung, jlahoda, chegar --- .../share/classfile/classFileParser.cpp | 26 +++---- src/hotspot/share/oops/instanceKlass.cpp | 3 +- src/hotspot/share/prims/jvm.cpp | 6 +- .../share/classes/java/lang/Class.java | 22 ++++-- .../sealedClasses/GetPermittedSubclasses.jcod | 76 +++++++++++++++++-- .../GetPermittedSubclassesTest.java | 74 ++++++++++++------ .../SealedClassesReflectionTest.java | 6 +- .../javac/sealed/SealedCompilationTests.java | 2 +- 8 files changed, 154 insertions(+), 61 deletions(-) diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 9130018b3e390..1282b373f06e4 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -3363,25 +3363,23 @@ u2 ClassFileParser::parse_classfile_permitted_subclasses_attribute(const ClassFi cfs->guarantee_more(2, CHECK_0); // length length = cfs->get_u2_fast(); } - if (length < 1) { - classfile_parse_error("PermittedSubclasses attribute is empty in class file %s", THREAD); - return 0; - } const int size = length; Array* const permitted_subclasses = MetadataFactory::new_array(_loader_data, size, CHECK_0); _permitted_subclasses = permitted_subclasses; - int index = 0; - cfs->guarantee_more(2 * length, CHECK_0); - for (int n = 0; n < length; n++) { - const u2 class_info_index = cfs->get_u2_fast(); - check_property( - valid_klass_reference_at(class_info_index), - "Permitted subclass class_info_index %u has bad constant type in class file %s", - class_info_index, CHECK_0); - permitted_subclasses->at_put(index++, class_info_index); + if (length > 0) { + int index = 0; + cfs->guarantee_more(2 * length, CHECK_0); + for (int n = 0; n < length; n++) { + const u2 class_info_index = cfs->get_u2_fast(); + check_property( + valid_klass_reference_at(class_info_index), + "Permitted subclass class_info_index %u has bad constant type in class file %s", + class_info_index, CHECK_0); + permitted_subclasses->at_put(index++, class_info_index); + } + assert(index == size, "wrong size"); } - assert(index == size, "wrong size"); // Restore buffer's current position. cfs->set_current(current_mark); diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index e4918ec653362..0c54c2db4e0f4 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -741,8 +741,7 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) { bool InstanceKlass::is_sealed() const { return _permitted_subclasses != NULL && - _permitted_subclasses != Universe::the_empty_short_array() && - _permitted_subclasses->length() > 0; + _permitted_subclasses != Universe::the_empty_short_array(); } bool InstanceKlass::should_be_initialized() const { diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 9bb29a8993cf8..8f9464add4fc4 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -2124,10 +2124,10 @@ JVM_ENTRY(jobjectArray, JVM_GetPermittedSubclasses(JNIEnv* env, jclass current)) Klass* c = java_lang_Class::as_Klass(mirror); assert(c->is_instance_klass(), "must be"); InstanceKlass* ik = InstanceKlass::cast(c); - { + if (ik->is_sealed()) { JvmtiVMObjectAllocEventCollector oam; Array* subclasses = ik->permitted_subclasses(); - int length = subclasses == NULL ? 0 : subclasses->length(); + int length = subclasses->length(); objArrayOop r = oopFactory::new_objArray(SystemDictionary::Class_klass(), length, CHECK_NULL); objArrayHandle result(THREAD, r); @@ -2156,6 +2156,8 @@ JVM_ENTRY(jobjectArray, JVM_GetPermittedSubclasses(JNIEnv* env, jclass current)) return (jobjectArray)JNIHandles::make_local(THREAD, result2()); } return (jobjectArray)JNIHandles::make_local(THREAD, result()); + } else { + return NULL; } } JVM_END diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 2657667bea222..5157704445564 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -4390,10 +4390,13 @@ public Optional describeConstable() { * * Returns an array containing {@code Class} objects representing the * direct subinterfaces or subclasses permitted to extend or - * implement this class or interface if it is sealed. The order of such elements - * is unspecified. If this {@code Class} object represents a primitive type, + * implement this class or interface if it is sealed. The order of such elements + * is unspecified. The array is empty if this sealed class or interface has no + * permitted subclass. If this {@code Class} object represents a primitive type, * {@code void}, an array type, or a class or interface that is not sealed, - * an empty array is returned. + * that is {@link #isSealed()} returns {@code false}, then this method returns {@code null}. + * Conversely, if {@link #isSealed()} returns {@code true}, then this method + * returns a non-null value. * * For each class or interface {@code C} which is recorded as a permitted * direct subinterface or subclass of this class or interface, @@ -4406,7 +4409,8 @@ public Optional describeConstable() { * cannot be obtained, it is silently ignored, and not included in the result * array. * - * @return an array of {@code Class} objects of the permitted subclasses of this class or interface + * @return an array of {@code Class} objects of the permitted subclasses of this class or interface, + * or {@code null} if this class or interface is not sealed. * * @throws SecurityException * If a security manager, s, is present and the caller's @@ -4423,8 +4427,8 @@ public Optional describeConstable() { @CallerSensitive public Class[] getPermittedSubclasses() { Class[] subClasses; - if (isArray() || isPrimitive() || (subClasses = getPermittedSubclasses0()).length == 0) { - return EMPTY_CLASS_ARRAY; + if (isArray() || isPrimitive() || (subClasses = getPermittedSubclasses0()) == null) { + return null; } if (subClasses.length > 0) { if (Arrays.stream(subClasses).anyMatch(c -> !isDirectSubType(c))) { @@ -4469,7 +4473,9 @@ private boolean isDirectSubType(Class c) { * Returns {@code true} if and only if this {@code Class} object represents * a sealed class or interface. If this {@code Class} object represents a * primitive type, {@code void}, or an array type, this method returns - * {@code false}. + * {@code false}. A sealed class or interface has (possibly zero) permitted + * subclasses; {@link #getPermittedSubclasses()} returns a non-null but + * possibly empty value for a sealed class or interface. * * @return {@code true} if and only if this {@code Class} object represents a sealed class or interface. * @@ -4483,7 +4489,7 @@ public boolean isSealed() { if (isArray() || isPrimitive()) { return false; } - return getPermittedSubclasses().length != 0; + return getPermittedSubclasses() != null; } private native Class[] getPermittedSubclasses0(); diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod index ba42c193518e8..8d4758edc96c9 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod @@ -164,7 +164,7 @@ class ExistingClassFile { } // end class ExistingClassFile // This class contains an empty PermittedSubclasses attribute. Test that -// this causes an exception to get thrown. +// this does not cause an exception to get thrown. class NoSubclasses { 0xCAFEBABE; 65535; // minor version @@ -223,17 +223,83 @@ class NoSubclasses { } // methods [2] { // Attributes - Attr(#11, 2) { // SourceFile at 0xD8 - #12; - } // end SourceFile - ; Attr(#13, 2) { // PermittedSubclasses at 0xE0 0x0000; } // end PermittedSubclasses + ; + Attr(#11, 2) { // SourceFile at 0xD8 + #12; + } // end SourceFile } // Attributes } // end class NoSubclasses +// This class extends NoSubClasses to show that a class with an empty +// PermittedSubtypes attribute cannot be subclass-ed. +class SubClass { + 0xCAFEBABE; + 65535; // minor version + 60; // version + [13] { // Constant Pool + ; // first element is empty + Method #2 #3; // #1 at 0x0A + class #4; // #2 at 0x0F + NameAndType #5 #6; // #3 at 0x12 + Utf8 "NoSubclasses"; // #4 at 0x17 + Utf8 ""; // #5 at 0x26 + Utf8 "()V"; // #6 at 0x2F + class #8; // #7 at 0x35 + Utf8 "SubClass"; // #8 at 0x38 + Utf8 "Code"; // #9 at 0x43 + Utf8 "LineNumberTable"; // #10 at 0x4A + Utf8 "SourceFile"; // #11 at 0x5C + Utf8 "SubClass.java"; // #12 at 0x69 + } // Constant Pool + + 0x0021; // access [ ACC_PUBLIC ACC_SUPER ] + #7;// this_cpx + #2;// super_cpx + + [0] { // Interfaces + } // Interfaces + + [0] { // Fields + } // Fields + + [1] { // Methods + { // method at 0x85 + 0x0001; // access + #5; // name_index : + #6; // descriptor_index : ()V + [1] { // Attributes + Attr(#9, 29) { // Code at 0x8D + 1; // max_stack + 1; // max_locals + Bytes[5]{ + 0x2AB70001B1; + } + [0] { // Traps + } // end Traps + [1] { // Attributes + Attr(#10, 6) { // LineNumberTable at 0xA4 + [1] { // line_number_table + 0 1; // at 0xB0 + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } + } // Methods + + [1] { // Attributes + Attr(#11, 2) { // SourceFile at 0xB2 + #12; + } // end SourceFile + } // Attributes +} // end class SubClass + + // This class has a PermittedSubclasses attribute but an old class file version. // The PermittedSubclasses attribute should be ignored. diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java index 67b0f0d2ec15a..d77de99cf4025 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclassesTest.java @@ -50,15 +50,16 @@ final class NotSealed implements SealedI1 {} final class Final4 {} - public static void testSealedInfo(Class c, String[] expected) { + public static void testSealedInfo(Class c, String[] expected, boolean isSealed) { var permitted = c.getPermittedSubclasses(); - if (permitted.length != expected.length) { - throw new RuntimeException( - "Unexpected number of permitted subclasses for: " + c.toString() + "(" + java.util.Arrays.asList(permitted)); - } + if (isSealed) { + if (permitted.length != expected.length) { + throw new RuntimeException( + "Unexpected number of permitted subclasses for: " + c.toString() + + "(" + java.util.Arrays.asList(permitted)); + } - if (permitted.length > 0) { if (!c.isSealed()) { throw new RuntimeException("Expected sealed class: " + c.toString()); } @@ -83,63 +84,86 @@ public static void testSealedInfo(Class c, String[] expected) { } } } else { - // Must not be sealed if no permitted subclasses. - if (c.isSealed()) { + // Must not be sealed. + if (c.isSealed() || permitted != null) { throw new RuntimeException("Unexpected sealed class: " + c.toString()); } } } - public static void testBadSealedClass(String className, String expectedCFEMessage) throws Throwable { + public static void testBadSealedClass(String className, + Class expectedException, + String expectedCFEMessage) throws Throwable { try { Class.forName(className); throw new RuntimeException("Expected ClassFormatError exception not thrown for " + className); } catch (ClassFormatError cfe) { + if (ClassFormatError.class != expectedException) { + throw new RuntimeException( + "Class " + className + " got unexpected exception: " + cfe.getMessage()); + } if (!cfe.getMessage().contains(expectedCFEMessage)) { throw new RuntimeException( "Class " + className + " got unexpected ClassFormatError exception: " + cfe.getMessage()); } + } catch (IncompatibleClassChangeError icce) { + if (IncompatibleClassChangeError.class != expectedException) { + throw new RuntimeException( + "Class " + className + " got unexpected exception: " + icce.getMessage()); + } + if (!icce.getMessage().contains(expectedCFEMessage)) { + throw new RuntimeException( + "Class " + className + " got unexpected IncompatibleClassChangeError exception: " + icce.getMessage()); + } } } public static void main(String... args) throws Throwable { testSealedInfo(SealedI1.class, new String[] {"GetPermittedSubclassesTest$NotSealed", "GetPermittedSubclassesTest$Sub1", - "GetPermittedSubclassesTest$Extender"}); + "GetPermittedSubclassesTest$Extender"}, + true); - testSealedInfo(Sealed1.class, new String[] {"GetPermittedSubclassesTest$Sub1"}); - testSealedInfo(Final4.class, new String[] { }); - testSealedInfo(NotSealed.class, new String[] { }); + testSealedInfo(Sealed1.class, new String[] {"GetPermittedSubclassesTest$Sub1"}, true); + testSealedInfo(Final4.class, null, false); + testSealedInfo(NotSealed.class, null, false); // Test class with PermittedSubclasses attribute but old class file version. - testSealedInfo(OldClassFile.class, new String[] { }); + testSealedInfo(OldClassFile.class, null, false); // Test class with an empty PermittedSubclasses attribute. - testBadSealedClass("NoSubclasses", "PermittedSubclasses attribute is empty"); + testSealedInfo(NoSubclasses.class, new String[]{}, true); + + // Test that a class with an empty PermittedSubclasses attribute cannot be subclass-ed. + testBadSealedClass("SubClass", IncompatibleClassChangeError.class, + "SubClass cannot inherit from sealed class NoSubclasses"); // Test returning only names of existing classes. - testSealedInfo(NoLoadSubclasses.class, new String[]{"ExistingClassFile" }); + testSealedInfo(NoLoadSubclasses.class, new String[]{"ExistingClassFile" }, true); // Test that loading a class with a corrupted PermittedSubclasses attribute // causes a ClassFormatError. - testBadSealedClass("BadPermittedAttr", - "Permitted subclass class_info_index 15 has bad constant type"); + testBadSealedClass("BadPermittedAttr", ClassFormatError.class, + "Permitted subclass class_info_index 15 has bad constant type"); // Test that loading a sealed final class with a PermittedSubclasses // attribute causes a ClassFormatError. - testBadSealedClass("SealedButFinal", "PermittedSubclasses attribute in final class"); + testBadSealedClass("SealedButFinal", ClassFormatError.class, + "PermittedSubclasses attribute in final class"); - // Test that loading a sealed class with a bad class name in its PermittedSubclasses - // attribute causes a ClassFormatError. - testBadSealedClass("BadPermittedSubclassEntry", "Illegal class name \"iDont;;Exist\" in class file"); + // Test that loading a sealed class with an ill-formed class name in its + // PermittedSubclasses attribute causes a ClassFormatError. + testBadSealedClass("BadPermittedSubclassEntry", ClassFormatError.class, + "Illegal class name \"iDont;;Exist\" in class file"); // Test that loading a sealed class with an empty class name in its PermittedSubclasses // attribute causes a ClassFormatError. - testBadSealedClass("EmptyPermittedSubclassEntry", "Illegal class name \"\" in class file"); + testBadSealedClass("EmptyPermittedSubclassEntry", ClassFormatError.class, + "Illegal class name \"\" in class file"); //test type enumerated in the PermittedSubclasses attribute, //which are not direct subtypes of the current class are not returned: - testSealedInfo(noSubclass.BaseC.class, new String[] {"noSubclass.ImplCIntermediate"}); - testSealedInfo(noSubclass.BaseI.class, new String[] {"noSubclass.ImplIIntermediateI", "noSubclass.ImplIIntermediateC"}); + testSealedInfo(noSubclass.BaseC.class, new String[] {"noSubclass.ImplCIntermediate"}, true); + testSealedInfo(noSubclass.BaseI.class, new String[] {"noSubclass.ImplIIntermediateI", "noSubclass.ImplIIntermediateC"}, true); } } diff --git a/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java b/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java index abecc2b0215ac..27d20567464f8 100644 --- a/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java +++ b/test/jdk/java/lang/reflect/sealed_classes/SealedClassesReflectionTest.java @@ -110,8 +110,7 @@ public Object[][] notSealedClassesData() { @Test(dataProvider = "notSealedClasses") public void testNotSealedClasses(Class cls) { assertTrue(!cls.isSealed()); - assertTrue(cls.getPermittedSubclasses() != null); - assertTrue(cls.getPermittedSubclasses().length == 0); + assertTrue(cls.getPermittedSubclasses() == null); } @DataProvider(name = "non_sealedClasses") @@ -128,8 +127,7 @@ public void testnon_sealedClasses(Class cls) { assertTrue(!cls.isSealed()); assertTrue(!Modifier.isFinal(cls.getModifiers())); assertTrue((cls.getSuperclass() != null && cls.getSuperclass().isSealed()) || Arrays.stream(cls.getInterfaces()).anyMatch(Class::isSealed)); - assertTrue(cls.getPermittedSubclasses() != null); - assertTrue(cls.getPermittedSubclasses().length == 0); + assertTrue(cls.getPermittedSubclasses() == null); } @DataProvider(name = "reflectionData") diff --git a/test/langtools/tools/javac/sealed/SealedCompilationTests.java b/test/langtools/tools/javac/sealed/SealedCompilationTests.java index 005fd13708232..5f830d08544f7 100644 --- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java +++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java @@ -633,7 +633,7 @@ public void testAPIForPrimitiveAndArrayClasses() { float.class, float[].class, double.class, double[].class, char.class, char[].class, boolean.class, boolean[].class, void.class, String[].class}) { Assert.check(!c.isSealed()); - Assert.check(c.getPermittedSubclasses().length == 0); + Assert.check(c.getPermittedSubclasses() == null); } } From 30de320c01c7a271a62b431a22c3aa5ebb4d83cf Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Wed, 9 Dec 2020 19:20:13 +0000 Subject: [PATCH 166/504] 6882207: Convert javap to use diamond operator internally Reviewed-by: jjg --- .../share/classes/com/sun/tools/javap/CodeWriter.java | 4 ++-- .../share/classes/com/sun/tools/javap/ConstantWriter.java | 8 ++++---- .../share/classes/com/sun/tools/javap/JavapTask.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/CodeWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/CodeWriter.java index 8167d8223ece2..f3cd6daa8a670 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/CodeWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/CodeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -128,7 +128,7 @@ public void writeInstr(Instruction instr) { } // where Instruction.KindVisitor instructionPrinter = - new Instruction.KindVisitor() { + new Instruction.KindVisitor<>() { public Void visitNoOperands(Instruction instr, Integer indent) { return null; diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java index 6ef90081e4585..59f8c4e935c95 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -60,7 +60,7 @@ protected void writeConstantPool() { } protected void writeConstantPool(ConstantPool constant_pool) { - ConstantPool.Visitor v = new ConstantPool.Visitor() { + ConstantPool.Visitor v = new ConstantPool.Visitor<>() { public Integer visitClass(CONSTANT_Class_info info, Void p) { print("#" + info.name_index); tab(); @@ -545,6 +545,6 @@ private static String addEscapes(String name) { return buf.toString(); } - private ClassWriter classWriter; - private Options options; + private final ClassWriter classWriter; + private final Options options; } diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java index fc511a2e25cec..a759bac49a9f2 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java @@ -1024,7 +1024,7 @@ private void reportWarning(String key, Object... args) { private Diagnostic createDiagnostic( final Diagnostic.Kind kind, final String key, final Object... args) { - return new Diagnostic() { + return new Diagnostic<>() { public Kind getKind() { return kind; } From fd5f6e2e196f1b83c15e802d71aa053d9feab20f Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 9 Dec 2020 19:21:53 +0000 Subject: [PATCH 167/504] 8257986: [JVMCI] ProblemList 2 reprofile JVMCI tests Reviewed-by: iignatyev --- test/hotspot/jtreg/ProblemList.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 4ae9f9c164975..898c084b32831 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -44,6 +44,8 @@ compiler/ciReplay/TestSAServer.java 8029528 generic-all compiler/codecache/jmx/PoolsIndependenceTest.java 8167015 generic-all compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8225370 generic-all compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all +compiler/jvmci/compilerToVM/IsMatureVsReprofileTest.java 8257919 generic-all +compiler/jvmci/compilerToVM/ReprofileTest.java 8257919 generic-all compiler/tiered/LevelTransitionTest.java 8067651 generic-all compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all From baf4c1a4af091d9e4c40e73c297e670a05cd25a2 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Wed, 9 Dec 2020 20:26:55 +0000 Subject: [PATCH 168/504] 8257917: [JVMCI] crash when materializing boxed values under -Xcomp Reviewed-by: iveresov, kvn --- src/hotspot/share/aot/aotLoader.cpp | 13 ++------ src/hotspot/share/jvmci/jvmci.cpp | 30 +++++++++++++++++++ src/hotspot/share/jvmci/jvmci.hpp | 6 ++++ .../share/jvmci/jvmciCodeInstaller.cpp | 9 ++++++ 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/hotspot/share/aot/aotLoader.cpp b/src/hotspot/share/aot/aotLoader.cpp index 2d03483a72430..b41a7e25f8194 100644 --- a/src/hotspot/share/aot/aotLoader.cpp +++ b/src/hotspot/share/aot/aotLoader.cpp @@ -26,6 +26,7 @@ #include "aot/aotLoader.inline.hpp" #include "classfile/javaClasses.hpp" #include "jvm.h" +#include "jvmci/jvmci.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/compressedOops.hpp" @@ -329,15 +330,5 @@ void AOTLoader::initialize_box_caches(TRAPS) { return; } TraceTime timer("AOT initialization of box caches", TRACETIME_LOG(Info, aot, startuptime)); - Symbol* box_classes[] = { java_lang_Boolean::symbol(), java_lang_Byte_ByteCache::symbol(), - java_lang_Short_ShortCache::symbol(), java_lang_Character_CharacterCache::symbol(), - java_lang_Integer_IntegerCache::symbol(), java_lang_Long_LongCache::symbol() }; - - for (unsigned i = 0; i < sizeof(box_classes) / sizeof(Symbol*); i++) { - Klass* k = SystemDictionary::resolve_or_fail(box_classes[i], true, CHECK); - InstanceKlass* ik = InstanceKlass::cast(k); - if (ik->is_not_initialized()) { - ik->initialize(CHECK); - } - } + JVMCI::ensure_box_caches_initialized(CHECK); } diff --git a/src/hotspot/share/jvmci/jvmci.cpp b/src/hotspot/share/jvmci/jvmci.cpp index 679795690a18c..f971ffae0d882 100644 --- a/src/hotspot/share/jvmci/jvmci.cpp +++ b/src/hotspot/share/jvmci/jvmci.cpp @@ -37,6 +37,7 @@ JVMCIRuntime* JVMCI::_compiler_runtime = NULL; JVMCIRuntime* JVMCI::_java_runtime = NULL; volatile bool JVMCI::_is_initialized = false; +volatile bool JVMCI::_box_caches_initialized = false; void* JVMCI::_shared_library_handle = NULL; char* JVMCI::_shared_library_path = NULL; volatile bool JVMCI::_in_shutdown = false; @@ -125,6 +126,35 @@ void JVMCI::initialize_globals() { } } +void JVMCI::ensure_box_caches_initialized(TRAPS) { + if (_box_caches_initialized) { + return; + } + MutexLocker locker(JVMCI_lock); + // Check again after locking + if (_box_caches_initialized) { + return; + } + + Symbol* box_classes[] = { + java_lang_Boolean::symbol(), + java_lang_Byte_ByteCache::symbol(), + java_lang_Short_ShortCache::symbol(), + java_lang_Character_CharacterCache::symbol(), + java_lang_Integer_IntegerCache::symbol(), + java_lang_Long_LongCache::symbol() + }; + + for (unsigned i = 0; i < sizeof(box_classes) / sizeof(Symbol*); i++) { + Klass* k = SystemDictionary::resolve_or_fail(box_classes[i], true, CHECK); + InstanceKlass* ik = InstanceKlass::cast(k); + if (ik->is_not_initialized()) { + ik->initialize(CHECK); + } + } + _box_caches_initialized = true; +} + JavaThread* JVMCI::compilation_tick(JavaThread* thread) { if (thread->is_Compiler_thread()) { CompileTask *task = thread->as_CompilerThread()->task(); diff --git a/src/hotspot/share/jvmci/jvmci.hpp b/src/hotspot/share/jvmci/jvmci.hpp index e1b0cc0bf5b1f..61c0527e37a51 100644 --- a/src/hotspot/share/jvmci/jvmci.hpp +++ b/src/hotspot/share/jvmci/jvmci.hpp @@ -53,6 +53,9 @@ class JVMCI : public AllStatic { // execution has completed successfully. static volatile bool _is_initialized; + // used to synchronize lazy initialization of boxing cache classes. + static volatile bool _box_caches_initialized; + // Handle created when loading the JVMCI shared library with os::dll_load. // Must hold JVMCI_lock when initializing. static void* _shared_library_handle; @@ -110,6 +113,9 @@ class JVMCI : public AllStatic { static void initialize_compiler(TRAPS); + // Ensures the boxing cache classes (e.g., java.lang.Integer.IntegerCache) are initialized. + static void ensure_box_caches_initialized(TRAPS); + // Increments a value indicating some JVMCI compilation activity // happened on `thread` if it is a CompilerThread. // Returns `thread`. diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index e5025b9b37edf..0ed9f8d92f794 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -1022,12 +1022,16 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de } GrowableArray* objects = new GrowableArray(JVMCIENV->get_length(virtualObjects), JVMCIENV->get_length(virtualObjects), NULL); // Create the unique ObjectValues + bool has_auto_box = false; for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) { // HandleMark hm(THREAD); JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i); int id = jvmci_env()->get_VirtualObject_id(value); JVMCIObject type = jvmci_env()->get_VirtualObject_type(value); bool is_auto_box = jvmci_env()->get_VirtualObject_isAutoBox(value); + if (is_auto_box) { + has_auto_box = true; + } Klass* klass = jvmci_env()->asKlass(type); oop javaMirror = klass->java_mirror(); ScopeValue *klass_sv = new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)); @@ -1049,6 +1053,11 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de record_object_value(objects->at(id)->as_ObjectValue(), value, objects, JVMCI_CHECK_NULL); } _debug_recorder->dump_object_pool(objects); + + if (has_auto_box) { + JavaThread* THREAD = JavaThread::current(); + JVMCI::ensure_box_caches_initialized(CHECK_NULL); + } return objects; } From 46c9a860b6516c119f11edee2deb3d9f62907323 Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Wed, 9 Dec 2020 21:09:23 +0000 Subject: [PATCH 169/504] 8245956: JavaCompiler still uses File API instead of Path API in a specific case Reviewed-by: jjg --- .../tools/javac/file/JavacFileManager.java | 8 +-- .../tools/javac/T8245956/T8245956.java | 67 +++++++++++++++++++ 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 test/langtools/tools/javac/T8245956/T8245956.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java index c7b95b80437fd..c5301ba2c064e 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java @@ -741,13 +741,13 @@ public void close() throws IOException { @Override @DefinedBy(Api.COMPILER) public ClassLoader getClassLoader(Location location) { checkNotModuleOrientedLocation(location); - Iterable path = getLocation(location); - if (path == null) + Collection searchPath = getLocationAsPaths(location); + if (searchPath == null) return null; ListBuffer lb = new ListBuffer<>(); - for (File f: path) { + for (Path p : searchPath) { try { - lb.append(f.toURI().toURL()); + lb.append(p.toUri().toURL()); } catch (MalformedURLException e) { throw new AssertionError(e); } diff --git a/test/langtools/tools/javac/T8245956/T8245956.java b/test/langtools/tools/javac/T8245956/T8245956.java new file mode 100644 index 0000000000000..5da20eafc97e5 --- /dev/null +++ b/test/langtools/tools/javac/T8245956/T8245956.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2020, 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 8245956 + * @summary JavaCompiler still uses File API instead of Path API in a specific case + * @run main T8245956 + */ + +import java.net.URI; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; + +public class T8245956 { + public static void main(String[] args) throws Exception { + Path zipFilePath = Path.of("T8245956.zip"); + URI zipFileUri = zipFilePath.toUri(); + URI jarZipFileUri = URI.create("jar:" + zipFileUri.toString()); + Map env = new LinkedHashMap<>(); + env.put("create", "true"); + try (FileSystem fs = FileSystems.newFileSystem(jarZipFileUri, env)) { + Path fsPath = fs.getPath(""); + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + DiagnosticCollector diagnosticCollector = new DiagnosticCollector<>(); + try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnosticCollector, null, null)) { + List classPath = new ArrayList<>(); + classPath.add(fsPath); + fileManager.setLocationFromPaths(StandardLocation.CLASS_PATH, classPath); + fileManager.getClassLoader(StandardLocation.CLASS_PATH); // Should not generate any exceptions. + System.out.println("The method getClassLoader terminated normally.\n"); + } + } + } +} From 0a3e446ad95b09de2facee7107f7c1206339ee0d Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 9 Dec 2020 23:08:52 +0000 Subject: [PATCH 170/504] 8257993: vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/TestDescription.java crash intermittently Reviewed-by: sspitsyn, hseigel, dholmes --- .../share/interpreter/interpreterRuntime.cpp | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index c5142cfc32e39..e68fabda54f84 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -821,24 +821,17 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte CallInfo info; constantPoolHandle pool(thread, last_frame.method()->constants()); + methodHandle resolved_method; + { JvmtiHideSingleStepping jhss(thread); LinkResolver::resolve_invoke(info, receiver, pool, last_frame.get_index_u2_cpcache(bytecode), bytecode, CHECK); - if (JvmtiExport::can_hotswap_or_post_breakpoint()) { - int retry_count = 0; - while (info.resolved_method()->is_old()) { - // It is very unlikely that method is redefined more than 100 times - // in the middle of resolve. If it is looping here more than 100 times - // means then there could be a bug here. - guarantee((retry_count++ < 100), - "Could not resolve to latest version of redefined method"); - // method is redefined in the middle of resolve so re-try. - LinkResolver::resolve_invoke(info, receiver, pool, - last_frame.get_index_u2_cpcache(bytecode), bytecode, - CHECK); - } + if (JvmtiExport::can_hotswap_or_post_breakpoint() && info.resolved_method()->is_old()) { + resolved_method = methodHandle(THREAD, info.resolved_method()->get_new_method()); + } else { + resolved_method = methodHandle(THREAD, info.resolved_method()); } } // end JvmtiHideSingleStepping @@ -848,22 +841,20 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte #ifdef ASSERT if (bytecode == Bytecodes::_invokeinterface) { - if (info.resolved_method()->method_holder() == - SystemDictionary::Object_klass()) { + if (resolved_method->method_holder() == SystemDictionary::Object_klass()) { // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec // (see also CallInfo::set_interface for details) assert(info.call_kind() == CallInfo::vtable_call || info.call_kind() == CallInfo::direct_call, ""); - Method* rm = info.resolved_method(); - assert(rm->is_final() || info.has_vtable_index(), + assert(resolved_method->is_final() || info.has_vtable_index(), "should have been set already"); - } else if (!info.resolved_method()->has_itable_index()) { + } else if (!resolved_method->has_itable_index()) { // Resolved something like CharSequence.toString. Use vtable not itable. assert(info.call_kind() != CallInfo::itable_call, ""); } else { // Setup itable entry assert(info.call_kind() == CallInfo::itable_call, ""); - int index = info.resolved_method()->itable_index(); + int index = resolved_method->itable_index(); assert(info.itable_index() == index, ""); } } else if (bytecode == Bytecodes::_invokespecial) { @@ -878,7 +869,6 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte // methods must be checked for every call. InstanceKlass* sender = pool->pool_holder(); sender = sender->is_unsafe_anonymous() ? sender->unsafe_anonymous_host() : sender; - methodHandle resolved_method(THREAD, info.resolved_method()); switch (info.call_kind()) { case CallInfo::direct_call: From 53e537c7386c301638f040f29c8f5f725621bc18 Mon Sep 17 00:00:00 2001 From: Toshio Nakamura Date: Thu, 10 Dec 2020 00:27:44 +0000 Subject: [PATCH 171/504] 8255387: Japanese characters were printed upside down on AIX Reviewed-by: prr, serb --- .../native/libfontmanager/freetypeScaler.c | 5 +- test/jdk/java/awt/font/Rotate/MirrorTest.java | 163 ++++++++++++++++++ 2 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 test/jdk/java/awt/font/Rotate/MirrorTest.java diff --git a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c index b5d6c14e4458d..e80c73211e5de 100644 --- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c +++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -529,7 +529,8 @@ Java_sun_font_FreetypeFontScaler_createScalerContextNative( */ if ((aa != TEXT_AA_ON) && (fm != TEXT_FM_ON) && !context->doBold && !context->doItalize && - (context->transform.yx == 0) && (context->transform.xy == 0)) + (context->transform.yx == 0) && (context->transform.xy == 0) && + (context->transform.xx > 0) && (context->transform.yy > 0)) { context->useSbits = 1; } diff --git a/test/jdk/java/awt/font/Rotate/MirrorTest.java b/test/jdk/java/awt/font/Rotate/MirrorTest.java new file mode 100644 index 0000000000000..0a928ba05b333 --- /dev/null +++ b/test/jdk/java/awt/font/Rotate/MirrorTest.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2020, 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 MirrorTest + * @bug 8255387 + * @summary Mirrored characters should be drawn correctly + * @run main MirrorTest + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; + +public class MirrorTest { + static String target = "\u3042"; + static final int SIZE = 50; + static final int SHIFT = 20; + static final int LIMIT = 5; + + static Point getCenterOfGravity(BufferedImage img) { + int count = 0; + int sx = 0; + int sy = 0; + for (int y = 0; y < SIZE; y++) { + for (int x = 0; x < SIZE; x++) { + int c = img.getRGB(x, y) & 0xFFFFFF; + if (c == 0) { + count++; + sx += x; + sy += y; + } + } + } + if (count == 0) { + return null; + } else { + return new Point(sx/count, sy/count); + } + } + + static BufferedImage drawNormal(Font font) { + BufferedImage image = new BufferedImage(SIZE, SIZE, + BufferedImage.TYPE_BYTE_BINARY); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, image.getWidth(), image.getHeight()); + g2d.setColor(Color.black); + //Set antialias on not to use embedded bitmap for reference + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setFont(font); + FontMetrics fm = g2d.getFontMetrics(); + g2d.drawString(target, SHIFT, SHIFT+fm.getAscent()); + g2d.dispose(); + return image; + } + + static BufferedImage drawVerticalMirror(Font font) { + BufferedImage image = new BufferedImage(SIZE, SIZE, + BufferedImage.TYPE_BYTE_BINARY); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, image.getWidth(), image.getHeight()); + g2d.setColor(Color.black); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + + AffineTransform base = g2d.getTransform(); + AffineTransform trans = new AffineTransform(1.0, 0, 0, -1.0, 0, 0); + trans.concatenate(base); + g2d.setTransform(trans); + + g2d.setFont(font); + FontMetrics fm = g2d.getFontMetrics(); + g2d.drawString(target, SHIFT, SHIFT-image.getHeight()+fm.getAscent()); + g2d.dispose(); + return image; + } + + static BufferedImage drawHorizontalMirror(Font font) { + BufferedImage image = new BufferedImage(SIZE, SIZE, + BufferedImage.TYPE_BYTE_BINARY); + Graphics2D g2d = image.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, image.getWidth(), image.getHeight()); + g2d.setColor(Color.black); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + + AffineTransform base = g2d.getTransform(); + AffineTransform trans = new AffineTransform(-1.0, 0, 0, 1.0, 0, 0); + trans.concatenate(base); + g2d.setTransform(trans); + + g2d.setFont(font); + FontMetrics fm = g2d.getFontMetrics(); + g2d.drawString(target, SHIFT-image.getWidth(), SHIFT+fm.getAscent()); + g2d.dispose(); + return image; + } + + public static void main(String[] args) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + Font fonts[] = ge.getAllFonts(); + + for (Font font: fonts) { + if (!font.canDisplay(target.charAt(0))) { + continue; + } + font = font.deriveFont(12.0f); + BufferedImage img1 = drawNormal(font); + BufferedImage img2 = drawVerticalMirror(font); + BufferedImage img3 = drawHorizontalMirror(font); + Point p1 = getCenterOfGravity(img1); + Point p2 = getCenterOfGravity(img2); + Point p3 = getCenterOfGravity(img3); + if (p1 == null || p2 == null || p3 == null ) { + continue; + } + p2.y = SIZE - p2.y - 2; // Back from vertical mirror + p3.x = SIZE - p3.x - 2; // Back from horizontal mirror + + if (Math.abs(p1.x - p2.x) > LIMIT || + Math.abs(p1.y - p2.y) > LIMIT || + Math.abs(p1.x - p3.x) > LIMIT || + Math.abs(p1.y - p3.y) > LIMIT) { + System.out.println("Error: "+p1+","+p2+","+p3); + throw new RuntimeException( + "Incorrect mirrored character with " + font); + } + } + } +} + From 1ce2a36c7b23469298817b5002599955d7041759 Mon Sep 17 00:00:00 2001 From: Andy Herrick Date: Thu, 10 Dec 2020 00:50:28 +0000 Subject: [PATCH 172/504] 8257539: tools/jpackage/windows/WinL10nTest.java unpack.bat failed with Exit code: 1618 Reviewed-by: almatvee, asemenyuk, prr, kizune --- .../jpackage/helpers/jdk/jpackage/test/WindowsHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java index 458fd0d7d45b0..b0c4b34b3a2b2 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java @@ -63,7 +63,7 @@ private static Path getInstallationSubDirectory(JPackageCommand cmd) { private static void runMsiexecWithRetries(Executor misexec) { Executor.Result result = null; - for (int attempt = 0; attempt != 3; ++attempt) { + for (int attempt = 0; attempt < 8; ++attempt) { result = misexec.executeWithoutExitCodeCheck(); // The given Executor may either be of an msiexe command or an @@ -72,7 +72,8 @@ private static void runMsiexecWithRetries(Executor misexec) { if ((result.exitCode == 1618) || (result.exitCode == 1603)) { // Another installation is already in progress. // Wait a little and try again. - ThrowingRunnable.toRunnable(() -> Thread.sleep(3000)).run(); + Long timeout = 1000L * (attempt + 3); // from 3 to 10 seconds + ThrowingRunnable.toRunnable(() -> Thread.sleep(timeout)).run(); continue; } break; From eb1c8a15b6a64aa228e5dbb310bb54dbc4bf5543 Mon Sep 17 00:00:00 2001 From: Alexander Matveev Date: Thu, 10 Dec 2020 01:01:38 +0000 Subject: [PATCH 173/504] 8257924: Use full path when running external executable from jpackage Reviewed-by: herrick, asemenyuk --- .../jdk/jpackage/internal/MacAppBundler.java | 2 +- .../jdk/jpackage/internal/MacAppImageBuilder.java | 13 +++++++------ .../jdk/jpackage/internal/MacAppStoreBundler.java | 4 ++-- .../jpackage/internal/MacBaseInstallerBundler.java | 2 +- .../jdk/jpackage/internal/MacCertificate.java | 4 ++-- .../jdk/jpackage/internal/MacDmgBundler.java | 4 ++-- .../jdk/jpackage/internal/MacPkgBundler.java | 6 +++--- .../jdk/tools/jpackage/macosx/base/SigningBase.java | 4 ++-- .../tools/jpackage/macosx/base/SigningCheck.java | 4 ++-- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java index e7054c4c12237..d28a8bdadc730 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppBundler.java @@ -127,7 +127,7 @@ private static void doValidate(Map params) // Signing will not work without Xcode with command line developer tools try { - ProcessBuilder pb = new ProcessBuilder("xcrun", "--help"); + ProcessBuilder pb = new ProcessBuilder("/usr/bin/xcrun", "--help"); Process p = pb.start(); int code = p.waitFor(); if (code != 0) { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java index 82ba22ac34418..4dc58ce40e8de 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java @@ -582,7 +582,7 @@ public static void addNewKeychain(Map params) }); List args = new ArrayList<>(); - args.add("security"); + args.add("/usr/bin/security"); args.add("list-keychains"); args.add("-s"); @@ -607,7 +607,7 @@ public static void restoreKeychainList(Map params) } List args = new ArrayList<>(); - args.add("security"); + args.add("/usr/bin/security"); args.add("list-keychains"); args.add("-s"); @@ -658,7 +658,7 @@ static void signAppBundle( "message.already.signed"), p.toString())); } else { List args = new ArrayList<>(); - args.addAll(Arrays.asList("codesign", + args.addAll(Arrays.asList("/usr/bin/codesign", "--timestamp", "--options", "runtime", "-s", signingIdentity, @@ -706,7 +706,7 @@ static void signAppBundle( try { List args = new ArrayList<>(); - args.addAll(Arrays.asList("codesign", + args.addAll(Arrays.asList("/usr/bin/codesign", "--timestamp", "--options", "runtime", "--force", @@ -751,7 +751,7 @@ static void signAppBundle( // sign the app itself List args = new ArrayList<>(); - args.addAll(Arrays.asList("codesign", + args.addAll(Arrays.asList("/usr/bin/codesign", "--timestamp", "--options", "runtime", "--force", @@ -778,7 +778,8 @@ static void signAppBundle( private static boolean isFileSigned(Path file) { ProcessBuilder pb = - new ProcessBuilder("codesign", "--verify", file.toString()); + new ProcessBuilder("/usr/bin/codesign", + "--verify", file.toString()); try { IOUtils.exec(pb); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java index 27ef91b81decc..d74e23570401a 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppStoreBundler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020, 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 @@ -152,7 +152,7 @@ public Path bundle(Map params, MAC_APP_STORE_PKG_SIGNING_KEY.fetchFrom(params); List buildOptions = new ArrayList<>(); - buildOptions.add("productbuild"); + buildOptions.add("/usr/bin/productbuild"); buildOptions.add("--component"); buildOptions.add(appLocation.toString()); buildOptions.add("/Applications"); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java index 46215b796fc42..d98c2c5e323c3 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBaseInstallerBundler.java @@ -164,7 +164,7 @@ public static String findKey(String keyPrefix, String teamName, String keychainN try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos)) { List searchOptions = new ArrayList<>(); - searchOptions.add("security"); + searchOptions.add("/usr/bin/security"); searchOptions.add("find-certificate"); searchOptions.add("-c"); searchOptions.add(key); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java index 75dd82c8ff06a..4e205fd970525 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -56,7 +56,7 @@ private static Path findCertificate(String certificate) { Path result = null; List args = new ArrayList<>(); - args.add("security"); + args.add("/usr/bin/security"); args.add("find-certificate"); args.add("-c"); args.add(certificate); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java index 2fed52cc834a6..26c3bd30f8797 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java @@ -245,7 +245,7 @@ private String findSetFileUtility() { // generic find attempt try { - ProcessBuilder pb = new ProcessBuilder("xcrun", "-find", "SetFile"); + ProcessBuilder pb = new ProcessBuilder("/usr/bin/xcrun", "-find", "SetFile"); Process p = pb.start(); InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); @@ -387,7 +387,7 @@ private Path buildDMG( Map params, // to install-dir in DMG as critical error, since it can fail in // headless enviroment. try { - pb = new ProcessBuilder("osascript", + pb = new ProcessBuilder("/usr/bin/osascript", getConfig_VolumeScript(params).toAbsolutePath().toString()); IOUtils.exec(pb, 180); // Wait 3 minutes. See JDK-8248248. } catch (IOException ex) { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java index 021f7038c0f0e..1370bcd64af8f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java @@ -418,7 +418,7 @@ private Path createPKG(Map params, // Generate default CPL file Path cpl = CONFIG_ROOT.fetchFrom(params).resolve("cpl.plist"); - ProcessBuilder pb = new ProcessBuilder("pkgbuild", + ProcessBuilder pb = new ProcessBuilder("/usr/bin/pkgbuild", "--root", root, "--install-location", @@ -433,7 +433,7 @@ private Path createPKG(Map params, preparePackageScripts(params); // build application package - pb = new ProcessBuilder("pkgbuild", + pb = new ProcessBuilder("/usr/bin/pkgbuild", "--root", root, "--install-location", @@ -454,7 +454,7 @@ private Path createPKG(Map params, Files.createDirectories(outdir); List commandLine = new ArrayList<>(); - commandLine.add("productbuild"); + commandLine.add("/usr/bin/productbuild"); commandLine.add("--resources"); commandLine.add(CONFIG_ROOT.fetchFrom(params).toAbsolutePath().toString()); diff --git a/test/jdk/tools/jpackage/macosx/base/SigningBase.java b/test/jdk/tools/jpackage/macosx/base/SigningBase.java index 68a4c01ae11cb..9c7f7f21851b7 100644 --- a/test/jdk/tools/jpackage/macosx/base/SigningBase.java +++ b/test/jdk/tools/jpackage/macosx/base/SigningBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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,7 +51,7 @@ private static void checkString(List result, String lookupString) { private static List codesignResult(Path target, boolean signed) { int exitCode = signed ? 0 : 1; List result = new Executor() - .setExecutable("codesign") + .setExecutable("/usr/bin/codesign") .addArguments("--verify", "--deep", "--strict", "--verbose=2", target.toString()) .saveOutput() diff --git a/test/jdk/tools/jpackage/macosx/base/SigningCheck.java b/test/jdk/tools/jpackage/macosx/base/SigningCheck.java index 3d0b4a44e34e3..9647f439411d7 100644 --- a/test/jdk/tools/jpackage/macosx/base/SigningCheck.java +++ b/test/jdk/tools/jpackage/macosx/base/SigningCheck.java @@ -47,7 +47,7 @@ public static void checkCertificates() { private static List findCertificate(String name, String keyChain) { List result = new Executor() - .setExecutable("security") + .setExecutable("/usr/bin/security") .addArguments("find-certificate", "-c", name, "-a", keyChain) .executeAndGetOutput(); @@ -89,7 +89,7 @@ private static void validateCertificateTrust(String name) { // will not be listed as trusted by dump-trust-settings if (SigningBase.DEV_NAME.equals("jpackage.openjdk.java.net")) { List result = new Executor() - .setExecutable("security") + .setExecutable("/usr/bin/security") .addArguments("dump-trust-settings") .executeWithoutExitCodeCheckAndGetOutput(); result.stream().forEachOrdered(TKit::trace); From f631a9901f2c5790d7c8beda76565aa2b5e0373b Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 10 Dec 2020 01:36:52 +0000 Subject: [PATCH 174/504] 8256888: Client manual test problem list update Reviewed-by: serb --- test/jdk/ProblemList.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index c26ad9b9d4337..6f861554826b7 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -880,5 +880,11 @@ java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all java/awt/font/TextLayout/TestJustification.html 8250791 macosx-all javax/swing/JTabbedPane/4209065/bug4209065.java 8251177 macosx-all java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all +java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all +java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html 7187728 macosx-all,linux-all +java/awt/print/PageFormat/Orient.java 8016055 macosx-all +java/awt/TextArea/TextAreaCursorTest/HoveringAndDraggingTest.java 8024986 macosx-all,linux-all +java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter.java 8254841 macosx-all + ############################################################################ From d2f9e31ae4b82e031401c3efcbb499c59efa37d7 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 10 Dec 2020 02:59:26 +0000 Subject: [PATCH 175/504] 8257638: Update usage of "type" terminology in javax.lang.model Reviewed-by: jjg --- .../processing/AbstractProcessor.java | 10 +- .../javax/annotation/processing/Filer.java | 57 ++++++------ .../annotation/processing/FilerException.java | 7 +- .../annotation/processing/Processor.java | 92 +++++++++---------- .../processing/SupportedAnnotationTypes.java | 6 +- .../lang/model/element/AnnotationMirror.java | 2 +- .../lang/model/element/AnnotationValue.java | 2 +- .../model/element/AnnotationValueVisitor.java | 2 +- .../javax/lang/model/element/Element.java | 16 ++-- .../javax/lang/model/element/ElementKind.java | 8 +- .../lang/model/element/ExecutableElement.java | 6 +- .../javax/lang/model/element/NestingKind.java | 13 ++- .../model/element/RecordComponentElement.java | 2 +- .../javax/lang/model/element/TypeElement.java | 71 +++++++------- .../lang/model/element/package-info.java | 32 ++++--- .../javax/lang/model/util/ElementFilter.java | 2 +- .../javax/lang/model/util/Elements.java | 16 ++-- 17 files changed, 178 insertions(+), 166 deletions(-) diff --git a/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java b/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java index 1db32d48df9fd..469ec4a4b8e40 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/AbstractProcessor.java @@ -39,9 +39,9 @@ * superclass for most concrete annotation processors. This class * examines annotation values to compute the {@linkplain * #getSupportedOptions options}, {@linkplain - * #getSupportedAnnotationTypes annotation types}, and {@linkplain - * #getSupportedSourceVersion source version} supported by its - * subtypes. + * #getSupportedAnnotationTypes annotation interfaces}, and + * {@linkplain #getSupportedSourceVersion source version} supported by + * its subtypes. * *

      The getter methods may {@linkplain Messager#printMessage issue * warnings} about noteworthy conditions using the facilities available @@ -98,8 +98,8 @@ public Set getSupportedOptions() { * then any leading {@linkplain Processor#getSupportedAnnotationTypes * module prefixes} are stripped from the names. * - * @return the names of the annotation types supported by this - * processor, or an empty set if none + * @return the names of the annotation interfaces supported by + * this processor, or an empty set if none */ public Set getSupportedAnnotationTypes() { SupportedAnnotationTypes sat = this.getClass().getAnnotation(SupportedAnnotationTypes.class); diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Filer.java b/src/java.compiler/share/classes/javax/annotation/processing/Filer.java index e077d7b7edb89..257b0085e6d44 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Filer.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Filer.java @@ -66,9 +66,9 @@ *

      The file creation methods take a variable number of arguments to * allow the originating elements to be provided as hints to * the tool infrastructure to better manage dependencies. The - * originating elements are the types or packages (representing {@code - * package-info} files) or modules (representing {@code - * module-info} files) which caused an annotation processor to + * originating elements are the classes or interfaces or packages + * (representing {@code package-info} files) or modules (representing + * {@code module-info} files) which caused an annotation processor to * attempt to create a new file. For example, if an annotation * processor tries to create a source file, {@code * GeneratedFromUserSource}, in response to processing @@ -107,14 +107,15 @@ *

      In general, processors must not knowingly attempt to overwrite * existing files that were not generated by some processor. A {@code * Filer} may reject attempts to open a file corresponding to an - * existing type, like {@code java.lang.Object}. Likewise, the + * existing class or interface, like {@code java.lang.Object}. Likewise, the * invoker of the annotation processing tool must not knowingly * configure the tool such that the discovered processors will attempt * to overwrite existing files that were not generated. * *

      Processors can indicate a source or class file is generated by - * including a {@link javax.annotation.processing.Generated} annotation if the - * environment is configured so that that type is accessible. + * including a {@link javax.annotation.processing.Generated} + * annotation if the environment is configured so that that class or + * interface is accessible. * * @apiNote Some of the effect of overwriting a file can be * achieved by using a decorator-style pattern. Instead of @@ -133,8 +134,8 @@ public interface Filer { /** * Creates a new source file and returns an object to allow - * writing to it. A source file for a type, or a package can - * be created. + * writing to it. A source file for a class, interface, or a + * package can be created. * * The file's name and path (relative to the {@linkplain * StandardLocation#SOURCE_OUTPUT root output location for source @@ -142,9 +143,9 @@ public interface Filer { * that file as well as the specified module for the item (if * any). * - * If more than one type is being declared in a single file (that + * If more than one class or interface is being declared in a single file (that * is, a single compilation unit), the name of the file should - * correspond to the name of the principal top-level type (the + * correspond to the name of the principal top-level class or interface (the * public one, for example). * *

      A source file can also be created to hold information about @@ -155,7 +156,7 @@ public interface Filer { * *

      The optional module name is prefixed to the type name or * package name and separated using a "{@code /}" character. For - * example, to create a source file for type {@code a.B} in module + * example, to create a source file for class {@code a.B} in module * {@code foo}, use a {@code name} argument of {@code "foo/a.B"}. * *

      If no explicit module prefix is given and modules are supported @@ -194,15 +195,15 @@ public interface Filer { * as the target module. A separate option may be used to provide the target * module if it cannot be determined using the above rules. * - * @param name canonical (fully qualified) name of the principal type + * @param name canonical (fully qualified) name of the principal class or interface * being declared in this file or a package name followed by * {@code ".package-info"} for a package information file - * @param originatingElements type or package or module elements causally - * associated with the creation of this file, may be elided or - * {@code null} + * @param originatingElements class, interface, package, or module + * elements causally associated with the creation of this file, + * may be elided or {@code null} * @return a {@code JavaFileObject} to write the new source file * @throws FilerException if the same pathname has already been - * created, the same type has already been created, the name is + * created, the same class or interface has already been created, the name is * otherwise not valid for the entity requested to being created, * if the target module cannot be determined, if the target * module is not writable, or a module is specified when the environment @@ -215,7 +216,7 @@ JavaFileObject createSourceFile(CharSequence name, /** * Creates a new class file, and returns an object to allow - * writing to it. A class file for a type, or a package can + * writing to it. A class file for a class, interface, or a package can * be created. * * The file's name and path (relative to the {@linkplain @@ -231,7 +232,7 @@ JavaFileObject createSourceFile(CharSequence name, * *

      The optional module name is prefixed to the type name or * package name and separated using a "{@code /}" character. For - * example, to create a class file for type {@code a.B} in module + * example, to create a class file for class {@code a.B} in module * {@code foo}, use a {@code name} argument of {@code "foo/a.B"}. * *

      If no explicit module prefix is given and modules are supported @@ -259,15 +260,16 @@ JavaFileObject createSourceFile(CharSequence name, * as the target module. A separate option may be used to provide the target * module if it cannot be determined using the above rules. * - * @param name binary name of the type being written or a package name followed by - * {@code ".package-info"} for a package information file - * @param originatingElements type or package or module elements causally - * associated with the creation of this file, may be elided or - * {@code null} + * @param name binary name of the class or interface being written + * or a package name followed by {@code ".package-info"} for a + * package information file + * @param originatingElements class or interface or package or + * module elements causally associated with the creation of this + * file, may be elided or {@code null} * @return a {@code JavaFileObject} to write the new class file * @throws FilerException if the same pathname has already been - * created, the same type has already been created, the name is - * not valid for a type, if the target module cannot be determined, + * created, the same class or interface has already been created, the name is + * not valid for a class or interface, if the target module cannot be determined, * if the target module is not writable, or a module is specified when * the environment doesn't support modules. * @throws IOException if the file cannot be created @@ -330,8 +332,9 @@ JavaFileObject createClassFile(CharSequence name, * @param moduleAndPkg module and/or package relative to which the file * should be named, or the empty string if none * @param relativeName final pathname components of the file - * @param originatingElements type or package or module elements causally - * associated with the creation of this file, may be elided or + * @param originatingElements class or interface or package or + * module elements causally associated with the creation of this + * file, may be elided or * {@code null} * @return a {@code FileObject} to write the new resource * @throws IOException if the file cannot be created diff --git a/src/java.compiler/share/classes/javax/annotation/processing/FilerException.java b/src/java.compiler/share/classes/javax/annotation/processing/FilerException.java index 9585521925876..0e7d9cdda76a7 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/FilerException.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/FilerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -31,8 +31,9 @@ * Indicates a {@link Filer} detected an attempt to open a file that * would violate the guarantees provided by the {@code Filer}. Those * guarantees include not creating the same file more than once, not - * creating multiple files corresponding to the same type or package, and not - * creating files for types with invalid names. + * creating multiple files corresponding to the same class or + * interface or package, and not creating files for classes or + * interfaces with invalid names. * * @author Joseph D. Darcy * @author Scott Seligman diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Processor.java b/src/java.compiler/share/classes/javax/annotation/processing/Processor.java index 0b29faebaa953..0b2160da263a1 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Processor.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Processor.java @@ -90,45 +90,45 @@ * configuration mechanisms, such as command line options; for * details, refer to the particular tool's documentation. Which * processors the tool asks to {@linkplain #process run} is a function - * of the types of the annotations {@linkplain AnnotatedConstruct present} - * on the {@linkplain + * of the interfaces of the annotations {@linkplain + * AnnotatedConstruct present} on the {@linkplain * RoundEnvironment#getRootElements root elements}, what {@linkplain - * #getSupportedAnnotationTypes annotation types a processor + * #getSupportedAnnotationTypes annotation interfaces a processor * supports}, and whether or not a processor {@linkplain #process - * claims the annotation types it processes}. A processor will be asked to - * process a subset of the annotation types it supports, possibly an - * empty set. - * - * For a given round, the tool computes the set of annotation types - * that are present on the elements enclosed within the root elements. - * If there is at least one annotation type present, then as - * processors claim annotation types, they are removed from the set of - * unmatched annotation types. When the set is empty or no more - * processors are available, the round has run to completion. If - * there are no annotation types present, annotation processing still - * occurs but only universal processors which support - * processing all annotation types, {@code "*"}, can claim the (empty) - * set of annotation types. - * - *

      An annotation type is considered present if there is at least - * one annotation of that type present on an element enclosed within + * claims the annotation interfaces it processes}. A processor will + * be asked to process a subset of the annotation interfaces it + * supports, possibly an empty set. + * + * For a given round, the tool computes the set of annotation + * interfaces that are present on the elements enclosed within the + * root elements. If there is at least one annotation interface + * present, then as processors claim annotation interfaces, they are + * removed from the set of unmatched annotation interfaces. When the + * set is empty or no more processors are available, the round has run + * to completion. If there are no annotation interfaces present, + * annotation processing still occurs but only universal + * processors which support processing all annotation interfaces, + * {@code "*"}, can claim the (empty) set of annotation interfaces. + * + *

      An annotation interface is considered present if there is at least + * one annotation of that interface present on an element enclosed within * the root elements of a round. For this purpose, a type parameter is * considered to be enclosed by its {@linkplain * TypeParameterElement#getGenericElement generic * element}. * For this purpose, a package element is not considered to - * enclose the top-level types within that package. (A root element - * representing a package is created when a {@code package-info} file - * is processed.) Likewise, for this purpose, a module element is - * not considered to enclose the packages within that - * module. (A root element representing a module is created when a - * {@code module-info} file is processed.) + * enclose the top-level classes and interfaces within that + * package. (A root element representing a package is created when a + * {@code package-info} file is processed.) Likewise, for this + * purpose, a module element is not considered to enclose the + * packages within that module. (A root element representing a module + * is created when a {@code module-info} file is processed.) * * Annotations on {@linkplain * java.lang.annotation.ElementType#TYPE_USE type uses}, as opposed to * annotations on elements, are ignored when computing whether or not - * an annotation type is present. + * an annotation interface is present. * *

      An annotation is present if it meets the definition of being * present given in {@link AnnotatedConstruct}. In brief, an @@ -141,10 +141,10 @@ * Elements#getAllAnnotationMirrors(Element)} called on that element. Since * annotations inside container annotations are not considered * present, to properly process {@linkplain - * java.lang.annotation.Repeatable repeatable annotation types}, + * java.lang.annotation.Repeatable repeatable annotation interfaces}, * processors are advised to include both the repeatable annotation - * type and its containing annotation type in the set of {@linkplain - * #getSupportedAnnotationTypes() supported annotation types} of a + * interface and its containing annotation interface in the set of {@linkplain + * #getSupportedAnnotationTypes() supported annotation interfaces} of a * processor. * *

      Note that if a processor supports {@code "*"} and returns {@code @@ -240,17 +240,17 @@ public interface Processor { Set getSupportedOptions(); /** - * Returns the names of the annotation types supported by this + * Returns the names of the annotation interfaces supported by this * processor. An element of the result may be the canonical - * (fully qualified) name of a supported annotation type. + * (fully qualified) name of a supported annotation interface. * Alternately it may be of the form "name.*" - * representing the set of all annotation types with canonical + * representing the set of all annotation interfaces with canonical * names beginning with "name.". * - * In either of those cases, the name of the annotation type can + * In either of those cases, the name of the annotation interface can * be optionally preceded by a module name followed by a {@code * "/"} character. For example, if a processor supports {@code - * "a.B"}, this can include multiple annotation types named {@code + * "a.B"}, this can include multiple annotation interfaces named {@code * a.B} which reside in different modules. To only support {@code * a.B} in the {@code foo} module, instead use {@code "foo/a.B"}. * @@ -259,11 +259,11 @@ public interface Processor { * environment where modules are not supported, such as an * annotation processing environment configured for a {@linkplain * javax.annotation.processing.ProcessingEnvironment#getSourceVersion - * source version} without modules, then the annotation types with + * source version} without modules, then the annotation interfaces with * a module name do not match. * * Finally, {@code "*"} by itself represents the set of all - * annotation types, including the empty set. Note that a + * annotation interfaces, including the empty set. Note that a * processor should not claim {@code "*"} unless it is actually * processing all files; claiming unnecessary annotations may * cause a performance slowdown in some environments. @@ -291,13 +291,13 @@ public interface Processor { * * @apiNote When running in an environment which supports modules, * processors are encouraged to include the module prefix when - * describing their supported annotation types. The method {@link + * describing their supported annotation interfaces. The method {@link * AbstractProcessor#getSupportedAnnotationTypes * AbstractProcessor.getSupportedAnnotationTypes} provides support * for stripping off the module prefix when running in an * environment without modules. * - * @return the names of the annotation types supported by this processor + * @return the names of the annotation interfaces supported by this processor * or an empty set if none * @see javax.annotation.processing.SupportedAnnotationTypes * @jls 3.8 Identifiers @@ -322,12 +322,12 @@ public interface Processor { void init(ProcessingEnvironment processingEnv); /** - * Processes a set of annotation types on type elements + * Processes a set of annotation interfaces on type elements * originating from the prior round and returns whether or not - * these annotation types are claimed by this processor. If {@code - * true} is returned, the annotation types are claimed and subsequent + * these annotation interfaces are claimed by this processor. If {@code + * true} is returned, the annotation interfaces are claimed and subsequent * processors will not be asked to process them; if {@code false} - * is returned, the annotation types are unclaimed and subsequent + * is returned, the annotation interfaces are unclaimed and subsequent * processors may be asked to process them. A processor may * always return the same boolean value or may vary the result * based on its own chosen criteria. @@ -336,9 +336,9 @@ public interface Processor { * "*"} and the root elements have no annotations. A {@code * Processor} must gracefully handle an empty set of annotations. * - * @param annotations the annotation types requested to be processed + * @param annotations the annotation interfaces requested to be processed * @param roundEnv environment for information about the current and prior round - * @return whether or not the set of annotation types are claimed by this processor + * @return whether or not the set of annotation interfaces are claimed by this processor */ boolean process(Set annotations, RoundEnvironment roundEnv); @@ -381,7 +381,7 @@ boolean process(Set annotations, * * (A Mersenne prime is prime number of the form * 2n - 1.) Given an {@code AnnotationMirror} - * for this annotation type, a list of all such primes in the + * for this annotation interface, a list of all such primes in the * {@code int} range could be returned without examining any other * arguments to {@code getCompletions}: * diff --git a/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java b/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java index e752bb53db8fb..bb6c87ef7e221 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/SupportedAnnotationTypes.java @@ -30,8 +30,8 @@ import static java.lang.annotation.ElementType.*; /** - * An annotation used to indicate what annotation types an annotation - * processor supports. The {@link + * An annotation used to indicate what annotation interfaces an + * annotation processor supports. The {@link * Processor#getSupportedAnnotationTypes} method can construct its * result from the value of this annotation, as done by {@link * AbstractProcessor#getSupportedAnnotationTypes}. Only {@linkplain @@ -48,7 +48,7 @@ @Retention(RUNTIME) public @interface SupportedAnnotationTypes { /** - * {@return the names of the supported annotation types} + * {@return the names of the supported annotation interfaces} */ String [] value(); } diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java index b59e190a5a769..1f493cadbb28e 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationMirror.java @@ -30,7 +30,7 @@ /** * Represents an annotation. An annotation associates a value with - * each element of an annotation type. + * each element of an annotation interface. * *

      Annotations should be compared using the {@code equals} * method. There is no guarantee that any particular annotation will diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java index 2a39cab48492c..ed7a180537e0a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValue.java @@ -26,7 +26,7 @@ package javax.lang.model.element; /** - * Represents a value of an annotation type element. + * Represents a value of an annotation interface element. * A value is of one of the following types: *

      • a wrapper class (such as {@link Integer}) for a primitive type *
      • {@code String} diff --git a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java index fd730a253df49..be66b95e4fc60 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java @@ -31,7 +31,7 @@ import javax.lang.model.util.*; /** - * A visitor of the values of annotation type elements, using a + * A visitor of the values of annotation interface elements, using a * variant of the visitor design pattern. Unlike a standard visitor * which dispatches based on the concrete type of a member of a type * hierarchy, this visitor dispatches based on the type of data diff --git a/src/java.compiler/share/classes/javax/lang/model/element/Element.java b/src/java.compiler/share/classes/javax/lang/model/element/Element.java index cbc4777ba6c36..61da65e0555ec 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/Element.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/Element.java @@ -125,12 +125,12 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { Set getModifiers(); /** - * {@return the simple (unqualified) name of this element} The - * name of a generic type does not include any reference to its - * formal type parameters. + * {@return the simple (unqualified) name of this element} The + * name of a generic class or interface does not include any + * reference to its formal type parameters. * - * For example, the simple name of the type element {@code - * java.util.Set} is {@code "Set"}. + * For example, the simple name of the type element representing + * {@code java.util.Set} is {@code "Set"}. * * If this element represents an unnamed {@linkplain * PackageElement#getSimpleName package} or unnamed {@linkplain @@ -166,7 +166,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * element is returned. * *
      • If this is a {@linkplain TypeElement#getEnclosingElement - * top-level type}, its package is returned. + * top-level class or interface}, its package is returned. * *
      • If this is a {@linkplain * PackageElement#getEnclosingElement package}, its module is @@ -184,7 +184,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * *
      • If this is a {@linkplain * RecordComponentElement#getEnclosingElement record component}, - * {@linkplain TypeElement the type} which declares the + * {@linkplain TypeElement the record class} which declares the * record component is returned. * *
      • If this is a {@linkplain ModuleElement#getEnclosingElement @@ -204,7 +204,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * * A {@linkplain TypeElement#getEnclosedElements class or * interface} is considered to enclose the fields, methods, - * constructors, record components, and member types that it directly declares. + * constructors, record components, and member classes and interfaces that it directly declares. * * A {@linkplain PackageElement#getEnclosedElements package} * encloses the top-level classes and interfaces within it, but is diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java b/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java index fa609761022b8..213a376dae59e 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ElementKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -44,7 +44,7 @@ public enum ElementKind { PACKAGE, // Declared types - /** An enum type. */ + /** An enum class. */ ENUM, /** * A class not described by a more specific kind (like {@code @@ -52,7 +52,7 @@ public enum ElementKind { */ CLASS, - /** An annotation type. */ + /** An annotation interface. (Formerly known as an annotation type.) */ ANNOTATION_TYPE, /** * An interface not described by a more specific kind (like @@ -109,7 +109,7 @@ public enum ElementKind { MODULE, /** - * A record type. + * A record class. * @since 16 */ RECORD, diff --git a/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java b/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java index ff179e0781593..9f8e3997781c7 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java @@ -123,9 +123,9 @@ public interface ExecutableElement extends Element, Parameterizable { /** * Returns the default value if this executable is an annotation - * type element. Returns {@code null} if this method is not an - * annotation type element, or if it is an annotation type element - * with no default value. + * interface element. Returns {@code null} if this method is not + * an annotation interface element, or if it is an annotation + * interface element with no default value. * * @return the default value, or {@code null} if none */ diff --git a/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java b/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java index 6f44be536a2d5..3c784393f315f 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -83,24 +83,27 @@ */ public enum NestingKind { /** - * A top-level type, not contained within another type. + * A top-level class or interface, not contained within another + * class or interface. */ TOP_LEVEL, /** - * A type that is a named member of another type. + * A class or interface that is a named member of another class or + * interface. * @jls 8.5 Member Type Declarations */ MEMBER, /** - * A named type declared within a construct other than a type. + * A named class or interface declared within a construct other + * than a class or interface. * @jls 14.3 Local Class Declarations */ LOCAL, /** - * A type without a name. + * A class without a name. * @jls 15.9.5 Anonymous Class Declarations */ ANONYMOUS; diff --git a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java index c9bb58dd05dc7..85e71ac2fc592 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/RecordComponentElement.java @@ -34,7 +34,7 @@ public interface RecordComponentElement extends Element { /** * {@return the enclosing element of this record component} * - * The enclosing element of a record component is the type + * The enclosing element of a record component is the record class * declaring the record component. */ @Override diff --git a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java index 836ad989c3546..aed3e95b9385a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java @@ -31,8 +31,9 @@ /** * Represents a class or interface program element. Provides access - * to information about the type and its members. Note that an enum - * type and a record type are kinds of classes and an annotation type is a kind of + * to information about the class or interface and its members. Note + * that an enum class and a record class are specialized kinds of + * classes and an annotation interface is a specialized kind of * interface. * *

        While a {@code TypeElement} represents a class or interface @@ -60,8 +61,9 @@ */ public interface TypeElement extends Element, Parameterizable, QualifiedNameable { /** - * Returns the type defined by this type element, returning the - * prototypical type for an element representing a generic type. + * Returns the type defined by this class or interface element, + * returning the prototypical type for an element + * representing a generic type. * *

        A generic element defines a family of types, not just one. * If this is a generic element, a prototypical type is @@ -83,24 +85,24 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable /** * Returns the fields, methods, constructors, record components, - * and member types that are directly declared in this class or - * interface. + * and member classes and interfaces that are directly declared in + * this class or interface. * * This includes any {@linkplain Elements.Origin#MANDATED * mandated} elements such as the (implicit) default constructor * and the implicit {@code values} and {@code valueOf} methods of - * an enum type. + * an enum class. * * @apiNote As a particular instance of the {@linkplain * javax.lang.model.element general accuracy requirements} and the * ordering behavior required of this interface, the list of * enclosed elements will be returned in the natural order for the - * originating source of information about the type. For example, - * if the information about the type is originating from a source - * file, the elements will be returned in source code order. - * (However, in that case the ordering of {@linkplain - * Elements.Origin#MANDATED implicitly declared} elements, such as - * default constructors, is not specified.) + * originating source of information about the class or interface. + * For example, if the information about the class or interface is + * originating from a source file, the elements will be returned + * in source code order. (However, in that case the ordering of + * {@linkplain Elements.Origin#MANDATED implicitly declared} + * elements, such as default constructors, is not specified.) * * @return the enclosed elements in proper order, or an empty list if none * @@ -111,23 +113,24 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable List getEnclosedElements(); /** - * Returns the nesting kind of this type element. + * Returns the nesting kind of this class or interface element. * - * @return the nesting kind of this type element + * @return the nesting kind of this class or interface element */ NestingKind getNestingKind(); /** - * Returns the fully qualified name of this type element. More - * precisely, it returns the canonical name. For local and - * anonymous classes, which do not have canonical names, an empty name is returned. + * Returns the fully qualified name of this class or interface + * element. More precisely, it returns the canonical name. + * For local and anonymous classes, which do not have canonical + * names, an empty name is + * returned. * - *

        The name of a generic type does not include any reference + *

        The name of a generic class or interface does not include any reference * to its formal type parameters. * For example, the fully qualified name of the interface * {@code java.util.Set} is "{@code java.util.Set}". - * Nested types use "{@code .}" as a separator, as in + * Nested classes and interfaces use "{@code .}" as a separator, as in * "{@code java.util.Map.Entry}". * * @return the fully qualified name of this class or interface, or @@ -139,7 +142,7 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable Name getQualifiedName(); /** - * Returns the simple name of this type element. + * Returns the simple name of this class or interface element. * * For an anonymous class, an empty * name is returned. @@ -152,8 +155,8 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable Name getSimpleName(); /** - * Returns the direct superclass of this type element. - * If this type element represents an interface or the class + * Returns the direct superclass of this class or interface element. + * If this class or interface element represents an interface or the class * {@code java.lang.Object}, then a {@link NoType} * with kind {@link TypeKind#NONE NONE} is returned. * @@ -171,7 +174,7 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable List getInterfaces(); /** - * Returns the formal type parameters of this type element + * Returns the formal type parameters of this class or interface element * in declaration order. * * @return the formal type parameters, or an empty list @@ -180,8 +183,8 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable List getTypeParameters(); /** - * Returns the record components of this type element in - * declaration order. + * Returns the record components of this class or interface + * element in declaration order. * * @implSpec The default implementations of this method returns an * empty and unmodifiable list. @@ -202,8 +205,8 @@ default List getRecordComponents() { * feature of the Java language. Preview features * may be removed in a future release, or upgraded to permanent * features of the Java language.} - * Returns the permitted classes of this type element in - * declaration order. + * Returns the permitted classes of this class or interface + * element in declaration order. * * @implSpec The default implementations of this method returns an * empty and unmodifiable list. @@ -219,12 +222,12 @@ default List getPermittedSubclasses() { } /** - * Returns the package of a top-level type and returns the - * immediately lexically enclosing element for a {@linkplain - * NestingKind#isNested nested} type. + * Returns the package of a top-level class or interface and + * returns the immediately lexically enclosing element for a + * {@linkplain NestingKind#isNested nested} class or interface. * - * @return the package of a top-level type, the immediately - * lexically enclosing element for a nested type + * @return the package of a top-level class or interface, the immediately + * lexically enclosing element for a nested class or interface */ @Override Element getEnclosingElement(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/package-info.java b/src/java.compiler/share/classes/javax/lang/model/element/package-info.java index 6787ea97538f2..296a4034fc62e 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/package-info.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/package-info.java @@ -50,7 +50,9 @@ * recovered from class files and class files might not be able to * provide source position information. * - * Names of {@linkplain javax.lang.model.element.ExecutableElement#getParameters() parameters} may not be recoverable from class files. + * Names of {@linkplain + * javax.lang.model.element.ExecutableElement#getParameters() + * parameters} may not be recoverable from class files. * * The {@linkplain javax.lang.model.element.Modifier modifiers} on an * element created from a class file may differ in some cases from an @@ -82,20 +84,20 @@ * guarantees about the nature of the resulting model. If the source * code is not syntactically well-formed or has some other * irrecoverable error that could not be removed by the generation of - * new types, a model may or may not be provided as a quality of - * implementation issue. - * If a program is syntactically valid but erroneous in some other - * fashion, any returned model must have no less information than if - * all the method bodies in the program were replaced by {@code "throw - * new RuntimeException();"}. If a program refers to a missing type Xyz, - * the returned model must contain no less information than if the - * declaration of type Xyz were assumed to be {@code "class Xyz {}"}, - * {@code "interface Xyz {}"}, {@code "enum Xyz {}"}, {@code - * "@interface Xyz {}"}, or {@code "record Xyz {}"}. If a program refers to a missing type {@code - * Xyz}, the returned model must contain no less - * information than if the declaration of Xyz were assumed to be - * {@code "class Xyz {}"} or {@code "interface Xyz {}"} + * new classes or interfaces, a model may or may not be provided as a + * quality of implementation issue. If a program is syntactically + * valid but erroneous in some other fashion, any returned model must + * have no less information than if all the method bodies in the + * program were replaced by {@code "throw new RuntimeException();"}. + * If a program refers to a missing class or interface Xyz, the + * returned model must contain no less information than if the + * declaration of class or interface Xyz were assumed to be {@code + * "class Xyz {}"}, {@code "interface Xyz {}"}, {@code "enum Xyz {}"}, + * {@code "@interface Xyz {}"}, or {@code "record Xyz {}"}. If a + * program refers to a missing class or interface {@code Xyz}, the returned model must contain no less information than + * if the declaration of Xyz were assumed to be {@code "class Xyz {}"} or {@code "interface Xyz {}"} * *

        Unless otherwise specified in a particular implementation, the * collections returned by methods in this package should be expected diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java index b410d811ff7b1..20589053776cf 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java @@ -166,7 +166,7 @@ private ElementFilter() {} // Do not instantiate. } /** - * {@return a list of types in {@code elements}} + * {@return a list of classes and interfaces in {@code elements}} * @param elements the elements to filter */ public static List diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java index ebc078bb31272..c6e3289446e86 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java @@ -336,7 +336,7 @@ default Origin getOrigin(Element e) { * An annotation mirror is {@linkplain Origin#MANDATED mandated} * if it is an implicitly declared container annotation * used to hold repeated annotations of a repeatable annotation - * type. + * interface. * *

        Note that if this method returns {@link Origin#EXPLICIT * EXPLICIT} and the annotation mirror was created from a class @@ -423,7 +423,7 @@ public enum Origin { * * Another example of a mandated construct is an implicitly * declared container annotation used to hold - * multiple annotations of a repeatable annotation type. + * multiple annotations of a repeatable annotation interface. * * @jls 8.8.9 Default Constructor * @jls 8.9.3 Enum Members @@ -480,7 +480,7 @@ default boolean isBridge(ExecutableElement e) { * itself. * The package of a module is {@code null}. * - * The package of a top-level type is its {@linkplain + * The package of a top-level class or interface is its {@linkplain * TypeElement#getEnclosingElement enclosing package}. Otherwise, * the package of an element is equal to the package of the * {@linkplain Element#getEnclosingElement enclosing element}. @@ -559,7 +559,7 @@ default ModuleElement getModuleOf(Element e) { boolean hides(Element hider, Element hidden); /** - * Tests whether one method, as a member of a given type, + * Tests whether one method, as a member of a given class or interface, * overrides another method. * When a non-abstract method overrides an abstract one, the * former is also said to implement the latter. @@ -578,8 +578,8 @@ default ModuleElement getModuleOf(Element e) { * * * A more interesting case can be illustrated by the following example - * in which a method in type {@code A} does not override a - * like-named method in type {@code B}: + * in which a method in class {@code A} does not override a + * like-named method in interface {@code B}: * *

        * {@code class A { public void m() {} } }
        @@ -591,7 +591,7 @@ default ModuleElement getModuleOf(Element e) { * elements.getTypeElement("A")); } *
        * - * When viewed as a member of a third type {@code C}, however, + * When viewed as a member of a third class {@code C}, however, * the method in {@code A} does override the one in {@code B}: * *
        @@ -603,7 +603,7 @@ default ModuleElement getModuleOf(Element e) { * * @param overrider the first method, possible overrider * @param overridden the second method, possibly being overridden - * @param type the type of which the first method is a member + * @param type the class or interface of which the first method is a member * @return {@code true} if and only if the first method overrides * the second * @jls 8.4.8 Inheritance, Overriding, and Hiding From 6847bbbb11379c1e36589256d6691a69188e2b9e Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Thu, 10 Dec 2020 03:40:01 +0000 Subject: [PATCH 176/504] 8255918: XMLStreamFilterImpl constructor consumes XMLStreamException Reviewed-by: joehw --- .../internal/impl/XMLStreamFilterImpl.java | 30 ++++--- .../XMLStreamReaderFilterTest.java | 78 +++++++++++++++++++ 2 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/XMLStreamReaderFilterTest.java diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java index d147cc9e1552a..127e2c05479dc 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java @@ -25,8 +25,6 @@ package com.sun.org.apache.xerces.internal.impl; -import javax.xml.XMLConstants; -import javax.xml.stream.Location; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.StreamFilter; import javax.xml.stream.XMLStreamException; @@ -56,22 +54,30 @@ public class XMLStreamFilterImpl implements javax.xml.stream.XMLStreamReader { * hasNext() to advance the underlining stream in order to find the next acceptable event */ private boolean fStreamAdvancedByHasNext = false; - /** Creates a new instance of XMLStreamFilterImpl */ - public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){ + /** + * Creates a new instance of XMLStreamFilterImpl, advancing the reader to + * the next event accepted by the filter, if not already positioned on an + * accepted event. + * + * @param reader + * the reader to filter + * @param filter + * the filter to apply to the reader + * @throws XMLStreamException + * when an {@code XMLStreamException} is thrown when + * advancing the reader to an accepted event. + **/ + public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter) throws XMLStreamException { fStreamReader = reader; this.fStreamFilter = filter; //this is debatable to initiate at an acceptable event, //but it's neccessary in order to pass the TCK and yet avoid skipping element - try { - if (fStreamFilter.accept(fStreamReader)) { - fEventAccepted = true; - } else { - findNextEvent(); - } - }catch(XMLStreamException xs){ - System.err.println("Error while creating a stream Filter"+xs); + if (fStreamFilter.accept(fStreamReader)) { + fEventAccepted = true; + } else { + findNextEvent(); } } diff --git a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/XMLStreamReaderFilterTest.java b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/XMLStreamReaderFilterTest.java new file mode 100644 index 0000000000000..3afa144635068 --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/XMLStreamReaderFilterTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2020, 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 stream.XMLStreamFilterTest; + +import static org.testng.Assert.assertThrows; + +import java.io.Reader; +import java.io.StringReader; + +import javax.xml.stream.StreamFilter; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.testng.annotations.Test; + +/* +* @test +* @bug 8255918 +* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest +* @run testng stream.XMLStreamFilterTest.XMLStreamReaderFilterTest +* @summary Test the implementation of {@code XMLStreamReader} using a {@code StreamFilter} +*/ +public class XMLStreamReaderFilterTest { + + static final String XMLSOURCE1 = "\n" + + " \n" + + " \n" // Unclosed element2 + + " \n" + + " \n" + + " \n" + + ""; + + /** + * Verifies that XMLStreamException is thrown as specified by the + * {@code XMLInputFactory::createFilteredReader} method when an error + * is encountered. This test illustrates the scenario by creating a + * reader with a filter that requires the original reader to advance + * past the invalid element in the underlying XML. + * + * @throws Exception When an unexpected exception is encountered (test failure) + */ + @Test + public void testCreateFilteredReader() throws Exception { + StreamFilter filter = r -> r.getEventType() == XMLStreamConstants.START_ELEMENT + && r.getLocalName().equals("element3"); + + XMLInputFactory factory = XMLInputFactory.newInstance(); + + try (Reader source = new StringReader(XMLSOURCE1)) { + XMLStreamReader reader = factory.createXMLStreamReader(source); + assertThrows(XMLStreamException.class, () -> factory.createFilteredReader(reader, filter)); + } + } + +} From 34650f52b524962363452ed1dae5f54dd0832d08 Mon Sep 17 00:00:00 2001 From: Koichi Sakata Date: Thu, 10 Dec 2020 04:05:18 +0000 Subject: [PATCH 177/504] 8257872: UL: -Xlog does not check number of options Reviewed-by: dholmes, iklam, ysuenaga --- src/hotspot/share/logging/logConfiguration.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hotspot/share/logging/logConfiguration.cpp b/src/hotspot/share/logging/logConfiguration.cpp index 323537b012c76..556a34f3672c7 100644 --- a/src/hotspot/share/logging/logConfiguration.cpp +++ b/src/hotspot/share/logging/logConfiguration.cpp @@ -362,10 +362,15 @@ bool LogConfiguration::parse_command_line_arguments(const char* opts) { *next = '\0'; str = next + 1; } else { + str = NULL; break; } } + if (str != NULL) { + log_warning(logging)("Ignoring excess -Xlog options: \"%s\"", str); + } + // Parse and apply the separated configuration options char* what = substrings[0]; char* output = substrings[1]; From 869dcb6f5030e74f0ea70292d4eedc9dceb00f3e Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Thu, 10 Dec 2020 04:31:27 +0000 Subject: [PATCH 178/504] 8257806: Optimize x86 allTrue and anyTrue vector mask operations of Vector API Reviewed-by: kvn, psandoz --- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 56 +++++++++++ src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp | 4 + src/hotspot/cpu/x86/x86.ad | 94 +++++++++++++------ 3 files changed, 125 insertions(+), 29 deletions(-) diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index c975b4f3b1389..4b7649cca535e 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -29,6 +29,7 @@ #include "opto/c2_MacroAssembler.hpp" #include "opto/intrinsicnode.hpp" #include "opto/opcodes.hpp" +#include "opto/subnode.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/objectMonitor.hpp" #include "runtime/stubRoutines.hpp" @@ -2161,6 +2162,61 @@ void C2_MacroAssembler::evpblend(BasicType typ, XMMRegister dst, KRegister kmask } } +void C2_MacroAssembler::vectortest(int bt, int vlen, XMMRegister src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2) { + switch(vlen) { + case 4: + assert(vtmp1 != xnoreg, "required."); + // Broadcast lower 32 bits to 128 bits before ptest + pshufd(vtmp1, src1, 0x0); + if (bt == BoolTest::overflow) { + assert(vtmp2 != xnoreg, "required."); + pshufd(vtmp2, src2, 0x0); + } else { + assert(vtmp2 == xnoreg, "required."); + vtmp2 = src2; + } + ptest(vtmp1, vtmp2); + break; + case 8: + assert(vtmp1 != xnoreg, "required."); + // Broadcast lower 64 bits to 128 bits before ptest + pshufd(vtmp1, src1, 0x4); + if (bt == BoolTest::overflow) { + assert(vtmp2 != xnoreg, "required."); + pshufd(vtmp2, src2, 0x4); + } else { + assert(vtmp2 == xnoreg, "required."); + vtmp2 = src2; + } + ptest(vtmp1, vtmp2); + break; + case 16: + assert((vtmp1 == xnoreg) && (vtmp2 == xnoreg), "required."); + ptest(src1, src2); + break; + case 32: + assert((vtmp1 == xnoreg) && (vtmp2 == xnoreg), "required."); + vptest(src1, src2, Assembler::AVX_256bit); + break; + case 64: + { + KRegister ktemp = k2; // Use a hardcoded temp due to no k register allocation. + assert((vtmp1 == xnoreg) && (vtmp2 == xnoreg), "required."); + evpcmpeqb(ktemp, src1, src2, Assembler::AVX_512bit); + if (bt == BoolTest::ne) { + ktestql(ktemp, ktemp); + } else { + assert(bt == BoolTest::overflow, "required"); + kortestql(ktemp, ktemp); + } + } + break; + default: + assert(false,"Should not reach here."); + break; + } +} + //------------------------------------------------------------------------------------------- // IndexOf for constant substrings with size >= 8 chars diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp index f6730f83404c2..800f98d5eb28b 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp @@ -129,6 +129,10 @@ void get_elem(BasicType typ, Register dst, XMMRegister src, int elemindex); void get_elem(BasicType typ, XMMRegister dst, XMMRegister src, int elemindex, Register tmp = noreg, XMMRegister vtmp = xnoreg); + // vector test + void vectortest(int bt, int vlen, XMMRegister src1, XMMRegister src2, + XMMRegister vtmp1 = xnoreg, XMMRegister vtmp2 = xnoreg); + // blend void evpcmp(BasicType typ, KRegister kdmask, KRegister ksmask, XMMRegister src1, AddressLiteral adr, int comparison, int vector_len, Register scratch = rscratch1); void evpblend(BasicType typ, XMMRegister dst, KRegister kmask, XMMRegister src1, XMMRegister src2, bool merge, int vector_len); diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index e5923f772193b..5396d4a27f25c 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1678,7 +1678,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType case Op_VectorTest: if (UseSSE < 4) { return false; // Implementation limitation - } else if (size_in_bits < 128) { + } else if (size_in_bits < 32) { return false; // Implementation limitation } else if (size_in_bits == 512 && (VM_Version::supports_avx512bw() == false)) { return false; // Implementation limitation @@ -7266,57 +7266,93 @@ instruct vabsnegD(vec dst, vec src, rRegI scratch) %{ //------------------------------------- VectorTest -------------------------------------------- #ifdef _LP64 +instruct vptest_alltrue_lt16(rRegI dst, legVec src1, legVec src2, legVec vtmp1, legVec vtmp2, rFlagsReg cr) %{ + predicate(vector_length_in_bytes(n->in(1)) >= 4 && + vector_length_in_bytes(n->in(1)) < 16 && + static_cast(n)->get_predicate() == BoolTest::overflow); + match(Set dst (VectorTest src1 src2 )); + effect(TEMP vtmp1, TEMP vtmp2, KILL cr); + format %{ "vector_test $dst,$src1, $src2\t! using $vtmp1, $vtmp2 and $cr as TEMP" %} + ins_encode %{ + int vlen = vector_length_in_bytes(this, $src1); + __ vectortest(BoolTest::overflow, vlen, $src1$$XMMRegister, $src2$$XMMRegister, $vtmp1$$XMMRegister, $vtmp2$$XMMRegister); + __ setb(Assembler::carrySet, $dst$$Register); + __ movzbl($dst$$Register, $dst$$Register); + %} + ins_pipe( pipe_slow ); +%} + instruct vptest_alltrue(rRegI dst, legVec src1, legVec src2, rFlagsReg cr) %{ - predicate(static_cast(n)->get_predicate() == BoolTest::overflow); + predicate(vector_length_in_bytes(n->in(1)) >= 16 && + static_cast(n)->get_predicate() == BoolTest::overflow); match(Set dst (VectorTest src1 src2 )); effect(KILL cr); format %{ "vector_test $dst,$src1, $src2\t! using $cr as TEMP" %} ins_encode %{ int vlen = vector_length_in_bytes(this, $src1); - int vlen_enc = vector_length_encoding(vlen); - if (vlen <= 32) { - if (UseAVX == 0) { - assert(vlen <= 16, "required"); - __ ptest($src1$$XMMRegister, $src2$$XMMRegister); - } else { - __ vptest($src1$$XMMRegister, $src2$$XMMRegister, vlen_enc); - } - } else { - KRegister ktmp = k2; // Use a hardcoded temp due to no k register allocation. - __ evpcmpeqb(ktmp, $src1$$XMMRegister, $src2$$XMMRegister, vlen_enc); - __ kortestql(ktmp, ktmp); - } + __ vectortest(BoolTest::overflow, vlen, $src1$$XMMRegister, $src2$$XMMRegister); __ setb(Assembler::carrySet, $dst$$Register); __ movzbl($dst$$Register, $dst$$Register); %} ins_pipe( pipe_slow ); %} +instruct vptest_anytrue_lt16(rRegI dst, legVec src1, legVec src2, legVec vtmp, rFlagsReg cr) %{ + predicate(vector_length_in_bytes(n->in(1)) >= 4 && + vector_length_in_bytes(n->in(1)) < 16 && + static_cast(n)->get_predicate() == BoolTest::ne); + match(Set dst (VectorTest src1 src2 )); + effect(TEMP vtmp, KILL cr); + format %{ "vector_test_any_true $dst,$src1,$src2\t! using $vtmp, $cr as TEMP" %} + ins_encode %{ + int vlen = vector_length_in_bytes(this, $src1); + __ vectortest(BoolTest::ne, vlen, $src1$$XMMRegister, $src2$$XMMRegister, $vtmp$$XMMRegister); + __ setb(Assembler::notZero, $dst$$Register); + __ movzbl($dst$$Register, $dst$$Register); + %} + ins_pipe( pipe_slow ); +%} + instruct vptest_anytrue(rRegI dst, legVec src1, legVec src2, rFlagsReg cr) %{ - predicate(static_cast(n)->get_predicate() == BoolTest::ne); + predicate(vector_length_in_bytes(n->in(1)) >= 16 && + static_cast(n)->get_predicate() == BoolTest::ne); match(Set dst (VectorTest src1 src2 )); effect(KILL cr); format %{ "vector_test_any_true $dst,$src1,$src2\t! using $cr as TEMP" %} ins_encode %{ int vlen = vector_length_in_bytes(this, $src1); - int vlen_enc = vector_length_encoding(vlen); - if (vlen <= 32) { - if (UseAVX == 0) { - assert(vlen <= 16, "required"); - __ ptest($src1$$XMMRegister, $src2$$XMMRegister); - } else { - __ vptest($src1$$XMMRegister, $src2$$XMMRegister, vlen_enc); - } - } else { - KRegister ktmp = k2; // Use a hardcoded temp due to no k register allocation. - __ evpcmpeqb(ktmp, $src1$$XMMRegister, $src2$$XMMRegister, vlen_enc); - __ ktestql(ktmp, ktmp); - } + __ vectortest(BoolTest::ne, vlen, $src1$$XMMRegister, $src2$$XMMRegister); __ setb(Assembler::notZero, $dst$$Register); __ movzbl($dst$$Register, $dst$$Register); %} ins_pipe( pipe_slow ); %} + +instruct cmpvptest_anytrue_lt16(rFlagsReg cr, legVec src1, legVec src2, immI_0 zero, legVec vtmp) %{ + predicate(vector_length_in_bytes(n->in(1)->in(1)) >= 4 && + vector_length_in_bytes(n->in(1)->in(1)) < 16 && + static_cast(n->in(1))->get_predicate() == BoolTest::ne); + match(Set cr (CmpI (VectorTest src1 src2) zero)); + effect(TEMP vtmp); + format %{ "cmp_vector_test_any_true $src1,$src2\t! using $vtmp as TEMP" %} + ins_encode %{ + int vlen = vector_length_in_bytes(this, $src1); + __ vectortest(BoolTest::ne, vlen, $src1$$XMMRegister, $src2$$XMMRegister, $vtmp$$XMMRegister); + %} + ins_pipe( pipe_slow ); +%} + +instruct cmpvptest_anytrue(rFlagsReg cr, legVec src1, legVec src2, immI_0 zero) %{ + predicate(vector_length_in_bytes(n->in(1)->in(1)) >= 16 && + static_cast(n->in(1))->get_predicate() == BoolTest::ne); + match(Set cr (CmpI (VectorTest src1 src2) zero)); + format %{ "cmp_vector_test_any_true $src1,$src2\t!" %} + ins_encode %{ + int vlen = vector_length_in_bytes(this, $src1); + __ vectortest(BoolTest::ne, vlen, $src1$$XMMRegister, $src2$$XMMRegister); + %} + ins_pipe( pipe_slow ); +%} #endif //------------------------------------- LoadMask -------------------------------------------- From d93293f31be05777f34db2c412c6c11414ef2f81 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Thu, 10 Dec 2020 08:09:08 +0000 Subject: [PATCH 179/504] 8256730: Code that uses Object.checkIndex() range checks doesn't optimize well Reviewed-by: vlivanov, thartmann --- src/hotspot/share/opto/castnode.cpp | 38 +++++ src/hotspot/share/opto/compile.hpp | 5 + src/hotspot/share/opto/convertnode.cpp | 141 ++++++++++-------- src/hotspot/share/opto/loopTransform.cpp | 8 +- src/hotspot/share/opto/loopopts.cpp | 6 +- ... => TestMoveConvI2LOrCastIIThruAddIs.java} | 48 +++++- 6 files changed, 175 insertions(+), 71 deletions(-) rename test/hotspot/jtreg/compiler/conversions/{TestMoveConvI2LThroughAddIs.java => TestMoveConvI2LOrCastIIThruAddIs.java} (80%) diff --git a/src/hotspot/share/opto/castnode.cpp b/src/hotspot/share/opto/castnode.cpp index f1b34da54147e..911e697acfef2 100644 --- a/src/hotspot/share/opto/castnode.cpp +++ b/src/hotspot/share/opto/castnode.cpp @@ -240,12 +240,50 @@ const Type* CastIINode::Value(PhaseGVN* phase) const { return res; } +static Node* find_or_make_CastII(PhaseIterGVN* igvn, Node* parent, Node* control, + const TypeInt* type) { + Node* n = new CastIINode(parent, type); + n->set_req(0, control); + Node* existing = igvn->hash_find_insert(n); + if (existing != NULL) { + n->destruct(igvn); + return existing; + } + return igvn->register_new_node_with_optimizer(n); +} + Node *CastIINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* progress = ConstraintCastNode::Ideal(phase, can_reshape); if (progress != NULL) { return progress; } + PhaseIterGVN *igvn = phase->is_IterGVN(); + const TypeInt* this_type = this->type()->is_int(); + Node* z = in(1); + const TypeInteger* rx = NULL; + const TypeInteger* ry = NULL; + // Similar to ConvI2LNode::Ideal() for the same reasons + if (!_range_check_dependency && Compile::push_thru_add(phase, z, this_type, rx, ry, T_INT)) { + if (igvn == NULL) { + // Postpone this optimization to iterative GVN, where we can handle deep + // AddI chains without an exponential number of recursive Ideal() calls. + phase->record_for_igvn(this); + return NULL; + } + int op = z->Opcode(); + Node* x = z->in(1); + Node* y = z->in(2); + + Node* cx = find_or_make_CastII(igvn, x, in(0), rx->is_int()); + Node* cy = find_or_make_CastII(igvn, y, in(0), ry->is_int()); + switch (op) { + case Op_AddI: return new AddINode(cx, cy); + case Op_SubI: return new SubINode(cx, cy); + default: ShouldNotReachHere(); + } + } + // Similar to ConvI2LNode::Ideal() for the same reasons // Do not narrow the type of range check dependent CastIINodes to // avoid corruption of the graph if a CastII is replaced by TOP but diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index e45d73a21fad1..a2e20a431da81 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -80,6 +80,7 @@ class JVMState; class Type; class TypeData; class TypeInt; +class TypeInteger; class TypePtr; class TypeOopPtr; class TypeFunc; @@ -1182,6 +1183,10 @@ class Compile : public Phase { void set_exception_backedge() { _exception_backedge = true; } bool has_exception_backedge() const { return _exception_backedge; } #endif + + static bool + push_thru_add(PhaseGVN* phase, Node* z, const TypeInteger* tz, const TypeInteger*& rx, const TypeInteger*& ry, + BasicType bt); }; #endif // SHARE_OPTO_COMPILE_HPP diff --git a/src/hotspot/share/opto/convertnode.cpp b/src/hotspot/share/opto/convertnode.cpp index bdacc68d640ca..e2c4c25f5abb0 100644 --- a/src/hotspot/share/opto/convertnode.cpp +++ b/src/hotspot/share/opto/convertnode.cpp @@ -252,13 +252,13 @@ const Type* ConvI2LNode::Value(PhaseGVN* phase) const { return tl; } -#ifdef _LP64 static inline bool long_ranges_overlap(jlong lo1, jlong hi1, jlong lo2, jlong hi2) { // Two ranges overlap iff one range's low point falls in the other range. return (lo2 <= lo1 && lo1 <= hi2) || (lo1 <= lo2 && lo2 <= hi1); } +#ifdef _LP64 // If there is an existing ConvI2L node with the given parent and type, return // it. Otherwise, create and return a new one. Both reusing existing ConvI2L // nodes and postponing the idealization of new ones are needed to avoid an @@ -275,6 +275,80 @@ static Node* find_or_make_convI2L(PhaseIterGVN* igvn, Node* parent, } #endif +bool Compile::push_thru_add(PhaseGVN* phase, Node* z, const TypeInteger* tz, const TypeInteger*& rx, const TypeInteger*& ry, + BasicType bt) { + int op = z->Opcode(); + if (op == Op_AddI || op == Op_SubI) { + Node* x = z->in(1); + Node* y = z->in(2); + assert (x != z && y != z, "dead loop in ConvI2LNode::Ideal"); + if (phase->type(x) == Type::TOP) { + return false; + } + if (phase->type(y) == Type::TOP) { + return false; + } + const TypeInt* tx = phase->type(x)->is_int(); + const TypeInt* ty = phase->type(y)->is_int(); + + jlong xlo = tx->is_int()->_lo; + jlong xhi = tx->is_int()->_hi; + jlong ylo = ty->is_int()->_lo; + jlong yhi = ty->is_int()->_hi; + jlong zlo = tz->lo_as_long(); + jlong zhi = tz->hi_as_long(); + jlong vbit = CONST64(1) << BitsPerInt; + int widen = MAX2(tx->_widen, ty->_widen); + if (op == Op_SubI) { + jlong ylo0 = ylo; + ylo = -yhi; + yhi = -ylo0; + } + // See if x+y can cause positive overflow into z+2**32 + if (long_ranges_overlap(xlo+ylo, xhi+yhi, zlo+vbit, zhi+vbit)) { + return false; + } + // See if x+y can cause negative overflow into z-2**32 + if (long_ranges_overlap(xlo+ylo, xhi+yhi, zlo-vbit, zhi-vbit)) { + return false; + } + // Now it's always safe to assume x+y does not overflow. + // This is true even if some pairs x,y might cause overflow, as long + // as that overflow value cannot fall into [zlo,zhi]. + + // Confident that the arithmetic is "as if infinite precision", + // we can now use z's range to put constraints on those of x and y. + // The "natural" range of x [xlo,xhi] can perhaps be narrowed to a + // more "restricted" range by intersecting [xlo,xhi] with the + // range obtained by subtracting y's range from the asserted range + // of the I2L conversion. Here's the interval arithmetic algebra: + // x == z-y == [zlo,zhi]-[ylo,yhi] == [zlo,zhi]+[-yhi,-ylo] + // => x in [zlo-yhi, zhi-ylo] + // => x in [zlo-yhi, zhi-ylo] INTERSECT [xlo,xhi] + // => x in [xlo MAX zlo-yhi, xhi MIN zhi-ylo] + jlong rxlo = MAX2(xlo, zlo - yhi); + jlong rxhi = MIN2(xhi, zhi - ylo); + // And similarly, x changing place with y: + jlong rylo = MAX2(ylo, zlo - xhi); + jlong ryhi = MIN2(yhi, zhi - xlo); + if (rxlo > rxhi || rylo > ryhi) { + return false; // x or y is dying; don't mess w/ it + } + if (op == Op_SubI) { + jlong rylo0 = rylo; + rylo = -ryhi; + ryhi = -rylo0; + } + assert(rxlo == (int)rxlo && rxhi == (int)rxhi, "x should not overflow"); + assert(rylo == (int)rylo && ryhi == (int)ryhi, "y should not overflow"); + rx = TypeInteger::make(rxlo, rxhi, widen, bt); + ry = TypeInteger::make(rylo, ryhi, widen, bt); + return true; + } + return false; +} + + //------------------------------Ideal------------------------------------------ Node *ConvI2LNode::Ideal(PhaseGVN *phase, bool can_reshape) { PhaseIterGVN *igvn = phase->is_IterGVN(); @@ -348,74 +422,21 @@ Node *ConvI2LNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Addressing arithmetic will not absorb it as part of a 64-bit AddL. Node* z = in(1); - int op = z->Opcode(); - if (op == Op_AddI || op == Op_SubI) { + const TypeInteger* rx = NULL; + const TypeInteger* ry = NULL; + if (Compile::push_thru_add(phase, z, this_type, rx, ry, T_LONG)) { if (igvn == NULL) { // Postpone this optimization to iterative GVN, where we can handle deep // AddI chains without an exponential number of recursive Ideal() calls. phase->record_for_igvn(this); return this_changed; } + int op = z->Opcode(); Node* x = z->in(1); Node* y = z->in(2); - assert (x != z && y != z, "dead loop in ConvI2LNode::Ideal"); - if (phase->type(x) == Type::TOP) return this_changed; - if (phase->type(y) == Type::TOP) return this_changed; - const TypeInt* tx = phase->type(x)->is_int(); - const TypeInt* ty = phase->type(y)->is_int(); - const TypeLong* tz = this_type; - jlong xlo = tx->_lo; - jlong xhi = tx->_hi; - jlong ylo = ty->_lo; - jlong yhi = ty->_hi; - jlong zlo = tz->_lo; - jlong zhi = tz->_hi; - jlong vbit = CONST64(1) << BitsPerInt; - int widen = MAX2(tx->_widen, ty->_widen); - if (op == Op_SubI) { - jlong ylo0 = ylo; - ylo = -yhi; - yhi = -ylo0; - } - // See if x+y can cause positive overflow into z+2**32 - if (long_ranges_overlap(xlo+ylo, xhi+yhi, zlo+vbit, zhi+vbit)) { - return this_changed; - } - // See if x+y can cause negative overflow into z-2**32 - if (long_ranges_overlap(xlo+ylo, xhi+yhi, zlo-vbit, zhi-vbit)) { - return this_changed; - } - // Now it's always safe to assume x+y does not overflow. - // This is true even if some pairs x,y might cause overflow, as long - // as that overflow value cannot fall into [zlo,zhi]. - // Confident that the arithmetic is "as if infinite precision", - // we can now use z's range to put constraints on those of x and y. - // The "natural" range of x [xlo,xhi] can perhaps be narrowed to a - // more "restricted" range by intersecting [xlo,xhi] with the - // range obtained by subtracting y's range from the asserted range - // of the I2L conversion. Here's the interval arithmetic algebra: - // x == z-y == [zlo,zhi]-[ylo,yhi] == [zlo,zhi]+[-yhi,-ylo] - // => x in [zlo-yhi, zhi-ylo] - // => x in [zlo-yhi, zhi-ylo] INTERSECT [xlo,xhi] - // => x in [xlo MAX zlo-yhi, xhi MIN zhi-ylo] - jlong rxlo = MAX2(xlo, zlo - yhi); - jlong rxhi = MIN2(xhi, zhi - ylo); - // And similarly, x changing place with y: - jlong rylo = MAX2(ylo, zlo - xhi); - jlong ryhi = MIN2(yhi, zhi - xlo); - if (rxlo > rxhi || rylo > ryhi) { - return this_changed; // x or y is dying; don't mess w/ it - } - if (op == Op_SubI) { - jlong rylo0 = rylo; - rylo = -ryhi; - ryhi = -rylo0; - } - assert(rxlo == (int)rxlo && rxhi == (int)rxhi, "x should not overflow"); - assert(rylo == (int)rylo && ryhi == (int)ryhi, "y should not overflow"); - Node* cx = find_or_make_convI2L(igvn, x, TypeLong::make(rxlo, rxhi, widen)); - Node* cy = find_or_make_convI2L(igvn, y, TypeLong::make(rylo, ryhi, widen)); + Node* cx = find_or_make_convI2L(igvn, x, rx->is_long()); + Node* cy = find_or_make_convI2L(igvn, y, ry->is_long()); switch (op) { case Op_AddI: return new AddLNode(cx, cy); case Op_SubI: return new SubLNode(cx, cy); diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index 416e369d93306..2c23c26b4e980 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -2428,6 +2428,7 @@ void PhaseIdealLoop::add_constraint(jlong stride_con, jlong scale_con, Node* off //------------------------------is_scaled_iv--------------------------------- // Return true if exp is a constant times an induction var bool PhaseIdealLoop::is_scaled_iv(Node* exp, Node* iv, int* p_scale) { + exp = exp->uncast(); if (exp == iv) { if (p_scale != NULL) { *p_scale = 1; @@ -2436,20 +2437,20 @@ bool PhaseIdealLoop::is_scaled_iv(Node* exp, Node* iv, int* p_scale) { } int opc = exp->Opcode(); if (opc == Op_MulI) { - if (exp->in(1) == iv && exp->in(2)->is_Con()) { + if (exp->in(1)->uncast() == iv && exp->in(2)->is_Con()) { if (p_scale != NULL) { *p_scale = exp->in(2)->get_int(); } return true; } - if (exp->in(2) == iv && exp->in(1)->is_Con()) { + if (exp->in(2)->uncast() == iv && exp->in(1)->is_Con()) { if (p_scale != NULL) { *p_scale = exp->in(1)->get_int(); } return true; } } else if (opc == Op_LShiftI) { - if (exp->in(1) == iv && exp->in(2)->is_Con()) { + if (exp->in(1)->uncast() == iv && exp->in(2)->is_Con()) { if (p_scale != NULL) { *p_scale = 1 << exp->in(2)->get_int(); } @@ -2470,6 +2471,7 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, } return true; } + exp = exp->uncast(); int opc = exp->Opcode(); if (opc == Op_AddI) { if (is_scaled_iv(exp->in(1), iv, p_scale)) { diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 9d7780422c431..52e56fad02457 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -56,8 +56,8 @@ Node* PhaseIdealLoop::split_thru_phi(Node* n, Node* region, int policy) { // Splitting range check CastIIs through a loop induction Phi can // cause new Phis to be created that are left unrelated to the loop // induction Phi and prevent optimizations (vectorization) - if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() && - region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) { + if (n->Opcode() == Op_CastII && region->is_CountedLoop() && + n->in(1) == region->as_CountedLoop()->phi()) { return NULL; } @@ -1116,7 +1116,7 @@ static bool merge_point_safe(Node* region) { Node* m = n->fast_out(j); if (m->Opcode() == Op_ConvI2L) return false; - if (m->is_CastII() && m->isa_CastII()->has_range_check()) { + if (m->is_CastII()) { return false; } } diff --git a/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LThroughAddIs.java b/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java similarity index 80% rename from test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LThroughAddIs.java rename to test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java index f93677b3754b4..c4c6a27cb7d88 100644 --- a/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LThroughAddIs.java +++ b/test/hotspot/jtreg/compiler/conversions/TestMoveConvI2LOrCastIIThruAddIs.java @@ -23,12 +23,13 @@ package compiler.conversions; +import java.util.Objects; import java.util.Random; import jdk.test.lib.Asserts; /* * @test - * @bug 8254317 + * @bug 8254317 8256730 * @requires vm.compiler2.enabled * @summary Exercises the optimization that moves integer-to-long conversions * upwards through different shapes of integer addition @@ -40,14 +41,18 @@ * the explosion earlier. * @library /test/lib / * @run main/othervm - * compiler.conversions.TestMoveConvI2LThroughAddIs functional + * compiler.conversions.TestMoveConvI2LOrCastIIThruAddIs functional * @run main/othervm/timeout=30 -Xbatch - * compiler.conversions.TestMoveConvI2LThroughAddIs stress1 + * compiler.conversions.TestMoveConvI2LOrCastIIThruAddIs stress1 * @run main/othervm/timeout=30 -Xbatch - * compiler.conversions.TestMoveConvI2LThroughAddIs stress2 + * compiler.conversions.TestMoveConvI2LOrCastIIThruAddIs stress2 + * @run main/othervm/timeout=30 -Xbatch + * compiler.conversions.TestMoveConvI2LOrCastIIThruAddIs stress3 + * @run main/othervm/timeout=30 -Xbatch + * compiler.conversions.TestMoveConvI2LOrCastIIThruAddIs stress4 */ -public class TestMoveConvI2LThroughAddIs { +public class TestMoveConvI2LOrCastIIThruAddIs { // Number of repetitions of each test. Should be sufficiently large for the // method under test to be compiled with C2. @@ -126,6 +131,28 @@ static long testStress2(boolean cnd) { return d; } + // Same as testStress1 for CastII + static long testStress3(int a) { + Objects.checkIndex(a, 2); + for (int i = 0; i < 28; i++) { + a = a + a; + } + return Objects.checkIndex(a, 2); + } + + // Same as testStress2 for CastII + static long testStress4(int a) { + a = Objects.checkIndex(a, 2); + int b = a; + int c = a + a; + for (int i = 0; i < 20; i++) { + b = b + c; + c = b + c; + } + int d = b + c; + return Objects.checkIndex(d, 2); + } + public static void main(String[] args) { // We use a random number generator to avoid constant propagation in C2 // and produce a variable ("a" in the different tests) with a finite, @@ -157,6 +184,17 @@ public static void main(String[] args) { cnd ? 701408733L : 1402817466L); } break; + case "stress3": + for (int i = 0; i < N; i++) { + testStress3(0); + } + break; + case "stress4": + // DAG-shaped stress test. + for (int i = 0; i < N; i++) { + testStress4(0); + } + break; default: System.out.println("invalid mode"); } From 4a839e95de35ef1bbbfbea13683c18d964288ea5 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 10 Dec 2020 10:09:29 +0000 Subject: [PATCH 180/504] 8256459: java/net/httpclient/ManyRequests.java and java/net/httpclient/LineBodyHandlerTest.java fail infrequently with java.net.ConnectException: Connection timed out: no further information Reviewed-by: chegar --- .../jdk/internal/net/http/MultiExchange.java | 2 +- .../net/http/PlainHttpConnection.java | 82 +++++++++++++++---- .../net/httpclient/HttpServerAdapters.java | 19 ++++- .../net/httpclient/LineBodyHandlerTest.java | 74 +++++++++++------ .../jdk/java/net/httpclient/ManyRequests.java | 31 ++++++- .../java/net/httpclient/ManyRequests2.java | 4 +- 6 files changed, 164 insertions(+), 48 deletions(-) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index c1f03190380cc..afa71130ef9ab 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -471,7 +471,7 @@ private static boolean disableRetryConnect() { /** True if ALL ( even non-idempotent ) requests can be automatic retried. */ private static final boolean RETRY_ALWAYS = retryPostValue(); /** True if ConnectException should cause a retry. Enabled by default */ - private static final boolean RETRY_CONNECT = !disableRetryConnect(); + static final boolean RETRY_CONNECT = !disableRetryConnect(); /** Returns true is given request has an idempotent method. */ private static boolean isIdempotentRequest(HttpRequest request) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java b/src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java index 7a550c529d3e9..db9075961d8a0 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/PlainHttpConnection.java @@ -36,7 +36,10 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.time.Duration; +import java.time.Instant; import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + import jdk.internal.net.http.common.FlowTube; import jdk.internal.net.http.common.Log; import jdk.internal.net.http.common.MinimalFuture; @@ -56,15 +59,20 @@ class PlainHttpConnection extends HttpConnection { private volatile boolean connected; private boolean closed; private volatile ConnectTimerEvent connectTimerEvent; // may be null + private volatile int unsuccessfulAttempts; + + // Indicates whether a connection attempt has succeeded or should be retried. + // If the attempt failed, and shouldn't be retried, there will be an exception + // instead. + private enum ConnectState { SUCCESS, RETRY } - // should be volatile to provide proper synchronization(visibility) action /** * Returns a ConnectTimerEvent iff there is a connect timeout duration, * otherwise null. */ private ConnectTimerEvent newConnectTimer(Exchange exchange, - CompletableFuture cf) { + CompletableFuture cf) { Duration duration = exchange.remainingConnectTimeout().orElse(null); if (duration != null) { ConnectTimerEvent cte = new ConnectTimerEvent(duration, exchange, cf); @@ -74,12 +82,12 @@ private ConnectTimerEvent newConnectTimer(Exchange exchange, } final class ConnectTimerEvent extends TimeoutEvent { - private final CompletableFuture cf; + private final CompletableFuture cf; private final Exchange exchange; ConnectTimerEvent(Duration duration, Exchange exchange, - CompletableFuture cf) { + CompletableFuture cf) { super(duration); this.exchange = exchange; this.cf = cf; @@ -102,10 +110,10 @@ public String toString() { } final class ConnectEvent extends AsyncEvent { - private final CompletableFuture cf; + private final CompletableFuture cf; private final Exchange exchange; - ConnectEvent(CompletableFuture cf, Exchange exchange) { + ConnectEvent(CompletableFuture cf, Exchange exchange) { this.cf = cf; this.exchange = exchange; } @@ -133,8 +141,13 @@ public void handle() { finished, exchange.multi.requestCancelled(), chan.getLocalAddress()); assert finished || exchange.multi.requestCancelled() : "Expected channel to be connected"; // complete async since the event runs on the SelectorManager thread - cf.completeAsync(() -> null, client().theExecutor()); + cf.completeAsync(() -> ConnectState.SUCCESS, client().theExecutor()); } catch (Throwable e) { + if (canRetryConnect(e)) { + unsuccessfulAttempts++; + cf.completeAsync(() -> ConnectState.RETRY, client().theExecutor()); + return; + } Throwable t = Utils.toConnectException(e); client().theExecutor().execute( () -> cf.completeExceptionally(t)); close(); @@ -150,17 +163,19 @@ public void abort(IOException ioe) { @Override public CompletableFuture connectAsync(Exchange exchange) { - CompletableFuture cf = new MinimalFuture<>(); + CompletableFuture cf = new MinimalFuture<>(); try { assert !connected : "Already connected"; assert !chan.isBlocking() : "Unexpected blocking channel"; boolean finished; - connectTimerEvent = newConnectTimer(exchange, cf); - if (connectTimerEvent != null) { - if (debug.on()) - debug.log("registering connect timer: " + connectTimerEvent); - client().registerTimer(connectTimerEvent); + if (connectTimerEvent == null) { + connectTimerEvent = newConnectTimer(exchange, cf); + if (connectTimerEvent != null) { + if (debug.on()) + debug.log("registering connect timer: " + connectTimerEvent); + client().registerTimer(connectTimerEvent); + } } PrivilegedExceptionAction pa = @@ -172,7 +187,7 @@ public CompletableFuture connectAsync(Exchange exchange) { } if (finished) { if (debug.on()) debug.log("connect finished without blocking"); - cf.complete(null); + cf.complete(ConnectState.SUCCESS); } else { if (debug.on()) debug.log("registering connect event"); client().registerEvent(new ConnectEvent(cf, exchange)); @@ -187,7 +202,44 @@ public CompletableFuture connectAsync(Exchange exchange) { debug.log("Failed to close channel after unsuccessful connect"); } } - return cf; + return cf.handle((r,t) -> checkRetryConnect(r, t,exchange)) + .thenCompose(Function.identity()); + } + + /** + * On some platforms, a ConnectEvent may be raised and a ConnectionException + * may occur with the message "Connection timed out: no further information" + * before our actual connection timeout has expired. In this case, this + * method will be called with a {@code connect} state of {@code ConnectState.RETRY) + * and we will retry once again. + * @param connect indicates whether the connection was successful or should be retried + * @param failed the failure if the connection failed + * @param exchange the exchange + * @return a completable future that will take care of retrying the connection if needed. + */ + private CompletableFuture checkRetryConnect(ConnectState connect, Throwable failed, Exchange exchange) { + // first check if the connection failed + if (failed != null) return MinimalFuture.failedFuture(failed); + // then check if the connection should be retried + if (connect == ConnectState.RETRY) { + int attempts = unsuccessfulAttempts; + assert attempts <= 1; + if (debug.on()) + debug.log("Retrying connect after %d attempts", attempts); + return connectAsync(exchange); + } + // Otherwise, the connection was successful; + assert connect == ConnectState.SUCCESS; + return MinimalFuture.completedFuture(null); + } + + private boolean canRetryConnect(Throwable e) { + if (!MultiExchange.RETRY_CONNECT) return false; + if (!(e instanceof ConnectException)) return false; + if (unsuccessfulAttempts > 0) return false; + ConnectTimerEvent timer = connectTimerEvent; + if (timer == null) return true; + return timer.deadline().isAfter(Instant.now()); } @Override diff --git a/test/jdk/java/net/httpclient/HttpServerAdapters.java b/test/jdk/java/net/httpclient/HttpServerAdapters.java index 07a836b6ec259..b52d764c7da94 100644 --- a/test/jdk/java/net/httpclient/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/HttpServerAdapters.java @@ -48,6 +48,7 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutorService; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Stream; @@ -505,13 +506,23 @@ public static HttpTestServer of(HttpServer server) { return new Http1TestServer(server); } + public static HttpTestServer of(HttpServer server, ExecutorService executor) { + return new Http1TestServer(server, executor); + } + public static HttpTestServer of(Http2TestServer server) { return new Http2TestServerImpl(server); } private static class Http1TestServer extends HttpTestServer { private final HttpServer impl; + private final ExecutorService executor; Http1TestServer(HttpServer server) { + this(server, null); + } + Http1TestServer(HttpServer server, ExecutorService executor) { + if (executor != null) server.setExecutor(executor); + this.executor = executor; this.impl = server; } @Override @@ -522,7 +533,13 @@ public void start() { @Override public void stop() { System.out.println("Http1TestServer: stop"); - impl.stop(0); + try { + impl.stop(0); + } finally { + if (executor != null) { + executor.shutdownNow(); + } + } } @Override public HttpTestContext addHandler(HttpTestHandler handler, String path) { diff --git a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java index 039bc9c8cd87c..7b29941d692a4 100644 --- a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java +++ b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,6 +32,7 @@ import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; +import java.net.http.HttpClient.Builder; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; @@ -43,7 +44,11 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.Flow; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -71,6 +76,7 @@ * @summary Basic tests for line adapter subscribers as created by * the BodyHandlers returned by BodyHandler::fromLineSubscriber * and BodyHandler::asLines + * @bug 8256459 * @modules java.base/sun.net.www.http * java.net.http/jdk.internal.net.http.common * java.net.http/jdk.internal.net.http.frame @@ -182,11 +188,17 @@ private static final List lines(String text, String eol) { } } + HttpClient newClient() { + return HttpClient.newBuilder() + .sslContext(sslContext) + .proxy(Builder.NO_PROXY) + .build(); + } + @Test(dataProvider = "uris") void testStringWithFinisher(String url) { String body = "May the luck of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -207,8 +219,7 @@ void testStringWithFinisher(String url) { @Test(dataProvider = "uris") void testAsStream(String url) { String body = "May the luck of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -230,7 +241,8 @@ void testAsStream(String url) { @Test(dataProvider = "uris") void testStringWithFinisher2(String url) { String body = "May the luck\r\n\r\n of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); + HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -251,7 +263,7 @@ void testStringWithFinisher2(String url) { @Test(dataProvider = "uris") void testAsStreamWithCRLF(String url) { String body = "May the luck\r\n\r\n of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -275,7 +287,7 @@ void testAsStreamWithCRLF(String url) { @Test(dataProvider = "uris") void testStringWithFinisherBlocking(String url) throws Exception { String body = "May the luck of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)).build(); @@ -292,7 +304,7 @@ void testStringWithFinisherBlocking(String url) throws Exception { @Test(dataProvider = "uris") void testStringWithoutFinisherBlocking(String url) throws Exception { String body = "May the luck of the Irish be with you!"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)).build(); @@ -311,7 +323,7 @@ void testStringWithoutFinisherBlocking(String url) throws Exception { @Test(dataProvider = "uris") void testAsStreamWithMixedCRLF(String url) { String body = "May\r\n the wind\r\n always be\rat your back.\r\r"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -338,7 +350,7 @@ void testAsStreamWithMixedCRLF(String url) { @Test(dataProvider = "uris") void testAsStreamWithMixedCRLF_UTF8(String url) { String body = "May\r\n the wind\r\n always be\rat your back.\r\r"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .header("Content-type", "text/text; charset=UTF-8") .POST(BodyPublishers.ofString(body, UTF_8)).build(); @@ -364,7 +376,7 @@ void testAsStreamWithMixedCRLF_UTF8(String url) { @Test(dataProvider = "uris") void testAsStreamWithMixedCRLF_UTF16(String url) { String body = "May\r\n the wind\r\n always be\rat your back.\r\r"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .header("Content-type", "text/text; charset=UTF-16") .POST(BodyPublishers.ofString(body, UTF_16)).build(); @@ -391,7 +403,7 @@ void testAsStreamWithMixedCRLF_UTF16(String url) { @Test(dataProvider = "uris") void testObjectWithFinisher(String url) { String body = "May\r\n the wind\r\n always be\rat your back."; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -416,7 +428,7 @@ void testObjectWithFinisher(String url) { @Test(dataProvider = "uris") void testObjectWithFinisher_UTF16(String url) { String body = "May\r\n the wind\r\n always be\rat your back.\r\r"; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .header("Content-type", "text/text; charset=UTF-16") .POST(BodyPublishers.ofString(body, UTF_16)).build(); @@ -442,8 +454,7 @@ void testObjectWithFinisher_UTF16(String url) { @Test(dataProvider = "uris") void testObjectWithoutFinisher(String url) { String body = "May\r\n the wind\r\n always be\rat your back."; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -469,8 +480,7 @@ void testObjectWithoutFinisher(String url) { @Test(dataProvider = "uris") void testObjectWithFinisherBlocking(String url) throws Exception { String body = "May\r\n the wind\r\n always be\nat your back."; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -494,8 +504,7 @@ void testObjectWithFinisherBlocking(String url) throws Exception { @Test(dataProvider = "uris") void testObjectWithoutFinisherBlocking(String url) throws Exception { String body = "May\r\n the wind\r\n always be\nat your back."; - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(body)) .build(); @@ -529,8 +538,7 @@ static private final String bigtext() { @Test(dataProvider = "uris") void testBigTextFromLineSubscriber(String url) { - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); String bigtext = bigtext(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(bigtext)) @@ -551,8 +559,7 @@ void testBigTextFromLineSubscriber(String url) { @Test(dataProvider = "uris") void testBigTextAsStream(String url) { - HttpClient client = HttpClient.newBuilder().sslContext(sslContext) - .build(); + HttpClient client = newClient(); String bigtext = bigtext(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .POST(BodyPublishers.ofString(bigtext)) @@ -640,6 +647,19 @@ static void uncheckedWrite(ByteArrayOutputStream baos, byte[] ba) { } } + private static ExecutorService executorFor(String serverThreadName) { + ThreadFactory factory = new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(); + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r); + thread.setName(serverThreadName + "#" + counter.incrementAndGet()); + return thread; + } + }; + return Executors.newCachedThreadPool(factory); + } + @BeforeTest public void setup() throws Exception { sslContext = new SimpleSSLContext().get(); @@ -647,13 +667,15 @@ public void setup() throws Exception { throw new AssertionError("Unexpected null sslContext"); InetSocketAddress sa = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - httpTestServer = HttpTestServer.of(HttpServer.create(sa, 0)); + httpTestServer = HttpTestServer.of(HttpServer.create(sa, 0), + executorFor("HTTP/1.1 Server Thread")); httpTestServer.addHandler(new HttpTestEchoHandler(), "/http1/echo"); httpURI = "http://" + httpTestServer.serverAuthority() + "/http1/echo"; HttpsServer httpsServer = HttpsServer.create(sa, 0); httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext)); - httpsTestServer = HttpTestServer.of(httpsServer); + httpsTestServer = HttpTestServer.of(httpsServer, + executorFor("HTTPS/1.1 Server Thread")); httpsTestServer.addHandler(new HttpTestEchoHandler(),"/https1/echo"); httpsURI = "https://" + httpsTestServer.serverAuthority() + "/https1/echo"; diff --git a/test/jdk/java/net/httpclient/ManyRequests.java b/test/jdk/java/net/httpclient/ManyRequests.java index 97435d768c6f0..f79d565162ad8 100644 --- a/test/jdk/java/net/httpclient/ManyRequests.java +++ b/test/jdk/java/net/httpclient/ManyRequests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,7 +23,7 @@ /* * @test - * @bug 8087112 8180044 + * @bug 8087112 8180044 8256459 * @modules java.net.http * java.logging * jdk.httpserver @@ -51,14 +51,20 @@ import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; +import java.net.http.HttpClient.Builder; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse.BodyHandlers; +import java.time.Duration; import java.util.Arrays; import java.util.Formatter; import java.util.HashMap; import java.util.LinkedList; import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; import java.util.logging.Level; import java.util.concurrent.CompletableFuture; @@ -81,16 +87,21 @@ public static void main(String[] args) throws Exception { InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); HttpsServer server = HttpsServer.create(addr, 0); + ExecutorService executor = executorFor("HTTPS/1.1 Server Thread"); server.setHttpsConfigurator(new Configurator(ctx)); + server.setExecutor(executor); HttpClient client = HttpClient.newBuilder() + .proxy(Builder.NO_PROXY) .sslContext(ctx) + .connectTimeout(Duration.ofMillis(120_000)) // 2mins .build(); try { test(server, client); System.out.println("OK"); } finally { server.stop(0); + executor.shutdownNow(); } } @@ -102,7 +113,7 @@ public static void main(String[] args) throws Exception { static final boolean XFIXED = Boolean.getBoolean("test.XFixed"); static class TestEchoHandler extends EchoHandler { - final Random rand = new Random(); + final Random rand = jdk.test.lib.RandomFactory.getRandom(); @Override public void handle(HttpExchange e) throws IOException { System.out.println("Server: received " + e.getRequestURI()); @@ -279,4 +290,18 @@ public void configure(HttpsParameters params) { params.setSSLParameters(getSSLContext().getSupportedSSLParameters()); } } + + private static ExecutorService executorFor(String serverThreadName) { + ThreadFactory factory = new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(); + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r); + thread.setName(serverThreadName + "#" + counter.incrementAndGet()); + return thread; + } + }; + return Executors.newCachedThreadPool(factory); + } + } diff --git a/test/jdk/java/net/httpclient/ManyRequests2.java b/test/jdk/java/net/httpclient/ManyRequests2.java index f600b00c34880..b0eee6e3be413 100644 --- a/test/jdk/java/net/httpclient/ManyRequests2.java +++ b/test/jdk/java/net/httpclient/ManyRequests2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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,7 +23,7 @@ /* * @test - * @bug 8087112 8180044 + * @bug 8087112 8180044 8256459 * @modules java.net.http * java.logging * jdk.httpserver From db5da9619b976fc6dbdb1c6554c48e1ba3db5597 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Thu, 10 Dec 2020 10:34:47 +0000 Subject: [PATCH 181/504] 8257876: Avoid Reference.isEnqueued in tests Reviewed-by: mchung, tschatzl --- .../gc/gctests/ReferencesGC/ReferencesGC.java | 114 ++++++++---------- .../WeakReferenceGC/WeakReferenceGC.java | 7 +- test/jdk/java/lang/ref/ReferenceEnqueue.java | 25 ++-- 3 files changed, 65 insertions(+), 81 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java b/test/hotspot/jtreg/vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java index dee73fb54f156..9857b037ee366 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java @@ -53,6 +53,8 @@ public class ReferencesGC extends ThreadedGCTest { static int RANGE = 256; static float RATIO = (float) 1.0; + static int REMOVE; // Initialized in parseArgs. + static int RETAIN; // Initialized in parseArgs. public static void main(String[] args) { parseArgs(args); @@ -67,6 +69,8 @@ public static void parseArgs(String[] args) { RATIO = new Float(args[++i]).floatValue(); } } + REMOVE = (int) (RANGE * RATIO); + RETAIN = RANGE - REMOVE; } private class Worker implements Runnable { @@ -76,13 +80,13 @@ private class Worker implements Runnable { static final int PHANTOM = 2; private ExecutionController stresser; int finalizationMaxTime = 1000 * 60 * runParams.getNumberOfThreads(); - int[] alive = new int[3]; - int[] enqued = new int[3]; + ReferenceQueue refq = null; // Reinitialized each time through loop + int[] alive = null; // Reinitialized each time through loop + int[] wrong = null; // Reinitialized each time through loop CircularLinkedList holder[] = new CircularLinkedList[RANGE]; WeakReference wr[] = new WeakReference[RANGE]; SoftReference sr[] = new SoftReference[RANGE]; PhantomReference phr[] = new PhantomReference[RANGE]; - ReferenceQueue refq = new ReferenceQueue(); GarbageProducer gp = GarbageUtils.getArrayProducers().get(0); int iter = 0; @@ -93,11 +97,11 @@ public void run() { } while (stresser.continueExecution()) { - int totalQ = 0; + int totalLive = 0; try { refq = new ReferenceQueue(); alive = new int[3]; - enqued = new int[3]; + wrong = new int[3]; for (int j = 0; j < RANGE; j++) { holder[j] = new CircularLinkedList(); holder[j].addNelements(300); @@ -112,21 +116,21 @@ public void run() { } for (int i = 0; i < RANGE; i++) { - if (wr[i].isEnqueued()) { - ++totalQ; + if (wr[i].refersTo(holder[i])) { + ++totalLive; } - if (sr[i].isEnqueued()) { - ++totalQ; + if (sr[i].refersTo(holder[i])) { + ++totalLive; } - if (phr[i].isEnqueued()) { - ++totalQ; + if (phr[i].refersTo(holder[i])) { + ++totalLive; } } - if (totalQ != 0) { - throw new TestFailure("There are " + totalQ + " references in the queue instead 0 before null-assigment."); + if (totalLive != 3 * RANGE) { + throw new TestFailure("There are " + (3 * RANGE - totalLive) + " references cleared before null-assigment."); } - for (int i = 0; i < (int) (RANGE * RATIO); i++) { + for (int i = 0; i < REMOVE; i++) { holder[i] = null; } @@ -137,69 +141,57 @@ public void run() { // At this point OOME was thrown and accordingly to spec // all weak refs should be processed - alive = new int[3]; - enqued = new int[3]; - for (int i = 0; i < RANGE; i++) { - if (wr[i].get() != null) { - ++alive[WEAK]; - } - if (wr[i].isEnqueued()) { - ++enqued[WEAK]; - } - if (sr[i].get() != null) { - ++alive[SOFT]; - } - if (sr[i].isEnqueued()) { - ++enqued[SOFT]; - } - if (phr[i].isEnqueued()) { - ++enqued[PHANTOM]; - } - } - long waitTime = System.currentTimeMillis() + finalizationMaxTime; - while (totalQ < (RANGE * RATIO * 3 * 0.9) && (System.currentTimeMillis() < waitTime)) { - alive = new int[3]; - enqued = new int[3]; + int totalQ = 0; + while ((totalQ < (3 * REMOVE)) && (System.currentTimeMillis() < waitTime)) { + alive[WEAK] = alive[SOFT] = alive[PHANTOM] = 0; + wrong[WEAK] = wrong[SOFT] = wrong[PHANTOM] = 0; for (int i = 0; i < RANGE; i++) { - if (wr[i].get() != null) { + if (!wr[i].refersTo(holder[i])) { + ++wrong[WEAK]; + } else if (holder[i] != null) { ++alive[WEAK]; } - if (wr[i].isEnqueued()) { - ++enqued[WEAK]; - } - if (sr[i].get() != null) { + + if (!sr[i].refersTo(holder[i])) { + ++wrong[SOFT]; + } else if (holder[i] != null) { ++alive[SOFT]; } - if (sr[i].isEnqueued()) { - ++enqued[SOFT]; + + if (!phr[i].refersTo(holder[i])) { + ++wrong[PHANTOM]; + } else if (holder[i] != null) { + ++alive[PHANTOM]; } - if (phr[i].isEnqueued()) { - ++enqued[PHANTOM]; + } + + try { + while (refq.remove(100) != null) { + ++totalQ; } + } catch (InterruptedException ie) { } - totalQ = (enqued[WEAK] + enqued[SOFT] + enqued[PHANTOM]); - if (totalQ < (int) (3 * RANGE * RATIO * 0.9)) { - log.debug("After null-assignment to " + (int) (RANGE * RATIO) + - //" elements from " + lower + " to " + (upper - 1) + - " and provoking gc found:\n\t" + - enqued[WEAK] + " weak\n\t" + - enqued[SOFT] + " soft\n\t" + - enqued[PHANTOM] + " phantom " + - " queuened refs and \n\t" + - alive[WEAK] + " weak\n\t" + - alive[SOFT] + " soft\n\t" + - "alive refs."); + if (totalQ < (3 * REMOVE)) { + log.debug("After null-assignment to " + REMOVE + + " referent values and provoking gc found:\n\t" + + totalQ + " queued refs."); try { - log.debug("sleeping to give gc one more chance ......"); + log.debug("sleeping to give reference processing more time ..."); Thread.sleep(1000); } catch (InterruptedException ie) { } } } log.debug("iteration.... " + iter++); - if (totalQ < (int) (3 * RANGE * RATIO * 0.9) || totalQ > (int) (3 * RANGE * RATIO)) { - throw new TestFailure("Test failed"); + if (wrong[WEAK] != 0) { + throw new TestFailure("Expected " + RETAIN + " weak references still alive: " + alive[WEAK]); + } else if (wrong[SOFT] != 0) { + throw new TestFailure("Expected " + RETAIN + " soft references still alive: " + alive[SOFT]); + } else if (wrong[PHANTOM] != 0) { + throw new TestFailure("Expected " + RETAIN + " phantom references still alive: " + alive[PHANTOM]); + } else if (totalQ != (3 * REMOVE)) { + throw new TestFailure("Expected " + (3 * REMOVE) + " references enqueued: " + totalQ); } } } diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java b/test/hotspot/jtreg/vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java index 0beb24a4064ab..f351a8d40eae1 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/WeakReferenceGC/WeakReferenceGC.java @@ -201,11 +201,12 @@ private void persistentGC() { if (GarbageUtils.eatMemory(getExecutionController()) == 0) { return; // We were unable to provoke OOME before timeout is over } - numEnqueued = 0; // We set counter to zero to avoid counting references twice - for (int i = 0; i < numLists; i++) { - if (wholder[i].isEnqueued()) { + try { + while ((numEnqueued < numLists) && + (refQueue.remove(1000) != null)) { numEnqueued++; } + } catch (InterruptedException ie) { } } results.addElement((new Statistic(iter, numEnqueued))); diff --git a/test/jdk/java/lang/ref/ReferenceEnqueue.java b/test/jdk/java/lang/ref/ReferenceEnqueue.java index c405c5c8a05b2..90ed9d0c09331 100644 --- a/test/jdk/java/lang/ref/ReferenceEnqueue.java +++ b/test/jdk/java/lang/ref/ReferenceEnqueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020, 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,20 +51,17 @@ static class WeakRef { } void run() throws InterruptedException { + boolean enqueued = false; System.gc(); for (int i = 0; i < iterations; i++) { System.gc(); - if (ref.isEnqueued()) { - break; - } - - Thread.sleep(100); + enqueued = (queue.remove(100) == ref); + if (enqueued) break; } - if (ref.isEnqueued() == false) { + if (!enqueued) { // GC have not enqueued refWeak for the timeout period - System.out.println("Reference not enqueued yet"); - return; + throw new RuntimeException("Error: reference not enqueued"); } if (ref.enqueue() == true) { @@ -73,12 +70,6 @@ void run() throws InterruptedException { throw new RuntimeException("Error: enqueue() returned true;" + " expected false"); } - - if (queue.poll() == null) { - // poll() should return ref enqueued by the GC - throw new RuntimeException("Error: poll() returned null;" - + " expected ref object"); - } } } @@ -90,7 +81,7 @@ static class ExplicitEnqueue { ExplicitEnqueue() { this.refs.add(new SoftReference<>(new Object(), queue)); this.refs.add(new WeakReference<>(new Object(), queue)); - // Can't test PhantomReference because get() always returns null. + this.refs.add(new PhantomReference<>(new Object(), queue)); } void run() throws InterruptedException { @@ -98,7 +89,7 @@ void run() throws InterruptedException { if (ref.enqueue() == false) { throw new RuntimeException("Error: enqueue failed"); } - if (ref.get() != null) { + if (!ref.refersTo(null)) { throw new RuntimeException("Error: referent must be cleared"); } } From 29ffffa7b938a57ab306c4e32a38d5c6cd7dfbc9 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Thu, 10 Dec 2020 10:56:36 +0000 Subject: [PATCH 182/504] 8257997: sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java again reports leaks after JDK-8257884 Reviewed-by: mbaesken --- test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java index 3a4a9c7be9bdc..d43d4d3bacc12 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketLeak.java @@ -31,20 +31,19 @@ /* * @test - * @bug 8256818 8257670 8257884 + * @bug 8256818 8257670 8257884 8257997 * @summary Test that creating and closing SSL Sockets without bind/connect * will not leave leaking socket file descriptors * @library /test/lib * @run main/othervm SSLSocketLeak */ -// Note: this test is not reliable, run it manually. public class SSLSocketLeak { // number of sockets to open/close private static final int NUM_TEST_SOCK = 500; // percentage of accepted growth of open handles - private static final int OPEN_HANDLE_GROWTH_THRESHOLD = Platform.isWindows() ? 25 : 10; + private static final int OPEN_HANDLE_GROWTH_THRESHOLD_PERCENTAGE = Platform.isWindows() ? 25 : 10; public static void main(String[] args) throws IOException { long fds_start = FileUtils.getProcessHandleCount(); @@ -58,7 +57,7 @@ public static void main(String[] args) throws IOException { long fds_end = FileUtils.getProcessHandleCount(); System.out.println("FDs in the end: " + fds_end); - if ((fds_end - fds_start) > (NUM_TEST_SOCK / OPEN_HANDLE_GROWTH_THRESHOLD)) { + if ((fds_end - fds_start) > ((NUM_TEST_SOCK * OPEN_HANDLE_GROWTH_THRESHOLD_PERCENTAGE)) / 100) { throw new RuntimeException("Too many open file descriptors. Looks leaky."); } } From 0a0691ebcf5bde8308389f453a0a4f2bbd99eec9 Mon Sep 17 00:00:00 2001 From: Per Liden Date: Thu, 10 Dec 2020 11:10:38 +0000 Subject: [PATCH 183/504] 8257901: ZGC: Take virtual memory usage into account when sizing heap Reviewed-by: stefank, eosterlund, ayang, tschatzl --- src/hotspot/share/gc/shared/gcArguments.cpp | 4 ++++ src/hotspot/share/gc/shared/gcArguments.hpp | 7 ++++++- src/hotspot/share/gc/z/zAddressSpaceLimit.cpp | 5 +++-- src/hotspot/share/gc/z/zArguments.cpp | 5 +++++ src/hotspot/share/gc/z/zArguments.hpp | 3 ++- src/hotspot/share/runtime/arguments.cpp | 21 ++++++++++++------- src/hotspot/share/runtime/arguments.hpp | 7 ++++--- 7 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/hotspot/share/gc/shared/gcArguments.cpp b/src/hotspot/share/gc/shared/gcArguments.cpp index 17da38e0e3cad..b5ebc66a5da32 100644 --- a/src/hotspot/share/gc/shared/gcArguments.cpp +++ b/src/hotspot/share/gc/shared/gcArguments.cpp @@ -172,3 +172,7 @@ void GCArguments::initialize_heap_flags_and_sizes() { DEBUG_ONLY(assert_flags();) } + +size_t GCArguments::heap_virtual_to_physical_ratio() { + return 1; +} diff --git a/src/hotspot/share/gc/shared/gcArguments.hpp b/src/hotspot/share/gc/shared/gcArguments.hpp index 0de6140dd3686..40b612d75a6b8 100644 --- a/src/hotspot/share/gc/shared/gcArguments.hpp +++ b/src/hotspot/share/gc/shared/gcArguments.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -46,6 +46,11 @@ class GCArguments { public: virtual void initialize(); virtual size_t conservative_max_heap_alignment() = 0; + + // Used by heap size heuristics to determine max + // amount of address space to use for the heap. + virtual size_t heap_virtual_to_physical_ratio(); + virtual CollectedHeap* create_heap() = 0; // Allows GCs to tell external code if it's supported or not in the current setup. diff --git a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp index 20c1041171123..c0bbd11abf54d 100644 --- a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp +++ b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ #include "precompiled.hpp" #include "gc/z/zAddressSpaceLimit.hpp" #include "gc/z/zGlobals.hpp" +#include "runtime/globals.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" @@ -46,6 +47,6 @@ size_t ZAddressSpaceLimit::mark_stack() { size_t ZAddressSpaceLimit::heap_view() { // Allow all heap views to occupy 50% of the address space - const size_t limit = address_space_limit() / 2 / ZHeapViews; + const size_t limit = address_space_limit() / MaxVirtMemFraction / ZHeapViews; return align_up(limit, ZGranuleSize); } diff --git a/src/hotspot/share/gc/z/zArguments.cpp b/src/hotspot/share/gc/z/zArguments.cpp index 46f0a0e250dc4..f0bbe11a74851 100644 --- a/src/hotspot/share/gc/z/zArguments.cpp +++ b/src/hotspot/share/gc/z/zArguments.cpp @@ -25,6 +25,7 @@ #include "gc/z/zAddressSpaceLimit.hpp" #include "gc/z/zArguments.hpp" #include "gc/z/zCollectedHeap.hpp" +#include "gc/z/zGlobals.hpp" #include "gc/z/zHeuristics.hpp" #include "gc/shared/gcArguments.hpp" #include "runtime/globals.hpp" @@ -94,6 +95,10 @@ void ZArguments::initialize() { } } +size_t ZArguments::heap_virtual_to_physical_ratio() { + return ZHeapViews * ZVirtualToPhysicalRatio; +} + size_t ZArguments::conservative_max_heap_alignment() { return 0; } diff --git a/src/hotspot/share/gc/z/zArguments.hpp b/src/hotspot/share/gc/z/zArguments.hpp index 2508b40bd3401..cc177e25d90a4 100644 --- a/src/hotspot/share/gc/z/zArguments.hpp +++ b/src/hotspot/share/gc/z/zArguments.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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,6 +34,7 @@ class ZArguments : public GCArguments { virtual void initialize(); virtual size_t conservative_max_heap_alignment(); + virtual size_t heap_virtual_to_physical_ratio(); virtual CollectedHeap* create_heap(); virtual bool is_supported() const; diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 732923b51ac53..e467da554b81b 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1655,11 +1655,18 @@ jint Arguments::set_ergonomics_flags() { return JNI_OK; } -julong Arguments::limit_by_allocatable_memory(julong limit) { +julong Arguments::limit_heap_by_allocatable_memory(julong limit) { julong max_allocatable; julong result = limit; if (os::has_allocatable_memory_limit(&max_allocatable)) { - result = MIN2(result, max_allocatable / MaxVirtMemFraction); + // The AggressiveHeap check is a temporary workaround to avoid calling + // GCarguments::heap_virtual_to_physical_ratio() before a GC has been + // selected. This works because AggressiveHeap implies UseParallelGC + // where we know the ratio will be 1. Once the AggressiveHeap option is + // removed, this can be cleaned up. + julong heap_virtual_to_physical_ratio = (AggressiveHeap ? 1 : GCConfig::arguments()->heap_virtual_to_physical_ratio()); + julong fraction = MaxVirtMemFraction * heap_virtual_to_physical_ratio; + result = MIN2(result, max_allocatable / fraction); } return result; } @@ -1775,12 +1782,12 @@ void Arguments::set_heap_size() { } #endif // _LP64 - reasonable_max = limit_by_allocatable_memory(reasonable_max); + reasonable_max = limit_heap_by_allocatable_memory(reasonable_max); if (!FLAG_IS_DEFAULT(InitialHeapSize)) { // An initial heap size was specified on the command line, // so be sure that the maximum size is consistent. Done - // after call to limit_by_allocatable_memory because that + // after call to limit_heap_by_allocatable_memory because that // method might reduce the allocation size. reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); } else if (!FLAG_IS_DEFAULT(MinHeapSize)) { @@ -1798,11 +1805,11 @@ void Arguments::set_heap_size() { reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize); - reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum); + reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum); if (InitialHeapSize == 0) { julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100); - reasonable_initial = limit_by_allocatable_memory(reasonable_initial); + reasonable_initial = limit_heap_by_allocatable_memory(reasonable_initial); reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)MinHeapSize); reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); @@ -1846,7 +1853,7 @@ jint Arguments::set_aggressive_heap_flags() { initHeapSize = MIN2(total_memory / (julong) 2, total_memory - (julong) 160 * M); - initHeapSize = limit_by_allocatable_memory(initHeapSize); + initHeapSize = limit_heap_by_allocatable_memory(initHeapSize); if (FLAG_IS_DEFAULT(MaxHeapSize)) { if (FLAG_SET_CMDLINE(MaxHeapSize, initHeapSize) != JVMFlag::SUCCESS) { diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index c0b874ac18c65..e81b1dad765ad 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -363,9 +363,10 @@ class Arguments : AllStatic { static void set_use_compressed_klass_ptrs(); static jint set_ergonomics_flags(); static jint set_shared_spaces_flags_and_archive_paths(); - // limits the given memory size by the maximum amount of memory this process is - // currently allowed to allocate or reserve. - static julong limit_by_allocatable_memory(julong size); + // Limits the given heap size by the maximum amount of virtual + // memory this process is currently allowed to use. It also takes + // the virtual-to-physical ratio of the current GC into account. + static julong limit_heap_by_allocatable_memory(julong size); // Setup heap size static void set_heap_size(); From 026b09cf6488494778db94ffe37252d1164164ba Mon Sep 17 00:00:00 2001 From: Dong Bo Date: Thu, 10 Dec 2020 12:26:04 +0000 Subject: [PATCH 184/504] 8257483: C2: Split immediate vector rotate from RotateLeftV and RotateRightV nodes Reviewed-by: vlivanov --- src/hotspot/cpu/aarch64/aarch64.ad | 4 ++++ src/hotspot/cpu/arm/arm.ad | 4 ++++ src/hotspot/cpu/ppc/ppc.ad | 4 ++++ src/hotspot/cpu/s390/s390.ad | 4 ++++ src/hotspot/cpu/x86/x86.ad | 4 ++++ src/hotspot/share/opto/matcher.hpp | 3 +++ src/hotspot/share/opto/vectornode.cpp | 6 ++++-- 7 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index fcd0ce096f90a..2d5ddfe86f15f 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -2437,6 +2437,10 @@ bool Matcher::supports_vector_variable_shifts(void) { return true; } +bool Matcher::supports_vector_variable_rotates(void) { + return false; // not supported +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index 9fd708e0339c3..ec74cf95439ff 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -997,6 +997,10 @@ bool Matcher::supports_vector_variable_shifts(void) { return VM_Version::has_simd(); } +bool Matcher::supports_vector_variable_rotates(void) { + return false; // not supported +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index ed51f054128a3..c3ed2d4357c7e 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -2155,6 +2155,10 @@ bool Matcher::supports_vector_variable_shifts(void) { return false; // not supported } +bool Matcher::supports_vector_variable_rotates(void) { + return false; // not supported +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index b05432d6dc036..afb05d870b4c9 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -1550,6 +1550,10 @@ bool Matcher::supports_vector_variable_shifts(void) { return false; // not supported } +bool Matcher::supports_vector_variable_rotates(void) { + return false; // not supported +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index 5396d4a27f25c..bf4596f9fc47d 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1814,6 +1814,10 @@ bool Matcher::supports_vector_variable_shifts(void) { return (UseAVX >= 2); } +bool Matcher::supports_vector_variable_rotates(void) { + return true; +} + const bool Matcher::has_predicated_vectors(void) { bool ret_value = false; if (UseAVX > 2) { diff --git a/src/hotspot/share/opto/matcher.hpp b/src/hotspot/share/opto/matcher.hpp index 6616a9e972b82..31c9fa5eaf41f 100644 --- a/src/hotspot/share/opto/matcher.hpp +++ b/src/hotspot/share/opto/matcher.hpp @@ -348,6 +348,9 @@ class Matcher : public PhaseTransform { // Does the CPU supports vector variable shift instructions? static bool supports_vector_variable_shifts(void); + // Does the CPU supports vector vairable rotate instructions? + static bool supports_vector_variable_rotates(void); + // CPU supports misaligned vectors store/load. static const bool misaligned_vectors_ok(); diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index 42f7a8b929051..cca896859126c 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -1172,7 +1172,8 @@ Node* VectorNode::degenerate_vector_rotate(Node* src, Node* cnt, bool is_rotate_ Node* RotateLeftVNode::Ideal(PhaseGVN* phase, bool can_reshape) { int vlen = length(); BasicType bt = vect_type()->element_basic_type(); - if (!Matcher::match_rule_supported_vector(Op_RotateLeftV, vlen, bt)) { + if ((!in(2)->is_Con() && !Matcher::supports_vector_variable_rotates()) || + !Matcher::match_rule_supported_vector(Op_RotateLeftV, vlen, bt)) { return VectorNode::degenerate_vector_rotate(in(1), in(2), true, vlen, bt, phase); } return NULL; @@ -1181,7 +1182,8 @@ Node* RotateLeftVNode::Ideal(PhaseGVN* phase, bool can_reshape) { Node* RotateRightVNode::Ideal(PhaseGVN* phase, bool can_reshape) { int vlen = length(); BasicType bt = vect_type()->element_basic_type(); - if (!Matcher::match_rule_supported_vector(Op_RotateRightV, vlen, bt)) { + if ((!in(2)->is_Con() && !Matcher::supports_vector_variable_rotates()) || + !Matcher::match_rule_supported_vector(Op_RotateRightV, vlen, bt)) { return VectorNode::degenerate_vector_rotate(in(1), in(2), false, vlen, bt, phase); } return NULL; From 502a5241e5128c19ecff33137a041ac1ef3ef6d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Thu, 10 Dec 2020 12:33:48 +0000 Subject: [PATCH 185/504] 8257602: Introduce JFR Event Throttling and new jdk.ObjectAllocationSample event (enabled by default) Co-authored-by: Jaroslav Bachorik Reviewed-by: egahlin, jbachorik --- .../build/tools/jfr/GenerateJfrFiles.java | 5 + src/hotspot/share/gc/shared/allocTracer.cpp | 82 +++- src/hotspot/share/jfr/jni/jfrJniMethod.cpp | 6 + src/hotspot/share/jfr/jni/jfrJniMethod.hpp | 2 + .../jfr/jni/jfrJniMethodRegistration.cpp | 1 + .../leakprofiler/sampling/objectSampler.cpp | 2 +- src/hotspot/share/jfr/metadata/metadata.xml | 6 + src/hotspot/share/jfr/metadata/metadata.xsd | 1 + .../share/jfr/recorder/jfrRecorder.cpp | 9 + .../share/jfr/recorder/jfrRecorder.hpp | 1 + .../share/jfr/recorder/service/jfrEvent.hpp | 61 ++- .../recorder/service/jfrEventThrottler.cpp | 276 +++++++++++++ .../recorder/service/jfrEventThrottler.hpp | 57 +++ .../share/jfr/support/jfrAdaptiveSampler.cpp | 385 ++++++++++++++++++ .../share/jfr/support/jfrAdaptiveSampler.hpp | 155 +++++++ .../share/jfr/utilities/jfrLogTagSets.hpp | 1 + src/hotspot/share/jfr/utilities/jfrRandom.hpp | 41 ++ .../share/jfr/utilities/jfrRandom.inline.hpp | 60 +++ .../share/jfr/utilities/jfrTryLock.hpp | 10 +- src/hotspot/share/logging/logTag.hpp | 1 + src/hotspot/share/runtime/objectMonitor.cpp | 2 +- .../jdk/jfr/internal/EventControl.java | 17 +- .../share/classes/jdk/jfr/internal/JVM.java | 12 + .../classes/jdk/jfr/internal/LogTag.java | 12 +- .../jdk/jfr/internal/MetadataLoader.java | 5 + .../jdk/jfr/internal/MetadataRepository.java | 1 + .../jdk/jfr/internal/PlatformEventType.java | 15 + .../classes/jdk/jfr/internal/Throttle.java | 76 ++++ .../share/classes/jdk/jfr/internal/Utils.java | 92 ++++- .../internal/settings/ThrottleSetting.java | 108 +++++ src/jdk.jfr/share/conf/jfr/default.jfc | 44 +- src/jdk.jfr/share/conf/jfr/profile.jfc | 43 +- .../gtest/jfr/test_adaptiveSampler.cpp | 281 +++++++++++++ test/jdk/TEST.groups | 2 +- .../TestObjectAllocationInNewTLABEvent.java} | 85 ++-- ...TestObjectAllocationOutsideTLABEvent.java} | 63 +-- .../TestObjectAllocationSampleEvent.java | 80 ++++ ...ObjectAllocationSampleEventThrottling.java | 120 ++++++ test/lib/jdk/test/lib/jfr/EventNames.java | 1 + 39 files changed, 2096 insertions(+), 125 deletions(-) create mode 100644 src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp create mode 100644 src/hotspot/share/jfr/recorder/service/jfrEventThrottler.hpp create mode 100644 src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp create mode 100644 src/hotspot/share/jfr/support/jfrAdaptiveSampler.hpp create mode 100644 src/hotspot/share/jfr/utilities/jfrRandom.hpp create mode 100644 src/hotspot/share/jfr/utilities/jfrRandom.inline.hpp create mode 100644 src/jdk.jfr/share/classes/jdk/jfr/internal/Throttle.java create mode 100644 src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottleSetting.java create mode 100644 test/hotspot/gtest/jfr/test_adaptiveSampler.cpp rename test/jdk/jdk/jfr/event/{compiler/TestAllocInNewTLAB.java => allocation/TestObjectAllocationInNewTLABEvent.java} (65%) rename test/jdk/jdk/jfr/event/{compiler/TestAllocOutsideTLAB.java => allocation/TestObjectAllocationOutsideTLABEvent.java} (66%) create mode 100644 test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java create mode 100644 test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java diff --git a/make/src/classes/build/tools/jfr/GenerateJfrFiles.java b/make/src/classes/build/tools/jfr/GenerateJfrFiles.java index cf6a08cdc49da..dbaa8db7f653d 100644 --- a/make/src/classes/build/tools/jfr/GenerateJfrFiles.java +++ b/make/src/classes/build/tools/jfr/GenerateJfrFiles.java @@ -172,6 +172,7 @@ static class TypeElement { boolean startTime; String period = ""; boolean cutoff; + boolean throttle; boolean experimental; long id; boolean isEvent; @@ -194,6 +195,7 @@ public void persist(DataOutputStream pos) throws IOException { pos.writeBoolean(startTime); pos.writeUTF(period); pos.writeBoolean(cutoff); + pos.writeBoolean(throttle); pos.writeBoolean(experimental); pos.writeLong(id); pos.writeBoolean(isEvent); @@ -490,6 +492,7 @@ public void startElement(String uri, String localName, String qName, Attributes currentType.startTime = getBoolean(attributes, "startTime", true); currentType.period = getString(attributes, "period"); currentType.cutoff = getBoolean(attributes, "cutoff", false); + currentType.throttle = getBoolean(attributes, "throttle", false); currentType.commitState = getString(attributes, "commitState"); currentType.isEvent = "Event".equals(qName); currentType.isRelation = "Relation".equals(qName); @@ -759,6 +762,7 @@ private static void printJfrEventClassesHpp(Metadata metadata, File outputFile) out.write(" void set_starttime(const Ticks&) const {}"); out.write(" void set_endtime(const Ticks&) const {}"); out.write(" bool should_commit() const { return false; }"); + out.write(" bool is_started() const { return false; }"); out.write(" static bool is_enabled() { return false; }"); out.write(" void commit() {}"); out.write("};"); @@ -820,6 +824,7 @@ private static void printEvent(Printer out, TypeElement event, boolean empty) { out.write(" static const bool hasStackTrace = " + event.stackTrace + ";"); out.write(" static const bool isInstant = " + !event.startTime + ";"); out.write(" static const bool hasCutoff = " + event.cutoff + ";"); + out.write(" static const bool hasThrottle = " + event.throttle + ";"); out.write(" static const bool isRequestable = " + !event.period.isEmpty() + ";"); out.write(" static const JfrEventId eventId = Jfr" + event.name + "Event;"); out.write(""); diff --git a/src/hotspot/share/gc/shared/allocTracer.cpp b/src/hotspot/share/gc/shared/allocTracer.cpp index db89e4cf08af2..9de1d5bd3e99c 100644 --- a/src/hotspot/share/gc/shared/allocTracer.cpp +++ b/src/hotspot/share/gc/shared/allocTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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,14 +24,86 @@ #include "precompiled.hpp" #include "gc/shared/allocTracer.hpp" +#include "gc/shared/threadLocalAllocBuffer.inline.hpp" #include "jfr/jfrEvents.hpp" -#include "runtime/handles.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" #if INCLUDE_JFR #include "jfr/support/jfrAllocationTracer.hpp" #endif +static THREAD_LOCAL int64_t _last_allocated_bytes = 0; + +inline void send_allocation_sample(const Klass* klass, int64_t allocated_bytes) { + assert(allocated_bytes > 0, "invariant"); + EventObjectAllocationSample event; + if (event.should_commit()) { + const size_t weight = allocated_bytes - _last_allocated_bytes; + assert(weight > 0, "invariant"); + event.set_objectClass(klass); + event.set_weight(weight); + event.commit(); + _last_allocated_bytes = allocated_bytes; + } +} + +inline bool send_allocation_sample_with_result(const Klass* klass, int64_t allocated_bytes) { + assert(allocated_bytes > 0, "invariant"); + EventObjectAllocationSample event; + if (event.should_commit()) { + const size_t weight = allocated_bytes - _last_allocated_bytes; + assert(weight > 0, "invariant"); + event.set_objectClass(klass); + event.set_weight(weight); + event.commit(); + _last_allocated_bytes = allocated_bytes; + return true; + } + return false; +} + +inline intptr_t estimate_tlab_size_bytes(Thread* thread) { + assert(thread != NULL, "invariant"); + const size_t desired_tlab_size_bytes = thread->tlab().desired_size() * HeapWordSize; + const size_t alignment_reserve_bytes = thread->tlab().alignment_reserve_in_bytes(); + assert(desired_tlab_size_bytes > alignment_reserve_bytes, "invariant"); + return static_cast(desired_tlab_size_bytes - alignment_reserve_bytes); +} + +inline int64_t load_allocated_bytes(Thread* thread) { + const int64_t allocated_bytes = thread->allocated_bytes(); + if (allocated_bytes < _last_allocated_bytes) { + // A hw thread can detach and reattach to the VM, and when it does, + // it gets a new JavaThread representation. The thread local variable + // tracking _last_allocated_bytes is mapped to the existing hw thread, + // so it needs to be reset. + _last_allocated_bytes = 0; + } + return allocated_bytes == _last_allocated_bytes ? 0 : allocated_bytes; +} + +// To avoid large objects from being undersampled compared to the regular TLAB samples, +// the data amount is normalized as if it was a TLAB, giving a number of TLAB sampling attempts to the large object. +static void normalize_as_tlab_and_send_allocation_samples(Klass* klass, intptr_t obj_alloc_size_bytes, Thread* thread) { + const int64_t allocated_bytes = load_allocated_bytes(thread); + assert(allocated_bytes > 0, "invariant"); // obj_alloc_size_bytes is already attributed to allocated_bytes at this point. + if (!UseTLAB) { + send_allocation_sample(klass, allocated_bytes); + return; + } + const intptr_t tlab_size_bytes = estimate_tlab_size_bytes(thread); + if (allocated_bytes - _last_allocated_bytes < tlab_size_bytes) { + return; + } + assert(obj_alloc_size_bytes > 0, "invariant"); + do { + if (send_allocation_sample_with_result(klass, allocated_bytes)) { + return; + } + obj_alloc_size_bytes -= tlab_size_bytes; + } while (obj_alloc_size_bytes > 0); +} + void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread) { JFR_ONLY(JfrAllocationTracer tracer(obj, alloc_size, thread);) EventObjectAllocationOutsideTLAB event; @@ -40,6 +112,7 @@ void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size event.set_allocationSize(alloc_size); event.commit(); } + normalize_as_tlab_and_send_allocation_samples(klass, static_cast(alloc_size), thread); } void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread) { @@ -51,6 +124,11 @@ void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_ event.set_tlabSize(tlab_size); event.commit(); } + const int64_t allocated_bytes = load_allocated_bytes(thread); + if (allocated_bytes == 0) { + return; + } + send_allocation_sample(klass, allocated_bytes); } void AllocTracer::send_allocation_requiring_gc_event(size_t size, uint gcId) { diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index eb5ac627da224..3e8404e145c0c 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -35,6 +35,7 @@ #include "jfr/recorder/repository/jfrRepository.hpp" #include "jfr/recorder/repository/jfrChunkRotation.hpp" #include "jfr/recorder/repository/jfrChunkWriter.hpp" +#include "jfr/recorder/service/jfrEventThrottler.hpp" #include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" #include "jfr/recorder/stringpool/jfrStringPool.hpp" @@ -175,6 +176,11 @@ NO_TRANSITION(jboolean, jfr_set_cutoff(JNIEnv* env, jobject jvm, jlong event_typ return JfrEventSetting::set_cutoff(event_type_id, cutoff_ticks) ? JNI_TRUE : JNI_FALSE; NO_TRANSITION_END +NO_TRANSITION(jboolean, jfr_set_throttle(JNIEnv* env, jobject jvm, jlong event_type_id, jlong event_sample_size, jlong period_ms)) + JfrEventThrottler::configure(static_cast(event_type_id), event_sample_size, period_ms); + return JNI_TRUE; +NO_TRANSITION_END + NO_TRANSITION(jboolean, jfr_should_rotate_disk(JNIEnv* env, jobject jvm)) return JfrChunkRotation::should_rotate() ? JNI_TRUE : JNI_FALSE; NO_TRANSITION_END diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp index 975ecef50cc46..a193df55f9f23 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp @@ -132,6 +132,8 @@ jlong JNICALL jfr_get_unloaded_event_classes_count(JNIEnv* env, jobject jvm); jboolean JNICALL jfr_set_cutoff(JNIEnv* env, jobject jvm, jlong event_type_id, jlong cutoff_ticks); +jboolean JNICALL jfr_set_throttle(JNIEnv* env, jobject jvm, jlong event_type_id, jlong event_sample_size, jlong period_ms); + void JNICALL jfr_emit_old_object_samples(JNIEnv* env, jobject jvm, jlong cutoff_ticks, jboolean, jboolean); jboolean JNICALL jfr_should_rotate_disk(JNIEnv* env, jobject jvm); diff --git a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp index 53d55e455f4d5..2d11467dc193c 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp @@ -81,6 +81,7 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) { (char*)"setForceInstrumentation", (char*)"(Z)V", (void*)jfr_set_force_instrumentation, (char*)"getUnloadedEventClassCount", (char*)"()J", (void*)jfr_get_unloaded_event_classes_count, (char*)"setCutoff", (char*)"(JJ)Z", (void*)jfr_set_cutoff, + (char*)"setThrottle", (char*)"(JJJ)Z", (void*)jfr_set_throttle, (char*)"emitOldObjectSamples", (char*)"(JZZ)V", (void*)jfr_emit_old_object_samples, (char*)"shouldRotateDisk", (char*)"()Z", (void*)jfr_should_rotate_disk, (char*)"exclude", (char*)"(Ljava/lang/Thread;)V", (void*)jfr_exclude_thread, diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp index 797f9e2a4fa46..c5ba05ce3d5e6 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp @@ -175,7 +175,7 @@ void ObjectSampler::sample(HeapWord* obj, size_t allocated, JavaThread* thread) record_stacktrace(thread); // try enter critical section JfrTryLock tryLock(&_lock); - if (!tryLock.has_lock()) { + if (!tryLock.acquired()) { log_trace(jfr, oldobject, sampling)("Skipping old object sample due to lock contention"); return; } diff --git a/src/hotspot/share/jfr/metadata/metadata.xml b/src/hotspot/share/jfr/metadata/metadata.xml index d4484f7db364a..111506067f95f 100644 --- a/src/hotspot/share/jfr/metadata/metadata.xml +++ b/src/hotspot/share/jfr/metadata/metadata.xml @@ -614,6 +614,12 @@ + + + + + diff --git a/src/hotspot/share/jfr/metadata/metadata.xsd b/src/hotspot/share/jfr/metadata/metadata.xsd index bded74ce2e514..017307e384730 100644 --- a/src/hotspot/share/jfr/metadata/metadata.xsd +++ b/src/hotspot/share/jfr/metadata/metadata.xsd @@ -70,6 +70,7 @@ + diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp index 254b5b5c27e41..baf7fcc7116b7 100644 --- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp +++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp @@ -33,6 +33,7 @@ #include "jfr/recorder/jfrRecorder.hpp" #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp" #include "jfr/recorder/repository/jfrRepository.hpp" +#include "jfr/recorder/service/jfrEventThrottler.hpp" #include "jfr/recorder/service/jfrOptionSet.hpp" #include "jfr/recorder/service/jfrPostBox.hpp" #include "jfr/recorder/service/jfrRecorderService.hpp" @@ -289,6 +290,9 @@ bool JfrRecorder::create_components() { if (!create_thread_sampling()) { return false; } + if (!create_event_throttler()) { + return false; + } return true; } @@ -362,6 +366,10 @@ bool JfrRecorder::create_thread_sampling() { return _thread_sampling != NULL; } +bool JfrRecorder::create_event_throttler() { + return JfrEventThrottler::create(); +} + void JfrRecorder::destroy_components() { JfrJvmtiAgent::destroy(); if (_post_box != NULL) { @@ -396,6 +404,7 @@ void JfrRecorder::destroy_components() { JfrThreadSampling::destroy(); _thread_sampling = NULL; } + JfrEventThrottler::destroy(); } bool JfrRecorder::create_recorder_thread() { diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.hpp b/src/hotspot/share/jfr/recorder/jfrRecorder.hpp index 1fbda6544eff8..fb7f2910ae1d4 100644 --- a/src/hotspot/share/jfr/recorder/jfrRecorder.hpp +++ b/src/hotspot/share/jfr/recorder/jfrRecorder.hpp @@ -53,6 +53,7 @@ class JfrRecorder : public JfrCHeapObj { static bool create_storage(); static bool create_stringpool(); static bool create_thread_sampling(); + static bool create_event_throttler(); static bool create_components(); static void destroy_components(); static void on_recorder_thread_exit(); diff --git a/src/hotspot/share/jfr/recorder/service/jfrEvent.hpp b/src/hotspot/share/jfr/recorder/service/jfrEvent.hpp index f7ca26836df0b..7c1e953f4e863 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrEvent.hpp +++ b/src/hotspot/share/jfr/recorder/service/jfrEvent.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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,7 @@ #define SHARE_JFR_RECORDER_SERVICE_JFREVENT_HPP #include "jfr/recorder/jfrEventSetting.inline.hpp" +#include "jfr/recorder/service/jfrEventThrottler.hpp" #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp" #include "jfr/utilities/jfrTime.hpp" #include "jfr/utilities/jfrTypes.hpp" @@ -63,9 +64,14 @@ class JfrEvent { jlong _start_time; jlong _end_time; bool _started; + bool _untimed; + bool _should_commit; + bool _evaluated; protected: - JfrEvent(EventStartTime timing=TIMED) : _start_time(0), _end_time(0), _started(false) + JfrEvent(EventStartTime timing=TIMED) : _start_time(0), _end_time(0), + _started(false), _untimed(timing == UNTIMED), + _should_commit(false), _evaluated(false) #ifdef ASSERT , _verifier() #endif @@ -79,19 +85,12 @@ class JfrEvent { } void commit() { - if (!should_commit()) { - return; - } assert(!_verifier.committed(), "event already committed"); - if (_start_time == 0) { - set_starttime(JfrTicks::now()); - } else if (_end_time == 0) { - set_endtime(JfrTicks::now()); - } - if (should_write()) { - write_event(); - DEBUG_ONLY(_verifier.set_committed();) + if (!should_write()) { + return; } + write_event(); + DEBUG_ONLY(_verifier.set_committed();) } public: @@ -147,16 +146,44 @@ class JfrEvent { return T::hasStackTrace; } - bool should_commit() { + bool is_started() const { return _started; } + bool should_commit() { + if (!_started) { + return false; + } + if (_untimed) { + return true; + } + if (_evaluated) { + return _should_commit; + } + _should_commit = evaluate(); + _evaluated = true; + return _should_commit; + } + private: bool should_write() { - if (T::isInstant || T::isRequestable || T::hasCutoff) { - return true; + return _started && (_evaluated ? _should_commit : evaluate()); + } + + bool evaluate() { + assert(_started, "invariant"); + if (_start_time == 0) { + set_starttime(JfrTicks::now()); + } else if (_end_time == 0) { + set_endtime(JfrTicks::now()); + } + if (T::isInstant || T::isRequestable) { + return T::hasThrottle ? JfrEventThrottler::accept(T::eventId, _untimed ? 0 : _start_time) : true; + } + if (_end_time - _start_time < JfrEventSetting::threshold(T::eventId)) { + return false; } - return (_end_time - _start_time) >= JfrEventSetting::threshold(T::eventId); + return T::hasThrottle ? JfrEventThrottler::accept(T::eventId, _untimed ? 0 : _end_time) : true; } void write_event() { diff --git a/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp new file mode 100644 index 0000000000000..0f5777c8b00e7 --- /dev/null +++ b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.cpp @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Datadog, 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. + * + */ + +#include "precompiled.hpp" +#include "jfr/recorder/service/jfrEventThrottler.hpp" +#include "jfr/utilities/jfrSpinlockHelper.hpp" +#include "logging/log.hpp" + +constexpr static const JfrSamplerParams _disabled_params = { + 0, // sample points per window + 0, // window duration ms + 0, // window lookback count + false // reconfigure + }; + +static JfrEventThrottler* _throttler = NULL; + +JfrEventThrottler::JfrEventThrottler(JfrEventId event_id) : + JfrAdaptiveSampler(), + _last_params(), + _sample_size(0), + _period_ms(0), + _sample_size_ewma(0), + _event_id(event_id), + _disabled(false), + _update(false) {} + +bool JfrEventThrottler::create() { + assert(_throttler == NULL, "invariant"); + _throttler = new JfrEventThrottler(JfrObjectAllocationSampleEvent); + return _throttler != NULL && _throttler->initialize(); +} + +void JfrEventThrottler::destroy() { + delete _throttler; + _throttler = NULL; +} + +// There is currently only one throttler instance, for the jdk.ObjectAllocationSample event. +// When introducing additional throttlers, also add a lookup map keyed by event id. +JfrEventThrottler* JfrEventThrottler::for_event(JfrEventId event_id) { + assert(_throttler != NULL, "JfrEventThrottler has not been properly initialized"); + assert(event_id == JfrObjectAllocationSampleEvent, "Event type has an unconfigured throttler"); + return event_id == JfrObjectAllocationSampleEvent ? _throttler : NULL; +} + +void JfrEventThrottler::configure(JfrEventId event_id, int64_t sample_size, int64_t period_ms) { + if (event_id != JfrObjectAllocationSampleEvent) { + return; + } + assert(_throttler != NULL, "JfrEventThrottler has not been properly initialized"); + _throttler->configure(sample_size, period_ms); +} + +/* + * The event throttler currently only supports a single configuration option, a rate, but more may be added in the future: + * + * We configure to throttle dynamically, to maintain a continuous, maximal event emission rate per time period. + * + * - sample_size size of the event sample set + * - period_ms time period expressed in milliseconds + */ +void JfrEventThrottler::configure(int64_t sample_size, int64_t period_ms) { + JfrSpinlockHelper mutex(&_lock); + _sample_size = sample_size; + _period_ms = period_ms; + _update = true; + reconfigure(); +} + +// Predicate for event selection. +bool JfrEventThrottler::accept(JfrEventId event_id, int64_t timestamp /* 0 */) { + JfrEventThrottler* const throttler = for_event(event_id); + if (throttler == NULL) return true; + return _throttler->_disabled ? true : _throttler->sample(timestamp); +} + +/* + * The window_lookback_count defines the history in number of windows to take into account + * when the JfrAdaptiveSampler engine is calcualting an expected weigthed moving average (EWMA) over the population. + * Technically, it determines the alpha coefficient in the EMWA formula. + */ +constexpr static const size_t default_window_lookback_count = 25; // 25 windows == 5 seconds (for default window duration of 200 ms) + +/* + * Rates lower than or equal to the 'low rate upper bound', are considered special. + * They will use a single window of whatever duration, because the rates are so low they + * do not justify the overhead of more frequent window rotations. + */ +constexpr static const intptr_t low_rate_upper_bound = 9; +constexpr static const size_t window_divisor = 5; + +constexpr static const int64_t MINUTE = 60 * MILLIUNITS; +constexpr static const int64_t TEN_PER_1000_MS_IN_MINUTES = 600; +constexpr static const int64_t HOUR = 60 * MINUTE; +constexpr static const int64_t TEN_PER_1000_MS_IN_HOURS = 36000; +constexpr static const int64_t DAY = 24 * HOUR; +constexpr static const int64_t TEN_PER_1000_MS_IN_DAYS = 864000; + +inline void set_window_lookback(JfrSamplerParams& params) { + if (params.window_duration_ms <= MILLIUNITS) { + params.window_lookback_count = default_window_lookback_count; // 5 seconds + return; + } + if (params.window_duration_ms == MINUTE) { + params.window_lookback_count = 5; // 5 windows == 5 minutes + return; + } + params.window_lookback_count = 1; // 1 window == 1 hour or 1 day +} + +inline void set_low_rate(JfrSamplerParams& params, int64_t event_sample_size, int64_t period_ms) { + params.sample_points_per_window = event_sample_size; + params.window_duration_ms = period_ms; +} + +// If the throttler is off, it accepts all events. +constexpr static const int64_t event_throttler_off = -2; + +/* + * Set the number of sample points and window duration. + */ +inline void set_sample_points_and_window_duration(JfrSamplerParams& params, int64_t sample_size, int64_t period_ms) { + assert(sample_size != event_throttler_off, "invariant"); + assert(sample_size >= 0, "invariant"); + assert(period_ms >= 1000, "invariant"); + if (sample_size <= low_rate_upper_bound) { + set_low_rate(params, sample_size, period_ms); + return; + } else if (period_ms == MINUTE && sample_size < TEN_PER_1000_MS_IN_MINUTES) { + set_low_rate(params, sample_size, period_ms); + return; + } else if (period_ms == HOUR && sample_size < TEN_PER_1000_MS_IN_HOURS) { + set_low_rate(params, sample_size, period_ms); + return; + } else if (period_ms == DAY && sample_size < TEN_PER_1000_MS_IN_DAYS) { + set_low_rate(params, sample_size, period_ms); + return; + } + assert(period_ms % window_divisor == 0, "invariant"); + params.sample_points_per_window = sample_size / window_divisor; + params.window_duration_ms = period_ms / window_divisor; +} + +/* + * If the input event sample size is large enough, normalize to per 1000 ms + */ +inline void normalize(int64_t* sample_size, int64_t* period_ms) { + assert(sample_size != NULL, "invariant"); + assert(period_ms != NULL, "invariant"); + if (*period_ms == MILLIUNITS) { + return; + } + if (*period_ms == MINUTE) { + if (*sample_size >= TEN_PER_1000_MS_IN_MINUTES) { + *sample_size /= 60; + *period_ms /= 60; + } + return; + } + if (*period_ms == HOUR) { + if (*sample_size >= TEN_PER_1000_MS_IN_HOURS) { + *sample_size /= 3600; + *period_ms /= 3600; + } + return; + } + if (*sample_size >= TEN_PER_1000_MS_IN_DAYS) { + *sample_size /= 86400; + *period_ms /= 86400; + } +} + +inline bool is_disabled(int64_t event_sample_size) { + return event_sample_size == event_throttler_off; +} + +const JfrSamplerParams& JfrEventThrottler::update_params(const JfrSamplerWindow* expired) { + _disabled = is_disabled(_sample_size); + if (_disabled) { + return _disabled_params; + } + normalize(&_sample_size, &_period_ms); + set_sample_points_and_window_duration(_last_params, _sample_size, _period_ms); + set_window_lookback(_last_params); + _sample_size_ewma = 0; + _last_params.reconfigure = true; + _update = false; + return _last_params; +} + +/* + * Exponentially Weighted Moving Average (EWMA): + * + * Y is a datapoint (at time t) + * S is the current EMWA (at time t-1) + * alpha represents the degree of weighting decrease, a constant smoothing factor between 0 and 1. + * + * A higher alpha discounts older observations faster. + * Returns the new EWMA for S +*/ + +inline double exponentially_weighted_moving_average(double Y, double alpha, double S) { + return alpha * Y + (1 - alpha) * S; +} + +inline double compute_ewma_alpha_coefficient(size_t lookback_count) { + return lookback_count <= 1 ? 1 : static_cast(1) / static_cast(lookback_count); +} + +/* + * To start debugging the throttler: -Xlog:jfr+system+throttle=debug + * It will log details of each expired window together with an average sample size. + * + * Excerpt: + * + * "jdk.ObjectAllocationSample: avg.sample size: 19.8377, window set point: 20 ..." + * + * Monitoring the relation of average sample size to the window set point, i.e the target, + * is a good indicator of how the throttler is performing over time. + * + * Note: there is currently only one throttler instance, for the ObjectAllocationSample event. + * When introducing additional throttlers, also provide a map from the event id to the event name. + */ +static void log(const JfrSamplerWindow* expired, double* sample_size_ewma) { + assert(sample_size_ewma != NULL, "invariant"); + if (log_is_enabled(Debug, jfr, system, throttle)) { + *sample_size_ewma = exponentially_weighted_moving_average(expired->sample_size(), compute_ewma_alpha_coefficient(expired->params().window_lookback_count), *sample_size_ewma); + log_debug(jfr, system, throttle)("jdk.ObjectAllocationSample: avg.sample size: %0.4f, window set point: %zu, sample size: %zu, population size: %zu, ratio: %.4f, window duration: %zu ms\n", + *sample_size_ewma, expired->params().sample_points_per_window, expired->sample_size(), expired->population_size(), + expired->population_size() == 0 ? 0 : (double)expired->sample_size() / (double)expired->population_size(), + expired->params().window_duration_ms); + } +} + +/* + * This is the feedback control loop. + * + * The JfrAdaptiveSampler engine calls this when a sampler window has expired, providing + * us with an opportunity to perform some analysis. To reciprocate, we returns a set of + * parameters, possibly updated, for the engine to apply to the next window. + * + * Try to keep relatively quick, since the engine is currently inside a critical section, + * in the process of rotating windows. + */ +const JfrSamplerParams& JfrEventThrottler::next_window_params(const JfrSamplerWindow* expired) { + assert(expired != NULL, "invariant"); + assert(_lock, "invariant"); + log(expired, &_sample_size_ewma); + if (_update) { + return update_params(expired); // Updates _last_params in-place. + } + return _disabled ? _disabled_params : _last_params; +} diff --git a/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.hpp b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.hpp new file mode 100644 index 0000000000000..226a2d4ecd221 --- /dev/null +++ b/src/hotspot/share/jfr/recorder/service/jfrEventThrottler.hpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Datadog, 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. + * + */ + +#ifndef SHARE_JFR_RECORDER_SERVICE_JFREVENTTHROTTLER_HPP +#define SHARE_JFR_RECORDER_SERVICE_JFREVENTTHROTTLER_HPP + +#include "jfrfiles/jfrEventIds.hpp" +#include "jfr/support/jfrAdaptiveSampler.hpp" + +class JfrEventThrottler : public JfrAdaptiveSampler { + friend class JfrRecorder; + private: + JfrSamplerParams _last_params; + int64_t _sample_size; + int64_t _period_ms; + double _sample_size_ewma; + JfrEventId _event_id; + bool _disabled; + bool _update; + + static bool create(); + static void destroy(); + JfrEventThrottler(JfrEventId event_id); + void configure(int64_t event_sample_size, int64_t period_ms); + + const JfrSamplerParams& update_params(const JfrSamplerWindow* expired); + const JfrSamplerParams& next_window_params(const JfrSamplerWindow* expired); + static JfrEventThrottler* for_event(JfrEventId event_id); + + public: + static void configure(JfrEventId event_id, int64_t event_sample_size, int64_t period_ms); + static bool accept(JfrEventId event_id, int64_t timestamp = 0); +}; + +#endif // SHARE_JFR_RECORDER_SERVICE_JFREVENTTHROTTLER_HPP \ No newline at end of file diff --git a/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp new file mode 100644 index 0000000000000..3eb53a54a106d --- /dev/null +++ b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp @@ -0,0 +1,385 @@ +/* +* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2020, Datadog, 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. +* +*/ + +#include "precompiled.hpp" +#include "jfr/support/jfrAdaptiveSampler.hpp" +#include "jfr/utilities/jfrRandom.inline.hpp" +#include "jfr/utilities/jfrSpinlockHelper.hpp" +#include "jfr/utilities/jfrTime.hpp" +#include "jfr/utilities/jfrTimeConverter.hpp" +#include "jfr/utilities/jfrTryLock.hpp" +#include "logging/log.hpp" +#include "runtime/atomic.hpp" +#include "utilities/globalDefinitions.hpp" +#include + +JfrSamplerWindow::JfrSamplerWindow() : + _params(), + _end_ticks(0), + _sampling_interval(1), + _projected_population_size(0), + _measured_population_size(0) {} + +JfrAdaptiveSampler::JfrAdaptiveSampler() : + _prng(this), + _window_0(NULL), + _window_1(NULL), + _active_window(NULL), + _avg_population_size(0), + _ewma_population_size_alpha(0), + _acc_debt_carry_limit(0), + _acc_debt_carry_count(0), + _lock(0) {} + +JfrAdaptiveSampler::~JfrAdaptiveSampler() { + delete _window_0; + delete _window_1; +} + +bool JfrAdaptiveSampler::initialize() { + assert(_window_0 == NULL, "invariant"); + _window_0 = new JfrSamplerWindow(); + if (_window_0 == NULL) { + return false; + } + assert(_window_1 == NULL, "invariant"); + _window_1 = new JfrSamplerWindow(); + if (_window_1 == NULL) { + return false; + } + _active_window = _window_0; + return true; +} + +/* + * The entry point to the sampler. + */ +bool JfrAdaptiveSampler::sample(int64_t timestamp) { + bool expired_window; + const bool result = active_window()->sample(timestamp, &expired_window); + if (expired_window) { + JfrTryLock mutex(&_lock); + if (mutex.acquired()) { + rotate_window(timestamp); + } + } + return result; +} + +inline const JfrSamplerWindow* JfrAdaptiveSampler::active_window() const { + return Atomic::load_acquire(&_active_window); +} + +inline int64_t now() { + return JfrTicks::now().value(); +} + +inline bool JfrSamplerWindow::is_expired(int64_t timestamp) const { + const int64_t end_ticks = Atomic::load(&_end_ticks); + return timestamp == 0 ? now() >= end_ticks : timestamp >= end_ticks; +} + +bool JfrSamplerWindow::sample(int64_t timestamp, bool* expired_window) const { + assert(expired_window != NULL, "invariant"); + *expired_window = is_expired(timestamp); + return *expired_window ? false : sample(); +} + +inline bool JfrSamplerWindow::sample() const { + const size_t ordinal = Atomic::add(&_measured_population_size, static_cast(1)); + return ordinal <= _projected_population_size && ordinal % _sampling_interval == 0; +} + +// Called exclusively by the holder of the lock when a window is determined to have expired. +void JfrAdaptiveSampler::rotate_window(int64_t timestamp) { + assert(_lock, "invariant"); + const JfrSamplerWindow* const current = active_window(); + assert(current != NULL, "invariant"); + if (!current->is_expired(timestamp)) { + // Someone took care of it. + return; + } + rotate(current); +} + +// Subclasses can call this to immediately trigger a reconfiguration of the sampler. +// There is no need to await the expiration of the current active window. +void JfrAdaptiveSampler::reconfigure() { + assert(_lock, "invariant"); + rotate(active_window()); +} + +// Call next_window_param() to report the expired window and to retreive params for the next window. +void JfrAdaptiveSampler::rotate(const JfrSamplerWindow* expired) { + assert(expired == active_window(), "invariant"); + install(configure(next_window_params(expired), expired)); +} + +inline void JfrAdaptiveSampler::install(const JfrSamplerWindow* next) { + assert(next != active_window(), "invariant"); + Atomic::release_store(&_active_window, next); +} + +const JfrSamplerWindow* JfrAdaptiveSampler::configure(const JfrSamplerParams& params, const JfrSamplerWindow* expired) { + assert(_lock, "invariant"); + if (params.reconfigure) { + // Store updated params once to both windows. + const_cast(expired)->_params = params; + next_window(expired)->_params = params; + configure(params); + } + JfrSamplerWindow* const next = set_rate(params, expired); + next->initialize(params); + return next; +} + +/* + * Exponentially Weighted Moving Average (EWMA): + * + * Y is a datapoint (at time t) + * S is the current EMWA (at time t-1) + * alpha represents the degree of weighting decrease, a constant smoothing factor between 0 and 1. + * + * A higher alpha discounts older observations faster. + * Returns the new EWMA for S +*/ + +inline double exponentially_weighted_moving_average(double Y, double alpha, double S) { + return alpha * Y + (1 - alpha) * S; +} + +inline double compute_ewma_alpha_coefficient(size_t lookback_count) { + return lookback_count <= 1 ? 1 : static_cast(1) / static_cast(lookback_count); +} + +inline size_t compute_accumulated_debt_carry_limit(const JfrSamplerParams& params) { + if (params.window_duration_ms == 0 || params.window_duration_ms >= MILLIUNITS) { + return 1; + } + return MILLIUNITS / params.window_duration_ms; +} + +void JfrAdaptiveSampler::configure(const JfrSamplerParams& params) { + assert(params.reconfigure, "invariant"); + _avg_population_size = 0; + _ewma_population_size_alpha = compute_ewma_alpha_coefficient(params.window_lookback_count); + _acc_debt_carry_limit = compute_accumulated_debt_carry_limit(params); + _acc_debt_carry_count = _acc_debt_carry_limit; + params.reconfigure = false; +} + +inline int64_t millis_to_countertime(int64_t millis) { + return JfrTimeConverter::nanos_to_countertime(millis * NANOSECS_PER_MILLISEC); +} + +void JfrSamplerWindow::initialize(const JfrSamplerParams& params) { + assert(_sampling_interval >= 1, "invariant"); + if (params.window_duration_ms == 0) { + Atomic::store(&_end_ticks, static_cast(0)); + return; + } + Atomic::store(&_measured_population_size, static_cast(0)); + const int64_t end_ticks = now() + millis_to_countertime(params.window_duration_ms); + Atomic::store(&_end_ticks, end_ticks); +} + +/* + * Based on what it has learned from the past, the sampler creates a future 'projection', + * a speculation, or model, of what the situation will be like during the next window. + * This projection / model is used to derive values for the parameters, which are estimates for + * collecting a sample set that, should the model hold, is as close as possible to the target, + * i.e. the set point, which is a function of the number of sample_points_per_window + amortization. + * The model is a geometric distribution over the number of trials / selections required until success. + * For each window, the sampling interval is a random variable from this geometric distribution. + */ +JfrSamplerWindow* JfrAdaptiveSampler::set_rate(const JfrSamplerParams& params, const JfrSamplerWindow* expired) { + JfrSamplerWindow* const next = next_window(expired); + assert(next != expired, "invariant"); + const size_t sample_size = project_sample_size(params, expired); + if (sample_size == 0) { + next->_projected_population_size = 0; + return next; + } + next->_sampling_interval = derive_sampling_interval(sample_size, expired); + assert(next->_sampling_interval >= 1, "invariant"); + next->_projected_population_size = sample_size * next->_sampling_interval; + return next; +} + +inline JfrSamplerWindow* JfrAdaptiveSampler::next_window(const JfrSamplerWindow* expired) const { + assert(expired != NULL, "invariant"); + return expired == _window_0 ? _window_1 : _window_0; +} + +size_t JfrAdaptiveSampler::project_sample_size(const JfrSamplerParams& params, const JfrSamplerWindow* expired) { + return params.sample_points_per_window + amortize_debt(expired); +} + +/* + * When the sampler is configured to maintain a rate, is employs the concepts + * of 'debt' and 'accumulated debt'. 'Accumulated debt' can be thought of as + * a cumulative error term, and is indicative for how much the sampler is + * deviating from a set point, i.e. the ideal target rate. Debt accumulates naturally + * as a function of undersampled windows, caused by system fluctuations, + * i.e. too small populations. + * + * A specified rate is implicitly a _maximal_ rate, so the sampler must ensure + * to respect this 'limit'. Rates are normalized as per-second ratios, hence the + * limit to respect is on a per second basis. During this second, the sampler + * has freedom to dynamically re-adjust, and it does so by 'amortizing' + * accumulated debt over a certain number of windows that fall within the second. + * + * Intuitively, accumulated debt 'carry over' from the predecessor to the successor + * window if within the allowable time frame (determined in # of 'windows' given by + * _acc_debt_carry_limit). The successor window will sample more points to make amends, + * or 'amortize' debt accumulated by its predecessor(s). + */ +size_t JfrAdaptiveSampler::amortize_debt(const JfrSamplerWindow* expired) { + assert(expired != NULL, "invariant"); + const intptr_t accumulated_debt = expired->accumulated_debt(); + assert(accumulated_debt <= 0, "invariant"); + if (_acc_debt_carry_count == _acc_debt_carry_limit) { + _acc_debt_carry_count = 1; + return 0; + } + ++_acc_debt_carry_count; + return -accumulated_debt; // negation +} + +inline size_t JfrSamplerWindow::max_sample_size() const { + return _projected_population_size / _sampling_interval; +} + +// The sample size is derived from the measured population size. +size_t JfrSamplerWindow::sample_size() const { + const size_t size = population_size(); + return size > _projected_population_size ? max_sample_size() : size / _sampling_interval; +} + +size_t JfrSamplerWindow::population_size() const { + return Atomic::load(&_measured_population_size); +} + +intptr_t JfrSamplerWindow::accumulated_debt() const { + return _projected_population_size == 0 ? 0 : static_cast(_params.sample_points_per_window - max_sample_size()) + debt(); +} + +intptr_t JfrSamplerWindow::debt() const { + return _projected_population_size == 0 ? 0 : static_cast(sample_size() - _params.sample_points_per_window); +} + +/* + * Inverse transform sampling from a uniform to a geometric distribution. + * + * PMF: f(x) = P(X=x) = ((1-p)^x-1)p + * + * CDF: F(x) = P(X<=x) = 1 - (1-p)^x + * + * Inv + * CDF: F'(u) = ceil( ln(1-u) / ln(1-p) ) // u = random uniform, 0.0 < u < 1.0 + * + */ +inline size_t next_geometric(double p, double u) { + assert(u >= 0.0, "invariant"); + assert(u <= 1.0, "invariant"); + if (u == 0.0) { + u = 0.01; + } else if (u == 1.0) { + u = 0.99; + } + // Inverse CDF for the geometric distribution. + return ceil(log(1.0 - u) / log(1.0 - p)); +} + +size_t JfrAdaptiveSampler::derive_sampling_interval(double sample_size, const JfrSamplerWindow* expired) { + assert(sample_size > 0, "invariant"); + const size_t population_size = project_population_size(expired); + if (population_size <= sample_size) { + return 1; + } + assert(population_size > 0, "invariant"); + const double projected_probability = sample_size / population_size; + return next_geometric(projected_probability, _prng.next_uniform()); +} + +// The projected population size is an exponentially weighted moving average, a function of the window_lookback_count. +inline size_t JfrAdaptiveSampler::project_population_size(const JfrSamplerWindow* expired) { + assert(expired != NULL, "invariant"); + _avg_population_size = exponentially_weighted_moving_average(expired->population_size(), _ewma_population_size_alpha, _avg_population_size); + return _avg_population_size; +} + +/* GTEST support */ +JfrGTestFixedRateSampler::JfrGTestFixedRateSampler(size_t sample_points_per_window, size_t window_duration_ms, size_t lookback_count) : JfrAdaptiveSampler(), _params() { + _sample_size_ewma = 0.0; + _params.sample_points_per_window = sample_points_per_window; + _params.window_duration_ms = window_duration_ms; + _params.window_lookback_count = lookback_count; + _params.reconfigure = true; +} + +bool JfrGTestFixedRateSampler::initialize() { + const bool result = JfrAdaptiveSampler::initialize(); + JfrSpinlockHelper mutex(&_lock); + reconfigure(); + return result; +} + +/* + * To start debugging the sampler: -Xlog:jfr+system+throttle=debug + * It will log details of each expired window together with an average sample size. + * + * Excerpt: + * + * "JfrGTestFixedRateSampler: avg.sample size: 19.8377, window set point: 20 ..." + * + * Monitoring the relation of average sample size to the window set point, i.e the target, + * is a good indicator of how the sampler is performing over time. + * + */ +static void log(const JfrSamplerWindow* expired, double* sample_size_ewma) { + assert(sample_size_ewma != NULL, "invariant"); + if (log_is_enabled(Debug, jfr, system, throttle)) { + *sample_size_ewma = exponentially_weighted_moving_average(expired->sample_size(), compute_ewma_alpha_coefficient(expired->params().window_lookback_count), *sample_size_ewma); + log_debug(jfr, system, throttle)("JfrGTestFixedRateSampler: avg.sample size: %0.4f, window set point: %zu, sample size: %zu, population size: %zu, ratio: %.4f, window duration: %zu ms\n", + *sample_size_ewma, expired->params().sample_points_per_window, expired->sample_size(), expired->population_size(), + expired->population_size() == 0 ? 0 : (double)expired->sample_size() / (double)expired->population_size(), + expired->params().window_duration_ms); + } +} + +/* + * This is the feedback control loop. + * + * The JfrAdaptiveSampler engine calls this when a sampler window has expired, providing + * us with an opportunity to perform some analysis.To reciprocate, we returns a set of + * parameters, possibly updated, for the engine to apply to the next window. + */ +const JfrSamplerParams& JfrGTestFixedRateSampler::next_window_params(const JfrSamplerWindow* expired) { + assert(expired != NULL, "invariant"); + assert(_lock, "invariant"); + log(expired, &_sample_size_ewma); + return _params; +} diff --git a/src/hotspot/share/jfr/support/jfrAdaptiveSampler.hpp b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.hpp new file mode 100644 index 0000000000000..e518cb53dd016 --- /dev/null +++ b/src/hotspot/share/jfr/support/jfrAdaptiveSampler.hpp @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2020, Datadog, 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. +* +*/ + +#ifndef SHARE_JFR_SUPPORT_JFRADAPTIVESAMPLER_HPP +#define SHARE_JFR_SUPPORT_JFRADAPTIVESAMPLER_HPP + +#include "jfr/utilities/jfrAllocation.hpp" +#include "jfr/utilities/jfrRandom.hpp" + +/* + * The terminology is mostly from the domain of statistics: + * + * Population - a set of elements of interest. + * Sample - a subset of elements from a population selected by a defined procedure. + * Sample point - an element of a sample (sub)set. + * Sampling interval - the distance between which measurements are taken, also referred to as 'nth selection' + * Debt - an error term, signifying the deviation from a configured set point. + * Amortization - a projection or strategy to recover accumulated debt. + * Window - as in time window or time frame. The sampler sees the evolution of the system in time slices, i.e. in windows. + * Rotate - the process of retiring an expired window and installing a new window with updated parameters. + * + * The adaptive sampler will guarantee a maximum number of sample points selected from a populuation + * during a certain time interval. It is using fixed size time windows and adjusts the sampling interval for the next + * window based on what it learned in the past. Each window has a set point, which is the target number of sample points + * to select. The sampler keeps a cumulative error term, called 'accumulated debt', which is a measure + * for how much the sampler is deviating from the set point over time. The maximum number of sample points selected + * during an individual window is the set point + the accumulated debt. + * The 'accumulated debt' also works as a 'spike damper', smoothing out the extremes in a way that the overall + * target rate is obeyed without highly over- or under-sampled windows. + * + * Sample point selection is defined by a sampling interval, which gives instructions for selecting the 'nth' element + * in a population. Which 'nth' to select is a random variable from a geometric distribution, recalculated for each window. + * + * Each window is configured individually, by an instance of the JfrSamplerParams struct. On window expiration, + * but before switching in the next window, the sampler calls a subclass with the just expired window as an argument. +.* A subclass can inspect the window to study the history of the system and also get an overview of how the sampler + * is performing to help draw inferences. Based on what it learned, it can choose to let the sampler re-apply an updated + * set of parameters to the next, upcoming, window. This is a basic feedback control loop to be developed further, + * perhaps evolving more elaborate sampling schemes in the future. + * + * Using the JfrAdaptiveSampler, we can let a user specify at a high level, for example that he/she would like a + * maximum rate of n sample points per second. Naturally, lower rates will be reported if the system does not produce + * a population to sustain the requested rate, but n per second is respected as a maximum limit, hence it will never + * report a rate higher than n per second. + * + * One good use of the sampler is to employ it as a throttler, or regulator, to help shape large data sets into smaller, + * more managable subsets while still keeping the data somewhat representative. + * + */ + +struct JfrSamplerParams { + size_t sample_points_per_window; // The number of sample points to target per window. + size_t window_duration_ms; + size_t window_lookback_count; // The number of data points (windows) to include when calculating a moving average for the population size. + mutable bool reconfigure; // The sampler should issue a reconfiguration because some parameter changed. +}; + +class JfrSamplerWindow : public JfrCHeapObj { + friend class JfrAdaptiveSampler; + private: + JfrSamplerParams _params; + volatile int64_t _end_ticks; + size_t _sampling_interval; + size_t _projected_population_size; + mutable volatile size_t _measured_population_size; + + JfrSamplerWindow(); + void initialize(const JfrSamplerParams& params); + size_t max_sample_size() const; + bool is_expired(int64_t timestamp) const; + bool sample() const; + bool sample(int64_t timestamp, bool* is_expired) const; + + public: + size_t population_size() const; + size_t sample_size() const; + intptr_t debt() const; + intptr_t accumulated_debt() const; + const JfrSamplerParams& params() const { + return _params; + } +}; + +class JfrAdaptiveSampler : public JfrCHeapObj { + private: + JfrPRNG _prng; + JfrSamplerWindow* _window_0; + JfrSamplerWindow* _window_1; + const JfrSamplerWindow* _active_window; + double _avg_population_size; + double _ewma_population_size_alpha; + size_t _acc_debt_carry_limit; + size_t _acc_debt_carry_count; + + void rotate_window(int64_t timestamp); + void rotate(const JfrSamplerWindow* expired); + const JfrSamplerWindow* active_window() const; + JfrSamplerWindow* next_window(const JfrSamplerWindow* expired) const; + void install(const JfrSamplerWindow* next); + + size_t amortize_debt(const JfrSamplerWindow* expired); + size_t derive_sampling_interval(double sample_size, const JfrSamplerWindow* expired); + size_t project_population_size(const JfrSamplerWindow* expired); + size_t project_sample_size(const JfrSamplerParams& params, const JfrSamplerWindow* expired); + JfrSamplerWindow* set_rate(const JfrSamplerParams& params, const JfrSamplerWindow* expired); + + void configure(const JfrSamplerParams& params); + const JfrSamplerWindow* configure(const JfrSamplerParams& params, const JfrSamplerWindow* expired); + + protected: + volatile int _lock; + JfrAdaptiveSampler(); + virtual ~JfrAdaptiveSampler(); + virtual bool initialize(); + virtual const JfrSamplerParams& next_window_params(const JfrSamplerWindow* expired) = 0; + void reconfigure(); + + public: + bool sample(int64_t timestamp = 0); +}; + +/* GTEST support */ +class JfrGTestFixedRateSampler : public JfrAdaptiveSampler { + private: + JfrSamplerParams _params; + double _sample_size_ewma; + public: + JfrGTestFixedRateSampler(size_t sample_points_per_window, size_t window_duration_ms, size_t lookback_count); + virtual bool initialize(); + const JfrSamplerParams& next_window_params(const JfrSamplerWindow* expired); +}; + +#endif // SHARE_JFR_SUPPORT_JFRADAPTIVESAMPLER_HPP diff --git a/src/hotspot/share/jfr/utilities/jfrLogTagSets.hpp b/src/hotspot/share/jfr/utilities/jfrLogTagSets.hpp index 67a80daef7a64..47fdeaa71f060 100644 --- a/src/hotspot/share/jfr/utilities/jfrLogTagSets.hpp +++ b/src/hotspot/share/jfr/utilities/jfrLogTagSets.hpp @@ -54,6 +54,7 @@ JFR_LOG_TAG(jfr, system, parser) \ JFR_LOG_TAG(jfr, system, metadata) \ JFR_LOG_TAG(jfr, system, streaming) \ + JFR_LOG_TAG(jfr, system, throttle) \ JFR_LOG_TAG(jfr, metadata) \ JFR_LOG_TAG(jfr, event) \ JFR_LOG_TAG(jfr, setting) \ diff --git a/src/hotspot/share/jfr/utilities/jfrRandom.hpp b/src/hotspot/share/jfr/utilities/jfrRandom.hpp new file mode 100644 index 0000000000000..7f3fae98336a7 --- /dev/null +++ b/src/hotspot/share/jfr/utilities/jfrRandom.hpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, Google 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. + * + */ + +#ifndef SHARE_JFR_UTILITIES_JFRRANDOM_HPP +#define SHARE_JFR_UTILITIES_JFRRANDOM_HPP + +#include "jfr/utilities/jfrAllocation.hpp" + +// Cheap pseudorandom number generator + +class JfrPRNG : public JfrCHeapObj { + private: + mutable uint64_t _rnd; + public: + JfrPRNG(const void* seed); + double next_uniform() const; +}; + +#endif // SHARE_JFR_UTILITIES_JFRRANDOM_HPP diff --git a/src/hotspot/share/jfr/utilities/jfrRandom.inline.hpp b/src/hotspot/share/jfr/utilities/jfrRandom.inline.hpp new file mode 100644 index 0000000000000..2e84911236c06 --- /dev/null +++ b/src/hotspot/share/jfr/utilities/jfrRandom.inline.hpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, Google 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. + * + */ + +#ifndef SHARE_JFR_UTILITIES_JFRRANDOM_INLINE_HPP +#define SHARE_JFR_UTILITIES_JFRRANDOM_INLINE_HPP + +#include "jfr/utilities/jfrRandom.hpp" + +inline JfrPRNG::JfrPRNG(const void* seed) : _rnd(reinterpret_cast(seed)) { + assert(seed != NULL, "invariant"); +} + +// Returns the next prng value. +// pRNG is: aX+b mod c with a = 0x5DEECE66D, b = 0xB, c = 1<<48 +// This is the lrand64 generator. +inline uint64_t next(uint64_t rnd) { + static const uint64_t PrngMult = 0x5DEECE66DLL; + static const uint64_t PrngAdd = 0xB; + static const uint64_t PrngModPower = 48; + static const uint64_t PrngModMask = (static_cast(1) << PrngModPower) - 1; + return (PrngMult * rnd + PrngAdd) & PrngModMask; +} + +inline double JfrPRNG::next_uniform() const { + _rnd = next(_rnd); + // Take the top 26 bits as the random number + // (This plus a 1<<58 sampling bound gives a max possible step of + // 5194297183973780480 bytes. In this case, + // for sample_parameter = 1<<19, max possible step is + // 9448372 bytes (24 bits). + static const uint64_t PrngModPower = 48; // Number of bits in prng + // The uint32_t cast is to prevent a (hard-to-reproduce) NAN + // under piii debug for some binaries. + // the n_rand value is between 0 and 2**26-1 so it needs to be normalized by dividing by 2**26 (67108864) + return (static_cast(_rnd >> (PrngModPower - 26)) / static_cast(67108864)); +} + +#endif // SHARE_JFR_UTILITIES_JFRRANDOM_INLINE_HPP diff --git a/src/hotspot/share/jfr/utilities/jfrTryLock.hpp b/src/hotspot/share/jfr/utilities/jfrTryLock.hpp index 9f92b6cd13caf..10b3c93f5dc3b 100644 --- a/src/hotspot/share/jfr/utilities/jfrTryLock.hpp +++ b/src/hotspot/share/jfr/utilities/jfrTryLock.hpp @@ -33,20 +33,20 @@ class JfrTryLock { private: volatile int* const _lock; - bool _has_lock; + bool _acquired; public: - JfrTryLock(volatile int* lock) : _lock(lock), _has_lock(Atomic::cmpxchg(lock, 0, 1) == 0) {} + JfrTryLock(volatile int* lock) : _lock(lock), _acquired(Atomic::cmpxchg(lock, 0, 1) == 0) {} ~JfrTryLock() { - if (_has_lock) { + if (_acquired) { OrderAccess::fence(); *_lock = 0; } } - bool has_lock() const { - return _has_lock; + bool acquired() const { + return _acquired; } }; diff --git a/src/hotspot/share/logging/logTag.hpp b/src/hotspot/share/logging/logTag.hpp index 56ea22b434580..55f9aa4a351df 100644 --- a/src/hotspot/share/logging/logTag.hpp +++ b/src/hotspot/share/logging/logTag.hpp @@ -179,6 +179,7 @@ LOG_TAG(task) \ DEBUG_ONLY(LOG_TAG(test)) \ LOG_TAG(thread) \ + LOG_TAG(throttle) \ LOG_TAG(time) \ LOG_TAG(timer) \ LOG_TAG(tlab) \ diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index 242eb2feb9923..9642bb6d5de33 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -378,7 +378,7 @@ bool ObjectMonitor::enter(TRAPS) { JFR_ONLY(JfrConditionalFlushWithStacktrace flush(jt);) EventJavaMonitorEnter event; - if (event.should_commit()) { + if (event.is_started()) { event.set_monitorClass(object()->klass()); // Set an address that is 'unique enough', such that events close in // time and with the same address are likely (but not guaranteed) to diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java index de93476910113..eba46e85ce0f6 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventControl.java @@ -50,6 +50,7 @@ import jdk.jfr.internal.settings.PeriodSetting; import jdk.jfr.internal.settings.StackTraceSetting; import jdk.jfr.internal.settings.ThresholdSetting; +import jdk.jfr.internal.settings.ThrottleSetting; // This class can't have a hard reference from PlatformEventType, since it // holds SettingControl instances that need to be released @@ -69,6 +70,7 @@ final static class NamedControl { private static final Type TYPE_STACK_TRACE = TypeLibrary.createType(StackTraceSetting.class); private static final Type TYPE_PERIOD = TypeLibrary.createType(PeriodSetting.class); private static final Type TYPE_CUTOFF = TypeLibrary.createType(CutoffSetting.class); + private static final Type TYPE_THROTTLE = TypeLibrary.createType(ThrottleSetting.class); private final ArrayList settingInfos = new ArrayList<>(); private final ArrayList namedControls = new ArrayList<>(5); @@ -76,7 +78,6 @@ final static class NamedControl { private final String idName; EventControl(PlatformEventType eventType) { - addControl(Enabled.NAME, defineEnabled(eventType)); if (eventType.hasDuration()) { addControl(Threshold.NAME, defineThreshold(eventType)); } @@ -89,6 +90,10 @@ final static class NamedControl { if (eventType.hasCutoff()) { addControl(Cutoff.NAME, defineCutoff(eventType)); } + if (eventType.hasThrottle()) { + addControl(Throttle.NAME, defineThrottle(eventType)); + } + addControl(Enabled.NAME, defineEnabled(eventType)); ArrayList aes = new ArrayList<>(eventType.getAnnotationElements()); remove(eventType, aes, Threshold.class); @@ -96,6 +101,7 @@ final static class NamedControl { remove(eventType, aes, Enabled.class); remove(eventType, aes, StackTrace.class); remove(eventType, aes, Cutoff.class); + remove(eventType, aes, Throttle.class); aes.trimToSize(); eventType.setAnnotations(aes); this.type = eventType; @@ -252,6 +258,15 @@ private static Control defineCutoff(PlatformEventType type) { return new Control(new CutoffSetting(type), def); } + private static Control defineThrottle(PlatformEventType type) { + Throttle throttle = type.getAnnotation(Throttle.class); + String def = Throttle.DEFAULT; + if (throttle != null) { + def = throttle.value(); + } + type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_THROTTLE, Throttle.NAME, def, Collections.emptyList())); + return new Control(new ThrottleSetting(type), def); + } private static Control definePeriod(PlatformEventType type) { Period period = type.getAnnotation(Period.class); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java index c850fcce8a005..ffde6045a113b 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java @@ -516,6 +516,18 @@ public boolean hasNativeJFR() { */ public native boolean setCutoff(long eventTypeId, long cutoffTicks); + /** + * Sets the event emission rate in event sample size per time unit. + * + * Determines how events are throttled. + * + * @param eventTypeId the id of the event type + * @param eventSampleSize event sample size + * @param period_ms time period in milliseconds + * @return true, if it could be set + */ + public native boolean setThrottle(long eventTypeId, long eventSampleSize, long period_ms); + /** * Emit old object sample events. * diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/LogTag.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/LogTag.java index c19417580988d..f2cbeabfdfd80 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/LogTag.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/LogTag.java @@ -66,22 +66,26 @@ public enum LogTag { * Covers streaming (for Hotspot developers) */ JFR_SYSTEM_STREAMING(7), + /** + * Covers throttling (for Hotspot developers) + */ + JFR_SYSTEM_THROTTLE(8), /** * Covers metadata for Java user (for Hotspot developers) */ - JFR_METADATA(8), + JFR_METADATA(9), /** * Covers events (for users of the JDK) */ - JFR_EVENT(9), + JFR_EVENT(10), /** * Covers setting (for users of the JDK) */ - JFR_SETTING(10), + JFR_SETTING(11), /** * Covers usage of jcmd with JFR */ - JFR_DCMD(11); + JFR_DCMD(12); /* set from native side */ volatile int tagSetLevel = 100; // prevent logging if JVM log system has not been initialized diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java index e0e242bf03b45..20477ec0d802f 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataLoader.java @@ -81,6 +81,7 @@ private final static class TypeElement { private final boolean startTime; private final boolean stackTrace; private final boolean cutoff; + private final boolean throttle; private final boolean isEvent; private final boolean isRelation; private final boolean experimental; @@ -101,6 +102,7 @@ public TypeElement(DataInputStream dis) throws IOException { startTime = dis.readBoolean(); period = dis.readUTF(); cutoff = dis.readBoolean(); + throttle = dis.readBoolean(); experimental = dis.readBoolean(); id = dis.readLong(); isEvent = dis.readBoolean(); @@ -304,6 +306,9 @@ private Map buildTypeMap() { if (t.cutoff) { aes.add(new AnnotationElement(Cutoff.class, Cutoff.INFINITY)); } + if (t.throttle) { + aes.add(new AnnotationElement(Throttle.class, Throttle.DEFAULT)); + } } if (t.experimental) { aes.add(EXPERIMENTAL); diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java index f7b4746c79386..469827a7a1d39 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java @@ -76,6 +76,7 @@ private void initializeJVMEventTypes() { pEventType.setHasDuration(eventType.getAnnotation(Threshold.class) != null); pEventType.setHasStackTrace(eventType.getAnnotation(StackTrace.class) != null); pEventType.setHasCutoff(eventType.getAnnotation(Cutoff.class) != null); + pEventType.setHasThrottle(eventType.getAnnotation(Throttle.class) != null); pEventType.setHasPeriod(eventType.getAnnotation(Period.class) != null); // Must add hook before EventControl is created as it removes // annotations, such as Period and Threshold. diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java index 6212ddc2d7b59..8e246acd3dbce 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java @@ -59,6 +59,7 @@ public final class PlatformEventType extends Type { private boolean hasDuration = true; private boolean hasPeriod = true; private boolean hasCutoff = false; + private boolean hasThrottle = false; private boolean isInstrumented; private boolean markForInstrumentation; private boolean registered = true; @@ -142,6 +143,10 @@ public void setHasCutoff(boolean hasCutoff) { this.hasCutoff = hasCutoff; } + public void setHasThrottle(boolean hasThrottle) { + this.hasThrottle = hasThrottle; + } + public void setCutoff(long cutoffNanos) { if (isJVM) { long cutoffTicks = Utils.nanosToTicks(cutoffNanos); @@ -149,6 +154,12 @@ public void setCutoff(long cutoffNanos) { } } + public void setThrottle(long eventSampleSize, long period_ms) { + if (isJVM) { + JVM.getJVM().setThrottle(getId(), eventSampleSize, period_ms); + } + } + public void setHasPeriod(boolean hasPeriod) { this.hasPeriod = hasPeriod; } @@ -169,6 +180,10 @@ public boolean hasCutoff() { return this.hasCutoff; } + public boolean hasThrottle() { + return this.hasThrottle; + } + public boolean isEnabled() { return enabled; } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/Throttle.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/Throttle.java new file mode 100644 index 0000000000000..39f0cc491d2e7 --- /dev/null +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Throttle.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Datadog, 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. 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 jdk.jfr.internal; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import jdk.jfr.MetadataDefinition; + +/** + * Event annotation, determines the event emission rate in events per time unit. + * + * This setting is only supported for JVM events. + * + * @since 16 + */ +@MetadataDefinition +@Target({ ElementType.TYPE }) +@Inherited +@Retention(RetentionPolicy.RUNTIME) +public @interface Throttle { + /** + * Settings name {@code "throttle"} for configuring an event emission rate in events per time unit. + */ + public final static String NAME = "throttle"; + public final static String DEFAULT = "off"; + + /** + * Throttle, for example {@code "100/s"}. + *

        + * String representation of a non-negative {@code Long} value followed by a slash ("/") + * and one of the following units
        + * {@code "ns"} (nanoseconds)
        + * {@code "us"} (microseconds)
        + * {@code "ms"} (milliseconds)
        + * {@code "s"} (seconds)
        + * {@code "m"} (minutes)
        + * {@code "h"} (hours)
        + * {@code "d"} (days)
        + *

        + * Example values, {@code "6000/m"}, {@code "10/ms"} and {@code "200/s"}. + * When zero is specified, for example {@code "0/s"}, no events are emitted. + * When {@code "off"} is specified, all events are emitted. + * + * @return the throttle value, default {@code "off"} not {@code null} + * + */ + String value() default DEFAULT; +} diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java index 5c01370f1e919..49953c3ba5bee 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java @@ -49,6 +49,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.concurrent.TimeUnit; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -69,6 +70,7 @@ public final class Utils { private static final Object flushObject = new Object(); private static final String INFINITY = "infinity"; + private static final String OFF = "off"; public static final String EVENTS_PACKAGE_NAME = "jdk.jfr.events"; public static final String INSTRUMENT_PACKAGE_NAME = "jdk.jfr.internal.instrument"; public static final String HANDLERS_PACKAGE_NAME = "jdk.jfr.internal.handlers"; @@ -78,7 +80,6 @@ public final class Utils { private static Boolean SAVE_GENERATED; - private static final Duration MICRO_SECOND = Duration.ofNanos(1_000); private static final Duration SECOND = Duration.ofSeconds(1); private static final Duration MINUTE = Duration.ofMinutes(1); @@ -88,6 +89,7 @@ public final class Utils { private static final int MILL_SIGNIFICANT_FIGURES = 3; private static final int DISPLAY_NANO_DIGIT = 3; private static final int BASE = 10; + private static long THROTTLE_OFF = -2; public static void checkAccessFlightRecorder() throws SecurityException { @@ -204,6 +206,94 @@ private static void appendPadded(StringBuilder text, int number, boolean separat } } + enum ThrottleUnit { + NANOSECONDS("ns", TimeUnit.NANOSECONDS, TimeUnit.SECONDS.toNanos(1), TimeUnit.SECONDS.toMillis(1)), + MICROSECONDS("us", TimeUnit.MICROSECONDS, TimeUnit.SECONDS.toNanos(1) / 1000, TimeUnit.SECONDS.toMillis(1)), + MILLISECONDS("ms", TimeUnit.MILLISECONDS, TimeUnit.SECONDS.toMillis(1), TimeUnit.SECONDS.toMillis(1)), + SECONDS("s", TimeUnit.SECONDS, 1, TimeUnit.SECONDS.toMillis(1)), + MINUTES("m", TimeUnit.MINUTES, 1, TimeUnit.MINUTES.toMillis(1)), + HOUR("h", TimeUnit.HOURS, 1, TimeUnit.HOURS.toMillis(1)), + DAY("d", TimeUnit.DAYS, 1, TimeUnit.DAYS.toMillis(1)); + + private final String text; + private final TimeUnit timeUnit; + private final long factor; + private final long millis; + + ThrottleUnit(String t, TimeUnit u, long factor, long millis) { + this.text = t; + this.timeUnit = u; + this.factor = factor; + this.millis = millis; + } + + private static ThrottleUnit parse(String s) { + if (s.equals(OFF)) { + return MILLISECONDS; + } + return unit(parseThrottleString(s, false)); + } + + private static ThrottleUnit unit(String s) { + if (s.endsWith("ns") || s.endsWith("us") || s.endsWith("ms")) { + return value(s.substring(s.length() - 2)); + } + if (s.endsWith("s") || s.endsWith("m") || s.endsWith("h") || s.endsWith("d")) { + return value(s.substring(s.length() - 1)); + } + throw new NumberFormatException("'" + s + "' is not a valid time unit."); + } + + private static ThrottleUnit value(String s) { + for (ThrottleUnit t : values()) { + if (t.text.equals(s)) { + return t; + } + } + throw new NumberFormatException("'" + s + "' is not a valid time unit."); + } + + static long asMillis(String s) { + return parse(s).millis; + } + + static long normalizeValueAsMillis(long value, String s) { + return value * parse(s).factor; + } + } + + private static void throwThrottleNumberFormatException(String s) { + throw new NumberFormatException("'" + s + "' is not valid. Should be a non-negative numeric value followed by a delimiter. i.e. '/', and then followed by a unit e.g. 100/s."); + } + + // Expected input format is "x/y" where x is a non-negative long + // and y is a time unit. Split the string at the delimiter. + private static String parseThrottleString(String s, boolean value) { + String[] split = s.split("/"); + if (split.length != 2) { + throwThrottleNumberFormatException(s); + } + return value ? split[0].trim() : split[1].trim(); + } + + public static long parseThrottleValue(String s) { + if (s.equals(OFF)) { + return THROTTLE_OFF; + } + String parsedValue = parseThrottleString(s, true); + long normalizedValue = 0; + try { + normalizedValue = ThrottleUnit.normalizeValueAsMillis(Long.parseLong(parsedValue), s); + } catch (NumberFormatException nfe) { + throwThrottleNumberFormatException(s); + } + return normalizedValue; + } + + public static long parseThrottleTimeUnit(String s) { + return ThrottleUnit.asMillis(s); + } + public static long parseTimespanWithInfinity(String s) { if (INFINITY.equals(s)) { return Long.MAX_VALUE; diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottleSetting.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottleSetting.java new file mode 100644 index 0000000000000..550e450e966db --- /dev/null +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottleSetting.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Datadog, 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. 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 jdk.jfr.internal.settings; + +import static java.util.concurrent.TimeUnit.MICROSECONDS; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.util.concurrent.TimeUnit; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +import jdk.jfr.Description; +import jdk.jfr.Label; +import jdk.jfr.MetadataDefinition; +import jdk.jfr.Name; +import jdk.jfr.Timespan; +import jdk.jfr.internal.PlatformEventType; +import jdk.jfr.internal.Type; +import jdk.jfr.internal.Utils; + +@MetadataDefinition +@Label("Event Emission Throttle") +@Description("Throttles the emission rate for an event") +@Name(Type.SETTINGS_PREFIX + "Throttle") +public final class ThrottleSetting extends JDKSettingControl { + private final static long typeId = Type.getTypeId(ThrottleSetting.class); + private final static long OFF = -2; + private String value = "0/s"; + private final PlatformEventType eventType; + + public ThrottleSetting(PlatformEventType eventType) { + this.eventType = Objects.requireNonNull(eventType); + } + + @Override + public String combine(Set values) { + long max = OFF; + String text = "off"; + for (String value : values) { + long l = parseValueSafe(value); + if (l > max) { + text = value; + max = l; + } + } + return text; + } + + private static long parseValueSafe(String s) { + long value = 0L; + try { + value = Utils.parseThrottleValue(s); + } catch (NumberFormatException nfe) { + } + return value; + } + + @Override + public void setValue(String s) { + long size = 0; + long millis = 1000; + try { + size = Utils.parseThrottleValue(s); + millis = Utils.parseThrottleTimeUnit(s); + this.value = s; + } catch (NumberFormatException nfe) { + } + eventType.setThrottle(size, millis); + } + + @Override + public String getValue() { + return value; + } + + public static boolean isType(long typeId) { + return ThrottleSetting.typeId == typeId; + } +} + diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index 53151be43f076..5c102f7c05b20 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -274,7 +274,7 @@ - false + false everyChunk @@ -443,11 +443,11 @@ - false + false - false + false @@ -605,12 +605,18 @@ - false + false true - false + false + true + + + + true + 150/s true @@ -826,21 +832,41 @@ - + + - + + + + + + - - + + + + + + + + + + + + + + + + diff --git a/src/jdk.jfr/share/conf/jfr/profile.jfc b/src/jdk.jfr/share/conf/jfr/profile.jfc index 7958f6a1fbeb0..52cbd2d72b411 100644 --- a/src/jdk.jfr/share/conf/jfr/profile.jfc +++ b/src/jdk.jfr/share/conf/jfr/profile.jfc @@ -274,7 +274,7 @@ - false + false everyChunk @@ -443,11 +443,11 @@ - true + true - true + true @@ -605,12 +605,18 @@ - true + false true - true + false + true + + + + true + 300/s true @@ -826,23 +832,42 @@ - + + - + + + + + + - - + + + + + + + + + + + + + + + diff --git a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp new file mode 100644 index 0000000000000..920c874ec53e1 --- /dev/null +++ b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Datadog, 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. + * + */ + +#include "precompiled.hpp" + +// This test performs mocking of certain JVM functionality. This works by +// including the source file under test inside an anonymous namespace (which +// prevents linking conflicts) with the mocked symbols redefined. + +// The include list should mirror the one found in the included source file - +// with the ones that should pick up the mocks removed. Those should be included +// later after the mocks have been defined. + +#include + +#include "jfr/utilities/jfrAllocation.hpp" +#include "jfr/utilities/jfrRandom.inline.hpp" +#include "jfr/utilities/jfrSpinlockHelper.hpp" +#include "jfr/utilities/jfrTime.hpp" +#include "jfr/utilities/jfrTimeConverter.hpp" +#include "jfr/utilities/jfrTryLock.hpp" +#include "logging/log.hpp" +#include "runtime/atomic.hpp" +#include "utilities/globalDefinitions.hpp" + +#include "unittest.hpp" + +// #undef SHARE_JFR_SUPPORT_JFRADAPTIVESAMPLER_HPP + +namespace { + class MockJfrTimeConverter : public ::JfrTimeConverter { + public: + static double nano_to_counter_multiplier(bool is_os_time = false) { + return 1.0; + } + static jlong counter_to_nanos(jlong c, bool is_os_time = false) { + return c; + } + static jlong counter_to_millis(jlong c, bool is_os_time = false) { + return c * NANOS_PER_MILLISEC; + } + static jlong nanos_to_countertime(jlong c, bool as_os_time = false) { + return c; + } + }; + + class MockJfrTickValue { + private: + jlong _ticks; + public: + MockJfrTickValue(jlong ticks) : _ticks(ticks) {}; + jlong value() { + return _ticks; + } + }; + class MockJfrTicks { + public: + static jlong tick; + static MockJfrTickValue now() { + return MockJfrTickValue(tick); + } + }; + + jlong MockJfrTicks::tick = 0; + + // Reincluding source files in the anonymous namespace unfortunately seems to + // behave strangely with precompiled headers (only when using gcc though) +#ifndef DONT_USE_PRECOMPILED_HEADER +#define DONT_USE_PRECOMPILED_HEADER +#endif + +#define JfrTicks MockJfrTicks +#define JfrTimeConverter MockJfrTimeConverter + +#include "jfr/support/jfrAdaptiveSampler.hpp" +#include "jfr/support/jfrAdaptiveSampler.cpp" + +#undef JfrTimeConverter +#undef JfrTicks +} // anonymous namespace + +class JfrGTestAdaptiveSampling : public ::testing::Test { + protected: + const int max_population_per_window = 2000; + const int min_population_per_window = 2; + const int window_count = 10000; + const clock_t window_duration_ms = 100; + const size_t expected_sample_points_per_window = 50; + const size_t expected_sample_points = expected_sample_points_per_window * (size_t)window_count; + const size_t window_lookback_count = 50; // 50 windows == 5 seconds (for a window duration of 100 ms) + const double max_sample_bias = 0.11; + + void SetUp() { + // Ensure that tests are separated in time by spreading them by 24hrs apart + MockJfrTicks::tick += (24 * 60 * 60) * NANOSECS_PER_SEC; + } + + void TearDown() { + // nothing + } + + void assertDistributionProperties(int distr_slots, jlong* population, jlong* sample, size_t population_size, size_t sample_size, const char* msg) { + size_t population_sum = 0; + size_t sample_sum = 0; + for (int i = 0; i < distr_slots; i++) { + population_sum += i * population[i]; + sample_sum += i * sample[i]; + } + + double population_mean = population_sum / (double)population_size; + double sample_mean = sample_sum / (double)sample_size; + + double population_variance = 0; + double sample_variance = 0; + for (int i = 0; i < distr_slots; i++) { + double population_diff = i - population_mean; + population_variance = population[i] * population_diff * population_diff; + + double sample_diff = i - sample_mean; + sample_variance = sample[i] * sample_diff * sample_diff; + } + population_variance = population_variance / (population_size - 1); + sample_variance = sample_variance / (sample_size - 1); + double population_stdev = sqrt(population_variance); + double sample_stdev = sqrt(sample_variance); + + // make sure the standard deviation is ok + EXPECT_NEAR(population_stdev, sample_stdev, 0.5) << msg; + // make sure that the subsampled set mean is within 2-sigma of the original set mean + EXPECT_NEAR(population_mean, sample_mean, population_stdev) << msg; + // make sure that the original set mean is within 2-sigma of the subsampled set mean + EXPECT_NEAR(sample_mean, population_mean, sample_stdev) << msg; + } + + typedef size_t(JfrGTestAdaptiveSampling::* incoming)() const; + void test(incoming inc, size_t events_per_window, double expectation, const char* description); + + public: + size_t incoming_uniform() const { + return os::random() % max_population_per_window + min_population_per_window; + } + + size_t incoming_bursty_10_percent() const { + bool is_burst = (os::random() % 100) < 10; // 10% burst chance + return is_burst ? max_population_per_window : min_population_per_window; + } + + size_t incoming_bursty_90_percent() const { + bool is_burst = (os::random() % 100) < 90; // 90% burst chance + return is_burst ? max_population_per_window : min_population_per_window; + } + + size_t incoming_low_rate() const { + return min_population_per_window; + } + + size_t incoming_high_rate() const { + return max_population_per_window; + } + + size_t incoming_burst_eval(size_t& count, size_t mod_value) const { + return count++ % 10 == mod_value ? max_population_per_window : 0; + } + + size_t incoming_early_burst() const { + static size_t count = 1; + return incoming_burst_eval(count, 1); + } + + size_t incoming_mid_burst() const { + static size_t count = 1; + return incoming_burst_eval(count, 5); + } + + size_t incoming_late_burst() const { + static size_t count = 1; + return incoming_burst_eval(count, 0); + } +}; + +void JfrGTestAdaptiveSampling::test(JfrGTestAdaptiveSampling::incoming inc, size_t sample_points_per_window, double error_factor, const char* const description) { + assert(description != NULL, "invariant"); + char output[1024] = "Adaptive sampling: "; + strcat(output, description); + fprintf(stdout, "=== %s\n", output); + jlong population[100] = { 0 }; + jlong sample[100] = { 0 }; + ::JfrGTestFixedRateSampler sampler = ::JfrGTestFixedRateSampler(expected_sample_points_per_window, window_duration_ms, window_lookback_count); + EXPECT_TRUE(sampler.initialize()); + + size_t population_size = 0; + size_t sample_size = 0; + for (int t = 0; t < window_count; t++) { + const size_t incoming_events = (this->*inc)(); + for (size_t i = 0; i < incoming_events; i++) { + ++population_size; + size_t index = os::random() % 100; + population[index] += 1; + if (sampler.sample()) { + ++sample_size; + sample[index] += 1; + } + } + MockJfrTicks::tick += window_duration_ms * NANOSECS_PER_MILLISEC + 1; + sampler.sample(); // window rotation + } + + const size_t target_sample_size = sample_points_per_window * window_count; + EXPECT_NEAR(target_sample_size, sample_size, expected_sample_points * error_factor) << output; + strcat(output, ", hit distribution"); + assertDistributionProperties(100, population, sample, population_size, sample_size, output); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, uniform_rate) { + test(&JfrGTestAdaptiveSampling::incoming_uniform, expected_sample_points_per_window, 0.05, "random uniform, all samples"); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, low_rate) { + test(&JfrGTestAdaptiveSampling::incoming_low_rate, min_population_per_window, 0.05, "low rate"); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, high_rate) { + test(&JfrGTestAdaptiveSampling::incoming_high_rate, expected_sample_points_per_window, 0.02, "high rate"); +} + +// We can think of the windows as splitting up a time period, for example a second (window_duration_ms = 100) +// The burst tests for early, mid and late apply a burst rate at a selected window, with other windows having no incoming input. +// +// - early during the first window of a new time period +// - mid during the middle window of a new time period +// - late during the last window of a new time period +// +// The tests verify the total sample size correspond to the selected bursts: +// +// - early start of a second -> each second will have sampled the window set point for a single window only since no debt has accumulated into the new time period. +// - mid middle of the second -> each second will have sampled the window set point + accumulated debt for the first 4 windows. +// - late end of the second -> each second will have sampled the window set point + accumulated debt for the first 9 windows (i.e. it will have sampled all) +// + +TEST_VM_F(JfrGTestAdaptiveSampling, early_burst) { + test(&JfrGTestAdaptiveSampling::incoming_early_burst, expected_sample_points_per_window, 0.9, "early burst"); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, mid_burst) { + test(&JfrGTestAdaptiveSampling::incoming_mid_burst, expected_sample_points_per_window, 0.5, "mid burst"); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, late_burst) { + test(&JfrGTestAdaptiveSampling::incoming_late_burst, expected_sample_points_per_window, 0.0, "late burst"); +} + +// These are randomized burst tests +TEST_VM_F(JfrGTestAdaptiveSampling, bursty_rate_10_percent) { + test(&JfrGTestAdaptiveSampling::incoming_bursty_10_percent, expected_sample_points_per_window, 0.96, "bursty 10%"); +} + +TEST_VM_F(JfrGTestAdaptiveSampling, bursty_rate_90_percent) { + test(&JfrGTestAdaptiveSampling::incoming_bursty_10_percent, expected_sample_points_per_window, 0.96, "bursty 90%"); +} diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 62160ae5fc27b..c5bed118dd789 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -464,7 +464,7 @@ jdk_jfr_sanity = \ jdk/jfr/api/recording/event/TestLoadEventAfterStart.java \ jdk/jfr/api/recording/state/TestState.java \ jdk/jfr/event/os/TestCPULoad.java \ - jdk/jfr/event/compiler/TestAllocInNewTLAB.java \ + jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java \ jdk/jfr/jcmd/TestJcmdStartStopDefault.java \ jdk/jfr/event/io/TestFileStreamEvents.java \ jdk/jfr/event/compiler/TestCompilerCompile.java \ diff --git a/test/jdk/jdk/jfr/event/compiler/TestAllocInNewTLAB.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java similarity index 65% rename from test/jdk/jdk/jfr/event/compiler/TestAllocInNewTLAB.java rename to test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java index 61c2366558411..51d4f2767c4ff 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestAllocInNewTLAB.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationInNewTLABEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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,18 +23,15 @@ * questions. */ -package jdk.jfr.event.compiler; +package jdk.jfr.event.allocation; import static java.lang.Math.floor; -import static jdk.test.lib.Asserts.assertGreaterThanOrEqual; -import static jdk.test.lib.Asserts.assertLessThanOrEqual; - -import java.time.Duration; import jdk.jfr.Recording; import jdk.jfr.consumer.RecordedEvent; import jdk.test.lib.jfr.EventNames; import jdk.test.lib.jfr.Events; +import jdk.test.lib.Asserts; /** * @test @@ -42,8 +39,8 @@ * @key jfr * @requires vm.hasJFR * @library /test/lib - * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 jdk.jfr.event.compiler.TestAllocInNewTLAB - * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 -Xint jdk.jfr.event.compiler.TestAllocInNewTLAB + * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 jdk.jfr.event.allocation.TestObjectAllocationInNewTLABEvent + * @run main/othervm -XX:+UseTLAB -XX:TLABSize=100k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=1 -Xint jdk.jfr.event.allocation.TestObjectAllocationInNewTLABEvent */ /** @@ -56,56 +53,32 @@ * max TLAB waste at refill is set to minimum (-XX:TLABRefillWasteFraction=1), * to provoke a new TLAB creation. */ -public class TestAllocInNewTLAB { +public class TestObjectAllocationInNewTLABEvent { private final static String EVENT_NAME = EventNames.ObjectAllocationInNewTLAB; private static final int BYTE_ARRAY_OVERHEAD = 16; // Extra bytes used by a byte array. private static final int OBJECT_SIZE = 100 * 1024; - private static final int OBJECT_SIZE_ALT = OBJECT_SIZE + 8; // Object size in case of disabled CompressedOops + private static final int OBJECT_SIZE_ALT = OBJECT_SIZE + 8; // Object size in case of disabled CompressedOops. private static final int OBJECTS_TO_ALLOCATE = 100; private static final String BYTE_ARRAY_CLASS_NAME = new byte[0].getClass().getName(); private static final int INITIAL_TLAB_SIZE = 100 * 1024; + private static int countAllTlabs; // Count all matching tlab allocations. + private static int countFullTlabs; // Count matching tlab allocations with full tlab size. - // make sure allocation isn't dead code eliminated + // Make sure allocation isn't dead code eliminated. public static byte[] tmp; public static void main(String[] args) throws Exception { Recording recording = new Recording(); - recording.enable(EVENT_NAME).withThreshold(Duration.ofMillis(0)); - + recording.enable(EVENT_NAME); recording.start(); System.gc(); - for (int i = 0; i < OBJECTS_TO_ALLOCATE; ++i) { - tmp = new byte[OBJECT_SIZE - BYTE_ARRAY_OVERHEAD]; - } + allocate(); recording.stop(); - - int countAllTlabs = 0; // Count all matching tlab allocations. - int countFullTlabs = 0; // Count matching tlab allocations with full tlab size. - for (RecordedEvent event : Events.fromRecording(recording)) { - if (!EVENT_NAME.equals(event.getEventType().getName())) { - continue; - } - System.out.println("Event:" + event); - - long allocationSize = Events.assertField(event, "allocationSize").atLeast(1L).getValue(); - long tlabSize = Events.assertField(event, "tlabSize").atLeast(allocationSize).getValue(); - String className = Events.assertField(event, "objectClass.name").notEmpty().getValue(); - - boolean isMyEvent = Thread.currentThread().getId() == event.getThread().getJavaThreadId() - && className.equals(BYTE_ARRAY_CLASS_NAME) - && (allocationSize == OBJECT_SIZE || allocationSize == OBJECT_SIZE_ALT); - if (isMyEvent) { - countAllTlabs++; - if (tlabSize == INITIAL_TLAB_SIZE + OBJECT_SIZE || tlabSize == INITIAL_TLAB_SIZE + OBJECT_SIZE_ALT) { - countFullTlabs++; - } - } - } - + verifyRecording(recording); int minCount = (int) floor(OBJECTS_TO_ALLOCATE * 0.80); - assertGreaterThanOrEqual(countAllTlabs, minCount, "Too few tlab objects allocated"); - assertLessThanOrEqual(countAllTlabs, OBJECTS_TO_ALLOCATE, "Too many tlab objects allocated"); + Asserts.assertGreaterThanOrEqual(countAllTlabs, minCount, "Too few tlab objects allocated"); + Asserts.assertLessThanOrEqual(countAllTlabs, OBJECTS_TO_ALLOCATE, "Too many tlab objects allocated"); // For most GCs we expect the size of each tlab to be // INITIAL_TLAB_SIZE + ALLOCATION_SIZE, but that is not always true for G1. @@ -119,7 +92,33 @@ public static void main(String[] args) throws Exception { // It is only the last tlab in each region that has a smaller size. // This means that at least 50% of the allocated tlabs should // have the expected size (1 full tlab, and 1 fractional tlab). - assertGreaterThanOrEqual(2*countFullTlabs, countAllTlabs, "Too many fractional tlabs."); + Asserts.assertGreaterThanOrEqual(2*countFullTlabs, countAllTlabs, "Too many fractional tlabs."); } + private static void allocate() { + for (int i = 0; i < OBJECTS_TO_ALLOCATE; ++i) { + tmp = new byte[OBJECT_SIZE - BYTE_ARRAY_OVERHEAD]; + } + } + + private static void verifyRecording(Recording recording) throws Exception { + for (RecordedEvent event : Events.fromRecording(recording)) { + verify(event); + } + } + + private static void verify(RecordedEvent event) { + if (Thread.currentThread().getId() != event.getThread().getJavaThreadId()) { + return; + } + long allocationSize = Events.assertField(event, "allocationSize").atLeast(1L).getValue(); + long tlabSize = Events.assertField(event, "tlabSize").atLeast(allocationSize).getValue(); + String className = Events.assertField(event, "objectClass.name").notEmpty().getValue(); + if (className.equals(BYTE_ARRAY_CLASS_NAME) && (allocationSize == OBJECT_SIZE || allocationSize == OBJECT_SIZE_ALT)) { + countAllTlabs++; + if (tlabSize == INITIAL_TLAB_SIZE + OBJECT_SIZE || tlabSize == INITIAL_TLAB_SIZE + OBJECT_SIZE_ALT) { + countFullTlabs++; + } + } + } } diff --git a/test/jdk/jdk/jfr/event/compiler/TestAllocOutsideTLAB.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java similarity index 66% rename from test/jdk/jdk/jfr/event/compiler/TestAllocOutsideTLAB.java rename to test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java index ec90d3d6d880a..9efbf4b778a71 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestAllocOutsideTLAB.java +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationOutsideTLABEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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,18 +23,15 @@ * questions. */ -package jdk.jfr.event.compiler; +package jdk.jfr.event.allocation; import static java.lang.Math.floor; -import static jdk.test.lib.Asserts.assertGreaterThanOrEqual; -import static jdk.test.lib.Asserts.assertLessThanOrEqual; - -import java.time.Duration; import jdk.jfr.Recording; import jdk.jfr.consumer.RecordedEvent; import jdk.test.lib.jfr.EventNames; import jdk.test.lib.jfr.Events; +import jdk.test.lib.Asserts; /** * @test @@ -42,8 +39,8 @@ * @key jfr * @requires vm.hasJFR * @library /test/lib - * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 jdk.jfr.event.compiler.TestAllocOutsideTLAB - * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 -Xint jdk.jfr.event.compiler.TestAllocOutsideTLAB + * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 jdk.jfr.event.allocation.TestObjectAllocationOutsideTLABEvent + * @run main/othervm -XX:+UseTLAB -XX:TLABSize=90k -XX:-ResizeTLAB -XX:TLABRefillWasteFraction=256 -Xint jdk.jfr.event.allocation.TestObjectAllocationOutsideTLABEvent */ /** @@ -56,7 +53,7 @@ * max TLAB waste at refill is set to 256 (-XX:TLABRefillWasteFraction=256), * to prevent a new TLAB creation. */ -public class TestAllocOutsideTLAB { +public class TestObjectAllocationOutsideTLABEvent { private static final String EVENT_NAME = EventNames.ObjectAllocationOutsideTLAB; private static final int BYTE_ARRAY_OVERHEAD = 16; // Extra bytes used by a byte array @@ -64,39 +61,43 @@ public class TestAllocOutsideTLAB { private static final int OBJECT_SIZE_ALT = OBJECT_SIZE + 8; // Object size in case of disabled CompressedOops private static final int OBJECTS_TO_ALLOCATE = 100; private static final String BYTE_ARRAY_CLASS_NAME = new byte[0].getClass().getName(); + private static int eventCount; - public static byte[] tmp; // Used to prevent optimizer from removing code. + // Make sure allocation isn't dead code eliminated. + public static byte[] tmp; public static void main(String[] args) throws Exception { Recording recording = new Recording(); - recording.enable(EVENT_NAME).withThreshold(Duration.ofMillis(0)); + recording.enable(EVENT_NAME); recording.start(); + allocate(); + recording.stop(); + verifyRecording(recording); + int minCount = (int) floor(OBJECTS_TO_ALLOCATE * 0.80); + Asserts.assertGreaterThanOrEqual(eventCount, minCount, "Too few objects allocated"); + Asserts.assertLessThanOrEqual(eventCount, OBJECTS_TO_ALLOCATE, "Too many objects allocated"); + } + + private static void allocate() { for (int i = 0; i < OBJECTS_TO_ALLOCATE; ++i) { tmp = new byte[OBJECT_SIZE - BYTE_ARRAY_OVERHEAD]; } - recording.stop(); + } - int countEvents = 0; + private static void verifyRecording(Recording recording) throws Exception { for (RecordedEvent event : Events.fromRecording(recording)) { - if (!EVENT_NAME.equals(event.getEventType().getName())) { - continue; - } - System.out.println("Event:" + event); - - long allocationSize = Events.assertField(event, "allocationSize").atLeast(1L).getValue(); - String className = Events.assertField(event, "objectClass.name").notEmpty().getValue(); - - boolean isMyEvent = Thread.currentThread().getId() == event.getThread().getJavaThreadId() - && className.equals(BYTE_ARRAY_CLASS_NAME) - && (allocationSize == OBJECT_SIZE || allocationSize == OBJECT_SIZE_ALT); - if (isMyEvent) { - ++countEvents; - } + verify(event); } - - int minCount = (int) floor(OBJECTS_TO_ALLOCATE * 0.80); - assertGreaterThanOrEqual(countEvents, minCount, "Too few tlab objects allocated"); - assertLessThanOrEqual(countEvents, OBJECTS_TO_ALLOCATE, "Too many tlab objects allocated"); } + private static void verify(RecordedEvent event) { + if (Thread.currentThread().getId() != event.getThread().getJavaThreadId()) { + return; + } + long allocationSize = Events.assertField(event, "allocationSize").atLeast(1L).getValue(); + String className = Events.assertField(event, "objectClass.name").notEmpty().getValue(); + if (className.equals(BYTE_ARRAY_CLASS_NAME) && (allocationSize == OBJECT_SIZE || allocationSize == OBJECT_SIZE_ALT)) { + ++eventCount; + } + } } diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java new file mode 100644 index 0000000000000..f16d9eedd9f09 --- /dev/null +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEvent.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2020, 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 jdk.jfr.event.allocation; + +import java.util.concurrent.CountDownLatch; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordingStream; +import jdk.test.lib.Asserts; +import jdk.test.lib.jfr.EventNames; +import jdk.test.lib.jfr.Events; + +/** + * @test + * @summary Tests ObjectAllocationSampleEvent + * @key jfr + * @requires vm.hasJFR + * @library /test/lib + * @run main/othervm -XX:+UseTLAB -XX:TLABSize=2k -XX:-ResizeTLAB jdk.jfr.event.allocation.TestObjectAllocationSampleEvent + */ +public class TestObjectAllocationSampleEvent { + private static final String EVENT_NAME = EventNames.ObjectAllocationSample; + private static final int OBJECT_SIZE = 4 * 1024; + private static final int OBJECTS_TO_ALLOCATE = 16; + private static final String BYTE_ARRAY_CLASS_NAME = new byte[0].getClass().getName(); + + // Make sure allocation isn't dead code eliminated. + public static byte[] tmp; + + public static void main(String... args) throws Exception { + CountDownLatch delivered = new CountDownLatch(1); + Thread current = Thread.currentThread(); + try (RecordingStream rs = new RecordingStream()) { + rs.enable(EVENT_NAME); + rs.onEvent(EVENT_NAME, e -> { + if (verify(e, current)) { + delivered.countDown(); + } + }); + rs.startAsync(); + for (int i = 0; i < OBJECTS_TO_ALLOCATE; ++i) { + tmp = new byte[OBJECT_SIZE]; + } + delivered.await(); + } + } + + private static boolean verify(RecordedEvent event, Thread thread) { + if (thread.getId() != event.getThread().getJavaThreadId()) { + return false; + } + if (Events.assertField(event, "objectClass.name").notEmpty().getValue().equals(BYTE_ARRAY_CLASS_NAME)) { + Events.assertField(event, "weight").atLeast(1L); + return true; + } + return false; + } +} diff --git a/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java new file mode 100644 index 0000000000000..1e09441fbdda5 --- /dev/null +++ b/test/jdk/jdk/jfr/event/allocation/TestObjectAllocationSampleEventThrottling.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2020, 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 jdk.jfr.event.allocation; + +import static java.lang.Math.floor; + +import java.util.List; + +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.test.lib.jfr.EventNames; +import jdk.test.lib.jfr.Events; +import jdk.test.lib.Asserts; + +/** + * @test + * @summary Test that when an object is allocated outside a TLAB an event will be triggered. + * @key jfr + * @requires vm.hasJFR + * @library /test/lib +* @run main/othervm -XX:+UseTLAB -XX:TLABSize=2k -XX:-ResizeTLAB jdk.jfr.event.allocation.TestObjectAllocationSampleEventThrottling + */ + +public class TestObjectAllocationSampleEventThrottling { + private static final String EVENT_NAME = EventNames.ObjectAllocationSample; + + private static final int BYTE_ARRAY_OVERHEAD = 16; // Extra bytes used by a byte array + private static final int OBJECT_SIZE = 100 * 1024; + private static final int OBJECT_SIZE_ALT = OBJECT_SIZE + 8; // Object size in case of disabled CompressedOops + private static final int OBJECTS_TO_ALLOCATE = 100; + private static final String BYTE_ARRAY_CLASS_NAME = new byte[0].getClass().getName(); + private static int eventCount; + + // Make sure allocation isn't dead code eliminated. + public static byte[] tmp; + + public static void main(String[] args) throws Exception { + testZeroPerSecond(); + testThrottleSettings(); + } + + private static void testZeroPerSecond() throws Exception { + Recording r1 = new Recording(); + setThrottle(r1, "0/s"); + r1.start(); + allocate(); + r1.stop(); + List events = Events.fromRecording(r1); + Asserts.assertTrue(events.isEmpty(), "throttle rate 0/s should not emit any events"); + } + + private static void testThrottleSettings() throws Exception { + Recording r1 = new Recording(); + // 0/s will not emit any events + setThrottle(r1, "0/s"); + r1.start(); + Recording r2 = new Recording(); + // 1/ns is a *very* high emit rate, it should trump the previous 0/s value + // to allow the allocation sample events to be recorded. + setThrottle(r2, "1/ns"); + r2.start(); + allocate(); + r2.stop(); + r1.stop(); + verifyRecording(r2); + int minCount = (int) floor(OBJECTS_TO_ALLOCATE * 0.80); + Asserts.assertGreaterThanOrEqual(eventCount, minCount, "Too few object samples allocated"); + List events = Events.fromRecording(r1); + Asserts.assertFalse(events.isEmpty(), "r1 should also have events"); + } + + private static void setThrottle(Recording recording, String rate) { + recording.enable(EVENT_NAME).with("throttle", rate); + } + + private static void allocate() { + for (int i = 0; i < OBJECTS_TO_ALLOCATE; ++i) { + tmp = new byte[OBJECT_SIZE - BYTE_ARRAY_OVERHEAD]; + } + } + + private static void verifyRecording(Recording recording) throws Exception { + for (RecordedEvent event : Events.fromRecording(recording)) { + verify(event); + } + } + + private static void verify(RecordedEvent event) { + if (Thread.currentThread().getId() != event.getThread().getJavaThreadId()) { + return; + } + if (Events.assertField(event, "objectClass.name").notEmpty().getValue().equals(BYTE_ARRAY_CLASS_NAME)) { + Events.assertField(event, "weight").atLeast(1L); + ++eventCount; + } + } +} diff --git a/test/lib/jdk/test/lib/jfr/EventNames.java b/test/lib/jdk/test/lib/jfr/EventNames.java index 482de84d32a72..3d383a95301bb 100644 --- a/test/lib/jdk/test/lib/jfr/EventNames.java +++ b/test/lib/jdk/test/lib/jfr/EventNames.java @@ -165,6 +165,7 @@ public class EventNames { public final static String CodeCacheFull = PREFIX + "CodeCacheFull"; public final static String ObjectAllocationInNewTLAB = PREFIX + "ObjectAllocationInNewTLAB"; public final static String ObjectAllocationOutsideTLAB = PREFIX + "ObjectAllocationOutsideTLAB"; + public final static String ObjectAllocationSample = PREFIX + "ObjectAllocationSample"; public final static String Deoptimization = PREFIX + "Deoptimization"; // OS From 0890620c94cd9d0aca6289e85b3980b64cd122ed Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 10 Dec 2020 14:54:40 +0000 Subject: [PATCH 186/504] 8258005: JDK build fails with incorrect fixpath script Co-authored-by: Mikael Vidstedt Reviewed-by: erikj --- make/autoconf/basic_windows.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/autoconf/basic_windows.m4 b/make/autoconf/basic_windows.m4 index 8681442fe612a..a8686e45d8919 100644 --- a/make/autoconf/basic_windows.m4 +++ b/make/autoconf/basic_windows.m4 @@ -158,7 +158,7 @@ AC_DEFUN([BASIC_SETUP_PATHS_WINDOWS], else WINENV_PREFIX_ARG="$WINENV_PREFIX" fi - FIXPATH_ARGS="-e $PATHTOOL -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR -c $CMD -q" + FIXPATH_ARGS="-e $PATHTOOL -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT//\\/\\\\} -t $WINENV_TEMP_DIR -c $CMD -q" FIXPATH_BASE="$BASH $FIXPATH_DIR/fixpath.sh $FIXPATH_ARGS" FIXPATH="$FIXPATH_BASE exec" @@ -203,7 +203,7 @@ AC_DEFUN([BASIC_WINDOWS_FINALIZE_FIXPATH], [ if test "x$OPENJDK_BUILD_OS" = xwindows; then FIXPATH_CMDLINE=". $TOPDIR/make/scripts/fixpath.sh -e $PATHTOOL \ - -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT/\\/\\\\} -t $WINENV_TEMP_DIR \ + -p $WINENV_PREFIX_ARG -r ${WINENV_ROOT//\\/\\\\} -t $WINENV_TEMP_DIR \ -c $CMD -q" $ECHO > $OUTPUTDIR/fixpath '#!/bin/bash' $ECHO >> $OUTPUTDIR/fixpath export PATH='"[$]PATH:'$PATH'"' From 37043b05576c8b81b43ac41a8f06de0d0bbb3f5b Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 10 Dec 2020 15:32:36 +0000 Subject: [PATCH 187/504] 8257837: Performance regression in heap byte buffer views Reviewed-by: chegar, roland --- src/hotspot/share/classfile/vmIntrinsics.hpp | 1 + src/hotspot/share/oops/methodData.cpp | 3 +- .../foreign/LoopOverPollutedBuffer.java | 118 ++++++++++++++++++ 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedBuffer.java diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index 9b6ecde2e3957..d36b3867a885c 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -495,6 +495,7 @@ class methodHandle; /* support for Unsafe */ \ do_class(jdk_internal_misc_Unsafe, "jdk/internal/misc/Unsafe") \ do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \ + do_class(jdk_internal_misc_ScopedMemoryAccess, "jdk/internal/misc/ScopedMemoryAccess") \ \ do_intrinsic(_writeback0, jdk_internal_misc_Unsafe, writeback0_name, long_void_signature , F_RN) \ do_name( writeback0_name, "writeback0") \ diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index a98ec664076e8..02d782b966755 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1586,7 +1586,8 @@ bool MethodData::profile_unsafe(const methodHandle& m, int bci) { Bytecode_invoke inv(m , bci); if (inv.is_invokevirtual()) { if (inv.klass() == vmSymbols::jdk_internal_misc_Unsafe() || - inv.klass() == vmSymbols::sun_misc_Unsafe()) { + inv.klass() == vmSymbols::sun_misc_Unsafe() || + inv.klass() == vmSymbols::jdk_internal_misc_ScopedMemoryAccess()) { ResourceMark rm; char* name = inv.name()->as_C_string(); if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) { diff --git a/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedBuffer.java b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedBuffer.java new file mode 100644 index 0000000000000..3903159c4073f --- /dev/null +++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedBuffer.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2020, 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 org.openjdk.bench.jdk.incubator.foreign; + + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.annotations.Warmup; +import sun.misc.Unsafe; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.util.concurrent.TimeUnit; + +import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(value = 3, jvmArgsAppend = { "--add-modules=jdk.incubator.foreign" }) +public class LoopOverPollutedBuffer { + + static final int ELEM_SIZE = 1_000_000; + static final int CARRIER_SIZE = (int) JAVA_INT.byteSize(); + static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE; + + static final Unsafe unsafe = Utils.unsafe; + + ByteBuffer dbb = ByteBuffer.allocateDirect(ALLOC_SIZE).order(ByteOrder.nativeOrder()); + byte[] arr = new byte[ALLOC_SIZE]; + ByteBuffer hbb = ByteBuffer.wrap(arr).order(ByteOrder.nativeOrder()); + FloatBuffer hfb = hbb.asFloatBuffer(); + + + @Setup + public void setup() { + for (int i = 0; i < ELEM_SIZE; i++) { + dbb.putFloat(i * 4, i); + hbb.putFloat(i * 4, i); + } + for (int i = 0; i < ELEM_SIZE; i++) { + hfb.put(i, i); + } + } + + @TearDown + public void tearDown() { + unsafe.invokeCleaner(dbb); + arr = null; + hbb = null; + hfb = null; + } + + @Benchmark + public int direct_byte_buffer_get_float() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + dbb.putFloat(k, (float)k + 1); + float v = dbb.getFloat(k * 4); + sum += (int)v; + } + return sum; + } + + @Benchmark + public int heap_byte_buffer_get_int() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + hbb.putInt(k, k + 1); + int v = hbb.getInt(k * 4); + sum += v; + } + return sum; + } + + @Benchmark + public int unsafe_get_float() { + int sum = 0; + for (int k = 0; k < ALLOC_SIZE; k += 4) { + unsafe.putFloat(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET, k + 1); + float v = unsafe.getFloat(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET); + sum += (int)v; + } + return sum; + } +} From b35401d6a77275ec68ce8d54b380ee9105a661a8 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Thu, 10 Dec 2020 16:02:25 +0000 Subject: [PATCH 188/504] 8257966: Instrument test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java Reviewed-by: alanb, dfuchs --- .../InheritedChannelTest.java | 10 +- .../inheritedChannel/StateTestService.java | 109 ++++++++++++------ .../inheritedChannel/java.policy.fail | 4 +- .../inheritedChannel/java.policy.pass | 4 +- 4 files changed, 82 insertions(+), 45 deletions(-) diff --git a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java index 2db3480d4d683..f4076af9b0116 100644 --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java @@ -59,7 +59,8 @@ public class InheritedChannelTest { private static final String TEST_SRC = System.getProperty("test.src"); - private static final String TEST_CLASSES = System.getProperty("test.class.path"); + private static final String TEST_CLASSPATH = System.getProperty("test.class.path"); + private static final String TEST_CLASSES = System.getProperty("test.classes"); private static final Path POLICY_PASS = Paths.get(TEST_SRC, "java.policy.pass"); private static final Path POLICY_FAIL = Paths.get(TEST_SRC, "java.policy.fail"); @@ -76,7 +77,7 @@ public Object[][] testCases() { return new Object[][] { { "UnixDomainChannelTest", List.of(UnixDomainChannelTest.class.getName())}, { "UnixSocketTest", List.of(UnixSocketTest.class.getName())}, - { "StateTest", List.of(StateTest.class.getName()) }, + { "StateTest", List.of(StateTest.class.getName(), "-Dtest.classes="+TEST_CLASSES)}, { "EchoTest", List.of(EchoTest.class.getName()) }, { "CloseTest", List.of(CloseTest.class.getName()) }, @@ -85,15 +86,16 @@ public Object[][] testCases() { // These system properties are passed to the launched service as options: // java [-options] class [args...] - { "StateTest run with " + POLICY_PASS, List.of(StateTest.class.getName(), "-Djava.security.manager", + "-Dtest.classes=" + TEST_CLASSES, "-Djava.security.policy=" + POLICY_PASS) }, { "StateTest run with " + POLICY_FAIL, List.of(StateTest.class.getName(), "-expectFail", "-Djava.security.manager", + "-Dtest.classes=" + TEST_CLASSES, "-Djava.security.policy=" + POLICY_FAIL) } @@ -115,7 +117,7 @@ public void test(String desc, List opts) throws Throwable { ProcessBuilder pb = new ProcessBuilder(args); Map env = pb.environment(); - env.put("CLASSPATH", TEST_CLASSES); + env.put("CLASSPATH", TEST_CLASSPATH); env.put(pathVar, libraryPath.toString()); ProcessTools.executeCommand(pb).shouldHaveExitValue(0); diff --git a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java index eac735287099f..002fb4141f9f4 100644 --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/StateTestService.java @@ -38,6 +38,8 @@ * message to indicate the test result. */ import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; @@ -45,6 +47,11 @@ import java.nio.channels.DatagramChannel; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; +import java.nio.file.Files; +import java.nio.file.Path; + +import static java.nio.file.StandardOpenOption.APPEND; +import static java.nio.file.StandardOpenOption.CREATE; public class StateTestService { @@ -52,12 +59,35 @@ public class StateTestService { static int reply_port; static void check(boolean okay) { + println("check " + okay); if (!okay) { failed = true; } } + static String logDir; + static PrintStream out; + static boolean initialized = false; + + // Opens named log file in ${test.classes} + static void initLogFile() { + if (initialized) + return; + + try { + OutputStream f = Files.newOutputStream(Path.of(logDir, "statetest.txt"), APPEND, CREATE); + out = new PrintStream(f); + } catch (Exception e) {} + initialized = true; + } + + static void println(String msg) { + initLogFile(); + out.println(msg); + } + private static void reply(String msg) throws IOException { + println("REPLYING: " + msg); InetSocketAddress isa = new InetSocketAddress(InetAddress.getLocalHost(), reply_port); SocketChannel sc = SocketChannel.open(isa); byte b[] = msg.getBytes("UTF-8"); @@ -67,48 +97,53 @@ private static void reply(String msg) throws IOException { } public static void main(String args[]) throws IOException { - if (args.length == 0) { - System.err.println("Usage: StateTestService [reply-port]"); - return; - } - reply_port = Integer.parseInt(args[0]); - - Channel c = null; try { - c = System.inheritedChannel(); - } catch (SecurityException se) { - // ignore - } - if (c == null) { - reply("FAILED"); - return; - } + if (args.length == 0) { + System.err.println("Usage: StateTestService [reply-port]"); + return; + } + reply_port = Integer.parseInt(args[0]); + logDir = System.getProperty("test.classes"); - if (c instanceof SocketChannel) { - SocketChannel sc = (SocketChannel)c; - check( sc.isBlocking() ); - check( sc.socket().isBound() ); - check( sc.socket().isConnected() ); - } + Channel c = null; + try { + c = System.inheritedChannel(); + } catch (SecurityException se) { + // ignore + } + if (c == null) { + println("c == null"); + reply("FAILED"); + return; + } - if (c instanceof ServerSocketChannel) { - ServerSocketChannel ssc = (ServerSocketChannel)c; - check( ssc.isBlocking() ); - check( ssc.socket().isBound() ); - } + if (c instanceof SocketChannel) { + SocketChannel sc = (SocketChannel)c; + check( sc.isBlocking() ); + check( sc.socket().isBound() ); + check( sc.socket().isConnected() ); + } - if (c instanceof DatagramChannel) { - DatagramChannel dc = (DatagramChannel)c; - check( dc.isBlocking() ); - check( dc.socket().isBound() ); - } + if (c instanceof ServerSocketChannel) { + ServerSocketChannel ssc = (ServerSocketChannel)c; + check( ssc.isBlocking() ); + check( ssc.socket().isBound() ); + } - if (failed) { - reply("FAILED"); - } else { - reply("PASSED"); - } + if (c instanceof DatagramChannel) { + DatagramChannel dc = (DatagramChannel)c; + check( dc.isBlocking() ); + check( dc.socket().isBound() ); + } + if (failed) { + reply("FAILED"); + } else { + reply("PASSED"); + } + } catch (Throwable t) { + t.printStackTrace(out); + throw t; + } } - } diff --git a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.fail b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.fail index 8e04de2860558..f8f1746bfc49c 100644 --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.fail +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.fail @@ -1,6 +1,4 @@ // -// -// // Used by unit tests for System.inheritedChannel() method. This policy // file allows doesn't grant the service the runtime permission needed // to obtain the inherited channel but does grant the socket permission @@ -8,4 +6,6 @@ // grant { permission java.net.SocketPermission "*:1024-", "resolve,connect"; + permission java.io.FilePermission "${test.classes}${/}statetest.txt", "read,write"; + permission java.util.PropertyPermission "test.classes", "read"; }; diff --git a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.pass b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.pass index fc7cf756fa8d8..66a480d2df5b4 100644 --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.pass +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/java.policy.pass @@ -1,6 +1,4 @@ // -// -// // Used by unit tests for System.inheritedChannel() method. This policy // file allows a service to obtain the inherited channel and additionally // allows the service to report a test result over a socket connection. @@ -8,4 +6,6 @@ grant { permission java.lang.RuntimePermission "inheritedChannel"; permission java.net.SocketPermission "*:1024-", "resolve,connect"; + permission java.io.FilePermission "${test.classes}${/}statetest.txt", "read,write"; + permission java.util.PropertyPermission "test.classes", "read"; }; From d163c6fe2ec235a175b62ec821477d33b14841fe Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Thu, 10 Dec 2020 16:16:25 +0000 Subject: [PATCH 189/504] 8258015: [JVMCI] JVMCI_lock shouldn't be held while initializing box classes Reviewed-by: iveresov --- src/hotspot/share/jvmci/jvmci.cpp | 9 +++------ src/hotspot/share/jvmci/jvmci.hpp | 4 ++-- src/hotspot/share/jvmci/jvmciCodeInstaller.cpp | 11 +++++------ src/hotspot/share/jvmci/jvmciCodeInstaller.hpp | 7 ++++++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/hotspot/share/jvmci/jvmci.cpp b/src/hotspot/share/jvmci/jvmci.cpp index f971ffae0d882..46fe89be1ba73 100644 --- a/src/hotspot/share/jvmci/jvmci.cpp +++ b/src/hotspot/share/jvmci/jvmci.cpp @@ -37,7 +37,7 @@ JVMCIRuntime* JVMCI::_compiler_runtime = NULL; JVMCIRuntime* JVMCI::_java_runtime = NULL; volatile bool JVMCI::_is_initialized = false; -volatile bool JVMCI::_box_caches_initialized = false; +bool JVMCI::_box_caches_initialized = false; void* JVMCI::_shared_library_handle = NULL; char* JVMCI::_shared_library_path = NULL; volatile bool JVMCI::_in_shutdown = false; @@ -130,12 +130,9 @@ void JVMCI::ensure_box_caches_initialized(TRAPS) { if (_box_caches_initialized) { return; } - MutexLocker locker(JVMCI_lock); - // Check again after locking - if (_box_caches_initialized) { - return; - } + // While multiple threads may reach here, that's fine + // since class initialization is synchronized. Symbol* box_classes[] = { java_lang_Boolean::symbol(), java_lang_Byte_ByteCache::symbol(), diff --git a/src/hotspot/share/jvmci/jvmci.hpp b/src/hotspot/share/jvmci/jvmci.hpp index 61c0527e37a51..9225dc6e02907 100644 --- a/src/hotspot/share/jvmci/jvmci.hpp +++ b/src/hotspot/share/jvmci/jvmci.hpp @@ -53,8 +53,8 @@ class JVMCI : public AllStatic { // execution has completed successfully. static volatile bool _is_initialized; - // used to synchronize lazy initialization of boxing cache classes. - static volatile bool _box_caches_initialized; + // True once boxing cache classes are guaranteed to be initialized. + static bool _box_caches_initialized; // Handle created when loading the JVMCI shared library with os::dll_load. // Must hold JVMCI_lock when initializing. diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index 0ed9f8d92f794..a08da90870583 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -945,6 +945,10 @@ JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, bo } } #endif + if (_has_auto_box) { + JavaThread* THREAD = JavaThread::current(); + JVMCI::ensure_box_caches_initialized(CHECK_(JVMCI::ok)); + } return JVMCI::ok; } @@ -1022,7 +1026,6 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de } GrowableArray* objects = new GrowableArray(JVMCIENV->get_length(virtualObjects), JVMCIENV->get_length(virtualObjects), NULL); // Create the unique ObjectValues - bool has_auto_box = false; for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) { // HandleMark hm(THREAD); JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i); @@ -1030,7 +1033,7 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de JVMCIObject type = jvmci_env()->get_VirtualObject_type(value); bool is_auto_box = jvmci_env()->get_VirtualObject_isAutoBox(value); if (is_auto_box) { - has_auto_box = true; + _has_auto_box = true; } Klass* klass = jvmci_env()->asKlass(type); oop javaMirror = klass->java_mirror(); @@ -1054,10 +1057,6 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de } _debug_recorder->dump_object_pool(objects); - if (has_auto_box) { - JavaThread* THREAD = JavaThread::current(); - JVMCI::ensure_box_caches_initialized(CHECK_NULL); - } return objects; } diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp index fcdd7febdc112..347dccd209cd9 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp @@ -200,6 +200,7 @@ class CodeInstaller : public StackObj { Dependencies* _dependencies; ExceptionHandlerTable _exception_handler_table; ImplicitExceptionTable _implicit_exception_table; + bool _has_auto_box; bool _immutable_pic_compilation; // Installer is called for Immutable PIC compilation. @@ -230,7 +231,11 @@ class CodeInstaller : public StackObj { public: - CodeInstaller(JVMCIEnv* jvmci_env, bool immutable_pic_compilation) : _arena(mtJVMCI), _jvmci_env(jvmci_env), _immutable_pic_compilation(immutable_pic_compilation) {} + CodeInstaller(JVMCIEnv* jvmci_env, bool immutable_pic_compilation) : + _arena(mtJVMCI), + _jvmci_env(jvmci_env), + _has_auto_box(false), + _immutable_pic_compilation(immutable_pic_compilation) {} #if INCLUDE_AOT JVMCI::CodeInstallResult gather_metadata(JVMCIObject target, JVMCIObject compiled_code, CodeMetadata& metadata, JVMCI_TRAPS); From 6be1f5671eab355c835ca38761ca6e427927bc7f Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 10 Dec 2020 16:46:28 +0000 Subject: [PATCH 190/504] 8257450: Start of release updates for JDK 17 8257451: Add SourceVersion.RELEASE_17 8257453: Add source 17 and target 17 to javac Reviewed-by: dholmes, erikj, iris, mikael, jjg, jlahoda, jwilhelm, mchung, ihse --- make/autoconf/version-numbers | 10 +- make/data/symbols/java.base-G.sym.txt | 1034 ++++++++++++ make/data/symbols/java.compiler-G.sym.txt | 143 ++ make/data/symbols/java.datatransfer-G.sym.txt | 36 + make/data/symbols/java.desktop-G.sym.txt | 1253 ++++++++++++++ make/data/symbols/java.instrument-G.sym.txt | 31 + make/data/symbols/java.logging-G.sym.txt | 63 + make/data/symbols/java.management-G.sym.txt | 269 +++ .../symbols/java.management.rmi-G.sym.txt | 39 + make/data/symbols/java.naming-G.sym.txt | 76 + make/data/symbols/java.net.http-G.sym.txt | 40 + make/data/symbols/java.rmi-G.sym.txt | 52 + make/data/symbols/java.scripting-G.sym.txt | 32 + .../data/symbols/java.security.jgss-G.sym.txt | 69 + .../data/symbols/java.security.sasl-G.sym.txt | 32 + make/data/symbols/java.smartcardio-G.sym.txt | 62 + make/data/symbols/java.sql-G.sym.txt | 60 + make/data/symbols/java.sql.rowset-G.sym.txt | 69 + make/data/symbols/java.xml-G.sym.txt | 150 ++ make/data/symbols/java.xml.crypto-G.sym.txt | 46 + make/data/symbols/jdk.accessibility-G.sym.txt | 44 + make/data/symbols/jdk.attach-G.sym.txt | 55 + make/data/symbols/jdk.compiler-G.sym.txt | 382 +++++ make/data/symbols/jdk.dynalink-G.sym.txt | 136 ++ make/data/symbols/jdk.httpserver-G.sym.txt | 68 + .../symbols/jdk.incubator.foreign-G.sym.txt | 318 ++++ .../symbols/jdk.incubator.jpackage-G.sym.txt | 30 + .../symbols/jdk.incubator.vector-G.sym.txt | 1441 +++++++++++++++++ make/data/symbols/jdk.jartool-G.sym.txt | 39 + make/data/symbols/jdk.javadoc-G.sym.txt | 39 + make/data/symbols/jdk.jconsole-G.sym.txt | 31 + make/data/symbols/jdk.jdi-G.sym.txt | 397 +++++ make/data/symbols/jdk.jfr-G.sym.txt | 50 + make/data/symbols/jdk.jpackage-G.sym.txt | 31 + make/data/symbols/jdk.jshell-G.sym.txt | 108 ++ make/data/symbols/jdk.jsobject-G.sym.txt | 31 + make/data/symbols/jdk.management-G.sym.txt | 49 + .../data/symbols/jdk.management.jfr-G.sym.txt | 58 + make/data/symbols/jdk.net-G.sym.txt | 60 + make/data/symbols/jdk.sctp-G.sym.txt | 73 + make/data/symbols/jdk.security.auth-G.sym.txt | 106 ++ make/data/symbols/jdk.security.jgss-G.sym.txt | 49 + make/data/symbols/jdk.unsupported-G.sym.txt | 52 + make/data/symbols/jdk.xml.dom-G.sym.txt | 295 ++++ make/data/symbols/symbols | 3 +- .../share/classfile/classFileParser.cpp | 2 + .../org/objectweb/asm/ClassReader.java | 2 +- .../internal/org/objectweb/asm/Opcodes.java | 1 + .../javax/lang/model/SourceVersion.java | 14 +- .../AbstractAnnotationValueVisitor14.java | 2 +- .../model/util/AbstractElementVisitor14.java | 2 +- .../model/util/AbstractTypeVisitor14.java | 2 +- .../lang/model/util/ElementKindVisitor14.java | 2 +- .../lang/model/util/ElementScanner14.java | 2 +- .../util/SimpleAnnotationValueVisitor14.java | 2 +- .../model/util/SimpleElementVisitor14.java | 2 +- .../lang/model/util/SimpleTypeVisitor14.java | 2 +- .../lang/model/util/TypeKindVisitor14.java | 2 +- .../com/sun/tools/javac/code/Source.java | 11 +- .../com/sun/tools/javac/jvm/ClassFile.java | 3 +- .../com/sun/tools/javac/jvm/Target.java | 5 +- .../javac/processing/PrintingProcessor.java | 2 +- .../replacements/classfile/Classfile.java | 2 +- .../runtime/modules/sealedP1/SuperClass.jcod | 2 +- .../modules/sealedP1/SuperInterface.jcod | 2 +- .../sealedClasses/GetPermittedSubclasses.jcod | 12 +- .../sealedClasses/Pkg/NotPermitted.jcod | 2 +- .../sealedClasses/Pkg/SealedInterface.jcod | 2 +- .../runtime/sealedClasses/planets/Mars.jcod | 2 +- .../sealedClasses/planets/OuterPlanets.jcod | 2 +- .../lang/module/ClassFileVersionsTest.java | 7 +- .../javac/api/TestGetSourceVersions.java | 4 +- .../javac/classfiles/ClassVersionChecker.java | 5 +- .../lib/JavacTestingAbstractProcessor.java | 18 +- .../classReaderTest/Client.nopreview.out | 2 +- .../classReaderTest/Client.preview.out | 2 +- .../tools/javac/versions/Versions.java | 33 +- 77 files changed, 7607 insertions(+), 59 deletions(-) create mode 100644 make/data/symbols/java.base-G.sym.txt create mode 100644 make/data/symbols/java.compiler-G.sym.txt create mode 100644 make/data/symbols/java.datatransfer-G.sym.txt create mode 100644 make/data/symbols/java.desktop-G.sym.txt create mode 100644 make/data/symbols/java.instrument-G.sym.txt create mode 100644 make/data/symbols/java.logging-G.sym.txt create mode 100644 make/data/symbols/java.management-G.sym.txt create mode 100644 make/data/symbols/java.management.rmi-G.sym.txt create mode 100644 make/data/symbols/java.naming-G.sym.txt create mode 100644 make/data/symbols/java.net.http-G.sym.txt create mode 100644 make/data/symbols/java.rmi-G.sym.txt create mode 100644 make/data/symbols/java.scripting-G.sym.txt create mode 100644 make/data/symbols/java.security.jgss-G.sym.txt create mode 100644 make/data/symbols/java.security.sasl-G.sym.txt create mode 100644 make/data/symbols/java.smartcardio-G.sym.txt create mode 100644 make/data/symbols/java.sql-G.sym.txt create mode 100644 make/data/symbols/java.sql.rowset-G.sym.txt create mode 100644 make/data/symbols/java.xml-G.sym.txt create mode 100644 make/data/symbols/java.xml.crypto-G.sym.txt create mode 100644 make/data/symbols/jdk.accessibility-G.sym.txt create mode 100644 make/data/symbols/jdk.attach-G.sym.txt create mode 100644 make/data/symbols/jdk.compiler-G.sym.txt create mode 100644 make/data/symbols/jdk.dynalink-G.sym.txt create mode 100644 make/data/symbols/jdk.httpserver-G.sym.txt create mode 100644 make/data/symbols/jdk.incubator.foreign-G.sym.txt create mode 100644 make/data/symbols/jdk.incubator.jpackage-G.sym.txt create mode 100644 make/data/symbols/jdk.incubator.vector-G.sym.txt create mode 100644 make/data/symbols/jdk.jartool-G.sym.txt create mode 100644 make/data/symbols/jdk.javadoc-G.sym.txt create mode 100644 make/data/symbols/jdk.jconsole-G.sym.txt create mode 100644 make/data/symbols/jdk.jdi-G.sym.txt create mode 100644 make/data/symbols/jdk.jfr-G.sym.txt create mode 100644 make/data/symbols/jdk.jpackage-G.sym.txt create mode 100644 make/data/symbols/jdk.jshell-G.sym.txt create mode 100644 make/data/symbols/jdk.jsobject-G.sym.txt create mode 100644 make/data/symbols/jdk.management-G.sym.txt create mode 100644 make/data/symbols/jdk.management.jfr-G.sym.txt create mode 100644 make/data/symbols/jdk.net-G.sym.txt create mode 100644 make/data/symbols/jdk.sctp-G.sym.txt create mode 100644 make/data/symbols/jdk.security.auth-G.sym.txt create mode 100644 make/data/symbols/jdk.security.jgss-G.sym.txt create mode 100644 make/data/symbols/jdk.unsupported-G.sym.txt create mode 100644 make/data/symbols/jdk.xml.dom-G.sym.txt diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers index ca9a577244555..7e9313331b8d7 100644 --- a/make/autoconf/version-numbers +++ b/make/autoconf/version-numbers @@ -26,18 +26,18 @@ # Default version, product, and vendor information to use, # unless overridden by configure -DEFAULT_VERSION_FEATURE=16 +DEFAULT_VERSION_FEATURE=17 DEFAULT_VERSION_INTERIM=0 DEFAULT_VERSION_UPDATE=0 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2021-03-16 -DEFAULT_VERSION_CLASSFILE_MAJOR=60 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" +DEFAULT_VERSION_DATE=2021-09-14 +DEFAULT_VERSION_CLASSFILE_MAJOR=61 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 -DEFAULT_ACCEPTABLE_BOOT_VERSIONS="15 16" -DEFAULT_JDK_SOURCE_TARGET_VERSION=16 +DEFAULT_ACCEPTABLE_BOOT_VERSIONS="15 16 17" +DEFAULT_JDK_SOURCE_TARGET_VERSION=17 DEFAULT_PROMOTED_VERSION_PRE=ea LAUNCHER_NAME=openjdk diff --git a/make/data/symbols/java.base-G.sym.txt b/make/data/symbols/java.base-G.sym.txt new file mode 100644 index 0000000000000..54d0245aacbd8 --- /dev/null +++ b/make/data/symbols/java.base-G.sym.txt @@ -0,0 +1,1034 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/io/PrintStream +header extends java/io/FilterOutputStream implements java/lang/Appendable,java/io/Closeable flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 + +class name java/lang/AbstractStringBuilder +header extends java/lang/Object implements java/lang/Appendable,java/lang/CharSequence flags 420 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/Boolean +-method name booleanValue descriptor ()Z +-method name valueOf descriptor (Z)Ljava/lang/Boolean; +method name booleanValue descriptor ()Z flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name valueOf descriptor (Z)Ljava/lang/Boolean; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Byte +-method name valueOf descriptor (B)Ljava/lang/Byte; +-method name byteValue descriptor ()B +method name valueOf descriptor (B)Ljava/lang/Byte; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name byteValue descriptor ()B flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Character +-method name valueOf descriptor (C)Ljava/lang/Character; +-method name charValue descriptor ()C +-method name reverseBytes descriptor (C)C +method name valueOf descriptor (C)Ljava/lang/Character; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name charValue descriptor ()C flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name reverseBytes descriptor (C)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Class +-method name isInstance descriptor (Ljava/lang/Object;)Z +-method name isAssignableFrom descriptor (Ljava/lang/Class;)Z +-method name isInterface descriptor ()Z +-method name isArray descriptor ()Z +-method name isPrimitive descriptor ()Z +-method name getSuperclass descriptor ()Ljava/lang/Class; +-method name getModifiers descriptor ()I +-method name cast descriptor (Ljava/lang/Object;)Ljava/lang/Object; +-method name getRecordComponents descriptor ()[Ljava/lang/reflect/RecordComponent; +-method name isRecord descriptor ()Z +-method name isHidden descriptor ()Z +method name isInstance descriptor (Ljava/lang/Object;)Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name isAssignableFrom descriptor (Ljava/lang/Class;)Z flags 101 signature (Ljava/lang/Class<*>;)Z runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name isInterface descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name isArray descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name isPrimitive descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getSuperclass descriptor ()Ljava/lang/Class; flags 101 signature ()Ljava/lang/Class<-TT;>; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getModifiers descriptor ()I flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getRecordComponents descriptor ()[Ljava/lang/reflect/RecordComponent; flags 1 runtimeAnnotations @Ljdk/internal/reflect/CallerSensitive; +method name isRecord descriptor ()Z flags 1 +method name cast descriptor (Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljava/lang/Object;)TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name isHidden descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Compiler +header extends java/lang/Object flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/lang/Deprecated +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;)@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;CONSTRUCTOR;eLjava/lang/annotation/ElementType;FIELD;eLjava/lang/annotation/ElementType;LOCAL_VARIABLE;eLjava/lang/annotation/ElementType;METHOD;eLjava/lang/annotation/ElementType;PACKAGE;eLjava/lang/annotation/ElementType;MODULE;eLjava/lang/annotation/ElementType;PARAMETER;eLjava/lang/annotation/ElementType;TYPE;}) + +class name java/lang/Double +-method name valueOf descriptor (D)Ljava/lang/Double; +-method name doubleValue descriptor ()D +-method name doubleToLongBits descriptor (D)J +-method name doubleToRawLongBits descriptor (D)J +-method name longBitsToDouble descriptor (J)D +method name valueOf descriptor (D)Ljava/lang/Double; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name doubleValue descriptor ()D flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name doubleToLongBits descriptor (D)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name doubleToRawLongBits descriptor (D)J flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name longBitsToDouble descriptor (J)D flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Float +-method name valueOf descriptor (F)Ljava/lang/Float; +-method name floatValue descriptor ()F +-method name floatToIntBits descriptor (F)I +-method name floatToRawIntBits descriptor (F)I +-method name intBitsToFloat descriptor (I)F +method name valueOf descriptor (F)Ljava/lang/Float; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name floatValue descriptor ()F flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name floatToIntBits descriptor (F)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name floatToRawIntBits descriptor (F)I flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name intBitsToFloat descriptor (I)F flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/IllegalCallerException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/IndexOutOfBoundsException +method name descriptor (J)V flags 1 + +class name java/lang/Integer +-method name toString descriptor (I)Ljava/lang/String; +-method name valueOf descriptor (I)Ljava/lang/Integer; +-method name intValue descriptor ()I +-method name numberOfLeadingZeros descriptor (I)I +-method name numberOfTrailingZeros descriptor (I)I +-method name bitCount descriptor (I)I +-method name reverseBytes descriptor (I)I +method name toString descriptor (I)Ljava/lang/String; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name valueOf descriptor (I)Ljava/lang/Integer; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name intValue descriptor ()I flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name numberOfLeadingZeros descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name numberOfTrailingZeros descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name bitCount descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name reverseBytes descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/LayerInstantiationException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/Long +-method name valueOf descriptor (J)Ljava/lang/Long; +-method name longValue descriptor ()J +-method name numberOfLeadingZeros descriptor (J)I +-method name numberOfTrailingZeros descriptor (J)I +-method name bitCount descriptor (J)I +-method name reverseBytes descriptor (J)J +method name valueOf descriptor (J)Ljava/lang/Long; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name longValue descriptor ()J flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name numberOfLeadingZeros descriptor (J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name numberOfTrailingZeros descriptor (J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name bitCount descriptor (J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name reverseBytes descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Math +-method name signum descriptor (D)D +-method name signum descriptor (F)F +-method name copySign descriptor (DD)D +-method name copySign descriptor (FF)F +-method name sin descriptor (D)D +-method name cos descriptor (D)D +-method name tan descriptor (D)D +-method name exp descriptor (D)D +-method name log descriptor (D)D +-method name log10 descriptor (D)D +-method name sqrt descriptor (D)D +-method name atan2 descriptor (DD)D +-method name pow descriptor (DD)D +-method name addExact descriptor (II)I +-method name addExact descriptor (JJ)J +-method name subtractExact descriptor (II)I +-method name subtractExact descriptor (JJ)J +-method name multiplyExact descriptor (II)I +-method name multiplyExact descriptor (JJ)J +-method name incrementExact descriptor (I)I +-method name incrementExact descriptor (J)J +-method name decrementExact descriptor (I)I +-method name decrementExact descriptor (J)J +-method name negateExact descriptor (I)I +-method name negateExact descriptor (J)J +-method name abs descriptor (D)D +-method name max descriptor (II)I +-method name min descriptor (II)I +-method name fma descriptor (DDD)D +-method name fma descriptor (FFF)F +-method name multiplyHigh descriptor (JJ)J +-method name abs descriptor (I)I +-method name abs descriptor (J)J +-method name abs descriptor (F)F +-method name max descriptor (FF)F +-method name max descriptor (DD)D +-method name min descriptor (FF)F +-method name min descriptor (DD)D +-method name ceil descriptor (D)D +-method name floor descriptor (D)D +-method name rint descriptor (D)D +method name sin descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name cos descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name tan descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name exp descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name log descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name log10 descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name sqrt descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name ceil descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name floor descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name rint descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name atan2 descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name pow descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name addExact descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name addExact descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name subtractExact descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name subtractExact descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name multiplyExact descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name multiplyExact descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name incrementExact descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name incrementExact descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name decrementExact descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name decrementExact descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name negateExact descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name negateExact descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name multiplyHigh descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name abs descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name abs descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name abs descriptor (F)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name abs descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name fma descriptor (DDD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name fma descriptor (FFF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name signum descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name signum descriptor (F)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name copySign descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name copySign descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/NamedPackage +header extends java/lang/Object flags 20 + +class name java/lang/Object +-method name descriptor ()V +-method name getClass descriptor ()Ljava/lang/Class; +-method name hashCode descriptor ()I +-method name clone descriptor ()Ljava/lang/Object; +-method name notify descriptor ()V +-method name notifyAll descriptor ()V +method name descriptor ()V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getClass descriptor ()Ljava/lang/Class; flags 111 signature ()Ljava/lang/Class<*>; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name hashCode descriptor ()I flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name clone descriptor ()Ljava/lang/Object; thrownTypes java/lang/CloneNotSupportedException flags 104 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name notify descriptor ()V flags 111 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name notifyAll descriptor ()V flags 111 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Record +header extends java/lang/Object flags 421 + +class name java/lang/Short +-method name valueOf descriptor (S)Ljava/lang/Short; +-method name shortValue descriptor ()S +-method name reverseBytes descriptor (S)S +method name valueOf descriptor (S)Ljava/lang/Short; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name shortValue descriptor ()S flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name reverseBytes descriptor (S)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/StrictMath +-method name sqrt descriptor (D)D +-method name max descriptor (II)I +-method name min descriptor (II)I +-method name max descriptor (FF)F +-method name max descriptor (DD)D +-method name min descriptor (FF)F +-method name min descriptor (DD)D +method name sqrt descriptor (D)D flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name max descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (II)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (FF)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name min descriptor (DD)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/String +-method name descriptor (Ljava/lang/String;)V +method name descriptor (Ljava/lang/String;)V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/StringBuffer +-method name descriptor ()V +-method name descriptor (I)V +-method name descriptor (Ljava/lang/String;)V +-method name append descriptor (Ljava/lang/String;)Ljava/lang/StringBuffer; +-method name append descriptor (C)Ljava/lang/StringBuffer; +-method name append descriptor (I)Ljava/lang/StringBuffer; +-method name toString descriptor ()Ljava/lang/String; +-method name append descriptor (I)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (C)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (C)Ljava/lang/Appendable; +method name descriptor ()V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (I)V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (Ljava/lang/String;)V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (Ljava/lang/String;)Ljava/lang/StringBuffer; flags 21 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/StringBuffer; flags 21 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (I)Ljava/lang/StringBuffer; flags 21 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name toString descriptor ()Ljava/lang/String; flags 21 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (I)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/Appendable; thrownTypes java/io/IOException flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/StringBuilder +-method name descriptor ()V +-method name descriptor (I)V +-method name descriptor (Ljava/lang/String;)V +-method name append descriptor (Ljava/lang/String;)Ljava/lang/StringBuilder; +-method name append descriptor (C)Ljava/lang/StringBuilder; +-method name append descriptor (I)Ljava/lang/StringBuilder; +-method name toString descriptor ()Ljava/lang/String; +-method name append descriptor (I)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (C)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; +-method name append descriptor (C)Ljava/lang/Appendable; +method name descriptor ()V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (I)V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (Ljava/lang/String;)V flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (Ljava/lang/String;)Ljava/lang/StringBuilder; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/StringBuilder; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (I)Ljava/lang/StringBuilder; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name toString descriptor ()Ljava/lang/String; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (I)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (Ljava/lang/String;)Ljava/lang/AbstractStringBuilder; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name append descriptor (C)Ljava/lang/Appendable; thrownTypes java/io/IOException flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/SuppressWarnings +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;TYPE;eLjava/lang/annotation/ElementType;FIELD;eLjava/lang/annotation/ElementType;METHOD;eLjava/lang/annotation/ElementType;PARAMETER;eLjava/lang/annotation/ElementType;CONSTRUCTOR;eLjava/lang/annotation/ElementType;LOCAL_VARIABLE;eLjava/lang/annotation/ElementType;MODULE;})@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;SOURCE;) + +class name java/lang/System +-method name currentTimeMillis descriptor ()J +-method name nanoTime descriptor ()J +-method name arraycopy descriptor (Ljava/lang/Object;ILjava/lang/Object;II)V +-method name identityHashCode descriptor (Ljava/lang/Object;)I +method name currentTimeMillis descriptor ()J flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name nanoTime descriptor ()J flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name arraycopy descriptor (Ljava/lang/Object;ILjava/lang/Object;II)V flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name identityHashCode descriptor (Ljava/lang/Object;)I flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Thread +-method name currentThread descriptor ()Ljava/lang/Thread; +-method name onSpinWait descriptor ()V +method name currentThread descriptor ()Ljava/lang/Thread; flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name onSpinWait descriptor ()V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/ThreadGroup +-method name isDaemon descriptor ()Z +-method name isDestroyed descriptor ()Z +-method name setDaemon descriptor (Z)V +-method name destroy descriptor ()V +-method name stop descriptor ()V +method name isDaemon descriptor ()Z flags 11 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") +method name isDestroyed descriptor ()Z flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") +method name setDaemon descriptor (Z)V flags 11 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") +method name stop descriptor ()V flags 11 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") +method name destroy descriptor ()V flags 11 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name java/lang/annotation/ElementType +-field name RECORD_COMPONENT descriptor Ljava/lang/annotation/ElementType; +field name RECORD_COMPONENT descriptor Ljava/lang/annotation/ElementType; flags 4019 + +class name java/lang/invoke/CallSite +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/LambdaMetafactory +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/MethodHandle +-method name invokeExact descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name invoke descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +method name invokeExact descriptor ([Ljava/lang/Object;)Ljava/lang/Object; thrownTypes java/lang/Throwable flags 191 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate;@Ljava/lang/invoke/MethodHandle$PolymorphicSignature; +method name invoke descriptor ([Ljava/lang/Object;)Ljava/lang/Object; thrownTypes java/lang/Throwable flags 191 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate;@Ljava/lang/invoke/MethodHandle$PolymorphicSignature; + +class name java/lang/invoke/MethodHandles +method name dropReturn descriptor (Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle; flags 9 +method name classData descriptor (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; thrownTypes java/lang/IllegalAccessException flags 9 signature (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)TT; +method name classDataAt descriptor (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object; thrownTypes java/lang/IllegalAccessException flags 9 signature (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)TT; + +class name java/lang/invoke/MethodHandles$Lookup +field name ORIGINAL descriptor I constantValue 64 flags 19 +method name defineHiddenClassWithClassData descriptor ([BLjava/lang/Object;Z[Ljava/lang/invoke/MethodHandles$Lookup$ClassOption;)Ljava/lang/invoke/MethodHandles$Lookup; thrownTypes java/lang/IllegalAccessException flags 81 + +class name java/lang/invoke/StringConcatException +header extends java/lang/Exception flags 21 + +class name java/lang/invoke/VarHandle +-method name get descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name set descriptor ([Ljava/lang/Object;)V +-method name getVolatile descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name setVolatile descriptor ([Ljava/lang/Object;)V +-method name getOpaque descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name setOpaque descriptor ([Ljava/lang/Object;)V +-method name getAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name setRelease descriptor ([Ljava/lang/Object;)V +-method name compareAndSet descriptor ([Ljava/lang/Object;)Z +-method name compareAndExchange descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name compareAndExchangeAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name compareAndExchangeRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name weakCompareAndSetPlain descriptor ([Ljava/lang/Object;)Z +-method name weakCompareAndSet descriptor ([Ljava/lang/Object;)Z +-method name weakCompareAndSetAcquire descriptor ([Ljava/lang/Object;)Z +-method name weakCompareAndSetRelease descriptor ([Ljava/lang/Object;)Z +-method name getAndSet descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndSetAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndSetRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndAdd descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndAddAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndAddRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseOr descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseOrAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseOrRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseAnd descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseAndAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseAndRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseXor descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseXorAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +-method name getAndBitwiseXorRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; +method name hasInvokeExactBehavior descriptor ()Z flags 1 +method name get descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name set descriptor ([Ljava/lang/Object;)V flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getVolatile descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name setVolatile descriptor ([Ljava/lang/Object;)V flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getOpaque descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name setOpaque descriptor ([Ljava/lang/Object;)V flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name setRelease descriptor ([Ljava/lang/Object;)V flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name compareAndSet descriptor ([Ljava/lang/Object;)Z flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name compareAndExchange descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name compareAndExchangeAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name compareAndExchangeRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name weakCompareAndSetPlain descriptor ([Ljava/lang/Object;)Z flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name weakCompareAndSet descriptor ([Ljava/lang/Object;)Z flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name weakCompareAndSetAcquire descriptor ([Ljava/lang/Object;)Z flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name weakCompareAndSetRelease descriptor ([Ljava/lang/Object;)Z flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndSet descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndSetAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndSetRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndAdd descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndAddAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndAddRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseOr descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseOrAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseOrRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseAnd descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseAndAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseAndRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseXor descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseXorAcquire descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getAndBitwiseXorRelease descriptor ([Ljava/lang/Object;)Ljava/lang/Object; flags 191 runtimeAnnotations @Ljava/lang/invoke/MethodHandle$PolymorphicSignature;@Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name withInvokeExactBehavior descriptor ()Ljava/lang/invoke/VarHandle; flags 401 +method name withInvokeBehavior descriptor ()Ljava/lang/invoke/VarHandle; flags 401 + +class name java/lang/module/Configuration +header extends java/lang/Object flags 31 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/module/FindException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/module/InvalidModuleDescriptorException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/module/ModuleReader +header extends java/lang/Object implements java/io/Closeable flags 601 + +class name java/lang/module/ModuleReference +header extends java/lang/Object flags 421 + +class name java/lang/module/ResolutionException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/module/ResolvedModule +header extends java/lang/Object flags 31 + +class name java/lang/ref/Reference +-method name get descriptor ()Ljava/lang/Object; +method name get descriptor ()Ljava/lang/Object; flags 1 signature ()TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name refersTo descriptor (Ljava/lang/Object;)Z flags 11 signature (TT;)Z + +class name java/lang/reflect/AccessibleObject +header extends java/lang/Object implements java/lang/reflect/AnnotatedElement flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/reflect/AnnotatedElement +header extends java/lang/Object flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/reflect/Array +-method name getLength descriptor (Ljava/lang/Object;)I +method name getLength descriptor (Ljava/lang/Object;)I thrownTypes java/lang/IllegalArgumentException flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/reflect/InaccessibleObjectException +header extends java/lang/RuntimeException flags 21 + +class name java/lang/reflect/InvocationHandler +method name invokeDefault descriptor (Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; thrownTypes java/lang/Throwable flags 89 runtimeAnnotations @Ljdk/internal/reflect/CallerSensitive; + +class name java/lang/reflect/Method +-method name invoke descriptor (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; +method name invoke descriptor (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; thrownTypes java/lang/IllegalAccessException,java/lang/IllegalArgumentException,java/lang/reflect/InvocationTargetException flags 81 runtimeAnnotations @Ljdk/internal/reflect/CallerSensitive;@Ljdk/internal/vm/annotation/ForceInline;@Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/reflect/RecordComponent +header extends java/lang/Object implements java/lang/reflect/AnnotatedElement flags 31 + +class name java/lang/runtime/ObjectMethods +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/StandardProtocolFamily +field name UNIX descriptor Ljava/net/StandardProtocolFamily; flags 4019 + +class name java/net/URLDecoder +-method name descriptor ()V +method name descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name java/net/UnixDomainSocketAddress +header extends java/net/SocketAddress flags 31 +method name of descriptor (Ljava/lang/String;)Ljava/net/UnixDomainSocketAddress; flags 9 +method name of descriptor (Ljava/nio/file/Path;)Ljava/net/UnixDomainSocketAddress; flags 9 +method name getPath descriptor ()Ljava/nio/file/Path; flags 1 +method name hashCode descriptor ()I flags 1 +method name equals descriptor (Ljava/lang/Object;)Z flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name java/net/spi/URLStreamHandlerProvider +header extends java/lang/Object implements java/net/URLStreamHandlerFactory flags 421 + +class name java/nio/ByteBuffer +method name put descriptor (ILjava/nio/ByteBuffer;II)Ljava/nio/ByteBuffer; flags 1 + +class name java/nio/CharBuffer +header extends java/nio/Buffer implements java/lang/Comparable,java/lang/Appendable,java/lang/CharSequence,java/lang/Readable flags 421 signature Ljava/nio/Buffer;Ljava/lang/Comparable;Ljava/lang/Appendable;Ljava/lang/CharSequence;Ljava/lang/Readable; +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name put descriptor (ILjava/nio/CharBuffer;II)Ljava/nio/CharBuffer; flags 1 + +class name java/nio/DoubleBuffer +method name put descriptor (ILjava/nio/DoubleBuffer;II)Ljava/nio/DoubleBuffer; flags 1 + +class name java/nio/FloatBuffer +method name put descriptor (ILjava/nio/FloatBuffer;II)Ljava/nio/FloatBuffer; flags 1 + +class name java/nio/IntBuffer +method name put descriptor (ILjava/nio/IntBuffer;II)Ljava/nio/IntBuffer; flags 1 + +class name java/nio/LongBuffer +method name put descriptor (ILjava/nio/LongBuffer;II)Ljava/nio/LongBuffer; flags 1 + +class name java/nio/ShortBuffer +method name put descriptor (ILjava/nio/ShortBuffer;II)Ljava/nio/ShortBuffer; flags 1 + +class name java/security/Certificate +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/Identity +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 421 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.2") + +class name java/security/SecureRandomParameters +header extends java/lang/Object flags 601 + +class name java/security/SignedObject +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name java/security/cert/CertificateRevokedException +header extends java/security/cert/CertificateException flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/security/cert/URICertStoreParameters +header extends java/lang/Object implements java/security/cert/CertStoreParameters flags 31 + +class name java/security/cert/X509CRL +-method name getIssuerDN descriptor ()Ljava/security/Principal; +method name getIssuerDN descriptor ()Ljava/security/Principal; flags 401 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") + +class name java/security/cert/X509CRLSelector +-method name addIssuerName descriptor (Ljava/lang/String;)V +method name addIssuerName descriptor (Ljava/lang/String;)V thrownTypes java/io/IOException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") + +class name java/security/cert/X509CertSelector +-method name setIssuer descriptor (Ljava/lang/String;)V +-method name setSubject descriptor (Ljava/lang/String;)V +-method name getIssuerAsString descriptor ()Ljava/lang/String; +-method name getSubjectAsString descriptor ()Ljava/lang/String; +method name setIssuer descriptor (Ljava/lang/String;)V thrownTypes java/io/IOException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name setSubject descriptor (Ljava/lang/String;)V thrownTypes java/io/IOException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getIssuerAsString descriptor ()Ljava/lang/String; flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getSubjectAsString descriptor ()Ljava/lang/String; flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") + +class name java/security/cert/X509Certificate +-method name getIssuerDN descriptor ()Ljava/security/Principal; +-method name getSubjectDN descriptor ()Ljava/security/Principal; +method name getIssuerDN descriptor ()Ljava/security/Principal; flags 401 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getSubjectDN descriptor ()Ljava/security/Principal; flags 401 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") + +class name java/security/interfaces/RSAKey +-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; +method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1 + +class name java/security/spec/MGF1ParameterSpec +-field name SHA512_224 descriptor Ljava/security/spec/MGF1ParameterSpec; +-field name SHA512_256 descriptor Ljava/security/spec/MGF1ParameterSpec; +field name SHA512_224 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +field name SHA512_256 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +field name SHA3_224 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +field name SHA3_256 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +field name SHA3_384 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +field name SHA3_512 descriptor Ljava/security/spec/MGF1ParameterSpec; flags 19 +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name java/security/spec/PSSParameterSpec +-field name TRAILER_FIELD_BC descriptor I +field name TRAILER_FIELD_BC descriptor I constantValue 1 flags 19 +-method name toString descriptor ()Ljava/lang/String; +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name java/security/spec/RSAKeyGenParameterSpec +-method name descriptor (ILjava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V +-method name getKeyParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; +method name descriptor (ILjava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1 +method name getKeyParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1 + +class name java/security/spec/RSAMultiPrimePrivateCrtKeySpec +-method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;[Ljava/security/spec/RSAOtherPrimeInfo;Ljava/security/spec/AlgorithmParameterSpec;)V +method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;[Ljava/security/spec/RSAOtherPrimeInfo;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1 + +class name java/security/spec/RSAPrivateCrtKeySpec +-method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V +method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1 + +class name java/security/spec/RSAPrivateKeySpec +-method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V +-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; +method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1 +method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1 + +class name java/security/spec/RSAPublicKeySpec +-method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V +-method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; +method name descriptor (Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/security/spec/AlgorithmParameterSpec;)V flags 1 +method name getParams descriptor ()Ljava/security/spec/AlgorithmParameterSpec; flags 1 + +class name java/text/DateFormatSymbols +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 + +class name java/text/RuleBasedCollator +header extends java/text/Collator flags 21 +innerclass innerClass java/text/Normalizer$Form outerClass java/text/Normalizer innerClassName Form flags 4019 + +class name java/time/chrono/ChronoLocalDate +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/chrono/ChronoLocalDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;>; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/format/DateTimeFormatterBuilder +method name appendDayPeriodText descriptor (Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder; flags 1 + +class name java/time/format/DecimalStyle +header extends java/lang/Object flags 31 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 + +class name java/time/temporal/TemporalAdjusters +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/Arrays +-method name equals descriptor ([C[C)Z +-method name equals descriptor ([B[B)Z +-method name copyOf descriptor ([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object; +-method name copyOfRange descriptor ([Ljava/lang/Object;IILjava/lang/Class;)[Ljava/lang/Object; +method name equals descriptor ([C[C)Z flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name equals descriptor ([B[B)Z flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name copyOf descriptor ([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object; flags 9 signature ([TU;ILjava/lang/Class<+[TT;>;)[TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name copyOfRange descriptor ([Ljava/lang/Object;IILjava/lang/Class;)[Ljava/lang/Object; flags 9 signature ([TU;IILjava/lang/Class<+[TT;>;)[TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/util/Comparator +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/DoubleSummaryStatistics +header extends java/lang/Object implements java/util/function/DoubleConsumer flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/GregorianCalendar +header extends java/util/Calendar flags 21 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 + +class name java/util/HashSet +header extends java/util/AbstractSet implements java/util/Set,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/util/AbstractSet;Ljava/util/Set;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/util/Objects +method name checkIndex descriptor (JJ)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name checkFromToIndex descriptor (JJJ)J flags 9 +method name checkFromIndexSize descriptor (JJJ)J flags 9 + +class name java/util/Observable +header extends java/lang/Object flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/util/Observer +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/util/TimeZone +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 + +class name java/util/TreeSet +header extends java/util/AbstractSet implements java/util/NavigableSet,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/util/AbstractSet;Ljava/util/NavigableSet;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/util/concurrent/ConcurrentMap +header extends java/lang/Object implements java/util/Map flags 601 signature Ljava/lang/Object;Ljava/util/Map; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/ConcurrentSkipListSet +header extends java/util/AbstractSet implements java/util/NavigableSet,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/util/AbstractSet;Ljava/util/NavigableSet;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/CountedCompleter +header extends java/util/concurrent/ForkJoinTask flags 421 signature Ljava/util/concurrent/ForkJoinTask; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/atomic/AtomicBoolean +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/atomic/AtomicReference +header extends java/lang/Object implements java/io/Serializable flags 21 signature Ljava/lang/Object;Ljava/io/Serializable; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/atomic/AtomicReferenceArray +header extends java/lang/Object implements java/io/Serializable flags 21 signature Ljava/lang/Object;Ljava/io/Serializable; +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/locks/StampedLock +header extends java/lang/Object implements java/io/Serializable flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I1) +-method name tryWriteLock descriptor ()J +-method name writeLockInterruptibly descriptor ()J +-method name tryReadLock descriptor ()J +-method name tryReadLock descriptor (JLjava/util/concurrent/TimeUnit;)J +-method name readLockInterruptibly descriptor ()J +-method name unlock descriptor (J)V +method name tryWriteLock descriptor ()J flags 1 +method name writeLockInterruptibly descriptor ()J thrownTypes java/lang/InterruptedException flags 1 +method name tryReadLock descriptor ()J flags 1 +method name tryReadLock descriptor (JLjava/util/concurrent/TimeUnit;)J thrownTypes java/lang/InterruptedException flags 1 +method name readLockInterruptibly descriptor ()J thrownTypes java/lang/InterruptedException flags 1 +method name unlock descriptor (J)V flags 1 + +class name java/util/function/BiConsumer +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/BiFunction +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/BiPredicate +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/BinaryOperator +header extends java/lang/Object implements java/util/function/BiFunction flags 601 signature Ljava/lang/Object;Ljava/util/function/BiFunction; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/Consumer +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/DoubleConsumer +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/DoublePredicate +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/DoubleUnaryOperator +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/Function +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/IntConsumer +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/IntPredicate +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/IntUnaryOperator +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/LongConsumer +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/LongPredicate +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/LongUnaryOperator +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/Predicate +header extends java/lang/Object flags 601 signature Ljava/lang/Object; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/function/UnaryOperator +header extends java/lang/Object implements java/util/function/Function flags 601 signature Ljava/lang/Object;Ljava/util/function/Function; runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/spi/AbstractResourceBundleProvider +header extends java/lang/Object implements java/util/spi/ResourceBundleProvider flags 421 +innerclass innerClass java/util/ResourceBundle$Control outerClass java/util/ResourceBundle innerClassName Control flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/spi/CurrencyNameProvider +header extends java/util/spi/LocaleServiceProvider flags 421 +innerclass innerClass java/util/ResourceBundle$Control outerClass java/util/ResourceBundle innerClassName Control flags 9 + +class name java/util/spi/ResourceBundleProvider +header extends java/lang/Object flags 601 + +class name java/util/spi/ToolProvider +header extends java/lang/Object flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/stream/DoubleStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/DoubleStream$DoubleMapMultiConsumer,java/util/stream/DoubleStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/stream/DoubleStream$DoubleMapMultiConsumer outerClass java/util/stream/DoubleStream innerClassName DoubleMapMultiConsumer flags 609 +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfDouble outerClass java/util/PrimitiveIterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/stream/DoubleStream$Builder outerClass java/util/stream/DoubleStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name mapMulti descriptor (Ljava/util/stream/DoubleStream$DoubleMapMultiConsumer;)Ljava/util/stream/DoubleStream; flags 1 + +class name java/util/stream/DoubleStream$DoubleMapMultiConsumer +header extends java/lang/Object nestHost java/util/stream/DoubleStream flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/util/stream/DoubleStream$DoubleMapMultiConsumer outerClass java/util/stream/DoubleStream innerClassName DoubleMapMultiConsumer flags 609 +method name accept descriptor (DLjava/util/function/DoubleConsumer;)V flags 401 + +class name java/util/stream/IntStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/IntStream$IntMapMultiConsumer,java/util/stream/IntStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/stream/IntStream$IntMapMultiConsumer outerClass java/util/stream/IntStream innerClassName IntMapMultiConsumer flags 609 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfInt outerClass java/util/PrimitiveIterator innerClassName OfInt flags 609 +innerclass innerClass java/util/stream/IntStream$Builder outerClass java/util/stream/IntStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name mapMulti descriptor (Ljava/util/stream/IntStream$IntMapMultiConsumer;)Ljava/util/stream/IntStream; flags 1 + +class name java/util/stream/IntStream$IntMapMultiConsumer +header extends java/lang/Object nestHost java/util/stream/IntStream flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/util/stream/IntStream$IntMapMultiConsumer outerClass java/util/stream/IntStream innerClassName IntMapMultiConsumer flags 609 +method name accept descriptor (ILjava/util/function/IntConsumer;)V flags 401 + +class name java/util/stream/LongStream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/LongStream$LongMapMultiConsumer,java/util/stream/LongStream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream; +innerclass innerClass java/util/stream/LongStream$LongMapMultiConsumer outerClass java/util/stream/LongStream innerClassName LongMapMultiConsumer flags 609 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/PrimitiveIterator$OfLong outerClass java/util/PrimitiveIterator innerClassName OfLong flags 609 +innerclass innerClass java/util/stream/LongStream$Builder outerClass java/util/stream/LongStream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name mapMulti descriptor (Ljava/util/stream/LongStream$LongMapMultiConsumer;)Ljava/util/stream/LongStream; flags 1 + +class name java/util/stream/LongStream$LongMapMultiConsumer +header extends java/lang/Object nestHost java/util/stream/LongStream flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; +innerclass innerClass java/util/stream/LongStream$LongMapMultiConsumer outerClass java/util/stream/LongStream innerClassName LongMapMultiConsumer flags 609 +method name accept descriptor (JLjava/util/function/LongConsumer;)V flags 401 + +class name java/util/stream/Stream +header extends java/lang/Object implements java/util/stream/BaseStream nestMembers java/util/stream/Stream$Builder flags 601 signature Ljava/lang/Object;Ljava/util/stream/BaseStream;>; +innerclass innerClass java/util/Spliterator$OfDouble outerClass java/util/Spliterator innerClassName OfDouble flags 609 +innerclass innerClass java/util/Spliterator$OfLong outerClass java/util/Spliterator innerClassName OfLong flags 609 +innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterator innerClassName OfInt flags 609 +innerclass innerClass java/util/stream/Stream$Builder outerClass java/util/stream/Stream innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name mapMulti descriptor (Ljava/util/function/BiConsumer;)Ljava/util/stream/Stream; flags 1 signature (Ljava/util/function/BiConsumer<-TT;-Ljava/util/function/Consumer;>;)Ljava/util/stream/Stream; +method name mapMultiToInt descriptor (Ljava/util/function/BiConsumer;)Ljava/util/stream/IntStream; flags 1 signature (Ljava/util/function/BiConsumer<-TT;-Ljava/util/function/IntConsumer;>;)Ljava/util/stream/IntStream; +method name mapMultiToLong descriptor (Ljava/util/function/BiConsumer;)Ljava/util/stream/LongStream; flags 1 signature (Ljava/util/function/BiConsumer<-TT;-Ljava/util/function/LongConsumer;>;)Ljava/util/stream/LongStream; +method name mapMultiToDouble descriptor (Ljava/util/function/BiConsumer;)Ljava/util/stream/DoubleStream; flags 1 signature (Ljava/util/function/BiConsumer<-TT;-Ljava/util/function/DoubleConsumer;>;)Ljava/util/stream/DoubleStream; +method name toList descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List; + +class name java/util/zip/CRC32C +header extends java/lang/Object implements java/util/zip/Checksum flags 31 + +class name javax/crypto/AEADBadTagException +header extends javax/crypto/BadPaddingException flags 21 + +class name javax/crypto/BadPaddingException +header extends java/security/GeneralSecurityException flags 21 + +class name javax/crypto/CipherInputStream +header extends java/io/FilterInputStream flags 21 + +class name javax/crypto/CipherOutputStream +header extends java/io/FilterOutputStream flags 21 + +class name javax/crypto/CipherSpi +header extends java/lang/Object flags 421 + +class name javax/crypto/EncryptedPrivateKeyInfo +header extends java/lang/Object flags 21 + +class name javax/crypto/ExemptionMechanism +header extends java/lang/Object flags 21 + +class name javax/crypto/ExemptionMechanismException +header extends java/security/GeneralSecurityException flags 21 + +class name javax/crypto/ExemptionMechanismSpi +header extends java/lang/Object flags 421 + +class name javax/crypto/IllegalBlockSizeException +header extends java/security/GeneralSecurityException flags 21 + +class name javax/crypto/KeyAgreement +header extends java/lang/Object flags 21 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 + +class name javax/crypto/KeyAgreementSpi +header extends java/lang/Object flags 421 + +class name javax/crypto/KeyGenerator +header extends java/lang/Object flags 21 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 + +class name javax/crypto/KeyGeneratorSpi +header extends java/lang/Object flags 421 + +class name javax/crypto/Mac +header extends java/lang/Object implements java/lang/Cloneable flags 21 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 + +class name javax/crypto/MacSpi +header extends java/lang/Object flags 421 + +class name javax/crypto/NoSuchPaddingException +header extends java/security/GeneralSecurityException flags 21 + +class name javax/crypto/NullCipher +header extends javax/crypto/Cipher flags 21 + +class name javax/crypto/SealedObject +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/crypto/SecretKey +header extends java/lang/Object implements java/security/Key,javax/security/auth/Destroyable flags 601 + +class name javax/crypto/SecretKeyFactory +header extends java/lang/Object flags 21 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 + +class name javax/crypto/SecretKeyFactorySpi +header extends java/lang/Object flags 421 + +class name javax/crypto/ShortBufferException +header extends java/security/GeneralSecurityException flags 21 + +class name javax/crypto/interfaces/DHKey +header extends java/lang/Object flags 601 + +class name javax/crypto/interfaces/DHPrivateKey +header extends java/lang/Object implements javax/crypto/interfaces/DHKey,java/security/PrivateKey flags 601 + +class name javax/crypto/interfaces/DHPublicKey +header extends java/lang/Object implements javax/crypto/interfaces/DHKey,java/security/PublicKey flags 601 + +class name javax/crypto/interfaces/PBEKey +header extends java/lang/Object implements javax/crypto/SecretKey flags 601 + +class name javax/crypto/spec/DESKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec flags 21 + +class name javax/crypto/spec/DESedeKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec flags 21 + +class name javax/crypto/spec/DHGenParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/DHParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/DHPrivateKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec flags 21 + +class name javax/crypto/spec/DHPublicKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec flags 21 + +class name javax/crypto/spec/GCMParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/IvParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/OAEPParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 +innerclass innerClass javax/crypto/spec/PSource$PSpecified outerClass javax/crypto/spec/PSource innerClassName PSpecified flags 19 + +class name javax/crypto/spec/PBEKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec flags 21 + +class name javax/crypto/spec/PBEParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/RC2ParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/RC5ParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 21 + +class name javax/crypto/spec/SecretKeySpec +header extends java/lang/Object implements java/security/spec/KeySpec,javax/crypto/SecretKey flags 21 + diff --git a/make/data/symbols/java.compiler-G.sym.txt b/make/data/symbols/java.compiler-G.sym.txt new file mode 100644 index 0000000000000..1fdb4f4409ae1 --- /dev/null +++ b/make/data/symbols/java.compiler-G.sym.txt @@ -0,0 +1,143 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/annotation/processing/AbstractProcessor +header extends java/lang/Object implements javax/annotation/processing/Processor flags 421 +innerclass innerClass javax/tools/Diagnostic$Kind outerClass javax/tools/Diagnostic innerClassName Kind flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/annotation/processing/Generated +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;SOURCE;)@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;PACKAGE;eLjava/lang/annotation/ElementType;TYPE;eLjava/lang/annotation/ElementType;METHOD;eLjava/lang/annotation/ElementType;CONSTRUCTOR;eLjava/lang/annotation/ElementType;FIELD;eLjava/lang/annotation/ElementType;LOCAL_VARIABLE;eLjava/lang/annotation/ElementType;PARAMETER;}) + +class name javax/lang/model/SourceVersion +field name RELEASE_16 descriptor Ljavax/lang/model/SourceVersion; flags 4019 + +class name javax/lang/model/element/ElementKind +-field name RECORD descriptor Ljavax/lang/model/element/ElementKind; +-field name RECORD_COMPONENT descriptor Ljavax/lang/model/element/ElementKind; +-field name BINDING_VARIABLE descriptor Ljavax/lang/model/element/ElementKind; +field name RECORD descriptor Ljavax/lang/model/element/ElementKind; flags 4019 +field name RECORD_COMPONENT descriptor Ljavax/lang/model/element/ElementKind; flags 4019 +field name BINDING_VARIABLE descriptor Ljavax/lang/model/element/ElementKind; flags 4019 + +class name javax/lang/model/element/ElementVisitor +-method name visitRecordComponent descriptor (Ljavax/lang/model/element/RecordComponentElement;Ljava/lang/Object;)Ljava/lang/Object; +method name visitRecordComponent descriptor (Ljavax/lang/model/element/RecordComponentElement;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljavax/lang/model/element/RecordComponentElement;TP;)TR; + +class name javax/lang/model/element/RecordComponentElement +header extends java/lang/Object implements javax/lang/model/element/Element flags 601 + +class name javax/lang/model/element/TypeElement +-method name getRecordComponents descriptor ()Ljava/util/List; +method name getRecordComponents descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List<+Ljavax/lang/model/element/RecordComponentElement;>; + +class name javax/lang/model/element/UnknownAnnotationValueException +header extends javax/lang/model/UnknownEntityException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/element/UnknownDirectiveException +header extends javax/lang/model/UnknownEntityException flags 21 +innerclass innerClass javax/lang/model/element/ModuleElement$Directive outerClass javax/lang/model/element/ModuleElement innerClassName Directive flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/element/UnknownElementException +header extends javax/lang/model/UnknownEntityException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/type/MirroredTypeException +header extends javax/lang/model/type/MirroredTypesException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/type/MirroredTypesException +header extends java/lang/RuntimeException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/type/UnknownTypeException +header extends javax/lang/model/UnknownEntityException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/lang/model/util/AbstractAnnotationValueVisitor14 +header extends javax/lang/model/util/AbstractAnnotationValueVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractAnnotationValueVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/AbstractElementVisitor14 +header extends javax/lang/model/util/AbstractElementVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractElementVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/AbstractTypeVisitor14 +header extends javax/lang/model/util/AbstractTypeVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/AbstractTypeVisitor6 +header extends java/lang/Object implements javax/lang/model/type/TypeVisitor flags 421 signature Ljava/lang/Object;Ljavax/lang/model/type/TypeVisitor; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_6;) + +class name javax/lang/model/util/AbstractTypeVisitor7 +header extends javax/lang/model/util/AbstractTypeVisitor6 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor6; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_7;) + +class name javax/lang/model/util/AbstractTypeVisitor8 +header extends javax/lang/model/util/AbstractTypeVisitor7 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor7; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_8;) + +class name javax/lang/model/util/ElementFilter +-method name recordComponentsIn descriptor (Ljava/lang/Iterable;)Ljava/util/List; +-method name recordComponentsIn descriptor (Ljava/util/Set;)Ljava/util/Set; +method name recordComponentsIn descriptor (Ljava/lang/Iterable;)Ljava/util/List; flags 9 signature (Ljava/lang/Iterable<+Ljavax/lang/model/element/Element;>;)Ljava/util/List; +method name recordComponentsIn descriptor (Ljava/util/Set;)Ljava/util/Set; flags 9 signature (Ljava/util/Set<+Ljavax/lang/model/element/Element;>;)Ljava/util/Set; + +class name javax/lang/model/util/ElementKindVisitor14 +header extends javax/lang/model/util/ElementKindVisitor9 flags 21 signature Ljavax/lang/model/util/ElementKindVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/ElementKindVisitor6 +-method name visitTypeAsRecord descriptor (Ljavax/lang/model/element/TypeElement;Ljava/lang/Object;)Ljava/lang/Object; +method name visitTypeAsRecord descriptor (Ljavax/lang/model/element/TypeElement;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljavax/lang/model/element/TypeElement;TP;)TR; + +class name javax/lang/model/util/ElementScanner14 +header extends javax/lang/model/util/ElementScanner9 flags 21 signature Ljavax/lang/model/util/ElementScanner9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/Elements +-method name recordComponentFor descriptor (Ljavax/lang/model/element/ExecutableElement;)Ljavax/lang/model/element/RecordComponentElement; +method name recordComponentFor descriptor (Ljavax/lang/model/element/ExecutableElement;)Ljavax/lang/model/element/RecordComponentElement; flags 1 + +class name javax/lang/model/util/SimpleAnnotationValueVisitor14 +header extends javax/lang/model/util/SimpleAnnotationValueVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleAnnotationValueVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/SimpleElementVisitor14 +header extends javax/lang/model/util/SimpleElementVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleElementVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/SimpleTypeVisitor14 +header extends javax/lang/model/util/SimpleTypeVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleTypeVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/lang/model/util/TypeKindVisitor14 +header extends javax/lang/model/util/TypeKindVisitor9 flags 21 signature Ljavax/lang/model/util/TypeKindVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_16;) + +class name javax/tools/SimpleJavaFileObject +header extends java/lang/Object implements javax/tools/JavaFileObject flags 21 +innerclass innerClass javax/tools/JavaFileObject$Kind outerClass javax/tools/JavaFileObject innerClassName Kind flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/tools/ToolProvider +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name descriptor ()V + diff --git a/make/data/symbols/java.datatransfer-G.sym.txt b/make/data/symbols/java.datatransfer-G.sym.txt new file mode 100644 index 0000000000000..51008b6e51c6a --- /dev/null +++ b/make/data/symbols/java.datatransfer-G.sym.txt @@ -0,0 +1,36 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/awt/datatransfer/Clipboard +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/datatransfer/DataFlavor +header extends java/lang/Object implements java/io/Externalizable,java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.desktop-G.sym.txt b/make/data/symbols/java.desktop-G.sym.txt new file mode 100644 index 0000000000000..5b20574914328 --- /dev/null +++ b/make/data/symbols/java.desktop-G.sym.txt @@ -0,0 +1,1253 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/applet/AppletContext +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/applet/AppletStub +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/applet/AudioClip +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/awt/AWTKeyStroke +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/AttributeValue +header extends java/lang/Object flags 420 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/BorderLayout +header extends java/lang/Object implements java/awt/LayoutManager2,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/CheckboxGroup +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Color +header extends java/lang/Object implements java/awt/Paint,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/ContainerOrderFocusTraversalPolicy +header extends java/awt/FocusTraversalPolicy implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Dimension +header extends java/awt/geom/Dimension2D implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/DisplayMode +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Event +header extends java/lang/Object implements java/io/Serializable flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/FlowLayout +header extends java/lang/Object implements java/awt/LayoutManager,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/FocusTraversalPolicy +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/FontMetrics +header extends java/lang/Object implements java/io/Serializable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Graphics +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/GridBagLayoutInfo +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 + +class name java/awt/GridLayout +header extends java/lang/Object implements java/awt/LayoutManager,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/HeadlessException +header extends java/lang/UnsupportedOperationException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Image +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/Insets +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/MenuShortcut +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/Point +header extends java/awt/geom/Point2D implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/PrintJob +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/Rectangle +header extends java/awt/geom/Rectangle2D implements java/awt/Shape,java/io/Serializable flags 21 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/SystemColor +header extends java/awt/Color implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/TexturePaint +header extends java/lang/Object implements java/awt/Paint flags 21 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 + +class name java/awt/Toolkit +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/color/ColorSpace +header extends java/lang/Object implements java/io/Serializable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/color/ICC_ColorSpace +header extends java/awt/color/ColorSpace flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I4) + +class name java/awt/color/ICC_Profile +-method name finalize descriptor ()V +method name finalize descriptor ()V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/awt/desktop/AboutEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/AboutHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/AppEvent +header extends java/util/EventObject flags 21 + +class name java/awt/desktop/AppForegroundEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/AppForegroundListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/desktop/AppHiddenEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/AppHiddenListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/desktop/AppReopenedEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/AppReopenedListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/desktop/FilesEvent +header extends java/awt/desktop/AppEvent flags 21 + +class name java/awt/desktop/OpenFilesEvent +header extends java/awt/desktop/FilesEvent flags 31 + +class name java/awt/desktop/OpenFilesHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/OpenURIEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/OpenURIHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/PreferencesEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/PreferencesHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/PrintFilesEvent +header extends java/awt/desktop/FilesEvent flags 31 + +class name java/awt/desktop/PrintFilesHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/QuitEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/QuitHandler +header extends java/lang/Object flags 601 + +class name java/awt/desktop/QuitResponse +header extends java/lang/Object flags 601 + +class name java/awt/desktop/QuitStrategy +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; + +class name java/awt/desktop/ScreenSleepEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/ScreenSleepListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/desktop/SystemEventListener +header extends java/lang/Object implements java/util/EventListener flags 601 + +class name java/awt/desktop/SystemSleepEvent +header extends java/awt/desktop/AppEvent flags 31 + +class name java/awt/desktop/SystemSleepListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/desktop/UserSessionListener +header extends java/lang/Object implements java/awt/desktop/SystemEventListener flags 601 + +class name java/awt/dnd/DragGestureEvent +header extends java/util/EventObject flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name java/awt/dnd/DragGestureRecognizer +header extends java/lang/Object implements java/io/Serializable flags 421 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name java/awt/dnd/DragSource +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/dnd/DragSourceAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/dnd/DropTargetAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/dnd/DropTargetDragEvent +header extends java/awt/dnd/DropTargetEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/dnd/DropTargetDropEvent +header extends java/awt/dnd/DropTargetEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/ActionEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/AdjustmentEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/ComponentAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/ComponentEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/ContainerAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/ContainerEvent +header extends java/awt/event/ComponentEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/FocusAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/HierarchyBoundsAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/HierarchyEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/InputMethodEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/ItemEvent +header extends java/awt/AWTEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/KeyAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/MouseAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/MouseMotionAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/MouseWheelEvent +header extends java/awt/event/MouseEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/PaintEvent +header extends java/awt/event/ComponentEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/event/WindowAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/event/WindowEvent +header extends java/awt/event/ComponentEvent flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/font/FontRenderContext +header extends java/lang/Object flags 21 +innerclass innerClass java/awt/RenderingHints$Key outerClass java/awt/RenderingHints innerClassName Key flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/font/GlyphVector +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/font/GraphicAttribute +header extends java/lang/Object flags 421 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 + +class name java/awt/font/ImageGraphicAttribute +header extends java/awt/font/GraphicAttribute flags 31 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 + +class name java/awt/font/LayoutPath +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/font/LineMetrics +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/font/ShapeGraphicAttribute +header extends java/awt/font/GraphicAttribute flags 31 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 + +class name java/awt/font/TextHitInfo +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/font/TextMeasurer +header extends java/lang/Object implements java/lang/Cloneable flags 31 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/geom/AffineTransform +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass java/awt/geom/Point2D$Double outerClass java/awt/geom/Point2D innerClassName Double flags 9 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/awt/geom/Path2D$Double outerClass java/awt/geom/Path2D innerClassName Double flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/geom/Area +header extends java/lang/Object implements java/awt/Shape,java/lang/Cloneable flags 21 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 + +class name java/awt/geom/RectangularShape +header extends java/lang/Object implements java/awt/Shape,java/lang/Cloneable flags 421 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 + +class name java/awt/image/AbstractMultiResolutionImage +header extends java/awt/Image implements java/awt/image/MultiResolutionImage flags 421 +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/image/BandCombineOp +header extends java/lang/Object implements java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/BandedSampleModel +header extends java/awt/image/ComponentSampleModel flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/BaseMultiResolutionImage +header extends java/awt/image/AbstractMultiResolutionImage flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/BufferStrategy +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/image/BufferedImageFilter +header extends java/awt/image/ImageFilter implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ByteLookupTable +header extends java/awt/image/LookupTable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ColorConvertOp +header extends java/lang/Object implements java/awt/image/BufferedImageOp,java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 + +class name java/awt/image/ColorModel +-method name finalize descriptor ()V +method name finalize descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/awt/image/ComponentColorModel +header extends java/awt/image/ColorModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ComponentSampleModel +header extends java/awt/image/SampleModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ConvolveOp +header extends java/lang/Object implements java/awt/image/BufferedImageOp,java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 + +class name java/awt/image/DataBufferUShort +header extends java/awt/image/DataBuffer flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/DirectColorModel +header extends java/awt/image/PackedColorModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ImageFilter +header extends java/lang/Object implements java/awt/image/ImageConsumer,java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/IndexColorModel +header extends java/awt/image/ColorModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name finalize descriptor ()V +method name finalize descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") + +class name java/awt/image/Kernel +header extends java/lang/Object implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/LookupOp +header extends java/lang/Object implements java/awt/image/BufferedImageOp,java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/MultiPixelPackedSampleModel +header extends java/awt/image/SampleModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/MultiResolutionImage +header extends java/lang/Object flags 601 + +class name java/awt/image/PackedColorModel +header extends java/awt/image/ColorModel flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/RGBImageFilter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/image/Raster +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ReplicateScaleFilter +header extends java/awt/image/ImageFilter flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/RescaleOp +header extends java/lang/Object implements java/awt/image/BufferedImageOp,java/awt/image/RasterOp flags 21 +innerclass innerClass java/awt/geom/Point2D$Float outerClass java/awt/geom/Point2D innerClassName Float flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/SampleModel +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/ShortLookupTable +header extends java/awt/image/LookupTable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/SinglePixelPackedSampleModel +header extends java/awt/image/SampleModel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/awt/image/VolatileImage +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/awt/print/Paper +header extends java/lang/Object implements java/lang/Cloneable flags 21 +innerclass innerClass java/awt/geom/Rectangle2D$Double outerClass java/awt/geom/Rectangle2D innerClassName Double flags 9 + +class name java/beans/AppletInitializer +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/beans/BeanProperty +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;METHOD;})@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;) + +class name java/beans/Beans +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/DefaultPersistenceDelegate +header extends java/beans/PersistenceDelegate flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/Encoder +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/EventSetDescriptor +header extends java/beans/FeatureDescriptor flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/Expression +header extends java/beans/Statement flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/FeatureDescriptor +header extends java/lang/Object flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/beans/IndexedPropertyDescriptor +header extends java/beans/PropertyDescriptor flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/JavaBean +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;TYPE;})@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;) + +class name java/beans/PersistenceDelegate +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name java/beans/PropertyDescriptor +header extends java/beans/FeatureDescriptor flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/beans/SimpleBeanInfo +header extends java/lang/Object implements java/beans/BeanInfo flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/accessibility/AccessibilityProvider +header extends java/lang/Object flags 421 + +class name javax/accessibility/AccessibleBundle +header extends java/lang/Object flags 421 classAnnotations @Ljdk/Profile+Annotation;(value=I4) + +class name javax/accessibility/AccessibleContext +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/accessibility/AccessibleHyperlink +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/accessibility/AccessibleRelationSet +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/accessibility/AccessibleStateSet +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/metadata/IIOMetadata +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/plugins/jpeg/JPEGHuffmanTable +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/plugins/jpeg/JPEGQTable +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/plugins/tiff/TIFFDirectory +header extends java/lang/Object implements java/lang/Cloneable flags 21 + +class name javax/imageio/plugins/tiff/TIFFField +header extends java/lang/Object implements java/lang/Cloneable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/plugins/tiff/TIFFImageReadParam +header extends javax/imageio/ImageReadParam flags 31 + +class name javax/imageio/plugins/tiff/TIFFTag +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/imageio/plugins/tiff/TIFFTagSet +header extends java/lang/Object flags 21 + +class name javax/imageio/spi/ImageReaderWriterSpi +header extends javax/imageio/spi/IIOServiceProvider flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/PrintServiceLookup +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/print/ServiceUIFactory +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/print/StreamPrintServiceFactory +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/print/attribute/DateTimeSyntax +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/attribute/EnumSyntax +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/attribute/IntegerSyntax +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/attribute/standard/MediaPrintableArea +header extends java/lang/Object implements javax/print/attribute/DocAttribute,javax/print/attribute/PrintRequestAttribute,javax/print/attribute/PrintJobAttribute flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/event/PrintEvent +header extends java/util/EventObject flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/print/event/PrintJobAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/midi/MetaMessage +header extends javax/sound/midi/MidiMessage flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/midi/MidiMessage +header extends java/lang/Object implements java/lang/Cloneable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/midi/Sequence +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/midi/ShortMessage +header extends javax/sound/midi/MidiMessage flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/midi/SysexMessage +header extends javax/sound/midi/MidiMessage flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sound/midi/spi/MidiDeviceProvider +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/midi/spi/MidiFileReader +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/midi/spi/MidiFileWriter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/midi/spi/SoundbankReader +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/sampled/ReverbType +header extends java/lang/Object flags 21 classAnnotations @Ljdk/Profile+Annotation;(value=I4) + +class name javax/sound/sampled/spi/AudioFileReader +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/sampled/spi/AudioFileWriter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/sampled/spi/FormatConversionProvider +header extends java/lang/Object flags 421 +innerclass innerClass javax/sound/sampled/AudioFormat$Encoding outerClass javax/sound/sampled/AudioFormat innerClassName Encoding flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/sound/sampled/spi/MixerProvider +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/AbstractButton +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/AbstractCellEditor +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/AbstractListModel +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/AbstractSpinnerModel +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/BoxLayout +header extends java/lang/Object implements java/awt/LayoutManager2,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/DebugGraphics +header extends java/awt/Graphics flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/DefaultBoundedRangeModel +header extends java/lang/Object implements javax/swing/BoundedRangeModel,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/DefaultListSelectionModel +header extends java/lang/Object implements javax/swing/ListSelectionModel,java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/FocusManager +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/GrayFilter +header extends java/awt/image/RGBImageFilter flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/InputVerifier +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/InternalFrameFocusTraversalPolicy +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/JFormattedTextField$AbstractFormatter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/JFormattedTextField$AbstractFormatterFactory +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/JList$AccessibleJList$AccessibleJListChild +-method name getAccessibleAction descriptor ()Ljavax/accessibility/AccessibleAction; +method name getAccessibleAction descriptor ()Ljavax/accessibility/AccessibleAction; flags 1 + +class name javax/swing/JSlider$AccessibleJSlider +header extends javax/swing/JComponent$AccessibleJComponent implements javax/accessibility/AccessibleValue,javax/swing/event/ChangeListener nestHost javax/swing/JSlider flags 21 +innerclass innerClass javax/swing/JSlider$AccessibleJSlider outerClass javax/swing/JSlider innerClassName AccessibleJSlider flags 4 +innerclass innerClass javax/swing/JComponent$AccessibleJComponent outerClass javax/swing/JComponent innerClassName AccessibleJComponent flags 401 +method name stateChanged descriptor (Ljavax/swing/event/ChangeEvent;)V flags 1 + +class name javax/swing/JTextPane +header extends javax/swing/JEditorPane flags 21 runtimeAnnotations @Ljava/beans/JavaBean;(description="A\u005C;u0020;text\u005C;u0020;component\u005C;u0020;that\u005C;u0020;can\u005C;u0020;be\u005C;u0020;marked\u005C;u0020;up\u005C;u0020;with\u005C;u0020;attributes\u005C;u0020;that\u005C;u0020;are\u005C;u0020;graphically\u005C;u0020;represented.")@Ljavax/swing/SwingContainer; + +class name javax/swing/LookAndFeel +header extends java/lang/Object flags 421 +innerclass innerClass javax/swing/text/JTextComponent$KeyBinding outerClass javax/swing/text/JTextComponent innerClassName KeyBinding flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/MenuSelectionManager +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/RowFilter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/SizeRequirements +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/SortingFocusTraversalPolicy +header extends javax/swing/InternalFrameFocusTraversalPolicy flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/SwingContainer +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;TYPE;})@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;) + +class name javax/swing/UIClientPropertyKey +header extends java/lang/Object flags 601 + +class name javax/swing/border/AbstractBorder +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/border/LineBorder +header extends javax/swing/border/AbstractBorder flags 21 +innerclass innerClass java/awt/geom/RoundRectangle2D$Float outerClass java/awt/geom/RoundRectangle2D innerClassName Float flags 9 +innerclass innerClass java/awt/geom/Rectangle2D$Float outerClass java/awt/geom/Rectangle2D innerClassName Float flags 9 +innerclass innerClass java/awt/geom/Path2D$Float outerClass java/awt/geom/Path2D innerClassName Float flags 9 + +class name javax/swing/colorchooser/AbstractColorChooserPanel +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/event/EventListenerList +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/event/InternalFrameAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/event/ListDataEvent +header extends java/util/EventObject flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/event/ListSelectionEvent +header extends java/util/EventObject flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/event/MouseInputAdapter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/event/TreeModelEvent +header extends java/util/EventObject flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/filechooser/FileFilter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/filechooser/FileNameExtensionFilter +header extends javax/swing/filechooser/FileFilter flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/filechooser/FileView +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ButtonUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ColorChooserUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ComboBoxUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/DesktopIconUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/DesktopPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/FileChooserUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/InternalFrameUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/LabelUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ListUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/MenuBarUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/MenuItemUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/OptionPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/PanelUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/PopupMenuUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ProgressBarUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/RootPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ScrollBarUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ScrollPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/SeparatorUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/SliderUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/SpinnerUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/SplitPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/TabbedPaneUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/TableHeaderUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/TableUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/TextUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ToolBarUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ToolTipUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/TreeUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/ViewportUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/basic/BasicArrowButton +header extends javax/swing/JButton implements javax/swing/SwingConstants flags 21 +innerclass innerClass java/awt/geom/Path2D$Double outerClass java/awt/geom/Path2D innerClassName Double flags 9 + +class name javax/swing/plaf/basic/BasicButtonUI +header extends javax/swing/plaf/ButtonUI flags 21 +innerclass innerClass java/awt/Component$BaselineResizeBehavior outerClass java/awt/Component innerClassName BaselineResizeBehavior flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicLookAndFeel +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/basic/BasicPasswordFieldUI +header extends javax/swing/plaf/basic/BasicTextFieldUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/basic/BasicRadioButtonUI +-method name installListeners descriptor (Ljavax/swing/AbstractButton;)V +-method name uninstallListeners descriptor (Ljavax/swing/AbstractButton;)V + +class name javax/swing/plaf/basic/BasicSliderUI +method name descriptor ()V flags 1 + +class name javax/swing/plaf/basic/BasicToolBarSeparatorUI +header extends javax/swing/plaf/basic/BasicSeparatorUI flags 21 +innerclass innerClass javax/swing/JToolBar$Separator outerClass javax/swing/JToolBar innerClassName Separator flags 9 + +class name javax/swing/plaf/metal/MetalButtonUI +header extends javax/swing/plaf/basic/BasicButtonUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/metal/MetalCheckBoxUI +header extends javax/swing/plaf/metal/MetalRadioButtonUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/metal/MetalRadioButtonUI +header extends javax/swing/plaf/basic/BasicRadioButtonUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/metal/MetalTheme +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/metal/MetalToggleButtonUI +header extends javax/swing/plaf/basic/BasicToggleButtonUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/metal/MetalToolTipUI +header extends javax/swing/plaf/basic/BasicToolTipUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/multi/MultiLookAndFeel +header extends javax/swing/LookAndFeel flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/synth/SynthButtonUI +header extends javax/swing/plaf/basic/BasicButtonUI implements java/beans/PropertyChangeListener,javax/swing/plaf/synth/SynthUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/synth/SynthDesktopIconUI +method name uninstallComponents descriptor ()V flags 4 + +class name javax/swing/plaf/synth/SynthIcon +header extends java/lang/Object implements javax/swing/Icon flags 601 + +class name javax/swing/plaf/synth/SynthMenuItemUI +header extends javax/swing/plaf/basic/BasicMenuItemUI implements java/beans/PropertyChangeListener,javax/swing/plaf/synth/SynthUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/synth/SynthMenuUI +header extends javax/swing/plaf/basic/BasicMenuUI implements java/beans/PropertyChangeListener,javax/swing/plaf/synth/SynthUI flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/plaf/synth/SynthPainter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/plaf/synth/SynthSeparatorUI +header extends javax/swing/plaf/SeparatorUI implements java/beans/PropertyChangeListener,javax/swing/plaf/synth/SynthUI flags 21 +innerclass innerClass javax/swing/JToolBar$Separator outerClass javax/swing/JToolBar innerClassName Separator flags 9 + +class name javax/swing/plaf/synth/SynthStyle +header extends java/lang/Object flags 421 +innerclass innerClass javax/swing/UIDefaults$LazyInputMap outerClass javax/swing/UIDefaults innerClassName LazyInputMap flags 9 +innerclass innerClass javax/swing/UIDefaults$LazyValue outerClass javax/swing/UIDefaults innerClassName LazyValue flags 609 + +class name javax/swing/table/AbstractTableModel +header extends java/lang/Object implements javax/swing/table/TableModel,java/io/Serializable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/table/TableStringConverter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/AbstractWriter +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/BoxView +header extends javax/swing/text/CompositeView flags 21 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/CompositeView +header extends javax/swing/text/View flags 421 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/DateFormatter +header extends javax/swing/text/InternationalFormatter flags 21 +innerclass innerClass java/text/DateFormat$Field outerClass java/text/DateFormat innerClassName Field flags 9 + +class name javax/swing/text/DefaultTextUI +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/DocumentFilter$FilterBypass +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/GlyphView$GlyphPainter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/IconView +header extends javax/swing/text/View flags 21 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/LayeredHighlighter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/LayeredHighlighter$LayerPainter +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/LayoutQueue +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/NavigationFilter$FilterBypass +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/NumberFormatter +header extends javax/swing/text/InternationalFormatter flags 21 +innerclass innerClass java/text/NumberFormat$Field outerClass java/text/NumberFormat innerClassName Field flags 9 +innerclass innerClass javax/swing/text/DocumentFilter$FilterBypass outerClass javax/swing/text/DocumentFilter innerClassName FilterBypass flags 409 +innerclass innerClass java/text/AttributedCharacterIterator$Attribute outerClass java/text/AttributedCharacterIterator innerClassName Attribute flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/Segment +header extends java/lang/Object implements java/lang/Cloneable,java/text/CharacterIterator,java/lang/CharSequence flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/TabSet +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/TabStop +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/View +header extends java/lang/Object implements javax/swing/SwingConstants flags 421 +innerclass innerClass javax/swing/text/Position$Bias outerClass javax/swing/text/Position innerClassName Bias flags 19 +innerclass innerClass javax/swing/event/DocumentEvent$ElementChange outerClass javax/swing/event/DocumentEvent innerClassName ElementChange flags 609 +innerclass innerClass javax/swing/event/DocumentEvent$EventType outerClass javax/swing/event/DocumentEvent innerClassName EventType flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/HTMLDocument$Iterator +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/html/HTMLEditorKit$Parser +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/text/html/InlineView +header extends javax/swing/text/LabelView flags 21 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 + +class name javax/swing/text/html/ListView +header extends javax/swing/text/html/BlockView flags 21 +innerclass innerClass javax/swing/text/html/StyleSheet$ListPainter outerClass javax/swing/text/html/StyleSheet innerClassName ListPainter flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/MinimalHTMLWriter +header extends javax/swing/text/AbstractWriter flags 21 +innerclass innerClass javax/swing/text/StyleConstants$ParagraphConstants outerClass javax/swing/text/StyleConstants innerClassName ParagraphConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$CharacterConstants outerClass javax/swing/text/StyleConstants innerClassName CharacterConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$FontConstants outerClass javax/swing/text/StyleConstants innerClassName FontConstants flags 9 +innerclass innerClass javax/swing/text/StyleConstants$ColorConstants outerClass javax/swing/text/StyleConstants innerClassName ColorConstants flags 9 +innerclass innerClass javax/swing/text/AbstractDocument$BranchElement outerClass javax/swing/text/AbstractDocument innerClassName BranchElement flags 1 +innerclass innerClass javax/swing/text/StyleContext$NamedStyle outerClass javax/swing/text/StyleContext innerClassName NamedStyle flags 1 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/ObjectView +header extends javax/swing/text/ComponentView flags 21 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/Option +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 + +class name javax/swing/text/html/ParagraphView +header extends javax/swing/text/ParagraphView flags 21 +innerclass innerClass javax/swing/text/html/StyleSheet$BoxPainter outerClass javax/swing/text/html/StyleSheet innerClassName BoxPainter flags 9 +innerclass innerClass javax/swing/text/html/CSS$Attribute outerClass javax/swing/text/html/CSS innerClassName Attribute flags 19 + +class name javax/swing/text/html/parser/ContentModel +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/parser/DocumentParser +header extends javax/swing/text/html/parser/Parser flags 21 +innerclass innerClass javax/swing/text/html/HTMLEditorKit$ParserCallback outerClass javax/swing/text/html/HTMLEditorKit innerClassName ParserCallback flags 9 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 + +class name javax/swing/text/html/parser/Parser +header extends java/lang/Object implements javax/swing/text/html/parser/DTDConstants flags 21 +innerclass innerClass javax/swing/text/html/HTML$Attribute outerClass javax/swing/text/html/HTML innerClassName Attribute flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/text/html/parser/TagElement +header extends java/lang/Object flags 21 +innerclass innerClass javax/swing/text/html/HTML$Tag outerClass javax/swing/text/html/HTML innerClassName Tag flags 9 +innerclass innerClass javax/swing/text/html/HTML$UnknownTag outerClass javax/swing/text/html/HTML innerClassName UnknownTag flags 9 + +class name javax/swing/tree/AbstractLayoutCache +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/tree/AbstractLayoutCache$NodeDimensions +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name javax/swing/tree/DefaultTreeCellRenderer +header extends javax/swing/JLabel implements javax/swing/tree/TreeCellRenderer flags 21 +innerclass innerClass javax/swing/plaf/BorderUIResource$EmptyBorderUIResource outerClass javax/swing/plaf/BorderUIResource innerClassName EmptyBorderUIResource flags 9 +innerclass innerClass javax/swing/JTree$DropLocation outerClass javax/swing/JTree innerClassName DropLocation flags 19 + +class name javax/swing/tree/DefaultTreeModel +header extends java/lang/Object implements java/io/Serializable,javax/swing/tree/TreeModel flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name javax/swing/tree/DefaultTreeSelectionModel +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable,javax/swing/tree/TreeSelectionModel flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/tree/TreePath +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/undo/AbstractUndoableEdit +header extends java/lang/Object implements javax/swing/undo/UndoableEdit,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/undo/CompoundEdit +header extends javax/swing/undo/AbstractUndoableEdit flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/swing/undo/UndoableEditSupport +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.instrument-G.sym.txt b/make/data/symbols/java.instrument-G.sym.txt new file mode 100644 index 0000000000000..edad5250d354f --- /dev/null +++ b/make/data/symbols/java.instrument-G.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/lang/instrument/UnmodifiableModuleException +header extends java/lang/RuntimeException flags 21 + diff --git a/make/data/symbols/java.logging-G.sym.txt b/make/data/symbols/java.logging-G.sym.txt new file mode 100644 index 0000000000000..fb408727b225a --- /dev/null +++ b/make/data/symbols/java.logging-G.sym.txt @@ -0,0 +1,63 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/util/logging/ErrorManager +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/logging/LogRecord +-method name getThreadID descriptor ()I +-method name setThreadID descriptor (I)V +method name getThreadID descriptor ()I flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name setThreadID descriptor (I)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getLongThreadID descriptor ()J flags 1 +method name setLongThreadID descriptor (J)Ljava/util/logging/LogRecord; flags 1 + +class name java/util/logging/LoggingMXBean +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") + +class name java/util/logging/LoggingPermission +header extends java/security/BasicPermission flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/logging/MemoryHandler +header extends java/util/logging/Handler flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/logging/SimpleFormatter +header extends java/util/logging/Formatter flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/logging/SocketHandler +header extends java/util/logging/StreamHandler flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/logging/XMLFormatter +header extends java/util/logging/Formatter flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.management-G.sym.txt b/make/data/symbols/java.management-G.sym.txt new file mode 100644 index 0000000000000..e9605ec3d8b20 --- /dev/null +++ b/make/data/symbols/java.management-G.sym.txt @@ -0,0 +1,269 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/lang/management/LockInfo +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/management/ManagementPermission +header extends java/security/BasicPermission flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/management/MemoryUsage +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/management/MonitorInfo +header extends java/lang/management/LockInfo flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/management/RuntimeMXBean +header extends java/lang/Object implements java/lang/management/PlatformManagedObject flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/Attribute +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/AttributeList +header extends java/util/ArrayList flags 21 signature Ljava/util/ArrayList; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/BadAttributeValueExpException +header extends java/lang/Exception flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/BadBinaryOpValueExpException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/BadStringOperationException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/ConstructorParameters +header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;CONSTRUCTOR;})@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;) + +class name javax/management/ImmutableDescriptor +header extends java/lang/Object implements javax/management/Descriptor flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanAttributeInfo +header extends javax/management/MBeanFeatureInfo implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanConstructorInfo +header extends javax/management/MBeanFeatureInfo implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanNotificationInfo +header extends javax/management/MBeanFeatureInfo implements java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanOperationInfo +header extends javax/management/MBeanFeatureInfo implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanParameterInfo +header extends javax/management/MBeanFeatureInfo implements java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanPermission +header extends java/security/Permission flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanServerDelegate +header extends java/lang/Object implements javax/management/MBeanServerDelegateMBean,javax/management/NotificationEmitter flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanServerFactory +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanServerInvocationHandler +header extends java/lang/Object implements java/lang/reflect/InvocationHandler flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanServerNotification +header extends javax/management/Notification flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanServerPermission +header extends java/security/BasicPermission flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/MBeanTrustPermission +header extends java/security/BasicPermission flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/Notification +header extends java/util/EventObject flags 21 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/ObjectInstance +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/Query +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/StandardEmitterMBean +header extends javax/management/StandardMBean implements javax/management/NotificationEmitter flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/StringValueExp +header extends java/lang/Object implements javax/management/ValueExp flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/loading/DefaultLoaderRepository +header extends java/lang/Object flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated; +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 + +class name javax/management/loading/MLetContent +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/InvalidTargetObjectTypeException +header extends java/lang/Exception flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/modelmbean/XMLParseException +header extends java/lang/Exception flags 21 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/ArrayType +header extends javax/management/openmbean/OpenType flags 21 signature Ljavax/management/openmbean/OpenType; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/CompositeDataInvocationHandler +header extends java/lang/Object implements java/lang/reflect/InvocationHandler flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/CompositeDataSupport +header extends java/lang/Object implements javax/management/openmbean/CompositeData,java/io/Serializable flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/CompositeType +header extends javax/management/openmbean/OpenType flags 21 signature Ljavax/management/openmbean/OpenType; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/OpenMBeanAttributeInfoSupport +header extends javax/management/MBeanAttributeInfo implements javax/management/openmbean/OpenMBeanAttributeInfo flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/OpenMBeanOperationInfoSupport +header extends javax/management/MBeanOperationInfo implements javax/management/openmbean/OpenMBeanOperationInfo flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/SimpleType +header extends javax/management/openmbean/OpenType flags 31 signature Ljavax/management/openmbean/OpenType; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/TabularDataSupport +header extends java/lang/Object implements javax/management/openmbean/TabularData,java/util/Map,java/lang/Cloneable,java/io/Serializable flags 21 signature Ljava/lang/Object;Ljavax/management/openmbean/TabularData;Ljava/util/Map;Ljava/lang/Cloneable;Ljava/io/Serializable; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/openmbean/TabularType +header extends javax/management/openmbean/OpenType flags 21 signature Ljavax/management/openmbean/OpenType; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/RelationNotification +header extends javax/management/Notification flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/management/relation/RelationSupport +header extends java/lang/Object implements javax/management/relation/RelationSupportMBean,javax/management/MBeanRegistration flags 21 +innerclass innerClass java/lang/System$Logger outerClass java/lang/System innerClassName Logger flags 609 +innerclass innerClass java/lang/System$Logger$Level outerClass java/lang/System$Logger innerClassName Level flags 4019 + +class name javax/management/relation/Role +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/RoleInfo +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/relation/RoleResult +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/management/relation/RoleStatus +-method name descriptor ()V +method name descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name javax/management/relation/RoleUnresolved +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/JMXConnectorServerFactory +header extends java/lang/Object flags 21 +innerclass innerClass java/util/ServiceLoader$Provider outerClass java/util/ServiceLoader innerClassName Provider flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/JMXPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/JMXServiceURL +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/NotificationResult +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/TargetedNotification +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.management.rmi-G.sym.txt b/make/data/symbols/java.management.rmi-G.sym.txt new file mode 100644 index 0000000000000..70f97b366edca --- /dev/null +++ b/make/data/symbols/java.management.rmi-G.sym.txt @@ -0,0 +1,39 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/management/remote/rmi/RMIConnectorServer +header extends javax/management/remote/JMXConnectorServer flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/management/remote/rmi/RMIIIOPServerImpl +header extends javax/management/remote/rmi/RMIServerImpl flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated; + +class name javax/management/remote/rmi/RMIServerImpl +header extends java/lang/Object implements java/io/Closeable,javax/management/remote/rmi/RMIServer flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.naming-G.sym.txt b/make/data/symbols/java.naming-G.sym.txt new file mode 100644 index 0000000000000..03579420728ae --- /dev/null +++ b/make/data/symbols/java.naming-G.sym.txt @@ -0,0 +1,76 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/naming/BinaryRefAddr +header extends javax/naming/RefAddr flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/Binding +header extends javax/naming/NameClassPair flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/CompositeName +header extends java/lang/Object implements javax/naming/Name flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/CompoundName +header extends java/lang/Object implements javax/naming/Name flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/LinkException +header extends javax/naming/NamingException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/NameClassPair +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/NamingException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/RefAddr +header extends java/lang/Object implements java/io/Serializable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/Reference +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/directory/AttributeModificationException +header extends javax/naming/NamingException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/directory/ModificationItem +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/naming/directory/SearchResult +header extends javax/naming/Binding flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.net.http-G.sym.txt b/make/data/symbols/java.net.http-G.sym.txt new file mode 100644 index 0000000000000..045aa0dc4208f --- /dev/null +++ b/make/data/symbols/java.net.http-G.sym.txt @@ -0,0 +1,40 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/net/http/HttpRequest +header extends java/lang/Object nestMembers java/net/http/HttpRequest$BodyPublishers,java/net/http/HttpRequest$BodyPublisher,java/net/http/HttpRequest$Builder flags 421 +innerclass innerClass java/net/http/HttpRequest$Builder outerClass java/net/http/HttpRequest innerClassName Builder flags 609 +innerclass innerClass java/net/http/HttpRequest$BodyPublishers outerClass java/net/http/HttpRequest innerClassName BodyPublishers flags 9 +innerclass innerClass java/net/http/HttpRequest$BodyPublisher outerClass java/net/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name newBuilder descriptor (Ljava/net/http/HttpRequest;Ljava/util/function/BiPredicate;)Ljava/net/http/HttpRequest$Builder; flags 9 signature (Ljava/net/http/HttpRequest;Ljava/util/function/BiPredicate;)Ljava/net/http/HttpRequest$Builder; + +class name java/net/http/HttpRequest$BodyPublishers +method name concat descriptor ([Ljava/net/http/HttpRequest$BodyPublisher;)Ljava/net/http/HttpRequest$BodyPublisher; flags 89 + diff --git a/make/data/symbols/java.rmi-G.sym.txt b/make/data/symbols/java.rmi-G.sym.txt new file mode 100644 index 0000000000000..8bf63f3824bcc --- /dev/null +++ b/make/data/symbols/java.rmi-G.sym.txt @@ -0,0 +1,52 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/rmi/RemoteException +header extends java/io/IOException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/rmi/dgc/VMID +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/rmi/server/ObjID +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/rmi/server/RemoteObject +header extends java/lang/Object implements java/rmi/Remote,java/io/Serializable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/rmi/server/ServerCloneException +header extends java/lang/CloneNotSupportedException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/rmi/server/UID +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.scripting-G.sym.txt b/make/data/symbols/java.scripting-G.sym.txt new file mode 100644 index 0000000000000..2c76834f363a3 --- /dev/null +++ b/make/data/symbols/java.scripting-G.sym.txt @@ -0,0 +1,32 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/script/ScriptException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.security.jgss-G.sym.txt b/make/data/symbols/java.security.jgss-G.sym.txt new file mode 100644 index 0000000000000..322ac32bc3300 --- /dev/null +++ b/make/data/symbols/java.security.jgss-G.sym.txt @@ -0,0 +1,69 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/security/auth/kerberos/DelegationPermission +header extends java/security/BasicPermission implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/EncryptionKey +header extends java/lang/Object implements javax/crypto/SecretKey flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/KerberosCredMessage +header extends java/lang/Object implements javax/security/auth/Destroyable flags 31 +innerclass innerClass java/util/Base64$Encoder outerClass java/util/Base64 innerClassName Encoder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/KerberosKey +header extends java/lang/Object implements javax/crypto/SecretKey flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/KerberosPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/KerberosTicket +header extends java/lang/Object implements javax/security/auth/Destroyable,javax/security/auth/Refreshable,java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/KeyTab +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/security/auth/kerberos/ServicePermission +header extends java/security/Permission implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name org/ietf/jgss/GSSException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name org/ietf/jgss/Oid +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.security.sasl-G.sym.txt b/make/data/symbols/java.security.sasl-G.sym.txt new file mode 100644 index 0000000000000..76d9b5cd1add6 --- /dev/null +++ b/make/data/symbols/java.security.sasl-G.sym.txt @@ -0,0 +1,32 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/security/sasl/SaslException +header extends java/io/IOException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.smartcardio-G.sym.txt b/make/data/symbols/java.smartcardio-G.sym.txt new file mode 100644 index 0000000000000..480baf2db1427 --- /dev/null +++ b/make/data/symbols/java.smartcardio-G.sym.txt @@ -0,0 +1,62 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/smartcardio/ATR +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/smartcardio/Card +header extends java/lang/Object flags 421 + +class name javax/smartcardio/CardChannel +header extends java/lang/Object flags 421 + +class name javax/smartcardio/CardException +header extends java/lang/Exception flags 21 + +class name javax/smartcardio/CardNotPresentException +header extends javax/smartcardio/CardException flags 21 + +class name javax/smartcardio/CardPermission +header extends java/security/Permission flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/smartcardio/CardTerminal +header extends java/lang/Object flags 421 + +class name javax/smartcardio/CommandAPDU +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/smartcardio/ResponseAPDU +header extends java/lang/Object implements java/io/Serializable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/smartcardio/TerminalFactorySpi +header extends java/lang/Object flags 421 + diff --git a/make/data/symbols/java.sql-G.sym.txt b/make/data/symbols/java.sql-G.sym.txt new file mode 100644 index 0000000000000..03d6319f4cfa4 --- /dev/null +++ b/make/data/symbols/java.sql-G.sym.txt @@ -0,0 +1,60 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/sql/BatchUpdateException +header extends java/sql/SQLException flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name java/sql/ConnectionBuilder +header extends java/lang/Object flags 601 + +class name java/sql/JDBCType +header extends java/lang/Enum implements java/sql/SQLType flags 4031 signature Ljava/lang/Enum;Ljava/sql/SQLType; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/sql/SQLWarning +header extends java/sql/SQLException flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/sql/ShardingKey +header extends java/lang/Object flags 601 + +class name java/sql/ShardingKeyBuilder +header extends java/lang/Object flags 601 + +class name java/sql/Statement +header extends java/lang/Object implements java/sql/Wrapper,java/lang/AutoCloseable flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sql/PooledConnectionBuilder +header extends java/lang/Object flags 601 + +class name javax/sql/XAConnectionBuilder +header extends java/lang/Object flags 601 + diff --git a/make/data/symbols/java.sql.rowset-G.sym.txt b/make/data/symbols/java.sql.rowset-G.sym.txt new file mode 100644 index 0000000000000..ffdde75c8c44d --- /dev/null +++ b/make/data/symbols/java.sql.rowset-G.sym.txt @@ -0,0 +1,69 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/sql/rowset/BaseRowSet +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sql/rowset/serial/SerialArray +header extends java/lang/Object implements java/sql/Array,java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/sql/rowset/serial/SerialBlob +header extends java/lang/Object implements java/sql/Blob,java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/sql/rowset/serial/SerialClob +header extends java/lang/Object implements java/sql/Clob,java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sql/rowset/serial/SerialDatalink +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sql/rowset/serial/SerialJavaObject +header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 + +class name javax/sql/rowset/serial/SerialRef +header extends java/lang/Object implements java/sql/Ref,java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/sql/rowset/serial/SerialStruct +header extends java/lang/Object implements java/sql/Struct,java/io/Serializable,java/lang/Cloneable flags 21 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.xml-G.sym.txt b/make/data/symbols/java.xml-G.sym.txt new file mode 100644 index 0000000000000..f4b3425902ce8 --- /dev/null +++ b/make/data/symbols/java.xml-G.sym.txt @@ -0,0 +1,150 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/xml/catalog/Catalog +header extends java/lang/Object flags 601 + +class name javax/xml/catalog/CatalogException +header extends java/lang/RuntimeException flags 21 + +class name javax/xml/catalog/CatalogManager +header extends java/lang/Object flags 31 + +class name javax/xml/catalog/CatalogResolver +header extends java/lang/Object implements org/xml/sax/EntityResolver,javax/xml/stream/XMLResolver,javax/xml/transform/URIResolver,org/w3c/dom/ls/LSResourceResolver flags 601 + +class name javax/xml/datatype/DatatypeFactory +header extends java/lang/Object flags 421 +innerclass innerClass javax/xml/datatype/DatatypeConstants$Field outerClass javax/xml/datatype/DatatypeConstants innerClassName Field flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/datatype/Duration +header extends java/lang/Object flags 421 +innerclass innerClass javax/xml/datatype/DatatypeConstants$Field outerClass javax/xml/datatype/DatatypeConstants innerClassName Field flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/namespace/QName +header extends java/lang/Object implements java/io/Serializable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/parsers/DocumentBuilder +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/parsers/DocumentBuilderFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/parsers/SAXParser +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/parsers/SAXParserFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/stream/XMLEventReader +header extends java/lang/Object implements java/util/Iterator flags 601 signature Ljava/lang/Object;Ljava/util/Iterator; + +class name javax/xml/stream/XMLInputFactory +-method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; +method name newFactory descriptor ()Ljavax/xml/stream/XMLInputFactory; thrownTypes javax/xml/stream/FactoryConfigurationError flags 9 + +class name javax/xml/stream/XMLStreamException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/transform/Transformer +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/transform/TransformerException +header extends java/lang/Exception flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/validation/SchemaFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/xpath/XPath +header extends java/lang/Object flags 601 +innerclass innerClass javax/xml/xpath/XPathEvaluationResult$XPathResultType outerClass javax/xml/xpath/XPathEvaluationResult innerClassName XPathResultType flags 4019 + +class name javax/xml/xpath/XPathException +header extends java/lang/Exception flags 21 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name javax/xml/xpath/XPathExpression +header extends java/lang/Object flags 601 +innerclass innerClass javax/xml/xpath/XPathEvaluationResult$XPathResultType outerClass javax/xml/xpath/XPathEvaluationResult innerClassName XPathResultType flags 4019 + +class name javax/xml/xpath/XPathFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/xpath/XPathNodes +header extends java/lang/Object implements java/lang/Iterable flags 601 signature Ljava/lang/Object;Ljava/lang/Iterable; + +class name org/w3c/dom/ElementTraversal +header extends java/lang/Object flags 601 + +class name org/xml/sax/AttributeList +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/DocumentHandler +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/HandlerBase +header extends java/lang/Object implements org/xml/sax/EntityResolver,org/xml/sax/DTDHandler,org/xml/sax/DocumentHandler,org/xml/sax/ErrorHandler flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/Parser +header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/ext/Attributes2Impl +header extends org/xml/sax/helpers/AttributesImpl implements org/xml/sax/ext/Attributes2 flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name org/xml/sax/helpers/AttributeListImpl +header extends java/lang/Object implements org/xml/sax/AttributeList flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/helpers/AttributesImpl +header extends java/lang/Object implements org/xml/sax/Attributes flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name org/xml/sax/helpers/ParserFactory +header extends java/lang/Object flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="1.5") + +class name org/xml/sax/helpers/XMLFilterImpl +header extends java/lang/Object implements org/xml/sax/XMLFilter,org/xml/sax/EntityResolver,org/xml/sax/DTDHandler,org/xml/sax/ContentHandler,org/xml/sax/ErrorHandler flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name org/xml/sax/helpers/XMLReaderFactory +header extends java/lang/Object flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/java.xml.crypto-G.sym.txt b/make/data/symbols/java.xml.crypto-G.sym.txt new file mode 100644 index 0000000000000..0428e5934bba3 --- /dev/null +++ b/make/data/symbols/java.xml.crypto-G.sym.txt @@ -0,0 +1,46 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/xml/crypto/NodeSetData +header extends java/lang/Object implements javax/xml/crypto/Data,java/lang/Iterable flags 601 signature Ljava/lang/Object;Ljavax/xml/crypto/Data;Ljava/lang/Iterable; + +class name javax/xml/crypto/dom/DOMCryptoContext +header extends java/lang/Object implements javax/xml/crypto/XMLCryptoContext flags 21 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/crypto/dsig/XMLSignatureFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/xml/crypto/dsig/keyinfo/KeyInfoFactory +header extends java/lang/Object flags 421 +innerclass innerClass java/security/Provider$Service outerClass java/security/Provider innerClassName Service flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/make/data/symbols/jdk.accessibility-G.sym.txt b/make/data/symbols/jdk.accessibility-G.sym.txt new file mode 100644 index 0000000000000..06c8977098321 --- /dev/null +++ b/make/data/symbols/jdk.accessibility-G.sym.txt @@ -0,0 +1,44 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/java/accessibility/util/AccessibilityListenerList +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/java/accessibility/util/EventID +header extends java/lang/Object flags 21 + +class name com/sun/java/accessibility/util/GUIInitializedListener +header extends java/lang/Object implements java/util/EventListener flags 601 + +class name com/sun/java/accessibility/util/TopLevelWindowListener +header extends java/lang/Object implements java/util/EventListener flags 601 + +class name com/sun/java/accessibility/util/Translator +header extends javax/accessibility/AccessibleContext implements javax/accessibility/Accessible,javax/accessibility/AccessibleComponent flags 21 + diff --git a/make/data/symbols/jdk.attach-G.sym.txt b/make/data/symbols/jdk.attach-G.sym.txt new file mode 100644 index 0000000000000..330e659adf6be --- /dev/null +++ b/make/data/symbols/jdk.attach-G.sym.txt @@ -0,0 +1,55 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/tools/attach/AgentInitializationException +header extends java/lang/Exception flags 21 + +class name com/sun/tools/attach/AgentLoadException +header extends java/lang/Exception flags 21 + +class name com/sun/tools/attach/AttachNotSupportedException +header extends java/lang/Exception flags 21 + +class name com/sun/tools/attach/AttachOperationFailedException +header extends java/io/IOException flags 21 + +class name com/sun/tools/attach/AttachPermission +header extends java/security/BasicPermission flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/tools/attach/VirtualMachine +header extends java/lang/Object flags 421 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/tools/attach/VirtualMachineDescriptor +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/tools/attach/spi/AttachProvider +header extends java/lang/Object flags 421 + diff --git a/make/data/symbols/jdk.compiler-G.sym.txt b/make/data/symbols/jdk.compiler-G.sym.txt new file mode 100644 index 0000000000000..8f44f88c24604 --- /dev/null +++ b/make/data/symbols/jdk.compiler-G.sym.txt @@ -0,0 +1,382 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.compiler +header exports com/sun/source/doctree,com/sun/source/tree,com/sun/source/util,com/sun/tools/javac requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;20 uses javax/annotation/processing/Processor,com/sun/source/util/Plugin,com/sun/tools/doclint/DocLint,com/sun/tools/javac/platform/PlatformProvider provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;com/sun/tools/javac/main/JavacToolProvider,interface\u0020;com/sun/tools/javac/platform/PlatformProvider\u0020;impls\u0020;com/sun/tools/javac/platform/JDKPlatformProvider,interface\u0020;javax/tools/JavaCompiler\u0020;impls\u0020;com/sun/tools/javac/api/JavacTool,interface\u0020;javax/tools/Tool\u0020;impls\u0020;com/sun/tools/javac/api/JavacTool target linux-amd64 flags 8000 + +class name com/sun/source/doctree/AuthorTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/BlockTagTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/CommentTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/DeprecatedTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/DocCommentTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/DocRootTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/DocTreeVisitor +header extends java/lang/Object flags 601 signature Ljava/lang/Object; + +class name com/sun/source/doctree/DocTypeTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/EndElementTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/EntityTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/ErroneousTree +header extends java/lang/Object implements com/sun/source/doctree/TextTree flags 601 + +class name com/sun/source/doctree/HiddenTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/IdentifierTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/IndexTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/InheritDocTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/InlineTagTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/LinkTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/LiteralTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/ParamTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/ProvidesTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/ReferenceTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/ReturnTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/SeeTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/SerialDataTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/SerialFieldTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/SerialTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/SinceTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/StartElementTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/SummaryTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/TextTree +header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 + +class name com/sun/source/doctree/ThrowsTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/UnknownBlockTagTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/UnknownInlineTagTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/UsesTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/doctree/ValueTree +header extends java/lang/Object implements com/sun/source/doctree/InlineTagTree flags 601 + +class name com/sun/source/doctree/VersionTree +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 + +class name com/sun/source/tree/AnnotatedTypeTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/AnnotationTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/ArrayAccessTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/ArrayTypeTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/AssertTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/AssignmentTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/BinaryTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/BindingPatternTree +-method name getType descriptor ()Lcom/sun/source/tree/Tree; +-method name getBinding descriptor ()Ljavax/lang/model/element/Name; +method name getVariable descriptor ()Lcom/sun/source/tree/VariableTree; flags 401 + +class name com/sun/source/tree/BlockTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/BreakTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/CatchTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ClassTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/CompilationUnitTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/CompoundAssignmentTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/ConditionalExpressionTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/ContinueTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/DirectiveTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/DoWhileLoopTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/EmptyStatementTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/EnhancedForLoopTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/ErroneousTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/ExportsTree +header extends java/lang/Object implements com/sun/source/tree/DirectiveTree flags 601 + +class name com/sun/source/tree/ExpressionStatementTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/ExpressionTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ForLoopTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/IdentifierTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/IfTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/ImportTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/InstanceOfTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/IntersectionTypeTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/LabeledStatementTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/LineMap +header extends java/lang/Object flags 601 + +class name com/sun/source/tree/LiteralTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/MemberSelectTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/MethodInvocationTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/MethodTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ModifiersTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/NewArrayTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/NewClassTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/OpensTree +header extends java/lang/Object implements com/sun/source/tree/DirectiveTree flags 601 + +class name com/sun/source/tree/PackageTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ParameterizedTypeTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ParenthesizedTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/PrimitiveTypeTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/ProvidesTree +header extends java/lang/Object implements com/sun/source/tree/DirectiveTree flags 601 + +class name com/sun/source/tree/RequiresTree +header extends java/lang/Object implements com/sun/source/tree/DirectiveTree flags 601 + +class name com/sun/source/tree/ReturnTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/Scope +header extends java/lang/Object flags 601 + +class name com/sun/source/tree/StatementTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/SwitchTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/SynchronizedTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/ThrowTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/Tree$Kind +-field name RECORD descriptor Lcom/sun/source/tree/Tree$Kind; +field name RECORD descriptor Lcom/sun/source/tree/Tree$Kind; flags 4019 + +class name com/sun/source/tree/TreeVisitor +header extends java/lang/Object flags 601 signature Ljava/lang/Object; + +class name com/sun/source/tree/TryTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/TypeCastTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/TypeParameterTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/UnaryTree +header extends java/lang/Object implements com/sun/source/tree/ExpressionTree flags 601 + +class name com/sun/source/tree/UnionTypeTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/tree/UsesTree +header extends java/lang/Object implements com/sun/source/tree/DirectiveTree flags 601 + +class name com/sun/source/tree/VariableTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/WhileLoopTree +header extends java/lang/Object implements com/sun/source/tree/StatementTree flags 601 + +class name com/sun/source/tree/WildcardTree +header extends java/lang/Object implements com/sun/source/tree/Tree flags 601 + +class name com/sun/source/util/DocSourcePositions +header extends java/lang/Object implements com/sun/source/util/SourcePositions flags 601 + +class name com/sun/source/util/DocTreeFactory +header extends java/lang/Object flags 601 +innerclass innerClass com/sun/source/doctree/AttributeTree$ValueKind outerClass com/sun/source/doctree/AttributeTree innerClassName ValueKind flags 4019 + +class name com/sun/source/util/DocTreePathScanner +header extends com/sun/source/util/DocTreeScanner flags 21 signature Lcom/sun/source/util/DocTreeScanner; + +class name com/sun/source/util/DocTreeScanner +header extends java/lang/Object implements com/sun/source/doctree/DocTreeVisitor flags 21 signature Ljava/lang/Object;Lcom/sun/source/doctree/DocTreeVisitor; + +class name com/sun/source/util/DocTrees +header extends com/sun/source/util/Trees flags 421 +innerclass innerClass javax/tools/JavaCompiler$CompilationTask outerClass javax/tools/JavaCompiler innerClassName CompilationTask flags 609 +innerclass innerClass javax/tools/Diagnostic$Kind outerClass javax/tools/Diagnostic innerClassName Kind flags 4019 +method name getCharacters descriptor (Lcom/sun/source/doctree/EntityTree;)Ljava/lang/String; flags 401 + +class name com/sun/source/util/JavacTask +header extends java/lang/Object implements javax/tools/JavaCompiler$CompilationTask flags 421 +innerclass innerClass javax/tools/JavaCompiler$CompilationTask outerClass javax/tools/JavaCompiler innerClassName CompilationTask flags 609 + +class name com/sun/source/util/Plugin +header extends java/lang/Object flags 601 + +class name com/sun/source/util/SimpleDocTreeVisitor +header extends java/lang/Object implements com/sun/source/doctree/DocTreeVisitor flags 21 signature Ljava/lang/Object;Lcom/sun/source/doctree/DocTreeVisitor; + +class name com/sun/source/util/SimpleTreeVisitor +header extends java/lang/Object implements com/sun/source/tree/TreeVisitor flags 21 signature Ljava/lang/Object;Lcom/sun/source/tree/TreeVisitor; + +class name com/sun/source/util/SourcePositions +header extends java/lang/Object flags 601 + +class name com/sun/source/util/TaskListener +header extends java/lang/Object flags 601 + +class name com/sun/source/util/TreePathScanner +header extends com/sun/source/util/TreeScanner flags 21 signature Lcom/sun/source/util/TreeScanner; + +class name com/sun/source/util/Trees +header extends java/lang/Object flags 421 +innerclass innerClass javax/tools/JavaCompiler$CompilationTask outerClass javax/tools/JavaCompiler innerClassName CompilationTask flags 609 +innerclass innerClass javax/tools/Diagnostic$Kind outerClass javax/tools/Diagnostic innerClassName Kind flags 4019 + +class name com/sun/tools/javac/Main +header extends java/lang/Object flags 21 +-method name descriptor ()V +method name descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + diff --git a/make/data/symbols/jdk.dynalink-G.sym.txt b/make/data/symbols/jdk.dynalink-G.sym.txt new file mode 100644 index 0000000000000..4d1453d475802 --- /dev/null +++ b/make/data/symbols/jdk.dynalink-G.sym.txt @@ -0,0 +1,136 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/dynalink/CallSiteDescriptor +header extends jdk/dynalink/SecureLookupSupplier flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/DynamicLinker +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/StackWalker$StackFrame outerClass java/lang/StackWalker innerClassName StackFrame flags 609 +innerclass innerClass java/lang/StackWalker$Option outerClass java/lang/StackWalker innerClassName Option flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/NamedOperation +header extends java/lang/Object implements jdk/dynalink/Operation flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/Namespace +header extends java/lang/Object flags 601 + +class name jdk/dynalink/NamespaceOperation +header extends java/lang/Object implements jdk/dynalink/Operation flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/NoSuchDynamicMethodException +header extends java/lang/RuntimeException flags 21 + +class name jdk/dynalink/Operation +header extends java/lang/Object flags 601 + +class name jdk/dynalink/RelinkableCallSite +header extends java/lang/Object flags 601 + +class name jdk/dynalink/SecureLookupSupplier +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/StandardNamespace +header extends java/lang/Enum implements jdk/dynalink/Namespace flags 4031 signature Ljava/lang/Enum;Ljdk/dynalink/Namespace; + +class name jdk/dynalink/StandardOperation +header extends java/lang/Enum implements jdk/dynalink/Operation flags 4031 signature Ljava/lang/Enum;Ljdk/dynalink/Operation; + +class name jdk/dynalink/beans/MissingMemberHandlerFactory +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name jdk/dynalink/linker/GuardedInvocation +header extends java/lang/Object flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/linker/GuardedInvocationTransformer +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name jdk/dynalink/linker/GuardingDynamicLinker +header extends java/lang/Object flags 601 + +class name jdk/dynalink/linker/GuardingDynamicLinkerExporter +header extends java/lang/Object implements java/util/function/Supplier flags 421 signature Ljava/lang/Object;Ljava/util/function/Supplier;>; + +class name jdk/dynalink/linker/GuardingTypeConverterFactory +header extends java/lang/Object flags 601 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/linker/LinkRequest +header extends java/lang/Object flags 601 + +class name jdk/dynalink/linker/LinkerServices +header extends java/lang/Object flags 601 +innerclass innerClass jdk/dynalink/linker/ConversionComparator$Comparison outerClass jdk/dynalink/linker/ConversionComparator innerClassName Comparison flags 4019 + +class name jdk/dynalink/linker/MethodHandleTransformer +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name jdk/dynalink/linker/MethodTypeConversionStrategy +header extends java/lang/Object flags 601 runtimeAnnotations @Ljava/lang/FunctionalInterface; + +class name jdk/dynalink/linker/TypeBasedGuardingDynamicLinker +header extends java/lang/Object implements jdk/dynalink/linker/GuardingDynamicLinker flags 601 + +class name jdk/dynalink/linker/support/CompositeGuardingDynamicLinker +header extends java/lang/Object implements jdk/dynalink/linker/GuardingDynamicLinker flags 21 + +class name jdk/dynalink/linker/support/DefaultInternalObjectFilter +header extends java/lang/Object implements jdk/dynalink/linker/MethodHandleTransformer flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/linker/support/Guards +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/linker/support/Lookup +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/linker/support/SimpleLinkRequest +header extends java/lang/Object implements jdk/dynalink/linker/LinkRequest flags 21 + +class name jdk/dynalink/linker/support/TypeUtilities +header extends java/lang/Object flags 31 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name jdk/dynalink/support/AbstractRelinkableCallSite +header extends java/lang/invoke/MutableCallSite implements jdk/dynalink/RelinkableCallSite flags 421 + +class name jdk/dynalink/support/ChainedCallSite +header extends jdk/dynalink/support/AbstractRelinkableCallSite flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/dynalink/support/SimpleRelinkableCallSite +header extends jdk/dynalink/support/AbstractRelinkableCallSite flags 21 + diff --git a/make/data/symbols/jdk.httpserver-G.sym.txt b/make/data/symbols/jdk.httpserver-G.sym.txt new file mode 100644 index 0000000000000..b25a633fcf5e1 --- /dev/null +++ b/make/data/symbols/jdk.httpserver-G.sym.txt @@ -0,0 +1,68 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/net/httpserver/Authenticator +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name com/sun/net/httpserver/Authenticator$Result +-method name descriptor ()V +method name descriptor ()V flags 4 + +class name com/sun/net/httpserver/Headers +header extends java/lang/Object implements java/util/Map flags 21 signature Ljava/lang/Object;Ljava/util/Map;>; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name com/sun/net/httpserver/HttpContext +header extends java/lang/Object flags 421 + +class name com/sun/net/httpserver/HttpHandler +header extends java/lang/Object flags 601 + +class name com/sun/net/httpserver/HttpPrincipal +header extends java/lang/Object implements java/security/Principal flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/net/httpserver/HttpServer +header extends java/lang/Object flags 421 + +class name com/sun/net/httpserver/HttpsConfigurator +header extends java/lang/Object flags 21 + +class name com/sun/net/httpserver/HttpsExchange +header extends com/sun/net/httpserver/HttpExchange flags 421 + +class name com/sun/net/httpserver/HttpsParameters +header extends java/lang/Object flags 421 + +class name com/sun/net/httpserver/HttpsServer +header extends com/sun/net/httpserver/HttpServer flags 421 + +class name com/sun/net/httpserver/spi/HttpServerProvider +header extends java/lang/Object flags 421 + diff --git a/make/data/symbols/jdk.incubator.foreign-G.sym.txt b/make/data/symbols/jdk.incubator.foreign-G.sym.txt new file mode 100644 index 0000000000000..1ec39c418339d --- /dev/null +++ b/make/data/symbols/jdk.incubator.foreign-G.sym.txt @@ -0,0 +1,318 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/incubator/foreign/Addressable +header extends java/lang/Object flags 601 +method name address descriptor ()Ljdk/incubator/foreign/MemoryAddress; flags 401 + +class name jdk/incubator/foreign/CLinker +header extends java/lang/Object nestMembers jdk/incubator/foreign/CLinker$TypeKind,jdk/incubator/foreign/CLinker$VaList,jdk/incubator/foreign/CLinker$VaList$Builder flags 601 +innerclass innerClass jdk/incubator/foreign/CLinker$TypeKind outerClass jdk/incubator/foreign/CLinker innerClassName TypeKind flags 4019 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList outerClass jdk/incubator/foreign/CLinker innerClassName VaList flags 609 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList$Builder outerClass jdk/incubator/foreign/CLinker$VaList innerClassName Builder flags 609 +field name C_CHAR descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_SHORT descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_INT descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_LONG descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_LONG_LONG descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_FLOAT descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_DOUBLE descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_POINTER descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 +field name C_VA_LIST descriptor Ljdk/incubator/foreign/MemoryLayout; flags 19 +method name getInstance descriptor ()Ljdk/incubator/foreign/CLinker; flags 9 +method name downcallHandle descriptor (Ljdk/incubator/foreign/Addressable;Ljava/lang/invoke/MethodType;Ljdk/incubator/foreign/FunctionDescriptor;)Ljava/lang/invoke/MethodHandle; flags 401 +method name upcallStub descriptor (Ljava/lang/invoke/MethodHandle;Ljdk/incubator/foreign/FunctionDescriptor;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name asVarArg descriptor (Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/MemoryLayout; flags 9 signature (TT;)TT; +method name toCString descriptor (Ljava/lang/String;)Ljdk/incubator/foreign/MemorySegment; flags 9 +method name toCString descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;)Ljdk/incubator/foreign/MemorySegment; flags 9 +method name toCString descriptor (Ljava/lang/String;Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/MemorySegment; flags 9 +method name toCString descriptor (Ljava/lang/String;Ljava/nio/charset/Charset;Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/MemorySegment; flags 9 +method name toJavaStringRestricted descriptor (Ljdk/incubator/foreign/MemoryAddress;)Ljava/lang/String; flags 9 +method name toJavaStringRestricted descriptor (Ljdk/incubator/foreign/MemoryAddress;Ljava/nio/charset/Charset;)Ljava/lang/String; flags 9 +method name toJavaString descriptor (Ljdk/incubator/foreign/MemorySegment;)Ljava/lang/String; flags 9 +method name toJavaString descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/charset/Charset;)Ljava/lang/String; flags 9 +method name allocateMemoryRestricted descriptor (J)Ljdk/incubator/foreign/MemoryAddress; flags 9 +method name freeMemoryRestricted descriptor (Ljdk/incubator/foreign/MemoryAddress;)V flags 9 + +class name jdk/incubator/foreign/CLinker$TypeKind +header extends java/lang/Enum nestHost jdk/incubator/foreign/CLinker flags 4031 signature Ljava/lang/Enum; +innerclass innerClass jdk/incubator/foreign/CLinker$TypeKind outerClass jdk/incubator/foreign/CLinker innerClassName TypeKind flags 4019 +field name CHAR descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name SHORT descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name INT descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name LONG descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name LONG_LONG descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name FLOAT descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name DOUBLE descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name POINTER descriptor Ljdk/incubator/foreign/CLinker$TypeKind; flags 4019 +field name ATTR_NAME descriptor Ljava/lang/String; constantValue abi/kind flags 19 +method name values descriptor ()[Ljdk/incubator/foreign/CLinker$TypeKind; flags 9 +method name valueOf descriptor (Ljava/lang/String;)Ljdk/incubator/foreign/CLinker$TypeKind; flags 9 +method name isIntegral descriptor ()Z flags 1 +method name isFloat descriptor ()Z flags 1 +method name isPointer descriptor ()Z flags 1 + +class name jdk/incubator/foreign/CLinker$VaList +header extends java/lang/Object implements jdk/incubator/foreign/Addressable,java/lang/AutoCloseable nestHost jdk/incubator/foreign/CLinker flags 601 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList outerClass jdk/incubator/foreign/CLinker innerClassName VaList flags 609 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList$Builder outerClass jdk/incubator/foreign/CLinker$VaList innerClassName Builder flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name vargAsInt descriptor (Ljdk/incubator/foreign/MemoryLayout;)I flags 401 +method name vargAsLong descriptor (Ljdk/incubator/foreign/MemoryLayout;)J flags 401 +method name vargAsDouble descriptor (Ljdk/incubator/foreign/MemoryLayout;)D flags 401 +method name vargAsAddress descriptor (Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/MemoryAddress; flags 401 +method name vargAsSegment descriptor (Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name vargAsSegment descriptor (Ljdk/incubator/foreign/MemoryLayout;Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name skip descriptor ([Ljdk/incubator/foreign/MemoryLayout;)V flags 481 +method name isAlive descriptor ()Z flags 401 +method name close descriptor ()V flags 401 +method name copy descriptor ()Ljdk/incubator/foreign/CLinker$VaList; flags 401 +method name copy descriptor (Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/CLinker$VaList; flags 401 +method name address descriptor ()Ljdk/incubator/foreign/MemoryAddress; flags 401 +method name ofAddressRestricted descriptor (Ljdk/incubator/foreign/MemoryAddress;)Ljdk/incubator/foreign/CLinker$VaList; flags 9 +method name make descriptor (Ljava/util/function/Consumer;)Ljdk/incubator/foreign/CLinker$VaList; flags 9 signature (Ljava/util/function/Consumer;)Ljdk/incubator/foreign/CLinker$VaList; +method name make descriptor (Ljava/util/function/Consumer;Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/CLinker$VaList; flags 9 signature (Ljava/util/function/Consumer;Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/CLinker$VaList; +method name empty descriptor ()Ljdk/incubator/foreign/CLinker$VaList; flags 9 + +class name jdk/incubator/foreign/CLinker$VaList$Builder +header extends java/lang/Object nestHost jdk/incubator/foreign/CLinker flags 601 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList outerClass jdk/incubator/foreign/CLinker innerClassName VaList flags 609 +innerclass innerClass jdk/incubator/foreign/CLinker$VaList$Builder outerClass jdk/incubator/foreign/CLinker$VaList innerClassName Builder flags 609 +method name vargFromInt descriptor (Ljdk/incubator/foreign/ValueLayout;I)Ljdk/incubator/foreign/CLinker$VaList$Builder; flags 401 +method name vargFromLong descriptor (Ljdk/incubator/foreign/ValueLayout;J)Ljdk/incubator/foreign/CLinker$VaList$Builder; flags 401 +method name vargFromDouble descriptor (Ljdk/incubator/foreign/ValueLayout;D)Ljdk/incubator/foreign/CLinker$VaList$Builder; flags 401 +method name vargFromAddress descriptor (Ljdk/incubator/foreign/ValueLayout;Ljdk/incubator/foreign/Addressable;)Ljdk/incubator/foreign/CLinker$VaList$Builder; flags 401 +method name vargFromSegment descriptor (Ljdk/incubator/foreign/GroupLayout;Ljdk/incubator/foreign/MemorySegment;)Ljdk/incubator/foreign/CLinker$VaList$Builder; flags 401 + +class name jdk/incubator/foreign/FunctionDescriptor +header extends java/lang/Object implements java/lang/constant/Constable flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name TRIVIAL_ATTRIBUTE_NAME descriptor Ljava/lang/String; constantValue abi/trivial flags 19 +method name attribute descriptor (Ljava/lang/String;)Ljava/util/Optional; flags 1 signature (Ljava/lang/String;)Ljava/util/Optional; +method name attributes descriptor ()Ljava/util/stream/Stream; flags 1 signature ()Ljava/util/stream/Stream; +method name withAttribute descriptor (Ljava/lang/String;Ljava/lang/constant/Constable;)Ljdk/incubator/foreign/FunctionDescriptor; flags 1 +method name returnLayout descriptor ()Ljava/util/Optional; flags 1 signature ()Ljava/util/Optional; +method name argumentLayouts descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List; +method name of descriptor (Ljdk/incubator/foreign/MemoryLayout;[Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/FunctionDescriptor; flags 89 +method name ofVoid descriptor ([Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/FunctionDescriptor; flags 89 +method name withAppendedArgumentLayouts descriptor ([Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/FunctionDescriptor; flags 81 +method name withReturnLayout descriptor (Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/FunctionDescriptor; flags 1 +method name withVoidReturnLayout descriptor ()Ljdk/incubator/foreign/FunctionDescriptor; flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 +method name equals descriptor (Ljava/lang/Object;)Z flags 1 +method name hashCode descriptor ()I flags 1 +method name describeConstable descriptor ()Ljava/util/Optional; flags 1 signature ()Ljava/util/Optional;>; + +class name jdk/incubator/foreign/LibraryLookup +header extends java/lang/Object nestMembers jdk/incubator/foreign/LibraryLookup$Symbol flags 601 +innerclass innerClass jdk/incubator/foreign/LibraryLookup$Symbol outerClass jdk/incubator/foreign/LibraryLookup innerClassName Symbol flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name lookup descriptor (Ljava/lang/String;)Ljava/util/Optional; flags 401 signature (Ljava/lang/String;)Ljava/util/Optional; +method name ofDefault descriptor ()Ljdk/incubator/foreign/LibraryLookup; flags 9 +method name ofPath descriptor (Ljava/nio/file/Path;)Ljdk/incubator/foreign/LibraryLookup; flags 9 +method name ofLibrary descriptor (Ljava/lang/String;)Ljdk/incubator/foreign/LibraryLookup; flags 9 + +class name jdk/incubator/foreign/LibraryLookup$Symbol +header extends java/lang/Object implements jdk/incubator/foreign/Addressable nestHost jdk/incubator/foreign/LibraryLookup flags 601 +innerclass innerClass jdk/incubator/foreign/LibraryLookup$Symbol outerClass jdk/incubator/foreign/LibraryLookup innerClassName Symbol flags 609 +method name name descriptor ()Ljava/lang/String; flags 401 +method name address descriptor ()Ljdk/incubator/foreign/MemoryAddress; flags 401 + +-class name jdk/incubator/foreign/MappedMemorySegment + +class name jdk/incubator/foreign/MappedMemorySegments +header extends java/lang/Object flags 31 +method name isLoaded descriptor (Ljdk/incubator/foreign/MemorySegment;)Z flags 9 +method name load descriptor (Ljdk/incubator/foreign/MemorySegment;)V flags 9 +method name unload descriptor (Ljdk/incubator/foreign/MemorySegment;)V flags 9 +method name force descriptor (Ljdk/incubator/foreign/MemorySegment;)V flags 9 + +class name jdk/incubator/foreign/MemoryAccess +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name getByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)B flags 9 +method name setByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JB)V flags 9 +method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 +method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 +method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 +method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 +method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 +method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 +method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 +method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 +method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 +method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 +method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 +method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 +method name getAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 +method name setAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 +method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 +method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 +method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 +method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 +method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 +method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 +method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 +method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 +method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 +method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 +method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 +method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 +method name getByte descriptor (Ljdk/incubator/foreign/MemorySegment;)B flags 9 +method name setByte descriptor (Ljdk/incubator/foreign/MemorySegment;B)V flags 9 +method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;)C flags 9 +method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;C)V flags 9 +method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;)S flags 9 +method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;S)V flags 9 +method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;)I flags 9 +method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;I)V flags 9 +method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;)F flags 9 +method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;F)V flags 9 +method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;)J flags 9 +method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;J)V flags 9 +method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;)D flags 9 +method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;D)V flags 9 +method name getAddress descriptor (Ljdk/incubator/foreign/MemorySegment;)Ljdk/incubator/foreign/MemoryAddress; flags 9 +method name setAddress descriptor (Ljdk/incubator/foreign/MemorySegment;Ljdk/incubator/foreign/Addressable;)V flags 9 +method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)C flags 9 +method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;C)V flags 9 +method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)S flags 9 +method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;S)V flags 9 +method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)I flags 9 +method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;I)V flags 9 +method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)F flags 9 +method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;F)V flags 9 +method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)J flags 9 +method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;J)V flags 9 +method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)D flags 9 +method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;D)V flags 9 +method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 +method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 +method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 +method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 +method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 +method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 +method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 +method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 +method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 +method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 +method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 +method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 +method name getAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 +method name setAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 +method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 +method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 +method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 +method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 +method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 +method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 +method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 +method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 +method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 +method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 +method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 +method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 + +class name jdk/incubator/foreign/MemoryAddress +header extends java/lang/Object implements jdk/incubator/foreign/Addressable flags 601 +-method name segment descriptor ()Ljdk/incubator/foreign/MemorySegment; +-method name segmentOffset descriptor ()J +-method name rebase descriptor (Ljdk/incubator/foreign/MemorySegment;)Ljdk/incubator/foreign/MemoryAddress; +method name address descriptor ()Ljdk/incubator/foreign/MemoryAddress; flags 1 +method name segmentOffset descriptor (Ljdk/incubator/foreign/MemorySegment;)J flags 401 +method name asSegmentRestricted descriptor (J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name asSegmentRestricted descriptor (JLjava/lang/Runnable;Ljava/lang/Object;)Ljdk/incubator/foreign/MemorySegment; flags 401 + +class name jdk/incubator/foreign/MemoryHandles +-method name withOffset descriptor (Ljava/lang/invoke/VarHandle;J)Ljava/lang/invoke/VarHandle; +-method name withStride descriptor (Ljava/lang/invoke/VarHandle;J)Ljava/lang/invoke/VarHandle; + +class name jdk/incubator/foreign/MemoryLayouts +field name ADDRESS descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 + +class name jdk/incubator/foreign/MemorySegment +header extends java/lang/Object implements jdk/incubator/foreign/Addressable,java/lang/AutoCloseable flags 601 +innerclass innerClass java/nio/channels/FileChannel$MapMode outerClass java/nio/channels/FileChannel innerClassName MapMode flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-field name ACQUIRE descriptor I +field name SHARE descriptor I constantValue 8 flags 19 +-method name baseAddress descriptor ()Ljdk/incubator/foreign/MemoryAddress; +-method name spliterator descriptor (Ljdk/incubator/foreign/MemorySegment;Ljdk/incubator/foreign/SequenceLayout;)Ljava/util/Spliterator; +-method name withOwnerThread descriptor (Ljava/lang/Thread;)Ljdk/incubator/foreign/MemorySegment; +-method name mapFromPath descriptor (Ljava/nio/file/Path;JJLjava/nio/channels/FileChannel$MapMode;)Ljdk/incubator/foreign/MappedMemorySegment; +-method name ofNativeRestricted descriptor (Ljdk/incubator/foreign/MemoryAddress;JLjava/lang/Thread;Ljava/lang/Runnable;Ljava/lang/Object;)Ljdk/incubator/foreign/MemorySegment; +method name address descriptor ()Ljdk/incubator/foreign/MemoryAddress; flags 401 +method name spliterator descriptor (Ljdk/incubator/foreign/SequenceLayout;)Ljava/util/Spliterator; flags 401 signature (Ljdk/incubator/foreign/SequenceLayout;)Ljava/util/Spliterator; +method name asSlice descriptor (Ljdk/incubator/foreign/MemoryAddress;J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name asSlice descriptor (J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name asSlice descriptor (Ljdk/incubator/foreign/MemoryAddress;)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name isMapped descriptor ()Z flags 401 +method name handoff descriptor (Ljava/lang/Thread;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name handoff descriptor (Ljdk/incubator/foreign/NativeScope;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name share descriptor ()Ljdk/incubator/foreign/MemorySegment; flags 401 +method name registerCleaner descriptor (Ljava/lang/ref/Cleaner;)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name toShortArray descriptor ()[S flags 401 +method name toCharArray descriptor ()[C flags 401 +method name toIntArray descriptor ()[I flags 401 +method name toFloatArray descriptor ()[F flags 401 +method name toLongArray descriptor ()[J flags 401 +method name toDoubleArray descriptor ()[D flags 401 +method name mapFile descriptor (Ljava/nio/file/Path;JJLjava/nio/channels/FileChannel$MapMode;)Ljdk/incubator/foreign/MemorySegment; thrownTypes java/io/IOException flags 9 +method name ofNativeRestricted descriptor ()Ljdk/incubator/foreign/MemorySegment; flags 9 + +class name jdk/incubator/foreign/NativeScope +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +innerclass innerClass jdk/incubator/foreign/MemoryLayout$PathElement outerClass jdk/incubator/foreign/MemoryLayout innerClassName PathElement flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name byteSize descriptor ()Ljava/util/OptionalLong; flags 401 +method name ownerThread descriptor ()Ljava/lang/Thread; flags 401 +method name allocatedBytes descriptor ()J flags 401 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;B)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;C)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;S)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;I)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;F)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;D)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/ValueLayout;Ljdk/incubator/foreign/Addressable;)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[B)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[S)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[C)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[I)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[F)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[D)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/ValueLayout;[Ljdk/incubator/foreign/Addressable;)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (Ljdk/incubator/foreign/MemoryLayout;)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocateArray descriptor (Ljdk/incubator/foreign/MemoryLayout;J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (J)Ljdk/incubator/foreign/MemorySegment; flags 1 +method name allocate descriptor (JJ)Ljdk/incubator/foreign/MemorySegment; flags 401 +method name close descriptor ()V flags 401 +method name boundedScope descriptor (J)Ljdk/incubator/foreign/NativeScope; flags 9 +method name unboundedScope descriptor ()Ljdk/incubator/foreign/NativeScope; flags 9 + diff --git a/make/data/symbols/jdk.incubator.jpackage-G.sym.txt b/make/data/symbols/jdk.incubator.jpackage-G.sym.txt new file mode 100644 index 0000000000000..3db44ac73f7bc --- /dev/null +++ b/make/data/symbols/jdk.incubator.jpackage-G.sym.txt @@ -0,0 +1,30 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +-module name jdk.incubator.jpackage + diff --git a/make/data/symbols/jdk.incubator.vector-G.sym.txt b/make/data/symbols/jdk.incubator.vector-G.sym.txt new file mode 100644 index 0000000000000..a8cdeef1d701b --- /dev/null +++ b/make/data/symbols/jdk.incubator.vector-G.sym.txt @@ -0,0 +1,1441 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.incubator.vector +header exports jdk/incubator/vector requires name\u0020;java.base\u0020;flags\u0020;8000 target linux-amd64 resolution 9 flags 8000 + +class name jdk/incubator/vector/AbstractVector +header extends jdk/incubator/vector/Vector flags 420 signature Ljdk/incubator/vector/Vector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Conversion outerClass jdk/incubator/vector/VectorOperators innerClassName Conversion flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name species descriptor ()Ljdk/incubator/vector/VectorSpecies; flags 11 signature ()Ljdk/incubator/vector/VectorSpecies; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name check descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/Vector; flags 11 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/Vector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name check descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/Vector; flags 11 signature (Ljava/lang/Class;)Ljdk/incubator/vector/Vector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name maskAll descriptor (Z)Ljdk/incubator/vector/VectorMask; flags 11 signature (Z)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name convert descriptor (Ljdk/incubator/vector/VectorOperators$Conversion;I)Ljdk/incubator/vector/Vector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Conversion;I)Ljdk/incubator/vector/Vector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name castShape descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; flags 11 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name convertShape descriptor (Ljdk/incubator/vector/VectorOperators$Conversion;Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Conversion;Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/ByteVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (B)Ljdk/incubator/vector/ByteVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;B)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;B)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/ByteVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/ByteVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;BB)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;BBLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;BBLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;B)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;B)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;BLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;BLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;BLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;BLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (B)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name not descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (B)Ljdk/incubator/vector/VectorMask; flags 11 signature (B)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (B)Ljdk/incubator/vector/VectorMask; flags 11 signature (B)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;B)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;B)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/ByteVector; flags 401 +method name blend descriptor (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/ByteVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/ByteVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/ByteVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; +method name unslice descriptor (I)Ljdk/incubator/vector/ByteVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/ByteVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (BB)Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (BLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; flags 11 signature (BLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;B)Ljdk/incubator/vector/ByteVector; flags 11 signature (Ljdk/incubator/vector/Vector;B)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)B flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)B flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)B +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)B flags 401 +method name withLane descriptor (IB)Ljdk/incubator/vector/ByteVector; flags 401 +method name toArray descriptor ()[B flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BI)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BI)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BI[II)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BI[II)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ByteVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([BI)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([BILjdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([BI[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([BI[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([BI[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 11 signature ()Ljdk/incubator/vector/Vector<*>; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/DoubleVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;D)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;D)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/DoubleVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/DoubleVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;DD)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;DDLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;DDLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;D)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;D)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;DLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;DLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;DLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;DLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name pow descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name pow descriptor (D)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sqrt descriptor ()Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (D)Ljdk/incubator/vector/VectorMask; flags 11 signature (D)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (D)Ljdk/incubator/vector/VectorMask; flags 11 signature (D)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;D)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;D)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/DoubleVector; flags 401 +method name blend descriptor (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (DLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/DoubleVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/DoubleVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/DoubleVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; +method name unslice descriptor (I)Ljdk/incubator/vector/DoubleVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/DoubleVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; +method name fma descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fma descriptor (DD)Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)D flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)D flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)D +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)D flags 401 +method name withLane descriptor (ID)Ljdk/incubator/vector/DoubleVector; flags 401 +method name toArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[DI)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[DI)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[DILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[DILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[DI[II)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[DI[II)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[DI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[DI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/DoubleVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([DI)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([DILjdk/incubator/vector/VectorMask;)V flags 11 signature ([DILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([DI[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([DI[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([DI[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/FloatVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (F)Ljdk/incubator/vector/FloatVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;F)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;F)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/FloatVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/FloatVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;FF)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;FFLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;FFLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;F)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;F)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;FLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;FLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;FLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;FLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name pow descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name pow descriptor (F)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sqrt descriptor ()Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (F)Ljdk/incubator/vector/VectorMask; flags 11 signature (F)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (F)Ljdk/incubator/vector/VectorMask; flags 11 signature (F)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;F)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;F)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/FloatVector; flags 401 +method name blend descriptor (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (FLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/FloatVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/FloatVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/FloatVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; +method name unslice descriptor (I)Ljdk/incubator/vector/FloatVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/FloatVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; +method name fma descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fma descriptor (FF)Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)F flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)F flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)F +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)F flags 401 +method name withLane descriptor (IF)Ljdk/incubator/vector/FloatVector; flags 401 +method name toArray descriptor ()[F flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[FI)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[FI)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[FILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[FILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[FI[II)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[FI[II)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[FI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[FI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/FloatVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([FI)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([FILjdk/incubator/vector/VectorMask;)V flags 11 signature ([FILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([FI[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([FI[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([FI[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/IntVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (I)Ljdk/incubator/vector/IntVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/IntVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/IntVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;II)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (I)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name not descriptor ()Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (I)Ljdk/incubator/vector/VectorMask; flags 11 signature (I)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (I)Ljdk/incubator/vector/VectorMask; flags 11 signature (I)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;I)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;I)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/IntVector; flags 401 +method name blend descriptor (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/IntVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; +method name unslice descriptor (I)Ljdk/incubator/vector/IntVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/IntVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (II)Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; flags 11 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; flags 11 signature (Ljdk/incubator/vector/Vector;I)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)I flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)I flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)I +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)I flags 401 +method name withLane descriptor (II)Ljdk/incubator/vector/IntVector; flags 401 +method name toArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[II)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[II)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[II[II)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[II[II)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[II[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[II[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/IntVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([II[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([II[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([II[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/IntVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/FloatVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/LongVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/LongVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/LongVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;JJ)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;JJLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;JJLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;J)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;J)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;JLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;JLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;JLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;JLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (J)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name not descriptor ()Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (J)Ljdk/incubator/vector/VectorMask; flags 11 signature (J)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (J)Ljdk/incubator/vector/VectorMask; flags 11 signature (J)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/LongVector; flags 401 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/LongVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/LongVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/LongVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; +method name unslice descriptor (I)Ljdk/incubator/vector/LongVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/LongVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (JJ)Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (JLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; flags 11 signature (JLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;J)Ljdk/incubator/vector/LongVector; flags 11 signature (Ljdk/incubator/vector/Vector;J)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)J flags 401 +method name withLane descriptor (IJ)Ljdk/incubator/vector/LongVector; flags 401 +method name toArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[JI)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[JI)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[JILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[JILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[JI[II)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[JI[II)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[JI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[JI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/LongVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([JI)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([JILjdk/incubator/vector/VectorMask;)V flags 11 signature ([JILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([JI[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([JI[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([JI[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/LongVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/DoubleVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/ShortVector +header extends jdk/incubator/vector/AbstractVector flags 421 signature Ljdk/incubator/vector/AbstractVector; +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name SPECIES_64 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_128 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_256 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_512 descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_MAX descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +field name SPECIES_PREFERRED descriptor Ljdk/incubator/vector/VectorSpecies; flags 19 signature Ljdk/incubator/vector/VectorSpecies; +method name zero descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (S)Ljdk/incubator/vector/ShortVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;S)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;S)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/ShortVector; flags 401 +method name broadcast descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/ShortVector; flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;SS)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;SSLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;SSLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;S)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;S)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;SLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;SLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;SLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Ternary;SLjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name max descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name and descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name or descriptor (S)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name not descriptor ()Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name eq descriptor (S)Ljdk/incubator/vector/VectorMask; flags 11 signature (S)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lt descriptor (S)Ljdk/incubator/vector/VectorMask; flags 11 signature (S)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;S)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;S)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 11 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; +method name addIndex descriptor (I)Ljdk/incubator/vector/ShortVector; flags 401 +method name blend descriptor (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 11 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (I)Ljdk/incubator/vector/ShortVector; flags 401 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/ShortVector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/ShortVector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; +method name unslice descriptor (I)Ljdk/incubator/vector/ShortVector; flags 401 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/ShortVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (SS)Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (SLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; flags 11 signature (SLjdk/incubator/vector/Vector;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name bitwiseBlend descriptor (Ljdk/incubator/vector/Vector;S)Ljdk/incubator/vector/ShortVector; flags 11 signature (Ljdk/incubator/vector/Vector;S)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)S flags 401 +method name reduceLanes descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)S flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)S +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name lane descriptor (I)S flags 401 +method name withLane descriptor (IS)Ljdk/incubator/vector/ShortVector; flags 401 +method name toArray descriptor ()[S flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toIntArray descriptor ()[I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toLongArray descriptor ()[J flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toDoubleArray descriptor ()[D flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteArray descriptor (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[SI)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[SI)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[SILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[SILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[SI[II)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[SI[II)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[SI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[SI[IILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromByteBuffer descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/ShortVector; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([SI)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([SILjdk/incubator/vector/VectorMask;)V flags 11 signature ([SILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([SI[II)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoArray descriptor ([SI[IILjdk/incubator/vector/VectorMask;)V flags 11 signature ([SI[IILjdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 11 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/ShortVector; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 11 signature ()Ljdk/incubator/vector/Vector<*>; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name equals descriptor (Ljava/lang/Object;)Z flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name hashCode descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/AbstractVector; flags 1041 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toArray descriptor ()Ljava/lang/Object; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 1041 +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 1041 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 1041 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 1041 + +class name jdk/incubator/vector/Vector +header extends jdk/internal/vm/vector/VectorSupport$Vector flags 421 signature Ljdk/internal/vm/vector/VectorSupport$Vector; +innerclass innerClass jdk/internal/vm/vector/VectorSupport$Vector outerClass jdk/internal/vm/vector/VectorSupport innerClassName Vector flags 9 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Conversion outerClass jdk/incubator/vector/VectorOperators innerClassName Conversion flags 609 +method name species descriptor ()Ljdk/incubator/vector/VectorSpecies; flags 401 signature ()Ljdk/incubator/vector/VectorSpecies; +method name elementType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class; +method name elementSize descriptor ()I flags 401 +method name shape descriptor ()Ljdk/incubator/vector/VectorShape; flags 401 +method name length descriptor ()I flags 401 +method name bitSize descriptor ()I flags 401 +method name byteSize descriptor ()I flags 401 +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Unary;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Unary;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;J)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Binary;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name lanewise descriptor (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Ternary;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name add descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name add descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name sub descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name sub descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name mul descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name mul descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name div descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name div descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name neg descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector; +method name abs descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector; +method name min descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name max descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;)J flags 401 +method name reduceLanesToLong descriptor (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J flags 401 signature (Ljdk/incubator/vector/VectorOperators$Associative;Ljdk/incubator/vector/VectorMask;)J +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;)Ljdk/incubator/vector/VectorMask; +method name test descriptor (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Test;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name eq descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name lt descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;J)Ljdk/incubator/vector/VectorMask; +method name compare descriptor (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Comparison;JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name blend descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name blend descriptor (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (JLjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name addIndex descriptor (I)Ljdk/incubator/vector/Vector; flags 401 signature (I)Ljdk/incubator/vector/Vector; +method name slice descriptor (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (ILjdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name slice descriptor (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (ILjdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name slice descriptor (I)Ljdk/incubator/vector/Vector; flags 401 signature (I)Ljdk/incubator/vector/Vector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; flags 401 signature (ILjdk/incubator/vector/Vector;I)Ljdk/incubator/vector/Vector; +method name unslice descriptor (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (ILjdk/incubator/vector/Vector;ILjdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name unslice descriptor (I)Ljdk/incubator/vector/Vector; flags 401 signature (I)Ljdk/incubator/vector/Vector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/Vector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;)Ljdk/incubator/vector/Vector; +method name selectFrom descriptor (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/Vector;Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/Vector; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 401 signature (J)Ljdk/incubator/vector/Vector; +method name maskAll descriptor (Z)Ljdk/incubator/vector/VectorMask; flags 401 signature (Z)Ljdk/incubator/vector/VectorMask; +method name toShuffle descriptor ()Ljdk/incubator/vector/VectorShuffle; flags 401 signature ()Ljdk/incubator/vector/VectorShuffle; +method name reinterpretShape descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; +method name reinterpretAsBytes descriptor ()Ljdk/incubator/vector/ByteVector; flags 401 +method name reinterpretAsShorts descriptor ()Ljdk/incubator/vector/ShortVector; flags 401 +method name reinterpretAsInts descriptor ()Ljdk/incubator/vector/IntVector; flags 401 +method name reinterpretAsLongs descriptor ()Ljdk/incubator/vector/LongVector; flags 401 +method name reinterpretAsFloats descriptor ()Ljdk/incubator/vector/FloatVector; flags 401 +method name reinterpretAsDoubles descriptor ()Ljdk/incubator/vector/DoubleVector; flags 401 +method name viewAsIntegralLanes descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector<*>; +method name viewAsFloatingLanes descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector<*>; +method name convert descriptor (Ljdk/incubator/vector/VectorOperators$Conversion;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Conversion;I)Ljdk/incubator/vector/Vector; +method name convertShape descriptor (Ljdk/incubator/vector/VectorOperators$Conversion;Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorOperators$Conversion;Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; +method name castShape descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/Vector; +method name check descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljava/lang/Class;)Ljdk/incubator/vector/Vector; +method name check descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/Vector; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/Vector; +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;)V flags 401 +method name intoByteArray descriptor ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 401 signature ([BILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;)V flags 401 +method name intoByteBuffer descriptor (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V flags 401 signature (Ljava/nio/ByteBuffer;ILjava/nio/ByteOrder;Ljdk/incubator/vector/VectorMask;)V +method name toArray descriptor ()Ljava/lang/Object; flags 401 +method name toIntArray descriptor ()[I flags 401 +method name toLongArray descriptor ()[J flags 401 +method name toDoubleArray descriptor ()[D flags 401 +method name toString descriptor ()Ljava/lang/String; flags 401 +method name equals descriptor (Ljava/lang/Object;)Z flags 401 +method name hashCode descriptor ()I flags 401 + +class name jdk/incubator/vector/VectorMask +header extends jdk/internal/vm/vector/VectorSupport$VectorMask flags 421 signature Ljdk/internal/vm/vector/VectorSupport$VectorMask; +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorMask outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorMask flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name vectorSpecies descriptor ()Ljdk/incubator/vector/VectorSpecies; flags 401 signature ()Ljdk/incubator/vector/VectorSpecies; +method name length descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromValues descriptor (Ljdk/incubator/vector/VectorSpecies;[Z)Ljdk/incubator/vector/VectorMask; flags 89 signature (Ljdk/incubator/vector/VectorSpecies;[Z)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[ZI)Ljdk/incubator/vector/VectorMask; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[ZI)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromLong descriptor (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/VectorMask; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;J)Ljdk/incubator/vector/VectorMask; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name cast descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorMask; +method name toLong descriptor ()J flags 401 +method name toArray descriptor ()[Z flags 401 +method name intoArray descriptor ([ZI)V flags 401 +method name anyTrue descriptor ()Z flags 401 +method name allTrue descriptor ()Z flags 401 +method name trueCount descriptor ()I flags 401 +method name firstTrue descriptor ()I flags 401 +method name lastTrue descriptor ()I flags 401 +method name and descriptor (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name or descriptor (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name eq descriptor (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name andNot descriptor (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorMask;)Ljdk/incubator/vector/VectorMask; +method name not descriptor ()Ljdk/incubator/vector/VectorMask; flags 401 signature ()Ljdk/incubator/vector/VectorMask; +method name indexInRange descriptor (II)Ljdk/incubator/vector/VectorMask; flags 401 signature (II)Ljdk/incubator/vector/VectorMask; +method name toVector descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector; +method name laneIsSet descriptor (I)Z flags 401 +method name check descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorMask; +method name check descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorMask; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorMask; +method name toString descriptor ()Ljava/lang/String; flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name hashCode descriptor ()I flags 11 + +class name jdk/incubator/vector/VectorOperators +header extends java/lang/Object nestMembers jdk/incubator/vector/VectorOperators$Conversion,jdk/incubator/vector/VectorOperators$Comparison,jdk/incubator/vector/VectorOperators$Test,jdk/incubator/vector/VectorOperators$Associative,jdk/incubator/vector/VectorOperators$Ternary,jdk/incubator/vector/VectorOperators$Binary,jdk/incubator/vector/VectorOperators$Unary,jdk/incubator/vector/VectorOperators$Operator flags 421 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Conversion outerClass jdk/incubator/vector/VectorOperators innerClassName Conversion flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name NOT descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ZOMO descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ABS descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name NEG descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name SIN descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name COS descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name TAN descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ASIN descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ACOS descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ATAN descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name EXP descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name LOG descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name LOG10 descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name SQRT descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name CBRT descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name SINH descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name COSH descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name TANH descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name EXPM1 descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name LOG1P descriptor Ljdk/incubator/vector/VectorOperators$Unary; flags 19 +field name ADD descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name SUB descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name MUL descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name DIV descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name MIN descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name MAX descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name FIRST_NONZERO descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name AND descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name AND_NOT descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name OR descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name XOR descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 +field name LSHL descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name ASHR descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name LSHR descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name ROL descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name ROR descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name ATAN2 descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name POW descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name HYPOT descriptor Ljdk/incubator/vector/VectorOperators$Binary; flags 19 +field name BITWISE_BLEND descriptor Ljdk/incubator/vector/VectorOperators$Ternary; flags 19 +field name FMA descriptor Ljdk/incubator/vector/VectorOperators$Ternary; flags 19 +field name IS_DEFAULT descriptor Ljdk/incubator/vector/VectorOperators$Test; flags 19 +field name IS_NEGATIVE descriptor Ljdk/incubator/vector/VectorOperators$Test; flags 19 +field name IS_FINITE descriptor Ljdk/incubator/vector/VectorOperators$Test; flags 19 +field name IS_NAN descriptor Ljdk/incubator/vector/VectorOperators$Test; flags 19 +field name IS_INFINITE descriptor Ljdk/incubator/vector/VectorOperators$Test; flags 19 +field name EQ descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name NE descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name LT descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name LE descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name GT descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name GE descriptor Ljdk/incubator/vector/VectorOperators$Comparison; flags 19 +field name B2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name B2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name B2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name B2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name B2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name D2B descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name D2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name D2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name D2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name D2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name F2B descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name F2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name F2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name F2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name F2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name I2B descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name I2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name I2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name I2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name I2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name L2B descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name L2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name L2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name L2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name L2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name S2B descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name S2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name S2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name S2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name S2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name REINTERPRET_D2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name REINTERPRET_F2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name REINTERPRET_I2F descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name REINTERPRET_L2D descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_B2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_B2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_B2S descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_I2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_S2I descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; +field name ZERO_EXTEND_S2L descriptor Ljdk/incubator/vector/VectorOperators$Conversion; flags 19 signature Ljdk/incubator/vector/VectorOperators$Conversion; + +class name jdk/incubator/vector/VectorOperators$Associative +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Binary nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Associative outerClass jdk/incubator/vector/VectorOperators innerClassName Associative flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 + +class name jdk/incubator/vector/VectorOperators$Binary +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Binary outerClass jdk/incubator/vector/VectorOperators innerClassName Binary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 + +class name jdk/incubator/vector/VectorOperators$Comparison +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Comparison outerClass jdk/incubator/vector/VectorOperators innerClassName Comparison flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 + +class name jdk/incubator/vector/VectorOperators$Conversion +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 signature Ljava/lang/Object;Ljdk/incubator/vector/VectorOperators$Operator; +innerclass innerClass jdk/incubator/vector/VectorOperators$Conversion outerClass jdk/incubator/vector/VectorOperators innerClassName Conversion flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +method name domainType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class; +method name rangeType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class; +method name check descriptor (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; flags 401 signature (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; +method name ofCast descriptor (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; flags 9 signature (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name ofReinterpret descriptor (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; flags 9 signature (Ljava/lang/Class;Ljava/lang/Class;)Ljdk/incubator/vector/VectorOperators$Conversion; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; + +class name jdk/incubator/vector/VectorOperators$Operator +header extends java/lang/Object nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 +method name name descriptor ()Ljava/lang/String; flags 401 +method name operatorName descriptor ()Ljava/lang/String; flags 401 +method name arity descriptor ()I flags 401 +method name isBoolean descriptor ()Z flags 401 +method name rangeType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class<*>; +method name isAssociative descriptor ()Z flags 401 +method name compatibleWith descriptor (Ljava/lang/Class;)Z flags 401 signature (Ljava/lang/Class<*>;)Z + +class name jdk/incubator/vector/VectorOperators$Ternary +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Ternary outerClass jdk/incubator/vector/VectorOperators innerClassName Ternary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 + +class name jdk/incubator/vector/VectorOperators$Test +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Test outerClass jdk/incubator/vector/VectorOperators innerClassName Test flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 + +class name jdk/incubator/vector/VectorOperators$Unary +header extends java/lang/Object implements jdk/incubator/vector/VectorOperators$Operator nestHost jdk/incubator/vector/VectorOperators flags 601 +innerclass innerClass jdk/incubator/vector/VectorOperators$Unary outerClass jdk/incubator/vector/VectorOperators innerClassName Unary flags 609 +innerclass innerClass jdk/incubator/vector/VectorOperators$Operator outerClass jdk/incubator/vector/VectorOperators innerClassName Operator flags 609 + +class name jdk/incubator/vector/VectorShape +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +field name S_64_BIT descriptor Ljdk/incubator/vector/VectorShape; flags 4019 +field name S_128_BIT descriptor Ljdk/incubator/vector/VectorShape; flags 4019 +field name S_256_BIT descriptor Ljdk/incubator/vector/VectorShape; flags 4019 +field name S_512_BIT descriptor Ljdk/incubator/vector/VectorShape; flags 4019 +field name S_Max_BIT descriptor Ljdk/incubator/vector/VectorShape; flags 4019 +method name values descriptor ()[Ljdk/incubator/vector/VectorShape; flags 9 +method name valueOf descriptor (Ljava/lang/String;)Ljdk/incubator/vector/VectorShape; flags 9 +method name vectorBitSize descriptor ()I flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name withLanes descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; flags 1 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; +method name forBitSize descriptor (I)Ljdk/incubator/vector/VectorShape; flags 9 +method name forIndexBitSize descriptor (II)Ljdk/incubator/vector/VectorShape; flags 9 +method name preferredShape descriptor ()Ljdk/incubator/vector/VectorShape; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; + +class name jdk/incubator/vector/VectorShuffle +header extends jdk/internal/vm/vector/VectorSupport$VectorShuffle flags 421 signature Ljdk/internal/vm/vector/VectorSupport$VectorShuffle; +innerclass innerClass jdk/internal/vm/vector/VectorSupport$VectorShuffle outerClass jdk/internal/vm/vector/VectorSupport innerClassName VectorShuffle flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name vectorSpecies descriptor ()Ljdk/incubator/vector/VectorSpecies; flags 401 signature ()Ljdk/incubator/vector/VectorSpecies; +method name length descriptor ()I flags 11 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name cast descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorShuffle; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorShuffle; +method name check descriptor (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorShuffle; flags 401 signature (Ljdk/incubator/vector/VectorSpecies;)Ljdk/incubator/vector/VectorShuffle; +method name checkIndex descriptor (I)I flags 401 +method name wrapIndex descriptor (I)I flags 401 +method name checkIndexes descriptor ()Ljdk/incubator/vector/VectorShuffle; flags 401 signature ()Ljdk/incubator/vector/VectorShuffle; +method name wrapIndexes descriptor ()Ljdk/incubator/vector/VectorShuffle; flags 401 signature ()Ljdk/incubator/vector/VectorShuffle; +method name laneIsValid descriptor ()Ljdk/incubator/vector/VectorMask; flags 401 signature ()Ljdk/incubator/vector/VectorMask; +method name fromValues descriptor (Ljdk/incubator/vector/VectorSpecies;[I)Ljdk/incubator/vector/VectorShuffle; flags 89 signature (Ljdk/incubator/vector/VectorSpecies;[I)Ljdk/incubator/vector/VectorShuffle; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromArray descriptor (Ljdk/incubator/vector/VectorSpecies;[II)Ljdk/incubator/vector/VectorShuffle; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;[II)Ljdk/incubator/vector/VectorShuffle; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name fromOp descriptor (Ljdk/incubator/vector/VectorSpecies;Ljava/util/function/IntUnaryOperator;)Ljdk/incubator/vector/VectorShuffle; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;Ljava/util/function/IntUnaryOperator;)Ljdk/incubator/vector/VectorShuffle; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name iota descriptor (Ljdk/incubator/vector/VectorSpecies;IIZ)Ljdk/incubator/vector/VectorShuffle; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;IIZ)Ljdk/incubator/vector/VectorShuffle; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name makeZip descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/VectorShuffle; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/VectorShuffle; +method name makeUnzip descriptor (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/VectorShuffle; flags 9 signature (Ljdk/incubator/vector/VectorSpecies;I)Ljdk/incubator/vector/VectorShuffle; +method name toArray descriptor ()[I flags 401 +method name intoArray descriptor ([II)V flags 401 +method name toVector descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector; +method name laneSource descriptor (I)I flags 1 +method name rearrange descriptor (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/VectorShuffle; flags 401 signature (Ljdk/incubator/vector/VectorShuffle;)Ljdk/incubator/vector/VectorShuffle; +method name toString descriptor ()Ljava/lang/String; flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name hashCode descriptor ()I flags 11 + +class name jdk/incubator/vector/VectorSpecies +header extends java/lang/Object flags 601 signature Ljava/lang/Object; +method name elementType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class; +method name vectorType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class<+Ljdk/incubator/vector/Vector;>; +method name maskType descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class<+Ljdk/incubator/vector/VectorMask;>; +method name elementSize descriptor ()I flags 401 +method name vectorShape descriptor ()Ljdk/incubator/vector/VectorShape; flags 401 +method name length descriptor ()I flags 401 +method name vectorBitSize descriptor ()I flags 401 +method name vectorByteSize descriptor ()I flags 401 +method name loopBound descriptor (I)I flags 401 +method name indexInRange descriptor (II)Ljdk/incubator/vector/VectorMask; flags 401 signature (II)Ljdk/incubator/vector/VectorMask; +method name check descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; flags 401 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; +method name partLimit descriptor (Ljdk/incubator/vector/VectorSpecies;Z)I flags 401 signature (Ljdk/incubator/vector/VectorSpecies<*>;Z)I +method name withLanes descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; flags 401 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; +method name withShape descriptor (Ljdk/incubator/vector/VectorShape;)Ljdk/incubator/vector/VectorSpecies; flags 401 signature (Ljdk/incubator/vector/VectorShape;)Ljdk/incubator/vector/VectorSpecies; +method name of descriptor (Ljava/lang/Class;Ljdk/incubator/vector/VectorShape;)Ljdk/incubator/vector/VectorSpecies; flags 9 signature (Ljava/lang/Class;Ljdk/incubator/vector/VectorShape;)Ljdk/incubator/vector/VectorSpecies; +method name ofLargestShape descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; flags 9 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; +method name ofPreferred descriptor (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; flags 9 signature (Ljava/lang/Class;)Ljdk/incubator/vector/VectorSpecies; +method name elementSize descriptor (Ljava/lang/Class;)I flags 9 signature (Ljava/lang/Class<*>;)I +method name zero descriptor ()Ljdk/incubator/vector/Vector; flags 401 signature ()Ljdk/incubator/vector/Vector; +method name fromArray descriptor (Ljava/lang/Object;I)Ljdk/incubator/vector/Vector; flags 401 signature (Ljava/lang/Object;I)Ljdk/incubator/vector/Vector; +method name fromByteArray descriptor ([BILjava/nio/ByteOrder;)Ljdk/incubator/vector/Vector; flags 401 signature ([BILjava/nio/ByteOrder;)Ljdk/incubator/vector/Vector; +method name loadMask descriptor ([ZI)Ljdk/incubator/vector/VectorMask; flags 401 signature ([ZI)Ljdk/incubator/vector/VectorMask; +method name maskAll descriptor (Z)Ljdk/incubator/vector/VectorMask; flags 401 signature (Z)Ljdk/incubator/vector/VectorMask; +method name broadcast descriptor (J)Ljdk/incubator/vector/Vector; flags 401 signature (J)Ljdk/incubator/vector/Vector; +method name checkValue descriptor (J)J flags 401 +method name shuffleFromValues descriptor ([I)Ljdk/incubator/vector/VectorShuffle; flags 481 signature ([I)Ljdk/incubator/vector/VectorShuffle; +method name shuffleFromArray descriptor ([II)Ljdk/incubator/vector/VectorShuffle; flags 401 signature ([II)Ljdk/incubator/vector/VectorShuffle; +method name shuffleFromOp descriptor (Ljava/util/function/IntUnaryOperator;)Ljdk/incubator/vector/VectorShuffle; flags 401 signature (Ljava/util/function/IntUnaryOperator;)Ljdk/incubator/vector/VectorShuffle; +method name iotaShuffle descriptor (IIZ)Ljdk/incubator/vector/VectorShuffle; flags 401 signature (IIZ)Ljdk/incubator/vector/VectorShuffle; +method name toString descriptor ()Ljava/lang/String; flags 401 +method name equals descriptor (Ljava/lang/Object;)Z flags 401 +method name hashCode descriptor ()I flags 401 + diff --git a/make/data/symbols/jdk.jartool-G.sym.txt b/make/data/symbols/jdk.jartool-G.sym.txt new file mode 100644 index 0000000000000..d3ee79dab532e --- /dev/null +++ b/make/data/symbols/jdk.jartool-G.sym.txt @@ -0,0 +1,39 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/security/jarsigner/JarSigner +header extends java/lang/Object nestMembers jdk/security/jarsigner/JarSigner$Builder flags 31 +innerclass innerClass jdk/security/jarsigner/JarSigner$Builder outerClass jdk/security/jarsigner/JarSigner innerClassName Builder flags 9 +innerclass innerClass java/util/jar/Attributes$Name outerClass java/util/jar/Attributes innerClassName Name flags 9 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/util/Base64$Encoder outerClass java/util/Base64 innerClassName Encoder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/security/jarsigner/JarSignerException +header extends java/lang/RuntimeException flags 21 + diff --git a/make/data/symbols/jdk.javadoc-G.sym.txt b/make/data/symbols/jdk.javadoc-G.sym.txt new file mode 100644 index 0000000000000..c702a6c0ae69b --- /dev/null +++ b/make/data/symbols/jdk.javadoc-G.sym.txt @@ -0,0 +1,39 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.javadoc +header exports jdk/javadoc/doclet requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.xml\u0020;flags\u0020;0,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;jdk.compiler\u0020;flags\u0020;20 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/javadoc/internal/tool/JavadocToolProvider,interface\u0020;javax/tools/DocumentationTool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool,interface\u0020;javax/tools/Tool\u0020;impls\u0020;jdk/javadoc/internal/api/JavadocTool,interface\u0020;com/sun/tools/doclint/DocLint\u0020;impls\u0020;jdk/javadoc/internal/doclint/DocLint target linux-amd64 flags 8000 + +class name jdk/javadoc/doclet/Reporter +header extends java/lang/Object flags 601 +innerclass innerClass javax/tools/Diagnostic$Kind outerClass javax/tools/Diagnostic innerClassName Kind flags 4019 + +class name jdk/javadoc/doclet/StandardDoclet +header extends java/lang/Object implements jdk/javadoc/doclet/Doclet flags 21 +innerclass innerClass jdk/javadoc/doclet/Doclet$Option outerClass jdk/javadoc/doclet/Doclet innerClassName Option flags 609 + diff --git a/make/data/symbols/jdk.jconsole-G.sym.txt b/make/data/symbols/jdk.jconsole-G.sym.txt new file mode 100644 index 0000000000000..fcc158c3dda6c --- /dev/null +++ b/make/data/symbols/jdk.jconsole-G.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/tools/jconsole/JConsolePlugin +header extends java/lang/Object flags 421 + diff --git a/make/data/symbols/jdk.jdi-G.sym.txt b/make/data/symbols/jdk.jdi-G.sym.txt new file mode 100644 index 0000000000000..f726818252468 --- /dev/null +++ b/make/data/symbols/jdk.jdi-G.sym.txt @@ -0,0 +1,397 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/jdi/AbsentInformationException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/Accessible +header extends java/lang/Object flags 601 + +class name com/sun/jdi/ArrayReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/ArrayType +header extends java/lang/Object implements com/sun/jdi/ReferenceType flags 601 + +class name com/sun/jdi/BooleanType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/BooleanValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue flags 601 + +class name com/sun/jdi/Bootstrap +header extends java/lang/Object flags 21 +-method name descriptor ()V +method name descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name com/sun/jdi/ByteType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/ByteValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/CharType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/CharValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/ClassLoaderReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/ClassNotLoadedException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/ClassNotPreparedException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/ClassObjectReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/ClassType +header extends java/lang/Object implements com/sun/jdi/ReferenceType flags 601 + +class name com/sun/jdi/DoubleType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/DoubleValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/Field +header extends java/lang/Object implements com/sun/jdi/TypeComponent,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/TypeComponent;Ljava/lang/Comparable; + +class name com/sun/jdi/FloatType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/FloatValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/IncompatibleThreadStateException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/InconsistentDebugInfoException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/IntegerType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/IntegerValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/InterfaceType +header extends java/lang/Object implements com/sun/jdi/ReferenceType flags 601 + +class name com/sun/jdi/InternalException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/InvalidCodeIndexException +header extends java/lang/RuntimeException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated; + +class name com/sun/jdi/InvalidLineNumberException +header extends java/lang/RuntimeException flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated; + +class name com/sun/jdi/InvalidModuleException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/InvalidStackFrameException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/InvalidTypeException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/InvocationException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/JDIPermission +header extends java/security/BasicPermission flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/jdi/LocalVariable +header extends java/lang/Object implements com/sun/jdi/Mirror,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/Mirror;Ljava/lang/Comparable; + +class name com/sun/jdi/Locatable +header extends java/lang/Object flags 601 + +class name com/sun/jdi/Location +header extends java/lang/Object implements com/sun/jdi/Mirror,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/Mirror;Ljava/lang/Comparable; + +class name com/sun/jdi/LongType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/LongValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/Method +header extends java/lang/Object implements com/sun/jdi/TypeComponent,com/sun/jdi/Locatable,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/TypeComponent;Lcom/sun/jdi/Locatable;Ljava/lang/Comparable; + +class name com/sun/jdi/Mirror +header extends java/lang/Object flags 601 + +class name com/sun/jdi/ModuleReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/MonitorInfo +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/NativeMethodException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/ObjectCollectedException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/ObjectReference +header extends java/lang/Object implements com/sun/jdi/Value flags 601 + +class name com/sun/jdi/PathSearchingVirtualMachine +header extends java/lang/Object implements com/sun/jdi/VirtualMachine flags 601 + +class name com/sun/jdi/PrimitiveType +header extends java/lang/Object implements com/sun/jdi/Type flags 601 + +class name com/sun/jdi/PrimitiveValue +header extends java/lang/Object implements com/sun/jdi/Value flags 601 + +class name com/sun/jdi/ReferenceType +header extends java/lang/Object implements com/sun/jdi/Type,java/lang/Comparable,com/sun/jdi/Accessible flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/Type;Ljava/lang/Comparable;Lcom/sun/jdi/Accessible; + +class name com/sun/jdi/ShortType +header extends java/lang/Object implements com/sun/jdi/PrimitiveType flags 601 + +class name com/sun/jdi/ShortValue +header extends java/lang/Object implements com/sun/jdi/PrimitiveValue,java/lang/Comparable flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/PrimitiveValue;Ljava/lang/Comparable; + +class name com/sun/jdi/StackFrame +header extends java/lang/Object implements com/sun/jdi/Mirror,com/sun/jdi/Locatable flags 601 + +class name com/sun/jdi/StringReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/ThreadGroupReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/ThreadReference +header extends java/lang/Object implements com/sun/jdi/ObjectReference flags 601 + +class name com/sun/jdi/Type +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/TypeComponent +header extends java/lang/Object implements com/sun/jdi/Mirror,com/sun/jdi/Accessible flags 601 + +class name com/sun/jdi/VMCannotBeModifiedException +header extends java/lang/UnsupportedOperationException flags 21 + +class name com/sun/jdi/VMDisconnectedException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/VMMismatchException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/VMOutOfMemoryException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/Value +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/VirtualMachine +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/VirtualMachineManager +header extends java/lang/Object flags 601 + +class name com/sun/jdi/VoidType +header extends java/lang/Object implements com/sun/jdi/Type flags 601 + +class name com/sun/jdi/VoidValue +header extends java/lang/Object implements com/sun/jdi/Value flags 601 + +class name com/sun/jdi/connect/AttachingConnector +header extends java/lang/Object implements com/sun/jdi/connect/Connector flags 601 +innerclass innerClass com/sun/jdi/connect/Connector$Argument outerClass com/sun/jdi/connect/Connector innerClassName Argument flags 609 + +class name com/sun/jdi/connect/IllegalConnectorArgumentsException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/connect/LaunchingConnector +header extends java/lang/Object implements com/sun/jdi/connect/Connector flags 601 +innerclass innerClass com/sun/jdi/connect/Connector$Argument outerClass com/sun/jdi/connect/Connector innerClassName Argument flags 609 + +class name com/sun/jdi/connect/ListeningConnector +header extends java/lang/Object implements com/sun/jdi/connect/Connector flags 601 +innerclass innerClass com/sun/jdi/connect/Connector$Argument outerClass com/sun/jdi/connect/Connector innerClassName Argument flags 609 + +class name com/sun/jdi/connect/Transport +header extends java/lang/Object flags 601 + +class name com/sun/jdi/connect/TransportTimeoutException +header extends java/io/IOException flags 21 + +class name com/sun/jdi/connect/VMStartException +header extends java/lang/Exception flags 21 + +class name com/sun/jdi/connect/spi/ClosedConnectionException +header extends java/io/IOException flags 21 + +class name com/sun/jdi/connect/spi/Connection +header extends java/lang/Object flags 421 + +class name com/sun/jdi/event/AccessWatchpointEvent +header extends java/lang/Object implements com/sun/jdi/event/WatchpointEvent flags 601 + +class name com/sun/jdi/event/BreakpointEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/ClassPrepareEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/ClassUnloadEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/Event +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/event/EventIterator +header extends java/lang/Object implements java/util/Iterator flags 601 signature Ljava/lang/Object;Ljava/util/Iterator; + +class name com/sun/jdi/event/EventQueue +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/event/EventSet +header extends java/lang/Object implements com/sun/jdi/Mirror,java/util/Set flags 601 signature Ljava/lang/Object;Lcom/sun/jdi/Mirror;Ljava/util/Set; + +class name com/sun/jdi/event/ExceptionEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/LocatableEvent +header extends java/lang/Object implements com/sun/jdi/event/Event,com/sun/jdi/Locatable flags 601 + +class name com/sun/jdi/event/MethodEntryEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/MethodExitEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/ModificationWatchpointEvent +header extends java/lang/Object implements com/sun/jdi/event/WatchpointEvent flags 601 + +class name com/sun/jdi/event/MonitorContendedEnterEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/MonitorContendedEnteredEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/MonitorWaitEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/MonitorWaitedEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/StepEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/event/ThreadDeathEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/ThreadStartEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/VMDeathEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/VMDisconnectEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/VMStartEvent +header extends java/lang/Object implements com/sun/jdi/event/Event flags 601 + +class name com/sun/jdi/event/WatchpointEvent +header extends java/lang/Object implements com/sun/jdi/event/LocatableEvent flags 601 + +class name com/sun/jdi/request/AccessWatchpointRequest +header extends java/lang/Object implements com/sun/jdi/request/WatchpointRequest flags 601 + +class name com/sun/jdi/request/BreakpointRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest,com/sun/jdi/Locatable flags 601 + +class name com/sun/jdi/request/ClassPrepareRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/ClassUnloadRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/DuplicateRequestException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/request/EventRequest +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/request/EventRequestManager +header extends java/lang/Object implements com/sun/jdi/Mirror flags 601 + +class name com/sun/jdi/request/ExceptionRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/InvalidRequestStateException +header extends java/lang/RuntimeException flags 21 + +class name com/sun/jdi/request/MethodEntryRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/MethodExitRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/ModificationWatchpointRequest +header extends java/lang/Object implements com/sun/jdi/request/WatchpointRequest flags 601 + +class name com/sun/jdi/request/MonitorContendedEnterRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/MonitorContendedEnteredRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/MonitorWaitRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/MonitorWaitedRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/StepRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/ThreadDeathRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/ThreadStartRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/VMDeathRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + +class name com/sun/jdi/request/WatchpointRequest +header extends java/lang/Object implements com/sun/jdi/request/EventRequest flags 601 + diff --git a/make/data/symbols/jdk.jfr-G.sym.txt b/make/data/symbols/jdk.jfr-G.sym.txt new file mode 100644 index 0000000000000..397e082021a2f --- /dev/null +++ b/make/data/symbols/jdk.jfr-G.sym.txt @@ -0,0 +1,50 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/jfr/SettingControl +header extends java/lang/Object flags 421 runtimeAnnotations @Ljdk/jfr/MetadataDefinition; + +class name jdk/jfr/consumer/EventStream +method name onMetadata descriptor (Ljava/util/function/Consumer;)V flags 1 signature (Ljava/util/function/Consumer;)V + +class name jdk/jfr/consumer/MetadataEvent +header extends java/lang/Object flags 31 +method name getEventTypes descriptor ()Ljava/util/List; flags 11 signature ()Ljava/util/List; +method name getAddedEventTypes descriptor ()Ljava/util/List; flags 11 signature ()Ljava/util/List; +method name getRemovedEventTypes descriptor ()Ljava/util/List; flags 11 signature ()Ljava/util/List; +method name getConfigurations descriptor ()Ljava/util/List; flags 1 signature ()Ljava/util/List; + +class name jdk/jfr/consumer/RecordedEvent +-method name objectAt descriptor (I)Ljava/lang/Object; + +class name jdk/jfr/consumer/RecordedObject +-method name objectAt descriptor (I)Ljava/lang/Object; + +class name jdk/jfr/consumer/RecordingStream +method name onMetadata descriptor (Ljava/util/function/Consumer;)V flags 1 signature (Ljava/util/function/Consumer;)V + diff --git a/make/data/symbols/jdk.jpackage-G.sym.txt b/make/data/symbols/jdk.jpackage-G.sym.txt new file mode 100644 index 0000000000000..2a687430d7550 --- /dev/null +++ b/make/data/symbols/jdk.jpackage-G.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jpackage +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.jlink\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;0 uses jdk/jpackage/internal/Bundler,jdk/jpackage/internal/Bundlers provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/jpackage/internal/JPackageToolProvider,interface\u0020;jdk/jpackage/internal/Bundler\u0020;impls\u0020;jdk/jpackage/internal/LinuxAppBundler\u005C;u002C;jdk/jpackage/internal/LinuxDebBundler\u005C;u002C;jdk/jpackage/internal/LinuxRpmBundler,interface\u0020;jdk/jpackage/internal/Bundlers\u0020;impls\u0020;jdk/jpackage/internal/BasicBundlers target linux-amd64 flags 8000 + diff --git a/make/data/symbols/jdk.jshell-G.sym.txt b/make/data/symbols/jdk.jshell-G.sym.txt new file mode 100644 index 0000000000000..df90a03a18568 --- /dev/null +++ b/make/data/symbols/jdk.jshell-G.sym.txt @@ -0,0 +1,108 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/jshell/DeclarationSnippet +header extends jdk/jshell/PersistentSnippet flags 421 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/Diag +header extends java/lang/Object flags 421 + +class name jdk/jshell/EvalException +header extends jdk/jshell/JShellException flags 21 + +class name jdk/jshell/ExpressionSnippet +header extends jdk/jshell/Snippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/ImportSnippet +header extends jdk/jshell/PersistentSnippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/JShellException +header extends java/lang/Exception flags 21 + +class name jdk/jshell/MethodSnippet +header extends jdk/jshell/DeclarationSnippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/PersistentSnippet +header extends jdk/jshell/Snippet flags 421 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/SnippetEvent +header extends java/lang/Object flags 21 +innerclass innerClass jdk/jshell/Snippet$Status outerClass jdk/jshell/Snippet innerClassName Status flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/StatementSnippet +header extends jdk/jshell/Snippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/TypeDeclSnippet +header extends jdk/jshell/DeclarationSnippet flags 21 +innerclass innerClass jdk/jshell/Snippet$SubKind outerClass jdk/jshell/Snippet innerClassName SubKind flags 4019 + +class name jdk/jshell/execution/FailOverExecutionControlProvider +header extends java/lang/Object implements jdk/jshell/spi/ExecutionControlProvider flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/JdiDefaultExecutionControl +header extends jdk/jshell/execution/JdiExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$RunException outerClass jdk/jshell/spi/ExecutionControl innerClassName RunException flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name jdk/jshell/execution/JdiExecutionControlProvider +header extends java/lang/Object implements jdk/jshell/spi/ExecutionControlProvider flags 21 + +class name jdk/jshell/execution/LoaderDelegate +header extends java/lang/Object flags 601 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassBytecodes outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassBytecodes flags 19 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 + +class name jdk/jshell/execution/LocalExecutionControlProvider +header extends java/lang/Object implements jdk/jshell/spi/ExecutionControlProvider flags 21 + +class name jdk/jshell/spi/ExecutionControlProvider +header extends java/lang/Object flags 601 + +class name jdk/jshell/spi/ExecutionEnv +header extends java/lang/Object flags 601 + +class name jdk/jshell/spi/SPIResolutionException +header extends java/lang/RuntimeException flags 21 + +class name jdk/jshell/tool/JavaShellToolBuilder +header extends java/lang/Object flags 601 + diff --git a/make/data/symbols/jdk.jsobject-G.sym.txt b/make/data/symbols/jdk.jsobject-G.sym.txt new file mode 100644 index 0000000000000..29648f9a8f0e3 --- /dev/null +++ b/make/data/symbols/jdk.jsobject-G.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name netscape/javascript/JSException +header extends java/lang/RuntimeException flags 21 + diff --git a/make/data/symbols/jdk.management-G.sym.txt b/make/data/symbols/jdk.management-G.sym.txt new file mode 100644 index 0000000000000..fa57a5ba73f1c --- /dev/null +++ b/make/data/symbols/jdk.management-G.sym.txt @@ -0,0 +1,49 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/management/GarbageCollectionNotificationInfo +header extends java/lang/Object implements javax/management/openmbean/CompositeDataView flags 21 + +class name com/sun/management/GarbageCollectorMXBean +header extends java/lang/Object implements java/lang/management/GarbageCollectorMXBean flags 601 + +class name com/sun/management/GcInfo +header extends java/lang/Object implements javax/management/openmbean/CompositeData,javax/management/openmbean/CompositeDataView flags 21 + +class name com/sun/management/HotSpotDiagnosticMXBean +header extends java/lang/Object implements java/lang/management/PlatformManagedObject flags 601 + +class name com/sun/management/OperatingSystemMXBean +header extends java/lang/Object implements java/lang/management/OperatingSystemMXBean flags 601 + +class name com/sun/management/ThreadMXBean +header extends java/lang/Object implements java/lang/management/ThreadMXBean flags 601 + +class name com/sun/management/UnixOperatingSystemMXBean +header extends java/lang/Object implements com/sun/management/OperatingSystemMXBean flags 601 + diff --git a/make/data/symbols/jdk.management.jfr-G.sym.txt b/make/data/symbols/jdk.management.jfr-G.sym.txt new file mode 100644 index 0000000000000..fe17ee835b626 --- /dev/null +++ b/make/data/symbols/jdk.management.jfr-G.sym.txt @@ -0,0 +1,58 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.management.jfr +header exports jdk/management/jfr requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.jfr\u0020;flags\u0020;20,name\u0020;jdk.management\u0020;flags\u0020;0,name\u0020;java.management\u0020;flags\u0020;20 provides interface\u0020;sun/management/spi/PlatformMBeanProvider\u0020;impls\u0020;jdk/management/jfr/internal/FlightRecorderMXBeanProvider target linux-amd64 flags 8000 + +class name jdk/management/jfr/RemoteRecordingStream +header extends java/lang/Object implements jdk/jfr/consumer/EventStream flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name descriptor (Ljavax/management/MBeanServerConnection;)V thrownTypes java/io/IOException flags 1 +method name descriptor (Ljavax/management/MBeanServerConnection;Ljava/nio/file/Path;)V thrownTypes java/io/IOException flags 1 +method name onMetadata descriptor (Ljava/util/function/Consumer;)V flags 1 signature (Ljava/util/function/Consumer;)V +method name setSettings descriptor (Ljava/util/Map;)V flags 1 signature (Ljava/util/Map;)V +method name disable descriptor (Ljava/lang/String;)Ljdk/jfr/EventSettings; flags 1 +method name enable descriptor (Ljava/lang/String;)Ljdk/jfr/EventSettings; flags 1 +method name setMaxAge descriptor (Ljava/time/Duration;)V flags 1 +method name setMaxSize descriptor (J)V flags 1 +method name onEvent descriptor (Ljava/util/function/Consumer;)V flags 1 signature (Ljava/util/function/Consumer;)V +method name onEvent descriptor (Ljava/lang/String;Ljava/util/function/Consumer;)V flags 1 signature (Ljava/lang/String;Ljava/util/function/Consumer;)V +method name onFlush descriptor (Ljava/lang/Runnable;)V flags 1 +method name onError descriptor (Ljava/util/function/Consumer;)V flags 1 signature (Ljava/util/function/Consumer;)V +method name onClose descriptor (Ljava/lang/Runnable;)V flags 1 +method name close descriptor ()V flags 1 +method name remove descriptor (Ljava/lang/Object;)Z flags 1 +method name setReuse descriptor (Z)V flags 1 +method name setOrdered descriptor (Z)V flags 1 +method name setStartTime descriptor (Ljava/time/Instant;)V flags 1 +method name setEndTime descriptor (Ljava/time/Instant;)V flags 1 +method name start descriptor ()V flags 1 +method name startAsync descriptor ()V flags 1 +method name awaitTermination descriptor (Ljava/time/Duration;)V thrownTypes java/lang/InterruptedException flags 1 +method name awaitTermination descriptor ()V thrownTypes java/lang/InterruptedException flags 1 + diff --git a/make/data/symbols/jdk.net-G.sym.txt b/make/data/symbols/jdk.net-G.sym.txt new file mode 100644 index 0000000000000..9d38f61888888 --- /dev/null +++ b/make/data/symbols/jdk.net-G.sym.txt @@ -0,0 +1,60 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/net/ExtendedSocketOptions +field name SO_PEERCRED descriptor Ljava/net/SocketOption; flags 19 signature Ljava/net/SocketOption; + +class name jdk/net/NetworkPermission +header extends java/security/BasicPermission flags 31 + +class name jdk/net/Sockets +header extends java/lang/Object flags 21 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name setOption descriptor (Ljava/net/Socket;Ljava/net/SocketOption;Ljava/lang/Object;)V +-method name getOption descriptor (Ljava/net/Socket;Ljava/net/SocketOption;)Ljava/lang/Object; +-method name setOption descriptor (Ljava/net/ServerSocket;Ljava/net/SocketOption;Ljava/lang/Object;)V +-method name getOption descriptor (Ljava/net/ServerSocket;Ljava/net/SocketOption;)Ljava/lang/Object; +-method name setOption descriptor (Ljava/net/DatagramSocket;Ljava/net/SocketOption;Ljava/lang/Object;)V +-method name getOption descriptor (Ljava/net/DatagramSocket;Ljava/net/SocketOption;)Ljava/lang/Object; +-method name supportedOptions descriptor (Ljava/lang/Class;)Ljava/util/Set; +method name setOption descriptor (Ljava/net/Socket;Ljava/net/SocketOption;Ljava/lang/Object;)V thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/Socket;Ljava/net/SocketOption;TT;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getOption descriptor (Ljava/net/Socket;Ljava/net/SocketOption;)Ljava/lang/Object; thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/Socket;Ljava/net/SocketOption;)TT; runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name setOption descriptor (Ljava/net/ServerSocket;Ljava/net/SocketOption;Ljava/lang/Object;)V thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/ServerSocket;Ljava/net/SocketOption;TT;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getOption descriptor (Ljava/net/ServerSocket;Ljava/net/SocketOption;)Ljava/lang/Object; thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/ServerSocket;Ljava/net/SocketOption;)TT; runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name setOption descriptor (Ljava/net/DatagramSocket;Ljava/net/SocketOption;Ljava/lang/Object;)V thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/DatagramSocket;Ljava/net/SocketOption;TT;)V runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name getOption descriptor (Ljava/net/DatagramSocket;Ljava/net/SocketOption;)Ljava/lang/Object; thrownTypes java/io/IOException flags 9 deprecated true signature (Ljava/net/DatagramSocket;Ljava/net/SocketOption;)TT; runtimeAnnotations @Ljava/lang/Deprecated;(since="16") +method name supportedOptions descriptor (Ljava/lang/Class;)Ljava/util/Set; flags 9 deprecated true signature (Ljava/lang/Class<*>;)Ljava/util/Set;>; runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name jdk/net/UnixDomainPrincipal +header extends java/lang/Object flags 31 +method name descriptor (Ljava/nio/file/attribute/UserPrincipal;Ljava/nio/file/attribute/GroupPrincipal;)V flags 1 +method name equals descriptor (Ljava/lang/Object;)Z flags 1 +method name hashCode descriptor ()I flags 1 +method name user descriptor ()Ljava/nio/file/attribute/UserPrincipal; flags 1 +method name group descriptor ()Ljava/nio/file/attribute/GroupPrincipal; flags 1 + diff --git a/make/data/symbols/jdk.sctp-G.sym.txt b/make/data/symbols/jdk.sctp-G.sym.txt new file mode 100644 index 0000000000000..3408490a376f3 --- /dev/null +++ b/make/data/symbols/jdk.sctp-G.sym.txt @@ -0,0 +1,73 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/nio/sctp/AbstractNotificationHandler +header extends java/lang/Object implements com/sun/nio/sctp/NotificationHandler flags 21 signature Ljava/lang/Object;Lcom/sun/nio/sctp/NotificationHandler; + +class name com/sun/nio/sctp/Association +header extends java/lang/Object flags 21 + +class name com/sun/nio/sctp/HandlerResult +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; + +class name com/sun/nio/sctp/IllegalReceiveException +header extends java/lang/IllegalStateException flags 21 + +class name com/sun/nio/sctp/IllegalUnbindException +header extends java/lang/IllegalStateException flags 21 + +class name com/sun/nio/sctp/InvalidStreamException +header extends java/lang/IllegalArgumentException flags 21 + +class name com/sun/nio/sctp/MessageInfo +header extends java/lang/Object flags 421 + +class name com/sun/nio/sctp/Notification +header extends java/lang/Object flags 601 + +class name com/sun/nio/sctp/NotificationHandler +header extends java/lang/Object flags 601 signature Ljava/lang/Object; + +class name com/sun/nio/sctp/SctpChannel +header extends java/nio/channels/spi/AbstractSelectableChannel flags 421 + +class name com/sun/nio/sctp/SctpMultiChannel +header extends java/nio/channels/spi/AbstractSelectableChannel flags 421 + +class name com/sun/nio/sctp/SctpServerChannel +header extends java/nio/channels/spi/AbstractSelectableChannel flags 421 + +class name com/sun/nio/sctp/SctpSocketOption +header extends java/lang/Object implements java/net/SocketOption flags 601 signature Ljava/lang/Object;Ljava/net/SocketOption; + +class name com/sun/nio/sctp/SendFailedNotification +header extends java/lang/Object implements com/sun/nio/sctp/Notification flags 421 + +class name com/sun/nio/sctp/ShutdownNotification +header extends java/lang/Object implements com/sun/nio/sctp/Notification flags 421 + diff --git a/make/data/symbols/jdk.security.auth-G.sym.txt b/make/data/symbols/jdk.security.auth-G.sym.txt new file mode 100644 index 0000000000000..9d9d5aed75be9 --- /dev/null +++ b/make/data/symbols/jdk.security.auth-G.sym.txt @@ -0,0 +1,106 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/security/auth/LdapPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 31 + +class name com/sun/security/auth/NTDomainPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/NTNumericCredential +header extends java/lang/Object flags 21 + +class name com/sun/security/auth/NTSid +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/NTSidDomainPrincipal +header extends com/sun/security/auth/NTSid flags 21 + +class name com/sun/security/auth/NTSidGroupPrincipal +header extends com/sun/security/auth/NTSid flags 21 + +class name com/sun/security/auth/NTSidPrimaryGroupPrincipal +header extends com/sun/security/auth/NTSid flags 21 + +class name com/sun/security/auth/NTSidUserPrincipal +header extends com/sun/security/auth/NTSid flags 21 + +class name com/sun/security/auth/NTUserPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/PrincipalComparator +header extends java/lang/Object flags 601 + +class name com/sun/security/auth/UnixNumericGroupPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/UnixNumericUserPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/UnixPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 21 + +class name com/sun/security/auth/UserPrincipal +header extends java/lang/Object implements java/security/Principal,java/io/Serializable flags 31 + +class name com/sun/security/auth/callback/TextCallbackHandler +header extends java/lang/Object implements javax/security/auth/callback/CallbackHandler flags 21 + +class name com/sun/security/auth/login/ConfigFile +header extends javax/security/auth/login/Configuration flags 21 + +class name com/sun/security/auth/module/JndiLoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/KeyStoreLoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/Krb5LoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/LdapLoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/NTLoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/NTSystem +header extends java/lang/Object flags 21 + +class name com/sun/security/auth/module/UnixLoginModule +header extends java/lang/Object implements javax/security/auth/spi/LoginModule flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/auth/module/UnixSystem +header extends java/lang/Object flags 21 + diff --git a/make/data/symbols/jdk.security.jgss-G.sym.txt b/make/data/symbols/jdk.security.jgss-G.sym.txt new file mode 100644 index 0000000000000..259e768088fbd --- /dev/null +++ b/make/data/symbols/jdk.security.jgss-G.sym.txt @@ -0,0 +1,49 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/security/jgss/AuthorizationDataEntry +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name com/sun/security/jgss/ExtendedGSSContext +header extends java/lang/Object implements org/ietf/jgss/GSSContext flags 601 + +class name com/sun/security/jgss/ExtendedGSSCredential +header extends java/lang/Object implements org/ietf/jgss/GSSCredential flags 601 + +class name com/sun/security/jgss/GSSUtil +header extends java/lang/Object flags 21 +-method name descriptor ()V +method name descriptor ()V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") + +class name com/sun/security/jgss/InquireSecContextPermission +header extends java/security/BasicPermission flags 31 + +class name com/sun/security/jgss/InquireType +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; + diff --git a/make/data/symbols/jdk.unsupported-G.sym.txt b/make/data/symbols/jdk.unsupported-G.sym.txt new file mode 100644 index 0000000000000..2d82f61546deb --- /dev/null +++ b/make/data/symbols/jdk.unsupported-G.sym.txt @@ -0,0 +1,52 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/nio/file/ExtendedCopyOption +header extends java/lang/Enum implements java/nio/file/CopyOption flags 4031 signature Ljava/lang/Enum;Ljava/nio/file/CopyOption; classAnnotations @Lsun/Proprietary+Annotation; + +class name com/sun/nio/file/ExtendedOpenOption +header extends java/lang/Enum implements java/nio/file/OpenOption flags 4031 signature Ljava/lang/Enum;Ljava/nio/file/OpenOption; classAnnotations @Lsun/Proprietary+Annotation; + +class name com/sun/nio/file/ExtendedWatchEventModifier +header extends java/lang/Enum implements java/nio/file/WatchEvent$Modifier flags 4031 signature Ljava/lang/Enum;Ljava/nio/file/WatchEvent$Modifier; classAnnotations @Lsun/Proprietary+Annotation; +innerclass innerClass java/nio/file/WatchEvent$Modifier outerClass java/nio/file/WatchEvent innerClassName Modifier flags 609 + +class name com/sun/nio/file/SensitivityWatchEventModifier +header extends java/lang/Enum implements java/nio/file/WatchEvent$Modifier flags 4031 signature Ljava/lang/Enum;Ljava/nio/file/WatchEvent$Modifier; classAnnotations @Lsun/Proprietary+Annotation; +innerclass innerClass java/nio/file/WatchEvent$Modifier outerClass java/nio/file/WatchEvent innerClassName Modifier flags 609 + +class name sun/misc/SignalHandler +header extends java/lang/Object flags 601 classAnnotations @Lsun/Proprietary+Annotation; + +class name sun/misc/Unsafe +-method name defineAnonymousClass descriptor (Ljava/lang/Class;[B[Ljava/lang/Object;)Ljava/lang/Class; +method name defineAnonymousClass descriptor (Ljava/lang/Class;[B[Ljava/lang/Object;)Ljava/lang/Class; flags 1 deprecated true signature (Ljava/lang/Class<*>;[B[Ljava/lang/Object;)Ljava/lang/Class<*>; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline;@Ljava/lang/Deprecated;(forRemoval=Ztrue,since="15") + +class name sun/reflect/ReflectionFactory +header extends java/lang/Object flags 21 classAnnotations @Lsun/Proprietary+Annotation; + diff --git a/make/data/symbols/jdk.xml.dom-G.sym.txt b/make/data/symbols/jdk.xml.dom-G.sym.txt new file mode 100644 index 0000000000000..0843d7dd102a9 --- /dev/null +++ b/make/data/symbols/jdk.xml.dom-G.sym.txt @@ -0,0 +1,295 @@ +# +# Copyright (c) 2020, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name org/w3c/dom/css/CSS2Properties +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/CSSCharsetRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSFontFaceRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSImportRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSMediaRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSPageRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSPrimitiveValue +header extends java/lang/Object implements org/w3c/dom/css/CSSValue flags 601 + +class name org/w3c/dom/css/CSSRule +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/CSSRuleList +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/CSSStyleDeclaration +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/CSSStyleRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSStyleSheet +header extends java/lang/Object implements org/w3c/dom/stylesheets/StyleSheet flags 601 + +class name org/w3c/dom/css/CSSUnknownRule +header extends java/lang/Object implements org/w3c/dom/css/CSSRule flags 601 + +class name org/w3c/dom/css/CSSValue +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/CSSValueList +header extends java/lang/Object implements org/w3c/dom/css/CSSValue flags 601 + +class name org/w3c/dom/css/Counter +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/DOMImplementationCSS +header extends java/lang/Object implements org/w3c/dom/DOMImplementation flags 601 + +class name org/w3c/dom/css/DocumentCSS +header extends java/lang/Object implements org/w3c/dom/stylesheets/DocumentStyle flags 601 + +class name org/w3c/dom/css/ElementCSSInlineStyle +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/RGBColor +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/Rect +header extends java/lang/Object flags 601 + +class name org/w3c/dom/css/ViewCSS +header extends java/lang/Object implements org/w3c/dom/views/AbstractView flags 601 + +class name org/w3c/dom/html/HTMLAnchorElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLAppletElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLAreaElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLBRElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLBaseElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLBaseFontElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLBodyElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLButtonElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLCollection +header extends java/lang/Object flags 601 + +class name org/w3c/dom/html/HTMLDListElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLDOMImplementation +header extends java/lang/Object implements org/w3c/dom/DOMImplementation flags 601 + +class name org/w3c/dom/html/HTMLDirectoryElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLDivElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLDocument +header extends java/lang/Object implements org/w3c/dom/Document flags 601 + +class name org/w3c/dom/html/HTMLElement +header extends java/lang/Object implements org/w3c/dom/Element flags 601 + +class name org/w3c/dom/html/HTMLFieldSetElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLFontElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLFormElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLFrameElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLFrameSetElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLHRElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLHeadElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLHeadingElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLHtmlElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLIFrameElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLImageElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLInputElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLIsIndexElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLLIElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLLabelElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLLegendElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLLinkElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLMapElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLMenuElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLMetaElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLModElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLOListElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLObjectElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLOptGroupElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLOptionElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLParagraphElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLParamElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLPreElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLQuoteElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLScriptElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLSelectElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLStyleElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableCaptionElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableCellElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableColElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableRowElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTableSectionElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTextAreaElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLTitleElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/html/HTMLUListElement +header extends java/lang/Object implements org/w3c/dom/html/HTMLElement flags 601 + +class name org/w3c/dom/stylesheets/DocumentStyle +header extends java/lang/Object flags 601 + +class name org/w3c/dom/stylesheets/LinkStyle +header extends java/lang/Object flags 601 + +class name org/w3c/dom/stylesheets/MediaList +header extends java/lang/Object flags 601 + +class name org/w3c/dom/stylesheets/StyleSheet +header extends java/lang/Object flags 601 + +class name org/w3c/dom/stylesheets/StyleSheetList +header extends java/lang/Object flags 601 + +class name org/w3c/dom/xpath/XPathEvaluator +header extends java/lang/Object flags 601 + +class name org/w3c/dom/xpath/XPathException +header extends java/lang/RuntimeException flags 21 + +class name org/w3c/dom/xpath/XPathExpression +header extends java/lang/Object flags 601 + +class name org/w3c/dom/xpath/XPathNSResolver +header extends java/lang/Object flags 601 + +class name org/w3c/dom/xpath/XPathNamespace +header extends java/lang/Object implements org/w3c/dom/Node flags 601 + +class name org/w3c/dom/xpath/XPathResult +header extends java/lang/Object flags 601 + diff --git a/make/data/symbols/symbols b/make/data/symbols/symbols index 0f8120f7e25fd..669a9ecc63a0c 100644 --- a/make/data/symbols/symbols +++ b/make/data/symbols/symbols @@ -29,7 +29,7 @@ #command used to generate this file: #build.tools.symbolgenerator.CreateSymbols build-description-incremental symbols include.list # -generate platforms 7:8:9:A:B:C:D:E:F +generate platforms 7:8:9:A:B:C:D:E:F:G platform version 8 files java.activation-8.sym.txt:java.base-8.sym.txt:java.compiler-8.sym.txt:java.corba-8.sym.txt:java.datatransfer-8.sym.txt:java.desktop-8.sym.txt:java.instrument-8.sym.txt:java.logging-8.sym.txt:java.management-8.sym.txt:java.management.rmi-8.sym.txt:java.naming-8.sym.txt:java.prefs-8.sym.txt:java.rmi-8.sym.txt:java.scripting-8.sym.txt:java.security.jgss-8.sym.txt:java.security.sasl-8.sym.txt:java.sql-8.sym.txt:java.sql.rowset-8.sym.txt:java.transaction-8.sym.txt:java.xml-8.sym.txt:java.xml.bind-8.sym.txt:java.xml.crypto-8.sym.txt:java.xml.ws-8.sym.txt:java.xml.ws.annotation-8.sym.txt:jdk.httpserver-8.sym.txt:jdk.management-8.sym.txt:jdk.scripting.nashorn-8.sym.txt:jdk.sctp-8.sym.txt:jdk.security.auth-8.sym.txt:jdk.security.jgss-8.sym.txt platform version 7 base 8 files java.base-7.sym.txt:java.compiler-7.sym.txt:java.datatransfer-7.sym.txt:java.desktop-7.sym.txt:java.logging-7.sym.txt:java.management-7.sym.txt:java.naming-7.sym.txt:java.prefs-7.sym.txt:java.rmi-7.sym.txt:java.scripting-7.sym.txt:java.security.jgss-7.sym.txt:java.security.sasl-7.sym.txt:java.sql-7.sym.txt:java.sql.rowset-7.sym.txt:java.xml-7.sym.txt:java.xml.bind-7.sym.txt:java.xml.ws.annotation-7.sym.txt:jdk.httpserver-7.sym.txt:jdk.management-7.sym.txt:jdk.scripting.nashorn-7.sym.txt:jdk.sctp-7.sym.txt:jdk.security.auth-7.sym.txt:jdk.security.jgss-7.sym.txt platform version 9 base 8 files java.activation-9.sym.txt:java.base-9.sym.txt:java.compiler-9.sym.txt:java.corba-9.sym.txt:java.datatransfer-9.sym.txt:java.desktop-9.sym.txt:java.instrument-9.sym.txt:java.logging-9.sym.txt:java.management-9.sym.txt:java.management.rmi-9.sym.txt:java.naming-9.sym.txt:java.prefs-9.sym.txt:java.rmi-9.sym.txt:java.scripting-9.sym.txt:java.se-9.sym.txt:java.se.ee-9.sym.txt:java.security.jgss-9.sym.txt:java.security.sasl-9.sym.txt:java.smartcardio-9.sym.txt:java.sql-9.sym.txt:java.sql.rowset-9.sym.txt:java.transaction-9.sym.txt:java.xml-9.sym.txt:java.xml.bind-9.sym.txt:java.xml.crypto-9.sym.txt:java.xml.ws-9.sym.txt:java.xml.ws.annotation-9.sym.txt:jdk.accessibility-9.sym.txt:jdk.attach-9.sym.txt:jdk.charsets-9.sym.txt:jdk.compiler-9.sym.txt:jdk.crypto.cryptoki-9.sym.txt:jdk.crypto.ec-9.sym.txt:jdk.dynalink-9.sym.txt:jdk.editpad-9.sym.txt:jdk.hotspot.agent-9.sym.txt:jdk.httpserver-9.sym.txt:jdk.incubator.httpclient-9.sym.txt:jdk.jartool-9.sym.txt:jdk.javadoc-9.sym.txt:jdk.jcmd-9.sym.txt:jdk.jconsole-9.sym.txt:jdk.jdeps-9.sym.txt:jdk.jdi-9.sym.txt:jdk.jdwp.agent-9.sym.txt:jdk.jlink-9.sym.txt:jdk.jshell-9.sym.txt:jdk.jsobject-9.sym.txt:jdk.jstatd-9.sym.txt:jdk.localedata-9.sym.txt:jdk.management-9.sym.txt:jdk.management.agent-9.sym.txt:jdk.naming.dns-9.sym.txt:jdk.naming.rmi-9.sym.txt:jdk.net-9.sym.txt:jdk.pack-9.sym.txt:jdk.policytool-9.sym.txt:jdk.rmic-9.sym.txt:jdk.scripting.nashorn-9.sym.txt:jdk.sctp-9.sym.txt:jdk.security.auth-9.sym.txt:jdk.security.jgss-9.sym.txt:jdk.unsupported-9.sym.txt:jdk.xml.dom-9.sym.txt:jdk.zipfs-9.sym.txt @@ -39,3 +39,4 @@ platform version C base B files java.base-C.sym.txt:java.compiler-C.sym.txt:java platform version D base C files java.base-D.sym.txt:java.compiler-D.sym.txt:java.desktop-D.sym.txt:java.management-D.sym.txt:java.management.rmi-D.sym.txt:java.net.http-D.sym.txt:java.security.jgss-D.sym.txt:java.xml-D.sym.txt:java.xml.crypto-D.sym.txt:jdk.compiler-D.sym.txt:jdk.httpserver-D.sym.txt:jdk.jartool-D.sym.txt:jdk.javadoc-D.sym.txt:jdk.jlink-D.sym.txt:jdk.jshell-D.sym.txt platform version E base D files java.base-E.sym.txt:java.compiler-E.sym.txt:java.desktop-E.sym.txt:java.xml-E.sym.txt:jdk.compiler-E.sym.txt:jdk.httpserver-E.sym.txt:jdk.incubator.foreign-E.sym.txt:jdk.incubator.jpackage-E.sym.txt:jdk.jfr-E.sym.txt:jdk.jlink-E.sym.txt:jdk.jshell-E.sym.txt:jdk.jsobject-E.sym.txt:jdk.management-E.sym.txt:jdk.net-E.sym.txt:jdk.pack-E.sym.txt platform version F base E files java.base-F.sym.txt:java.compiler-F.sym.txt:java.desktop-F.sym.txt:java.management.rmi-F.sym.txt:java.naming-F.sym.txt:java.rmi-F.sym.txt:java.xml-F.sym.txt:jdk.compiler-F.sym.txt:jdk.incubator.foreign-F.sym.txt:jdk.jartool-F.sym.txt:jdk.javadoc-F.sym.txt:jdk.jdi-F.sym.txt:jdk.net-F.sym.txt:jdk.nio.mapmode-F.sym.txt:jdk.rmic-F.sym.txt:jdk.scripting.nashorn-F.sym.txt:jdk.unsupported-F.sym.txt +platform version G base F files java.base-G.sym.txt:java.compiler-G.sym.txt:java.datatransfer-G.sym.txt:java.desktop-G.sym.txt:java.instrument-G.sym.txt:java.logging-G.sym.txt:java.management-G.sym.txt:java.management.rmi-G.sym.txt:java.naming-G.sym.txt:java.net.http-G.sym.txt:java.rmi-G.sym.txt:java.scripting-G.sym.txt:java.security.jgss-G.sym.txt:java.security.sasl-G.sym.txt:java.smartcardio-G.sym.txt:java.sql-G.sym.txt:java.sql.rowset-G.sym.txt:java.xml-G.sym.txt:java.xml.crypto-G.sym.txt:jdk.accessibility-G.sym.txt:jdk.attach-G.sym.txt:jdk.compiler-G.sym.txt:jdk.dynalink-G.sym.txt:jdk.httpserver-G.sym.txt:jdk.incubator.foreign-G.sym.txt:jdk.incubator.jpackage-G.sym.txt:jdk.incubator.vector-G.sym.txt:jdk.jartool-G.sym.txt:jdk.javadoc-G.sym.txt:jdk.jconsole-G.sym.txt:jdk.jdi-G.sym.txt:jdk.jfr-G.sym.txt:jdk.jpackage-G.sym.txt:jdk.jshell-G.sym.txt:jdk.jsobject-G.sym.txt:jdk.management-G.sym.txt:jdk.management.jfr-G.sym.txt:jdk.net-G.sym.txt:jdk.sctp-G.sym.txt:jdk.security.auth-G.sym.txt:jdk.security.jgss-G.sym.txt:jdk.unsupported-G.sym.txt:jdk.xml.dom-G.sym.txt diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 1282b373f06e4..97aa2a25b88a1 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -135,6 +135,8 @@ #define JAVA_16_VERSION 60 +#define JAVA_17_VERSION 61 + void ClassFileParser::set_class_bad_constant_seen(short bad_constant) { assert((bad_constant == JVM_CONSTANT_Module || bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION, diff --git a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java index b9558c4ff435f..9339dfa8242fb 100644 --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java @@ -222,7 +222,7 @@ public ClassReader( this.b = classFileBuffer; // Check the class' major_version. This field is after the magic and minor_version fields, which // use 4 and 2 bytes respectively. - if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V16) { + if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V17) { throw new IllegalArgumentException( "Unsupported class file major version " + readShort(classFileOffset + 6)); } diff --git a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java index 42fd8bc8001bb..8b799cf38d2b6 100644 --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java @@ -312,6 +312,7 @@ public interface Opcodes { int V14 = 0 << 16 | 58; int V15 = 0 << 16 | 59; int V16 = 0 << 16 | 60; + int V17 = 0 << 16 | 61; /** * Version flag indicating that the class is using 'preview' features. diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java index 2399e411e2bc7..7df7b914c5eef 100644 --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java @@ -223,7 +223,15 @@ public enum SourceVersion { * * @since 16 */ - RELEASE_16; + RELEASE_16, + + /** + * The version recognized by the Java Platform, Standard Edition + * 17. + * + * @since 17 + */ + RELEASE_17; // Note that when adding constants for newer releases, the // behavior of latest() and latestSupported() must be updated too. @@ -232,7 +240,7 @@ public enum SourceVersion { * {@return the latest source version that can be modeled} */ public static SourceVersion latest() { - return RELEASE_16; + return RELEASE_17; } private static final SourceVersion latestSupported = getLatestSupported(); @@ -247,7 +255,7 @@ public static SourceVersion latest() { private static SourceVersion getLatestSupported() { int intVersion = Runtime.version().feature(); return (intVersion >= 11) ? - valueOf("RELEASE_" + Math.min(16, intVersion)): + valueOf("RELEASE_" + Math.min(17, intVersion)): RELEASE_10; } diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java index db9d370caf23e..08a2fb51e6a2c 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor14.java @@ -44,7 +44,7 @@ * @see AbstractAnnotationValueVisitor9 * @since 14 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public abstract class AbstractAnnotationValueVisitor14 extends AbstractAnnotationValueVisitor9 { /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java index 3f0126b2ce19b..a0b8484982d6b 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor14.java @@ -49,7 +49,7 @@ * @see AbstractElementVisitor9 * @since 16 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public abstract class AbstractElementVisitor14 extends AbstractElementVisitor9 { /** * Constructor for concrete subclasses to call. diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java index 953c415b9b677..ac7ac4e078104 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor14.java @@ -47,7 +47,7 @@ * @see AbstractTypeVisitor9 * @since 14 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public abstract class AbstractTypeVisitor14 extends AbstractTypeVisitor9 { /** * Constructor for concrete subclasses to call. diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java index fd96c6ecad639..681c311bd914a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor14.java @@ -61,7 +61,7 @@ * @see ElementKindVisitor9 * @since 16 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class ElementKindVisitor14 extends ElementKindVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java index 5e5d484fa83a6..bc7618c454154 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java @@ -76,7 +76,7 @@ * @see ElementScanner9 * @since 16 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class ElementScanner14 extends ElementScanner9 { /** * Constructor for concrete subclasses; uses {@code null} for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java index f48dd4da3df0b..347b522503177 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor14.java @@ -52,7 +52,7 @@ * @see SimpleAnnotationValueVisitor9 * @since 14 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class SimpleAnnotationValueVisitor14 extends SimpleAnnotationValueVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java index 9150f27d0fe84..b8de0fe676c51 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor14.java @@ -57,7 +57,7 @@ * @see SimpleElementVisitor9 * @since 16 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class SimpleElementVisitor14 extends SimpleElementVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java index 3a1b6f5d9a1a8..25af6688f6fec 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor14.java @@ -56,7 +56,7 @@ * @see SimpleTypeVisitor9 * @since 14 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class SimpleTypeVisitor14 extends SimpleTypeVisitor9 { /** * Constructor for concrete subclasses; uses {@code null} for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java index 9309b645f3af2..1adc9749364bd 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor14.java @@ -61,7 +61,7 @@ * @see TypeKindVisitor9 * @since 14 */ -@SupportedSourceVersion(RELEASE_16) +@SupportedSourceVersion(RELEASE_17) public class TypeKindVisitor14 extends TypeKindVisitor9 { /** * Constructor for concrete subclasses to call; uses {@code null} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java index 72e92107bb784..6baf29d253826 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java @@ -107,7 +107,12 @@ public enum Source { /** * 16, tbd */ - JDK16("16"); + JDK16("16"), + + /** + * 17, tbd + */ + JDK17("17"); private static final Context.Key sourceKey = new Context.Key<>(); @@ -159,6 +164,7 @@ public boolean isSupported() { public Target requiredTarget() { return switch(this) { + case JDK17 -> Target.JDK1_17; case JDK16 -> Target.JDK1_16; case JDK15 -> Target.JDK1_15; case JDK14 -> Target.JDK1_14; @@ -217,7 +223,7 @@ public enum Feature { PATTERN_MATCHING_IN_INSTANCEOF(JDK16, Fragments.FeaturePatternMatchingInstanceof, DiagKind.NORMAL), REIFIABLE_TYPES_INSTANCEOF(JDK16, Fragments.FeatureReifiableTypesInstanceof, DiagKind.PLURAL), RECORDS(JDK16, Fragments.FeatureRecords, DiagKind.PLURAL), - SEALED_CLASSES(JDK16, Fragments.FeatureSealedClasses, DiagKind.PLURAL), + SEALED_CLASSES(JDK17, Fragments.FeatureSealedClasses, DiagKind.PLURAL), ; enum DiagKind { @@ -296,6 +302,7 @@ public static SourceVersion toSourceVersion(Source source) { case JDK14 -> RELEASE_14; case JDK15 -> RELEASE_15; case JDK16 -> RELEASE_16; + case JDK17 -> RELEASE_17; default -> null; }; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java index 9cf48dad218e1..fc939266acc84 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java @@ -117,7 +117,8 @@ public enum Version { V57(57, 0), // JDK 13 V58(58, 0), // JDK 14 V59(59, 0), // JDK 15 - V60(60, 0); // JDK 16 + V60(60, 0), // JDK 16 + V61(61, 0); // JDK 17 Version(int major, int minor) { this.major = major; this.minor = minor; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java index d98408e6c3492..8e4b900e13e3b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java @@ -82,7 +82,10 @@ public enum Target { JDK1_15("15", 59, 0), /** JDK 16. */ - JDK1_16("16", 60, 0); + JDK1_16("16", 60, 0), + + /** JDK 17. */ + JDK1_17("17", 61, 0); private static final Context.Key targetKey = new Context.Key<>(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java index f0e47f05d49b3..64d0c612b4da9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java @@ -55,7 +55,7 @@ * deletion without notice. */ @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_16) +@SupportedSourceVersion(SourceVersion.RELEASE_17) public class PrintingProcessor extends AbstractProcessor { PrintWriter writer; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java index 46638893f747c..95e0bb064e494 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java @@ -49,7 +49,7 @@ public class Classfile { private final List codeAttributes; private static final int MAJOR_VERSION_JAVA_MIN = 51; // JDK7 - private static final int MAJOR_VERSION_JAVA_MAX = 60; // JDK16 + private static final int MAJOR_VERSION_JAVA_MAX = 61; // JDK17 private static final int MAGIC = 0xCAFEBABE; /** diff --git a/test/hotspot/jtreg/runtime/modules/sealedP1/SuperClass.jcod b/test/hotspot/jtreg/runtime/modules/sealedP1/SuperClass.jcod index e0cb6297480dd..22f707550e28d 100644 --- a/test/hotspot/jtreg/runtime/modules/sealedP1/SuperClass.jcod +++ b/test/hotspot/jtreg/runtime/modules/sealedP1/SuperClass.jcod @@ -33,7 +33,7 @@ class sealedP1/SuperClass { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [20] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/modules/sealedP1/SuperInterface.jcod b/test/hotspot/jtreg/runtime/modules/sealedP1/SuperInterface.jcod index 1672b03876a2d..7c626e3925af9 100644 --- a/test/hotspot/jtreg/runtime/modules/sealedP1/SuperInterface.jcod +++ b/test/hotspot/jtreg/runtime/modules/sealedP1/SuperInterface.jcod @@ -33,7 +33,7 @@ class sealedP1/SuperInterface { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [14] { // Constant Pool ; // first element is empty class #2; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod index 8d4758edc96c9..26d6a61bca221 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod @@ -29,7 +29,7 @@ class NoLoadSubclasses { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [18] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A @@ -168,7 +168,7 @@ class ExistingClassFile { class NoSubclasses { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [14] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A @@ -385,7 +385,7 @@ class OldClassFile { class BadPermittedAttr { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [18] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A @@ -463,7 +463,7 @@ class BadPermittedAttr { class SealedButFinal { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [18] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A @@ -541,7 +541,7 @@ class SealedButFinal { class BadPermittedSubclassEntry { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [18] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A @@ -618,7 +618,7 @@ class BadPermittedSubclassEntry { class EmptyPermittedSubclassEntry { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [18] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/sealedClasses/Pkg/NotPermitted.jcod b/test/hotspot/jtreg/runtime/sealedClasses/Pkg/NotPermitted.jcod index 5a3eb7d717c76..36e0c8c9e80c6 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/Pkg/NotPermitted.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/Pkg/NotPermitted.jcod @@ -31,7 +31,7 @@ class Pkg/NotPermitted { 0xCAFEBABE; 0; // minor version - 60; // version + 61; // version [15] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/sealedClasses/Pkg/SealedInterface.jcod b/test/hotspot/jtreg/runtime/sealedClasses/Pkg/SealedInterface.jcod index 16c8480fce883..137f0dfad5187 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/Pkg/SealedInterface.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/Pkg/SealedInterface.jcod @@ -31,7 +31,7 @@ class Pkg/SealedInterface { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [14] { // Constant Pool ; // first element is empty class #2; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/sealedClasses/planets/Mars.jcod b/test/hotspot/jtreg/runtime/sealedClasses/planets/Mars.jcod index 1666e732002ab..d89c8c6a26432 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/planets/Mars.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/planets/Mars.jcod @@ -31,7 +31,7 @@ class planets/Mars { 0xCAFEBABE; 0; // minor version - 60; // version + 61; // version [13] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A diff --git a/test/hotspot/jtreg/runtime/sealedClasses/planets/OuterPlanets.jcod b/test/hotspot/jtreg/runtime/sealedClasses/planets/OuterPlanets.jcod index 615a5c885f631..d5044ccba891b 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/planets/OuterPlanets.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/planets/OuterPlanets.jcod @@ -28,7 +28,7 @@ class planets/OuterPlanets { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [20] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A diff --git a/test/jdk/java/lang/module/ClassFileVersionsTest.java b/test/jdk/java/lang/module/ClassFileVersionsTest.java index ac97054d3463d..81225135d3d2e 100644 --- a/test/jdk/java/lang/module/ClassFileVersionsTest.java +++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java @@ -60,6 +60,7 @@ public Object[][] supported() { { 58, 0, Set.of() }, // JDK 14 { 59, 0, Set.of() }, // JDK 15 { 60, 0, Set.of() }, // JDK 16 + { 61, 0, Set.of() }, // JDK 17 }; } @@ -99,7 +100,11 @@ public Object[][] unsupported() { { 60, 0, Set.of(TRANSITIVE) }, { 60, 0, Set.of(STATIC, TRANSITIVE) }, - { 61, 0, Set.of()}, // JDK 17 + { 61, 0, Set.of(STATIC) }, // JDK 17 + { 61, 0, Set.of(TRANSITIVE) }, + { 61, 0, Set.of(STATIC, TRANSITIVE) }, + + { 62, 0, Set.of()}, // JDK 18 }; } diff --git a/test/langtools/tools/javac/api/TestGetSourceVersions.java b/test/langtools/tools/javac/api/TestGetSourceVersions.java index cef53b7b2d7c3..6d8f911b19eec 100644 --- a/test/langtools/tools/javac/api/TestGetSourceVersions.java +++ b/test/langtools/tools/javac/api/TestGetSourceVersions.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6395981 6458819 7025784 8028543 8028544 8193291 8193292 8193292 8205393 8245585 8245585 + * @bug 6395981 6458819 7025784 8028543 8028544 8193291 8193292 8193292 8205393 8245585 8245585 8245585 * @summary JavaCompilerTool and Tool must specify version of JLS and JVMS * @author Peter von der Ah\u00e9 * @modules java.compiler @@ -34,7 +34,7 @@ * RELEASE_5 RELEASE_6 * @run main TestGetSourceVersions RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 * RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11 RELEASE_12 - * RELEASE_13 RELEASE_14 RELEASE_15 RELEASE_16 + * RELEASE_13 RELEASE_14 RELEASE_15 RELEASE_16 RELEASE_17 */ import java.util.EnumSet; diff --git a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java index facbbe03f9c62..b7c8051e8b1d6 100644 --- a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java +++ b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java @@ -23,7 +23,7 @@ /* * @test - * @bug 7157626 8001112 8188870 8173382 8193290 8205619 8245586 + * @bug 7157626 8001112 8188870 8173382 8193290 8205619 8245586 8257453 * @summary Test major version for all legal combinations for -source and -target * @author sgoel * @@ -51,7 +51,8 @@ private static enum Version { THIRTEEN("13", 57), FOURTEEN("14", 58), FIFTEEN("15", 59), - SIXTEEN("16", 60); + SIXTEEN("16", 60), + SEVENTEEN("17", 61); private Version(String release, int classFileVer) { this.release = release; diff --git a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java index f72206640514a..05e6d18c07c45 100644 --- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java +++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java @@ -110,7 +110,7 @@ protected void addExports(String moduleName, String... packageNames) { * corresponding platform visitor type. */ - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static abstract class AbstractAnnotationValueVisitor extends AbstractAnnotationValueVisitor14 { /** @@ -121,7 +121,7 @@ protected AbstractAnnotationValueVisitor() { } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static abstract class AbstractElementVisitor extends AbstractElementVisitor14 { /** * Constructor for concrete subclasses to call. @@ -131,7 +131,7 @@ protected AbstractElementVisitor(){ } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static abstract class AbstractTypeVisitor extends AbstractTypeVisitor14 { /** * Constructor for concrete subclasses to call. @@ -141,7 +141,7 @@ protected AbstractTypeVisitor() { } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class ElementKindVisitor extends ElementKindVisitor14 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -162,7 +162,7 @@ protected ElementKindVisitor(R defaultValue) { } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class ElementScanner extends ElementScanner14 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -181,7 +181,7 @@ protected ElementScanner(R defaultValue){ } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class SimpleAnnotationValueVisitor extends SimpleAnnotationValueVisitor14 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -202,7 +202,7 @@ protected SimpleAnnotationValueVisitor(R defaultValue) { } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class SimpleElementVisitor extends SimpleElementVisitor14 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -223,7 +223,7 @@ protected SimpleElementVisitor(R defaultValue){ } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class SimpleTypeVisitor extends SimpleTypeVisitor14 { /** * Constructor for concrete subclasses; uses {@code null} for the @@ -244,7 +244,7 @@ protected SimpleTypeVisitor(R defaultValue){ } } - @SupportedSourceVersion(RELEASE_16) + @SupportedSourceVersion(RELEASE_17) public static class TypeKindVisitor extends TypeKindVisitor14 { /** * Constructor for concrete subclasses to call; uses {@code null} diff --git a/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out b/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out index 99fb1073c03a8..275fb69402006 100644 --- a/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out +++ b/test/langtools/tools/javac/preview/classReaderTest/Client.nopreview.out @@ -1,2 +1,2 @@ -- compiler.err.preview.feature.disabled.classfile: Bar.class, 16 +- compiler.err.preview.feature.disabled.classfile: Bar.class, 17 1 error diff --git a/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out b/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out index aa833f9bf96bf..58a8ba6a474be 100644 --- a/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out +++ b/test/langtools/tools/javac/preview/classReaderTest/Client.preview.out @@ -1,4 +1,4 @@ -- compiler.warn.preview.feature.use.classfile: Bar.class, 16 +- compiler.warn.preview.feature.use.classfile: Bar.class, 17 - compiler.err.warnings.and.werror 1 error 1 warning diff --git a/test/langtools/tools/javac/versions/Versions.java b/test/langtools/tools/javac/versions/Versions.java index 5fccbd8fe1a6e..c68112f84a15d 100644 --- a/test/langtools/tools/javac/versions/Versions.java +++ b/test/langtools/tools/javac/versions/Versions.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382 8173382 8193290 8205619 8028563 8245147 8245586 + * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382 8173382 8193290 8205619 8028563 8245147 8245586 8257453 * @summary Check interpretation of -target and -source options * @modules java.compiler * jdk.compiler @@ -70,9 +70,9 @@ public static void main(String... args) throws IOException { Set.of("1.2", "1.3", "1.4", "1.5", "1.6"); public static final Set VALID_SOURCES = - Set.of("1.7", "1.8", "1.9", "1.10", "11", "12", "13", "14", "15", "16"); + Set.of("1.7", "1.8", "1.9", "1.10", "11", "12", "13", "14", "15", "16", "17"); - public static final String LATEST_MAJOR_VERSION = "60.0"; + public static final String LATEST_MAJOR_VERSION = "61.0"; static enum SourceTarget { SEVEN(true, "51.0", "7", Versions::checksrc7), @@ -84,7 +84,8 @@ static enum SourceTarget { THIRTEEN(false, "57.0", "13", Versions::checksrc13), FOURTEEN(false, "58.0", "14", Versions::checksrc14), FIFTEEN(false, "59.0", "15", Versions::checksrc15), - SIXTEEN(false, "60.0", "16", Versions::checksrc16); + SIXTEEN(false, "60.0", "16", Versions::checksrc16), + SEVENTEEN(false, "61.0", "17", Versions::checksrc17); private final boolean dotOne; private final String classFileVer; @@ -293,13 +294,20 @@ protected void checksrc15(List args) { printargs("checksrc15", args); expectedPass(args, List.of("New7.java", "New8.java", "New10.java", "New11.java", "New14.java", "New15.java")); - // Add expectedFail after new language features added in a later release. + expectedFail(args, List.of("New16.java")); } protected void checksrc16(List args) { printargs("checksrc16", args); expectedPass(args, List.of("New7.java", "New8.java", "New10.java", "New11.java", - "New14.java", "New15.java")); + "New14.java", "New15.java", "New16.java")); + // Add expectedFail after new language features added in a later release. + } + + protected void checksrc17(List args) { + printargs("checksrc17", args); + expectedPass(args, List.of("New7.java", "New8.java", "New10.java", "New11.java", + "New14.java", "New15.java", "New16.java")); // Add expectedFail after new language features added in a later release. } @@ -514,6 +522,19 @@ public class New15 { } """ ); + + /* + * Create a file with a new feature in 16, not in 15 : records + */ + writeSourceFile("New16.java", + """ + public class New16 { + public record Record(double rpm) { + public static final Record LONG_PLAY = new Record(100.0/3.0); + } + } + """ + ); } protected boolean checkClassFileVersion From 669361117d30c9904813b6f728714f8d6abe8484 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Thu, 10 Dec 2020 16:47:02 +0000 Subject: [PATCH 191/504] 8253797: [cgroups v2] Account for the fact that swap accounting is disabled on some systems Reviewed-by: hseigel --- .../platform/cgroupv2/CgroupV2Subsystem.java | 23 ++++++++-- .../cgroup/MetricsTesterCgroupV2.java | 42 +++++++++++-------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java index 573a425bd98c9..df6670e1d4ef5 100644 --- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java +++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java @@ -48,16 +48,21 @@ public class CgroupV2Subsystem implements CgroupSubsystem { private static final int PER_CPU_SHARES = 1024; private static final String MAX_VAL = "max"; private static final Object EMPTY_STR = ""; + private static final long NO_SWAP = 0; private CgroupV2Subsystem(CgroupSubsystemController unified) { this.unified = unified; } - private long getLongVal(String file) { + private long getLongVal(String file, long defaultValue) { return CgroupSubsystemController.getLongValue(unified, file, CgroupV2SubsystemController::convertStringToLong, - CgroupSubsystem.LONG_RETVAL_UNLIMITED); + defaultValue); + } + + private long getLongVal(String file) { + return getLongVal(file, CgroupSubsystem.LONG_RETVAL_UNLIMITED); } private static CgroupV2Subsystem initSubsystem() { @@ -289,6 +294,11 @@ public long getTcpMemoryUsage() { @Override public long getMemoryAndSwapLimit() { String strVal = CgroupSubsystemController.getStringValue(unified, "memory.swap.max"); + // We only get a null string when file memory.swap.max doesn't exist. + // In that case we return the memory limit without any swap. + if (strVal == null) { + return getMemoryLimit(); + } long swapLimit = limitFromString(strVal); if (swapLimit >= 0) { long memoryLimit = getMemoryLimit(); @@ -307,9 +317,14 @@ public long getMemoryAndSwapLimit() { */ @Override public long getMemoryAndSwapUsage() { - long swapUsage = getLongVal("memory.swap.current"); long memoryUsage = getMemoryUsage(); - return memoryUsage + swapUsage; + if (memoryUsage >= 0) { + // If file memory.swap.current doesn't exist, only return the regular + // memory usage (without swap). Thus, use default value of NO_SWAP. + long swapUsage = getLongVal("memory.swap.current", NO_SWAP); + return memoryUsage + swapUsage; + } + return memoryUsage; // case of no memory limits } @Override diff --git a/test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java b/test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java index ec2970a7af53b..25d6c73cbb5c4 100644 --- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java +++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV2.java @@ -239,25 +239,33 @@ public void testMemorySubsystem() { fail("memory.stat[sock]", oldVal, newVal); } - oldVal = metrics.getMemoryAndSwapLimit(); - long valSwap = getLongLimitValueFromFile("memory.swap.max"); - long valMemory = getLongLimitValueFromFile("memory.max"); - if (valSwap == UNLIMITED) { - newVal = valSwap; + long memAndSwapLimit = metrics.getMemoryAndSwapLimit(); + long memLimit = metrics.getMemoryLimit(); + // Only test swap memory limits if we can. On systems with swapaccount=0 + // we cannot, as swap limits are disabled. + if (memAndSwapLimit <= memLimit) { + System.out.println("No swap memory limits, test case(s) skipped"); } else { - assert valMemory >= 0; - newVal = valSwap + valMemory; - } - if (!CgroupMetricsTester.compareWithErrorMargin(oldVal, newVal)) { - fail("memory.swap.max", oldVal, newVal); - } + oldVal = memAndSwapLimit; + long valSwap = getLongLimitValueFromFile("memory.swap.max"); + long valMemory = getLongLimitValueFromFile("memory.max"); + if (valSwap == UNLIMITED) { + newVal = valSwap; + } else { + assert valMemory >= 0; + newVal = valSwap + valMemory; + } + if (!CgroupMetricsTester.compareWithErrorMargin(oldVal, newVal)) { + fail("memory.swap.max", oldVal, newVal); + } - oldVal = metrics.getMemoryAndSwapUsage(); - long swapUsage = getLongValueFromFile("memory.swap.current"); - long memUsage = getLongValueFromFile("memory.current"); - newVal = swapUsage + memUsage; - if (!CgroupMetricsTester.compareWithErrorMargin(oldVal, newVal)) { - fail("memory.swap.current", oldVal, newVal); + oldVal = metrics.getMemoryAndSwapUsage(); + long swapUsage = getLongValueFromFile("memory.swap.current"); + long memUsage = getLongValueFromFile("memory.current"); + newVal = swapUsage + memUsage; + if (!CgroupMetricsTester.compareWithErrorMargin(oldVal, newVal)) { + fail("memory.swap.current", oldVal, newVal); + } } oldVal = metrics.getMemorySoftLimit(); From 1e5e790ba02946fa8eaed2ca00a854edbd1f4a49 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 10 Dec 2020 17:04:35 +0000 Subject: [PATCH 192/504] 8258018: Remove arrayOop.inline.hpp Reviewed-by: stefank, kbarrett, coleenp --- .../parallel/psCompactionManager.inline.hpp | 2 +- .../shared/stringdedup/stringDedupTable.cpp | 2 +- src/hotspot/share/oops/arrayOop.hpp | 4 ++- src/hotspot/share/oops/arrayOop.inline.hpp | 35 ------------------- .../share/oops/objArrayKlass.inline.hpp | 2 +- src/hotspot/share/oops/objArrayOop.inline.hpp | 4 +-- .../share/oops/typeArrayOop.inline.hpp | 4 +-- src/hotspot/share/prims/jni.cpp | 2 +- src/hotspot/share/prims/jvmtiTagMap.cpp | 2 +- 9 files changed, 12 insertions(+), 45 deletions(-) delete mode 100644 src/hotspot/share/oops/arrayOop.inline.hpp diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp index 48b9875672fce..03ce090a4f43e 100644 --- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp @@ -31,7 +31,7 @@ #include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "oops/access.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp index 2deafa3ff0d75..5e8ebf54d0183 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp @@ -32,7 +32,7 @@ #include "memory/padded.inline.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayOop.hpp" #include "runtime/atomic.hpp" diff --git a/src/hotspot/share/oops/arrayOop.hpp b/src/hotspot/share/oops/arrayOop.hpp index a87a7e6c4cce9..100497f52cb67 100644 --- a/src/hotspot/share/oops/arrayOop.hpp +++ b/src/hotspot/share/oops/arrayOop.hpp @@ -90,7 +90,9 @@ class arrayOopDesc : public oopDesc { // Returns the address of the first element. The elements in the array will not // relocate from this address until a subsequent thread transition. - inline void* base(BasicType type) const; + void* base(BasicType type) const { + return reinterpret_cast(cast_from_oop(as_oop()) + base_offset_in_bytes(type)); + } template static T* obj_offset_to_raw(arrayOop obj, size_t offset_in_bytes, T* raw) { diff --git a/src/hotspot/share/oops/arrayOop.inline.hpp b/src/hotspot/share/oops/arrayOop.inline.hpp deleted file mode 100644 index 7b9aad1a2fbdb..0000000000000 --- a/src/hotspot/share/oops/arrayOop.inline.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, 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. - * - */ - -#ifndef SHARE_OOPS_ARRAYOOP_INLINE_HPP -#define SHARE_OOPS_ARRAYOOP_INLINE_HPP - -#include "oops/access.inline.hpp" -#include "oops/arrayOop.hpp" - -void* arrayOopDesc::base(BasicType type) const { - return reinterpret_cast(cast_from_oop(as_oop()) + base_offset_in_bytes(type)); -} - -#endif // SHARE_OOPS_ARRAYOOP_INLINE_HPP diff --git a/src/hotspot/share/oops/objArrayKlass.inline.hpp b/src/hotspot/share/oops/objArrayKlass.inline.hpp index fb25fd3de8029..251cf65e7df77 100644 --- a/src/hotspot/share/oops/objArrayKlass.inline.hpp +++ b/src/hotspot/share/oops/objArrayKlass.inline.hpp @@ -27,8 +27,8 @@ #include "memory/memRegion.hpp" #include "memory/iterator.hpp" -#include "oops/arrayOop.inline.hpp" #include "oops/arrayKlass.hpp" +#include "oops/arrayOop.hpp" #include "oops/klass.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/oops/objArrayOop.inline.hpp b/src/hotspot/share/oops/objArrayOop.inline.hpp index 4a9e9540c4c39..c10efea85edae 100644 --- a/src/hotspot/share/oops/objArrayOop.inline.hpp +++ b/src/hotspot/share/oops/objArrayOop.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ #define SHARE_OOPS_OBJARRAYOOP_INLINE_HPP #include "oops/access.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" #include "runtime/globals.hpp" diff --git a/src/hotspot/share/oops/typeArrayOop.inline.hpp b/src/hotspot/share/oops/typeArrayOop.inline.hpp index 6215acc69edb9..2cc827d9417a7 100644 --- a/src/hotspot/share/oops/typeArrayOop.inline.hpp +++ b/src/hotspot/share/oops/typeArrayOop.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ -27,7 +27,7 @@ #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/typeArrayOop.hpp" int typeArrayOopDesc::object_size() { diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index bdf03279580b2..c8e4415aa8e7c 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -49,7 +49,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/instanceKlass.inline.hpp" #include "oops/instanceOop.hpp" #include "oops/klass.inline.hpp" diff --git a/src/hotspot/share/prims/jvmtiTagMap.cpp b/src/hotspot/share/prims/jvmtiTagMap.cpp index 07da8e3159686..763765d506097 100644 --- a/src/hotspot/share/prims/jvmtiTagMap.cpp +++ b/src/hotspot/share/prims/jvmtiTagMap.cpp @@ -34,7 +34,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" -#include "oops/arrayOop.inline.hpp" +#include "oops/arrayOop.hpp" #include "oops/constantPool.inline.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/klass.inline.hpp" From f57405617ead0139b31fb19f961c46aa45bc844b Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Thu, 10 Dec 2020 17:22:48 +0000 Subject: [PATCH 193/504] 8256424: Move ciSymbol::symbol_name() to ciSymbols::symbol_name() Reviewed-by: kvn, iklam --- src/hotspot/share/aot/aotCodeHeap.cpp | 1 + src/hotspot/share/c1/c1_GraphBuilder.cpp | 5 ++- .../share/c1/c1_InstructionPrinter.cpp | 1 + src/hotspot/share/ci/bcEscapeAnalyzer.cpp | 9 ++-- src/hotspot/share/ci/bcEscapeAnalyzer.hpp | 4 +- src/hotspot/share/ci/ciEnv.cpp | 3 +- src/hotspot/share/ci/ciField.cpp | 31 ++++++++++--- src/hotspot/share/ci/ciField.hpp | 18 +------- src/hotspot/share/ci/ciMethod.cpp | 3 +- src/hotspot/share/ci/ciMethod.hpp | 5 ++- src/hotspot/share/ci/ciObjectFactory.cpp | 3 +- src/hotspot/share/ci/ciStreams.cpp | 3 +- src/hotspot/share/ci/ciSymbol.cpp | 4 ++ src/hotspot/share/ci/ciSymbol.hpp | 14 ++---- src/hotspot/share/ci/ciSymbols.hpp | 43 +++++++++++++++++++ .../share/compiler/compilerDirectives.hpp | 1 + src/hotspot/share/compiler/methodLiveness.cpp | 1 + src/hotspot/share/jvmci/compilerRuntime.cpp | 1 + src/hotspot/share/jvmci/jvmciCompiler.cpp | 11 +++++ src/hotspot/share/jvmci/jvmciCompiler.hpp | 10 +---- src/hotspot/share/oops/methodData.cpp | 1 + src/hotspot/share/opto/doCall.cpp | 3 +- src/hotspot/share/opto/library_call.cpp | 10 ++--- src/hotspot/share/opto/parseHelper.cpp | 3 +- src/hotspot/share/opto/stringopts.cpp | 27 ++++++------ src/hotspot/share/opto/vector.cpp | 9 ++-- src/hotspot/share/opto/vectorIntrinsics.cpp | 5 ++- src/hotspot/share/prims/jvmtiExport.cpp | 1 + .../share/prims/jvmtiRedefineClasses.cpp | 1 + src/hotspot/share/prims/whitebox.cpp | 1 + src/hotspot/share/runtime/vmStructs.cpp | 1 + src/hotspot/share/services/threadService.cpp | 1 + 32 files changed, 153 insertions(+), 81 deletions(-) create mode 100644 src/hotspot/share/ci/ciSymbols.hpp diff --git a/src/hotspot/share/aot/aotCodeHeap.cpp b/src/hotspot/share/aot/aotCodeHeap.cpp index 416c65df36bf3..4f46c856ff6fb 100644 --- a/src/hotspot/share/aot/aotCodeHeap.cpp +++ b/src/hotspot/share/aot/aotCodeHeap.cpp @@ -27,6 +27,7 @@ #include "aot/aotLoader.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/javaAssertions.hpp" +#include "classfile/vmSymbols.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/gcConfig.hpp" diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index a981c1fd461be..c2dc6529f2e49 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -32,6 +32,7 @@ #include "ci/ciField.hpp" #include "ci/ciKlass.hpp" #include "ci/ciMemberName.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/compileBroker.hpp" @@ -1477,7 +1478,7 @@ void GraphBuilder::method_return(Value x, bool ignore_return) { // The conditions for a memory barrier are described in Parse::do_exits(). bool need_mem_bar = false; - if (method()->name() == ciSymbol::object_initializer_name() && + if (method()->name() == ciSymbols::object_initializer_name() && (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields()) || (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile()))) { @@ -3820,7 +3821,7 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign } // don't inline throwable methods unless the inlining tree is rooted in a throwable class - if (callee->name() == ciSymbol::object_initializer_name() && + if (callee->name() == ciSymbols::object_initializer_name() && callee->holder()->is_subclass_of(ciEnv::current()->Throwable_klass())) { // Throwable constructor call IRScope* top = scope(); diff --git a/src/hotspot/share/c1/c1_InstructionPrinter.cpp b/src/hotspot/share/c1/c1_InstructionPrinter.cpp index 745aee4a47152..11a7cfe40b4ac 100644 --- a/src/hotspot/share/c1/c1_InstructionPrinter.cpp +++ b/src/hotspot/share/c1/c1_InstructionPrinter.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/vmSymbols.hpp" #include "c1/c1_InstructionPrinter.hpp" #include "c1/c1_ValueStack.hpp" #include "ci/ciArray.hpp" diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp index 8c426c22e0da9..82eca0d9667d1 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/vmIntrinsics.hpp" #include "ci/bcEscapeAnalyzer.hpp" #include "ci/ciConstant.hpp" #include "ci/ciField.hpp" @@ -1204,8 +1205,8 @@ void BCEscapeAnalyzer::do_analysis() { iterate_blocks(arena); } -vmIntrinsics::ID BCEscapeAnalyzer::known_intrinsic() { - vmIntrinsics::ID iid = method()->intrinsic_id(); +vmIntrinsicID BCEscapeAnalyzer::known_intrinsic() { + vmIntrinsicID iid = method()->intrinsic_id(); if (iid == vmIntrinsics::_getClass || iid == vmIntrinsics::_hashCode) { return iid; @@ -1214,7 +1215,7 @@ vmIntrinsics::ID BCEscapeAnalyzer::known_intrinsic() { } } -void BCEscapeAnalyzer::compute_escape_for_intrinsic(vmIntrinsics::ID iid) { +void BCEscapeAnalyzer::compute_escape_for_intrinsic(vmIntrinsicID iid) { switch (iid) { case vmIntrinsics::_getClass: _return_local = false; @@ -1293,7 +1294,7 @@ void BCEscapeAnalyzer::compute_escape_info() { int i; assert(!methodData()->has_escape_info(), "do not overwrite escape info"); - vmIntrinsics::ID iid = known_intrinsic(); + vmIntrinsicID iid = known_intrinsic(); // check if method can be analyzed if (iid == vmIntrinsics::_none && (method()->is_abstract() || method()->is_native() || !method()->holder()->is_initialized() diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.hpp b/src/hotspot/share/ci/bcEscapeAnalyzer.hpp index 89413ec29be22..4b377b999382a 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.hpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.hpp @@ -98,8 +98,8 @@ class BCEscapeAnalyzer : public ResourceObj { void initialize(); void clear_escape_info(); void compute_escape_info(); - vmIntrinsics::ID known_intrinsic(); - void compute_escape_for_intrinsic(vmIntrinsics::ID iid); + vmIntrinsicID known_intrinsic(); + void compute_escape_for_intrinsic(vmIntrinsicID iid); void do_analysis(); void read_escape_info(); diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index cb823998e309e..bda59ecbdc00e 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -32,6 +32,7 @@ #include "ci/ciMethod.hpp" #include "ci/ciNullObject.hpp" #include "ci/ciReplay.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" @@ -798,7 +799,7 @@ ciMethod* ciEnv::get_method_by_index_impl(const constantPoolHandle& cpool, // Fake a method that is equivalent to a declared method. ciInstanceKlass* holder = get_instance_klass(SystemDictionary::MethodHandle_klass()); - ciSymbol* name = ciSymbol::invokeBasic_name(); + ciSymbol* name = ciSymbols::invokeBasic_name(); ciSymbol* signature = get_symbol(cpool->signature_ref_at(index)); return get_unloaded_method(holder, name, signature, accessor); } else { diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index 83af90fe51fa6..fcdece72fc2ad 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "ci/ciField.hpp" #include "ci/ciInstanceKlass.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/javaClasses.hpp" #include "classfile/systemDictionary.hpp" @@ -218,7 +219,7 @@ ciField::ciField(fieldDescriptor *fd) : static bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder == NULL) return false; - if (holder->name() == ciSymbol::java_lang_System()) + if (holder->name() == ciSymbols::java_lang_System()) // Never trust strangely unstable finals: System.out, etc. return false; // Even if general trusting is disabled, trust system-built closures in these packages. @@ -239,14 +240,14 @@ static bool trust_final_non_static_fields(ciInstanceKlass* holder) { if (holder->is_record()) return true; // Trust final fields in String - if (holder->name() == ciSymbol::java_lang_String()) + if (holder->name() == ciSymbols::java_lang_String()) return true; // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483. - if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() || - holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() || - holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() || - holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) { + if (holder->name() == ciSymbols::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() || + holder->name() == ciSymbols::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() || + holder->name() == ciSymbols::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() || + holder->name() == ciSymbols::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) { return true; } return TrustFinalNonStaticFields; @@ -417,6 +418,24 @@ bool ciField::will_link(ciMethod* accessing_method, return true; } +bool ciField::is_call_site_target() { + ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass(); + if (callsite_klass == NULL) + return false; + return (holder()->is_subclass_of(callsite_klass) && (name() == ciSymbols::target_name())); +} + +bool ciField::is_autobox_cache() { + ciSymbol* klass_name = holder()->name(); + return (name() == ciSymbols::cache_field_name() && + holder()->uses_default_loader() && + (klass_name == ciSymbols::java_lang_Character_CharacterCache() || + klass_name == ciSymbols::java_lang_Byte_ByteCache() || + klass_name == ciSymbols::java_lang_Short_ShortCache() || + klass_name == ciSymbols::java_lang_Integer_IntegerCache() || + klass_name == ciSymbols::java_lang_Long_LongCache())); +} + // ------------------------------------------------------------------ // ciField::print void ciField::print() { diff --git a/src/hotspot/share/ci/ciField.hpp b/src/hotspot/share/ci/ciField.hpp index 218b5c1f17e07..8a3b3bcd8c2de 100644 --- a/src/hotspot/share/ci/ciField.hpp +++ b/src/hotspot/share/ci/ciField.hpp @@ -178,23 +178,9 @@ class ciField : public ResourceObj { // (or class/initializer methods if the field is static). bool has_initialized_final_update() const { return flags().has_initialized_final_update(); } - bool is_call_site_target() { - ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass(); - if (callsite_klass == NULL) - return false; - return (holder()->is_subclass_of(callsite_klass) && (name() == ciSymbol::target_name())); - } + bool is_call_site_target(); - bool is_autobox_cache() { - ciSymbol* klass_name = holder()->name(); - return (name() == ciSymbol::cache_field_name() && - holder()->uses_default_loader() && - (klass_name == ciSymbol::java_lang_Character_CharacterCache() || - klass_name == ciSymbol::java_lang_Byte_ByteCache() || - klass_name == ciSymbol::java_lang_Short_ShortCache() || - klass_name == ciSymbol::java_lang_Integer_IntegerCache() || - klass_name == ciSymbol::java_lang_Long_LongCache())); - } + bool is_autobox_cache(); // Debugging output void print(); diff --git a/src/hotspot/share/ci/ciMethod.cpp b/src/hotspot/share/ci/ciMethod.cpp index bdfe57a8b81be..b843fff8742cd 100644 --- a/src/hotspot/share/ci/ciMethod.cpp +++ b/src/hotspot/share/ci/ciMethod.cpp @@ -32,6 +32,7 @@ #include "ci/ciStreams.hpp" #include "ci/ciSymbol.hpp" #include "ci/ciReplay.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/abstractCompiler.hpp" @@ -946,7 +947,7 @@ bool ciMethod::is_compiled_lambda_form() const { // ciMethod::is_object_initializer // bool ciMethod::is_object_initializer() const { - return name() == ciSymbol::object_initializer_name(); + return name() == ciSymbols::object_initializer_name(); } // ------------------------------------------------------------------ diff --git a/src/hotspot/share/ci/ciMethod.hpp b/src/hotspot/share/ci/ciMethod.hpp index ae79a4e0e8d21..19db88850f477 100644 --- a/src/hotspot/share/ci/ciMethod.hpp +++ b/src/hotspot/share/ci/ciMethod.hpp @@ -29,6 +29,7 @@ #include "ci/ciInstanceKlass.hpp" #include "ci/ciObject.hpp" #include "ci/ciSignature.hpp" +#include "classfile/vmIntrinsics.hpp" #include "compiler/methodLiveness.hpp" #include "runtime/handles.hpp" #include "utilities/bitMap.hpp" @@ -75,7 +76,7 @@ class ciMethod : public ciMetadata { int _code_size; int _max_stack; int _max_locals; - vmIntrinsics::ID _intrinsic_id; + vmIntrinsicID _intrinsic_id; int _handler_count; int _nmethod_age; int _interpreter_invocation_count; @@ -181,7 +182,7 @@ class ciMethod : public ciMetadata { int code_size() const { check_is_loaded(); return _code_size; } int max_stack() const { check_is_loaded(); return _max_stack; } int max_locals() const { check_is_loaded(); return _max_locals; } - vmIntrinsics::ID intrinsic_id() const { check_is_loaded(); return _intrinsic_id; } + vmIntrinsicID intrinsic_id() const { check_is_loaded(); return _intrinsic_id; } bool has_exception_handlers() const { check_is_loaded(); return _handler_count > 0; } int exception_table_length() const { check_is_loaded(); return _handler_count; } int interpreter_invocation_count() const { check_is_loaded(); return _interpreter_invocation_count; } diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp index 4bafde9c22913..e69e32cf24d82 100644 --- a/src/hotspot/share/ci/ciObjectFactory.cpp +++ b/src/hotspot/share/ci/ciObjectFactory.cpp @@ -38,6 +38,7 @@ #include "ci/ciObject.hpp" #include "ci/ciObjectFactory.hpp" #include "ci/ciSymbol.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciTypeArray.hpp" #include "ci/ciTypeArrayKlass.hpp" #include "ci/ciUtilities.inline.hpp" @@ -136,7 +137,7 @@ void ciObjectFactory::init_shared_objects() { ciSymbol* sym = vm_symbol_at(index); assert(sym->get_symbol() == vmsym, "oop must match"); } - assert(ciSymbol::void_class_signature()->get_symbol() == vmSymbols::void_class_signature(), "spot check"); + assert(ciSymbols::void_class_signature()->get_symbol() == vmSymbols::void_class_signature(), "spot check"); #endif } diff --git a/src/hotspot/share/ci/ciStreams.cpp b/src/hotspot/share/ci/ciStreams.cpp index 02f889042fb55..4e9895bfaed8a 100644 --- a/src/hotspot/share/ci/ciStreams.cpp +++ b/src/hotspot/share/ci/ciStreams.cpp @@ -27,6 +27,7 @@ #include "ci/ciConstant.hpp" #include "ci/ciField.hpp" #include "ci/ciStreams.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "runtime/handles.inline.hpp" @@ -476,7 +477,7 @@ ciKlass* ciBytecodeStream::get_declared_method_holder() { bool ignore; // report as MethodHandle for invokedynamic, which is syntactically classless if (cur_bc() == Bytecodes::_invokedynamic) - return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false); + return CURRENT_ENV->get_klass_by_name(_holder, ciSymbols::java_lang_invoke_MethodHandle(), false); return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder); } diff --git a/src/hotspot/share/ci/ciSymbol.cpp b/src/hotspot/share/ci/ciSymbol.cpp index f651fd86c9f99..70d6801b946be 100644 --- a/src/hotspot/share/ci/ciSymbol.cpp +++ b/src/hotspot/share/ci/ciSymbol.cpp @@ -24,8 +24,10 @@ #include "precompiled.hpp" #include "ci/ciSymbol.hpp" +#include "ci/ciSymbols.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/vmSymbols.hpp" #include "memory/oopFactory.hpp" #include "prims/methodHandles.hpp" @@ -39,6 +41,8 @@ ciSymbol::ciSymbol(Symbol* s, vmSymbolID sid) assert(sid_ok(), "sid must be consistent with vmSymbols"); } +DEBUG_ONLY(bool ciSymbol::sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; }) + // ciSymbol // // This class represents a Symbol* in the HotSpot virtual diff --git a/src/hotspot/share/ci/ciSymbol.hpp b/src/hotspot/share/ci/ciSymbol.hpp index 4e5289e6421a0..974ed7685b647 100644 --- a/src/hotspot/share/ci/ciSymbol.hpp +++ b/src/hotspot/share/ci/ciSymbol.hpp @@ -27,8 +27,6 @@ #include "ci/ciBaseObject.hpp" #include "ci/ciObject.hpp" -#include "ci/ciObjectFactory.hpp" -#include "classfile/vmSymbols.hpp" #include "oops/symbol.hpp" #include "utilities/vmEnums.hpp" @@ -50,9 +48,10 @@ class ciSymbol : public ciBaseObject { private: const vmSymbolID _sid; - DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } ) - ciSymbol(Symbol* s, vmSymbolID sid = vmSymbolID::NO_SID); + ciSymbol(Symbol* s, vmSymbolID sid); + + DEBUG_ONLY(bool sid_ok();) Symbol* get_symbol() const { return _symbol; } @@ -67,7 +66,7 @@ class ciSymbol : public ciBaseObject { static ciSymbol* make_impl(const char* s); public: - // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none. + // The enumeration ID from vmSymbols, or vmSymbolID::NO_SID if none. vmSymbolID sid() const { return _sid; } // The text of the symbol as a null-terminated utf8 string. @@ -97,11 +96,6 @@ class ciSymbol : public ciBaseObject { // (Your code will be less subject to typographical bugs.) static ciSymbol* make(const char* s); -#define CI_SYMBOL_DECLARE(name, ignore_def) \ - static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(VM_SYMBOL_ENUM_NAME(name)); } - VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE) -#undef CI_SYMBOL_DECLARE - void print() { _symbol->print(); } diff --git a/src/hotspot/share/ci/ciSymbols.hpp b/src/hotspot/share/ci/ciSymbols.hpp new file mode 100644 index 0000000000000..df77b90148fdb --- /dev/null +++ b/src/hotspot/share/ci/ciSymbols.hpp @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +#ifndef SHARE_CI_CISYMBOLS_HPP +#define SHARE_CI_CISYMBOLS_HPP + +#include "ci/ciObjectFactory.hpp" +#include "ci/ciSymbol.hpp" +#include "classfile/vmSymbols.hpp" +#include "oops/symbol.hpp" + +class ciSymbols { + public: +#define CI_SYMBOL_DECLARE(name, ignore_def) \ + static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(VM_SYMBOL_ENUM_NAME(name)); } + + VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE) +#undef CI_SYMBOL_DECLARE + +}; + +#endif // SHARE_CI_CISYMBOLS_HPP \ No newline at end of file diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 4fca75be79bfc..478172dc0773b 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_COMPILER_COMPILERDIRECTIVES_HPP #define SHARE_COMPILER_COMPILERDIRECTIVES_HPP +#include "classfile/vmIntrinsics.hpp" #include "ci/ciMetadata.hpp" #include "ci/ciMethod.hpp" #include "compiler/methodMatcher.hpp" diff --git a/src/hotspot/share/compiler/methodLiveness.cpp b/src/hotspot/share/compiler/methodLiveness.cpp index 67bec91eb7228..8d99627cca2c8 100644 --- a/src/hotspot/share/compiler/methodLiveness.cpp +++ b/src/hotspot/share/compiler/methodLiveness.cpp @@ -26,6 +26,7 @@ #include "ci/ciMethod.hpp" #include "ci/ciMethodBlocks.hpp" #include "ci/ciStreams.hpp" +#include "classfile/vmIntrinsics.hpp" #include "compiler/methodLiveness.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/bytecodes.hpp" diff --git a/src/hotspot/share/jvmci/compilerRuntime.cpp b/src/hotspot/share/jvmci/compilerRuntime.cpp index 4c5edb5c1b156..539c4522f3aef 100644 --- a/src/hotspot/share/jvmci/compilerRuntime.cpp +++ b/src/hotspot/share/jvmci/compilerRuntime.cpp @@ -25,6 +25,7 @@ #include "aot/aotLoader.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/vmSymbols.hpp" #include "compiler/compilationPolicy.hpp" #include "interpreter/linkResolver.hpp" #include "jvmci/compilerRuntime.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCompiler.cpp b/src/hotspot/share/jvmci/jvmciCompiler.cpp index c0925eefc20db..6173bcc838d1d 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.cpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "compiler/compileBroker.hpp" #include "classfile/moduleEntry.hpp" +#include "classfile/vmSymbols.hpp" #include "jvmci/jvmciEnv.hpp" #include "jvmci/jvmciRuntime.hpp" #include "oops/objArrayOop.inline.hpp" @@ -42,6 +43,16 @@ JVMCICompiler::JVMCICompiler() : AbstractCompiler(compiler_jvmci) { _instance = this; } +JVMCICompiler* JVMCICompiler::instance(bool require_non_null, TRAPS) { + if (!EnableJVMCI) { + THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled") + } + if (_instance == NULL && require_non_null) { + THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "The JVMCI compiler instance has not been created"); + } + return _instance; +} + // Initialization void JVMCICompiler::initialize() { assert(!is_c1_or_interpreter_only(), "JVMCI is launched, it's not c1/interpreter only mode"); diff --git a/src/hotspot/share/jvmci/jvmciCompiler.hpp b/src/hotspot/share/jvmci/jvmciCompiler.hpp index db032b3c8acd5..c0536e91725f1 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.hpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.hpp @@ -58,15 +58,7 @@ class JVMCICompiler : public AbstractCompiler { public: JVMCICompiler(); - static JVMCICompiler* instance(bool require_non_null, TRAPS) { - if (!EnableJVMCI) { - THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled") - } - if (_instance == NULL && require_non_null) { - THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "The JVMCI compiler instance has not been created"); - } - return _instance; - } + static JVMCICompiler* instance(bool require_non_null, TRAPS); virtual const char* name() { return UseJVMCINativeLibrary ? "JVMCI-native" : "JVMCI"; } diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 02d782b966755..53ed699b666e2 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/vmSymbols.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/compilerOracle.hpp" #include "interpreter/bytecode.hpp" diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index eb4762f6e6c5f..3811dc370a88d 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "ci/ciCallSite.hpp" #include "ci/ciMethodHandle.hpp" +#include "ci/ciSymbols.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" @@ -1120,7 +1121,7 @@ ciMethod* Compile::optimize_inlining(ciMethod* caller, ciInstanceKlass* klass, // finalize() call on array is not allowed. if (receiver_type->isa_aryptr() && callee->holder() == env()->Object_klass() && - callee->name() != ciSymbol::finalize_method_name()) { + callee->name() != ciSymbols::finalize_method_name()) { return callee; } diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index e51fa2c76852b..3caa66df348b1 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -26,7 +26,7 @@ #include "asm/macroAssembler.hpp" #include "ci/ciUtilities.inline.hpp" #include "classfile/systemDictionary.hpp" -#include "classfile/vmSymbols.hpp" +#include "classfile/vmIntrinsics.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "gc/shared/barrierSet.hpp" @@ -60,7 +60,7 @@ //---------------------------make_vm_intrinsic---------------------------- CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { - vmIntrinsics::ID id = m->intrinsic_id(); + vmIntrinsicID id = m->intrinsic_id(); assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); if (!m->is_loaded()) { @@ -89,7 +89,7 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) { return new LibraryIntrinsic(m, is_virtual, vmIntrinsics::predicates_needed(id), vmIntrinsics::does_virtual_dispatch(id), - (vmIntrinsics::ID) id); + id); } else { return NULL; } @@ -672,7 +672,7 @@ bool LibraryCallKit::try_to_inline(int predicate) { default: // If you get here, it may be that someone has added a new intrinsic - // to the list in vmSymbols.hpp without implementing it here. + // to the list in vmIntrinsics.hpp without implementing it here. #ifndef PRODUCT if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) { tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)", @@ -708,7 +708,7 @@ Node* LibraryCallKit::try_to_predicate(int predicate) { default: // If you get here, it may be that someone has added a new intrinsic - // to the list in vmSymbols.hpp without implementing it here. + // to the list in vmIntrinsics.hpp without implementing it here. #ifndef PRODUCT if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) { tty->print_cr("*** Warning: Unimplemented predicate for intrinsic %s(%d)", diff --git a/src/hotspot/share/opto/parseHelper.cpp b/src/hotspot/share/opto/parseHelper.cpp index fbcb0713555ab..cd1104ca2f03d 100644 --- a/src/hotspot/share/opto/parseHelper.cpp +++ b/src/hotspot/share/opto/parseHelper.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "ci/ciSymbols.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/compileLog.hpp" #include "oops/objArrayKlass.hpp" @@ -245,7 +246,7 @@ void Parse::do_new() { // Should throw an InstantiationError? if (klass->is_abstract() || klass->is_interface() || - klass->name() == ciSymbol::java_lang_Class() || + klass->name() == ciSymbols::java_lang_Class() || iter().is_unresolved_klass()) { uncommon_trap(Deoptimization::Reason_unhandled, Deoptimization::Action_none, diff --git a/src/hotspot/share/opto/stringopts.cpp b/src/hotspot/share/opto/stringopts.cpp index 7e1ca856fbae1..68257eaab509f 100644 --- a/src/hotspot/share/opto/stringopts.cpp +++ b/src/hotspot/share/opto/stringopts.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "ci/ciSymbols.hpp" #include "classfile/javaClasses.hpp" #include "compiler/compileLog.hpp" #include "opto/addnode.hpp" @@ -417,13 +418,13 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { ciSymbol* int_sig; ciSymbol* char_sig; if (m->holder() == C->env()->StringBuilder_klass()) { - string_sig = ciSymbol::String_StringBuilder_signature(); - int_sig = ciSymbol::int_StringBuilder_signature(); - char_sig = ciSymbol::char_StringBuilder_signature(); + string_sig = ciSymbols::String_StringBuilder_signature(); + int_sig = ciSymbols::int_StringBuilder_signature(); + char_sig = ciSymbols::char_StringBuilder_signature(); } else if (m->holder() == C->env()->StringBuffer_klass()) { - string_sig = ciSymbol::String_StringBuffer_signature(); - int_sig = ciSymbol::int_StringBuffer_signature(); - char_sig = ciSymbol::char_StringBuffer_signature(); + string_sig = ciSymbols::String_StringBuffer_signature(); + int_sig = ciSymbols::int_StringBuffer_signature(); + char_sig = ciSymbols::char_StringBuffer_signature(); } else { return NULL; } @@ -470,14 +471,14 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { if (use != NULL && use->method() != NULL && !use->method()->is_static() && - use->method()->name() == ciSymbol::object_initializer_name() && + use->method()->name() == ciSymbols::object_initializer_name() && use->method()->holder() == m->holder()) { // Matched the constructor. ciSymbol* sig = use->method()->signature()->as_symbol(); - if (sig == ciSymbol::void_method_signature() || - sig == ciSymbol::int_void_signature() || - sig == ciSymbol::string_void_signature()) { - if (sig == ciSymbol::string_void_signature()) { + if (sig == ciSymbols::void_method_signature() || + sig == ciSymbols::int_void_signature() || + sig == ciSymbols::string_void_signature()) { + if (sig == ciSymbols::string_void_signature()) { // StringBuilder(String) so pick this up as the first argument assert(use->in(TypeFunc::Parms + 1) != NULL, "what?"); const Type* type = _gvn->type(use->in(TypeFunc::Parms + 1)); @@ -534,7 +535,7 @@ StringConcat* PhaseStringOpts::build_candidate(CallStaticJavaNode* call) { break; } else if (!cnode->method()->is_static() && cnode->method()->holder() == m->holder() && - cnode->method()->name() == ciSymbol::append_name() && + cnode->method()->name() == ciSymbols::append_name() && (cnode->method()->signature()->as_symbol() == string_sig || cnode->method()->signature()->as_symbol() == char_sig || cnode->method()->signature()->as_symbol() == int_sig)) { @@ -599,7 +600,7 @@ PhaseStringOpts::PhaseStringOpts(PhaseGVN* gvn, Unique_Node_List*): assert(OptimizeStringConcat, "shouldn't be here"); size_table_field = C->env()->Integer_klass()->get_field_by_name(ciSymbol::make("sizeTable"), - ciSymbol::make("[I"), true); + ciSymbols::int_array_signature(), true); if (size_table_field == NULL) { // Something wrong so give up. assert(false, "why can't we find Integer.sizeTable?"); diff --git a/src/hotspot/share/opto/vector.cpp b/src/hotspot/share/opto/vector.cpp index 5ccf70c2228f7..e9ac28545aa93 100644 --- a/src/hotspot/share/opto/vector.cpp +++ b/src/hotspot/share/opto/vector.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "ci/ciSymbols.hpp" #include "opto/castnode.hpp" #include "opto/graphKit.hpp" #include "opto/phaseX.hpp" @@ -358,8 +359,8 @@ Node* PhaseVector::expand_vbox_alloc_node(VectorBoxAllocateNode* vbox_alloc, Node* vec_obj = kit.new_instance(klass_node); // Store the allocated array into object. - ciField* field = ciEnv::current()->vector_VectorPayload_klass()->get_field_by_name(ciSymbol::payload_name(), - ciSymbol::object_signature(), + ciField* field = ciEnv::current()->vector_VectorPayload_klass()->get_field_by_name(ciSymbols::payload_name(), + ciSymbols::object_signature(), false); assert(field != NULL, ""); Node* vec_field = kit.basic_plus_adr(vec_obj, field->offset_in_bytes()); @@ -403,8 +404,8 @@ void PhaseVector::expand_vunbox_node(VectorUnboxNode* vec_unbox) { bt = T_BYTE; } - ciField* field = ciEnv::current()->vector_VectorPayload_klass()->get_field_by_name(ciSymbol::payload_name(), - ciSymbol::object_signature(), + ciField* field = ciEnv::current()->vector_VectorPayload_klass()->get_field_by_name(ciSymbols::payload_name(), + ciSymbols::object_signature(), false); assert(field != NULL, ""); int offset = field->offset_in_bytes(); diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 07036d2ca7b7e..76cfc71239fc5 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "ci/ciSymbols.hpp" #include "classfile/vmSymbols.hpp" #include "opto/library_call.hpp" #include "opto/runtime.hpp" @@ -40,14 +41,14 @@ static bool check_vbox(const TypeInstPtr* vbox_type) { ciInstanceKlass* ik = vbox_type->klass()->as_instance_klass(); assert(is_vector(ik), "not a vector"); - ciField* fd1 = ik->get_field_by_name(ciSymbol::ETYPE_name(), ciSymbol::class_signature(), /* is_static */ true); + ciField* fd1 = ik->get_field_by_name(ciSymbols::ETYPE_name(), ciSymbols::class_signature(), /* is_static */ true); assert(fd1 != NULL, "element type info is missing"); ciConstant val1 = fd1->constant_value(); BasicType elem_bt = val1.as_object()->as_instance()->java_mirror_type()->basic_type(); assert(is_java_primitive(elem_bt), "element type info is missing"); - ciField* fd2 = ik->get_field_by_name(ciSymbol::VLENGTH_name(), ciSymbol::int_signature(), /* is_static */ true); + ciField* fd2 = ik->get_field_by_name(ciSymbols::VLENGTH_name(), ciSymbols::int_signature(), /* is_static */ true); assert(fd2 != NULL, "vector length info is missing"); ciConstant val2 = fd2->constant_value(); diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp index c25781da310b5..14766c61468b7 100644 --- a/src/hotspot/share/prims/jvmtiExport.cpp +++ b/src/hotspot/share/prims/jvmtiExport.cpp @@ -26,6 +26,7 @@ #include "classfile/javaClasses.inline.hpp" #include "classfile/moduleEntry.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/vmSymbols.hpp" #include "code/nmethod.hpp" #include "code/pcDesc.hpp" #include "code/scopeDesc.hpp" diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index ed77f7db2e75a..7fadbaf542f3d 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -32,6 +32,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/verifier.hpp" +#include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" #include "interpreter/oopMapCache.hpp" diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index ffcddade86cc0..535875d8a21b5 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -32,6 +32,7 @@ #include "classfile/protectionDomainCache.hpp" #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" #include "compiler/compilationPolicy.hpp" #include "compiler/methodMatcher.hpp" diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 9956cc40e8e4b..7cb236713e92f 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -36,6 +36,7 @@ #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/vmSymbols.hpp" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" #include "code/compressedStream.hpp" diff --git a/src/hotspot/share/services/threadService.cpp b/src/hotspot/share/services/threadService.cpp index b447a85d7c119..ead65098d8a2d 100644 --- a/src/hotspot/share/services/threadService.cpp +++ b/src/hotspot/share/services/threadService.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/vmSymbols.hpp" #include "gc/shared/oopStorageSet.hpp" #include "memory/allocation.hpp" #include "memory/heapInspection.hpp" From 3342ecaf4431a88dfd676d2f66e3e0f2cbb2704a Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 10 Dec 2020 18:16:33 +0000 Subject: [PATCH 194/504] 8258054: runtime/sealedClasses/GetPermittedSubclassesTest.java fails w/ jdk17 Reviewed-by: mikael, hseigel, darcy --- .../jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod index 26d6a61bca221..06fda7e9d32a2 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod +++ b/test/hotspot/jtreg/runtime/sealedClasses/GetPermittedSubclasses.jcod @@ -239,7 +239,7 @@ class NoSubclasses { class SubClass { 0xCAFEBABE; 65535; // minor version - 60; // version + 61; // version [13] { // Constant Pool ; // first element is empty Method #2 #3; // #1 at 0x0A From 42264b2db4ff7af4c201b5642c771144a26164d9 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Thu, 10 Dec 2020 19:55:44 +0000 Subject: [PATCH 195/504] 8257971: (fs) Remove unused code from WindowsPath.subpath(begin, end) Reviewed-by: lancea --- src/java.base/windows/classes/sun/nio/fs/WindowsPath.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java b/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java index de2a0a8a28f7a..5d4360e105605 100644 --- a/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java +++ b/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java @@ -689,9 +689,7 @@ public WindowsPath subpath(int beginIndex, int endIndex) { throw new IllegalArgumentException(); StringBuilder sb = new StringBuilder(); - Integer[] nelems = new Integer[endIndex - beginIndex]; for (int i = beginIndex; i < endIndex; i++) { - nelems[i-beginIndex] = sb.length(); sb.append(elementAsString(i)); if (i != (endIndex-1)) sb.append("\\"); From 164c55be785aaac7f1f131f00f32d12ca2bf9247 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Thu, 10 Dec 2020 20:21:35 +0000 Subject: [PATCH 196/504] 8258056: jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java fails against jdk17 Reviewed-by: jwilhelm --- .../javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java index 301669d2e30f9..72ce48a36d22b 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java @@ -684,7 +684,7 @@ void checkHtmlTableContents() { checkOutput("constant-values.html", true, """

        public s\ - tatic final String
        CO\ @@ -815,7 +815,7 @@ void checkHtmlTableContentsNoComment() { checkOutput("constant-values.html", true, """
        CO\ From 80dac5a87c63981a2588e29fe8127a6787abba47 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 10 Dec 2020 20:33:13 +0000 Subject: [PATCH 197/504] 8257912: Convert enum iteration to use range-based for loops Reviewed-by: kbarrett, tschatzl, gziemski --- src/hotspot/share/ci/ciObjectFactory.cpp | 6 +- .../share/classfile/classFileParser.cpp | 3 +- src/hotspot/share/classfile/vmIntrinsics.cpp | 6 +- src/hotspot/share/classfile/vmIntrinsics.hpp | 2 - src/hotspot/share/classfile/vmSymbols.cpp | 30 +++----- src/hotspot/share/classfile/vmSymbols.hpp | 2 - .../jfr/recorder/checkpoint/types/jfrType.cpp | 5 +- src/hotspot/share/opto/compile.cpp | 3 +- src/hotspot/share/utilities/enumIterator.hpp | 18 +++-- .../gtest/utilities/test_enumIterator.cpp | 68 +++++++++++++++++++ 10 files changed, 95 insertions(+), 48 deletions(-) diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp index e69e32cf24d82..0f50c58ff6deb 100644 --- a/src/hotspot/share/ci/ciObjectFactory.cpp +++ b/src/hotspot/share/ci/ciObjectFactory.cpp @@ -122,8 +122,7 @@ void ciObjectFactory::init_shared_objects() { { // Create the shared symbols, but not in _shared_ci_metadata. - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { Symbol* vmsym = vmSymbols::symbol_at(index); assert(vmSymbols::find_sid(vmsym) == index, "1-1 mapping"); ciSymbol* sym = new (_arena) ciSymbol(vmsym, index); @@ -131,8 +130,7 @@ void ciObjectFactory::init_shared_objects() { _shared_ci_symbols[vmSymbols::as_int(index)] = sym; } #ifdef ASSERT - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { Symbol* vmsym = vmSymbols::symbol_at(index); ciSymbol* sym = vm_symbol_at(index); assert(sym->get_symbol() == vmsym, "oop must match"); diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 97aa2a25b88a1..fc2d0d068f8c9 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -5302,8 +5302,7 @@ static void check_methods_for_intrinsics(const InstanceKlass* ik, // The check is potentially expensive, therefore it is available // only in debug builds. - for (vmIntrinsicsIterator it = vmIntrinsicsRange.begin(); it != vmIntrinsicsRange.end(); ++it) { - vmIntrinsicID id = *it; + for (vmIntrinsicID id : EnumRange{}) { if (vmIntrinsics::_compiledLambdaForm == id) { // The _compiledLamdbdaForm intrinsic is a special marker for bytecode // generated for the JVM from a LambdaForm and therefore no method diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index a686c05022463..012e0c3edef57 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -574,8 +574,7 @@ void vmIntrinsics::init_vm_intrinsic_name_table() { const char** nt = &vm_intrinsic_name_table[0]; char* string = (char*) &vm_intrinsic_name_bodies[0]; - for (vmIntrinsicsIterator it = vmIntrinsicsRange.begin(); it != vmIntrinsicsRange.end(); ++it) { - vmIntrinsicID index = *it; + for (vmIntrinsicID index : EnumRange{}) { nt[as_int(index)] = string; string += strlen(string); // skip string body string += 1; // skip trailing null @@ -602,8 +601,7 @@ vmIntrinsics::ID vmIntrinsics::find_id(const char* name) { init_vm_intrinsic_name_table(); } - for (vmIntrinsicsIterator it = vmIntrinsicsRange.begin(); it != vmIntrinsicsRange.end(); ++it) { - vmIntrinsicID index = *it; + for (vmIntrinsicID index : EnumRange{}) { if (0 == strcmp(name, nt[as_int(index)])) { return index; } diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index d36b3867a885c..0cce545a77814 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -1044,8 +1044,6 @@ enum class vmIntrinsicID : int { }; ENUMERATOR_RANGE(vmIntrinsicID, vmIntrinsicID::FIRST_ID, vmIntrinsicID::LAST_ID) -constexpr EnumRange vmIntrinsicsRange; // the default range of all valid vmIntrinsicIDs -using vmIntrinsicsIterator = EnumIterator; // convenience class vmIntrinsics : AllStatic { friend class vmSymbols; diff --git a/src/hotspot/share/classfile/vmSymbols.cpp b/src/hotspot/share/classfile/vmSymbols.cpp index 0c6c8a9897f4e..d78a07eb5185d 100644 --- a/src/hotspot/share/classfile/vmSymbols.cpp +++ b/src/hotspot/share/classfile/vmSymbols.cpp @@ -83,8 +83,7 @@ void vmSymbols::initialize(TRAPS) { if (!UseSharedSpaces) { const char* string = &vm_symbol_bodies[0]; - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { Symbol* sym = SymbolTable::new_permanent_symbol(string); Symbol::_vm_symbols[as_int(index)] = sym; string += strlen(string); // skip string body @@ -113,12 +112,11 @@ void vmSymbols::initialize(TRAPS) { #ifdef ASSERT // Check for duplicates: - for (vmSymbolsIterator it1 = vmSymbolsRange.begin(); it1 != vmSymbolsRange.end(); ++it1) { - vmSymbolID i1 = *it1; + + for (vmSymbolID i1 : EnumRange{}) { Symbol* sym = symbol_at(i1); - for (vmSymbolsIterator it2 = vmSymbolsRange.begin(); it2 != it1; ++it2) { - vmSymbolID i2 = *it2; - if (symbol_at(i2) == sym) { + for (vmSymbolID i2 : EnumRange{vmSymbolID::FIRST_SID, i1}) { + if (i2 != i1 && symbol_at(i2) == sym) { tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"", vm_symbol_enum_name(i2), as_int(i2), vm_symbol_enum_name(i1), as_int(i1)); @@ -131,8 +129,7 @@ void vmSymbols::initialize(TRAPS) { // Create an index for find_id: { - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { vm_symbol_index[as_int(index)] = index; } int num_sids = SID_LIMIT-FIRST_SID; @@ -153,8 +150,7 @@ void vmSymbols::initialize(TRAPS) { assert(symbol_at(sid) == jlo, ""); // Make sure find_sid produces the right answer in each case. - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { Symbol* sym = symbol_at(index); sid = find_sid(sym); assert(sid == index, "symbol index works"); @@ -178,8 +174,7 @@ const char* vmSymbols::name_for(vmSymbolID sid) { if (sid == vmSymbolID::NO_SID) return "NO_SID"; const char* string = &vm_symbol_bodies[0]; - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { if (index == sid) return string; string += strlen(string); // skip string body @@ -192,8 +187,7 @@ const char* vmSymbols::name_for(vmSymbolID sid) { void vmSymbols::symbols_do(SymbolClosure* f) { - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { f->do_symbol(&Symbol::_vm_symbols[as_int(index)]); } for (int i = 0; i < T_VOID+1; i++) { @@ -202,8 +196,7 @@ void vmSymbols::symbols_do(SymbolClosure* f) { } void vmSymbols::metaspace_pointers_do(MetaspaceClosure *closure) { - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { closure->push(&Symbol::_vm_symbols[as_int(index)]); } for (int i = 0; i < T_VOID+1; i++) { @@ -281,8 +274,7 @@ vmSymbolID vmSymbols::find_sid(const Symbol* symbol) { // Make sure this is the right answer, using linear search. // (We have already proven that there are no duplicates in the list.) vmSymbolID sid2 = vmSymbolID::NO_SID; - for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { - vmSymbolID index = *it; + for (vmSymbolID index : EnumRange{}) { Symbol* sym2 = symbol_at(index); if (sym2 == symbol) { sid2 = index; diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index 495c30cfa6002..4623dbb2c649c 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.hpp @@ -722,8 +722,6 @@ enum class vmSymbolID : int { }; ENUMERATOR_RANGE(vmSymbolID, vmSymbolID::FIRST_SID, vmSymbolID::LAST_SID) -constexpr EnumRange vmSymbolsRange; // the default range of all valid vmSymbolIDs -using vmSymbolsIterator = EnumIterator; // convenience class vmSymbols: AllStatic { friend class vmIntrinsics; diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp index f867ce1422645..38b028ac6247e 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp @@ -138,11 +138,10 @@ static const char* flag_value_origin_to_string(JVMFlagOrigin origin) { } void FlagValueOriginConstant::serialize(JfrCheckpointWriter& writer) { - constexpr EnumRange range; + constexpr EnumRange range{}; writer.write_count(static_cast(range.size())); - for (EnumIterator it = range.begin(); it != range.end(); ++it) { - JVMFlagOrigin origin = *it; + for (JVMFlagOrigin origin : range) { writer.write_key(static_cast(origin)); writer.write(flag_value_origin_to_string(origin)); } diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 3468593932499..13144a0ff79c7 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -234,8 +234,7 @@ void Compile::print_intrinsic_statistics() { if (total == 0) total = 1; // avoid div0 in case of no successes #define PRINT_STAT_LINE(name, c, f) \ tty->print_cr(" %4d (%4.1f%%) %s (%s)", (int)(c), ((c) * 100.0) / total, name, f); - for (vmIntrinsicsIterator it = vmIntrinsicsRange.begin(); it != vmIntrinsicsRange.end(); ++it) { - vmIntrinsicID id = *it; + for (vmIntrinsicID id : EnumRange{}) { int flags = _intrinsic_hist_flags[as_int(id)]; juint count = _intrinsic_hist_count[as_int(id)]; if ((flags | count) != 0) { diff --git a/src/hotspot/share/utilities/enumIterator.hpp b/src/hotspot/share/utilities/enumIterator.hpp index aadae51b803f5..66a421d6e3f62 100644 --- a/src/hotspot/share/utilities/enumIterator.hpp +++ b/src/hotspot/share/utilities/enumIterator.hpp @@ -57,21 +57,19 @@ // EnumRange -- defines the range of *one specific* iteration loop. // EnumIterator -- the current point in the iteration loop. -// Example (see vmSymbols.hpp/cpp) +// Example: // -// ENUMERATOR_RANGE(vmSymbolID, vmSymbolID::FIRST_SID, vmSymbolID::LAST_SID) -// constexpr EnumRange vmSymbolsRange; -// using vmSymbolsIterator = EnumIterator; +// /* With range-base for (recommended) */ +// for (vmSymbolID index : EnumRange{}) { +// .... +// } // -// /* Without range-based for, allowed */ +// /* Without range-based for */ +// constexpr EnumRange vmSymbolsRange{}; +// using vmSymbolsIterator = EnumIterator; // for (vmSymbolsIterator it = vmSymbolsRange.begin(); it != vmSymbolsRange.end(); ++it) { // vmSymbolID index = *it; .... // } -// -// /* With range-base for, not allowed by HotSpot coding style yet */ -// for (vmSymbolID index : vmSymbolsRange) { -// .... -// } // EnumeratorRange is a traits type supporting iteration over the enumerators of T. // Specializations must provide static const data members named "_start" and "_end". diff --git a/test/hotspot/gtest/utilities/test_enumIterator.cpp b/test/hotspot/gtest/utilities/test_enumIterator.cpp index f1bf16f1a76b3..bf8d0417bf2ca 100644 --- a/test/hotspot/gtest/utilities/test_enumIterator.cpp +++ b/test/hotspot/gtest/utilities/test_enumIterator.cpp @@ -110,3 +110,71 @@ TEST(TestEnumIterator, implicit_iterator) { } EXPECT_EQ(it, range.end()); } + +TEST(TestEnumIterator, explict_range_based_for_loop_full) { + int i = explicit_start; + for (ExplicitTest value : EnumRange{}) { + EXPECT_EQ(size_t(i - explicit_start), EnumRange{}.index(value)); + EXPECT_TRUE(value == ExplicitTest::value1 || + value == ExplicitTest::value2 || + value == ExplicitTest::value3); + ++i; + } +} + +TEST(TestEnumIterator, explict_range_based_for_loop_start) { + constexpr EnumRange range{ExplicitTest::value2}; + int start = explicit_start + 2; + int i = start; + for (ExplicitTest value : range) { + EXPECT_EQ(size_t(i - start), range.index(value)); + EXPECT_TRUE(value == ExplicitTest::value2 || value == ExplicitTest::value3); + EXPECT_TRUE(value != ExplicitTest::value1); + ++i; + } +} + +TEST(TestEnumIterator, explict_range_based_for_loop_start_end) { + constexpr EnumRange range{ExplicitTest::value1, ExplicitTest::value2}; + int start = explicit_start + 1; + int i = start; + for (ExplicitTest value : range) { + EXPECT_EQ(size_t(i - start), range.index(value)); + EXPECT_TRUE(value == ExplicitTest::value1 || value == ExplicitTest::value2); + EXPECT_TRUE(value != ExplicitTest::value3); + ++i; + } +} + +TEST(TestEnumIterator, implicit_range_based_for_loop) { + int i = implicit_start; + for (ImplicitTest value : EnumRange{}) { + EXPECT_EQ(size_t(i - implicit_start), EnumRange{}.index(value)); + ++i; + } +} + +TEST(TestEnumIterator, implicit_range_based_for_loop_start) { + int start = implicit_start + 1; + EnumRange range{static_cast(start)}; + int i = start; + for (ImplicitTest value : range) { + EXPECT_EQ(size_t(i - start), range.index(value)); + int iv = static_cast(value); + EXPECT_TRUE(start <= iv && iv <= implicit_end); + ++i; + } +} + +TEST(TestEnumIterator, implicit_range_based_for_loop_start_end) { + int start = implicit_start + 1; + int end = implicit_end - 1; + EnumRange range{static_cast(start), static_cast(end)}; + int i = start; + for (ImplicitTest value : range) { + EXPECT_EQ(size_t(i - start), range.index(value)); + int iv = static_cast(value); + EXPECT_TRUE(start <= iv && iv <= end); + ++i; + } +} From fa77008f198b4be6f4eeb16ea49284e701e03619 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Thu, 10 Dec 2020 21:18:35 +0000 Subject: [PATCH 198/504] 8258015: [JVMCI] JVMCI_lock shouldn't be held while initializing box classes Reviewed-by: kvn Backport-of: d163c6fe2ec235a175b62ec821477d33b14841fe --- src/hotspot/share/jvmci/jvmci.cpp | 9 +++------ src/hotspot/share/jvmci/jvmci.hpp | 4 ++-- src/hotspot/share/jvmci/jvmciCodeInstaller.cpp | 11 +++++------ src/hotspot/share/jvmci/jvmciCodeInstaller.hpp | 7 ++++++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/hotspot/share/jvmci/jvmci.cpp b/src/hotspot/share/jvmci/jvmci.cpp index f971ffae0d882..46fe89be1ba73 100644 --- a/src/hotspot/share/jvmci/jvmci.cpp +++ b/src/hotspot/share/jvmci/jvmci.cpp @@ -37,7 +37,7 @@ JVMCIRuntime* JVMCI::_compiler_runtime = NULL; JVMCIRuntime* JVMCI::_java_runtime = NULL; volatile bool JVMCI::_is_initialized = false; -volatile bool JVMCI::_box_caches_initialized = false; +bool JVMCI::_box_caches_initialized = false; void* JVMCI::_shared_library_handle = NULL; char* JVMCI::_shared_library_path = NULL; volatile bool JVMCI::_in_shutdown = false; @@ -130,12 +130,9 @@ void JVMCI::ensure_box_caches_initialized(TRAPS) { if (_box_caches_initialized) { return; } - MutexLocker locker(JVMCI_lock); - // Check again after locking - if (_box_caches_initialized) { - return; - } + // While multiple threads may reach here, that's fine + // since class initialization is synchronized. Symbol* box_classes[] = { java_lang_Boolean::symbol(), java_lang_Byte_ByteCache::symbol(), diff --git a/src/hotspot/share/jvmci/jvmci.hpp b/src/hotspot/share/jvmci/jvmci.hpp index 61c0527e37a51..9225dc6e02907 100644 --- a/src/hotspot/share/jvmci/jvmci.hpp +++ b/src/hotspot/share/jvmci/jvmci.hpp @@ -53,8 +53,8 @@ class JVMCI : public AllStatic { // execution has completed successfully. static volatile bool _is_initialized; - // used to synchronize lazy initialization of boxing cache classes. - static volatile bool _box_caches_initialized; + // True once boxing cache classes are guaranteed to be initialized. + static bool _box_caches_initialized; // Handle created when loading the JVMCI shared library with os::dll_load. // Must hold JVMCI_lock when initializing. diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index 0ed9f8d92f794..a08da90870583 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -945,6 +945,10 @@ JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, bo } } #endif + if (_has_auto_box) { + JavaThread* THREAD = JavaThread::current(); + JVMCI::ensure_box_caches_initialized(CHECK_(JVMCI::ok)); + } return JVMCI::ok; } @@ -1022,7 +1026,6 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de } GrowableArray* objects = new GrowableArray(JVMCIENV->get_length(virtualObjects), JVMCIENV->get_length(virtualObjects), NULL); // Create the unique ObjectValues - bool has_auto_box = false; for (int i = 0; i < JVMCIENV->get_length(virtualObjects); i++) { // HandleMark hm(THREAD); JVMCIObject value = JVMCIENV->get_object_at(virtualObjects, i); @@ -1030,7 +1033,7 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de JVMCIObject type = jvmci_env()->get_VirtualObject_type(value); bool is_auto_box = jvmci_env()->get_VirtualObject_isAutoBox(value); if (is_auto_box) { - has_auto_box = true; + _has_auto_box = true; } Klass* klass = jvmci_env()->asKlass(type); oop javaMirror = klass->java_mirror(); @@ -1054,10 +1057,6 @@ GrowableArray* CodeInstaller::record_virtual_objects(JVMCIObject de } _debug_recorder->dump_object_pool(objects); - if (has_auto_box) { - JavaThread* THREAD = JavaThread::current(); - JVMCI::ensure_box_caches_initialized(CHECK_NULL); - } return objects; } diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp index fcdd7febdc112..347dccd209cd9 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp @@ -200,6 +200,7 @@ class CodeInstaller : public StackObj { Dependencies* _dependencies; ExceptionHandlerTable _exception_handler_table; ImplicitExceptionTable _implicit_exception_table; + bool _has_auto_box; bool _immutable_pic_compilation; // Installer is called for Immutable PIC compilation. @@ -230,7 +231,11 @@ class CodeInstaller : public StackObj { public: - CodeInstaller(JVMCIEnv* jvmci_env, bool immutable_pic_compilation) : _arena(mtJVMCI), _jvmci_env(jvmci_env), _immutable_pic_compilation(immutable_pic_compilation) {} + CodeInstaller(JVMCIEnv* jvmci_env, bool immutable_pic_compilation) : + _arena(mtJVMCI), + _jvmci_env(jvmci_env), + _has_auto_box(false), + _immutable_pic_compilation(immutable_pic_compilation) {} #if INCLUDE_AOT JVMCI::CodeInstallResult gather_metadata(JVMCIObject target, JVMCIObject compiled_code, CodeMetadata& metadata, JVMCI_TRAPS); From e90d0d1da4bfbb08ddd5a3186e5464ff1c825643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Thu, 10 Dec 2020 22:25:23 +0000 Subject: [PATCH 199/504] 8258065: ProblemList JfrGTestAdaptiveSampling Reviewed-by: iignatyev --- test/hotspot/gtest/jfr/test_adaptiveSampler.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp index 920c874ec53e1..8e8878c0b89d8 100644 --- a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp +++ b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp @@ -233,15 +233,15 @@ void JfrGTestAdaptiveSampling::test(JfrGTestAdaptiveSampling::incoming inc, size assertDistributionProperties(100, population, sample, population_size, sample_size, output); } -TEST_VM_F(JfrGTestAdaptiveSampling, uniform_rate) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_uniform_rate) { test(&JfrGTestAdaptiveSampling::incoming_uniform, expected_sample_points_per_window, 0.05, "random uniform, all samples"); } -TEST_VM_F(JfrGTestAdaptiveSampling, low_rate) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_low_rate) { test(&JfrGTestAdaptiveSampling::incoming_low_rate, min_population_per_window, 0.05, "low rate"); } -TEST_VM_F(JfrGTestAdaptiveSampling, high_rate) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_high_rate) { test(&JfrGTestAdaptiveSampling::incoming_high_rate, expected_sample_points_per_window, 0.02, "high rate"); } @@ -259,23 +259,23 @@ TEST_VM_F(JfrGTestAdaptiveSampling, high_rate) { // - late end of the second -> each second will have sampled the window set point + accumulated debt for the first 9 windows (i.e. it will have sampled all) // -TEST_VM_F(JfrGTestAdaptiveSampling, early_burst) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_early_burst) { test(&JfrGTestAdaptiveSampling::incoming_early_burst, expected_sample_points_per_window, 0.9, "early burst"); } -TEST_VM_F(JfrGTestAdaptiveSampling, mid_burst) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_mid_burst) { test(&JfrGTestAdaptiveSampling::incoming_mid_burst, expected_sample_points_per_window, 0.5, "mid burst"); } -TEST_VM_F(JfrGTestAdaptiveSampling, late_burst) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_late_burst) { test(&JfrGTestAdaptiveSampling::incoming_late_burst, expected_sample_points_per_window, 0.0, "late burst"); } // These are randomized burst tests -TEST_VM_F(JfrGTestAdaptiveSampling, bursty_rate_10_percent) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_bursty_rate_10_percent) { test(&JfrGTestAdaptiveSampling::incoming_bursty_10_percent, expected_sample_points_per_window, 0.96, "bursty 10%"); } -TEST_VM_F(JfrGTestAdaptiveSampling, bursty_rate_90_percent) { +TEST_VM_F(JfrGTestAdaptiveSampling, DISABLED_bursty_rate_90_percent) { test(&JfrGTestAdaptiveSampling::incoming_bursty_10_percent, expected_sample_points_per_window, 0.96, "bursty 90%"); } From 58dca9253d3ec7bc5745d5b814b33e1b4b8b08e8 Mon Sep 17 00:00:00 2001 From: Yudi Zheng Date: Thu, 10 Dec 2020 22:43:37 +0000 Subject: [PATCH 200/504] 8257910: [JVMCI] Set exception_seen accordingly in the runtime. Reviewed-by: kvn --- src/hotspot/share/c1/c1_Runtime1.cpp | 28 ++++++++++---------- src/hotspot/share/jvmci/jvmciRuntime.cpp | 28 ++++++++++---------- src/hotspot/share/runtime/deoptimization.cpp | 12 +++++++++ src/hotspot/share/runtime/sharedRuntime.cpp | 22 +++++++++++++++ 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index 8045fbfaa59e6..f0280d71b8d96 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -538,6 +538,20 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t } #endif + // debugging support + // tracing + if (log_is_enabled(Info, exceptions)) { + ResourceMark rm; + stringStream tempst; + assert(nm->method() != NULL, "Unexpected NULL method()"); + tempst.print("C1 compiled method <%s>\n" + " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, + nm->method()->print_value_string(), p2i(pc), p2i(thread)); + Exceptions::log_exception(exception, tempst.as_string()); + } + // for AbortVMOnException flag + Exceptions::debug_check_abort(exception); + // Check the stack guard pages and reenable them if necessary and there is // enough space on the stack to do so. Use fast exceptions only if the guard // pages are enabled. @@ -584,20 +598,6 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t // New exception handling mechanism can support inlined methods // with exception handlers since the mappings are from PC to PC - // debugging support - // tracing - if (log_is_enabled(Info, exceptions)) { - ResourceMark rm; - stringStream tempst; - assert(nm->method() != NULL, "Unexpected NULL method()"); - tempst.print("compiled method <%s>\n" - " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, - nm->method()->print_value_string(), p2i(pc), p2i(thread)); - Exceptions::log_exception(exception, tempst.as_string()); - } - // for AbortVMOnException flag - Exceptions::debug_check_abort(exception); - // Clear out the exception oop and pc since looking up an // exception handler can cause class loading, which might throw an // exception and those fields are expected to be clear during diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 4cd91108f4849..8701c7c6d3528 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -267,6 +267,20 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t } #endif + // debugging support + // tracing + if (log_is_enabled(Info, exceptions)) { + ResourceMark rm; + stringStream tempst; + assert(cm->method() != NULL, "Unexpected null method()"); + tempst.print("JVMCI compiled method <%s>\n" + " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, + cm->method()->print_value_string(), p2i(pc), p2i(thread)); + Exceptions::log_exception(exception, tempst.as_string()); + } + // for AbortVMOnException flag + Exceptions::debug_check_abort(exception); + // Check the stack guard pages and reenable them if necessary and there is // enough space on the stack to do so. Use fast exceptions only if the guard // pages are enabled. @@ -313,20 +327,6 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t // New exception handling mechanism can support inlined methods // with exception handlers since the mappings are from PC to PC - // debugging support - // tracing - if (log_is_enabled(Info, exceptions)) { - ResourceMark rm; - stringStream tempst; - assert(cm->method() != NULL, "Unexpected null method()"); - tempst.print("compiled method <%s>\n" - " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, - cm->method()->print_value_string(), p2i(pc), p2i(thread)); - Exceptions::log_exception(exception, tempst.as_string()); - } - // for AbortVMOnException flag - NOT_PRODUCT(Exceptions::debug_check_abort(exception)); - // Clear out the exception oop and pc since looking up an // exception handler can cause class loading, which might throw an // exception and those fields are expected to be clear during diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 095c22bb316d0..20a29459be796 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -1731,6 +1731,18 @@ address Deoptimization::deoptimize_for_missing_exception_handler(CompiledMethod* frame runtime_frame = thread->last_frame(); frame caller_frame = runtime_frame.sender(®_map); assert(caller_frame.cb()->as_compiled_method_or_null() == cm, "expect top frame compiled method"); + vframe* vf = vframe::new_vframe(&caller_frame, ®_map, thread); + compiledVFrame* cvf = compiledVFrame::cast(vf); + ScopeDesc* imm_scope = cvf->scope(); + MethodData* imm_mdo = get_method_data(thread, methodHandle(thread, imm_scope->method()), true); + if (imm_mdo != NULL) { + ProfileData* pdata = imm_mdo->allocate_bci_to_data(imm_scope->bci(), NULL); + if (pdata != NULL && pdata->is_BitData()) { + BitData* bit_data = (BitData*) pdata; + bit_data->set_exception_seen(); + } + } + Deoptimization::deoptimize(thread, caller_frame, Deoptimization::Reason_not_compiled_exception_handler); MethodData* trap_mdo = get_method_data(thread, methodHandle(thread, cm->method()), true); diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index 80a84ccbf9aac..4cdf89bf1291b 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -599,6 +599,28 @@ void SharedRuntime::throw_and_post_jvmti_exception(JavaThread *thread, Handle h_ address bcp = method()->bcp_from(vfst.bci()); JvmtiExport::post_exception_throw(thread, method(), bcp, h_exception()); } + +#if INCLUDE_JVMCI + if (EnableJVMCI && UseJVMCICompiler) { + vframeStream vfst(thread, true); + methodHandle method = methodHandle(thread, vfst.method()); + int bci = vfst.bci(); + MethodData* trap_mdo = method->method_data(); + if (trap_mdo != NULL) { + // Set exception_seen if the exceptional bytecode is an invoke + Bytecode_invoke call = Bytecode_invoke_check(method, bci); + if (call.is_valid()) { + ResourceMark rm(thread); + ProfileData* pdata = trap_mdo->allocate_bci_to_data(bci, NULL); + if (pdata != NULL && pdata->is_BitData()) { + BitData* bit_data = (BitData*) pdata; + bit_data->set_exception_seen(); + } + } + } + } +#endif + Exceptions::_throw(thread, __FILE__, __LINE__, h_exception); } From d4282b0cfc3b35bc305d4efc0b394eb35f8b96dc Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 10 Dec 2020 23:57:35 +0000 Subject: [PATCH 201/504] 8257731: Remove excessive include of stubRoutines.hpp Reviewed-by: coleenp, kvn --- .../cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 1 + src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp | 1 + .../cpu/aarch64/c2_MacroAssembler_aarch64.cpp | 1 + .../gc/shared/barrierSetAssembler_aarch64.cpp | 1 + src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 1 + .../cpu/aarch64/macroAssembler_aarch64_trig.cpp | 3 +-- src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp | 1 + src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp | 1 + src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp | 1 + src/hotspot/cpu/arm/jniFastGetField_arm.cpp | 1 + src/hotspot/cpu/arm/methodHandles_arm.cpp | 1 + src/hotspot/cpu/arm/sharedRuntime_arm.cpp | 1 + src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp | 1 + src/hotspot/cpu/ppc/methodHandles_ppc.cpp | 1 + src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp | 1 + src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp | 1 + src/hotspot/cpu/s390/c1_Runtime1_s390.cpp | 3 ++- src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp | 1 + src/hotspot/cpu/s390/methodHandles_s390.cpp | 1 + src/hotspot/cpu/s390/sharedRuntime_s390.cpp | 1 + src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp | 1 + src/hotspot/cpu/x86/c1_Runtime1_x86.cpp | 3 ++- .../cpu/x86/gc/shared/barrierSetAssembler_x86.cpp | 3 ++- src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp | 1 + src/hotspot/cpu/x86/methodHandles_x86.cpp | 1 + src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp | 1 + src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp | 1 + .../x86/templateInterpreterGenerator_x86_32.cpp | 3 ++- .../x86/templateInterpreterGenerator_x86_64.cpp | 3 ++- .../cpu/x86/universalUpcallHandler_x86_64.cpp | 1 + src/hotspot/cpu/x86/vm_version_ext_x86.cpp | 3 ++- src/hotspot/cpu/x86/vm_version_x86.cpp | 1 + src/hotspot/cpu/zero/interpreterRT_zero.cpp | 14 +++++++++++++- src/hotspot/cpu/zero/interpreterRT_zero.hpp | 14 +++----------- src/hotspot/os/posix/vmError_posix.cpp | 1 + src/hotspot/share/aot/aotCodeHeap.cpp | 1 + src/hotspot/share/c1/c1_Runtime1.cpp | 1 + src/hotspot/share/code/codeBlob.cpp | 2 ++ src/hotspot/share/gc/parallel/mutableNUMASpace.hpp | 2 ++ .../share/interpreter/interpreterRuntime.hpp | 2 ++ src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp | 1 + src/hotspot/share/jvmci/vmStructs_jvmci.cpp | 1 + src/hotspot/share/opto/c2compiler.cpp | 1 + src/hotspot/share/opto/generateOptoStub.cpp | 1 + src/hotspot/share/opto/library_call.cpp | 1 + src/hotspot/share/opto/loopTransform.cpp | 1 + src/hotspot/share/opto/macroArrayCopy.cpp | 3 ++- src/hotspot/share/opto/stringopts.cpp | 1 + src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp | 1 + src/hotspot/share/prims/methodHandles.hpp | 2 ++ src/hotspot/share/prims/unsafe.cpp | 1 + src/hotspot/share/runtime/frame.inline.hpp | 1 + src/hotspot/share/runtime/icache.cpp | 3 ++- src/hotspot/share/runtime/java.cpp | 1 + src/hotspot/share/runtime/sharedRuntime.hpp | 1 + src/hotspot/share/runtime/thread.cpp | 1 + src/hotspot/share/runtime/thread.hpp | 2 +- src/hotspot/share/utilities/copy.cpp | 3 ++- src/hotspot/share/utilities/copy.hpp | 6 ++++-- 59 files changed, 89 insertions(+), 26 deletions(-) diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index b0804c48fba42..550f7f18a06f5 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -40,6 +40,7 @@ #include "oops/objArrayKlass.hpp" #include "runtime/frame.inline.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" #include "vmreg_aarch64.inline.hpp" diff --git a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp index 6d266aaac1f91..2126695d673b9 100644 --- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp @@ -41,6 +41,7 @@ #include "register_aarch64.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframe.hpp" #include "runtime/vframeArray.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp index 032e9e80756bb..fab8ff669b1b8 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp @@ -27,6 +27,7 @@ #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/intrinsicnode.hpp" +#include "runtime/stubRoutines.hpp" #ifdef PRODUCT #define BLOCK_COMMENT(str) /* nothing */ diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp index 440a894ed9d7b..2841e68cf5658 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp @@ -31,6 +31,7 @@ #include "memory/universe.hpp" #include "runtime/jniHandles.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 0e18c8cc382db..4263329ddfdf2 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -46,6 +46,7 @@ #include "runtime/interfaceSupport.inline.hpp" #include "runtime/jniHandles.inline.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" #include "utilities/powerOfTwo.hpp" #ifdef COMPILER1 diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp index 160be0d077d86..1136b30595c1f 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Cavium. All rights reserved. (By BELLSOFT) * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" -#include "runtime/stubRoutines.hpp" #include "macroAssembler_aarch64.hpp" // The following code is a optimized version of fdlibm sin/cos implementation diff --git a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp index e60fb5539e68c..9bff0f25f0a0c 100644 --- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp @@ -33,6 +33,7 @@ #include "prims/methodHandles.hpp" #include "runtime/flags/flagSetting.hpp" #include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" #define __ _masm-> diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index 5caca699ccd0d..ce0c617e325db 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -41,6 +41,7 @@ #include "prims/methodHandles.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/align.hpp" #include "vmreg_aarch64.inline.hpp" diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp index f9b5fc69a8977..f2b64263aa107 100644 --- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp @@ -37,6 +37,7 @@ #include "oops/objArrayKlass.hpp" #include "runtime/frame.inline.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" #include "vmreg_arm.inline.hpp" diff --git a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp index 277a73fff6ff9..85d27f61f2665 100644 --- a/src/hotspot/cpu/arm/jniFastGetField_arm.cpp +++ b/src/hotspot/cpu/arm/jniFastGetField_arm.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "assembler_arm.inline.hpp" +#include "code/codeBlob.hpp" #include "memory/resourceArea.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm_misc.hpp" diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp index 81ed67824d4e9..34415c70d034d 100644 --- a/src/hotspot/cpu/arm/methodHandles_arm.cpp +++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp @@ -38,6 +38,7 @@ #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" #include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/preserveException.hpp" #define __ _masm-> diff --git a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp index 341cf63c4c98e..6380fbccfc857 100644 --- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp +++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp @@ -36,6 +36,7 @@ #include "prims/methodHandles.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/safepointMechanism.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/align.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp index fcac32f22081e..6b28ba99d65f1 100644 --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -40,6 +40,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" #define __ _masm-> diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp index f6a49f8a34b07..b204a4ad72180 100644 --- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp +++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp @@ -35,6 +35,7 @@ #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" #include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/preserveException.hpp" #define __ _masm-> diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index 038753e07eb0e..f9b95f00c42d5 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -38,6 +38,7 @@ #include "prims/methodHandles.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/align.hpp" #include "vmreg_ppc.inline.hpp" diff --git a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp index 4c7dc79e5e798..fb99fca8cf267 100644 --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp @@ -39,6 +39,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" #include "vmreg_s390.inline.hpp" diff --git a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp index 42914737e29ab..e89333198d506 100644 --- a/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp +++ b/src/hotspot/cpu/s390/c1_Runtime1_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -41,6 +41,7 @@ #include "registerSaver_s390.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp index 72c27a37e606a..83040fb6b7f41 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp @@ -27,6 +27,7 @@ #include "asm/assembler.inline.hpp" #include "opto/c2_MacroAssembler.hpp" #include "opto/intrinsicnode.hpp" +#include "runtime/stubRoutines.hpp" #define BLOCK_COMMENT(str) block_comment(str) #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") diff --git a/src/hotspot/cpu/s390/methodHandles_s390.cpp b/src/hotspot/cpu/s390/methodHandles_s390.cpp index 301b9f6e144d0..f75cfe8e487bd 100644 --- a/src/hotspot/cpu/s390/methodHandles_s390.cpp +++ b/src/hotspot/cpu/s390/methodHandles_s390.cpp @@ -35,6 +35,7 @@ #include "prims/jvmtiExport.hpp" #include "prims/methodHandles.hpp" #include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/preserveException.hpp" #ifdef PRODUCT diff --git a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp index 50ae89c4ac05e..f5d5a6d84015c 100644 --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp @@ -39,6 +39,7 @@ #include "registerSaver_s390.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/align.hpp" #include "vmreg_s390.inline.hpp" diff --git a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp index bba946ec4addf..f7a0ffce1e99a 100644 --- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp @@ -39,6 +39,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/powerOfTwo.hpp" #include "vmreg_x86.inline.hpp" diff --git a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp index 60347c41163ae..90b5b0ff913e6 100644 --- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp +++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2020, 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 @@ -39,6 +39,7 @@ #include "register_x86.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "utilities/macros.hpp" #include "vmreg_x86.inline.hpp" diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp index af4ed123e6a03..274cc1a8702ba 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -31,6 +31,7 @@ #include "memory/universe.hpp" #include "runtime/jniHandles.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" #define __ masm-> diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp index af94814fbe31d..d45860c7c46aa 100644 --- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp +++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" +#include "code/codeBlob.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp index 1cdd27e1cd96a..23f23d3c68dda 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.cpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp @@ -37,6 +37,7 @@ #include "prims/methodHandles.hpp" #include "runtime/flags/flagSetting.hpp" #include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/preserveException.hpp" #define __ Disassembler::hook(__FILE__, __LINE__, _masm)-> diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp index 812b56f6b5166..aa3b3c7307987 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp @@ -40,6 +40,7 @@ #include "prims/methodHandles.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "runtime/vm_version.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 6b07414efd1db..2c8d8ac15ebe1 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -45,6 +45,7 @@ #include "prims/methodHandles.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "runtime/vm_version.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp index ad76dd4f8b6e9..b8b4efda76822 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ -31,6 +31,7 @@ #include "interpreter/templateInterpreterGenerator.hpp" #include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #define __ Disassembler::hook(__FILE__, __LINE__, _masm)-> diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp index 664bf7bfa1cbe..b5661f9d8f50d 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -31,6 +31,7 @@ #include "interpreter/templateInterpreterGenerator.hpp" #include "runtime/arguments.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #define __ Disassembler::hook(__FILE__, __LINE__, _masm)-> diff --git a/src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp b/src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp index 0cbf716d32785..0b71f79a17a59 100644 --- a/src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp +++ b/src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp @@ -23,6 +23,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" +#include "code/codeBlob.hpp" #include "memory/resourceArea.hpp" #include "prims/universalUpcallHandler.hpp" diff --git a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp index 35d07d71e46c6..30d9494c654cd 100644 --- a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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 @@ -27,6 +27,7 @@ #include "utilities/macros.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "code/codeBlob.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "runtime/java.hpp" diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index a46845d81f553..0069a0c500cd9 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -26,6 +26,7 @@ #include "jvm.h" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "code/codeBlob.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/cpu/zero/interpreterRT_zero.cpp b/src/hotspot/cpu/zero/interpreterRT_zero.cpp index bbc22ad3a9421..816208dd71f34 100644 --- a/src/hotspot/cpu/zero/interpreterRT_zero.cpp +++ b/src/hotspot/cpu/zero/interpreterRT_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -129,6 +129,18 @@ void InterpreterRuntime::SignatureHandlerGeneratorBase::generate( push(method()->result_type()); } +InterpreterRuntime::SignatureHandlerGenerator::SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer) + : SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->insts_end()), + _cb(buffer) { + _cb->set_insts_end((address) (cif() + 1)); +} + +void InterpreterRuntime::SignatureHandlerGenerator::push(intptr_t value) { + intptr_t *dst = (intptr_t *) _cb->insts_end(); + _cb->set_insts_end((address) (dst + 1)); + *dst = value; +} + void InterpreterRuntime::SignatureHandler::finalize() { ffi_status status = ffi_prep_cif(cif(), diff --git a/src/hotspot/cpu/zero/interpreterRT_zero.hpp b/src/hotspot/cpu/zero/interpreterRT_zero.hpp index b9bf4e4ffcde0..49dea1f30b77d 100644 --- a/src/hotspot/cpu/zero/interpreterRT_zero.hpp +++ b/src/hotspot/cpu/zero/interpreterRT_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -98,18 +98,10 @@ class SignatureHandlerGenerator : public SignatureHandlerGeneratorBase { CodeBuffer* _cb; public: - SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer) - : SignatureHandlerGeneratorBase(method, (ffi_cif *) buffer->insts_end()), - _cb(buffer) { - _cb->set_insts_end((address) (cif() + 1)); - } + SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer); private: - void push(intptr_t value) { - intptr_t *dst = (intptr_t *) _cb->insts_end(); - _cb->set_insts_end((address) (dst + 1)); - *dst = value; - } + void push(intptr_t value); }; class SlowSignatureHandlerGenerator : public SignatureHandlerGeneratorBase { diff --git a/src/hotspot/os/posix/vmError_posix.cpp b/src/hotspot/os/posix/vmError_posix.cpp index 9b2e89c1e5e1d..80022dbbda395 100644 --- a/src/hotspot/os/posix/vmError_posix.cpp +++ b/src/hotspot/os/posix/vmError_posix.cpp @@ -26,6 +26,7 @@ #include "memory/metaspaceShared.hpp" #include "runtime/arguments.hpp" #include "runtime/os.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" #include "signals_posix.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/aot/aotCodeHeap.cpp b/src/hotspot/share/aot/aotCodeHeap.cpp index 4f46c856ff6fb..fb60aa73e27e9 100644 --- a/src/hotspot/share/aot/aotCodeHeap.cpp +++ b/src/hotspot/share/aot/aotCodeHeap.cpp @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "runtime/stubRoutines.hpp" #include "aot/aotCodeHeap.hpp" #include "aot/aotLoader.hpp" diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index 8045fbfaa59e6..32080865699e2 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -66,6 +66,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stackWatermarkSet.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/threadCritical.hpp" #include "runtime/vframe.inline.hpp" #include "runtime/vframeArray.hpp" diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index b4f95bf96da06..f0c10161d89e8 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -43,6 +43,8 @@ #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubCodeGenerator.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/vframe.hpp" #include "services/memoryService.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/gc/parallel/mutableNUMASpace.hpp b/src/hotspot/share/gc/parallel/mutableNUMASpace.hpp index d9c6afe0cc5e5..53eb4a9d89d72 100644 --- a/src/hotspot/share/gc/parallel/mutableNUMASpace.hpp +++ b/src/hotspot/share/gc/parallel/mutableNUMASpace.hpp @@ -27,6 +27,8 @@ #include "gc/parallel/mutableSpace.hpp" #include "gc/shared/gcUtil.hpp" +#include "runtime/globals.hpp" +#include "utilities/growableArray.hpp" #include "utilities/macros.hpp" /* diff --git a/src/hotspot/share/interpreter/interpreterRuntime.hpp b/src/hotspot/share/interpreter/interpreterRuntime.hpp index 1456390627139..1ca601530f80c 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.hpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.hpp @@ -33,6 +33,8 @@ #include "runtime/thread.hpp" #include "utilities/macros.hpp" +class CodeBuffer; + // The InterpreterRuntime is called by the interpreter for everything // that cannot/should not be dealt with in assembly and needs C support. diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp index 9fc9217c4416a..964aee225e1ae 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp @@ -34,6 +34,7 @@ #include "oops/klass.inline.hpp" #include "runtime/flags/jvmFlag.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/resourceHash.hpp" diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index 9237b235543d6..db34b63c9d9d8 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -35,6 +35,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/flags/jvmFlag.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #if INCLUDE_G1GC #include "gc/g1/g1CardTable.hpp" #include "gc/g1/heapRegion.hpp" diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index 4becb5bedc169..82de162584a2f 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -30,6 +30,7 @@ #include "opto/optoreg.hpp" #include "opto/output.hpp" #include "opto/runtime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/opto/generateOptoStub.cpp b/src/hotspot/share/opto/generateOptoStub.cpp index 7dc8431e97791..1fa893a75529b 100644 --- a/src/hotspot/share/opto/generateOptoStub.cpp +++ b/src/hotspot/share/opto/generateOptoStub.cpp @@ -38,6 +38,7 @@ #include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "opto/type.hpp" +#include "runtime/stubRoutines.hpp" //--------------------gen_stub------------------------------- void GraphKit::gen_stub(address C_function, diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 3caa66df348b1..8956efa7dadc0 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -55,6 +55,7 @@ #include "prims/unsafe.hpp" #include "runtime/objectMonitor.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index 2c23c26b4e980..e43b1a10defe1 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -41,6 +41,7 @@ #include "opto/superword.hpp" #include "opto/vectornode.hpp" #include "runtime/globals_extension.hpp" +#include "runtime/stubRoutines.hpp" //------------------------------is_loop_exit----------------------------------- // Given an IfNode, return the loop-exiting projection or NULL if both diff --git a/src/hotspot/share/opto/macroArrayCopy.cpp b/src/hotspot/share/opto/macroArrayCopy.cpp index 9f8f4c146d5a0..2bef24a9c6eff 100644 --- a/src/hotspot/share/opto/macroArrayCopy.cpp +++ b/src/hotspot/share/opto/macroArrayCopy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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 @@ -31,6 +31,7 @@ #include "opto/graphKit.hpp" #include "opto/macro.hpp" #include "opto/runtime.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/align.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/opto/stringopts.cpp b/src/hotspot/share/opto/stringopts.cpp index 68257eaab509f..27de56c9be6ec 100644 --- a/src/hotspot/share/opto/stringopts.cpp +++ b/src/hotspot/share/opto/stringopts.cpp @@ -37,6 +37,7 @@ #include "opto/stringopts.hpp" #include "opto/subnode.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #define __ kit. diff --git a/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp b/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp index 3b290cb0ae231..7c5138fedbd31 100644 --- a/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp +++ b/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp @@ -35,6 +35,7 @@ #include "prims/jvmtiThreadState.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/safepointVerifiers.hpp" +#include "runtime/stubCodeGenerator.hpp" #include "runtime/vmThread.hpp" // Support class to collect a list of the non-nmethod CodeBlobs in diff --git a/src/hotspot/share/prims/methodHandles.hpp b/src/hotspot/share/prims/methodHandles.hpp index eb75324395014..e0bcb56e1a6f0 100644 --- a/src/hotspot/share/prims/methodHandles.hpp +++ b/src/hotspot/share/prims/methodHandles.hpp @@ -29,6 +29,7 @@ #include "classfile/vmSymbols.hpp" #include "runtime/frame.hpp" #include "runtime/globals.hpp" +#include "runtime/stubCodeGenerator.hpp" #include "utilities/macros.hpp" #ifdef ZERO @@ -37,6 +38,7 @@ #endif class MacroAssembler; +class MethodHandlesAdapterBlob; class Label; class MethodHandles: AllStatic { diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp index 0df435b0fd651..457e00ed6590d 100644 --- a/src/hotspot/share/prims/unsafe.cpp +++ b/src/hotspot/share/prims/unsafe.cpp @@ -48,6 +48,7 @@ #include "runtime/orderAccess.hpp" #include "runtime/reflection.hpp" #include "runtime/sharedRuntime.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" #include "runtime/threadSMR.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/share/runtime/frame.inline.hpp b/src/hotspot/share/runtime/frame.inline.hpp index 34e556199b48d..d207d33a74299 100644 --- a/src/hotspot/share/runtime/frame.inline.hpp +++ b/src/hotspot/share/runtime/frame.inline.hpp @@ -30,6 +30,7 @@ #include "oops/method.hpp" #include "runtime/frame.hpp" #include "runtime/signature.hpp" +#include "runtime/stubRoutines.hpp" #include "utilities/macros.hpp" #ifdef ZERO # include "entryFrame_zero.hpp" diff --git a/src/hotspot/share/runtime/icache.cpp b/src/hotspot/share/runtime/icache.cpp index 597be5420e331..999c03f6fa999 100644 --- a/src/hotspot/share/runtime/icache.cpp +++ b/src/hotspot/share/runtime/icache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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,6 +23,7 @@ */ #include "precompiled.hpp" +#include "code/codeBlob.hpp" #include "memory/resourceArea.hpp" #include "runtime/icache.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index d82cfe59c99d3..5c942259c465f 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -66,6 +66,7 @@ #include "runtime/memprofiler.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/statSampler.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/sweeper.hpp" #include "runtime/task.hpp" #include "runtime/thread.inline.hpp" diff --git a/src/hotspot/share/runtime/sharedRuntime.hpp b/src/hotspot/share/runtime/sharedRuntime.hpp index 6dd56835ed7ab..6c1eb315615d6 100644 --- a/src/hotspot/share/runtime/sharedRuntime.hpp +++ b/src/hotspot/share/runtime/sharedRuntime.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_RUNTIME_SHAREDRUNTIME_HPP #define SHARE_RUNTIME_SHAREDRUNTIME_HPP +#include "code/codeBlob.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/bytecodeTracer.hpp" #include "interpreter/linkResolver.hpp" diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index fa0f0841a9eae..ff73548ed90c7 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "jvm.h" #include "aot/aotLoader.hpp" #include "classfile/classLoader.hpp" diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 6f1f6f8b0a28d..feb4df1070e5a 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -41,7 +41,6 @@ #include "runtime/park.hpp" #include "runtime/safepointMechanism.hpp" #include "runtime/stackWatermarkSet.hpp" -#include "runtime/stubRoutines.hpp" #include "runtime/stackOverflow.hpp" #include "runtime/threadHeapSampler.hpp" #include "runtime/threadLocalStorage.hpp" @@ -71,6 +70,7 @@ class ParkEvent; class Parker; class MonitorInfo; +class BufferBlob; class AbstractCompiler; class ciEnv; class CompileThread; diff --git a/src/hotspot/share/utilities/copy.cpp b/src/hotspot/share/utilities/copy.cpp index 798b2ad9f4c67..db513438749be 100644 --- a/src/hotspot/share/utilities/copy.cpp +++ b/src/hotspot/share/utilities/copy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020, 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,6 +23,7 @@ */ #include "precompiled.hpp" +#include "utilities/copy.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" diff --git a/src/hotspot/share/utilities/copy.hpp b/src/hotspot/share/utilities/copy.hpp index 6f317a54ebc8d..bd502d5313d27 100644 --- a/src/hotspot/share/utilities/copy.hpp +++ b/src/hotspot/share/utilities/copy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,8 +25,10 @@ #ifndef SHARE_UTILITIES_COPY_HPP #define SHARE_UTILITIES_COPY_HPP -#include "runtime/stubRoutines.hpp" +#include "oops/oopsHierarchy.hpp" +#include "runtime/globals.hpp" #include "utilities/align.hpp" +#include "utilities/bytes.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" From 37dc675cd0113c60bd12fc3b89f51ff1d9ce2a0c Mon Sep 17 00:00:00 2001 From: John Lin Date: Fri, 11 Dec 2020 00:26:10 +0000 Subject: [PATCH 202/504] 8247402: Documentation for Map::compute contains confusing implementation requirements Reviewed-by: prappo, martin --- src/java.base/share/classes/java/util/Map.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/java.base/share/classes/java/util/Map.java b/src/java.base/share/classes/java/util/Map.java index e1ec0e4282f80..496bf58dd36b8 100644 --- a/src/java.base/share/classes/java/util/Map.java +++ b/src/java.base/share/classes/java/util/Map.java @@ -1109,23 +1109,17 @@ default V computeIfPresent(K key, * * @implSpec * The default implementation is equivalent to performing the following - * steps for this {@code map}, then returning the current value or - * {@code null} if absent: + * steps for this {@code map}: * *
         {@code
              * V oldValue = map.get(key);
              * V newValue = remappingFunction.apply(key, oldValue);
        -     * if (oldValue != null) {
        -     *    if (newValue != null)
        -     *       map.put(key, newValue);
        -     *    else
        -     *       map.remove(key);
        -     * } else {
        -     *    if (newValue != null)
        -     *       map.put(key, newValue);
        -     *    else
        -     *       return null;
        +     * if (newValue != null) {
        +     *     map.put(key, newValue);
        +     * } else if (oldValue != null || map.containsKey(key)) {
        +     *     map.remove(key);
              * }
        +     * return newValue;
              * }
        * *

        The default implementation makes no guarantees about detecting if the From 8befc3210d607fa79d2c4d9286462c0c457033b2 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Fri, 11 Dec 2020 03:36:17 +0000 Subject: [PATCH 203/504] 8258073: x86_32 build broken after JDK-8257731 Reviewed-by: iklam --- src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp index 09bccd13b7659..1eb740f38772c 100644 --- a/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp +++ b/src/hotspot/cpu/x86/jniFastGetField_x86_32.cpp @@ -29,6 +29,7 @@ #include "prims/jvm_misc.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/safepoint.hpp" +#include "runtime/stubRoutines.hpp" #define __ masm-> From 1d15ebe19e310c5a19c78a0364c048fc70ca5353 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Fri, 11 Dec 2020 04:18:54 +0000 Subject: [PATCH 204/504] 8243205: Modularize JVM flags declaration Reviewed-by: kvn, coleenp, stefank --- .../cpu/aarch64/interp_masm_aarch64.cpp | 1 + .../templateInterpreterGenerator_aarch64.cpp | 1 + src/hotspot/cpu/x86/interp_masm_x86.cpp | 1 + src/hotspot/cpu/x86/macroAssembler_x86.cpp | 1 + .../x86/macroAssembler_x86_arrayCopy_avx3.cpp | 1 + .../x86/templateInterpreterGenerator_x86.cpp | 1 + src/hotspot/share/c1/c1_Compilation.hpp | 3 +- src/hotspot/share/c1/c1_globals.hpp | 7 +- src/hotspot/share/c1/c1_globals_pd.hpp | 34 +++++ src/hotspot/share/code/scopeDesc.cpp | 1 + .../share/compiler/compilerDirectives.hpp | 1 + .../share/compiler/compiler_globals.hpp | 42 +----- .../share/compiler/compiler_globals_pd.hpp | 87 ++++++++++++ src/hotspot/share/gc/shared/gc_globals.hpp | 2 + src/hotspot/share/jvmci/jvmci.hpp | 3 +- src/hotspot/share/jvmci/jvmciCompiler.hpp | 3 +- src/hotspot/share/jvmci/jvmci_globals.hpp | 3 + src/hotspot/share/opto/c2_globals.hpp | 6 +- src/hotspot/share/opto/c2_globals_pd.hpp | 34 +++++ src/hotspot/share/opto/compile.hpp | 1 + src/hotspot/share/runtime/escapeBarrier.hpp | 2 +- src/hotspot/share/runtime/flags/allFlags.hpp | 120 ++++++++++++++++ src/hotspot/share/runtime/globals.cpp | 15 +- src/hotspot/share/runtime/globals.hpp | 26 +--- .../share/runtime/globals_extension.hpp | 2 +- src/hotspot/share/runtime/globals_shared.hpp | 128 ++++-------------- src/hotspot/share/runtime/init.cpp | 1 + 27 files changed, 336 insertions(+), 191 deletions(-) create mode 100644 src/hotspot/share/c1/c1_globals_pd.hpp create mode 100644 src/hotspot/share/compiler/compiler_globals_pd.hpp create mode 100644 src/hotspot/share/opto/c2_globals_pd.hpp create mode 100644 src/hotspot/share/runtime/flags/allFlags.hpp diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 94c379a89e821..e5904dc95c143 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" +#include "compiler/compiler_globals.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interp_masm_aarch64.hpp" diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index 2ab37dc37ef99..2f5701e161125 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.inline.hpp" #include "classfile/javaClasses.hpp" +#include "compiler/compiler_globals.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/bytecodeHistogram.hpp" #include "interpreter/interpreter.hpp" diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 19c7f49b7881c..e7b0df3d675ba 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "compiler/compiler_globals.hpp" #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index e26d9cd50f6a8..216add0e598d6 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -26,6 +26,7 @@ #include "jvm.h" #include "asm/assembler.hpp" #include "asm/assembler.inline.hpp" +#include "compiler/compiler_globals.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_arrayCopy_avx3.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_arrayCopy_avx3.cpp index a922c86247f40..b03338a82089d 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_arrayCopy_avx3.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_arrayCopy_avx3.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "compiler/compiler_globals.hpp" #ifdef PRODUCT #define BLOCK_COMMENT(str) /* nothing */ diff --git a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp index 2025f41ffb608..5e1da51550843 100644 --- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "classfile/javaClasses.hpp" +#include "compiler/compiler_globals.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/bytecodeHistogram.hpp" diff --git a/src/hotspot/share/c1/c1_Compilation.hpp b/src/hotspot/share/c1/c1_Compilation.hpp index ea5e36f151bc3..13e0b0e2b4dc7 100644 --- a/src/hotspot/share/c1/c1_Compilation.hpp +++ b/src/hotspot/share/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2020, 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 @@ #include "ci/ciEnv.hpp" #include "ci/ciMethodData.hpp" #include "code/exceptionHandlerTable.hpp" +#include "compiler/compiler_globals.hpp" #include "compiler/compilerDirectives.hpp" #include "memory/resourceArea.hpp" #include "runtime/deoptimization.hpp" diff --git a/src/hotspot/share/c1/c1_globals.hpp b/src/hotspot/share/c1/c1_globals.hpp index 4c32940bc3e94..8a95a5b1fbafc 100644 --- a/src/hotspot/share/c1/c1_globals.hpp +++ b/src/hotspot/share/c1/c1_globals.hpp @@ -25,12 +25,9 @@ #ifndef SHARE_C1_C1_GLOBALS_HPP #define SHARE_C1_C1_GLOBALS_HPP +#include "c1/c1_globals_pd.hpp" #include "runtime/globals_shared.hpp" #include "utilities/macros.hpp" - -#include CPU_HEADER(c1_globals) -#include OS_HEADER(c1_globals) - // // Declare all global flags used by the client compiler. // @@ -339,4 +336,6 @@ // end of C1_FLAGS +DECLARE_FLAGS(C1_FLAGS) + #endif // SHARE_C1_C1_GLOBALS_HPP diff --git a/src/hotspot/share/c1/c1_globals_pd.hpp b/src/hotspot/share/c1/c1_globals_pd.hpp new file mode 100644 index 0000000000000..fcf78b9527226 --- /dev/null +++ b/src/hotspot/share/c1/c1_globals_pd.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +#ifndef SHARE_C1_C1_GLOBALS_PD_HPP +#define SHARE_C1_C1_GLOBALS_PD_HPP + +#include "runtime/globals_shared.hpp" +#include "utilities/macros.hpp" + +#include CPU_HEADER(c1_globals) +#include OS_HEADER(c1_globals) + +#endif // SHARE_C1_C1_GLOBALS_PD_HPP diff --git a/src/hotspot/share/code/scopeDesc.cpp b/src/hotspot/share/code/scopeDesc.cpp index 799d11a2f9168..c7daa6d8626b3 100644 --- a/src/hotspot/share/code/scopeDesc.cpp +++ b/src/hotspot/share/code/scopeDesc.cpp @@ -27,6 +27,7 @@ #include "code/debugInfoRec.hpp" #include "code/pcDesc.hpp" #include "code/scopeDesc.hpp" +#include "compiler/compiler_globals.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 478172dc0773b..2f97755645ca1 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -28,6 +28,7 @@ #include "classfile/vmIntrinsics.hpp" #include "ci/ciMetadata.hpp" #include "ci/ciMethod.hpp" +#include "compiler/compiler_globals.hpp" #include "compiler/methodMatcher.hpp" #include "compiler/compilerOracle.hpp" #include "utilities/exceptions.hpp" diff --git a/src/hotspot/share/compiler/compiler_globals.hpp b/src/hotspot/share/compiler/compiler_globals.hpp index c28c0e86eb57c..8867a328ce115 100644 --- a/src/hotspot/share/compiler/compiler_globals.hpp +++ b/src/hotspot/share/compiler/compiler_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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,44 +36,4 @@ #include "jvmci/jvmci_globals.hpp" #endif -#if !defined(COMPILER1) && !defined(COMPILER2) && !INCLUDE_JVMCI -define_pd_global(bool, BackgroundCompilation, false); -define_pd_global(bool, CICompileOSR, false); -define_pd_global(bool, UseTypeProfile, false); -define_pd_global(bool, UseOnStackReplacement, false); -define_pd_global(bool, InlineIntrinsics, false); -define_pd_global(bool, PreferInterpreterNativeStubs, true); -define_pd_global(bool, ProfileInterpreter, false); -define_pd_global(bool, ProfileTraps, false); -define_pd_global(bool, TieredCompilation, false); - -define_pd_global(intx, CompileThreshold, 0); - -define_pd_global(intx, OnStackReplacePercentage, 0); -define_pd_global(size_t, NewSizeThreadIncrease, 4*K); -define_pd_global(bool, InlineClassNatives, true); -define_pd_global(bool, InlineUnsafeOps, true); -define_pd_global(uintx, InitialCodeCacheSize, 160*K); -define_pd_global(uintx, ReservedCodeCacheSize, 32*M); -define_pd_global(uintx, NonProfiledCodeHeapSize, 0); -define_pd_global(uintx, ProfiledCodeHeapSize, 0); -define_pd_global(uintx, NonNMethodCodeHeapSize, 32*M); - -define_pd_global(uintx, CodeCacheExpansionSize, 32*K); -define_pd_global(uintx, CodeCacheMinBlockLength, 1); -define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K); -define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(4*M)); -define_pd_global(bool, NeverActAsServerClassMachine, true); -define_pd_global(uint64_t,MaxRAM, 1ULL*G); -#define CI_COMPILER_COUNT 0 -#else - -#if COMPILER2_OR_JVMCI -#define CI_COMPILER_COUNT 2 -#else -#define CI_COMPILER_COUNT 1 -#endif // COMPILER2_OR_JVMCI - -#endif // no compilers - #endif // SHARE_COMPILER_COMPILER_GLOBALS_HPP diff --git a/src/hotspot/share/compiler/compiler_globals_pd.hpp b/src/hotspot/share/compiler/compiler_globals_pd.hpp new file mode 100644 index 0000000000000..faa1c11fe1303 --- /dev/null +++ b/src/hotspot/share/compiler/compiler_globals_pd.hpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +#ifndef SHARE_COMPILER_COMPILER_GLOBALS_PD_HPP +#define SHARE_COMPILER_COMPILER_GLOBALS_PD_HPP + +// Platform-specific Default values for VM flags used by the compiler. +// +// Note: for historical reasons, some of these flags are declared in globals.hpp. +// E.g., BackgroundCompilation. Such declarations should be moved to this +// file instead. + +#include "runtime/globals_shared.hpp" +#ifdef COMPILER1 +#include "c1/c1_globals_pd.hpp" +#endif // COMPILER1 +#ifdef COMPILER2 +#include "opto/c2_globals_pd.hpp" +#endif // COMPILER2 + +// JVMCI has no platform-specific global definitions +//#if INCLUDE_JVMCI +//#include "jvmci/jvmci_globals_pd.hpp" +//#endif + +#if !defined(COMPILER1) && !defined(COMPILER2) && !INCLUDE_JVMCI +define_pd_global(bool, BackgroundCompilation, false); +define_pd_global(bool, CICompileOSR, false); +define_pd_global(bool, UseTypeProfile, false); +define_pd_global(bool, UseOnStackReplacement, false); +define_pd_global(bool, InlineIntrinsics, false); +define_pd_global(bool, PreferInterpreterNativeStubs, true); +define_pd_global(bool, ProfileInterpreter, false); +define_pd_global(bool, ProfileTraps, false); +define_pd_global(bool, TieredCompilation, false); + +define_pd_global(intx, CompileThreshold, 0); + +define_pd_global(intx, OnStackReplacePercentage, 0); +define_pd_global(size_t, NewSizeThreadIncrease, 4*K); +define_pd_global(bool, InlineClassNatives, true); +define_pd_global(bool, InlineUnsafeOps, true); +define_pd_global(uintx, InitialCodeCacheSize, 160*K); +define_pd_global(uintx, ReservedCodeCacheSize, 32*M); +define_pd_global(uintx, NonProfiledCodeHeapSize, 0); +define_pd_global(uintx, ProfiledCodeHeapSize, 0); +define_pd_global(uintx, NonNMethodCodeHeapSize, 32*M); + +define_pd_global(uintx, CodeCacheExpansionSize, 32*K); +define_pd_global(uintx, CodeCacheMinBlockLength, 1); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K); +define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(4*M)); +define_pd_global(bool, NeverActAsServerClassMachine, true); +define_pd_global(uint64_t,MaxRAM, 1ULL*G); +#define CI_COMPILER_COUNT 0 +#else + +#if COMPILER2_OR_JVMCI +#define CI_COMPILER_COUNT 2 +#else +#define CI_COMPILER_COUNT 1 +#endif // COMPILER2_OR_JVMCI + +#endif // no compilers + +#endif // SHARE_COMPILER_COMPILER_GLOBALS_PD_HPP diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index aca8d6b6c349f..02b101114bbf2 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -739,4 +739,6 @@ // end of GC_FLAGS +DECLARE_FLAGS(GC_FLAGS) + #endif // SHARE_GC_SHARED_GC_GLOBALS_HPP diff --git a/src/hotspot/share/jvmci/jvmci.hpp b/src/hotspot/share/jvmci/jvmci.hpp index 9225dc6e02907..5d740c1dc3059 100644 --- a/src/hotspot/share/jvmci/jvmci.hpp +++ b/src/hotspot/share/jvmci/jvmci.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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 @@ #ifndef SHARE_JVMCI_JVMCI_HPP #define SHARE_JVMCI_JVMCI_HPP +#include "compiler/compiler_globals.hpp" #include "compiler/compilerDefinitions.hpp" #include "utilities/events.hpp" #include "utilities/exceptions.hpp" diff --git a/src/hotspot/share/jvmci/jvmciCompiler.hpp b/src/hotspot/share/jvmci/jvmciCompiler.hpp index c0536e91725f1..93b0fa0184b9d 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.hpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020, 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,6 +25,7 @@ #define SHARE_JVMCI_JVMCICOMPILER_HPP #include "compiler/abstractCompiler.hpp" +#include "compiler/compiler_globals.hpp" #include "runtime/atomic.hpp" class JVMCICompiler : public AbstractCompiler { diff --git a/src/hotspot/share/jvmci/jvmci_globals.hpp b/src/hotspot/share/jvmci/jvmci_globals.hpp index 57d40b5fabd09..a1db06f8352cf 100644 --- a/src/hotspot/share/jvmci/jvmci_globals.hpp +++ b/src/hotspot/share/jvmci/jvmci_globals.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_JVMCI_JVMCI_GLOBALS_HPP #define SHARE_JVMCI_JVMCI_GLOBALS_HPP +#include "runtime/globals_shared.hpp" #include "utilities/vmEnums.hpp" class fileStream; @@ -139,6 +140,8 @@ class fileStream; // end of JVMCI_FLAGS +DECLARE_FLAGS(JVMCI_FLAGS) + // The base name for the shared library containing the JVMCI based compiler #define JVMCI_SHARED_LIBRARY_NAME "jvmcicompiler" diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index acf1d14006c2d..9fc31077f337f 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -25,12 +25,10 @@ #ifndef SHARE_OPTO_C2_GLOBALS_HPP #define SHARE_OPTO_C2_GLOBALS_HPP +#include "opto/c2_globals_pd.hpp" #include "runtime/globals_shared.hpp" #include "utilities/macros.hpp" -#include CPU_HEADER(c2_globals) -#include OS_HEADER(c2_globals) - // // Defines all globals flags used by the server compiler. // @@ -807,4 +805,6 @@ // end of C2_FLAGS +DECLARE_FLAGS(C2_FLAGS) + #endif // SHARE_OPTO_C2_GLOBALS_HPP diff --git a/src/hotspot/share/opto/c2_globals_pd.hpp b/src/hotspot/share/opto/c2_globals_pd.hpp new file mode 100644 index 0000000000000..c2ab269cebf92 --- /dev/null +++ b/src/hotspot/share/opto/c2_globals_pd.hpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +#ifndef SHARE_OPTO_C2_GLOBALS_PD_HPP +#define SHARE_OPTO_C2_GLOBALS_PD_HPP + +#include "runtime/globals_shared.hpp" +#include "utilities/macros.hpp" + +#include CPU_HEADER(c2_globals) +#include OS_HEADER(c2_globals) + +#endif // SHARE_OPTO_C2_GLOBALS_PD_HPP diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index a2e20a431da81..d4588aee62b8d 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -28,6 +28,7 @@ #include "asm/codeBuffer.hpp" #include "ci/compilerInterface.hpp" #include "code/debugInfoRec.hpp" +#include "compiler/compiler_globals.hpp" #include "compiler/compilerOracle.hpp" #include "compiler/compileBroker.hpp" #include "compiler/compilerEvent.hpp" diff --git a/src/hotspot/share/runtime/escapeBarrier.hpp b/src/hotspot/share/runtime/escapeBarrier.hpp index 96df282778348..61a8162832142 100644 --- a/src/hotspot/share/runtime/escapeBarrier.hpp +++ b/src/hotspot/share/runtime/escapeBarrier.hpp @@ -26,8 +26,8 @@ #ifndef SHARE_RUNTIME_ESCAPEBARRIER_HPP #define SHARE_RUNTIME_ESCAPEBARRIER_HPP +#include "compiler/compiler_globals.hpp" #include "memory/allocation.hpp" -#include "runtime/globals.hpp" #include "utilities/macros.hpp" class JavaThread; diff --git a/src/hotspot/share/runtime/flags/allFlags.hpp b/src/hotspot/share/runtime/flags/allFlags.hpp new file mode 100644 index 0000000000000..68e529e139c7b --- /dev/null +++ b/src/hotspot/share/runtime/flags/allFlags.hpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +#ifndef SHARE_RUNTIME_FLAGS_ALLFLAGS_HPP +#define SHARE_RUNTIME_FLAGS_ALLFLAGS_HPP + +#include "compiler/compiler_globals.hpp" +#include "runtime/globals.hpp" + +// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at +// the top, as they are processed by jvmFlags.cpp in that +// order. + +#define ALL_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) \ + \ + LP64_RUNTIME_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) \ + \ + JVMCI_ONLY(JVMCI_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint)) \ + \ + COMPILER1_PRESENT(C1_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint)) \ + \ + COMPILER2_PRESENT(C2_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint)) \ + \ + ARCH_FLAGS( \ + develop, \ + product, \ + notproduct, \ + range, \ + constraint) \ + \ + RUNTIME_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) \ + \ + RUNTIME_OS_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) \ + \ + GC_FLAGS( \ + develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) + +#define ALL_CONSTRAINTS(f) \ + COMPILER_CONSTRAINTS(f) \ + RUNTIME_CONSTRAINTS(f) \ + GC_CONSTRAINTS(f) + + +#endif // SHARE_RUNTIME_FLAGS_ALLFLAGS_HPP diff --git a/src/hotspot/share/runtime/globals.cpp b/src/hotspot/share/runtime/globals.cpp index fa3aa5060507d..66d1e33570864 100644 --- a/src/hotspot/share/runtime/globals.cpp +++ b/src/hotspot/share/runtime/globals.cpp @@ -23,20 +23,7 @@ */ #include "precompiled.hpp" -#include "jfr/jfrEvents.hpp" -#include "jvm.h" -#include "memory/allocation.inline.hpp" -#include "oops/oop.inline.hpp" -#include "runtime/arguments.hpp" -#include "runtime/globals.hpp" -#include "runtime/globals_extension.hpp" -#include "runtime/globals_shared.hpp" -#include "runtime/os.hpp" -#include "runtime/sharedRuntime.hpp" -#include "utilities/defaultStream.hpp" -#include "utilities/macros.hpp" -#include "utilities/ostream.hpp" -#include "utilities/stringUtils.hpp" +#include "runtime/flags/allFlags.hpp" // Implementation macros #define MATERIALIZE_PRODUCT_FLAG(type, name, value, ...) type name = value; diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 7efabe34eeb76..b9e7434038ebf 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_RUNTIME_GLOBALS_HPP #define SHARE_RUNTIME_GLOBALS_HPP -#include "compiler/compiler_globals.hpp" +#include "compiler/compiler_globals_pd.hpp" #include "gc/shared/gc_globals.hpp" #include "runtime/globals_shared.hpp" #include "utilities/align.hpp" @@ -2496,25 +2496,9 @@ const intx ObjectAlignmentInBytes = 8; // end of RUNTIME_FLAGS -// Interface macros -#define DECLARE_PRODUCT_FLAG(type, name, value, ...) extern "C" type name; -#define DECLARE_PD_PRODUCT_FLAG(type, name, ...) extern "C" type name; -#ifdef PRODUCT -#define DECLARE_DEVELOPER_FLAG(type, name, value, ...) const type name = value; -#define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) const type name = pd_##name; -#define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) const type name = value; -#else -#define DECLARE_DEVELOPER_FLAG(type, name, value, ...) extern "C" type name; -#define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) extern "C" type name; -#define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) extern "C" type name; -#endif // PRODUCT - -ALL_FLAGS(DECLARE_DEVELOPER_FLAG, - DECLARE_PD_DEVELOPER_FLAG, - DECLARE_PRODUCT_FLAG, - DECLARE_PD_PRODUCT_FLAG, - DECLARE_NOTPRODUCT_FLAG, - IGNORE_RANGE, - IGNORE_CONSTRAINT) +DECLARE_FLAGS(LP64_RUNTIME_FLAGS) +DECLARE_ARCH_FLAGS(ARCH_FLAGS) +DECLARE_FLAGS(RUNTIME_FLAGS) +DECLARE_FLAGS(RUNTIME_OS_FLAGS) #endif // SHARE_RUNTIME_GLOBALS_HPP diff --git a/src/hotspot/share/runtime/globals_extension.hpp b/src/hotspot/share/runtime/globals_extension.hpp index ceb5413b212b5..fd7b83c22a3d4 100644 --- a/src/hotspot/share/runtime/globals_extension.hpp +++ b/src/hotspot/share/runtime/globals_extension.hpp @@ -25,9 +25,9 @@ #ifndef SHARE_RUNTIME_GLOBALS_EXTENSION_HPP #define SHARE_RUNTIME_GLOBALS_EXTENSION_HPP +#include "runtime/flags/allFlags.hpp" #include "runtime/flags/jvmFlag.hpp" #include "runtime/flags/jvmFlagAccess.hpp" -#include "runtime/globals.hpp" #include "utilities/macros.hpp" // Construct enum of Flag_ constants. diff --git a/src/hotspot/share/runtime/globals_shared.hpp b/src/hotspot/share/runtime/globals_shared.hpp index 36dc94097623c..813aad13b0b53 100644 --- a/src/hotspot/share/runtime/globals_shared.hpp +++ b/src/hotspot/share/runtime/globals_shared.hpp @@ -79,110 +79,32 @@ #define IGNORE_FLAG(...) -#define VM_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - \ - RUNTIME_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - \ - GC_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - -// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at -// the top, as they are processed by jvmFlags.cpp in that -// order. +#define DECLARE_PRODUCT_FLAG(type, name, value, ...) extern "C" type name; +#define DECLARE_PD_PRODUCT_FLAG(type, name, ...) extern "C" type name; +#ifdef PRODUCT +#define DECLARE_DEVELOPER_FLAG(type, name, value, ...) const type name = value; +#define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) const type name = pd_##name; +#define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) const type name = value; +#else +#define DECLARE_DEVELOPER_FLAG(type, name, value, ...) extern "C" type name; +#define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) extern "C" type name; +#define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) extern "C" type name; +#endif // PRODUCT -#define ALL_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - \ - LP64_RUNTIME_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - \ - JVMCI_ONLY(JVMCI_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint)) \ - \ - COMPILER1_PRESENT(C1_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint)) \ - \ - COMPILER2_PRESENT(C2_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint)) \ - \ - ARCH_FLAGS( \ - develop, \ - product, \ - notproduct, \ - range, \ - constraint) \ - \ - VM_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) \ - \ - RUNTIME_OS_FLAGS( \ - develop, \ - develop_pd, \ - product, \ - product_pd, \ - notproduct, \ - range, \ - constraint) +#define DECLARE_FLAGS(flag_group) \ + flag_group(DECLARE_DEVELOPER_FLAG, \ + DECLARE_PD_DEVELOPER_FLAG, \ + DECLARE_PRODUCT_FLAG, \ + DECLARE_PD_PRODUCT_FLAG, \ + DECLARE_NOTPRODUCT_FLAG, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT) -#define ALL_CONSTRAINTS(f) \ - COMPILER_CONSTRAINTS(f) \ - RUNTIME_CONSTRAINTS(f) \ - GC_CONSTRAINTS(f) +#define DECLARE_ARCH_FLAGS(flag_group) \ + flag_group(DECLARE_DEVELOPER_FLAG, \ + DECLARE_PRODUCT_FLAG, \ + DECLARE_NOTPRODUCT_FLAG, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT) #endif // SHARE_RUNTIME_GLOBALS_SHARED_HPP diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp index 01e73aa8e4d2e..949cdfede0ea4 100644 --- a/src/hotspot/share/runtime/init.cpp +++ b/src/hotspot/share/runtime/init.cpp @@ -26,6 +26,7 @@ #include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "code/icBuffer.hpp" +#include "compiler/compiler_globals.hpp" #include "gc/shared/collectedHeap.hpp" #if INCLUDE_JVMCI #include "jvmci/jvmci.hpp" From b90b7f50df7c6c25dcf2d1f408c2e68e61722b5c Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Fri, 11 Dec 2020 04:54:27 +0000 Subject: [PATCH 205/504] 8196090: javax/swing/JComboBox/6559152/bug6559152.java fails Reviewed-by: serb --- test/jdk/ProblemList.txt | 1 - .../swing/JComboBox/4199622/bug4199622.java | 3 +- .../JComboBox/4515752/DefaultButtonTest.java | 7 +- .../swing/JComboBox/4743225/bug4743225.java | 3 +- .../swing/JComboBox/6559152/bug6559152.java | 78 ++++++++++++------- 5 files changed, 57 insertions(+), 35 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 6f861554826b7..ed1f055eec9e1 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -738,7 +738,6 @@ javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all -javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all javax/swing/JComboBox/8032878/bug8032878.java 8196092,8196439 windows-all,macosx-all,linux-all javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all diff --git a/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java b/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java index b65e45dba5b4c..fc0e56ffd9512 100644 --- a/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java +++ b/test/jdk/javax/swing/JComboBox/4199622/bug4199622.java @@ -68,6 +68,7 @@ public class bug4199622 extends JFrame implements ActionListener { setSize(300, 300); pack(); + setLocationRelativeTo(null); } @Override @@ -83,7 +84,7 @@ static void doTest() { if (robot == null) { try { robot = new Robot(); - robot.setAutoDelay(20); + robot.setAutoDelay(100); } catch (AWTException e) { throw new RuntimeException("Can't create robot. Test failed", e); } diff --git a/test/jdk/javax/swing/JComboBox/4515752/DefaultButtonTest.java b/test/jdk/javax/swing/JComboBox/4515752/DefaultButtonTest.java index eeb87ce5d8c3b..a7ec44caee40d 100644 --- a/test/jdk/javax/swing/JComboBox/4515752/DefaultButtonTest.java +++ b/test/jdk/javax/swing/JComboBox/4515752/DefaultButtonTest.java @@ -59,6 +59,7 @@ public DefaultButtonTest() { getContentPane().add(new DefaultPanel(this)); pack(); setVisible(true); + setLocationRelativeTo(null); } public static void test() { @@ -108,16 +109,12 @@ public static void test() { // Change value, changing focus should fire an ActionEvent. robot.waitForIdle(); robot.keyPress(KeyEvent.VK_BACK_SPACE); - robot.waitForIdle(); robot.keyRelease(KeyEvent.VK_BACK_SPACE); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SHIFT); - robot.waitForIdle(); robot.keyPress(KeyEvent.VK_TAB); - robot.waitForIdle(); - robot.keyRelease(KeyEvent.VK_SHIFT); - robot.waitForIdle(); robot.keyRelease(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_SHIFT); robot.waitForIdle(); testEditChange(true); robot.waitForIdle(); diff --git a/test/jdk/javax/swing/JComboBox/4743225/bug4743225.java b/test/jdk/javax/swing/JComboBox/4743225/bug4743225.java index 76ace04857a49..e2fdb2f6b6191 100644 --- a/test/jdk/javax/swing/JComboBox/4743225/bug4743225.java +++ b/test/jdk/javax/swing/JComboBox/4743225/bug4743225.java @@ -63,6 +63,7 @@ public void popupMenuCanceled(PopupMenuEvent e) { }); add(cb); pack(); + setLocationRelativeTo(null); } public static BasicComboPopup getPopup() { @@ -78,7 +79,7 @@ public static BasicComboPopup getPopup() { public static void main(String... args) throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(20); + robot.setAutoDelay(100); SwingUtilities.invokeAndWait(new Runnable() { public void run() { diff --git a/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java b/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java index 1363da64670d3..d580a36ef6bf8 100644 --- a/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java +++ b/test/jdk/javax/swing/JComboBox/6559152/bug6559152.java @@ -27,39 +27,59 @@ * @bug 6559152 * @summary Checks that you can select an item in JComboBox with keyboard * when it is a JTable cell editor. - * @author Mikhail Lapshin - * @library /lib/client - * @build ExtendedRobot * @run main bug6559152 */ -import javax.swing.*; +import javax.swing.DefaultCellEditor; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JComboBox; +import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; -import java.awt.*; +import javax.swing.JTable; +import java.awt.Point; import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; +import java.awt.Robot; public class bug6559152 { - private JFrame frame; - private JComboBox cb; - private ExtendedRobot robot; + private static JFrame frame; + private static JComboBox cb; + private static Robot robot; + private static Point p = null; public static void main(String[] args) throws Exception { - final bug6559152 test = new bug6559152(); + robot = new Robot(); + robot.setAutoDelay(100); try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - test.setupUI(); - } - }); - test.test(); + SwingUtilities.invokeAndWait(() -> setupUI()); + blockTillDisplayed(cb); + robot.waitForIdle(); + robot.delay(1000); + test(); } finally { - if (test.frame != null) { - test.frame.dispose(); + if (frame != null) { + SwingUtilities.invokeAndWait(() -> frame.dispose()); } } } - private void setupUI() { + static void blockTillDisplayed(JComponent comp) throws Exception { + while (p == null) { + try { + SwingUtilities.invokeAndWait(() -> { + p = comp.getLocationOnScreen(); + }); + } catch (IllegalStateException e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + + private static void setupUI() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -72,27 +92,31 @@ private void setupUI() { frame.add(cb); frame.pack(); - frame.setLocationRelativeTo(null); frame.setVisible(true); + frame.setLocationRelativeTo(null); } - private void test() throws Exception { - robot = new ExtendedRobot(); - robot.waitForIdle(); + private static void test() throws Exception { + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); testImpl(); robot.waitForIdle(); checkResult(); } - private void testImpl() throws Exception { - robot.type(KeyEvent.VK_DOWN); + private static void testImpl() throws Exception { + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); robot.waitForIdle(); - robot.type(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); robot.waitForIdle(); - robot.type(KeyEvent.VK_ENTER); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); } - private void checkResult() { + private static void checkResult() { if (cb.getSelectedItem().equals("two")) { System.out.println("Test passed"); } else { From fa20186cb688f5fcbc411cfa86fefcc81c3172e7 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Fri, 11 Dec 2020 07:45:18 +0000 Subject: [PATCH 206/504] 8257676: Simplify WeakProcessorPhase Reviewed-by: iwalulya, ayang, tschatzl --- src/hotspot/share/gc/shared/weakProcessor.cpp | 1 - .../share/gc/shared/weakProcessor.inline.hpp | 11 +- ...essorPhases.cpp => weakProcessorPhase.hpp} | 25 ++-- .../gc/shared/weakProcessorPhaseTimes.cpp | 11 +- .../gc/shared/weakProcessorPhaseTimes.hpp | 6 +- .../share/gc/shared/weakProcessorPhases.hpp | 118 ------------------ src/hotspot/share/utilities/enumIterator.hpp | 1 - 7 files changed, 20 insertions(+), 153 deletions(-) rename src/hotspot/share/gc/shared/{weakProcessorPhases.cpp => weakProcessorPhase.hpp} (64%) delete mode 100644 src/hotspot/share/gc/shared/weakProcessorPhases.hpp diff --git a/src/hotspot/share/gc/shared/weakProcessor.cpp b/src/hotspot/share/gc/shared/weakProcessor.cpp index 31ba22d4b6e93..4d1db7e46ad09 100644 --- a/src/hotspot/share/gc/shared/weakProcessor.cpp +++ b/src/hotspot/share/gc/shared/weakProcessor.cpp @@ -29,7 +29,6 @@ #include "gc/shared/oopStorageSet.hpp" #include "gc/shared/weakProcessor.inline.hpp" #include "gc/shared/oopStorageSetParState.inline.hpp" -#include "gc/shared/weakProcessorPhases.hpp" #include "gc/shared/weakProcessorPhaseTimes.hpp" #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" diff --git a/src/hotspot/share/gc/shared/weakProcessor.inline.hpp b/src/hotspot/share/gc/shared/weakProcessor.inline.hpp index 1050758a072ae..1aca302e15fad 100644 --- a/src/hotspot/share/gc/shared/weakProcessor.inline.hpp +++ b/src/hotspot/share/gc/shared/weakProcessor.inline.hpp @@ -29,7 +29,7 @@ #include "gc/shared/oopStorage.inline.hpp" #include "gc/shared/oopStorageParState.inline.hpp" #include "gc/shared/weakProcessor.hpp" -#include "gc/shared/weakProcessorPhases.hpp" +#include "gc/shared/weakProcessorPhase.hpp" #include "gc/shared/weakProcessorPhaseTimes.hpp" #include "gc/shared/workgroup.hpp" #include "prims/resolvedMethodTable.hpp" @@ -81,13 +81,12 @@ void WeakProcessor::Task::work(uint worker_id, "worker_id (%u) exceeds task's configured workers (%u)", worker_id, _nworkers); - typedef WeakProcessorPhases::Iterator Iterator; - - for (Iterator it = WeakProcessorPhases::oopstorage_iterator(); !it.is_end(); ++it) { - WeakProcessorPhase phase = *it; + constexpr EnumRange phase_range{}; + for (WeakProcessorPhase phase : phase_range) { CountingClosure cl(is_alive, keep_alive); WeakProcessorPhaseTimeTracker pt(_phase_times, phase, worker_id); - StorageState* cur_state = _storage_states.par_state(phase); + int state_index = checked_cast(phase_range.index(phase)); + StorageState* cur_state = _storage_states.par_state(state_index); cur_state->oops_do(&cl); cur_state->increment_num_dead(cl.dead()); if (_phase_times != NULL) { diff --git a/src/hotspot/share/gc/shared/weakProcessorPhases.cpp b/src/hotspot/share/gc/shared/weakProcessorPhase.hpp similarity index 64% rename from src/hotspot/share/gc/shared/weakProcessorPhases.cpp rename to src/hotspot/share/gc/shared/weakProcessorPhase.hpp index d5626c3b1fafd..5211fef828856 100644 --- a/src/hotspot/share/gc/shared/weakProcessorPhases.cpp +++ b/src/hotspot/share/gc/shared/weakProcessorPhase.hpp @@ -22,25 +22,14 @@ * */ -#include "precompiled.hpp" -#include "gc/shared/weakProcessorPhases.hpp" -#include "utilities/debug.hpp" -#include "utilities/macros.hpp" +#ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP +#define SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP -#ifdef ASSERT +#include "gc/shared/oopStorageSet.hpp" +#include "utilities/enumIterator.hpp" -void WeakProcessorPhases::Iterator::verify_nonsingular() const { - assert(_limit != singular_value, "precondition"); -} +enum class WeakProcessorPhase : uint {}; -void WeakProcessorPhases::Iterator::verify_category_match(const Iterator& other) const { - verify_nonsingular(); - assert(_limit == other._limit, "precondition"); -} +ENUMERATOR_VALUE_RANGE(WeakProcessorPhase, 0, OopStorageSet::weak_count); -void WeakProcessorPhases::Iterator::verify_dereferenceable() const { - verify_nonsingular(); - assert(_index < _limit, "precondition"); -} - -#endif // ASSERT +#endif // SHARE_GC_SHARED_WEAKPROCESSORPHASE_HPP diff --git a/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.cpp b/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.cpp index e8fe12703e02f..c8f455b08302b 100644 --- a/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.cpp +++ b/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/shared/oopStorage.hpp" -#include "gc/shared/weakProcessorPhases.hpp" +#include "gc/shared/weakProcessorPhase.hpp" #include "gc/shared/weakProcessorPhaseTimes.hpp" #include "gc/shared/workerDataArray.inline.hpp" #include "logging/log.hpp" @@ -100,7 +100,9 @@ void WeakProcessorPhaseTimes::record_total_time_sec(double time_sec) { } WorkerDataArray* WeakProcessorPhaseTimes::worker_data(WeakProcessorPhase phase) const { - return _worker_data[phase]; + size_t index = EnumRange().index(phase); + assert(index < ARRAY_SIZE(_worker_data), "invalid phase"); + return _worker_data[index]; } double WeakProcessorPhaseTimes::worker_time_sec(uint worker_id, WeakProcessorPhase phase) const { @@ -203,9 +205,8 @@ void WeakProcessorPhaseTimes::log_phase_details(WorkerDataArray* data, void WeakProcessorPhaseTimes::log_print_phases(uint indent) const { if (log_is_enabled(Debug, gc, phases)) { - typedef WeakProcessorPhases::Iterator Iterator; - for (Iterator it = WeakProcessorPhases::oopstorage_iterator(); !it.is_end(); ++it) { - log_phase_summary(*it, indent); + for (WeakProcessorPhase phase : EnumRange()) { + log_phase_summary(phase, indent); } } } diff --git a/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.hpp b/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.hpp index 5d652ee3566b4..2dc103677582b 100644 --- a/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.hpp +++ b/src/hotspot/share/gc/shared/weakProcessorPhaseTimes.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASETIMES_HPP #define SHARE_GC_SHARED_WEAKPROCESSORPHASETIMES_HPP -#include "gc/shared/weakProcessorPhases.hpp" +#include "gc/shared/weakProcessorPhase.hpp" #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ticks.hpp" @@ -44,9 +44,7 @@ class WeakProcessorPhaseTimes { double _total_time_sec; // Per-worker times and linked items. - static const uint worker_data_count = WeakProcessorPhases::oopstorage_phase_count; - WorkerDataArray* _worker_data[worker_data_count]; - + WorkerDataArray* _worker_data[EnumRange().size()]; WorkerDataArray* worker_data(WeakProcessorPhase phase) const; void log_phase_summary(WeakProcessorPhase phase, uint indent) const; diff --git a/src/hotspot/share/gc/shared/weakProcessorPhases.hpp b/src/hotspot/share/gc/shared/weakProcessorPhases.hpp deleted file mode 100644 index 3131e3709509f..0000000000000 --- a/src/hotspot/share/gc/shared/weakProcessorPhases.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, 2020, 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. - * - */ - -#ifndef SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP -#define SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP - -#include "gc/shared/oopStorageSet.hpp" -#include "memory/allocation.hpp" -#include "utilities/globalDefinitions.hpp" -#include "utilities/macros.hpp" - -class BoolObjectClosure; -class OopClosure; -class OopStorage; - -class WeakProcessorPhases : AllStatic { -public: - class Iterator; - - enum Phase { - // Implicit phase values for oopstorages. - }; - - static const uint oopstorage_phase_start = 0; - static const uint oopstorage_phase_count = OopStorageSet::weak_count; - static const uint phase_count = oopstorage_phase_count; - - static Iterator oopstorage_iterator(); -}; - -typedef WeakProcessorPhases::Phase WeakProcessorPhase; - -class WeakProcessorPhases::Iterator { - friend class WeakProcessorPhases; - - uint _index; - uint _limit; - - Iterator(uint index, uint limit) : _index(index), _limit(limit) {} - - static const uint singular_value = UINT_MAX; - void verify_nonsingular() const NOT_DEBUG_RETURN; - void verify_category_match(const Iterator& other) const NOT_DEBUG_RETURN; - void verify_dereferenceable() const NOT_DEBUG_RETURN; - -public: - // Construct a singular iterator for later assignment. The only valid - // operations are destruction and assignment. - Iterator() : _index(singular_value), _limit(singular_value) {} - - bool is_end() const { - verify_nonsingular(); - return _index == _limit; - } - - bool operator==(const Iterator& other) const { - verify_category_match(other); - return _index == other._index; - } - - bool operator!=(const Iterator& other) const { - return !operator==(other); - } - - WeakProcessorPhase operator*() const { - verify_dereferenceable(); - return static_cast(_index); - } - - // Phase doesn't have members, so no operator->(). - Iterator& operator++() { - verify_dereferenceable(); - ++_index; - return *this; - } - - Iterator operator++(int) { - verify_dereferenceable(); - return Iterator(_index++, _limit); - } - - Iterator begin() const { - verify_nonsingular(); - return *this; - } - - Iterator end() const { - verify_nonsingular(); - return Iterator(_limit, _limit); - } -}; - -inline WeakProcessorPhases::Iterator WeakProcessorPhases::oopstorage_iterator() { - return Iterator(oopstorage_phase_start, oopstorage_phase_start + oopstorage_phase_count); -} - -#endif // SHARE_GC_SHARED_WEAKPROCESSORPHASES_HPP diff --git a/src/hotspot/share/utilities/enumIterator.hpp b/src/hotspot/share/utilities/enumIterator.hpp index 66a421d6e3f62..afef9a7642e2a 100644 --- a/src/hotspot/share/utilities/enumIterator.hpp +++ b/src/hotspot/share/utilities/enumIterator.hpp @@ -40,7 +40,6 @@ // // case 2: // enum has sequential values, with U start and U end (exclusive). -// WeakProcessorPhases is an example because of oopstorage. // This can be mapped onto case 1 by casting start/(end-1). // // case 3: From b28b0947d9bcf7e64c3dd74807edc66baf87004f Mon Sep 17 00:00:00 2001 From: Dongbo He Date: Fri, 11 Dec 2020 09:06:10 +0000 Subject: [PATCH 207/504] 8257145: Performance regression with -XX:-ResizePLAB after JDK-8079555 Co-authored-by: Junjun Lin Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/gc/g1/g1EvacStats.cpp | 5 +++-- src/hotspot/share/gc/g1/g1EvacStats.hpp | 2 +- src/hotspot/share/gc/shared/plab.cpp | 3 +++ src/hotspot/share/gc/shared/plab.hpp | 6 ++++-- test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1EvacStats.cpp b/src/hotspot/share/gc/g1/g1EvacStats.cpp index b4a5f2e419709..42b57de220a87 100644 --- a/src/hotspot/share/gc/g1/g1EvacStats.cpp +++ b/src/hotspot/share/gc/g1/g1EvacStats.cpp @@ -27,6 +27,7 @@ #include "gc/shared/gcId.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" +#include "runtime/globals.hpp" void G1EvacStats::log_plab_allocation() { PLABStats::log_plab_allocation(); @@ -88,8 +89,8 @@ size_t G1EvacStats::compute_desired_plab_sz() { return cur_plab_sz; } -G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) : - PLABStats(description, desired_plab_sz_, wt), +G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt) : + PLABStats(description, default_per_thread_plab_size, default_per_thread_plab_size * ParallelGCThreads, wt), _region_end_waste(0), _regions_filled(0), _direct_allocated(0), diff --git a/src/hotspot/share/gc/g1/g1EvacStats.hpp b/src/hotspot/share/gc/g1/g1EvacStats.hpp index 22be30ef3a4ac..0bbd1d9661f91 100644 --- a/src/hotspot/share/gc/g1/g1EvacStats.hpp +++ b/src/hotspot/share/gc/g1/g1EvacStats.hpp @@ -56,7 +56,7 @@ class G1EvacStats : public PLABStats { virtual size_t compute_desired_plab_sz(); public: - G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt); + G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt); ~G1EvacStats(); diff --git a/src/hotspot/share/gc/shared/plab.cpp b/src/hotspot/share/gc/shared/plab.cpp index 2afde9141bb86..e1a3c2b181209 100644 --- a/src/hotspot/share/gc/shared/plab.cpp +++ b/src/hotspot/share/gc/shared/plab.cpp @@ -135,6 +135,9 @@ void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) { // Calculates plab size for current number of gc worker threads. size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) { + if (!ResizePLAB) { + return _default_plab_sz; + } return align_object_size(clamp(_desired_net_plab_sz / no_of_gc_workers, min_size(), max_size())); } diff --git a/src/hotspot/share/gc/shared/plab.hpp b/src/hotspot/share/gc/shared/plab.hpp index e517e858a951e..6180c635187fc 100644 --- a/src/hotspot/share/gc/shared/plab.hpp +++ b/src/hotspot/share/gc/shared/plab.hpp @@ -151,6 +151,7 @@ class PLABStats : public CHeapObj { size_t _wasted; // of which wasted (internal fragmentation) size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size) size_t _unused; // Unused in last buffer + size_t _default_plab_sz; size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized AdaptiveWeightedAverage _filter; // Integrator with decay @@ -169,13 +170,14 @@ class PLABStats : public CHeapObj { virtual size_t compute_desired_plab_sz(); public: - PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) : + PLABStats(const char* description, size_t default_per_thread_plab_size, size_t desired_net_plab_sz, unsigned wt) : _description(description), _allocated(0), _wasted(0), _undo_wasted(0), _unused(0), - _desired_net_plab_sz(desired_net_plab_sz_), + _default_plab_sz(default_per_thread_plab_size), + _desired_net_plab_sz(desired_net_plab_sz), _filter(wt) { } diff --git a/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java b/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java index cb2addef8224f..0af28223e19b4 100644 --- a/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java +++ b/test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java @@ -72,7 +72,7 @@ public class TestPLABPromotion { private static final int PLAB_SIZE_HIGH = 65536; private static final int OBJECT_SIZE_SMALL = 10; private static final int OBJECT_SIZE_MEDIUM = 100; - private static final int OBJECT_SIZE_HIGH = 1000; + private static final int OBJECT_SIZE_HIGH = 3500; private static final int GC_NUM_SMALL = 1; private static final int GC_NUM_MEDIUM = 3; private static final int GC_NUM_HIGH = 7; From b5592c05ade980888c5faa346dac76d29f11643b Mon Sep 17 00:00:00 2001 From: Per Liden Date: Fri, 11 Dec 2020 10:17:21 +0000 Subject: [PATCH 208/504] 8257970: Remove julong types in os::limit_heap_by_allocatable_memory Reviewed-by: stefank, tschatzl --- src/hotspot/os/posix/os_posix.cpp | 14 +++++++------- src/hotspot/os/windows/os_windows.cpp | 6 +++--- src/hotspot/share/gc/z/zAddressSpaceLimit.cpp | 4 ++-- src/hotspot/share/runtime/arguments.cpp | 10 +++++----- src/hotspot/share/runtime/arguments.hpp | 2 +- src/hotspot/share/runtime/os.hpp | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index a856ff0bd8208..8d959cfb9f891 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -546,7 +546,7 @@ bool os::get_host_name(char* buf, size_t buflen) { return true; } -bool os::has_allocatable_memory_limit(julong* limit) { +bool os::has_allocatable_memory_limit(size_t* limit) { struct rlimit rlim; int getrlimit_res = getrlimit(RLIMIT_AS, &rlim); // if there was an error when calling getrlimit, assume that there is no limitation @@ -555,7 +555,7 @@ bool os::has_allocatable_memory_limit(julong* limit) { if ((getrlimit_res != 0) || (rlim.rlim_cur == RLIM_INFINITY)) { result = false; } else { - *limit = (julong)rlim.rlim_cur; + *limit = (size_t)rlim.rlim_cur; result = true; } #ifdef _LP64 @@ -564,7 +564,7 @@ bool os::has_allocatable_memory_limit(julong* limit) { // arbitrary virtual space limit for 32 bit Unices found by testing. If // getrlimit above returned a limit, bound it with this limit. Otherwise // directly use it. - const julong max_virtual_limit = (julong)3800*M; + const size_t max_virtual_limit = 3800*M; if (result) { *limit = MIN2(*limit, max_virtual_limit); } else { @@ -581,9 +581,9 @@ bool os::has_allocatable_memory_limit(julong* limit) { // until the difference between these limits is "small". // the minimum amount of memory we care about allocating. - const julong min_allocation_size = M; + const size_t min_allocation_size = M; - julong upper_limit = *limit; + size_t upper_limit = *limit; // first check a few trivial cases if (is_allocatable(upper_limit) || (upper_limit <= min_allocation_size)) { @@ -594,9 +594,9 @@ bool os::has_allocatable_memory_limit(julong* limit) { *limit = min_allocation_size; } else { // perform the binary search. - julong lower_limit = min_allocation_size; + size_t lower_limit = min_allocation_size; while ((upper_limit - lower_limit) > min_allocation_size) { - julong temp_limit = ((upper_limit - lower_limit) / 2) + lower_limit; + size_t temp_limit = ((upper_limit - lower_limit) / 2) + lower_limit; temp_limit = align_down(temp_limit, min_allocation_size); if (is_allocatable(temp_limit)) { lower_limit = temp_limit; diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index a39b74e29d864..913ceae801e32 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -852,16 +852,16 @@ julong os::physical_memory() { return win32::physical_memory(); } -bool os::has_allocatable_memory_limit(julong* limit) { +bool os::has_allocatable_memory_limit(size_t* limit) { MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); GlobalMemoryStatusEx(&ms); #ifdef _LP64 - *limit = (julong)ms.ullAvailVirtual; + *limit = (size_t)ms.ullAvailVirtual; return true; #else // Limit to 1400m because of the 2gb address space wall - *limit = MIN2((julong)1400*M, (julong)ms.ullAvailVirtual); + *limit = MIN2((size_t)1400*M, (size_t)ms.ullAvailVirtual); return true; #endif } diff --git a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp index c0bbd11abf54d..b81d7a29a87e6 100644 --- a/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp +++ b/src/hotspot/share/gc/z/zAddressSpaceLimit.cpp @@ -29,10 +29,10 @@ #include "utilities/align.hpp" static size_t address_space_limit() { - julong limit = 0; + size_t limit = 0; if (os::has_allocatable_memory_limit(&limit)) { - return (size_t)limit; + return limit; } // No limit diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index e467da554b81b..9e8144e35f382 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1655,17 +1655,17 @@ jint Arguments::set_ergonomics_flags() { return JNI_OK; } -julong Arguments::limit_heap_by_allocatable_memory(julong limit) { - julong max_allocatable; - julong result = limit; +size_t Arguments::limit_heap_by_allocatable_memory(size_t limit) { + size_t max_allocatable; + size_t result = limit; if (os::has_allocatable_memory_limit(&max_allocatable)) { // The AggressiveHeap check is a temporary workaround to avoid calling // GCarguments::heap_virtual_to_physical_ratio() before a GC has been // selected. This works because AggressiveHeap implies UseParallelGC // where we know the ratio will be 1. Once the AggressiveHeap option is // removed, this can be cleaned up. - julong heap_virtual_to_physical_ratio = (AggressiveHeap ? 1 : GCConfig::arguments()->heap_virtual_to_physical_ratio()); - julong fraction = MaxVirtMemFraction * heap_virtual_to_physical_ratio; + size_t heap_virtual_to_physical_ratio = (AggressiveHeap ? 1 : GCConfig::arguments()->heap_virtual_to_physical_ratio()); + size_t fraction = MaxVirtMemFraction * heap_virtual_to_physical_ratio; result = MIN2(result, max_allocatable / fraction); } return result; diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index e81b1dad765ad..531cb07054828 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -366,7 +366,7 @@ class Arguments : AllStatic { // Limits the given heap size by the maximum amount of virtual // memory this process is currently allowed to use. It also takes // the virtual-to-physical ratio of the current GC into account. - static julong limit_heap_by_allocatable_memory(julong size); + static size_t limit_heap_by_allocatable_memory(size_t size); // Setup heap size static void set_heap_size(); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index df4fd68d3e51c..33b3d9e14d02f 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -237,7 +237,7 @@ class os: AllStatic { static julong available_memory(); static julong physical_memory(); - static bool has_allocatable_memory_limit(julong* limit); + static bool has_allocatable_memory_limit(size_t* limit); static bool is_server_class_machine(); // Returns the id of the processor on which the calling thread is currently executing. From ff75ad515bcdabc76d4f9085dfd93e5c419081b7 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Fri, 11 Dec 2020 11:26:10 +0000 Subject: [PATCH 209/504] 8258059: Clean up MethodData::profile_unsafe Reviewed-by: roland, chegar --- src/hotspot/share/oops/methodData.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 53ed699b666e2..acf0f332fba5b 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1586,12 +1586,12 @@ bool MethodData::profile_jsr292(const methodHandle& m, int bci) { bool MethodData::profile_unsafe(const methodHandle& m, int bci) { Bytecode_invoke inv(m , bci); if (inv.is_invokevirtual()) { - if (inv.klass() == vmSymbols::jdk_internal_misc_Unsafe() || - inv.klass() == vmSymbols::sun_misc_Unsafe() || - inv.klass() == vmSymbols::jdk_internal_misc_ScopedMemoryAccess()) { - ResourceMark rm; - char* name = inv.name()->as_C_string(); - if (!strncmp(name, "get", 3) || !strncmp(name, "put", 3)) { + Symbol* klass = inv.klass(); + if (klass == vmSymbols::jdk_internal_misc_Unsafe() || + klass == vmSymbols::sun_misc_Unsafe() || + klass == vmSymbols::jdk_internal_misc_ScopedMemoryAccess()) { + Symbol* name = inv.name(); + if (name->starts_with("get") || name->starts_with("put")) { return true; } } From 82735140954012ce2eb4c804b4a420b9a1a927c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=A0ipka?= Date: Fri, 11 Dec 2020 14:37:25 +0000 Subject: [PATCH 210/504] 8166026: Refactor java/lang shell tests to java Reviewed-by: mullan --- .../modules/CustomSecurityManager.sh | 66 --------------- .../modules/CustomSecurityManagerTest.java | 84 +++++++++++++++++++ .../lang/SecurityManager/modules/Test.java | 34 -------- 3 files changed, 84 insertions(+), 100 deletions(-) delete mode 100644 test/jdk/java/lang/SecurityManager/modules/CustomSecurityManager.sh create mode 100644 test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java delete mode 100644 test/jdk/java/lang/SecurityManager/modules/Test.java diff --git a/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManager.sh b/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManager.sh deleted file mode 100644 index 37b527e34d395..0000000000000 --- a/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManager.sh +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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 Basic test of -Djava.security.manager to a class in named module. - -set -e - -if [ -z "$TESTJAVA" ]; then - if [ $# -lt 1 ]; then exit 1; fi - TESTJAVA="$1"; shift - COMPILEJAVA="${TESTJAVA}" - TESTSRC=`pwd` - TESTCLASSES=`pwd` -fi - -OS=`uname -s` -case "$OS" in - Windows*) - PS=";" - ;; - CYGWIN* ) - PS=";" - ;; - * ) - PS=":" - ;; -esac - -JAVAC="$COMPILEJAVA/bin/javac" -JAVA="$TESTJAVA/bin/java ${TESTVMOPTS}" - -mkdir -p mods -$JAVAC -d mods --module-source-path ${TESTSRC} `find ${TESTSRC}/m -name "*.java"` - -mkdir -p classes -$JAVAC -d classes ${TESTSRC}/Test.java - -$JAVA -cp classes --module-path mods --add-modules m \ - -Djava.security.manager \ - -Djava.security.policy=${TESTSRC}/test.policy Test -$JAVA -cp classes --module-path mods --add-modules m \ - -Djava.security.manager=p.CustomSecurityManager \ - -Djava.security.policy=${TESTSRC}/test.policy Test - -exit 0 diff --git a/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java b/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java new file mode 100644 index 0000000000000..bb346f04b2a73 --- /dev/null +++ b/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2015, 2020, 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 jdk.test.lib.Utils; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import java.nio.file.Paths; +import java.util.List; + +/* + * @test + * @summary Basic test of -Djava.security.manager to a class in named module. + * @library /test/lib + * @build jdk.test.lib.process.* + * m/* + * @run testng/othervm CustomSecurityManagerTest + */ +public class CustomSecurityManagerTest { + + private static final String MODULE_PATH = Paths.get(Utils.TEST_CLASSES).resolve("modules").toString(); + private static final String POLICY_PATH = Paths.get(Utils.TEST_SRC).resolve("test.policy").toString(); + + @DataProvider + public Object[][] testCases() { + return new Object[][]{ + new Object[] { List.of( + "--module-path", MODULE_PATH, + "--add-modules", "m", + "-Djava.security.manager", + String.format("-Djava.security.policy=%s", POLICY_PATH), + "RunTest" + ) }, + new Object[] { List.of( + "--module-path", MODULE_PATH, + "--add-modules", "m", + "-Djava.security.manager=p.CustomSecurityManager", + String.format("-Djava.security.policy=%s", POLICY_PATH), + "RunTest" + ) } + }; + } + + @Test(dataProvider = "testCases") + public void testProvider(List args) throws Throwable { + ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(args); + OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(processBuilder); + outputAnalyzer.shouldHaveExitValue(0); + } + +} + +class RunTest { + public static void main(String... args) { + SecurityManager sm = System.getSecurityManager(); + Module module = sm.getClass().getModule(); + String s = System.getProperty("java.security.manager"); + String expected = s.isEmpty() ? "java.base" : "m"; + if (!module.isNamed() || !module.getName().equals(expected)) { + throw new RuntimeException(module + " expected module m instead"); + } + } +} diff --git a/test/jdk/java/lang/SecurityManager/modules/Test.java b/test/jdk/java/lang/SecurityManager/modules/Test.java deleted file mode 100644 index db499ff6299a3..0000000000000 --- a/test/jdk/java/lang/SecurityManager/modules/Test.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -public class Test { - public static void main(String... args) { - SecurityManager sm = System.getSecurityManager(); - Module module = sm.getClass().getModule(); - String s = System.getProperty("java.security.manager"); - String expected = s.isEmpty() ? "java.base" : "m"; - if (!module.isNamed() || !module.getName().equals(expected)) { - throw new RuntimeException(module + " expected module m instead"); - } - } -} From f9c9bf03a80a5b30319fedcc716cdf93fb74afec Mon Sep 17 00:00:00 2001 From: Conor Cleary Date: Fri, 11 Dec 2020 16:07:11 +0000 Subject: [PATCH 211/504] 8255583: Investigate creating a test to trigger the condition in KeepAliveStreamCleaner Reviewed-by: dfuchs, chegar, michaelm --- .../KeepAliveStreamCleanerTestDriver.java | 30 ++++++++++++++ .../www/http/KeepAliveStreamCleanerTest.java | 40 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java create mode 100644 test/jdk/sun/net/www/http/KeepAliveStreamCleaner/java.base/sun/net/www/http/KeepAliveStreamCleanerTest.java diff --git a/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java b/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java new file mode 100644 index 0000000000000..5f66aff365e68 --- /dev/null +++ b/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/KeepAliveStreamCleanerTestDriver.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020, 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 8255124 + * @summary Tests that KeepAliveStreamCleaner run does not throw an IllegalMonitorState Exception. + * @modules java.base/sun.net.www.http + * @run testng java.base/sun.net.www.http.KeepAliveStreamCleanerTest + */ diff --git a/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/java.base/sun/net/www/http/KeepAliveStreamCleanerTest.java b/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/java.base/sun/net/www/http/KeepAliveStreamCleanerTest.java new file mode 100644 index 0000000000000..b4bc638099db7 --- /dev/null +++ b/test/jdk/sun/net/www/http/KeepAliveStreamCleaner/java.base/sun/net/www/http/KeepAliveStreamCleanerTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2020, 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.net.www.http; + +import org.testng.annotations.Test; + +@Test +public class KeepAliveStreamCleanerTest { + + /* + Tests that KeepAliveStreamCleaner run does not throw an + IllegalMonitorState Exception. + */ + @Test + public void keepAliveStreamCleanerTest() { + KeepAliveStreamCleaner kase = new KeepAliveStreamCleaner(); + kase.run(); + } +} From bacf22b907731172e36285ddacfc702136615aba Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 11 Dec 2020 18:14:37 +0000 Subject: [PATCH 212/504] 8256641: CDS VM operations do not lock the heap Reviewed-by: kbarrett, iklam --- src/hotspot/share/gc/g1/g1HeapVerifier.cpp | 1 + .../share/gc/shared/gcVMOperations.cpp | 19 +++++- .../share/gc/shared/gcVMOperations.hpp | 67 ++++++++++++++----- src/hotspot/share/gc/z/zDriver.cpp | 1 + src/hotspot/share/memory/dynamicArchive.cpp | 5 +- src/hotspot/share/memory/heapShared.cpp | 3 + src/hotspot/share/memory/metaspaceShared.cpp | 11 ++- src/hotspot/share/runtime/thread.cpp | 1 + src/hotspot/share/runtime/vmOperations.cpp | 5 -- src/hotspot/share/runtime/vmOperations.hpp | 7 -- 10 files changed, 85 insertions(+), 35 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index 09c869f45822e..80d49da1667d9 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -472,6 +472,7 @@ bool G1HeapVerifier::should_verify(G1VerifyType type) { void G1HeapVerifier::verify(VerifyOption vo) { assert_at_safepoint_on_vm_thread(); + assert(Heap_lock->is_locked(), "heap must be locked"); log_debug(gc, verify)("Roots"); VerifyRootsClosure rootsCl(vo); diff --git a/src/hotspot/share/gc/shared/gcVMOperations.cpp b/src/hotspot/share/gc/shared/gcVMOperations.cpp index 60b97e33a098a..d5fd095cf850c 100644 --- a/src/hotspot/share/gc/shared/gcVMOperations.cpp +++ b/src/hotspot/share/gc/shared/gcVMOperations.cpp @@ -46,6 +46,20 @@ #include "gc/g1/g1Policy.hpp" #endif // INCLUDE_G1GC +bool VM_GC_Sync_Operation::doit_prologue() { + Heap_lock->lock(); + return true; +} + +void VM_GC_Sync_Operation::doit_epilogue() { + Heap_lock->unlock(); +} + +void VM_Verify::doit() { + Universe::heap()->prepare_for_verify(); + Universe::verify(); +} + VM_GC_Operation::~VM_GC_Operation() { CollectedHeap* ch = Universe::heap(); ch->soft_ref_policy()->set_all_soft_refs_clear(false); @@ -94,8 +108,7 @@ bool VM_GC_Operation::doit_prologue() { proper_unit_for_byte_size(NewSize))); } - // If the GC count has changed someone beat us to the collection - Heap_lock->lock(); + VM_GC_Sync_Operation::doit_prologue(); // Check invocations if (skip_operation()) { @@ -116,7 +129,7 @@ void VM_GC_Operation::doit_epilogue() { if (Universe::has_reference_pending_list()) { Heap_lock->notify_all(); } - Heap_lock->unlock(); + VM_GC_Sync_Operation::doit_epilogue(); } bool VM_GC_HeapInspection::skip_operation() const { diff --git a/src/hotspot/share/gc/shared/gcVMOperations.hpp b/src/hotspot/share/gc/shared/gcVMOperations.hpp index d071b50e2cd5a..8b16d3336a24f 100644 --- a/src/hotspot/share/gc/shared/gcVMOperations.hpp +++ b/src/hotspot/share/gc/shared/gcVMOperations.hpp @@ -39,17 +39,27 @@ // a set of operations (VM_Operation) related to GC. // // VM_Operation +// VM_GC_Sync_Operation // VM_GC_Operation -// VM_GC_HeapInspection -// VM_GenCollectFull -// VM_GenCollectFullConcurrent -// VM_ParallelGCSystemGC -// VM_CollectForAllocation -// VM_GenCollectForAllocation -// VM_ParallelGCFailedAllocation +// VM_GC_HeapInspection +// VM_PopulateDynamicDumpSharedSpace +// VM_GenCollectFull +// VM_GenCollectFullConcurrent +// VM_ParallelGCSystemGC +// VM_CollectForAllocation +// VM_GenCollectForAllocation +// VM_ParallelGCFailedAllocation +// VM_Verify +// VM_PopulateDumpSharedSpace +// +// VM_GC_Sync_Operation +// - implements only synchronization with other VM operations of the +// same kind using the Heap_lock, not actually doing a GC. +// // VM_GC_Operation -// - implements methods common to all classes in the hierarchy: -// prevents multiple gc requests and manages lock on heap; +// - implements methods common to all operations that perform garbage collections, +// checking that the VM is in a state to do GC and preventing multiple GC +// requests. // // VM_GC_HeapInspection // - prints class histogram on SIGBREAK if PrintClassHistogram @@ -68,11 +78,37 @@ // - these operations preform full collection of heaps of // different kind // +// VM_Verify +// - verifies the heap +// +// VM_PopulateDynamicDumpSharedSpace +// - populates the CDS archive area with the information from the archive file. +// +// VM_PopulateDumpSharedSpace +// - creates the CDS archive +// + +class VM_GC_Sync_Operation : public VM_Operation { +public: + + VM_GC_Sync_Operation() : VM_Operation() { } + + // Acquires the Heap_lock. + virtual bool doit_prologue(); + // Releases the Heap_lock. + virtual void doit_epilogue(); +}; + +class VM_Verify : public VM_GC_Sync_Operation { + public: + VMOp_Type type() const { return VMOp_Verify; } + void doit(); +}; -class VM_GC_Operation: public VM_Operation { +class VM_GC_Operation: public VM_GC_Sync_Operation { protected: - uint _gc_count_before; // gc count before acquiring PLL - uint _full_gc_count_before; // full gc count before acquiring PLL + uint _gc_count_before; // gc count before acquiring the Heap_lock + uint _full_gc_count_before; // full gc count before acquiring the Heap_lock bool _full; // whether a "full" collection bool _prologue_succeeded; // whether doit_prologue succeeded GCCause::Cause _gc_cause; // the putative cause for this gc op @@ -84,7 +120,7 @@ class VM_GC_Operation: public VM_Operation { VM_GC_Operation(uint gc_count_before, GCCause::Cause _cause, uint full_gc_count_before = 0, - bool full = false) { + bool full = false) : VM_GC_Sync_Operation() { _full = full; _prologue_succeeded = false; _gc_count_before = gc_count_before; @@ -106,9 +142,10 @@ class VM_GC_Operation: public VM_Operation { } ~VM_GC_Operation(); - // Acquire the reference synchronization lock + // Acquire the Heap_lock and determine if this VM operation should be executed + // (i.e. not skipped). Return this result, and also store it in _prologue_succeeded. virtual bool doit_prologue(); - // Do notifyAll (if needed) and release held lock + // Notify the Heap_lock if needed and release it. virtual void doit_epilogue(); virtual bool allow_nested_vm_operations() const { return true; } diff --git a/src/hotspot/share/gc/z/zDriver.cpp b/src/hotspot/share/gc/z/zDriver.cpp index a12ee90cf024a..0dc974524a2f7 100644 --- a/src/hotspot/share/gc/z/zDriver.cpp +++ b/src/hotspot/share/gc/z/zDriver.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/gcLocker.hpp" +#include "gc/shared/gcVMOperations.hpp" #include "gc/shared/isGCActiveMark.hpp" #include "gc/z/zBreakpoint.hpp" #include "gc/z/zCollectedHeap.hpp" diff --git a/src/hotspot/share/memory/dynamicArchive.cpp b/src/hotspot/share/memory/dynamicArchive.cpp index fcaf1c38e57cb..a8c357a16d639 100644 --- a/src/hotspot/share/memory/dynamicArchive.cpp +++ b/src/hotspot/share/memory/dynamicArchive.cpp @@ -27,6 +27,7 @@ #include "classfile/classLoaderData.inline.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionaryShared.hpp" +#include "gc/shared/gcVMOperations.hpp" #include "logging/log.hpp" #include "memory/archiveBuilder.hpp" #include "memory/archiveUtils.inline.hpp" @@ -541,10 +542,10 @@ void DynamicArchiveBuilder::write_archive(char* serialized_data) { log_info(cds, dynamic)("%d klasses; %d symbols", num_klasses, num_symbols); } -class VM_PopulateDynamicDumpSharedSpace: public VM_Operation { +class VM_PopulateDynamicDumpSharedSpace: public VM_GC_Sync_Operation { DynamicArchiveBuilder* _builder; public: - VM_PopulateDynamicDumpSharedSpace(DynamicArchiveBuilder* builder) : _builder(builder) {} + VM_PopulateDynamicDumpSharedSpace(DynamicArchiveBuilder* builder) : VM_GC_Sync_Operation(), _builder(builder) {} VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; } void doit() { ResourceMark rm; diff --git a/src/hotspot/share/memory/heapShared.cpp b/src/hotspot/share/memory/heapShared.cpp index fd929ade9ba1e..3477190dffb57 100644 --- a/src/hotspot/share/memory/heapShared.cpp +++ b/src/hotspot/share/memory/heapShared.cpp @@ -33,6 +33,7 @@ #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/gcLocker.hpp" +#include "gc/shared/gcVMOperations.hpp" #include "logging/log.hpp" #include "logging/logMessage.hpp" #include "logging/logStream.hpp" @@ -655,8 +656,10 @@ static void verify_the_heap(Klass* k, const char* which) { ResourceMark rm; log_info(cds, heap)("Verify heap %s initializing static field(s) in %s", which, k->external_name()); + VM_Verify verify_op; VMThread::execute(&verify_op); + if (!FLAG_IS_DEFAULT(VerifyArchivedFields)) { // If VerifyArchivedFields has a non-default value (e.g., specified on the command-line), do // more expensive checks. diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index c5dca41b9c814..6381b812a4632 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -37,6 +37,7 @@ #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" +#include "gc/shared/gcVMOperations.hpp" #include "interpreter/abstractInterpreter.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodes.hpp" @@ -577,7 +578,7 @@ void MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread } } -class VM_PopulateDumpSharedSpace: public VM_Operation { +class VM_PopulateDumpSharedSpace : public VM_GC_Operation { private: GrowableArray *_closed_archive_heap_regions; GrowableArray *_open_archive_heap_regions; @@ -602,6 +603,12 @@ class VM_PopulateDumpSharedSpace: public VM_Operation { public: + VM_PopulateDumpSharedSpace() : VM_GC_Operation(0, /* total collections, ignored */ + GCCause::_archive_time_gc) + { } + + bool skip_operation() const { return false; } + VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; } void doit(); // outline because gdb sucks bool allow_nested_vm_operations() const { return true; } @@ -1085,8 +1092,6 @@ void MetaspaceShared::preload_and_dump(TRAPS) { #endif VM_PopulateDumpSharedSpace op; - MutexLocker ml(THREAD, HeapShared::is_heap_object_archiving_allowed() ? - Heap_lock : NULL); // needed by HeapShared::run_gc() VMThread::execute(&op); } } diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index fa0f0841a9eae..88820241cbd35 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -38,6 +38,7 @@ #include "gc/shared/barrierSet.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcVMOperations.hpp" #include "gc/shared/oopStorage.hpp" #include "gc/shared/oopStorageSet.hpp" #include "gc/shared/workgroup.hpp" diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp index 0b71dd858a543..0cf1b4eb40431 100644 --- a/src/hotspot/share/runtime/vmOperations.cpp +++ b/src/hotspot/share/runtime/vmOperations.cpp @@ -156,11 +156,6 @@ void VM_ZombieAll::doit() { #endif // !PRODUCT -void VM_Verify::doit() { - Universe::heap()->prepare_for_verify(); - Universe::verify(); -} - bool VM_PrintThreads::doit_prologue() { // Get Heap_lock if concurrent locks will be dumped if (_print_concurrent_locks) { diff --git a/src/hotspot/share/runtime/vmOperations.hpp b/src/hotspot/share/runtime/vmOperations.hpp index 8efa0ef85e484..3dc1608678cd2 100644 --- a/src/hotspot/share/runtime/vmOperations.hpp +++ b/src/hotspot/share/runtime/vmOperations.hpp @@ -277,13 +277,6 @@ class VM_ZombieAll: public VM_Operation { }; #endif // PRODUCT -class VM_Verify: public VM_Operation { - public: - VMOp_Type type() const { return VMOp_Verify; } - void doit(); -}; - - class VM_PrintThreads: public VM_Operation { private: outputStream* _out; From a2801829560efb2eda4bbfea0b6d3cb04e2519a0 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Fri, 11 Dec 2020 18:38:45 +0000 Subject: [PATCH 213/504] 8258060: Update @jls tags for renamed/renumbered sections Reviewed-by: jjg, abuckley --- .../javax/annotation/processing/RoundEnvironment.java | 4 ++-- .../classes/javax/lang/model/AnnotatedConstruct.java | 10 +++++----- .../classes/javax/lang/model/element/Element.java | 2 +- .../classes/javax/lang/model/element/NestingKind.java | 2 +- .../classes/javax/lang/model/element/package-info.java | 2 +- .../share/classes/javax/lang/model/util/Elements.java | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java index 4b63873a57016..c50c6b787a658 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java @@ -109,7 +109,7 @@ public interface RoundEnvironment { * annotation types, or an empty set if there are none * @throws IllegalArgumentException if the any elements of the * argument set do not represent an annotation type - * @jls 9.6.3 Repeatable Annotation Types + * @jls 9.6.3 Repeatable Annotation Interfaces * @since 9 */ default Set getElementsAnnotatedWithAny(TypeElement... annotations){ @@ -191,7 +191,7 @@ default Set getElementsAnnotatedWithAny(TypeElement... annota * annotation types, or an empty set if there are none * @throws IllegalArgumentException if the any elements of the * argument set do not represent an annotation type - * @jls 9.6.3 Repeatable Annotation Types + * @jls 9.6.3 Repeatable Annotation Interfaces * * @see javax.lang.model.AnnotatedConstruct#getAnnotation(Class) * @see javax.lang.model.AnnotatedConstruct#getAnnotationsByType(Class) diff --git a/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java b/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java index e0df340275921..d10a1cbd10efe 100644 --- a/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java +++ b/src/java.compiler/share/classes/javax/lang/model/AnnotatedConstruct.java @@ -129,10 +129,10 @@ *

      * * @since 1.8 - * @jls 9.6 Annotation Types + * @jls 9.6 Annotation Interfaces * @jls 9.6.4.3 {@code @Inherited} * @jls 9.7.4 Where Annotations May Appear - * @jls 9.7.5 Multiple Annotations of the Same Type + * @jls 9.7.5 Multiple Annotations of the Same Interface */ public interface AnnotatedConstruct { /** @@ -184,7 +184,7 @@ public interface AnnotatedConstruct { * @see IncompleteAnnotationException * @see MirroredTypeException * @see MirroredTypesException - * @jls 9.6.1 Annotation Type Elements + * @jls 9.6.1 Annotation Interface Elements */ A getAnnotation(Class annotationType); @@ -244,8 +244,8 @@ public interface AnnotatedConstruct { * @see IncompleteAnnotationException * @see MirroredTypeException * @see MirroredTypesException - * @jls 9.6 Annotation Types - * @jls 9.6.1 Annotation Type Elements + * @jls 9.6 Annotation Interfaces + * @jls 9.6.1 Annotation Interface Elements */ A[] getAnnotationsByType(Class annotationType); } diff --git a/src/java.compiler/share/classes/javax/lang/model/element/Element.java b/src/java.compiler/share/classes/javax/lang/model/element/Element.java index 61da65e0555ec..01bad07dd2945 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/Element.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/Element.java @@ -229,7 +229,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct { * @see ModuleElement#getEnclosedElements * @see Elements#getAllMembers * @jls 8.8.9 Default Constructor - * @jls 8.9 Enum Types + * @jls 8.9 Enum Classes * @revised 9 */ List getEnclosedElements(); diff --git a/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java b/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java index 3c784393f315f..62cc65d8c5ad6 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/NestingKind.java @@ -91,7 +91,7 @@ public enum NestingKind { /** * A class or interface that is a named member of another class or * interface. - * @jls 8.5 Member Type Declarations + * @jls 8.5 Member Class and Interface Declarations */ MEMBER, diff --git a/src/java.compiler/share/classes/javax/lang/model/element/package-info.java b/src/java.compiler/share/classes/javax/lang/model/element/package-info.java index 296a4034fc62e..094dd1825bd7f 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/package-info.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/package-info.java @@ -116,7 +116,7 @@ * @jls 8.1 Class Declarations * @jls 8.3 Field Declarations * @jls 8.4 Method Declarations - * @jls 8.5 Member Type Declarations + * @jls 8.5 Member Class and Interface Declarations * @jls 8.8 Constructor Declarations * @jls 9.1 Interface Declarations * @since 1.6 diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java index c6e3289446e86..ec513fbe4a538 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Elements.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Elements.java @@ -354,7 +354,7 @@ default Origin getOrigin(Element e) { * @param c the construct the annotation mirror modifies * @param a the annotation mirror being examined * @jls 9.6.3 Repeatable Annotation Types - * @jls 9.7.5 Multiple Annotations of the Same Type + * @jls 9.7.5 Multiple Annotations of the Same Interface * @since 9 */ default Origin getOrigin(AnnotatedConstruct c, @@ -428,7 +428,7 @@ public enum Origin { * @jls 8.8.9 Default Constructor * @jls 8.9.3 Enum Members * @jls 9.6.3 Repeatable Annotation Types - * @jls 9.7.5 Multiple Annotations of the Same Type + * @jls 9.7.5 Multiple Annotations of the Same Interface */ MANDATED, From b7ac32d6ee518e9823fe695c68b79f9a855db87e Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Fri, 11 Dec 2020 19:16:34 +0000 Subject: [PATCH 214/504] 8257598: Clarify what component values are used in Record::equals Reviewed-by: darcy, chegar --- .../share/classes/java/lang/Record.java | 5 +- .../records/CheckEqualityIsBasedOnFields.java | 132 ++++++++++++++++++ 2 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 test/jdk/java/lang/reflect/records/CheckEqualityIsBasedOnFields.java diff --git a/src/java.base/share/classes/java/lang/Record.java b/src/java.base/share/classes/java/lang/Record.java index ee7c1095e6706..7441ec2faa50b 100644 --- a/src/java.base/share/classes/java/lang/Record.java +++ b/src/java.base/share/classes/java/lang/Record.java @@ -111,15 +111,14 @@ protected Record() {} *
    14. If the component is of a reference type, the component is * considered equal if and only if {@link * java.util.Objects#equals(Object,Object) - * Objects.equals(this.c(), r.c()} would return {@code true}. + * Objects.equals(this.c, r.c} would return {@code true}. * *
    15. If the component is of a primitive type, using the * corresponding primitive wrapper class {@code PW} (the * corresponding wrapper class for {@code int} is {@code * java.lang.Integer}, and so on), the component is considered * equal if and only if {@code - * PW.valueOf(this.c()).equals(PW.valueOf(r.c()))} would return - * {@code true}. + * PW.compare(this.c, r.c)} would return {@code 0}. * * * diff --git a/test/jdk/java/lang/reflect/records/CheckEqualityIsBasedOnFields.java b/test/jdk/java/lang/reflect/records/CheckEqualityIsBasedOnFields.java new file mode 100644 index 0000000000000..b5c438e4f9af7 --- /dev/null +++ b/test/jdk/java/lang/reflect/records/CheckEqualityIsBasedOnFields.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2020, 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 8257598 + * @summary check that Record::equals uses the fields and not the accessors for the comparison + * @run testng CheckEqualityIsBasedOnFields + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +public class CheckEqualityIsBasedOnFields { + public record R01(boolean x) { + public boolean x() { + return x ? x : !x; + } + } + + public record R02(byte x) { + public byte x() { + return (x >= 50) ? (byte)(x - 50) : x; + } + } + + public record R03(short x) { + public short x() { + return (x >= 50) ? (short)(x - 50) : x; + } + } + + public record R04(char x) { + public char x() { + return (x >= 50) ? (char)(x - 50) : x; + } + } + + public record R05(int x) { + public int x() { + return (x >= 50) ? (x - 50) : x; + } + } + + public record R06(long x) { + public long x() { + return (x >= 50) ? (long)(x - 50) : x; + } + } + + public record R07(float x) { + public float x() { + return (x >= 50) ? (float)(x - 50) : x; + } + } + public record R08(double x) { + public double x() { + return (x >= 50) ? (double)(x - 50) : x; + } + } + + public record R09(String x) { + public String x() { + return (x.length() > 1) ? x.substring(0, 1) : x; + } + } + + @DataProvider(name = "recordData") + public Object[][] recordTypeAndExpectedValue() { + return new Object[][] { + new Object[] { R01.class, boolean.class, new Object[]{true, false} }, + new Object[] { R02.class, byte.class, new Object[]{(byte)0, (byte)1, (byte)2, (byte)3, (byte)4, (byte)5, + (byte)50, (byte)51, (byte)52, (byte)53, (byte)54, (byte)55} }, + new Object[] { R03.class, short.class, new Object[]{(short)0, (short)1, (short)2, (short)3, (short)4, (short)5, + (short)50, (short)51, (short)52, (short)53, (short)54, (short)55} }, + new Object[] { R04.class, char.class, new Object[]{(char)0, (char)1, (char)2, (char)3, (char)4, (char)5, + (char)50, (char)51, (char)52, (char)53, (char)54, (char)55} }, + new Object[] { R05.class, int.class, new Object[]{0, 1, 2, 3, 4, 5, 50, 51, 52, 53, 54, 55} }, + new Object[] { R06.class, long.class, new Object[]{0L, 1L, 2L, 3L, 4L, 5L, 50L, 51L, 52L, 53L, 54L, 55L} }, + new Object[] { R07.class, float.class, new Object[]{(float)0, (float)1, (float)2, (float)3, (float)4, (float)5, + (float)50, (float)51, (float)52, (float)53, (float)54, (float)55} }, + new Object[] { R08.class, double.class, new Object[]{(double)0, (double)1, (double)2, (double)3, (double)4, (double)5, + (double)50, (double)51, (double)52, (double)53, (double)54, (double)55} }, + new Object[] { R09.class, String.class, new Object[]{"1", "2", "3", "4", "5", + "1_", "2_", "3_", "4_", "5_"} }, + }; + } + + @Test(dataProvider = "recordData") + public void testEqualsDoesntUseAccessors(Class clazz, Class componentClass, Object[] expectedXValues) throws Exception { + Constructor ctor; + Method getter, equalsMethod; + ctor = clazz.getConstructor(componentClass); + equalsMethod = clazz.getMethod("equals", Object.class); + getter = clazz.getMethod("x"); + for (int i = 0; i < expectedXValues.length / 2; i++) { + Object rec1 = ctor.newInstance(expectedXValues[i]); + Object rec2 = ctor.newInstance(expectedXValues[i + expectedXValues.length / 2]); + System.out.println(rec1.toString()); + System.out.println(rec2.toString()); + assertFalse((boolean) equalsMethod.invoke(rec1, rec2)); + assertNotEquals(expectedXValues[i], expectedXValues[i + expectedXValues.length / 2]); + assertEquals(getter.invoke(rec1), getter.invoke(rec2)); + } + } +} From 74b79c6e191d8c39da7be37d9c01ccbbbd103857 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Fri, 11 Dec 2020 21:26:16 +0000 Subject: [PATCH 215/504] 8257964: Broken Calendar#getMinimalDaysInFirstWeek with java.locale.providers=HOST Reviewed-by: joehw --- .../HostLocaleProviderAdapterImpl.java | 12 +++++-- .../libjava/HostLocaleProviderAdapter_md.c | 5 +++ .../jdk/java/util/Locale/LocaleProviders.java | 35 +++++++++++++++++++ .../java/util/Locale/LocaleProvidersRun.java | 5 ++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java b/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java index 8699a14a7f9b8..abc62d79bb1d4 100644 --- a/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java +++ b/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java @@ -75,7 +75,7 @@ public class HostLocaleProviderAdapterImpl { // CalendarData value types private static final int CD_FIRSTDAYOFWEEK = 0; - private static final int CD_MINIMALDAYSINFIRSTWEEK = 1; + private static final int CD_FIRSTWEEKOFYEAR = 1; // Currency/Locale display name types private static final int DN_CURRENCY_NAME = 0; @@ -366,7 +366,15 @@ public int getFirstDayOfWeek(Locale locale) { @Override public int getMinimalDaysInFirstWeek(Locale locale) { - return 0; + int firstWeek = getCalendarDataValue( + removeExtensions(locale).toLanguageTag(), + CD_FIRSTWEEKOFYEAR); + // Interpret the value from Windows LOCALE_IFIRSTWEEKOFYEAR setting + return switch (firstWeek) { + case 1 -> 7; // First full week following 1/1 is the first week of the year. + case 2 -> 4; // First week containing at least four days is the first week of the year. + default -> 1; // First week can be a single day, if 1/1 falls on the last day of the week. + }; } }; } diff --git a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c index e678d51630820..879422f096f3a 100644 --- a/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c +++ b/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c @@ -647,6 +647,11 @@ JNIEXPORT jint JNICALL Java_sun_util_locale_provider_HostLocaleProviderAdapterIm LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER, (LPWSTR)&num, sizeof(num)); break; + case sun_util_locale_provider_HostLocaleProviderAdapterImpl_CD_FIRSTWEEKOFYEAR: + got = getLocaleInfoWrapper(langtag, + LOCALE_IFIRSTWEEKOFYEAR | LOCALE_RETURN_NUMBER, + (LPWSTR)&num, sizeof(num)); + break; } (*env)->ReleaseStringChars(env, jlangtag, langtag); diff --git a/test/jdk/java/util/Locale/LocaleProviders.java b/test/jdk/java/util/Locale/LocaleProviders.java index 9d90b073c431f..c05565436dfe9 100644 --- a/test/jdk/java/util/Locale/LocaleProviders.java +++ b/test/jdk/java/util/Locale/LocaleProviders.java @@ -27,6 +27,7 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; +import java.time.temporal.WeekFields; import java.util.*; import java.util.logging.Level; import java.util.logging.LogRecord; @@ -110,6 +111,10 @@ public static void main(String[] args) { bug8248695Test(); break; + case "bug8257964Test": + bug8257964Test(); + break; + default: throw new RuntimeException("Test method '"+methodName+"' not found."); } @@ -433,4 +438,34 @@ static void bug8248695Test() { System.out.println(dtf.format(zdt)); } } + + // Run only if the platform locale is en-GB + static void bug8257964Test() { + var defLoc = Locale.getDefault(Locale.Category.FORMAT); + var type = LocaleProviderAdapter.getAdapter(CalendarNameProvider.class, Locale.UK) + .getAdapterType(); + if (defLoc.equals(Locale.UK) && + type == LocaleProviderAdapter.Type.HOST && + (IS_WINDOWS || IS_MAC)) { + Calendar instance = Calendar.getInstance(Locale.UK); + int result = instance.getMinimalDaysInFirstWeek(); + if (result != 4) { + throw new RuntimeException("MinimalDaysInFirstWeek for Locale.UK is incorrect. " + + "returned: " + result); + } + + LocalDate date = LocalDate.of(2020,12,31); + result = date.get(WeekFields.of(Locale.UK).weekOfWeekBasedYear()); + if (result != 53) { + throw new RuntimeException("weekNumber is incorrect. " + + "returned: " + result); + } + System.out.println("bug8257964Test succeeded."); + } else { + System.out.println("Test ignored. Either :-\n" + + "Default format locale is not Locale.UK: " + defLoc + ", or\n" + + "OS is neither macOS/Windows, or\n" + + "provider is not HOST: " + type); + } + } } diff --git a/test/jdk/java/util/Locale/LocaleProvidersRun.java b/test/jdk/java/util/Locale/LocaleProvidersRun.java index e6b4135853d56..ed091be3314df 100644 --- a/test/jdk/java/util/Locale/LocaleProvidersRun.java +++ b/test/jdk/java/util/Locale/LocaleProvidersRun.java @@ -26,7 +26,7 @@ * @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577 * 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006 * 8150432 8215913 8220227 8228465 8232871 8232860 8236495 8245241 - * 8246721 8248695 + * 8246721 8248695 8257964 * @summary tests for "java.locale.providers" system property * @library /test/lib * @build LocaleProviders @@ -172,6 +172,9 @@ public static void main(String[] args) throws Throwable { //testing 8248695 fix. testRun("HOST", "bug8248695Test", "", "", ""); + + //testing 8257964 fix. (macOS/Windows only) + testRun("HOST", "bug8257964Test", "", "", ""); } private static void testRun(String prefList, String methodName, From b1afed7501ccc6991ae0cf17c0849700ce19c5fe Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Fri, 11 Dec 2020 21:50:49 +0000 Subject: [PATCH 216/504] 8257919: [JVMCI] profiling info didn't change after reprofile Reviewed-by: kvn, redestad --- src/hotspot/share/ci/ciMethodData.cpp | 2 ++ src/hotspot/share/ci/ciMethodData.hpp | 4 +++- src/hotspot/share/oops/methodData.cpp | 4 +++- src/hotspot/share/oops/methodData.hpp | 14 ++++++-------- test/hotspot/jtreg/ProblemList.txt | 2 -- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index cded7042da10a..fef6e6f166d6f 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.cpp @@ -47,6 +47,7 @@ ciMethodData::ciMethodData(MethodData* md) _saw_free_extra_data(false), // Initialize the escape information (to "don't know."); _eflags(0), _arg_local(0), _arg_stack(0), _arg_returned(0), + _creation_mileage(0), _current_mileage(0), _invocation_counter(0), _backedge_counter(0), @@ -242,6 +243,7 @@ void ciMethodData::load_data() { load_remaining_extra_data(); // Note: Extra data are all BitData, and do not need translation. + _creation_mileage = mdo->creation_mileage(); _current_mileage = MethodData::mileage_of(mdo->method()); _invocation_counter = mdo->invocation_count(); _backedge_counter = mdo->backedge_count(); diff --git a/src/hotspot/share/ci/ciMethodData.hpp b/src/hotspot/share/ci/ciMethodData.hpp index 6b3c01b64faf8..bf37270125028 100644 --- a/src/hotspot/share/ci/ciMethodData.hpp +++ b/src/hotspot/share/ci/ciMethodData.hpp @@ -395,6 +395,8 @@ class ciMethodData : public ciMetadata { intx _arg_stack; // bit set of stack-allocatable arguments intx _arg_returned; // bit set of returned arguments + int _creation_mileage; // method mileage at MDO creation + // Maturity of the oop when the snapshot is taken. int _current_mileage; @@ -475,7 +477,7 @@ class ciMethodData : public ciMetadata { bool is_empty() { return _state == empty_state; } bool is_mature() { return _state == mature_state; } - int creation_mileage() { return _orig.creation_mileage(); } + int creation_mileage() { return _creation_mileage; } int current_mileage() { return _current_mileage; } int invocation_count() { return _invocation_counter; } diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 02d782b966755..311acab84601b 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1206,7 +1206,7 @@ void MethodData::post_initialize(BytecodeStream* stream) { MethodData::MethodData(const methodHandle& method) : _method(method()), _extra_data_lock(Mutex::leaf, "MDO extra data lock"), - _compiler_counters(method()), + _compiler_counters(), _parameters_type_data_di(parameters_uninitialized) { initialize(); } @@ -1217,6 +1217,7 @@ void MethodData::initialize() { ResourceMark rm(thread); init(); + set_creation_mileage(mileage_of(method())); // Go through the bytecodes and allocate and initialize the // corresponding data cells. @@ -1281,6 +1282,7 @@ void MethodData::initialize() { } void MethodData::init() { + _compiler_counters = CompilerCounters(); // reset compiler counters _invocation_counter.init(); _backedge_counter.init(); _invocation_counter_start = 0; diff --git a/src/hotspot/share/oops/methodData.hpp b/src/hotspot/share/oops/methodData.hpp index 289593afd94bc..83c7bd6fd6d32 100644 --- a/src/hotspot/share/oops/methodData.hpp +++ b/src/hotspot/share/oops/methodData.hpp @@ -1974,7 +1974,6 @@ class MethodData : public Metadata { friend class VMStructs; friend class JVMCIVMStructs; - int _creation_mileage; // method mileage at MDO creation uint _nof_decompiles; // count of all nmethod removals uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits uint _nof_overflow_traps; // trap count, excluding _trap_hist @@ -1983,16 +1982,12 @@ class MethodData : public Metadata { u1 _array[JVMCI_ONLY(2 *) MethodData::_trap_hist_limit]; } _trap_hist; - CompilerCounters(int current_mileage) : _creation_mileage(current_mileage), _nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) { + public: + CompilerCounters() : _nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) { static_assert(sizeof(_trap_hist) % HeapWordSize == 0, "align"); uint size_in_words = sizeof(_trap_hist) / HeapWordSize; Copy::zero_to_words((HeapWord*) &_trap_hist, size_in_words); } - public: - CompilerCounters(Method* m) : CompilerCounters(MethodData::mileage_of(m)) {} - CompilerCounters() : CompilerCounters(0) {} // for ciMethodData - - int creation_mileage() const { return _creation_mileage; } // Return (uint)-1 for overflow. uint trap_count(int reason) const { @@ -2044,6 +2039,8 @@ class MethodData : public Metadata { intx _arg_stack; // bit set of stack-allocatable arguments intx _arg_returned; // bit set of returned arguments + int _creation_mileage; // method mileage at MDO creation + // How many invocations has this MDO seen? // These counters are used to determine the exact age of MDO. // We need those because in tiered a method can be concurrently @@ -2188,7 +2185,8 @@ class MethodData : public Metadata { int size_in_bytes() const { return _size; } int size() const { return align_metadata_size(align_up(_size, BytesPerWord)/BytesPerWord); } - int creation_mileage() const { return _compiler_counters.creation_mileage(); } + int creation_mileage() const { return _creation_mileage; } + void set_creation_mileage(int x) { _creation_mileage = x; } int invocation_count() { if (invocation_counter()->carry()) { diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 898c084b32831..4ae9f9c164975 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -44,8 +44,6 @@ compiler/ciReplay/TestSAServer.java 8029528 generic-all compiler/codecache/jmx/PoolsIndependenceTest.java 8167015 generic-all compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8225370 generic-all compiler/jvmci/compilerToVM/GetFlagValueTest.java 8204459 generic-all -compiler/jvmci/compilerToVM/IsMatureVsReprofileTest.java 8257919 generic-all -compiler/jvmci/compilerToVM/ReprofileTest.java 8257919 generic-all compiler/tiered/LevelTransitionTest.java 8067651 generic-all compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all From 2001da3dd4a2e5d5b391ce49c13d81cde5d6bdfa Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 11 Dec 2020 22:44:48 +0000 Subject: [PATCH 217/504] 8257596: Clarify trusted final fields for record classes Reviewed-by: hseigel, chegar, psandoz --- src/hotspot/share/oops/instanceKlass.cpp | 6 +++ src/hotspot/share/oops/instanceKlass.hpp | 2 +- src/hotspot/share/prims/jvm.cpp | 47 ++++++++++--------- .../share/classes/java/lang/Class.java | 20 +++++--- 4 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 0c54c2db4e0f4..6c783903ae4cf 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -739,6 +739,12 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) { } } +bool InstanceKlass::is_record() const { + return _record_components != NULL && + is_final() && + java_super() == SystemDictionary::Record_klass(); +} + bool InstanceKlass::is_sealed() const { return _permitted_subclasses != NULL && _permitted_subclasses != Universe::the_empty_short_array(); diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 5e1da7c4f95f5..676efd90ddadb 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -473,7 +473,7 @@ class InstanceKlass: public Klass { void set_record_components(Array* record_components) { _record_components = record_components; } - bool is_record() const { return _record_components != NULL; } + bool is_record() const; // permitted subclasses Array* permitted_subclasses() const { return _permitted_subclasses; } diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 8f9464add4fc4..01ac5905a5174 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -1851,6 +1851,9 @@ JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, } JVM_END + +// A class is a record if and only if it is final and a direct subclass of +// java.lang.Record and has a Record attribute; otherwise, it is not a record. JVM_ENTRY(jboolean, JVM_IsRecord(JNIEnv *env, jclass cls)) { JVMWrapper("JVM_IsRecord"); @@ -1864,6 +1867,11 @@ JVM_ENTRY(jboolean, JVM_IsRecord(JNIEnv *env, jclass cls)) } JVM_END +// Returns an array containing the components of the Record attribute, +// or NULL if the attribute is not present. +// +// Note that this function returns the components of the Record attribute +// even if the class is not a record. JVM_ENTRY(jobjectArray, JVM_GetRecordComponents(JNIEnv* env, jclass ofClass)) { JVMWrapper("JVM_GetRecordComponents"); @@ -1871,31 +1879,26 @@ JVM_ENTRY(jobjectArray, JVM_GetRecordComponents(JNIEnv* env, jclass ofClass)) assert(c->is_instance_klass(), "must be"); InstanceKlass* ik = InstanceKlass::cast(c); - if (ik->is_record()) { - Array* components = ik->record_components(); - assert(components != NULL, "components should not be NULL"); - { - JvmtiVMObjectAllocEventCollector oam; - constantPoolHandle cp(THREAD, ik->constants()); - int length = components->length(); - assert(length >= 0, "unexpected record_components length"); - objArrayOop record_components = - oopFactory::new_objArray(SystemDictionary::RecordComponent_klass(), length, CHECK_NULL); - objArrayHandle components_h (THREAD, record_components); - - for (int x = 0; x < length; x++) { - RecordComponent* component = components->at(x); - assert(component != NULL, "unexpected NULL record component"); - oop component_oop = java_lang_reflect_RecordComponent::create(ik, component, CHECK_NULL); - components_h->obj_at_put(x, component_oop); - } - return (jobjectArray)JNIHandles::make_local(THREAD, components_h()); + Array* components = ik->record_components(); + if (components != NULL) { + JvmtiVMObjectAllocEventCollector oam; + constantPoolHandle cp(THREAD, ik->constants()); + int length = components->length(); + assert(length >= 0, "unexpected record_components length"); + objArrayOop record_components = + oopFactory::new_objArray(SystemDictionary::RecordComponent_klass(), length, CHECK_NULL); + objArrayHandle components_h (THREAD, record_components); + + for (int x = 0; x < length; x++) { + RecordComponent* component = components->at(x); + assert(component != NULL, "unexpected NULL record component"); + oop component_oop = java_lang_reflect_RecordComponent::create(ik, component, CHECK_NULL); + components_h->obj_at_put(x, component_oop); } + return (jobjectArray)JNIHandles::make_local(THREAD, components_h()); } - // Return empty array if ofClass is not a record. - objArrayOop result = oopFactory::new_objArray(SystemDictionary::RecordComponent_klass(), 0, CHECK_NULL); - return (jobjectArray)JNIHandles::make_local(THREAD, result); + return NULL; } JVM_END diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 5157704445564..16d5dc6e5dc6b 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -2383,11 +2383,7 @@ public RecordComponent[] getRecordComponents() { if (!isRecord()) { return null; } - RecordComponent[] recordComponents = getRecordComponents0(); - if (recordComponents == null) { - return new RecordComponent[0]; - } - return recordComponents; + return getRecordComponents0(); } /** @@ -3577,9 +3573,17 @@ private static Constructor[] copyConstructors(Constructor[] arg) { private native Field[] getDeclaredFields0(boolean publicOnly); private native Method[] getDeclaredMethods0(boolean publicOnly); private native Constructor[] getDeclaredConstructors0(boolean publicOnly); - private native Class[] getDeclaredClasses0(); + private native Class[] getDeclaredClasses0(); + + /* + * Returns an array containing the components of the Record attribute, + * or null if the attribute is not present. + * + * Note that this method returns non-null array on a class with + * the Record attribute even if this class is not a record. + */ private native RecordComponent[] getRecordComponents0(); - private native boolean isRecord0(); + private native boolean isRecord0(); /** * Helper method to get the method name from arguments. @@ -3706,6 +3710,8 @@ public boolean isEnum() { * @since 16 */ public boolean isRecord() { + // this superclass and final modifier check is not strictly necessary + // they are intrinsified and serve as a fast-path check return getSuperclass() == java.lang.Record.class && (this.getModifiers() & Modifier.FINAL) != 0 && isRecord0(); From 6d79ec87fbcff11374f6bc05b3a06e7cb5373c4e Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Sat, 12 Dec 2020 06:09:57 +0000 Subject: [PATCH 218/504] 8258111: Problemlist compiler/blackhole tests for -Xcomp until JDK-8258101 is fixed Reviewed-by: iignatyev, kvn --- test/hotspot/jtreg/ProblemList-Xcomp.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/hotspot/jtreg/ProblemList-Xcomp.txt b/test/hotspot/jtreg/ProblemList-Xcomp.txt index 35cc36d97e0ac..d69c9d02eb4ff 100644 --- a/test/hotspot/jtreg/ProblemList-Xcomp.txt +++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt @@ -28,3 +28,26 @@ ############################################################################# vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java 8205957 generic-all + +compiler/blackhole/BlackholeDiagnosticUnlockTest.java 8258101 generic-all +compiler/blackhole/BlackholeInstanceReturnTest.java#c1 8258101 generic-all +compiler/blackhole/BlackholeInstanceReturnTest.java#c1-no-coops 8258101 generic-all +compiler/blackhole/BlackholeInstanceReturnTest.java#c2 8258101 generic-all +compiler/blackhole/BlackholeInstanceReturnTest.java#c2-no-coops 8258101 generic-all +compiler/blackhole/BlackholeInstanceTest.java#c1 8258101 generic-all +compiler/blackhole/BlackholeInstanceTest.java#c1-no-coops 8258101 generic-all +compiler/blackhole/BlackholeInstanceTest.java#c2 8258101 generic-all +compiler/blackhole/BlackholeInstanceTest.java#c2-no-coops 8258101 generic-all +compiler/blackhole/BlackholeNonVoidWarningTest.java 8258101 generic-all +compiler/blackhole/BlackholeNullCheckTest.java#c1 8258101 generic-all +compiler/blackhole/BlackholeNullCheckTest.java#c1-no-coops 8258101 generic-all +compiler/blackhole/BlackholeNullCheckTest.java#c2 8258101 generic-all +compiler/blackhole/BlackholeNullCheckTest.java#c2-no-coops 8258101 generic-all +compiler/blackhole/BlackholeStaticReturnTest.java#c1 8258101 generic-all +compiler/blackhole/BlackholeStaticReturnTest.java#c1-no-coops 8258101 generic-all +compiler/blackhole/BlackholeStaticReturnTest.java#c2 8258101 generic-all +compiler/blackhole/BlackholeStaticReturnTest.java#c2-no-coops 8258101 generic-all +compiler/blackhole/BlackholeStaticTest.java#c1 8258101 generic-all +compiler/blackhole/BlackholeStaticTest.java#c1-no-coops 8258101 generic-all +compiler/blackhole/BlackholeStaticTest.java#c2 8258101 generic-all +compiler/blackhole/BlackholeStaticTest.java#c2-no-coops 8258101 generic-all From 43dc3f79923a70306eaf91f77392b7dbb99f1fd1 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Sun, 13 Dec 2020 19:17:36 +0000 Subject: [PATCH 219/504] 8254350: CompletableFuture.get may swallow InterruptedException Reviewed-by: alanb, dl --- .../util/concurrent/CompletableFuture.java | 18 ++-- .../CompletableFuture/LostInterrupt.java | 73 +++++++++++++++ .../SwallowedInterruptedException.java | 90 +++++++++++++++++++ 3 files changed, 173 insertions(+), 8 deletions(-) create mode 100644 test/jdk/java/util/concurrent/CompletableFuture/LostInterrupt.java create mode 100644 test/jdk/java/util/concurrent/CompletableFuture/SwallowedInterruptedException.java diff --git a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java index 2e704af9b957e..fbb34e84756d0 100644 --- a/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java +++ b/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java @@ -1871,6 +1871,8 @@ public boolean block() { * interrupted. */ private Object waitingGet(boolean interruptible) { + if (interruptible && Thread.interrupted()) + return null; Signaller q = null; boolean queued = false; Object r; @@ -1882,25 +1884,25 @@ private Object waitingGet(boolean interruptible) { } else if (!queued) queued = tryPushStack(q); + else if (interruptible && q.interrupted) { + q.thread = null; + cleanStack(); + return null; + } else { try { ForkJoinPool.managedBlock(q); } catch (InterruptedException ie) { // currently cannot happen q.interrupted = true; } - if (q.interrupted && interruptible) - break; } } - if (q != null && queued) { + if (q != null) { q.thread = null; - if (!interruptible && q.interrupted) + if (q.interrupted) Thread.currentThread().interrupt(); - if (r == null) - cleanStack(); } - if (r != null || (r = result) != null) - postComplete(); + postComplete(); return r; } diff --git a/test/jdk/java/util/concurrent/CompletableFuture/LostInterrupt.java b/test/jdk/java/util/concurrent/CompletableFuture/LostInterrupt.java new file mode 100644 index 0000000000000..0f5a462b630d1 --- /dev/null +++ b/test/jdk/java/util/concurrent/CompletableFuture/LostInterrupt.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2020, 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.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ThreadLocalRandom; +import static java.util.concurrent.TimeUnit.DAYS; + +/* + * @test + * @bug 8254350 + * @run main LostInterrupt + * @summary CompletableFuture.get may swallow interrupt status + * @key randomness + */ + +// TODO: Rewrite as a CompletableFuture tck test ? + +/** + * Submits a task that completes immediately, then invokes CompletableFuture.get + * with the interrupt status set. CompletableFuture.get should either complete + * immediately with the interrupt status set, or else throw InterruptedException + * with the interrupt status cleared. + */ +public class LostInterrupt { + static final int ITERATIONS = 10_000; + + public static void main(String[] args) throws Exception { + ThreadLocalRandom rnd = ThreadLocalRandom.current(); + ForkJoinPool executor = new ForkJoinPool(1); + try { + for (int i = 0; i < ITERATIONS; i++) { + CompletableFuture future = new CompletableFuture<>(); + boolean timed = rnd.nextBoolean(); + executor.execute(() -> future.complete("foo")); + + Thread.currentThread().interrupt(); + try { + String result = timed ? future.get(1, DAYS) : future.get(); + + if (!Thread.interrupted()) + throw new AssertionError("lost interrupt, run=" + i); + } catch (InterruptedException expected) { + if (Thread.interrupted()) + throw new AssertionError( + "interrupt status not cleared, run=" + i); + } + } + } finally { + executor.shutdown(); + } + } +} diff --git a/test/jdk/java/util/concurrent/CompletableFuture/SwallowedInterruptedException.java b/test/jdk/java/util/concurrent/CompletableFuture/SwallowedInterruptedException.java new file mode 100644 index 0000000000000..21097fb64c6c9 --- /dev/null +++ b/test/jdk/java/util/concurrent/CompletableFuture/SwallowedInterruptedException.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2020, 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.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicReference; + +/* + * @test + * @bug 8254350 + * @run main SwallowedInterruptedException + * @key randomness + */ + +public class SwallowedInterruptedException { + static final int ITERATIONS = 100; + + public static void main(String[] args) throws Throwable { + for (int i = 1; i <= ITERATIONS; i++) { + System.out.format("Iteration %d%n", i); + + CompletableFuture future = new CompletableFuture<>(); + CountDownLatch running = new CountDownLatch(1); + AtomicReference failed = new AtomicReference<>(); + + Thread thread = new Thread(() -> { + // signal main thread that child is running + running.countDown(); + + // invoke Future.get, it complete with the interrupt status set or + // else throw InterruptedException with the interrupt status not set. + try { + future.get(); + + // interrupt status should be set + if (!Thread.currentThread().isInterrupted()) { + failed.set("Future.get completed with interrupt status not set"); + } + } catch (InterruptedException ex) { + // interrupt status should be cleared + if (Thread.currentThread().isInterrupted()) { + failed.set("InterruptedException with interrupt status set"); + } + } catch (Throwable ex) { + failed.set("Unexpected exception " + ex); + } + }); + thread.setDaemon(true); + thread.start(); + + // wait for thread to run + running.await(); + + // interrupt thread and set result after an optional (random) delay + thread.interrupt(); + long sleepMillis = ThreadLocalRandom.current().nextLong(10); + if (sleepMillis > 0) + Thread.sleep(sleepMillis); + future.complete(null); + + // wait for thread to terminate and check for failure + thread.join(); + String failedReason = failed.get(); + if (failedReason != null) { + throw new RuntimeException("Test failed: " + failedReason); + } + } + } +} From e1182920db658a1999c00f315623c48776e52c13 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Mon, 14 Dec 2020 03:36:22 +0000 Subject: [PATCH 220/504] 8258040: Reenable fixed problemlisted test Reviewed-by: prr --- test/jdk/ProblemList.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index ed1f055eec9e1..e7cdacafbc382 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -745,7 +745,6 @@ javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all javax/swing/JPopupMenu/6580930/bug6580930.java 7124313 macosx-all javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all -javax/swing/JPopupMenu/6675802/bug6675802.java 8196097 windows-all javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all From c30fff7c329f1542c67df1500873ca663e7e3e70 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 14 Dec 2020 07:00:40 +0000 Subject: [PATCH 221/504] 8257229: gtest death tests fail with unrecognized stderr output Reviewed-by: coleenp, minqi --- test/hotspot/gtest/unittest.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/gtest/unittest.hpp b/test/hotspot/gtest/unittest.hpp index 8785f39873420..140d14d25f205 100644 --- a/test/hotspot/gtest/unittest.hpp +++ b/test/hotspot/gtest/unittest.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ TEST(category, CONCAT(name, _vm_assert)) { \ ASSERT_EXIT(child_ ## category ## _ ## name ## _(), \ ::testing::ExitedWithCode(1), \ - "^assert failed: " msg); \ + "assert failed: " msg); \ } \ \ void test_ ## category ## _ ## name ## _() From 164c8a6e1820056ab2a1056b534ac3b817314e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 14 Dec 2020 08:08:57 +0000 Subject: [PATCH 222/504] 8258092: Link to early access platform documentation in TestHtmlTableTags.java Reviewed-by: jjg --- .../testHtmlTableTags/TestHtmlTableTags.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java index 301669d2e30f9..17c653ac15dd8 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java @@ -51,6 +51,7 @@ public void test() { javadoc("-d", "out", "-sourcepath", testSrc, "-use", + "--no-platform-links", "pkg1", "pkg2"); checkExit(Exit.OK); @@ -66,6 +67,7 @@ public void testNoComment() { "-nocomment", "-sourcepath", testSrc, "-use", + "--no-platform-links", "pkg1", "pkg2"); checkExit(Exit.OK); @@ -683,12 +685,8 @@ void checkHtmlTableContents() { // Constant values checkOutput("constant-values.html", true, """ - - +
      public static final java.lang.String
      +
      "C1"
      """); @@ -814,12 +812,8 @@ void checkHtmlTableContentsNoComment() { // Constant values checkOutput("constant-values.html", true, """ -
      public s\ - tatic final String
      - +
      public static final java.lang.String
      +
      "C1"
      """); From 2ee795d9e495ea5cb6e1a41f48406291dc0e5e58 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Mon, 14 Dec 2020 11:34:39 +0000 Subject: [PATCH 223/504] 8196092: javax/swing/JComboBox/8032878/bug8032878.java fails Reviewed-by: serb, pbansal --- test/jdk/ProblemList.txt | 1 - .../swing/JComboBox/8032878/bug8032878.java | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index e7cdacafbc382..bf23ede62a41b 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -738,7 +738,6 @@ javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all -javax/swing/JComboBox/8032878/bug8032878.java 8196092,8196439 windows-all,macosx-all,linux-all javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all diff --git a/test/jdk/javax/swing/JComboBox/8032878/bug8032878.java b/test/jdk/javax/swing/JComboBox/8032878/bug8032878.java index 195bb4d4afb43..84607d0ea4810 100644 --- a/test/jdk/javax/swing/JComboBox/8032878/bug8032878.java +++ b/test/jdk/javax/swing/JComboBox/8032878/bug8032878.java @@ -28,9 +28,6 @@ * @summary Checks that JComboBox as JTable cell editor processes key events * even where setSurrendersFocusOnKeystroke flag in JTable is false and * that it does not lose the first key press where the flag is true. - * @library ../../regtesthelpers - * @build Util - * @author Alexey Ivanov * @run main bug8032878 */ @@ -86,6 +83,7 @@ private void setupUI() { frame.pack(); frame.setVisible(true); + frame.setLocationRelativeTo(null); } private void test(final boolean flag) throws Exception { @@ -93,11 +91,13 @@ private void test(final boolean flag) throws Exception { surrender = flag; SwingUtilities.invokeAndWait(this); + robot.waitForIdle(); + robot.delay(1000); runTest(); checkResult(); } finally { if (frame != null) { - frame.dispose(); + SwingUtilities.invokeAndWait(() -> frame.dispose()); } } } @@ -105,12 +105,20 @@ private void test(final boolean flag) throws Exception { private void runTest() throws Exception { robot.waitForIdle(); // Select 'one' - Util.hitKeys(robot, KeyEvent.VK_TAB); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); robot.waitForIdle(); - Util.hitKeys(robot, KeyEvent.VK_1); - Util.hitKeys(robot, KeyEvent.VK_2); - Util.hitKeys(robot, KeyEvent.VK_3); - Util.hitKeys(robot, KeyEvent.VK_ENTER); + robot.keyPress(KeyEvent.VK_1); + robot.keyRelease(KeyEvent.VK_1); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_2); + robot.keyRelease(KeyEvent.VK_2); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_3); + robot.keyRelease(KeyEvent.VK_3); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); robot.waitForIdle(); } From afc44414d551d9fc342a733651777227f2f95eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Mon, 14 Dec 2020 11:36:01 +0000 Subject: [PATCH 224/504] 8258094: AIX build fails after 8257602 Reviewed-by: rrich, stuefe, egahlin --- src/hotspot/share/gc/shared/allocTracer.cpp | 83 +------------ .../share/jfr/support/jfrAllocationTracer.cpp | 4 +- .../share/jfr/support/jfrAllocationTracer.hpp | 4 +- .../jfr/support/jfrObjectAllocationSample.cpp | 113 ++++++++++++++++++ .../jfr/support/jfrObjectAllocationSample.hpp | 38 ++++++ 5 files changed, 159 insertions(+), 83 deletions(-) create mode 100644 src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp create mode 100644 src/hotspot/share/jfr/support/jfrObjectAllocationSample.hpp diff --git a/src/hotspot/share/gc/shared/allocTracer.cpp b/src/hotspot/share/gc/shared/allocTracer.cpp index 9de1d5bd3e99c..9687992042311 100644 --- a/src/hotspot/share/gc/shared/allocTracer.cpp +++ b/src/hotspot/share/gc/shared/allocTracer.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "gc/shared/allocTracer.hpp" -#include "gc/shared/threadLocalAllocBuffer.inline.hpp" #include "jfr/jfrEvents.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" @@ -32,91 +31,18 @@ #include "jfr/support/jfrAllocationTracer.hpp" #endif -static THREAD_LOCAL int64_t _last_allocated_bytes = 0; - -inline void send_allocation_sample(const Klass* klass, int64_t allocated_bytes) { - assert(allocated_bytes > 0, "invariant"); - EventObjectAllocationSample event; - if (event.should_commit()) { - const size_t weight = allocated_bytes - _last_allocated_bytes; - assert(weight > 0, "invariant"); - event.set_objectClass(klass); - event.set_weight(weight); - event.commit(); - _last_allocated_bytes = allocated_bytes; - } -} - -inline bool send_allocation_sample_with_result(const Klass* klass, int64_t allocated_bytes) { - assert(allocated_bytes > 0, "invariant"); - EventObjectAllocationSample event; - if (event.should_commit()) { - const size_t weight = allocated_bytes - _last_allocated_bytes; - assert(weight > 0, "invariant"); - event.set_objectClass(klass); - event.set_weight(weight); - event.commit(); - _last_allocated_bytes = allocated_bytes; - return true; - } - return false; -} - -inline intptr_t estimate_tlab_size_bytes(Thread* thread) { - assert(thread != NULL, "invariant"); - const size_t desired_tlab_size_bytes = thread->tlab().desired_size() * HeapWordSize; - const size_t alignment_reserve_bytes = thread->tlab().alignment_reserve_in_bytes(); - assert(desired_tlab_size_bytes > alignment_reserve_bytes, "invariant"); - return static_cast(desired_tlab_size_bytes - alignment_reserve_bytes); -} - -inline int64_t load_allocated_bytes(Thread* thread) { - const int64_t allocated_bytes = thread->allocated_bytes(); - if (allocated_bytes < _last_allocated_bytes) { - // A hw thread can detach and reattach to the VM, and when it does, - // it gets a new JavaThread representation. The thread local variable - // tracking _last_allocated_bytes is mapped to the existing hw thread, - // so it needs to be reset. - _last_allocated_bytes = 0; - } - return allocated_bytes == _last_allocated_bytes ? 0 : allocated_bytes; -} - -// To avoid large objects from being undersampled compared to the regular TLAB samples, -// the data amount is normalized as if it was a TLAB, giving a number of TLAB sampling attempts to the large object. -static void normalize_as_tlab_and_send_allocation_samples(Klass* klass, intptr_t obj_alloc_size_bytes, Thread* thread) { - const int64_t allocated_bytes = load_allocated_bytes(thread); - assert(allocated_bytes > 0, "invariant"); // obj_alloc_size_bytes is already attributed to allocated_bytes at this point. - if (!UseTLAB) { - send_allocation_sample(klass, allocated_bytes); - return; - } - const intptr_t tlab_size_bytes = estimate_tlab_size_bytes(thread); - if (allocated_bytes - _last_allocated_bytes < tlab_size_bytes) { - return; - } - assert(obj_alloc_size_bytes > 0, "invariant"); - do { - if (send_allocation_sample_with_result(klass, allocated_bytes)) { - return; - } - obj_alloc_size_bytes -= tlab_size_bytes; - } while (obj_alloc_size_bytes > 0); -} - void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread) { - JFR_ONLY(JfrAllocationTracer tracer(obj, alloc_size, thread);) + JFR_ONLY(JfrAllocationTracer tracer(klass, obj, alloc_size, true, thread);) EventObjectAllocationOutsideTLAB event; if (event.should_commit()) { event.set_objectClass(klass); event.set_allocationSize(alloc_size); event.commit(); } - normalize_as_tlab_and_send_allocation_samples(klass, static_cast(alloc_size), thread); } void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread) { - JFR_ONLY(JfrAllocationTracer tracer(obj, alloc_size, thread);) + JFR_ONLY(JfrAllocationTracer tracer(klass, obj, alloc_size, false, thread);) EventObjectAllocationInNewTLAB event; if (event.should_commit()) { event.set_objectClass(klass); @@ -124,11 +50,6 @@ void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_ event.set_tlabSize(tlab_size); event.commit(); } - const int64_t allocated_bytes = load_allocated_bytes(thread); - if (allocated_bytes == 0) { - return; - } - send_allocation_sample(klass, allocated_bytes); } void AllocTracer::send_allocation_requiring_gc_event(size_t size, uint gcId) { diff --git a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp index 4c852faaa862a..5f62f3e374010 100644 --- a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp +++ b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp @@ -25,10 +25,12 @@ #include "precompiled.hpp" #include "jfr/leakprofiler/leakProfiler.hpp" #include "jfr/support/jfrAllocationTracer.hpp" +#include "jfr/support/jfrObjectAllocationSample.hpp" #include "jfr/support/jfrThreadLocal.hpp" #include "runtime/thread.hpp" -JfrAllocationTracer::JfrAllocationTracer(HeapWord* obj, size_t alloc_size, Thread* thread) : _tl(NULL) { +JfrAllocationTracer::JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread) : _tl(NULL) { + JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread); if (LeakProfiler::is_running()) { _tl = thread->jfr_thread_local(); LeakProfiler::sample(obj, alloc_size, thread->as_Java_thread()); diff --git a/src/hotspot/share/jfr/support/jfrAllocationTracer.hpp b/src/hotspot/share/jfr/support/jfrAllocationTracer.hpp index 651bce8c9e7a5..8d443e36aa50e 100644 --- a/src/hotspot/share/jfr/support/jfrAllocationTracer.hpp +++ b/src/hotspot/share/jfr/support/jfrAllocationTracer.hpp @@ -27,13 +27,15 @@ #include "memory/allocation.hpp" +class Klass; class JfrThreadLocal; +class Thread; class JfrAllocationTracer : public StackObj { private: JfrThreadLocal* _tl; public: - JfrAllocationTracer(HeapWord* obj, size_t alloc_size, Thread* thread); + JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread); ~JfrAllocationTracer(); }; diff --git a/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp new file mode 100644 index 0000000000000..ae45a8f124f44 --- /dev/null +++ b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.cpp @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2020, 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. +* +*/ + +#include "precompiled.hpp" +#include "gc/shared/threadLocalAllocBuffer.inline.hpp" +#include "jfr/jfrEvents.hpp" +#include "jfr/support/jfrObjectAllocationSample.hpp" +#include "utilities/globalDefinitions.hpp" + +static THREAD_LOCAL int64_t _last_allocated_bytes = 0; + +inline void send_allocation_sample(const Klass* klass, int64_t allocated_bytes) { + assert(allocated_bytes > 0, "invariant"); + EventObjectAllocationSample event; + if (event.should_commit()) { + const size_t weight = allocated_bytes - _last_allocated_bytes; + assert(weight > 0, "invariant"); + event.set_objectClass(klass); + event.set_weight(weight); + event.commit(); + _last_allocated_bytes = allocated_bytes; + } +} + +inline bool send_allocation_sample_with_result(const Klass* klass, int64_t allocated_bytes) { + assert(allocated_bytes > 0, "invariant"); + EventObjectAllocationSample event; + if (event.should_commit()) { + const size_t weight = allocated_bytes - _last_allocated_bytes; + assert(weight > 0, "invariant"); + event.set_objectClass(klass); + event.set_weight(weight); + event.commit(); + _last_allocated_bytes = allocated_bytes; + return true; + } + return false; +} + +inline intptr_t estimate_tlab_size_bytes(Thread* thread) { + const size_t desired_tlab_size_bytes = thread->tlab().desired_size() * HeapWordSize; + const size_t alignment_reserve_bytes = thread->tlab().alignment_reserve_in_bytes(); + assert(desired_tlab_size_bytes > alignment_reserve_bytes, "invariant"); + return static_cast(desired_tlab_size_bytes - alignment_reserve_bytes); +} + +inline int64_t load_allocated_bytes(Thread* thread) { + assert(thread != NULL, "invariant"); + const int64_t allocated_bytes = thread->allocated_bytes(); + if (allocated_bytes < _last_allocated_bytes) { + // A hw thread can detach and reattach to the VM, and when it does, + // it gets a new JavaThread representation. The thread local variable + // tracking _last_allocated_bytes is mapped to the existing hw thread, + // so it needs to be reset. + _last_allocated_bytes = 0; + } + return allocated_bytes == _last_allocated_bytes ? 0 : allocated_bytes; +} + +// To avoid large objects from being undersampled compared to the regular TLAB samples, +// the data amount is normalized as if it was a TLAB, giving a number of TLAB sampling attempts to the large object. +static void normalize_as_tlab_and_send_allocation_samples(const Klass* klass, intptr_t obj_alloc_size_bytes, Thread* thread) { + const int64_t allocated_bytes = load_allocated_bytes(thread); + assert(allocated_bytes > 0, "invariant"); // obj_alloc_size_bytes is already attributed to allocated_bytes at this point. + if (!UseTLAB) { + send_allocation_sample(klass, allocated_bytes); + return; + } + const intptr_t tlab_size_bytes = estimate_tlab_size_bytes(thread); + if (allocated_bytes - _last_allocated_bytes < tlab_size_bytes) { + return; + } + assert(obj_alloc_size_bytes > 0, "invariant"); + do { + if (send_allocation_sample_with_result(klass, allocated_bytes)) { + return; + } + obj_alloc_size_bytes -= tlab_size_bytes; + } while (obj_alloc_size_bytes > 0); +} + +void JfrObjectAllocationSample::send_event(const Klass* klass, size_t alloc_size, bool outside_tlab, Thread* thread) { + if (outside_tlab) { + normalize_as_tlab_and_send_allocation_samples(klass, static_cast(alloc_size), thread); + return; + } + const int64_t allocated_bytes = load_allocated_bytes(thread); + if (allocated_bytes == 0) { + return; + } + send_allocation_sample(klass, allocated_bytes); +} diff --git a/src/hotspot/share/jfr/support/jfrObjectAllocationSample.hpp b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.hpp new file mode 100644 index 0000000000000..0902db68f5b4e --- /dev/null +++ b/src/hotspot/share/jfr/support/jfrObjectAllocationSample.hpp @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2020, 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. +* +*/ + +#ifndef SHARE_JFR_SUPPORT_JFROBJECTALLOCATIONSAMPLE_HPP +#define SHARE_JFR_SUPPORT_JFROBJECTALLOCATIONSAMPLE_HPP + +#include "memory/allocation.hpp" + +class Klass; +class Thread; + +class JfrObjectAllocationSample : AllStatic { + friend class JfrAllocationTracer; + static void send_event(const Klass* klass, size_t alloc_size, bool outside_tlab, Thread* thread); +}; + +#endif // SHARE_JFR_SUPPORT_JFROBJECTALLOCATIONSAMPLE_HPP From e69ae07f085466d8dcfab574da0bdfd880686dba Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Mon, 14 Dec 2020 11:59:05 +0000 Subject: [PATCH 225/504] 8257985: count_trailing_zeros doesn't handle 64-bit values on 32-bit JVM Reviewed-by: kbarrett --- .../share/utilities/count_trailing_zeros.hpp | 56 +++++++++++++------ .../utilities/test_count_trailing_zeros.cpp | 54 +++++++++++++++--- 2 files changed, 85 insertions(+), 25 deletions(-) diff --git a/src/hotspot/share/utilities/count_trailing_zeros.hpp b/src/hotspot/share/utilities/count_trailing_zeros.hpp index b931c3283dd1d..b9e55d0fa2453 100644 --- a/src/hotspot/share/utilities/count_trailing_zeros.hpp +++ b/src/hotspot/share/utilities/count_trailing_zeros.hpp @@ -25,14 +25,18 @@ #ifndef SHARE_UTILITIES_COUNT_TRAILING_ZEROS_HPP #define SHARE_UTILITIES_COUNT_TRAILING_ZEROS_HPP +#include "metaprogramming/enableIf.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" -// unsigned count_trailing_zeros(uintx x) +// unsigned count_trailing_zeros(T x) + // Return the number of trailing zeros in x, e.g. the zero-based index // of the least significant set bit in x. // Precondition: x != 0. +// We implement and support variants for 8, 16, 32 and 64 bit integral types. + // Dispatch on toolchain to select implementation. /***************************************************************************** @@ -40,10 +44,12 @@ *****************************************************************************/ #if defined(TARGET_COMPILER_gcc) -inline unsigned count_trailing_zeros(uintx x) { - STATIC_ASSERT(sizeof(unsigned long) == sizeof(uintx)); - assert(x != 0, "precondition"); - return __builtin_ctzl(x); +inline unsigned count_trailing_zeros_32(uint32_t x) { + return __builtin_ctz(x); +} + +inline unsigned count_trailing_zeros_64(uint64_t x) { + return __builtin_ctzll(x); } /***************************************************************************** @@ -53,19 +59,27 @@ inline unsigned count_trailing_zeros(uintx x) { #include +#pragma intrinsic(_BitScanForward) #ifdef _LP64 #pragma intrinsic(_BitScanForward64) -#else -#pragma intrinsic(_BitScanForward) #endif -inline unsigned count_trailing_zeros(uintx x) { - assert(x != 0, "precondition"); +inline unsigned count_trailing_zeros_32(uint32_t x) { + unsigned long index; + _BitScanForward(&index, x); + return index; +} + +inline unsigned count_trailing_zeros_64(uint64_t x) { unsigned long index; #ifdef _LP64 _BitScanForward64(&index, x); #else - _BitScanForward(&index, x); + if (_BitScanForward(&index, static_cast(x)) == 0) { + // no bit found? If so, try the upper dword. Otherwise index already contains the result + _BitScanForward(&index, static_cast(x >> 32)); + index += 32; + } #endif return index; } @@ -77,13 +91,12 @@ inline unsigned count_trailing_zeros(uintx x) { #include -inline unsigned count_trailing_zeros(uintx x) { - assert(x != 0, "precondition"); -#ifdef _LP64 - return __cnttz8(x); -#else +inline unsigned count_trailing_zeros_32(uint32_t x) { return __cnttz4(x); -#endif +} + +inline unsigned count_trailing_zeros_64(uint64_t x) { + return __cnttz8(x); } /***************************************************************************** @@ -94,4 +107,15 @@ inline unsigned count_trailing_zeros(uintx x) { #endif // Toolchain dispatch +template::value), + ENABLE_IF(sizeof(T) <= sizeof(uint64_t))> +inline unsigned count_trailing_zeros(T x) { + assert(x != 0, "precondition"); + return (sizeof(x) <= sizeof(uint32_t)) ? + count_trailing_zeros_32(static_cast(x)) : + count_trailing_zeros_64(x); +} + + #endif // SHARE_UTILITIES_COUNT_TRAILING_ZEROS_HPP diff --git a/test/hotspot/gtest/utilities/test_count_trailing_zeros.cpp b/test/hotspot/gtest/utilities/test_count_trailing_zeros.cpp index 5cf9176d82fec..6bcdfbc70f0d5 100644 --- a/test/hotspot/gtest/utilities/test_count_trailing_zeros.cpp +++ b/test/hotspot/gtest/utilities/test_count_trailing_zeros.cpp @@ -27,31 +27,67 @@ #include "utilities/globalDefinitions.hpp" #include "unittest.hpp" -TEST(count_trailing_zeros, one_or_two_set_bits) { + +template static void test_one_or_two_set_bits() { unsigned i = 0; // Position of a set bit. - for (uintx ix = 1; ix != 0; ix <<= 1, ++i) { + unsigned max = sizeof(T) * BitsPerByte; + for (T ix = T(1); i < max; ix <<= 1, ++i) { unsigned j = 0; // Position of a set bit. - for (uintx jx = 1; jx != 0; jx <<= 1, ++j) { - uintx value = ix | jx; + for (T jx = T(1); j < max; jx <<= 1, ++j) { + T value = ix | jx; EXPECT_EQ(MIN2(i, j), count_trailing_zeros(value)) << "value = " << value; } } } -TEST(count_trailing_zeros, high_zeros_low_ones) { - uintx value = ~(uintx)0; +TEST(count_trailing_zeros, one_or_two_set_bits) { + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); + test_one_or_two_set_bits(); +} + +template static void test_high_zeros_low_ones() { + T value = std::numeric_limits::max(); for ( ; value != 0; value >>= 1) { EXPECT_EQ(0u, count_trailing_zeros(value)) << "value = " << value; } } -TEST(count_trailing_zeros, high_ones_low_zeros) { +TEST(count_trailing_zeros, high_zeros_low_ones) { + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); + test_high_zeros_low_ones(); +} + +template static void test_high_ones_low_zeros() { unsigned i = 0; // Index of least significant set bit. - uintx value = ~(uintx)0; - for ( ; value != 0; value <<= 1, ++i) { + T value = ~T(0); + unsigned max = sizeof(T) * BitsPerByte; + for ( ; i < max; value <<= 1, ++i) { EXPECT_EQ(i, count_trailing_zeros(value)) << "value = " << value; } } + +TEST(count_trailing_zeros, high_ones_low_zeros) { + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); + test_high_ones_low_zeros(); +} From 15481041e0636291cc3516a48c9250d77ded2594 Mon Sep 17 00:00:00 2001 From: Sergey Tsypanov Date: Mon, 14 Dec 2020 13:03:55 +0000 Subject: [PATCH 226/504] 8255477: Remove unused method URL.set(String protocol, String host, int port, String file, String ref) Reviewed-by: dfuchs --- src/java.base/share/classes/java/net/URL.java | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/src/java.base/share/classes/java/net/URL.java b/src/java.base/share/classes/java/net/URL.java index 0f30537149796..77660d6ff101b 100644 --- a/src/java.base/share/classes/java/net/URL.java +++ b/src/java.base/share/classes/java/net/URL.java @@ -774,39 +774,6 @@ private void checkSpecifyHandler(SecurityManager sm) { sm.checkPermission(SecurityConstants.SPECIFY_HANDLER_PERMISSION); } - /** - * Sets the fields of the URL. This is not a public method so that - * only URLStreamHandlers can modify URL fields. URLs are - * otherwise constant. - * - * @param protocol the name of the protocol to use - * @param host the name of the host - * @param port the port number on the host - * @param file the file on the host - * @param ref the internal reference in the URL - */ - void set(String protocol, String host, int port, - String file, String ref) { - synchronized (this) { - this.protocol = protocol; - this.host = host; - authority = port == -1 ? host : host + ":" + port; - this.port = port; - this.file = file; - this.ref = ref; - /* This is very important. We must recompute this after the - * URL has been changed. */ - hashCode = -1; - hostAddress = null; - int q = file.lastIndexOf('?'); - if (q != -1) { - query = file.substring(q+1); - path = file.substring(0, q); - } else - path = file; - } - } - /** * Sets the specified 8 fields of the URL. This is not a public method so * that only URLStreamHandlers can modify URL fields. URLs are otherwise From e8c40bafa51ed73247d2a03a8411cbcb0cdf4efa Mon Sep 17 00:00:00 2001 From: Anton Litvinov Date: Mon, 14 Dec 2020 14:36:15 +0000 Subject: [PATCH 227/504] 8255880: UI of Swing components is not redrawn after their internal state changed Reviewed-by: prr, serb --- .../unix/classes/sun/awt/X11/XFramePeer.java | 7 + ...epaintOnFrameIconifiedStateChangeTest.java | 192 ++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 test/jdk/javax/swing/JFrame/8255880/RepaintOnFrameIconifiedStateChangeTest.java diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java index aa1bc2dc83c16..2512feec94502 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XFramePeer.java @@ -341,6 +341,13 @@ public void handlePropertyNotify(XEvent xev) { } } handleStateChange(old_state, state); + + // RepaintManager does not repaint iconified windows. Window needs to be + // repainted explicitly, when it is deiconified. + if (((changed & Frame.ICONIFIED) != 0) && + ((state & Frame.ICONIFIED) == 0)) { + repaint(); + } } // NOTE: This method may be called by privileged threads. diff --git a/test/jdk/javax/swing/JFrame/8255880/RepaintOnFrameIconifiedStateChangeTest.java b/test/jdk/javax/swing/JFrame/8255880/RepaintOnFrameIconifiedStateChangeTest.java new file mode 100644 index 0000000000000..5987510e88f7e --- /dev/null +++ b/test/jdk/javax/swing/JFrame/8255880/RepaintOnFrameIconifiedStateChangeTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2020, 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 8255880 + @key headful + @summary Swing components, whose internal state changed while a frame was + iconified, are not redrawn after the frame becomes deiconified. + */ + +import java.awt.AWTException; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Robot; +import java.awt.Toolkit; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.plaf.metal.MetalLookAndFeel; + +public class RepaintOnFrameIconifiedStateChangeTest { + private static final String[][] strsForComps = new String[][] { + {"JLabel AAA", "JLabel BBB"}, + {"JButton AAA", "JButton BBB"}}; + private static final int lblIndex = 0; + private static final int btnIndex = 1; + + private static volatile JFrame frame; + private static volatile JLabel label; + private static volatile JButton button; + private static volatile JComponent[] comps = new JComponent[2]; + private static volatile boolean[] compRedrawn = new boolean[2]; + private static volatile boolean compRedrawnFlagCanBeSet = false; + + public static void main(String[] args) { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (!toolkit.isFrameStateSupported(JFrame.ICONIFIED) || + !toolkit.isFrameStateSupported(JFrame.NORMAL)) { + System.out.println("ICONIFIED or NORMAL frame states are not" + + "supported by a toolkit."); + return; + } + + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + System.out.println("Creating GUI..."); + createGUI(); + } + }); + Robot robot = new Robot(); + robot.delay(2000); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + System.out.println("Minimizing the frame..."); + frame.setExtendedState(JFrame.ICONIFIED); + } + }); + robot.delay(2000); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + System.out.println("Changing states of components..."); + label.setText(strsForComps[lblIndex][1]); + button.setText(strsForComps[btnIndex][1]); + } + }); + robot.delay(2000); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + System.out.println("Restoring the frame..."); + for (int i = 0; i < compRedrawn.length; i++) { + compRedrawn[i] = false; + } + compRedrawnFlagCanBeSet = true; + + frame.setExtendedState(JFrame.NORMAL); + frame.toFront(); + } + }); + robot.delay(2000); + + int notRedrawnCompsCount = 0; + for (int i = 0; i < compRedrawn.length; i++) { + if (!compRedrawn[i]) { + notRedrawnCompsCount++; + System.out.println(String.format( + "Not redrawn component #%d: '%s'", i, comps[i])); + } + } + if (notRedrawnCompsCount > 0) { + throw new RuntimeException(String.format( + "'%d' components were not redrawn.", + notRedrawnCompsCount)); + } + System.out.println("Test passed."); + } catch (InterruptedException | InvocationTargetException | + AWTException e) { + throw new RuntimeException(e); + } finally { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + if (frame != null) { + frame.dispose(); + frame = null; + } + } + }); + } catch (InterruptedException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + + private static void createGUI() { + if (!(UIManager.getLookAndFeel() instanceof MetalLookAndFeel)) { + try { + UIManager.setLookAndFeel(new MetalLookAndFeel()); + } catch (UnsupportedLookAndFeelException ulafe) { + throw new RuntimeException(ulafe); + } + } + + frame = new JFrame("RepaintOnFrameIconifiedStateChangeTest"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + Container content = frame.getContentPane(); + content.setLayout(new FlowLayout()); + + comps[lblIndex] = label = new JLabel(strsForComps[lblIndex][0]) { + @Override + public void paint(Graphics g) { + super.paint(g); + if (compRedrawnFlagCanBeSet) { + compRedrawn[lblIndex] = true; + } + } + }; + label.setPreferredSize(new Dimension(150, 50)); + content.add(label); + + comps[btnIndex] = button = new JButton(strsForComps[btnIndex][0]) { + @Override + public void paint(Graphics g) { + super.paint(g); + if (compRedrawnFlagCanBeSet) { + compRedrawn[btnIndex] = true; + } + } + }; + button.setPreferredSize(new Dimension(200, 50)); + button.setFocusable(false); + content.add(button); + + frame.pack(); + frame.setVisible(true); + } +} From 1ff0f1673d582638bc93797c480fd94bd28ea1b9 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 14 Dec 2020 16:13:23 +0000 Subject: [PATCH 228/504] 8258142: Simplify G1RedirtyCardsQueue Separate local redirty qset from redirty queue. Reviewed-by: tschatzl, iwalulya --- src/hotspot/share/gc/g1/g1EvacFailure.cpp | 9 +++- .../share/gc/g1/g1ParScanThreadState.cpp | 4 +- .../share/gc/g1/g1ParScanThreadState.hpp | 1 + .../share/gc/g1/g1RedirtyCardsQueue.cpp | 42 +++++++-------- .../share/gc/g1/g1RedirtyCardsQueue.hpp | 54 ++++++------------- 5 files changed, 47 insertions(+), 63 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1EvacFailure.cpp b/src/hotspot/share/gc/g1/g1EvacFailure.cpp index 7c850249b100b..0d2175ee2165c 100644 --- a/src/hotspot/share/gc/g1/g1EvacFailure.cpp +++ b/src/hotspot/share/gc/g1/g1EvacFailure.cpp @@ -199,6 +199,7 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { G1CollectedHeap* _g1h; uint _worker_id; + G1RedirtyCardsLocalQueueSet _rdc_local_qset; G1RedirtyCardsQueue _rdcq; UpdateLogBuffersDeferred _log_buffer_cl; @@ -206,10 +207,16 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { RemoveSelfForwardPtrHRClosure(G1RedirtyCardsQueueSet* rdcqs, uint worker_id) : _g1h(G1CollectedHeap::heap()), _worker_id(worker_id), - _rdcq(rdcqs), + _rdc_local_qset(rdcqs), + _rdcq(&_rdc_local_qset), _log_buffer_cl(&_rdcq) { } + ~RemoveSelfForwardPtrHRClosure() { + _rdcq.flush(); + _rdc_local_qset.flush(); + } + size_t remove_self_forward_ptr_by_walking_hr(HeapRegion* hr, bool during_concurrent_start) { RemoveSelfForwardPtrObjClosure rspc(hr, diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index c9ca7daed3204..b9221ba9d6b1e 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -58,7 +58,8 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, size_t optional_cset_length) : _g1h(g1h), _task_queue(g1h->task_queue(worker_id)), - _rdcq(rdcqs), + _rdc_local_qset(rdcqs), + _rdcq(&_rdc_local_qset), _ct(g1h->card_table()), _closures(NULL), _plab_allocator(NULL), @@ -114,6 +115,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, size_t G1ParScanThreadState::flush(size_t* surviving_young_words) { _rdcq.flush(); + _rdc_local_qset.flush(); flush_numa_stats(); // Update allocation statistics. _plab_allocator->flush_and_retire_stats(); diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp index 8b1c1b657001b..784b3b3aa695b 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp @@ -48,6 +48,7 @@ class outputStream; class G1ParScanThreadState : public CHeapObj { G1CollectedHeap* _g1h; G1ScannerTasksQueue* _task_queue; + G1RedirtyCardsLocalQueueSet _rdc_local_qset; G1RedirtyCardsQueue _rdcq; G1CardTable* _ct; G1EvacuationRootClosures* _closures; diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp index b62c236141cb2..d03c15bcb5de9 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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,19 +30,21 @@ // G1RedirtyCardsQueueBase::LocalQSet -G1RedirtyCardsQueueBase::LocalQSet::LocalQSet(G1RedirtyCardsQueueSet* shared_qset) : +G1RedirtyCardsLocalQueueSet::G1RedirtyCardsLocalQueueSet(G1RedirtyCardsQueueSet* shared_qset) : PtrQueueSet(shared_qset->allocator()), _shared_qset(shared_qset), _buffers() {} -G1RedirtyCardsQueueBase::LocalQSet::~LocalQSet() { +#ifdef ASSERT +G1RedirtyCardsLocalQueueSet::~G1RedirtyCardsLocalQueueSet() { assert(_buffers._head == NULL, "unflushed qset"); assert(_buffers._tail == NULL, "invariant"); assert(_buffers._entry_count == 0, "invariant"); } +#endif // ASSERT -void G1RedirtyCardsQueueBase::LocalQSet::enqueue_completed_buffer(BufferNode* node) { +void G1RedirtyCardsLocalQueueSet::enqueue_completed_buffer(BufferNode* node) { _buffers._entry_count += buffer_size() - node->index(); node->set_next(_buffers._head); _buffers._head = node; @@ -51,26 +53,22 @@ void G1RedirtyCardsQueueBase::LocalQSet::enqueue_completed_buffer(BufferNode* no } } -G1BufferNodeList G1RedirtyCardsQueueBase::LocalQSet::take_all_completed_buffers() { - G1BufferNodeList result = _buffers; +void G1RedirtyCardsLocalQueueSet::flush() { + _shared_qset->add_bufferlist(_buffers); _buffers = G1BufferNodeList(); - return result; -} - -void G1RedirtyCardsQueueBase::LocalQSet::flush() { - _shared_qset->merge_bufferlist(this); } // G1RedirtyCardsQueue -G1RedirtyCardsQueue::G1RedirtyCardsQueue(G1RedirtyCardsQueueSet* qset) : - G1RedirtyCardsQueueBase(qset), // Init _local_qset before passing to PtrQueue. - PtrQueue(&_local_qset, true /* active (always) */) +G1RedirtyCardsQueue::G1RedirtyCardsQueue(G1RedirtyCardsLocalQueueSet* qset) : + PtrQueue(qset, true /* always active */) {} +#ifdef ASSERT G1RedirtyCardsQueue::~G1RedirtyCardsQueue() { - flush(); + assert(is_empty(), "unflushed queue"); } +#endif // ASSERT void G1RedirtyCardsQueue::handle_completed_buffer() { enqueue_completed_buffer(); @@ -78,7 +76,6 @@ void G1RedirtyCardsQueue::handle_completed_buffer() { void G1RedirtyCardsQueue::flush() { flush_impl(); - _local_qset.flush(); } // G1RedirtyCardsQueueSet @@ -134,13 +131,12 @@ void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) { update_tail(node); } -void G1RedirtyCardsQueueSet::merge_bufferlist(LocalQSet* src) { +void G1RedirtyCardsQueueSet::add_bufferlist(const G1BufferNodeList& buffers) { assert(_collecting, "precondition"); - const G1BufferNodeList from = src->take_all_completed_buffers(); - if (from._head != NULL) { - assert(from._tail != NULL, "invariant"); - Atomic::add(&_entry_count, from._entry_count); - _list.prepend(*from._head, *from._tail); - update_tail(from._tail); + if (buffers._head != NULL) { + assert(buffers._tail != NULL, "invariant"); + Atomic::add(&_entry_count, buffers._entry_count); + _list.prepend(*buffers._head, *buffers._tail); + update_tail(buffers._tail); } } diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp index 7a4efa15926f7..2a0d7636e18bc 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2020, 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 @@ -27,56 +27,36 @@ #include "gc/g1/g1BufferNodeList.hpp" #include "gc/shared/ptrQueue.hpp" -#include "memory/allocation.hpp" #include "memory/padded.hpp" -class G1CardTableEntryClosure; -class G1RedirtyCardsQueue; class G1RedirtyCardsQueueSet; // Provide G1RedirtyCardsQueue with a thread-local qset. It provides an // uncontended staging area for completed buffers, to be flushed to the -// shared qset en masse. Using the "base from member" idiom so the local -// qset is constructed before being passed to the PtrQueue constructor. -class G1RedirtyCardsQueueBase { - friend class G1RedirtyCardsQueue; - friend class G1RedirtyCardsQueueSet; +// shared qset en masse. +class G1RedirtyCardsLocalQueueSet : public PtrQueueSet { + G1RedirtyCardsQueueSet* _shared_qset; + G1BufferNodeList _buffers; - class LocalQSet : public PtrQueueSet { - G1RedirtyCardsQueueSet* _shared_qset; - G1BufferNodeList _buffers; - - public: - LocalQSet(G1RedirtyCardsQueueSet* shared_qset); - ~LocalQSet(); - - // Add the buffer to the local list. - virtual void enqueue_completed_buffer(BufferNode* node); - - // Transfer all completed buffers to the shared qset. - void flush(); - - G1BufferNodeList take_all_completed_buffers(); - }; - - G1RedirtyCardsQueueBase(G1RedirtyCardsQueueSet* shared_qset) : - _local_qset(shared_qset) {} +public: + G1RedirtyCardsLocalQueueSet(G1RedirtyCardsQueueSet* shared_qset); + ~G1RedirtyCardsLocalQueueSet() NOT_DEBUG(= default); - ~G1RedirtyCardsQueueBase() {} + // Add the buffer to the local list. + virtual void enqueue_completed_buffer(BufferNode* node); - LocalQSet _local_qset; + // Transfer all completed buffers to the shared qset. + void flush(); }; // Worker-local queues of card table entries. -class G1RedirtyCardsQueue : private G1RedirtyCardsQueueBase, public PtrQueue { +class G1RedirtyCardsQueue : public PtrQueue { protected: virtual void handle_completed_buffer(); public: - G1RedirtyCardsQueue(G1RedirtyCardsQueueSet* qset); - - // Flushes the queue. - ~G1RedirtyCardsQueue(); + G1RedirtyCardsQueue(G1RedirtyCardsLocalQueueSet* qset); + ~G1RedirtyCardsQueue() NOT_DEBUG(= default); // Flushes all enqueued cards to qset. void flush(); @@ -97,8 +77,6 @@ class G1RedirtyCardsQueueSet : public PtrQueueSet { BufferNode* _tail; DEBUG_ONLY(mutable bool _collecting;) - typedef G1RedirtyCardsQueueBase::LocalQSet LocalQSet; - void update_tail(BufferNode* node); public: @@ -110,7 +88,7 @@ class G1RedirtyCardsQueueSet : public PtrQueueSet { // Collect buffers. These functions are thread-safe. // precondition: Must not be concurrent with buffer processing. virtual void enqueue_completed_buffer(BufferNode* node); - void merge_bufferlist(LocalQSet* src); + void add_bufferlist(const G1BufferNodeList& buffers); // Processing phase operations. // precondition: Must not be concurrent with buffer collection. From 2c3ae19a20434f93ccff23175ddaea398d49a0c6 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Mon, 14 Dec 2020 17:55:23 +0000 Subject: [PATCH 229/504] 8258239: Shenandoah: Used wrong closure to mark concurrent roots Reviewed-by: rkennke --- src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index 5331ca26d4859..2e6ff75b431d8 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -420,7 +420,7 @@ ShenandoahMarkConcurrentRootsTask::ShenandoahMarkConcurrentRootsTask(ShenandoahO void ShenandoahMarkConcurrentRootsTask::work(uint worker_id) { ShenandoahConcurrentWorkerSession worker_session(worker_id); ShenandoahObjToScanQueue* q = _queue_set->queue(worker_id); - ShenandoahMarkResolveRefsClosure cl(q, _rp); + ShenandoahMarkRefsClosure cl(q, _rp); _rs.oops_do(&cl, worker_id); } From 3ab1dfeb8fc2368d83e819ddd60e21c4b1def661 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Tue, 15 Dec 2020 07:00:54 +0000 Subject: [PATCH 230/504] 8257828: SafeFetch may crash if invoked in non-JavaThreads Reviewed-by: mdoerr, kbarrett, coleenp, dholmes --- src/hotspot/os/posix/signals_posix.cpp | 34 +++++++++- src/hotspot/os/windows/os_windows.cpp | 31 ++++----- src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp | 11 --- src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp | 5 -- src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp | 12 ---- .../os_cpu/linux_aarch64/os_linux_aarch64.cpp | 5 -- src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp | 4 -- src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp | 10 --- .../os_cpu/linux_s390/os_linux_s390.cpp | 10 --- src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp | 5 -- .../os_cpu/linux_zero/os_linux_zero.cpp | 12 ---- test/hotspot/gtest/runtime/test_safefetch.cpp | 68 +++++++++++++++++++ 12 files changed, 113 insertions(+), 94 deletions(-) create mode 100644 test/hotspot/gtest/runtime/test_safefetch.cpp diff --git a/src/hotspot/os/posix/signals_posix.cpp b/src/hotspot/os/posix/signals_posix.cpp index 02be4bace9e76..1105d9e1afc3e 100644 --- a/src/hotspot/os/posix/signals_posix.cpp +++ b/src/hotspot/os/posix/signals_posix.cpp @@ -32,12 +32,19 @@ #include "runtime/java.hpp" #include "runtime/os.hpp" #include "runtime/osThread.hpp" +#include "runtime/stubRoutines.hpp" #include "runtime/thread.hpp" #include "signals_posix.hpp" #include "utilities/events.hpp" #include "utilities/ostream.hpp" #include "utilities/vmError.hpp" +#ifdef ZERO +// See stubGenerator_zero.cpp +#include +extern sigjmp_buf* get_jmp_buf_for_continuation(); +#endif + #include // Various signal related mechanism are laid out in the following order: @@ -546,13 +553,36 @@ int JVM_HANDLE_XXX_SIGNAL(int sig, siginfo_t* info, // Handle assertion poison page accesses. #ifdef CAN_SHOW_REGISTERS_ON_ASSERT - if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) { + if (!signal_was_handled && + ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison)) { signal_was_handled = handle_assert_poison_fault(ucVoid, info->si_addr); } #endif + if (!signal_was_handled) { + // Handle SafeFetch access. +#ifndef ZERO + if (uc != NULL) { + address pc = os::Posix::ucontext_get_pc(uc); + if (StubRoutines::is_safefetch_fault(pc)) { + os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); + signal_was_handled = true; + } + } +#else + // See JDK-8076185 + if (sig == SIGSEGV || sig == SIGBUS) { + sigjmp_buf* const pjb = get_jmp_buf_for_continuation(); + if (pjb) { + siglongjmp(*pjb, 1); + } + } +#endif // ZERO + } + // Ignore SIGPIPE and SIGXFSZ (4229104, 6499219). - if (sig == SIGPIPE || sig == SIGXFSZ) { + if (!signal_was_handled && + (sig == SIGPIPE || sig == SIGXFSZ)) { PosixSignals::chained_handler(sig, info, ucVoid); signal_was_handled = true; // unconditionally. } diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 913ceae801e32..3e5ced4be9c42 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -2242,29 +2242,24 @@ int os::signal_wait() { LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler) { Thread* thread = Thread::current_or_null(); - // Save pc in thread + #if defined(_M_ARM64) - // Do not blow up if no thread info available. - if (thread) { - thread->as_Java_thread()->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Pc); - } - // Set pc to handler - exceptionInfo->ContextRecord->Pc = (DWORD64)handler; + #define PC_NAME Pc #elif defined(_M_AMD64) - // Do not blow up if no thread info available. - if (thread != NULL) { - thread->as_Java_thread()->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip); - } - // Set pc to handler - exceptionInfo->ContextRecord->Rip = (DWORD64)handler; + #define PC_NAME Rip +#elif defined(_M_IX86) + #define PC_NAME Eip #else - // Do not blow up if no thread info available. - if (thread != NULL) { - thread->as_Java_thread()->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip); + #error unknown architecture +#endif + + // Save pc in thread + if (thread != nullptr && thread->is_Java_thread()) { + thread->as_Java_thread()->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->PC_NAME); } + // Set pc to handler - exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler; -#endif + exceptionInfo->ContextRecord->PC_NAME = (DWORD64)handler; // Continue the execution return EXCEPTION_CONTINUE_EXECUTION; diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp index 2eaf38d05cd84..f08392fa4a28d 100644 --- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp @@ -180,17 +180,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // retrieve crash address address const addr = info ? (const address) info->si_addr : NULL; - // SafeFetch 32 handling: - // - make it work if _thread is null - // - make it use the standard os::...::ucontext_get/set_pc APIs - if (uc) { - address const pc = os::Posix::ucontext_get_pc(uc); - if (pc && StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - } - if (info == NULL || uc == NULL) { return false; // Fatal error } diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp index a1e9420c2c82f..d17927f188144 100644 --- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp @@ -411,11 +411,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, if (info != NULL && uc != NULL && thread != NULL) { pc = (address) os::Posix::ucontext_get_pc(uc); - if (StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - // Handle ALL stack overflow variations here if (sig == SIGSEGV || sig == SIGBUS) { address addr = (address) info->si_addr; diff --git a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp index 44c15a8509514..b0c3c9b7d5473 100644 --- a/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp +++ b/src/hotspot/os_cpu/bsd_zero/os_bsd_zero.cpp @@ -57,10 +57,6 @@ #include "utilities/events.hpp" #include "utilities/vmError.hpp" -// See stubGenerator_zero.cpp -#include -extern sigjmp_buf* get_jmp_buf_for_continuation(); - address os::current_stack_pointer() { address dummy = (address) &dummy; return dummy; @@ -118,14 +114,6 @@ frame os::fetch_frame_from_context(const void* ucVoid) { bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, ucontext_t* uc, JavaThread* thread) { - // handle SafeFetch faults the zero way - if (sig == SIGSEGV || sig == SIGBUS) { - sigjmp_buf* const pjb = get_jmp_buf_for_continuation(); - if (pjb) { - siglongjmp(*pjb, 1); - } - } - if (info != NULL && thread != NULL) { // Handle ALL stack overflow variations here if (sig == SIGSEGV || sig == SIGBUS) { diff --git a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp index 09273ae7fee96..c7135d36f5ab5 100644 --- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp @@ -185,11 +185,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, if (info != NULL && uc != NULL && thread != NULL) { pc = (address) os::Posix::ucontext_get_pc(uc); - if (StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - address addr = (address) info->si_addr; // Make sure the high order byte is sign extended, as it may be masked away by the hardware. diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp index 4169abb3bcd8f..695ea3d33db19 100644 --- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp +++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp @@ -268,10 +268,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, if (sig == SIGSEGV) { address addr = (address) info->si_addr; - if (StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } // check if fault address is within thread stack if (thread->is_in_full_stack(addr)) { // stack overflow diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index 5d68c4b340799..fce1c84b72df0 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -213,16 +213,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, } } - // Moved SafeFetch32 handling outside thread!=NULL conditional block to make - // it work if no associated JavaThread object exists. - if (uc) { - address const pc = os::Posix::ucontext_get_pc(uc); - if (pc && StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - } - // decide if this trap can be handled by a stub address stub = NULL; address pc = NULL; diff --git a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp index 6f2bafa71bebb..7db5f2cbfba51 100644 --- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp +++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp @@ -207,16 +207,6 @@ frame os::current_frame() { bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, ucontext_t* uc, JavaThread* thread) { - // Moved SafeFetch32 handling outside thread!=NULL conditional block to make - // it work if no associated JavaThread object exists. - if (uc) { - address const pc = os::Posix::ucontext_get_pc(uc); - if (pc && StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - } - // Decide if this trap can be handled by a stub. address stub = NULL; address pc = NULL; // Pc as retrieved from PSW. Usually points past failing instruction. diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 419a1beb96778..af205c03e234d 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -221,11 +221,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, if (info != NULL && uc != NULL && thread != NULL) { pc = (address) os::Posix::ucontext_get_pc(uc); - if (StubRoutines::is_safefetch_fault(pc)) { - os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); - return true; - } - #ifndef AMD64 // Halt if SI_KERNEL before more crashes get misdiagnosed as Java bugs // This can happen in any running code (currently more frequently in diff --git a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp index ff074c8cd20e7..2ef3dfc7181e4 100644 --- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp +++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp @@ -53,10 +53,6 @@ #include "utilities/events.hpp" #include "utilities/vmError.hpp" -// See stubGenerator_zero.cpp -#include -extern sigjmp_buf* get_jmp_buf_for_continuation(); - address os::current_stack_pointer() { // return the address of the current function return (address)__builtin_frame_address(0); @@ -114,14 +110,6 @@ frame os::fetch_frame_from_context(const void* ucVoid) { bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, ucontext_t* uc, JavaThread* thread) { - // handle SafeFetch faults - if (sig == SIGSEGV || sig == SIGBUS) { - sigjmp_buf* const pjb = get_jmp_buf_for_continuation(); - if (pjb) { - siglongjmp(*pjb, 1); - } - } - if (info != NULL && thread != NULL) { // Handle ALL stack overflow variations here if (sig == SIGSEGV) { diff --git a/test/hotspot/gtest/runtime/test_safefetch.cpp b/test/hotspot/gtest/runtime/test_safefetch.cpp new file mode 100644 index 0000000000000..c4c88efd9117d --- /dev/null +++ b/test/hotspot/gtest/runtime/test_safefetch.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020 SAP SE. 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. + */ + +#include "precompiled.hpp" +#include "runtime/interfaceSupport.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "runtime/vmOperations.hpp" +#include "runtime/vmThread.hpp" +#include "utilities/globalDefinitions.hpp" +#include "unittest.hpp" + +static const intptr_t pattern = LP64_ONLY(0xABCDABCDABCDABCDULL) NOT_LP64(0xABCDABCD); +static intptr_t* invalid_address = (intptr_t*)(intptr_t) NOT_AIX(os::min_page_size()) AIX_ONLY(-1); + +TEST_VM(os, safefetch_positive) { + intptr_t v = pattern; + intptr_t a = SafeFetchN(&v, 1); + ASSERT_EQ(v, a); +} + +#ifndef _WIN32 +// Needs JDK-8185734 to be solved +TEST_VM(os, safefetch_negative) { + intptr_t a = SafeFetchN(invalid_address, pattern); + ASSERT_EQ(pattern, a); + a = SafeFetchN(invalid_address, ~pattern); + ASSERT_EQ(~pattern, a); +} +#endif // _WIN32 + +class VM_TestSafeFetchAtSafePoint : public VM_GTestExecuteAtSafepoint { +public: + void doit() { + // Regression test for JDK-8257828 + // Should not crash. + intptr_t a = SafeFetchN(invalid_address, pattern); + ASSERT_EQ(pattern, a); + a = SafeFetchN(invalid_address, ~pattern); + ASSERT_EQ(~pattern, a); + } +}; + +TEST_VM(os, safefetch_negative_at_safepoint) { + VM_TestSafeFetchAtSafePoint op; + ThreadInVMfromNative invm(JavaThread::current()); + VMThread::execute(&op); +} From 09e8675f568571d959d55b096c2cd3b033204e62 Mon Sep 17 00:00:00 2001 From: Richard Reingruber Date: Tue, 15 Dec 2020 08:38:58 +0000 Subject: [PATCH 231/504] 8255381: com/sun/jdi/EATests.java should not suspend graal threads Reviewed-by: cjplummer, mdoerr, sspitsyn --- test/jdk/com/sun/jdi/EATests.java | 128 ++++++++++++++----------- test/jdk/com/sun/jdi/TestScaffold.java | 8 +- 2 files changed, 80 insertions(+), 56 deletions(-) diff --git a/test/jdk/com/sun/jdi/EATests.java b/test/jdk/com/sun/jdi/EATests.java index 11d548ab59398..465734487cfd7 100644 --- a/test/jdk/com/sun/jdi/EATests.java +++ b/test/jdk/com/sun/jdi/EATests.java @@ -448,15 +448,25 @@ public void run(EATests env) { } } + /** + * Set a breakpoint in the given method and resume all threads. The + * breakpoint is configured to suspend just the thread that reaches it + * instead of all threads. This is important when running with graal. + */ + public BreakpointEvent resumeTo(String clsName, String methodName, String signature) { + boolean suspendThreadOnly = true; + return env.resumeTo(clsName, methodName, signature, suspendThreadOnly); + } + public void resumeToWarmupDone() throws Exception { msg("resuming to " + TARGET_TESTCASE_BASE_NAME + ".warmupDone()V"); - env.resumeTo(TARGET_TESTCASE_BASE_NAME, "warmupDone", "()V"); + resumeTo(TARGET_TESTCASE_BASE_NAME, "warmupDone", "()V"); testCase = env.targetMainThread.frame(0).thisObject(); } public void resumeToTestCaseDone() { msg("resuming to " + TARGET_TESTCASE_BASE_NAME + ".testCaseDone()V"); - env.resumeTo(TARGET_TESTCASE_BASE_NAME, "testCaseDone", "()V"); + resumeTo(TARGET_TESTCASE_BASE_NAME, "testCaseDone", "()V"); } public void checkPostConditions() throws Exception { @@ -798,11 +808,6 @@ public static boolean unbox(Boolean value, boolean dflt) { public boolean warmupDone; - // With UseJVMCICompiler it is possible that a compilation is made a - // background compilation even though -Xbatch is given (e.g. if JVMCI is not - // yet fully initialized). Therefore it is possible that the test method has - // not reached the highest compilation level after warm-up. - public boolean testMethodReachedHighestCompLevel; public volatile Object biasToBeRevoked; @@ -915,7 +920,7 @@ public void dontinline_brkpt() { testCaseName + ": test method not found at depth " + testMethodDepth); // check if the frame is (not) deoptimized as expected if (!DeoptimizeObjectsALot) { - if (testFrameShouldBeDeoptimized() && testMethodReachedHighestCompLevel) { + if (testFrameShouldBeDeoptimized()) { Asserts.assertTrue(WB.isFrameDeoptimized(testMethodDepth+1), testCaseName + ": expected test method frame at depth " + testMethodDepth + " to be deoptimized"); } else { @@ -969,16 +974,24 @@ public void checkCompLevel() { } catch (NoSuchMethodException | SecurityException e) { Asserts.fail("could not check compilation level of", e); } - // Background compilation (-Xbatch) cannot always be disabled with JVMCI - // compiler (e.g. if JVMCI is not yet fully initialized), therefore it - // is possible that due to background compilation we reach here before - // the test method is compiled on the highest level. int highestLevel = CompilerUtils.getMaxCompilationLevel(); int compLevel = WB.getMethodCompilationLevel(m); - testMethodReachedHighestCompLevel = highestLevel == compLevel; if (!UseJVMCICompiler) { Asserts.assertEQ(highestLevel, compLevel, m + " not on expected compilation level"); + } else { + // Background compilation (-Xbatch) will block a thread with timeout + // (see CompileBroker::wait_for_jvmci_completion()). Therefore it is + // possible to reach here before the main test method is compiled. + // In that case we wait for it to be compiled. + while (compLevel != highestLevel) { + msg(TESTMETHOD_DEFAULT_NAME + " is compiled on level " + compLevel + + ". Wait until highes level (" + highestLevel + ") is reached."); + try { + Thread.sleep(200); + } catch (InterruptedException e) { /* ignored */ } + compLevel = WB.getMethodCompilationLevel(m); + } } } @@ -1140,7 +1153,7 @@ public boolean testFrameShouldBeDeoptimized() { class EAGetWithoutMaterialize extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); checkPrimitiveField(o, FD.I, "x", 4); @@ -1164,7 +1177,7 @@ class EAMaterializeLocalVariableUponGet extends EATestCaseBaseDebugger { private ObjectReference o; public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); // check 1. o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); @@ -1203,7 +1216,7 @@ public int getExpectedIResult() { // call that will return another object class EAMaterializeLocalAtObjectReturn extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy"); checkPrimitiveField(o, FD.I, "x", 4); @@ -1248,17 +1261,22 @@ public int getExpectedIResult() { class EAMaterializeLocalAtObjectPollReturnReturn extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { msg("Resume " + env.targetMainThread); - env.targetMainThread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); ObjectReference o = null; + int retryCount = 0; do { env.targetMainThread.suspend(); printStack(env.targetMainThread); try { o = getLocalRef(env.targetMainThread.frame(0), XYVAL_NAME, "xy"); } catch (Exception e) { - msg("The local variable xy is out of scope because we suspended at the wrong bci. Resume and try again!"); + ++retryCount; + msg("The local variable xy is out of scope because we suspended at the wrong bci. Resume and try again! (" + retryCount + ")"); env.targetMainThread.resume(); + if ((retryCount % 10) == 0) { + Thread.sleep(200); + } } } while (o == null); checkPrimitiveField(o, FD.I, "x", 4); @@ -1327,7 +1345,7 @@ public int getExpectedIResult() { class EAMaterializeIntArray extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); int[] expectedVals = {1, 2, 3}; checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.I, expectedVals); @@ -1352,7 +1370,7 @@ public long getExpectedLResult() { class EAMaterializeLongArray extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); long[] expectedVals = {1, 2, 3}; checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.J, expectedVals); @@ -1377,7 +1395,7 @@ public float getExpectedFResult() { class EAMaterializeFloatArray extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); float[] expectedVals = {1.1f, 2.2f, 3.3f}; checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.F, expectedVals); @@ -1402,7 +1420,7 @@ public double getExpectedDResult() { class EAMaterializeDoubleArray extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); double[] expectedVals = {1.1d, 2.2d, 3.3d}; checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.D, expectedVals); @@ -1427,7 +1445,7 @@ public long getExpectedLResult() { class EAMaterializeObjectArray extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ReferenceType clazz = bpe.thread().frame(0).location().declaringType(); ObjectReference[] expectedVals = { @@ -1465,7 +1483,7 @@ public double getExpectedDResult() { class EAMaterializeObjectWithConstantAndNotConstantValues extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference o = getLocalRef(bpe.thread().frame(1), "ILFDO", "o"); checkPrimitiveField(o, FD.I, "i", 1); @@ -1508,7 +1526,7 @@ public int getExpectedIResult() { class EAMaterializeObjReferencedBy2Locals extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); ObjectReference alias = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "alias"); @@ -1539,7 +1557,7 @@ public int getExpectedIResult() { class EAMaterializeObjReferencedBy2LocalsAndModify extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference alias = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "alias"); setField(alias, "x", env.vm().mirrorOf(42)); @@ -1580,7 +1598,7 @@ public int getExpectedIResult() { class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFrames extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference xy = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy"); ObjectReference alias = getLocalRef(bpe.thread().frame(1), "testMethod_inlined", "alias", XYVAL_NAME); @@ -1623,7 +1641,7 @@ public int getExpectedIResult() { class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModify extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference alias = getLocalRef(bpe.thread().frame(1), "testMethod_inlined", "alias", XYVAL_NAME); setField(alias, "x", env.vm().mirrorOf(42)); @@ -1669,7 +1687,7 @@ public int getExpectedIResult() { class EAMaterializeObjReferencedFromOperandStack extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference xy1 = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy1"); checkPrimitiveField(xy1, FD.I, "x", 2); @@ -1689,7 +1707,7 @@ public void runTestCase() throws Exception { class EAMaterializeLocalVariableUponGetAfterSetInteger extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); setLocal(bpe.thread().frame(1), "i", env.vm().mirrorOf(43)); ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); @@ -1727,7 +1745,7 @@ public boolean testFrameShouldBeDeoptimized() { class EARelockingSimple extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1"); @@ -1754,7 +1772,7 @@ public void dontinline_testMethod() { class EARelockingSimple_2 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1"); @@ -1804,7 +1822,7 @@ public void testMethod_inlined(XYVal l2) { class EARelockingRecursive extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1"); @@ -1846,7 +1864,7 @@ public void testMethod_inlined(XYVal l2) { class EARelockingNestedInflated extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1"); @@ -1863,7 +1881,7 @@ public void runTestCase() throws Exception { class EARelockingNestedInflated_02 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1"); @@ -1903,7 +1921,7 @@ public void testMethod_inlined(XYVal l2) { class EARelockingArgEscapeLWLockedInCalleeFrame extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1"); @@ -1942,7 +1960,7 @@ public boolean testFrameShouldBeDeoptimized() { class EARelockingArgEscapeLWLockedInCalleeFrame_2 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1"); @@ -1988,7 +2006,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrame_3 extends EATestCaseBaseDebugger public static final String XYVAL_LOCAL_NAME = EARelockingArgEscapeLWLockedInCalleeFrame_3Target.XYValLocal.class.getName(); public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_LOCAL_NAME, "l1"); @@ -2037,7 +2055,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrame_4 extends EATestCaseBaseDebugger public static final String XYVAL_LOCAL_NAME = EARelockingArgEscapeLWLockedInCalleeFrame_4Target.XYValLocal.class.getName(); public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_LOCAL_NAME, "l1"); @@ -2082,7 +2100,7 @@ public boolean testFrameShouldBeDeoptimized() { class EARelockingObjectCurrentlyWaitingOn extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - env.targetMainThread.resume(); + env.vm().resume(); boolean inWait = false; do { Thread.sleep(100); @@ -2184,7 +2202,7 @@ public void dontinline_waitWhenWarmupDone(ForLocking l2) throws Exception { class EADeoptFrameAfterReadLocalObject_01 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); @@ -2239,7 +2257,7 @@ public void callee(XYVal xy) { class EADeoptFrameAfterReadLocalObject_01B extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference xy = getLocalRef(bpe.thread().frame(1), "callee", "xy", XYVAL_NAME); @@ -2256,7 +2274,7 @@ public void runTestCase() throws Exception { class EADeoptFrameAfterReadLocalObject_02 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee", "xy", XYVAL_NAME); @@ -2302,7 +2320,7 @@ public boolean testFrameShouldBeDeoptimized() { class EADeoptFrameAfterReadLocalObject_02B extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee", "xy", XYVAL_NAME); @@ -2351,7 +2369,7 @@ public boolean testFrameShouldBeDeoptimized() { class EADeoptFrameAfterReadLocalObject_02C extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); @SuppressWarnings("unused") ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee_accessed_by_debugger", "xy", XYVAL_NAME); @@ -2405,7 +2423,7 @@ public boolean testFrameShouldBeDeoptimized() { class EADeoptFrameAfterReadLocalObject_03 extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy"); setField(xy, "x", env.vm().mirrorOf(1)); @@ -2462,7 +2480,7 @@ class EAGetOwnedMonitors extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { msg("resume"); - env.targetMainThread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); // In contrast to JVMTI, JDWP requires a target thread to be suspended, before the owned monitors can be queried msg("suspend target"); @@ -2511,7 +2529,7 @@ class EAEntryCount extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { msg("resume"); - env.targetMainThread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); // In contrast to JVMTI, JDWP requires a target thread to be suspended, before the owned monitors can be queried msg("suspend target"); @@ -2538,7 +2556,7 @@ public void runTestCase() throws Exception { class EAPopFrameNotInlined extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); printStack(bpe.thread()); msg("PopFrame"); bpe.thread().popFrames(bpe.thread().frame(0)); @@ -2590,7 +2608,7 @@ public boolean shouldSkip() { class EAPopFrameNotInlinedReallocFailure extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); ThreadReference thread = bpe.thread(); printStack(thread); // frame[0]: EATestCaseBaseTarget.dontinline_brkpt() @@ -2683,7 +2701,7 @@ class EAPopInlinedMethodWithScalarReplacedObjectsReallocFailure extends EATestCa public void runTestCase() throws Exception { ThreadReference thread = env.targetMainThread; - thread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); thread.suspend(); @@ -2800,7 +2818,7 @@ public boolean shouldSkip() { class EAForceEarlyReturnNotInlined extends EATestCaseBaseDebugger { public void runTestCase() throws Exception { - BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); + BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V"); ThreadReference thread = bpe.thread(); printStack(thread); // frame[0]: EATestCaseBaseTarget.dontinline_brkpt() @@ -2867,7 +2885,7 @@ class EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjects extends EATestC public void runTestCase() throws Exception { ThreadReference thread = env.targetMainThread; - thread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); thread.suspend(); @@ -2951,7 +2969,7 @@ class EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailure e public void runTestCase() throws Exception { ThreadReference thread = env.targetMainThread; - thread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); thread.suspend(); @@ -3073,7 +3091,7 @@ public void runTestCase() throws Exception { ReferenceType cls = ((ClassObjectReference)getField(testCase, "cls")).reflectedType(); msg("reflected type is " + cls); msg("resume"); - env.targetMainThread.resume(); + env.vm().resume(); waitUntilTargetHasEnteredEndlessLoop(); // do this while thread is running! msg("Retrieve instances of " + cls.name()); diff --git a/test/jdk/com/sun/jdi/TestScaffold.java b/test/jdk/com/sun/jdi/TestScaffold.java index fc7749cd7cbca..18da0b4e9c75d 100644 --- a/test/jdk/com/sun/jdi/TestScaffold.java +++ b/test/jdk/com/sun/jdi/TestScaffold.java @@ -839,6 +839,12 @@ public Location findLocation(ReferenceType rt, int lineNumber) public BreakpointEvent resumeTo(String clsName, String methodName, String methodSignature) { + return resumeTo(clsName, methodName, methodSignature, false /* suspendThread */); + } + + public BreakpointEvent resumeTo(String clsName, String methodName, + String methodSignature, + boolean suspendThread) { ReferenceType rt = findReferenceType(clsName); if (rt == null) { rt = resumeToPrepareOf(clsName).referenceType(); @@ -850,7 +856,7 @@ public BreakpointEvent resumeTo(String clsName, String methodName, + clsName + "." + methodName + ":" + methodSignature); } - return resumeTo(method.location()); + return resumeTo(method.location(), suspendThread); } public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException { From 568dc29b9a99d387072ea151bf3bd24cd046fa8a Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Tue, 15 Dec 2020 09:02:46 +0000 Subject: [PATCH 232/504] 8185734: [Windows] Structured Exception Catcher missing around gtest execution Reviewed-by: dholmes, ihse --- make/RunTests.gmk | 1 + src/hotspot/os/windows/os_windows.cpp | 2 ++ src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp | 1 + test/hotspot/gtest/gtestLauncher.cpp | 12 ++++++++++++ test/hotspot/jtreg/gtest/GTestWrapper.java | 1 + 5 files changed, 17 insertions(+) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 8b9fea85d32fa..4eeef218b0864 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -608,6 +608,7 @@ define SetupRunGtestTestBody $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \ -jdk $(JDK_UNDER_TEST) $$($1_GTEST_FILTER) \ --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \ + --gtest_catch_exceptions=0 \ $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \ $$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \ > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \ diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 3e5ced4be9c42..36c5228c27204 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -512,6 +512,7 @@ struct tm* os::gmtime_pd(const time_t* clock, struct tm* res) { return NULL; } +JNIEXPORT LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); // Thread start routine for all newly created threads @@ -2441,6 +2442,7 @@ static inline void report_error(Thread* t, DWORD exception_code, } //----------------------------------------------------------------------------- +JNIEXPORT LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (InterceptOSException) return EXCEPTION_CONTINUE_SEARCH; PEXCEPTION_RECORD exception_record = exceptionInfo->ExceptionRecord; diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp index 8afd5aeeb0486..a87d45a5f6d1e 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp @@ -68,6 +68,7 @@ #define REG_PC Eip #endif // AMD64 +JNIEXPORT extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); // Install a win32 structured exception handler around thread. diff --git a/test/hotspot/gtest/gtestLauncher.cpp b/test/hotspot/gtest/gtestLauncher.cpp index f926af6ed0958..02bfe9ac9bbda 100644 --- a/test/hotspot/gtest/gtestLauncher.cpp +++ b/test/hotspot/gtest/gtestLauncher.cpp @@ -23,11 +23,23 @@ #include "jni.h" +#ifdef _WIN32 +#include +#include +extern LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); +#endif + extern "C" { JNIIMPORT void JNICALL runUnitTests(int argv, char** argc); } int main(int argc, char** argv) { +#ifdef _WIN32 + __try { +#endif runUnitTests(argc, argv); +#ifdef _WIN32 + } __except(topLevelExceptionFilter(GetExceptionInformation())) {} +#endif return 0; } diff --git a/test/hotspot/jtreg/gtest/GTestWrapper.java b/test/hotspot/jtreg/gtest/GTestWrapper.java index 235ee7d1d4f9c..36ef5c1cd9bc9 100644 --- a/test/hotspot/jtreg/gtest/GTestWrapper.java +++ b/test/hotspot/jtreg/gtest/GTestWrapper.java @@ -82,6 +82,7 @@ public static void main(String[] args) throws Throwable { command.add("-jdk"); command.add(Utils.TEST_JDK); command.add("--gtest_output=xml:" + resultFile); + command.add("--gtest_catch_exceptions=0" + resultFile); for (String a : args) { command.add(a); } From a372be4ba2216adb325f7616e54c1d58ac8fdf2a Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 15 Dec 2020 13:22:10 +0000 Subject: [PATCH 233/504] 8258244: Shenandoah: Not expecting forwarded object in roots during mark after JDK-8240868 Reviewed-by: rkennke --- .../shenandoah/shenandoahConcurrentMark.cpp | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index 2e6ff75b431d8..7000cdc8ef194 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -51,7 +51,6 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" -template class ShenandoahInitMarkRootsClosure : public OopClosure { private: ShenandoahObjToScanQueue* _queue; @@ -60,7 +59,7 @@ class ShenandoahInitMarkRootsClosure : public OopClosure { template inline void do_oop_work(T* p) { - ShenandoahConcurrentMark::mark_through_ref(p, _heap, _queue, _mark_context, false); + ShenandoahConcurrentMark::mark_through_ref(p, _heap, _queue, _mark_context, false); } public: @@ -81,7 +80,6 @@ ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToSc _weak(false) { } -template class ShenandoahInitMarkRootsTask : public AbstractGangTask { private: ShenandoahRootScanner* _rp; @@ -101,7 +99,7 @@ class ShenandoahInitMarkRootsTask : public AbstractGangTask { ShenandoahObjToScanQueue* q = queues->queue(worker_id); - ShenandoahInitMarkRootsClosure mark_cl(q); + ShenandoahInitMarkRootsClosure mark_cl(q); do_work(heap, &mark_cl, worker_id); } @@ -301,15 +299,8 @@ void ShenandoahConcurrentMark::mark_roots(ShenandoahPhaseTimings::Phase root_pha TASKQUEUE_STATS_ONLY(task_queues()->reset_taskqueue_stats()); task_queues()->reserve(nworkers); - if (heap->has_forwarded_objects()) { - ShenandoahInitMarkRootsTask mark_roots(&root_proc); - workers->run_task(&mark_roots); - } else { - // No need to update references, which means the heap is stable. - // Can save time not walking through forwarding pointers. - ShenandoahInitMarkRootsTask mark_roots(&root_proc); - workers->run_task(&mark_roots); - } + ShenandoahInitMarkRootsTask mark_roots(&root_proc); + workers->run_task(&mark_roots); } void ShenandoahConcurrentMark::update_roots(ShenandoahPhaseTimings::Phase root_phase) { @@ -463,13 +454,8 @@ void ShenandoahConcurrentMark::finish_mark_from_roots(bool full_gc) { ShenandoahPhaseTimings::full_gc_scan_conc_roots : ShenandoahPhaseTimings::degen_gc_scan_conc_roots; ShenandoahGCPhase gc_phase(phase); - if (_heap->has_forwarded_objects()) { - ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); - _heap->workers()->run_task(&task); - } else { - ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); - _heap->workers()->run_task(&task); - } + ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); + _heap->workers()->run_task(&task); } // Finally mark everything else we've got in our queues during the previous steps. From 7ff9c85639ace351b6d99c9916e3afe46ac9c69d Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 15 Dec 2020 13:50:40 +0000 Subject: [PATCH 234/504] 8258242: Type profile pollution occurs when memory segments of different kinds are used Reviewed-by: vlivanov, redestad --- src/hotspot/share/classfile/vmSymbols.hpp | 1 + src/hotspot/share/oops/methodData.cpp | 16 ++ src/hotspot/share/oops/methodData.hpp | 1 + .../access/foreign/MemorySegmentProxy.java | 18 +- .../misc/X-ScopedMemoryAccess.java.template | 3 + .../jdk/incubator/foreign/MemoryAccess.java | 4 + .../foreign/AbstractMemorySegmentImpl.java | 2 +- .../foreign/LoopOverPollutedSegments.java | 190 ++++++++++++++++++ 8 files changed, 225 insertions(+), 10 deletions(-) create mode 100644 test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedSegments.java diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp index 495c30cfa6002..4fe2054390ffb 100644 --- a/src/hotspot/share/classfile/vmSymbols.hpp +++ b/src/hotspot/share/classfile/vmSymbols.hpp @@ -353,6 +353,7 @@ /* Panama Support */ \ template(jdk_internal_invoke_NativeEntryPoint, "jdk/internal/invoke/NativeEntryPoint") \ template(jdk_internal_invoke_NativeEntryPoint_signature, "Ljdk/internal/invoke/NativeEntryPoint;") \ + template(jdk_incubator_foreign_MemoryAccess, "jdk/incubator/foreign/MemoryAccess") \ \ /* Support for JVMCI */ \ JVMCI_VM_SYMBOLS_DO(template, do_alias) \ diff --git a/src/hotspot/share/oops/methodData.cpp b/src/hotspot/share/oops/methodData.cpp index 311acab84601b..1720c4c7b54bb 100644 --- a/src/hotspot/share/oops/methodData.cpp +++ b/src/hotspot/share/oops/methodData.cpp @@ -1600,6 +1600,18 @@ bool MethodData::profile_unsafe(const methodHandle& m, int bci) { return false; } +bool MethodData::profile_memory_access(const methodHandle& m, int bci) { + Bytecode_invoke inv(m , bci); + if (inv.is_invokestatic()) { + if (inv.klass() == vmSymbols::jdk_incubator_foreign_MemoryAccess()) { + if (inv.name()->starts_with("get") || inv.name()->starts_with("set")) { + return true; + } + } + } + return false; +} + int MethodData::profile_arguments_flag() { return TypeProfileLevel % 10; } @@ -1629,6 +1641,10 @@ bool MethodData::profile_arguments_for_invoke(const methodHandle& m, int bci) { return true; } + if (profile_memory_access(m, bci)) { + return true; + } + assert(profile_arguments_jsr292_only(), "inconsistent"); return profile_jsr292(m, bci); } diff --git a/src/hotspot/share/oops/methodData.hpp b/src/hotspot/share/oops/methodData.hpp index 83c7bd6fd6d32..464e783b2a49e 100644 --- a/src/hotspot/share/oops/methodData.hpp +++ b/src/hotspot/share/oops/methodData.hpp @@ -2148,6 +2148,7 @@ class MethodData : public Metadata { static bool profile_jsr292(const methodHandle& m, int bci); static bool profile_unsafe(const methodHandle& m, int bci); + static bool profile_memory_access(const methodHandle& m, int bci); static int profile_arguments_flag(); static bool profile_all_arguments(); static bool profile_arguments_for_invoke(const methodHandle& m, int bci); diff --git a/src/java.base/share/classes/jdk/internal/access/foreign/MemorySegmentProxy.java b/src/java.base/share/classes/jdk/internal/access/foreign/MemorySegmentProxy.java index e45ad08f8fecc..a00b6516a55bc 100644 --- a/src/java.base/share/classes/jdk/internal/access/foreign/MemorySegmentProxy.java +++ b/src/java.base/share/classes/jdk/internal/access/foreign/MemorySegmentProxy.java @@ -29,21 +29,21 @@ import jdk.internal.misc.ScopedMemoryAccess; /** - * This proxy interface is required to allow instances of the {@code MemorySegment} interface (which is defined inside + * This abstract class is required to allow implementations of the {@code MemorySegment} interface (which is defined inside * an incubating module) to be accessed from the memory access var handles. */ -public interface MemorySegmentProxy { +public abstract class MemorySegmentProxy { /** * Check that memory access is within spatial bounds and that access is compatible with segment access modes. * @throws UnsupportedOperationException if underlying segment has incompatible access modes (e.g. attempting to write * a read-only segment). * @throws IndexOutOfBoundsException if access is out-of-bounds. */ - void checkAccess(long offset, long length, boolean readOnly); - long unsafeGetOffset(); - Object unsafeGetBase(); - boolean isSmall(); - ScopedMemoryAccess.Scope scope(); + public abstract void checkAccess(long offset, long length, boolean readOnly); + public abstract long unsafeGetOffset(); + public abstract Object unsafeGetBase(); + public abstract boolean isSmall(); + public abstract ScopedMemoryAccess.Scope scope(); /* Helper functions for offset computations. These are required so that we can avoid issuing long opcodes * (e.g. LMUL, LADD) when we're operating on 'small' segments (segments whose length can be expressed with an int). @@ -51,7 +51,7 @@ public interface MemorySegmentProxy { * BCE when working with small segments. This workaround should be dropped when JDK-8223051 is resolved. */ - static long addOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) { + public static long addOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) { if (segmentProxy.isSmall()) { // force ints for BCE if (op1 > Integer.MAX_VALUE || op2 > Integer.MAX_VALUE @@ -74,7 +74,7 @@ static long addOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) { } } - static long multiplyOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) { + public static long multiplyOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) { if (segmentProxy.isSmall()) { if (op1 > Integer.MAX_VALUE || op2 > Integer.MAX_VALUE || op1 < Integer.MIN_VALUE || op2 < Integer.MIN_VALUE) { diff --git a/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template b/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template index 2bf948d33d6ea..7e6823718ae92 100644 --- a/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template +++ b/src/java.base/share/classes/jdk/internal/misc/X-ScopedMemoryAccess.java.template @@ -325,3 +325,6 @@ public class ScopedMemoryAccess { } // typed-ops here + // Note: all the accessor methods defined below take advantage of argument type profiling + // (see src/hotspot/share/oops/methodData.cpp) which greatly enhances performance when the same accessor + // method is used repeatedly with different 'base' objects. diff --git a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java index 9de681274fccb..3e2182b596387 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java @@ -88,6 +88,10 @@ private static VarHandle unalignedHandle(ValueLayout elementLayout, Class car return MemoryHandles.varHandle(carrier, 1, elementLayout.order()); } + // Note: all the accessor methods defined below take advantage of argument type profiling + // (see src/hotspot/share/oops/methodData.cpp) which greatly enhances performance when the same accessor + // method is used repeatedly with different segment kinds (e.g. on-heap vs. off-heap). + /** * Reads a byte from given segment and offset. * diff --git a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java index a26428e49592d..971533569cfea 100644 --- a/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java +++ b/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java @@ -53,7 +53,7 @@ * are defined for each memory segment kind, see {@link NativeMemorySegmentImpl}, {@link HeapMemorySegmentImpl} and * {@link MappedMemorySegmentImpl}. */ -public abstract class AbstractMemorySegmentImpl implements MemorySegment, MemorySegmentProxy { +public abstract class AbstractMemorySegmentImpl extends MemorySegmentProxy implements MemorySegment { private static final ScopedMemoryAccess SCOPED_MEMORY_ACCESS = ScopedMemoryAccess.getScopedMemoryAccess(); diff --git a/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedSegments.java b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedSegments.java new file mode 100644 index 0000000000000..463474ee0049e --- /dev/null +++ b/test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverPollutedSegments.java @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2020, 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 org.openjdk.bench.jdk.incubator.foreign; + +import jdk.incubator.foreign.MemoryAccess; +import jdk.incubator.foreign.MemoryLayout; +import jdk.incubator.foreign.MemorySegment; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.annotations.Warmup; +import sun.misc.Unsafe; + +import java.lang.invoke.VarHandle; +import java.util.concurrent.TimeUnit; + +import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement; +import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT; + +@BenchmarkMode(Mode.AverageTime) +@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) +@State(org.openjdk.jmh.annotations.Scope.Thread) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +@Fork(value = 3, jvmArgsAppend = { "--add-modules=jdk.incubator.foreign" }) +public class LoopOverPollutedSegments { + + static final int ELEM_SIZE = 1_000_000; + static final int CARRIER_SIZE = (int) JAVA_INT.byteSize(); + static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE; + + static final Unsafe unsafe = Utils.unsafe; + + MemorySegment nativeSegment, heapSegmentBytes, heapSegmentFloats; + byte[] arr; + long addr; + + static final VarHandle intHandle = MemoryLayout.ofSequence(JAVA_INT).varHandle(int.class, MemoryLayout.PathElement.sequenceElement()); + + + @Setup + public void setup() { + addr = unsafe.allocateMemory(ALLOC_SIZE); + for (int i = 0; i < ELEM_SIZE; i++) { + unsafe.putInt(addr + (i * 4), i); + } + arr = new byte[ALLOC_SIZE]; + nativeSegment = MemorySegment.allocateNative(ALLOC_SIZE, 4); + heapSegmentBytes = MemorySegment.ofArray(new byte[ALLOC_SIZE]); + heapSegmentFloats = MemorySegment.ofArray(new float[ELEM_SIZE]); + + for (int rep = 0 ; rep < 5 ; rep++) { + for (int i = 0; i < ELEM_SIZE; i++) { + unsafe.putInt(arr, Unsafe.ARRAY_BYTE_BASE_OFFSET + (i * 4), i); + MemoryAccess.setIntAtIndex(nativeSegment, i, i); + MemoryAccess.setFloatAtIndex(nativeSegment, i, i); + intHandle.set(nativeSegment, (long)i, i); + MemoryAccess.setIntAtIndex(heapSegmentBytes, i, i); + MemoryAccess.setFloatAtIndex(heapSegmentBytes, i, i); + intHandle.set(heapSegmentBytes, (long)i, i); + MemoryAccess.setIntAtIndex(heapSegmentFloats, i, i); + MemoryAccess.setFloatAtIndex(heapSegmentFloats, i, i); + intHandle.set(heapSegmentFloats, (long)i, i); + } + } + } + + @TearDown + public void tearDown() { + nativeSegment.close(); + heapSegmentBytes = null; + heapSegmentFloats = null; + arr = null; + unsafe.freeMemory(addr); + } + + @Benchmark + public int native_segment_VH() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + intHandle.set(nativeSegment, (long)k, k + 1); + int v = (int) intHandle.get(nativeSegment, (long)k); + sum += v; + } + return sum; + } + + @Benchmark + public int native_segment_static() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + MemoryAccess.setIntAtOffset(nativeSegment, k, k + 1); + int v = MemoryAccess.getIntAtOffset(nativeSegment, k); + sum += v; + } + return sum; + } + + @Benchmark + public int heap_segment_ints_VH() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + intHandle.set(heapSegmentBytes, (long)k, k + 1); + int v = (int) intHandle.get(heapSegmentBytes, (long)k); + sum += v; + } + return sum; + } + + @Benchmark + public int heap_segment_ints_static() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + MemoryAccess.setIntAtOffset(heapSegmentBytes, k, k + 1); + int v = MemoryAccess.getIntAtOffset(heapSegmentBytes, k); + sum += v; + } + return sum; + } + + @Benchmark + public int heap_segment_floats_VH() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + intHandle.set(heapSegmentFloats, (long)k, k + 1); + int v = (int)intHandle.get(heapSegmentFloats, (long)k); + sum += v; + } + return sum; + } + + @Benchmark + public int heap_segment_floats_static() { + int sum = 0; + for (int k = 0; k < ELEM_SIZE; k++) { + MemoryAccess.setIntAtOffset(heapSegmentFloats, k, k + 1); + int v = MemoryAccess.getIntAtOffset(heapSegmentFloats, k); + sum += v; + } + return sum; + } + + @Benchmark + public int heap_unsafe() { + int sum = 0; + for (int k = 0; k < ALLOC_SIZE; k += 4) { + unsafe.putInt(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET, k + 1); + int v = unsafe.getInt(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET); + sum += v; + } + return sum; + } + + @Benchmark + public int native_unsafe() { + int sum = 0; + for (int k = 0; k < ALLOC_SIZE; k += 4) { + unsafe.putInt(addr + k, k + 1); + int v = unsafe.getInt(addr + k); + sum += v; + } + return sum; + } +} From fa1cbb47aa306d111a12a89ad9b68b9dd4ac8e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Tue, 15 Dec 2020 14:48:57 +0000 Subject: [PATCH 235/504] 8258404: Restore stacktrace reuse after 8258094 Reviewed-by: egahlin --- src/hotspot/share/jfr/support/jfrAllocationTracer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp index 5f62f3e374010..ddf22be2748a0 100644 --- a/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp +++ b/src/hotspot/share/jfr/support/jfrAllocationTracer.cpp @@ -30,11 +30,12 @@ #include "runtime/thread.hpp" JfrAllocationTracer::JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread) : _tl(NULL) { - JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread); if (LeakProfiler::is_running()) { _tl = thread->jfr_thread_local(); LeakProfiler::sample(obj, alloc_size, thread->as_Java_thread()); } + // Let this happen after LeakProfiler::sample, to possibly reuse a cached stacktrace. + JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread); } JfrAllocationTracer::~JfrAllocationTracer() { From ce36aeaac36330f3398bc64604298a462e176e06 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Tue, 15 Dec 2020 15:14:34 +0000 Subject: [PATCH 236/504] 8257822: C2 crashes with SIGFPE due to a division that floats above its zero check Reviewed-by: kvn, thartmann --- src/hotspot/share/opto/loopnode.hpp | 1 + src/hotspot/share/opto/loopopts.cpp | 34 ++++++++-- .../loopopts/TestDivZeroWithSplitIf.java | 66 +++++++++++++++++++ 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index aa89d475ef8ab..5eb5efaaa6064 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1451,6 +1451,7 @@ class PhaseIdealLoop : public PhaseTransform { // Mark an IfNode as being dominated by a prior test, // without actually altering the CFG (and hence IDOM info). void dominated_by( Node *prevdom, Node *iff, bool flip = false, bool exclude_loop_predicate = false ); + bool no_dependent_zero_check(Node* n) const; // Split Node 'n' through merge point Node *split_thru_region( Node *n, Node *region ); diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 52e56fad02457..8c160c058cffa 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -278,18 +278,23 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc return; // Let IGVN transformation change control dependence. } - IdealLoopTree *old_loop = get_loop(dp); + IdealLoopTree* old_loop = get_loop(dp); for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) { Node* cd = dp->fast_out(i); // Control-dependent node - if (cd->depends_only_on_test()) { + // Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check. + if (cd->depends_only_on_test() && no_dependent_zero_check(cd)) { assert(cd->in(0) == dp, ""); _igvn.replace_input_of(cd, 0, prevdom); set_early_ctrl(cd, false); - IdealLoopTree *new_loop = get_loop(get_ctrl(cd)); + IdealLoopTree* new_loop = get_loop(get_ctrl(cd)); if (old_loop != new_loop) { - if (!old_loop->_child) old_loop->_body.yank(cd); - if (!new_loop->_child) new_loop->_body.push(cd); + if (!old_loop->_child) { + old_loop->_body.yank(cd); + } + if (!new_loop->_child) { + new_loop->_body.push(cd); + } } --i; --imax; @@ -297,6 +302,25 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc } } +// Check if the type of a divisor of a Div or Mod node includes zero. +bool PhaseIdealLoop::no_dependent_zero_check(Node* n) const { + switch (n->Opcode()) { + case Op_DivI: + case Op_ModI: { + // Type of divisor includes 0? + const TypeInt* type_divisor = _igvn.type(n->in(2))->is_int(); + return (type_divisor->_hi < 0 || type_divisor->_lo > 0); + } + case Op_DivL: + case Op_ModL: { + // Type of divisor includes 0? + const TypeLong* type_divisor = _igvn.type(n->in(2))->is_long(); + return (type_divisor->_hi < 0 || type_divisor->_lo > 0); + } + } + return true; +} + //------------------------------has_local_phi_input---------------------------- // Return TRUE if 'n' has Phi inputs from its local block and no other // block-local inputs (all non-local-phi inputs come from earlier blocks) diff --git a/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java b/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java new file mode 100644 index 0000000000000..2d43ebc53d40f --- /dev/null +++ b/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2020, 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 8257822 + * @summary Verify that zero check is executed before division/modulo operation. + * @requires vm.compiler2.enabled + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test + * -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf + */ + +package compiler.loopopts; + +public class TestDivZeroWithSplitIf { + public static int iArrFld[] = new int[10]; + + public static void test() { + int x = 20; + int y = 0; + int z = 10; + for (int i = 9; i < 99; i += 2) { + for (int j = 3; j < 100; j++) { + for (int k = 1; k < 2; k++) { + try { + x = (-65229 / y); // Division by zero + z = (iArrFld[5] / 8); // RangeCheckNode + } catch (ArithmeticException a_e) {} + try { + y = (-38077 / y); + z = (y / 9); + } catch (ArithmeticException a_e) {} + y = 8; + z += k; + } + } + } + } + public static void main(String[] strArr) { + for (int i = 0; i < 10; i++) { + test(); + } + } +} + From 65756abf44ef9e2e22cb19d4a95d751197adc46a Mon Sep 17 00:00:00 2001 From: Eric Caspole Date: Tue, 15 Dec 2020 16:20:15 +0000 Subject: [PATCH 237/504] 8257802: LogCompilation throws couldn't find bytecode on JDK 8 log Reviewed-by: kvn, redestad --- .../sun/hotspot/tools/compiler/LogParser.java | 108 ++++++++++-------- .../tools/compiler/UncommonTrapEvent.java | 6 + 2 files changed, 66 insertions(+), 48 deletions(-) diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index ab76ab8fae96d..a6ab11acb63ac 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -1000,44 +1000,49 @@ public void startElement(String uri, String localName, String qname, Attributes } methods.put(id, m); } else if (qname.equals("call")) { - if (methodHandleSite != null) { - methodHandleSite = null; - } - Method m = method(search(atts, "method")); - if (lateInlining && scopes.size() == 0) { - // re-attempting already seen call site (late inlining for MH invokes) - if (m != site.getMethod()) { - if (current_bci != site.getBci()) { - System.err.println(m + " bci: " + current_bci); - System.err.println(site.getMethod() + " bci: " + site.getBci()); - reportInternalError("bci mismatch after late inlining"); - } - site.setMethod(m); - } - } else { - // We're dealing with a new call site; the called method is - // likely to be parsed next. - site = new CallSite(current_bci, m); - } - site.setCount(Integer.parseInt(search(atts, "count", "0"))); - String receiver = atts.getValue("receiver"); - if (receiver != null) { - site.setReceiver(type(receiver)); - site.setReceiver_count(Integer.parseInt(search(atts, "receiver_count"))); - } - int methodHandle = Integer.parseInt(search(atts, "method_handle_intrinsic", "0")); - if (lateInlining && scopes.size() == 0) { - // The call was already added before this round of late - // inlining. Ignore. - } else if (methodHandle == 0) { - scopes.peek().add(site); - } else { - // method handle call site can be followed by another - // call (in case it is inlined). If that happens we - // discard the method handle call site. So we keep - // track of it but don't add it to the list yet. - methodHandleSite = site; - } + if (scopes.peek() == null) { + Phase p = phaseStack.peek(); + assert p != null && p.getName().equals("optimizer") : "should not be in parse here"; + } else { + if (methodHandleSite != null) { + methodHandleSite = null; + } + Method m = method(search(atts, "method")); + if (lateInlining && scopes.size() == 0) { + // re-attempting already seen call site (late inlining for MH invokes) + if (m != site.getMethod()) { + if (current_bci != site.getBci()) { + System.err.println(m + " bci: " + current_bci); + System.err.println(site.getMethod() + " bci: " + site.getBci()); + reportInternalError("bci mismatch after late inlining"); + } + site.setMethod(m); + } + } else { + // We're dealing with a new call site; the called method is + // likely to be parsed next. + site = new CallSite(current_bci, m); + } + site.setCount(Integer.parseInt(search(atts, "count", "0"))); + String receiver = atts.getValue("receiver"); + if (receiver != null) { + site.setReceiver(type(receiver)); + site.setReceiver_count(Integer.parseInt(search(atts, "receiver_count"))); + } + int methodHandle = Integer.parseInt(search(atts, "method_handle_intrinsic", "0")); + if (lateInlining && scopes.size() == 0) { + // The call was already added before this round of late + // inlining. Ignore. + } else if (methodHandle == 0) { + scopes.peek().add(site); + } else { + // method handle call site can be followed by another + // call (in case it is inlined). If that happens we + // discard the method handle call site. So we keep + // track of it but don't add it to the list yet. + methodHandleSite = site; + } + } } else if (qname.equals("intrinsic")) { String id = atts.getValue("id"); assert id != null : "intrinsic id is null"; @@ -1049,15 +1054,20 @@ public void startElement(String uri, String localName, String qname, Attributes } else if (qname.equals("replace_string_concat")) { expectStringConcatTrap = true; } else if (qname.equals("inline_fail")) { - if (methodHandleSite != null) { - scopes.peek().add(methodHandleSite); - methodHandleSite = null; - } - if (lateInlining && scopes.size() == 0) { - site.setReason("fail: " + search(atts, "reason")); - lateInlining = false; + if (scopes.peek() == null) { + Phase p = phaseStack.peek(); + assert p != null && p.getName().equals("optimizer") : "should not be in parse here"; } else { - scopes.peek().last().setReason("fail: " + search(atts, "reason")); + if (methodHandleSite != null) { + scopes.peek().add(methodHandleSite); + methodHandleSite = null; + } + if (lateInlining && scopes.size() == 0) { + site.setReason("fail: " + search(atts, "reason")); + lateInlining = false; + } else { + scopes.peek().last().setReason("fail: " + search(atts, "reason")); + } } } else if (qname.equals("inline_success")) { if (methodHandleSite != null) { @@ -1100,10 +1110,11 @@ public void startElement(String uri, String localName, String qname, Attributes return; } try { + String currBytecode = current_bytecode >= 0 ? bytecodes[current_bytecode] : ""; UncommonTrap unc = new UncommonTrap(Integer.parseInt(search(atts, "bci")), search(atts, "reason"), search(atts, "action"), - bytecodes[current_bytecode]); + currBytecode); if (scopes.size() == 0) { // There may be a dangling site not yet in scopes after a late_inline if (site != null) { @@ -1292,8 +1303,9 @@ public void endElement(String uri, String localName, String qname) { if (scopes.size() == 0) { lateInlining = false; } - // Don't carry a stale site to the next parse + // Clear the bytecode and site from the last parse site = null; + current_bytecode = -1; } else if (qname.equals("uncommon_trap")) { currentTrap = null; } else if (qname.startsWith("eliminate_lock")) { diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java index b207ff078c583..6c265572379d0 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java @@ -118,6 +118,12 @@ && getReason().equals("unstable_fused_if")) { */ public void setCompilation(Compilation compilation) { super.setCompilation(compilation); + + if (compilation.getSpecial() != null) { + assert compilation.getLevel() == 0 : "Should be 0"; + return; + } + // Attempt to associate a bytecode with with this trap CallSite site = compilation.getCall(); int i = 0; From d53ee6219bf9a196eb174a98ba98b0c6364f2233 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Tue, 15 Dec 2020 16:42:29 +0000 Subject: [PATCH 238/504] 8255899: Allow uninstallation of jpackage exe bundles Reviewed-by: almatvee, herrick --- .../native/applauncher/LinuxLauncher.cpp | 3 +- .../macosx/native/applauncher/MacLauncher.cpp | 5 +- .../share/native/applauncher/AppLauncher.cpp | 155 ------- .../share/native/applauncher/AppLauncher.h | 12 - src/jdk.jpackage/share/native/common/app.cpp | 186 ++++++++ src/jdk.jpackage/share/native/common/app.h | 49 ++ .../share/native/common/tstrings.cpp | 31 ++ .../share/native/common/tstrings.h | 14 + .../native/applauncher/WinLauncher.cpp | 105 +---- src/jdk.jpackage/windows/native/common/Flag.h | 50 +++ .../windows/native/common/Guid.cpp | 137 ++++++ src/jdk.jpackage/windows/native/common/Guid.h | 75 ++++ .../windows/native/common/MsiDb.cpp | 282 ++++++++++++ .../windows/native/common/MsiDb.h | 194 ++++++++ .../windows/native/common/MsiUtils.cpp | 420 ++++++++++++++++++ .../windows/native/common/MsiUtils.h | 337 ++++++++++++++ .../{msiwrapper => common}/Resources.cpp | 18 + .../native/{msiwrapper => common}/Resources.h | 51 +++ .../windows/native/common/WinApp.cpp | 139 ++++++ .../windows/native/common/WinApp.h | 38 ++ .../windows/native/libjpackage/JniUtils.h | 1 + .../native/libjpackage/ResourceEditor.h | 4 +- .../native/libjpackage/VersionInfo.cpp | 6 +- .../windows/native/libjpackage/jpackage.cpp | 9 + .../windows/native/msiwrapper/MsiWrapper.cpp | 34 +- .../jdk/jpackage/test/WindowsHelper.java | 18 +- 26 files changed, 2083 insertions(+), 290 deletions(-) create mode 100644 src/jdk.jpackage/share/native/common/app.cpp create mode 100644 src/jdk.jpackage/share/native/common/app.h create mode 100644 src/jdk.jpackage/windows/native/common/Flag.h create mode 100644 src/jdk.jpackage/windows/native/common/Guid.cpp create mode 100644 src/jdk.jpackage/windows/native/common/Guid.h create mode 100644 src/jdk.jpackage/windows/native/common/MsiDb.cpp create mode 100644 src/jdk.jpackage/windows/native/common/MsiDb.h create mode 100644 src/jdk.jpackage/windows/native/common/MsiUtils.cpp create mode 100644 src/jdk.jpackage/windows/native/common/MsiUtils.h rename src/jdk.jpackage/windows/native/{msiwrapper => common}/Resources.cpp (91%) rename src/jdk.jpackage/windows/native/{msiwrapper => common}/Resources.h (61%) create mode 100644 src/jdk.jpackage/windows/native/common/WinApp.cpp create mode 100644 src/jdk.jpackage/windows/native/common/WinApp.h diff --git a/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.cpp b/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.cpp index 69d3c30ae0129..8aa497f59c761 100644 --- a/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.cpp +++ b/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.cpp @@ -30,6 +30,7 @@ #include "UnixSysInfo.h" #include "Package.h" #include "Log.h" +#include "app.h" #include "ErrorHandling.h" @@ -124,5 +125,5 @@ void launchApp() { int main(int argc, char *argv[]) { SysInfo::argc = argc; SysInfo::argv = argv; - return AppLauncher::launch(std::nothrow, launchApp); + return app::launch(std::nothrow, launchApp); } diff --git a/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp b/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp index 3949716e51418..0de47c44553a0 100644 --- a/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp +++ b/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp @@ -24,6 +24,7 @@ */ #include "AppLauncher.h" +#include "app.h" #include "FileUtils.h" #include "UnixSysInfo.h" #include "JvmLauncher.h" @@ -74,10 +75,10 @@ int main(int argc, char *argv[]) { // Besides we should ignore main() arguments because these are the // arguments passed into JLI_Launch() call and not the arguments with // which the launcher was started. - return AppLauncher::launch(std::nothrow, launchJvm); + return app::launch(std::nothrow, launchJvm); } SysInfo::argc = argc; SysInfo::argv = argv; - return AppLauncher::launch(std::nothrow, initJvmLauncher); + return app::launch(std::nothrow, initJvmLauncher); } diff --git a/src/jdk.jpackage/share/native/applauncher/AppLauncher.cpp b/src/jdk.jpackage/share/native/applauncher/AppLauncher.cpp index 27850077e0c4f..a0143e1da7157 100644 --- a/src/jdk.jpackage/share/native/applauncher/AppLauncher.cpp +++ b/src/jdk.jpackage/share/native/applauncher/AppLauncher.cpp @@ -136,158 +136,3 @@ Jvm* AppLauncher::createJvmLauncher() const { void AppLauncher::launch() const { std::unique_ptr(createJvmLauncher())->launch(); } - - -namespace { -const std::string* theLastErrorMsg = 0; - -NopLogAppender nopLogAppender; - -class StandardLogAppender : public LogAppender { -public: - virtual void append(const LogEvent& v) { - std::cerr << "[" << v.logLevel << "] " - << v.fileName - << ":" << v.lineNum - << ": " << v.message - << std::endl; - } -} standardLogAppender; - -class LastErrorLogAppender : public LogAppender { -public: - virtual void append(const LogEvent& v) { - std::cerr << AppLauncher::lastErrorMsg() << std::endl; - } -} lastErrorLogAppender; -} // namespace - -LogAppender& AppLauncher::defaultLastErrorLogAppender() { - return lastErrorLogAppender; -} - - -std::string AppLauncher::lastErrorMsg() { - if (theLastErrorMsg) { - return *theLastErrorMsg; - } - return ""; -} - - -bool AppLauncher::isWithLogging() { - // If JPACKAGE_DEBUG environment variable is set to "true" - // logging is enabled. - return SysInfo::getEnvVariable( - std::nothrow, _T("JPACKAGE_DEBUG")) == _T("true"); -} - - -namespace { - -class ResetLastErrorMsgAtEndOfScope { -public: - ~ResetLastErrorMsgAtEndOfScope() { - JP_NO_THROW(theLastErrorMsg = 0); - } -}; - -class SetLoggerAtEndOfScope { -public: - SetLoggerAtEndOfScope( - std::unique_ptr& withLogAppender, - LogAppender* lastErrorLogAppender): - withLogAppender(withLogAppender), - lastErrorLogAppender(lastErrorLogAppender) { - } - - ~SetLoggerAtEndOfScope() { - JP_TRY; - std::unique_ptr other( - new WithExtraLogAppender(*lastErrorLogAppender)); - withLogAppender.swap(other); - JP_CATCH_ALL; - } - -private: - std::unique_ptr& withLogAppender; - LogAppender* lastErrorLogAppender; -}; - -} // namespace - -int AppLauncher::launch(const std::nothrow_t&, - LauncherFunc func, LogAppender* lastErrorLogAppender) { - if (isWithLogging()) { - Logger::defaultLogger().setAppender(standardLogAppender); - } else { - Logger::defaultLogger().setAppender(nopLogAppender); - } - - LOG_TRACE_FUNCTION(); - - if (!lastErrorLogAppender) { - lastErrorLogAppender = &defaultLastErrorLogAppender(); - } - std::unique_ptr withLogAppender; - std::string errorMsg; - const ResetLastErrorMsgAtEndOfScope resetLastErrorMsg; - - JP_TRY; - - // This will temporary change log appenders of the default logger - // to save log messages in the default and additional log appenders. - // Log appenders config of the default logger will be restored to - // the original state at function exit automatically. - const SetLoggerAtEndOfScope setLogger(withLogAppender, lastErrorLogAppender); - func(); - return 0; - - // The point of all these redefines is to save the last raw error message in - // 'AppLauncher::theLastErrorMsg' variable. - // By default error messages are saved in exception instances with the details - // of error origin (source file, function name, line number). - // We don't want these details in user error messages. However we still want to - // save full information about the last error in the default log appender. -#undef JP_HANDLE_ERROR -#undef JP_HANDLE_UNKNOWN_ERROR -#undef JP_CATCH_EXCEPTIONS -#define JP_HANDLE_ERROR(e) \ - do { \ - errorMsg = (tstrings::any() << e.what()).str(); \ - theLastErrorMsg = &errorMsg; \ - reportError(JP_SOURCE_CODE_POS, e); \ - } while(0) -#define JP_HANDLE_UNKNOWN_ERROR \ - do { \ - errorMsg = "Unknown error"; \ - theLastErrorMsg = &errorMsg; \ - reportUnknownError(JP_SOURCE_CODE_POS); \ - } while(0) -#define JP_CATCH_EXCEPTIONS \ - catch (const JpErrorBase& e) { \ - errorMsg = (tstrings::any() << e.rawMessage()).str(); \ - theLastErrorMsg = &errorMsg; \ - try { \ - throw; \ - } catch (const std::runtime_error& e) { \ - reportError(JP_SOURCE_CODE_POS, e); \ - } \ - } catch (const std::runtime_error& e) { \ - errorMsg = lastCRTError(); \ - theLastErrorMsg = &errorMsg; \ - reportError(JP_SOURCE_CODE_POS, e); \ - } \ - JP_CATCH_UNKNOWN_EXCEPTION - - JP_CATCH_ALL; - -#undef JP_HANDLE_ERROR -#undef JP_HANDLE_UNKNOWN_ERROR -#undef JP_CATCH_EXCEPTIONS -#define JP_HANDLE_ERROR(e) JP_REPORT_ERROR(e) -#define JP_HANDLE_UNKNOWN_ERROR JP_REPORT_UNKNOWN_ERROR -#define JP_CATCH_EXCEPTIONS JP_DEFAULT_CATCH_EXCEPTIONS - - return 1; -} diff --git a/src/jdk.jpackage/share/native/applauncher/AppLauncher.h b/src/jdk.jpackage/share/native/applauncher/AppLauncher.h index 6bde671fe3953..73a61f2eaa4b6 100644 --- a/src/jdk.jpackage/share/native/applauncher/AppLauncher.h +++ b/src/jdk.jpackage/share/native/applauncher/AppLauncher.h @@ -30,7 +30,6 @@ #include "tstrings.h" class Jvm; -class LogAppender; class AppLauncher { public: @@ -65,17 +64,6 @@ class AppLauncher { void launch() const; - static LogAppender& defaultLastErrorLogAppender(); - - static bool isWithLogging(); - - typedef void (*LauncherFunc) (); - - static int launch(const std::nothrow_t&, LauncherFunc func, - LogAppender* lastErrorLogAppender = 0); - - static std::string lastErrorMsg(); - private: tstring_array args; tstring launcherPath; diff --git a/src/jdk.jpackage/share/native/common/app.cpp b/src/jdk.jpackage/share/native/common/app.cpp new file mode 100644 index 0000000000000..ad0860d30ece7 --- /dev/null +++ b/src/jdk.jpackage/share/native/common/app.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include +#include "app.h" +#include "Log.h" +#include "SysInfo.h" +#include "ErrorHandling.h" + + +namespace { +const std::string* theLastErrorMsg = 0; + +NopLogAppender nopLogAppender; + +class StandardLogAppender : public LogAppender { +public: + virtual void append(const LogEvent& v) { + std::cerr << "[" << v.logLevel << "] " + << v.fileName + << ":" << v.lineNum + << ": " << v.message + << std::endl; + } +} standardLogAppender; + +class LastErrorLogAppender : public LogAppender { +public: + virtual void append(const LogEvent& v) { + std::cerr << app::lastErrorMsg() << std::endl; + } +} lastErrorLogAppender; + + +class ResetLastErrorMsgAtEndOfScope { +public: + ~ResetLastErrorMsgAtEndOfScope() { + JP_NO_THROW(theLastErrorMsg = 0); + } +}; + +class SetLoggerAtEndOfScope { +public: + SetLoggerAtEndOfScope( + std::unique_ptr& withLogAppender, + LogAppender* lastErrorLogAppender): + withLogAppender(withLogAppender), + lastErrorLogAppender(lastErrorLogAppender) { + } + + ~SetLoggerAtEndOfScope() { + JP_TRY; + std::unique_ptr other( + new WithExtraLogAppender(*lastErrorLogAppender)); + withLogAppender.swap(other); + JP_CATCH_ALL; + } + +private: + std::unique_ptr& withLogAppender; + LogAppender* lastErrorLogAppender; +}; + +} // namespace + + +namespace app { +LogAppender& defaultLastErrorLogAppender() { + return lastErrorLogAppender; +} + + +std::string lastErrorMsg() { + if (theLastErrorMsg) { + return *theLastErrorMsg; + } + return ""; +} + + +bool isWithLogging() { + // If JPACKAGE_DEBUG environment variable is set to "true" + // logging is enabled. + return SysInfo::getEnvVariable( + std::nothrow, _T("JPACKAGE_DEBUG")) == _T("true"); +} + + +int launch(const std::nothrow_t&, + LauncherFunc func, LogAppender* lastErrorLogAppender) { + if (isWithLogging()) { + Logger::defaultLogger().setAppender(standardLogAppender); + } else { + Logger::defaultLogger().setAppender(nopLogAppender); + } + + LOG_TRACE_FUNCTION(); + + if (!lastErrorLogAppender) { + lastErrorLogAppender = &defaultLastErrorLogAppender(); + } + std::unique_ptr withLogAppender; + std::string errorMsg; + const ResetLastErrorMsgAtEndOfScope resetLastErrorMsg; + + JP_TRY; + + // This will temporary change log appenders of the default logger + // to save log messages in the default and additional log appenders. + // Log appenders config of the default logger will be restored to + // the original state at function exit automatically. + const SetLoggerAtEndOfScope setLogger(withLogAppender, lastErrorLogAppender); + func(); + return 0; + + // The point of all these redefines is to save the last raw error message in + // 'theLastErrorMsg' variable. + // By default error messages are saved in exception instances with the details + // of error origin (source file, function name, line number). + // We don't want these details in user error messages. However we still want to + // save full information about the last error in the default log appender. +#undef JP_HANDLE_ERROR +#undef JP_HANDLE_UNKNOWN_ERROR +#undef JP_CATCH_EXCEPTIONS +#define JP_HANDLE_ERROR(e) \ + do { \ + errorMsg = (tstrings::any() << e.what()).str(); \ + theLastErrorMsg = &errorMsg; \ + reportError(JP_SOURCE_CODE_POS, e); \ + } while(0) +#define JP_HANDLE_UNKNOWN_ERROR \ + do { \ + errorMsg = "Unknown error"; \ + theLastErrorMsg = &errorMsg; \ + reportUnknownError(JP_SOURCE_CODE_POS); \ + } while(0) +#define JP_CATCH_EXCEPTIONS \ + catch (const JpErrorBase& e) { \ + errorMsg = (tstrings::any() << e.rawMessage()).str(); \ + theLastErrorMsg = &errorMsg; \ + try { \ + throw; \ + } catch (const std::runtime_error& e) { \ + reportError(JP_SOURCE_CODE_POS, e); \ + } \ + } catch (const std::runtime_error& e) { \ + errorMsg = lastCRTError(); \ + theLastErrorMsg = &errorMsg; \ + reportError(JP_SOURCE_CODE_POS, e); \ + } \ + JP_CATCH_UNKNOWN_EXCEPTION + + JP_CATCH_ALL; + +#undef JP_HANDLE_ERROR +#undef JP_HANDLE_UNKNOWN_ERROR +#undef JP_CATCH_EXCEPTIONS +#define JP_HANDLE_ERROR(e) JP_REPORT_ERROR(e) +#define JP_HANDLE_UNKNOWN_ERROR JP_REPORT_UNKNOWN_ERROR +#define JP_CATCH_EXCEPTIONS JP_DEFAULT_CATCH_EXCEPTIONS + + return 1; +} +} // namespace app diff --git a/src/jdk.jpackage/share/native/common/app.h b/src/jdk.jpackage/share/native/common/app.h new file mode 100644 index 0000000000000..d3e5605d558cf --- /dev/null +++ b/src/jdk.jpackage/share/native/common/app.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020, 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 app_h +#define app_h + +#include "tstrings.h" + +class LogAppender; + +namespace app { + +LogAppender& defaultLastErrorLogAppender(); + +bool isWithLogging(); + +typedef void (*LauncherFunc) (); + +int launch(const std::nothrow_t&, LauncherFunc func, + LogAppender* lastErrorLogAppender = 0); + +std::string lastErrorMsg(); + +} // namespace app + +#endif // app_h diff --git a/src/jdk.jpackage/share/native/common/tstrings.cpp b/src/jdk.jpackage/share/native/common/tstrings.cpp index 0efad4191bd92..d8a7e95ed98cc 100644 --- a/src/jdk.jpackage/share/native/common/tstrings.cpp +++ b/src/jdk.jpackage/share/native/common/tstrings.cpp @@ -287,5 +287,36 @@ std::wstring toUtf16(const std::string& utf8str) { return fromMultiByte(utf8str, CP_UTF8); } +// converts utf16-encoded string to Windows encoded string (WIDECHAR or ACP) +tstring toWinString(const std::wstring& utf16) { +#if defined(_UNICODE) || defined(UNICODE) + return utf16; +#else + return toMultiByte(utf16, CP_ACP); +#endif +} + +// converts utf8-encoded string to Windows encoded string (WIDECHAR or ACP) +tstring toWinString(const std::string& utf8) { + return toWinString(tstrings::toUtf16(utf8)); +} + + +std::string winStringToUtf8(const std::wstring& winStr) { + return toUtf8(winStr); +} + +std::string winStringToUtf8(const std::string& winStr) { + return toUtf8(fromMultiByte(winStr, CP_ACP)); +} + +std::wstring winStringToUtf16(const std::wstring& winStr) { + return winStr; +} + +std::wstring winStringToUtf16(const std::string& winStr) { + return fromMultiByte(winStr, CP_ACP); +} + } // namespace tstrings #endif // ifdef TSTRINGS_WITH_WCHAR diff --git a/src/jdk.jpackage/share/native/common/tstrings.h b/src/jdk.jpackage/share/native/common/tstrings.h index 295fb4e68caed..73787ee4759c8 100644 --- a/src/jdk.jpackage/share/native/common/tstrings.h +++ b/src/jdk.jpackage/share/native/common/tstrings.h @@ -143,6 +143,16 @@ namespace tstrings { // conversion to the active code page std::string toACP(const std::wstring& utf16str); + // conversion from windows-encoding string (WIDECHAR or ACP) to utf8/utf16 + std::string winStringToUtf8(const std::wstring& winStr); + std::string winStringToUtf8(const std::string& winStr); + std::wstring winStringToUtf16(const std::wstring& winStr); + std::wstring winStringToUtf16(const std::string& winStr); + + // conversion from utf8/utf16 to windows-encoding string (WIDECHAR or ACP) + tstring toWinString(const std::wstring& utf16); + tstring toWinString(const std::string& utf8); + // conversion to Utf8 std::string toUtf8(const std::wstring& utf16str); @@ -153,6 +163,10 @@ namespace tstrings { return toUtf16(utf8str); } + inline tstring fromUtf16(const std::wstring& utf16str) { + return utf16str; + } + #else inline std::string fromUtf8(const std::string& utf8str) { return utf8str; diff --git a/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp b/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp index eadbf35754d93..0c97e7ea22ae4 100644 --- a/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp +++ b/src/jdk.jpackage/windows/native/applauncher/WinLauncher.cpp @@ -31,6 +31,7 @@ #include "JvmLauncher.h" #include "Log.h" #include "Dll.h" +#include "WinApp.h" #include "Toolbox.h" #include "FileUtils.h" #include "UniqueHandle.h" @@ -170,113 +171,13 @@ void launchApp() { #ifndef JP_LAUNCHERW int __cdecl wmain() { - return AppLauncher::launch(std::nothrow, launchApp); + return app::launch(std::nothrow, launchApp); } #else -namespace { - -class LastErrorGuiLogAppender : public LogAppender { -public: - virtual void append(const LogEvent& v) { - JP_TRY; - - const std::wstring msg = (tstrings::any() - << AppLauncher::lastErrorMsg()).wstr(); - MessageBox(0, msg.c_str(), - FileUtils::basename(SysInfo::getProcessModulePath()).c_str(), - MB_ICONERROR | MB_OK); - - JP_CATCH_ALL; - } -}; - - -class Console { -public: - Console() { - if (!AttachConsole(ATTACH_PARENT_PROCESS)) { - // Failed to connect to parent's console. Create our own. - if (!AllocConsole()) { - // We already have a console, no need to redirect std I/O. - return; - } - } - - stdoutChannel = std::unique_ptr(new Channel(stdout)); - stderrChannel = std::unique_ptr(new Channel(stderr)); - } - - struct FileCloser { - typedef FILE* pointer; - - void operator()(pointer h) { - ::fclose(h); - } - }; - - typedef std::unique_ptr< - FileCloser::pointer, - FileCloser - > UniqueFILEHandle; - -private: - class Channel { - public: - Channel(FILE* stdFILEHandle): stdFILEHandle(stdFILEHandle) { - const char* stdFileName = "CONOUT$"; - const char* openMode = "w"; - if (stdFILEHandle == stdin) { - stdFileName = "CONIN$"; - openMode = "r"; - } - - FILE* fp = 0; - freopen_s(&fp, stdFileName, openMode, stdFILEHandle); - - fileHandle = UniqueFILEHandle(fp); - - std::ios_base::sync_with_stdio(); - } - - virtual ~Channel() { - JP_TRY; - - FILE* fp = 0; - fileHandle = UniqueFILEHandle(fp); - std::ios_base::sync_with_stdio(); - - JP_CATCH_ALL; - } - - private: - UniqueFILEHandle fileHandle; - FILE *stdFILEHandle; - }; - - std::unique_ptr stdoutChannel; - std::unique_ptr stderrChannel; -}; - - -void launchAppW() { - std::unique_ptr console; - if (AppLauncher::isWithLogging()) { - console = std::unique_ptr(new Console()); - } - - launchApp(); -} - -} // namespace - - int __stdcall wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) { - LastErrorGuiLogAppender lastErrorLogAppender; - TeeLogAppender logAppender(&AppLauncher::defaultLastErrorLogAppender(), - &lastErrorLogAppender); - return AppLauncher::launch(std::nothrow, launchAppW, &logAppender); + return app::wlaunch(std::nothrow, launchApp); } #endif diff --git a/src/jdk.jpackage/windows/native/common/Flag.h b/src/jdk.jpackage/windows/native/common/Flag.h new file mode 100644 index 0000000000000..0a086f83320a5 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/Flag.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2020, 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 Flag_h +#define Flag_h + + +template +class Flag { +public: + explicit Flag(T2 v): val(v) {} + + bool operator == (const Flag& other) const { + return val == other.val; + } + bool operator != (const Flag& other) const { + return ! *this == other; + } + + T2 value() const { + return val; + } + +private: + T2 val; +}; + +#endif // #ifndef Flag_h diff --git a/src/jdk.jpackage/windows/native/common/Guid.cpp b/src/jdk.jpackage/windows/native/common/Guid.cpp new file mode 100644 index 0000000000000..e632624cd0ddb --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/Guid.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include +#include + +#include "Guid.h" +#include "ErrorHandling.h" + + +#pragma comment(lib, "ole32") + + +Guid::Guid(const std::string& str) { + *this = Guid(std::wstring(str.begin(), str.end())); +} + + +namespace { + +void initGuid(const std::wstring& str, GUID& v) { + if (S_OK != IIDFromString(str.c_str(), &v)) { + JP_THROW(tstrings::any() << "IIDFromString(" << str << ") failed"); + } +} + +} //namespace + +Guid::Guid(const std::wstring& str) { + enum { StdGuildLength = 38 }; + + if ((str.size() == StdGuildLength && str.front() == L'{' && str.back() == L'}')) { + initGuid(str, value); + return; + } + + enum { BracketCount = 2 }; + enum { DashCount = 4 }; + + std::wstring buf(str); + + if (str.size() >= (StdGuildLength - (BracketCount + DashCount))) { + if (str.front() != L'{' && str.back() != L'}') { + buf = L"{" + str + L"}"; + } + + if (str.find(L'-') == std::wstring::npos) { + const size_t positions[] = { 9, 14, 19, 24 }; + for (int i = 0; i < DashCount; ++i) { + buf.insert(positions[i], 1, L'-'); + } + } + + if (buf.size() != StdGuildLength) { + // Still no good, drop all tweaks. + // Let parsing function fail on the original string. + buf = str; + } + } + initGuid(buf, value); +} + + +Guid::Guid(const GUID& v): value(v) { +} + + +Guid::Guid() { + memset(&value, 0, sizeof(value)); +} + + +bool Guid::operator < (const Guid& other) const { + return toString() < other.toString(); +} + + +bool Guid::operator == (const Guid& other) const { + return IsEqualGUID(value, other.value) != FALSE; +} + + +tstring Guid::toString(int flags) const { + wchar_t buffer[128]; + const int chars = StringFromGUID2(value, buffer, _countof(buffer)); + if (chars < 3 /* strlen("{}") + 1 */) { + JP_THROW("StringFromGUID2() failed"); + } + + tstring reply(tstrings::fromUtf16(buffer)); + + if (flags & NoCurlyBrackets) { + reply = reply.substr(1, reply.size() - 2); + } + + if (flags & NoDashes) { + // Drop all '-'. + reply = tstring(reply.begin(), std::remove(reply.begin(), reply.end(), _T('-'))); + } + + if (flags & LowerCase) { + reply = tstrings::toLower(reply); + } + + return reply; +} + + +Guid Guid::generate() { + GUID guid = { 0 }; + if (S_OK != CoCreateGuid(&guid)) { + JP_THROW("CoCreateGuid() failed"); + } + return Guid(guid); +} diff --git a/src/jdk.jpackage/windows/native/common/Guid.h b/src/jdk.jpackage/windows/native/common/Guid.h new file mode 100644 index 0000000000000..8a95845bff965 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/Guid.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2020, 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 Guid_h +#define Guid_h + +#include +#include "tstrings.h" + + +class Guid { +public: + Guid(const std::string& str); + Guid(const std::wstring& str); + Guid(const GUID& v); + Guid(); + + // Comparison for equality is the only comparison operation that make + // sense for GUIDs. However in order to use STL algorithms with + // Guid class need to define less operator. + bool operator < (const Guid& other) const; + bool operator == (const Guid& other) const; + bool operator != (const Guid& other) const { + return ! (*this == other); + } + + enum StringifyFlags { + WithCurlyBrackets = 0x0, + WithDashes = 0x0, + UpperCase = 0x0, + StringifyDefaults = WithCurlyBrackets | UpperCase | WithDashes, + NoCurlyBrackets = 0x1, + NoDashes = 0x2, + LowerCase = 0x4, + }; + + tstring toString(int flags=StringifyDefaults) const; + + /** + * Returns string GUID representation of this instance compatible with + * Windows MSI API. + */ + tstring toMsiString() const { + return toString(UpperCase | WithCurlyBrackets | WithDashes); + } + + static Guid generate(); + +private: + GUID value; +}; + +#endif // #ifndef Guid_h diff --git a/src/jdk.jpackage/windows/native/common/MsiDb.cpp b/src/jdk.jpackage/windows/native/common/MsiDb.cpp new file mode 100644 index 0000000000000..d59706286287c --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/MsiDb.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include "MsiDb.h" +#include "FileUtils.h" +#include "WinFileUtils.h" +#include "Log.h" + + +#pragma comment(lib, "msi.lib") + + +namespace msi { + +void closeDatabaseView(MSIHANDLE hView) { + if (hView) { + const auto status = MsiViewClose(hView); + if (status != ERROR_SUCCESS) { + LOG_WARNING(tstrings::any() << "MsiViewClose(" + << hView << ") failed with error=" << status); + return; + } + closeMSIHANDLE(hView); + } +} + + +namespace { +UniqueMSIHANDLE openDatabase(const tstring& msiPath) { + MSIHANDLE h = 0; + const UINT status = MsiOpenDatabase(msiPath.c_str(), + MSIDBOPEN_READONLY, &h); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() + << "MsiOpenDatabase(" << msiPath + << ", MSIDBOPEN_READONLY) failed", status)); + } + return UniqueMSIHANDLE(h); +} + +} // namespace + +Database::Database(const Guid& productCode): + msiPath(getProductInfo(productCode, INSTALLPROPERTY_LOCALPACKAGE)), + dbHandle(openDatabase(msiPath)) { +} + + +Database::Database(const tstring& msiPath): msiPath(msiPath), + dbHandle(openDatabase(msiPath)) { +} + + +tstring Database::getProperty(const tstring& name) const { + // Query value of a property with the given name from 'Property' MSI table. + const tstring sqlQuery = (tstrings::any() + << "SELECT Value FROM Property WHERE Property = '" + << name << "'").tstr(); + + DatabaseView view(*this, sqlQuery); + const DatabaseRecord record(view); + + // Data is stored in a record object. SQL query is constructed in a way + // this record object contains a single field. + // Verify record contains exactly one field. + if (record.getFieldCount() != 1) { + JP_THROW(Error( + tstrings::any() << "record.getFieldCount(" << msiPath + << ", " << sqlQuery + << ") returned unexpected value", + ERROR_SUCCESS)); + } + + // Field identifier. They start with 1, not from 0. + const unsigned field = 1; + return record.getString(field); +} + + +tstring Database::getProperty(const std::nothrow_t&, const tstring& name) const { + try { + return getProperty(name); + } catch (const NoMoreItemsError&) { + } + JP_CATCH_EXCEPTIONS; + return tstring(); +} + + +DatabaseRecord::DatabaseRecord(unsigned fieldCount) { + MSIHANDLE h = MsiCreateRecord(fieldCount); + if (!h) { + JP_THROW(msi::Error(tstrings::any() << "MsiCreateRecord(" + << fieldCount << ") failed", ERROR_FUNCTION_FAILED)); + } + handle = UniqueMSIHANDLE(h); +} + + +DatabaseRecord& DatabaseRecord::operator=(const DatabaseRecord& other) { + DatabaseRecord tmp(other); + std::swap(handle, tmp.handle); + return *this; +} + + +DatabaseRecord& DatabaseRecord::fetch(DatabaseView& view) { + *this = view.fetch(); + return *this; +} + + +DatabaseRecord& DatabaseRecord::tryFetch(DatabaseView& view) { + *this = view.tryFetch(); + return *this; +} + + +DatabaseRecord& DatabaseRecord::setString(unsigned idx, const tstring& v) { + const UINT status = MsiRecordSetString(handle.get(), idx, v.c_str()); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() << "MsiRecordSetString(" << idx + << ", " << v << ") failed", status)); + } + return *this; +} + + +DatabaseRecord& DatabaseRecord::setInteger(unsigned idx, int v) { + const UINT status = MsiRecordSetInteger(handle.get(), idx, v); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() << "MsiRecordSetInteger(" << idx + << ", " << v << ") failed", status)); + } + return *this; +} + + +DatabaseRecord& DatabaseRecord::setStreamFromFile(unsigned idx, + const tstring& v) { + const UINT status = MsiRecordSetStream(handle.get(), idx, v.c_str()); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() << "MsiRecordSetStream(" << idx + << ", " << v << ") failed", status)); + } + return *this; +} + + +unsigned DatabaseRecord::getFieldCount() const { + const unsigned reply = MsiRecordGetFieldCount(handle.get()); + if (int(reply) <= 0) { + JP_THROW(Error(std::string("MsiRecordGetFieldCount() failed"), + ERROR_FUNCTION_FAILED)); + } + return reply; +} + + +int DatabaseRecord::getInteger(unsigned idx) const { + int const reply = MsiRecordGetInteger(handle.get(), idx); + if (reply == MSI_NULL_INTEGER) { + JP_THROW(Error(tstrings::any() << "MsiRecordGetInteger(" << idx + << ") failed", ERROR_FUNCTION_FAILED)); + } + return reply; +} + + +void DatabaseRecord::saveStreamToFile(unsigned idx, + const tstring& path) const { + enum { ReadStreamBufferBytes = 1024 * 1024 }; + + FileUtils::FileWriter writer(path); + + std::vector buffer(ReadStreamBufferBytes); + DWORD bytes; + do { + bytes = ReadStreamBufferBytes; + const UINT status = MsiRecordReadStream(handle.get(), UINT(idx), + buffer.data(), &bytes); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(std::string("MsiRecordReadStream() failed"), + status)); + } + writer.write(buffer.data(), bytes); + } while(bytes == ReadStreamBufferBytes); + writer.finalize(); +} + + +DatabaseView::DatabaseView(const Database& db, const tstring& sqlQuery, + const DatabaseRecord& queryParam): db(db), sqlQuery(sqlQuery) { + MSIHANDLE h = 0; + + // Create SQL query. + for (const UINT status = MsiDatabaseOpenView(db.dbHandle.get(), + sqlQuery.c_str(), &h); status != ERROR_SUCCESS; ) { + JP_THROW(Error(tstrings::any() << "MsiDatabaseOpenView(" + << sqlQuery << ") failed", status)); + } + + UniqueMSIHANDLE tmp(h); + + // Run SQL query. + for (const UINT status = MsiViewExecute(h, queryParam.handle.get()); + status != ERROR_SUCCESS; ) { + JP_THROW(Error(tstrings::any() << "MsiViewExecute(" + << sqlQuery << ") failed", status)); + } + + // MsiViewClose should be called only after + // successful MsiViewExecute() call. + handle = UniqueDbView(h); + tmp.release(); +} + + +DatabaseRecord DatabaseView::fetch() { + DatabaseRecord reply = tryFetch(); + if (reply.empty()) { + JP_THROW(NoMoreItemsError(tstrings::any() << "No more items in [" + << sqlQuery << "] query")); + } + return reply; +} + + +DatabaseRecord DatabaseView::tryFetch() { + MSIHANDLE h = 0; + + // Fetch data from executed SQL query. + // Data is stored in a record object. + for (const UINT status = MsiViewFetch(handle.get(), &h); + status != ERROR_SUCCESS; ) { + if (status == ERROR_NO_MORE_ITEMS) { + return DatabaseRecord(); + } + + JP_THROW(Error(tstrings::any() << "MsiViewFetch(" << sqlQuery + << ") failed", status)); + } + + DatabaseRecord reply; + reply.handle = UniqueMSIHANDLE(h); + return reply; +} + + +DatabaseView& DatabaseView::modify(const DatabaseRecord& record, + MSIMODIFY mode) { + const UINT status = MsiViewModify(handle.get(), mode, record.handle.get()); + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() << "MsiViewModify(mode=" << mode + << ") failed", status)); + } + return *this; +} + +} // namespace msi diff --git a/src/jdk.jpackage/windows/native/common/MsiDb.h b/src/jdk.jpackage/windows/native/common/MsiDb.h new file mode 100644 index 0000000000000..98188a932514e --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/MsiDb.h @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2020, 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 MsiDb_h +#define MsiDb_h + +#include +#include + +#include "MsiUtils.h" + + +class Guid; + +/** + * Helpers to interact with MSI through database interface. + */ + +namespace msi { +void closeDatabaseView(MSIHANDLE h); + +struct MsiDbViewDeleter { + typedef MSIHANDLE pointer; + + void operator()(MSIHANDLE h) { + closeDatabaseView(h); + } +}; +} // namespace msi + + +typedef std::unique_ptr UniqueDbView; + + +namespace msi { + +class CA; +class DatabaseView; +class DatabaseRecord; + + +/** + * Opens product's database to query properties. + * The database is opened in R/O mode, i.e. it is safe to call this method + * even if there is active install/uninstall session. Unlike MsiOpenProduct(), + * it never fails with 1618 ('Another installation is + * already in progress') error code. + * + * Database can be opened from product code GUID, path to msi package or from + * custom action. + * + * If opened from CA the database is opened in R/W mode, however only adding + * new temporary records is supported. It is forbidden to change data in + * existing records. + */ +class Database { +public: + /** + * Opens msi database from the given product code GUID. + * Throws exception if fails. + */ + explicit Database(const Guid& productCode); + + /** + * Opens msi database from the given path to .msi file. + * Throws exception if fails. + */ + explicit Database(const tstring& msiPath); + + /** + * Opens msi database from the given custom action. + * Throws exception if fails. + */ + explicit Database(const CA& ca); + + /** + * Returns value of property with the given name. + * Throws NoMoreItemsError if property with the given name doesn't exist + * or Error if some error occurred. + */ + tstring getProperty(const tstring& name) const; + + /** + * Returns value of property with the given name. + * Returns empty string if property with the given name doesn't exist or + * if some error occurred. + */ + tstring getProperty(const std::nothrow_t&, const tstring& name) const; + + friend class DatabaseView; + +private: + Database(const Database&); + Database& operator=(const Database&); +private: + const tstring msiPath; + UniqueMSIHANDLE dbHandle; +}; + +typedef std::unique_ptr DatabasePtr; + + +class DatabaseRecord { +public: + DatabaseRecord(): handle(MSIHANDLE(0)) { + } + + DatabaseRecord(const DatabaseRecord& other): handle(MSIHANDLE(0)) { + handle.swap(other.handle); + } + + DatabaseRecord& operator=(const DatabaseRecord& other); + + friend class DatabaseView; + + explicit DatabaseRecord(unsigned fieldCount); + + explicit DatabaseRecord(DatabaseView& view) { + fetch(view); + } + + DatabaseRecord& fetch(DatabaseView& view); + + DatabaseRecord& tryFetch(DatabaseView& view); + + DatabaseRecord& setString(unsigned idx, const tstring& v); + + DatabaseRecord& setInteger(unsigned idx, int v); + + DatabaseRecord& setStreamFromFile(unsigned idx, const tstring& v); + + unsigned getFieldCount() const; + + tstring getString(unsigned idx) const; + + int getInteger(unsigned idx) const; + + void saveStreamToFile(unsigned idx, const tstring& path) const; + + bool empty() const { + return 0 == handle.get(); + } + + MSIHANDLE getHandle() const { + return handle.get(); + } + +private: + mutable UniqueMSIHANDLE handle; +}; + + +class DatabaseView { +public: + DatabaseView(const Database& db, const tstring& sqlQuery, + const DatabaseRecord& queryParam=DatabaseRecord()); + + DatabaseRecord fetch(); + + DatabaseRecord tryFetch(); + + DatabaseView& modify(const DatabaseRecord& record, MSIMODIFY mode); + +private: + tstring sqlQuery; + const Database& db; + UniqueDbView handle; +}; + +} // namespace msi + +#endif // #ifndef MsiDb_h diff --git a/src/jdk.jpackage/windows/native/common/MsiUtils.cpp b/src/jdk.jpackage/windows/native/common/MsiUtils.cpp new file mode 100644 index 0000000000000..c561bcad27755 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/MsiUtils.cpp @@ -0,0 +1,420 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include "MsiUtils.h" +#include "MsiDb.h" +#include "Resources.h" +#include "Dll.h" +#include "UniqueHandle.h" +#include "FileUtils.h" +#include "WinErrorHandling.h" + + +#pragma comment(lib, "msi.lib") + + +namespace msi { + +namespace { + +template +tstring getProperty(Func func, const LPCSTR funcName, Arg1Type arg1, + Arg2Type arg2) { + + std::vector buf(20); + DWORD size = static_cast(buf.size()); + + UINT status = ERROR_MORE_DATA; + while (ERROR_MORE_DATA == + (status = func(arg1, arg2, &*buf.begin(), &size))) { + buf.resize(buf.size() * 2); + size = static_cast(buf.size()); + } + + if (status != ERROR_SUCCESS) { + JP_THROW(Error(tstrings::any() << funcName << "(" << arg1 + << ", " << arg2 << ") failed", status)); + } + return tstring(buf.begin(), buf.begin() + size); +} + +template +tstring getProperty(const std::nothrow_t&, Func func, const LPCSTR funcName, + Arg1Type arg1, Arg2Type arg2) { + try { + return getProperty(func, funcName, arg1, arg2); + } catch (const std::exception&) { + } + return tstring(); +} + + +tstring escapePropertyValue(const tstring& value) { + // Escape quotes as described in + // http://msdn.microsoft.com/en-us/library/aa367988.aspx + tstring reply = tstrings::replace(value, _T("\""), _T("\"\"")); + + if (reply.empty()) { + // MSDN: To clear a public property by using the command line, + // set its value to an empty string. + reply = _T("\"\""); + } + + if (reply.find_first_of(_T(" \t")) != tstring::npos) { + reply = _T('"') + reply + _T('"'); + } + + return reply; +} + +template +tstring stringifyProperties(It b, It e) { + tostringstream buf; + for (; b != e; ++b) { + const tstring value = escapePropertyValue(b->second); + buf << _T(" ") << b->first << _T("=") << value; + } + + tstring reply = tstrings::trim(buf.str()); + return reply; +} + + +class CallbackTrigger { + CallbackTrigger(const CallbackTrigger&); + CallbackTrigger& operator=(const CallbackTrigger&); + + enum { MESSAGE_FILTER = 0xffffffff }; + + static int WINAPI adapter(LPVOID ctx, UINT type, LPCWSTR msg) { + Callback* callback = reinterpret_cast(ctx); + if (!callback) { + return 0; + } + + JP_TRY; + + // MSDN: Handling Progress Messages Using MsiSetExternalUI + // http://msdn.microsoft.com/en-us/library/aa368786(v=vs.85).aspx + const INSTALLMESSAGE mt = (INSTALLMESSAGE)(0xFF000000 & type); + const UINT flags = 0x00FFFFFF & type; + + if (msg) { + callback->notify(mt, flags, tstrings::toWinString(msg)); + } + + JP_CATCH_ALL; + + return 0; + } + +public: + explicit CallbackTrigger(Callback& cb) { + MsiSetExternalUIW(adapter, DWORD(MESSAGE_FILTER), &cb); + } + + ~CallbackTrigger() { + // Not restoring the original callback. + // Just because the original message filter is unknown. + MsiSetExternalUIW(0, 0, 0); + } +}; + +class LogFileTrigger { + LogFileTrigger(const LogFileTrigger&); + LogFileTrigger& operator=(const LogFileTrigger&); + +public: + explicit LogFileTrigger(const tstring& path) { + if (path.empty()) { + MsiEnableLog(0, NULL, 0); + } else { + MsiEnableLog(INSTALLLOGMODE_VERBOSE, path.c_str(), 0); + } + } + + ~LogFileTrigger() { + // Disable log + MsiEnableLog(0, NULL, 0); + } +}; + +struct SuppressUI: public OverrideUI { + SuppressUI(): OverrideUI(withoutUI()) { + } +}; + +class StateImpl: public ActionData::State { + const OverrideUI overrideUi; + LogFileTrigger logGuard; + std::unique_ptr callbackGuard; + +public: + explicit StateImpl(const ActionData& data): overrideUi(data.uiMode), + logGuard(data.logFile) { + if (data.callback) { + callbackGuard = std::unique_ptr( + new CallbackTrigger(*data.callback)); + } + } +}; + +} // namespace + + +void closeMSIHANDLE(MSIHANDLE h) { + if (h) { + const auto status = MsiCloseHandle(h); + if (status != ERROR_SUCCESS) { + LOG_WARNING(tstrings::any() << "MsiCloseHandle(" + << h << ") failed with error=" << status); + } + } +} + + +// DatabaseRecord::getString() should live in MsiDb.cpp. +// However it can't access handy msi::getProperty() from that location. +tstring DatabaseRecord::getString(unsigned idx) const { + return ::msi::getProperty(MsiRecordGetString, "MsiRecordGetString", + handle.get(), UINT(idx)); +} + + +tstring getProductInfo(const Guid& productCode, const tstring& prop) { + const tstring id = productCode.toMsiString(); + return getProperty(MsiGetProductInfo, "MsiGetProductInfo", id.c_str(), + prop.c_str()); +} + + +tstring getProductInfo(const std::nothrow_t&, const Guid& productCode, + const tstring& prop) { + const tstring id = productCode.toMsiString(); + return getProperty(std::nothrow, MsiGetProductInfo, "MsiGetProductInfo", + id.c_str(), prop.c_str()); +} + + +tstring getPropertyFromCustomAction(MSIHANDLE h, const tstring& prop) { + return getProperty(MsiGetProperty, "MsiGetProperty", h, prop.c_str()); +} + + +tstring getPropertyFromCustomAction(const std::nothrow_t&, MSIHANDLE h, + const tstring& prop) { + return getProperty(std::nothrow, MsiGetProperty,"MsiGetProperty", h, + prop.c_str()); +} + + +namespace { +std::string makeMessage(const std::string& msg, UINT errorCode) { + std::ostringstream err; + err << "MSI error [" << errorCode << "]"; + + const std::wstring msimsg_dll = tstrings::winStringToUtf16(FileUtils::combinePath( + SysInfo::getSystem32Dir(), _T("msimsg.dll"))); + + // Convert MSI Error Code to Description String + // http://msdn.microsoft.com/en-us/library/aa370315(v=vs.85).aspx + Dll::Handle lib(LoadLibraryExW(msimsg_dll.c_str(), NULL, + LOAD_LIBRARY_AS_DATAFILE)); + if (!lib.get()) { + JP_THROW(SysError(tstrings::any() << "LoadLibraryExW(" << + msimsg_dll << ") failed", LoadLibraryExW)); + } else { + tstring descr; + try { + descr = StringResource(errorCode, lib.get()).string(); + } catch (const std::exception &) { + descr = _T("No description"); + } + err << "(" << descr << ")"; + } + + return joinErrorMessages(msg, err.str()); +} +} // namespace + +Error::Error(const tstrings::any& msg, UINT ec): std::runtime_error( + makeMessage(msg.str(), ec)), errorCode(ec) { +} + + +Error::Error(const std::string& msg, UINT ec): std::runtime_error( + makeMessage(msg, ec)), errorCode(ec) { +} + + +tstring ActionData::getCmdLineArgs() const { + tstring raw = tstrings::trim(rawCmdLineArgs); + tstring strProperties = stringifyProperties(props.begin(), props.end()); + if (!raw.empty() && !strProperties.empty()) { + raw += _T(' '); + } + return raw + strProperties; +} + + +std::unique_ptr ActionData::createState() const { + return std::unique_ptr(new StateImpl(*this)); +} + + +namespace { + +bool isMsiStatusSuccess(const UINT status) { + switch (status) { + case ERROR_SUCCESS: + case ERROR_SUCCESS_REBOOT_INITIATED: + case ERROR_SUCCESS_REBOOT_REQUIRED: + return true; + default: + break; + } + return false; +} + +ActionStatus handleMsiStatus(tstrings::any& logMsg, const UINT status) { + if (!isMsiStatusSuccess(status)) { + logMsg << "failed [" << status << "]"; + return ActionStatus(status, logMsg.str()); + } + + logMsg << "succeeded"; + if (status != ERROR_SUCCESS) { + logMsg << " [" << status << "]"; + } + LOG_INFO(logMsg); + return ActionStatus(status); +} + +} // namespace + + +ActionStatus::operator bool() const { + return isMsiStatusSuccess(value); +} + + +void ActionStatus::throwIt() const { + JP_THROW(Error(comment, value)); +} + + +namespace { +template +ActionStatus msiAction(const T& obj, INSTALLSTATE state, + const tstring& cmdLineArgs) { + const tstring id = obj.getProductCode().toMsiString(); + const int level = INSTALLLEVEL_MAXIMUM; + const UINT status = MsiConfigureProductEx(id.c_str(), level, state, + cmdLineArgs.c_str()); + + tstrings::any logMsg; + logMsg << "MsiConfigureProductEx(" + << id + << ", " << level + << ", " << state + << ", " << cmdLineArgs + << ") "; + + return handleMsiStatus(logMsg, status); +} +} // namespace + + +template <> +ActionStatus action::execute(const uninstall& obj, + const tstring& cmdLineArgs) { + return msiAction(obj, INSTALLSTATE_ABSENT, cmdLineArgs); +} + + +template <> +ActionStatus action::execute(const update& obj, + const tstring& cmdLineArgs) { + return msiAction(obj, INSTALLSTATE_LOCAL, cmdLineArgs); +} + + +template <> +ActionStatus action::execute(const install& obj, + const tstring& cmdLineArgs) { + const tstring& msiPath = obj.getMsiPath(); + + const UINT status = MsiInstallProduct(msiPath.c_str(), + cmdLineArgs.c_str()); + + tstrings::any logMsg; + logMsg << "MsiInstallProduct(" << msiPath << ", " << cmdLineArgs << ") "; + + return handleMsiStatus(logMsg, status); +} + + +uninstall::uninstall() { + // Uninstall default behavior is to never reboot. + setProperty(_T("REBOOT"), _T("ReallySuppress")); +} + + +bool waitForInstallationCompletion(DWORD timeoutMS) +{ + // "_MSIExecute" mutex is used by the MSI installer service to prevent multiple installations at the same time + // http://msdn.microsoft.com/en-us/library/aa372909(VS.85).aspx + LPCTSTR mutexName = _T("Global\\_MSIExecute"); + UniqueHandle h(OpenMutex(SYNCHRONIZE, FALSE, mutexName)); + if (h.get() != NULL) { + DWORD res = WaitForSingleObject(h.get(), timeoutMS); + // log only if timeout != 0 + if (timeoutMS != 0) { + LOG_INFO(tstrings::any() << "finish waiting for mutex: " << res); + } + if (res == WAIT_TIMEOUT) { + return false; + } + } + return true; +} + + +bool isProductInstalled(const Guid& productCode) { + // Query any property. If product exists, query should succeed. + try { + getProductInfo(productCode, INSTALLPROPERTY_VERSIONSTRING); + } catch (const Error& e) { + switch (e.getReason()) { + case ERROR_UNKNOWN_PRODUCT: + // if the application being queried is advertised and not installed. + case ERROR_UNKNOWN_PROPERTY: + return false; + } + } + return true; +} + +} // namespace msi diff --git a/src/jdk.jpackage/windows/native/common/MsiUtils.h b/src/jdk.jpackage/windows/native/common/MsiUtils.h new file mode 100644 index 0000000000000..2a9b7a6f1e1e0 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/MsiUtils.h @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2020, 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 MsiUtils_h +#define MsiUtils_h + +#include +#include +#include +#include +#include +#include +#include + +#include "ErrorHandling.h" +#include "Toolbox.h" +#include "Guid.h" +#include "Flag.h" +#include "Log.h" + + +namespace msi { + +void closeMSIHANDLE(MSIHANDLE h); + +struct MsiHandleDeleter { + typedef MSIHANDLE pointer; + + void operator()(MSIHANDLE h) { + closeMSIHANDLE(h); + } +}; + +} // namespace msi + +typedef std::unique_ptr UniqueMSIHANDLE; + +namespace msi { + +tstring getProductInfo(const Guid& productCode, const tstring& prop); + +tstring getProductInfo(const std::nothrow_t&, const Guid& productCode, + const tstring& prop); + +tstring getPropertyFromCustomAction(MSIHANDLE h, const tstring& prop); + +tstring getPropertyFromCustomAction(const std::nothrow_t&, MSIHANDLE h, + const tstring& prop); + +inline tstring getPropertyFromDeferredCustomAction(MSIHANDLE h) { + return getPropertyFromCustomAction(h, _T("CustomActionData")); +} + +inline tstring getPropertyFromDeferredCustomAction(const std::nothrow_t&, + MSIHANDLE h) { + return getPropertyFromCustomAction(std::nothrow, h, + _T("CustomActionData")); +} + + +// UI level flags +class Tag {}; +typedef Flag UiModeFlag; + +inline UiModeFlag defaultUI() { + return UiModeFlag(INSTALLUILEVEL_DEFAULT); +} + +inline UiModeFlag withoutUI() { + return UiModeFlag(INSTALLUILEVEL_NONE); +} + + +// UI level control +struct OverrideUI { + explicit OverrideUI(const UiModeFlag& uiMode): + origMsiUiLevel(MsiSetInternalUI(uiMode.value(), 0)) { + } + + ~OverrideUI() { + MsiSetInternalUI(origMsiUiLevel, 0); + } + +private: + const INSTALLUILEVEL origMsiUiLevel; +}; + +struct SuppressUI: public OverrideUI { + SuppressUI(): OverrideUI(withoutUI()) { + } +}; + + +// MSI Properties (KEY=VALUE) +typedef std::pair Property; +typedef std::vector Properties; + + +// Callback for MSI functions +class Callback { +public: + virtual ~Callback() {} + + virtual void notify(INSTALLMESSAGE msgType, UINT flags, + const tstring& msg) = 0; +}; + + +// MSI Error +class Error : public std::runtime_error { +public: + Error(const tstrings::any& msg, UINT errorCode); + Error(const std::string& msg, UINT errorCode); + UINT getReason() const { + return errorCode; + } +private: + UINT errorCode; +}; + +// "No more items" exception +class NoMoreItemsError : public Error { +public: + NoMoreItemsError(const tstrings::any& msg) + : Error(msg, ERROR_NO_MORE_ITEMS) + {} +}; + +struct ActionData { + typedef std::map PropertyMap; + PropertyMap props; + tstring rawCmdLineArgs; + UiModeFlag uiMode; + Callback* callback; + tstring logFile; + + struct State { + virtual ~State() {} + }; + + std::unique_ptr createState() const; + + tstring getCmdLineArgs() const; + + ActionData(): uiMode(withoutUI()), callback(0) { + } +}; + + +// MSI function execution status. +class ActionStatus { +public: + ActionStatus(UINT value=ERROR_SUCCESS, const std::string& comment=""): + value(value), comment(comment) { + } + + explicit operator bool() const; + + UINT getValue() const { + return value; + } + + // Unconditionally converts this instance into msi::Error instance and + // throws it. + void throwIt() const; + + const std::string& getComment() const { + return comment; + } + +private: + std::string comment; + UINT value; +}; + + +// Some MSI action. +template +class action { +public: + T& setProperty(const Property& prop) { + data.props[prop.first] = prop.second; + return *static_cast(this); + } + + T& setProperty(const tstring& name, const tstring& value) { + return setProperty(Property(name, value)); + } + + template + T& setProperties(It b, It e) { + std::copy(b, e, std::inserter(data.props, data.props.end())); + return *static_cast(this); + } + + T& setRawCmdLineArgs(const tstring& value) { + data.rawCmdLineArgs = value; + return *static_cast(this); + } + + T& setUiMode(const UiModeFlag& flag) { + data.uiMode = flag; + return *static_cast(this); + } + + T& setLogFile(const tstring& path=tstring()) { + data.logFile = path; + return *static_cast(this); + } + + T& setCallback(Callback* cb) { + data.callback = cb; + return *static_cast(this); + } + + tstring getCmdLineArgs() const { + return data.getCmdLineArgs(); + } + + void operator () () const { + std::unique_ptr state(data.createState()); + const ActionStatus status = execute(*static_cast(this), + data.getCmdLineArgs()); + if (!status) { + status.throwIt(); + } + } + + ActionStatus operator () (const std::nothrow_t&) const { + JP_TRY; + std::unique_ptr state(data.createState()); + const ActionStatus status = execute(*static_cast(this), + data.getCmdLineArgs()); + if (!status) { + LOG_ERROR(status.getComment()); + } + return status; + JP_CATCH_ALL; + return ActionStatus(ERROR_INTERNAL_ERROR, "Unknown error"); + } + +private: + static ActionStatus execute(const T& obj, const tstring& cmdLineArgs); + + ActionData data; +}; + + +// Function object to uninstall product with the given GUID +class uninstall: public action { + Guid productCode; +public: + uninstall(); + + uninstall& setProductCode(const Guid& pc) { + productCode = pc; + return *this; + } + + const Guid& getProductCode() const { + return productCode; + } +}; + + +// Function object to update installed product with the given GUID +class update: public action { + Guid productCode; +public: + update& setProductCode(const Guid& pc) { + productCode = pc; + return *this; + } + + const Guid& getProductCode() const { + return productCode; + } +}; + + +// Function object to install package from the given msi file +class install: public action { + tstring msiPath; +public: + install& setMsiPath(const tstring& path) { + msiPath = path; + return *this; + } + + const tstring& getMsiPath() const { + return msiPath; + } +}; + + +// Checks if there is some installation is in progress and waits until it completes. +// returns true if there is no installation is in progress or the installation is completed. +// returns false if timeout exceeded. +// If timeout == 0, just checks that Windows Installer service is free. +bool waitForInstallationCompletion(DWORD timeoutMS); + +// Checks if there is some installation is in progress. +inline bool isInstallationInProgress() { + return !waitForInstallationCompletion(0); +} + + +/** + * Returns true if product with the given product code is installed. + */ +bool isProductInstalled(const Guid& productCode); + +} // namespace msi + +#endif // #ifndef MsiUtils_h diff --git a/src/jdk.jpackage/windows/native/msiwrapper/Resources.cpp b/src/jdk.jpackage/windows/native/common/Resources.cpp similarity index 91% rename from src/jdk.jpackage/windows/native/msiwrapper/Resources.cpp rename to src/jdk.jpackage/windows/native/common/Resources.cpp index 07fcdac7cd713..a0cf388b713b8 100644 --- a/src/jdk.jpackage/windows/native/msiwrapper/Resources.cpp +++ b/src/jdk.jpackage/windows/native/common/Resources.cpp @@ -148,3 +148,21 @@ Resource::ByteArray Resource::binary() const { LPBYTE resPtr = (LPBYTE)getPtr(size); return ByteArray(resPtr, resPtr+size); } + + +tstring StringResource::string() const +{ + DWORD size = 0; + // string are stored as UNICODE + LPWSTR resPtr = reinterpret_cast(impl.getPtr(size)); + // size is in bytes; + return tstrings::fromUtf16(std::wstring(resPtr, size / sizeof(wchar_t))); +} + +tstring StringResource::string(const std::nothrow_t &, const tstring &defValue) const throw() +{ + JP_TRY; + return string(); + JP_CATCH_ALL; + return defValue; +} diff --git a/src/jdk.jpackage/windows/native/msiwrapper/Resources.h b/src/jdk.jpackage/windows/native/common/Resources.h similarity index 61% rename from src/jdk.jpackage/windows/native/msiwrapper/Resources.h rename to src/jdk.jpackage/windows/native/common/Resources.h index 4c8b9bcab8340..4d68e67800652 100644 --- a/src/jdk.jpackage/windows/native/msiwrapper/Resources.h +++ b/src/jdk.jpackage/windows/native/common/Resources.h @@ -29,6 +29,8 @@ #include "WinSysInfo.h" +class StringResource; + /** * Classes for resource loading. * Common use cases: @@ -37,6 +39,17 @@ * if (res.available()) { * res.saveToFile(_T("c:\\temp\\my_resource.bin")); * } + * + * - get string resource: + * 1) if the resource is not available, exception is thrown: + * tstring str = StringResource(MAKEINTRESOURCE(resID)).string(); + * + * 2) nothrow method (returns default value if the resource is not available): + * a) returns empty string on error: + * tstring str = StringResource(MAKEINTRESOURCE(resID)).string(std::nothrow); + * + * b) returns provided default value on error: + * tstring str = StringResource(MAKEINTRESOURCE(resID)).string(std::nothrow, _T("defaultValue")); */ class Resource { @@ -62,6 +75,8 @@ class Resource { // returns the resource as byte array ByteArray binary() const; + friend class StringResource; + private: std::wstring nameStr; LPCWSTR namePtr; // can be integer value or point to nameStr.c_str() @@ -82,4 +97,40 @@ class Resource { Resource& operator = (const Resource&); }; + +// Note: string resources are returned utf16 or utf8 encoded. +// To get Windows-encoded string (utf16/ACP) use tstrings::toWinString(). +class StringResource { +public: + // string resource is always identified by integer id + StringResource(UINT resourceId, HINSTANCE moduleHandle = SysInfo::getCurrentModuleHandle()) + : impl(resourceId, RT_STRING, moduleHandle) {} + + // returns the resource as string + tstring string() const; + // nothrow version (logs error) + tstring string(const std::nothrow_t &, const tstring &defValue = tstring()) const throw(); + + bool available() const throw() { + return impl.available(); + } + + unsigned size() const { + return impl.size(); + } + + static tstring load(UINT resourceId, + HINSTANCE moduleHandle = SysInfo::getCurrentModuleHandle()) { + return StringResource(resourceId, moduleHandle).string(); + } + + static tstring load(const std::nothrow_t &, UINT resourceId, + HINSTANCE moduleHandle = SysInfo::getCurrentModuleHandle()) throw () { + return StringResource(resourceId, moduleHandle).string(std::nothrow); + } + +private: + Resource impl; +}; + #endif // RESOURCES_H diff --git a/src/jdk.jpackage/windows/native/common/WinApp.cpp b/src/jdk.jpackage/windows/native/common/WinApp.cpp new file mode 100644 index 0000000000000..13258f519db61 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/WinApp.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include +#include "WinApp.h" +#include "Log.h" +#include "SysInfo.h" +#include "FileUtils.h" +#include "ErrorHandling.h" + + +// MessageBox +#pragma comment(lib, "user32") + + +namespace { + +class LastErrorGuiLogAppender : public LogAppender { +public: + virtual void append(const LogEvent& v) { + JP_TRY; + + const std::wstring msg = (tstrings::any() + << app::lastErrorMsg()).wstr(); + MessageBox(0, msg.c_str(), + FileUtils::basename(SysInfo::getProcessModulePath()).c_str(), + MB_ICONERROR | MB_OK); + + JP_CATCH_ALL; + } +}; + + +class Console { +public: + Console() { + if (!AttachConsole(ATTACH_PARENT_PROCESS)) { + // Failed to connect to parent's console. Create our own. + if (!AllocConsole()) { + // We already have a console, no need to redirect std I/O. + return; + } + } + + stdoutChannel = std::unique_ptr(new Channel(stdout)); + stderrChannel = std::unique_ptr(new Channel(stderr)); + } + + struct FileCloser { + typedef FILE* pointer; + + void operator()(pointer h) { + ::fclose(h); + } + }; + + typedef std::unique_ptr< + FileCloser::pointer, + FileCloser + > UniqueFILEHandle; + +private: + class Channel { + public: + Channel(FILE* stdFILEHandle): stdFILEHandle(stdFILEHandle) { + const char* stdFileName = "CONOUT$"; + const char* openMode = "w"; + if (stdFILEHandle == stdin) { + stdFileName = "CONIN$"; + openMode = "r"; + } + + FILE* fp = 0; + freopen_s(&fp, stdFileName, openMode, stdFILEHandle); + + fileHandle = UniqueFILEHandle(fp); + + std::ios_base::sync_with_stdio(); + } + + virtual ~Channel() { + JP_TRY; + + FILE* fp = 0; + fileHandle = UniqueFILEHandle(fp); + std::ios_base::sync_with_stdio(); + + JP_CATCH_ALL; + } + + private: + UniqueFILEHandle fileHandle; + FILE *stdFILEHandle; + }; + + std::unique_ptr stdoutChannel; + std::unique_ptr stderrChannel; +}; + +} // namespace + + +namespace app { +int wlaunch(const std::nothrow_t&, LauncherFunc func) { + std::unique_ptr console; + JP_TRY; + if (app::isWithLogging()) { + console = std::unique_ptr(new Console()); + } + JP_CATCH_ALL; + + LastErrorGuiLogAppender lastErrorLogAppender; + TeeLogAppender logAppender(&app::defaultLastErrorLogAppender(), + &lastErrorLogAppender); + return app::launch(std::nothrow, func, &logAppender); +} +} // namespace app diff --git a/src/jdk.jpackage/windows/native/common/WinApp.h b/src/jdk.jpackage/windows/native/common/WinApp.h new file mode 100644 index 0000000000000..ab3429de33089 --- /dev/null +++ b/src/jdk.jpackage/windows/native/common/WinApp.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020, 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 WinApp_h +#define WinApp_h + +#include "app.h" + +namespace app { + +int wlaunch(const std::nothrow_t&, LauncherFunc func); + +} // namespace app + +#endif // WinApp_h diff --git a/src/jdk.jpackage/windows/native/libjpackage/JniUtils.h b/src/jdk.jpackage/windows/native/libjpackage/JniUtils.h index c1ad0b07f10f3..b37b19bab49d1 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/JniUtils.h +++ b/src/jdk.jpackage/windows/native/libjpackage/JniUtils.h @@ -26,6 +26,7 @@ #ifndef JNIUTILS_H #define JNIUTILS_H +#include #include "jni.h" #include "tstrings.h" diff --git a/src/jdk.jpackage/windows/native/libjpackage/ResourceEditor.h b/src/jdk.jpackage/windows/native/libjpackage/ResourceEditor.h index 8e7664cd47efe..6bf81134f5da6 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/ResourceEditor.h +++ b/src/jdk.jpackage/windows/native/libjpackage/ResourceEditor.h @@ -93,12 +93,12 @@ class ResourceEditor { ResourceEditor& id(LPCWSTR v); /** - * Relaces resource configured in the given binary with the given data stream. + * Replaces resource configured in the given binary with the given data stream. */ ResourceEditor& apply(const FileLock& dstBinary, std::istream& srcStream, std::streamsize size=0); /** - * Relaces resource configured in the given binary with contents of + * Replaces resource configured in the given binary with contents of * the given binary file. */ ResourceEditor& apply(const FileLock& dstBinary, const std::wstring& srcFile); diff --git a/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp b/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp index 52e885208bce0..7b0b8fa5a74aa 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp +++ b/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp @@ -196,12 +196,14 @@ void VersionInfo::fillBuffer(std::ostream& buf) const { writeWORD(buf, 0); // wValueLength writeWORD(buf, 1); // wType - const std::wstring strLangId = (std::wstringstream() + std::wstringstream strLangIdBuf; + strLangIdBuf << std::uppercase << std::hex << std::setw(8) << std::setfill(L'0') - << engLangId).str(); + << engLangId; + const std::wstring strLangId = strLangIdBuf.str(); write(buf, strLangId); // szKey add32bitPadding(buf); // Padding diff --git a/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp b/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp index 66e20b18aefa6..69a8e098d8efc 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp +++ b/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp @@ -28,6 +28,7 @@ #include "IconSwap.h" #include "VersionInfo.h" #include "JniUtils.h" +#include "MsiDb.h" #ifdef __cplusplus extern "C" { @@ -140,9 +141,17 @@ extern "C" { const std::wstring msiPath = jni::toUnicodeString(pEnv, jmsiPath); + // Put msi file in resources. const ResourceEditor::FileLock lock(reinterpret_cast(jResourceLock)); ResourceEditor().id(L"msi").type(RT_RCDATA).apply(lock, msiPath); + // Get product code of the msi being embedded + const Guid productCode = Guid(msi::Database(msiPath).getProperty(L"ProductCode")); + + // Save product code in resources + std::istringstream in(tstrings::toUtf8(productCode.toString())); + ResourceEditor().id(L"product_code").type(RT_RCDATA).apply(lock, in); + return 0; JP_CATCH_ALL; diff --git a/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp b/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp index 1fa284195c74f..e93d9e241fa5a 100644 --- a/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp +++ b/src/jdk.jpackage/windows/native/msiwrapper/MsiWrapper.cpp @@ -26,17 +26,34 @@ #include #include +#include "WinApp.h" +#include "Guid.h" #include "SysInfo.h" +#include "MsiUtils.h" #include "FileUtils.h" #include "WinFileUtils.h" #include "Executor.h" #include "Resources.h" -#include "WinErrorHandling.h" -int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int nShowCmd) -{ - JP_TRY; +namespace { +int exitCode = -1; + +void launchApp() { + const auto cmdline = SysInfo::getCommandArgs(); + if (std::find(cmdline.begin(), cmdline.end(), L"uninstall") != cmdline.end()) { + // This is uninstall request. + + // Get product code of the product to uninstall. + const auto productCodeUtf8 = Resource(L"product_code", RT_RCDATA).binary(); + const Guid productCode = Guid(std::string( + (const char*)productCodeUtf8.data(), productCodeUtf8.size())); + + // Uninstall product. + msi::uninstall().setProductCode(productCode)(); + exitCode = 0; + return; + } // Create temporary directory where to extract msi file. const auto tempMsiDir = FileUtils::createTempDirectory(); @@ -60,9 +77,12 @@ int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int nShowCmd) }); // Install msi file. - return msiExecutor.execAndWaitForExit(); + exitCode = msiExecutor.execAndWaitForExit(); +} +} // namespace - JP_CATCH_ALL; - return -1; +int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int nShowCmd) { + app::wlaunch(std::nothrow, launchApp); + return exitCode; } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java index b0c4b34b3a2b2..528973bea2298 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java @@ -114,14 +114,18 @@ static PackageHandlers createMsiPackageHandlers() { } static PackageHandlers createExePackageHandlers() { - PackageHandlers exe = new PackageHandlers(); - // can't have install handler without also having uninstall handler - // so following is commented out for now - // exe.installHandler = cmd -> { - // cmd.verifyIsOfType(PackageType.WIN_EXE); - // new Executor().setExecutable(cmd.outputBundle()).execute(); - // }; + BiConsumer installExe = (cmd, install) -> { + cmd.verifyIsOfType(PackageType.WIN_EXE); + Executor exec = new Executor().setExecutable(cmd.outputBundle()); + if (!install) { + exec.addArgument("uninstall"); + } + runMsiexecWithRetries(exec); + }; + PackageHandlers exe = new PackageHandlers(); + exe.installHandler = cmd -> installExe.accept(cmd, true); + exe.uninstallHandler = cmd -> installExe.accept(cmd, false); return exe; } From e9113517d4e4764674a1d466c97c35b7e58b0e16 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 15 Dec 2020 16:48:31 +0000 Subject: [PATCH 239/504] 8258140: Update @jls tags in java.base for renamed/renumbered sections Reviewed-by: psandoz --- src/java.base/share/classes/java/lang/Enum.java | 2 +- .../share/classes/java/lang/annotation/Repeatable.java | 4 ++-- src/java.base/share/classes/java/lang/annotation/Target.java | 2 +- src/java.base/share/classes/java/lang/reflect/Method.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Enum.java b/src/java.base/share/classes/java/lang/Enum.java index cc9b3c20b00c5..54a1f09c9ebd7 100644 --- a/src/java.base/share/classes/java/lang/Enum.java +++ b/src/java.base/share/classes/java/lang/Enum.java @@ -66,7 +66,7 @@ * @see Class#getEnumConstants() * @see java.util.EnumSet * @see java.util.EnumMap - * @jls 8.9 Enum Types + * @jls 8.9 Enum Classes * @jls 8.9.3 Enum Members * @since 1.5 */ diff --git a/src/java.base/share/classes/java/lang/annotation/Repeatable.java b/src/java.base/share/classes/java/lang/annotation/Repeatable.java index f9dc170ec7330..ecc379998b1bf 100644 --- a/src/java.base/share/classes/java/lang/annotation/Repeatable.java +++ b/src/java.base/share/classes/java/lang/annotation/Repeatable.java @@ -33,8 +33,8 @@ * type for the repeatable annotation type. * * @since 1.8 - * @jls 9.6.3 Repeatable Annotation Types - * @jls 9.7.5 Multiple Annotations of the Same Type + * @jls 9.6.3 Repeatable Annotation Interfaces + * @jls 9.7.5 Multiple Annotations of the Same Interface */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/src/java.base/share/classes/java/lang/annotation/Target.java b/src/java.base/share/classes/java/lang/annotation/Target.java index ea9547d981701..b9b7f40b902f7 100644 --- a/src/java.base/share/classes/java/lang/annotation/Target.java +++ b/src/java.base/share/classes/java/lang/annotation/Target.java @@ -72,7 +72,7 @@ * @since 1.5 * @jls 9.6.4.1 @Target * @jls 9.7.4 Where Annotations May Appear - * @jls 9.7.5 Multiple Annotations of the Same Type + * @jls 9.7.5 Multiple Annotations of the Same Interface */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/src/java.base/share/classes/java/lang/reflect/Method.java b/src/java.base/share/classes/java/lang/reflect/Method.java index 557948381a62a..567ae8be660ad 100644 --- a/src/java.base/share/classes/java/lang/reflect/Method.java +++ b/src/java.base/share/classes/java/lang/reflect/Method.java @@ -405,7 +405,7 @@ public int hashCode() { * * @jls 8.4.3 Method Modifiers * @jls 9.4 Method Declarations - * @jls 9.6.1 Annotation Type Elements + * @jls 9.6.1 Annotation Interface Elements */ public String toString() { return sharedToString(Modifier.methodModifiers(), @@ -475,7 +475,7 @@ String toShortSignature() { * * @jls 8.4.3 Method Modifiers * @jls 9.4 Method Declarations - * @jls 9.6.1 Annotation Type Elements + * @jls 9.6.1 Annotation Interface Elements */ @Override public String toGenericString() { From 36e20974014282351f6703744efcec16b6bd2172 Mon Sep 17 00:00:00 2001 From: Yumin Qi Date: Tue, 15 Dec 2020 16:52:26 +0000 Subject: [PATCH 240/504] 8255917: runtime/cds/SharedBaseAddress.java failed "assert(reserved_rgn != 0LL) failed: No reserved region" Reviewed-by: ccheung, iklam, stuefe --- src/hotspot/share/memory/filemap.cpp | 4 + src/hotspot/share/memory/metaspaceShared.cpp | 110 ++++++++++++------ src/hotspot/share/memory/metaspaceShared.hpp | 6 +- src/hotspot/share/runtime/os.cpp | 3 + .../share/services/virtualMemoryTracker.cpp | 28 +++-- test/hotspot/jtreg/TEST.groups | 1 + .../jtreg/runtime/cds/SharedBaseAddress.java | 6 +- .../MismatchedPathTriggerMemoryRelease.java | 69 +++++++++++ 8 files changed, 180 insertions(+), 47 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp index a8d92bcf2780d..b09909cb5291d 100644 --- a/src/hotspot/share/memory/filemap.cpp +++ b/src/hotspot/share/memory/filemap.cpp @@ -1680,6 +1680,10 @@ char* FileMapInfo::map_bitmap_region() { si->set_mapped_base(bitmap_base); si->set_mapped_from_file(true); + log_info(cds)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)", + is_static() ? "static " : "dynamic", + MetaspaceShared::bm, p2i(si->mapped_base()), p2i(si->mapped_end()), + shared_region_name[MetaspaceShared::bm]); return bitmap_base; } diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index 6381b812a4632..008f9ac2f89e9 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -1369,10 +1369,13 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File assert(static_mapinfo->mapping_end_offset() == dynamic_mapinfo->mapping_base_offset(), "no gap"); } - ReservedSpace archive_space_rs, class_space_rs; + ReservedSpace total_space_rs, archive_space_rs, class_space_rs; MapArchiveResult result = MAP_ARCHIVE_OTHER_FAILURE; - char* mapped_base_address = reserve_address_space_for_archives(static_mapinfo, dynamic_mapinfo, - use_requested_addr, archive_space_rs, + char* mapped_base_address = reserve_address_space_for_archives(static_mapinfo, + dynamic_mapinfo, + use_requested_addr, + total_space_rs, + archive_space_rs, class_space_rs); if (mapped_base_address == NULL) { result = MAP_ARCHIVE_MMAP_FAILURE; @@ -1422,6 +1425,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File // this with use_requested_addr, since we're going to patch all the // pointers anyway so there's no benefit to mmap. if (use_requested_addr) { + assert(!total_space_rs.is_reserved(), "Should not be reserved for Windows"); log_info(cds)("Windows mmap workaround: releasing archive space."); archive_space_rs.release(); } @@ -1477,6 +1481,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File // cover both archive and class space. address cds_base = (address)static_mapinfo->mapped_base(); address ccs_end = (address)class_space_rs.end(); + assert(ccs_end > cds_base, "Sanity check"); CompressedKlassPointers::initialize(cds_base, ccs_end - cds_base); // map_heap_regions() compares the current narrow oop and klass encodings @@ -1489,7 +1494,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File } else { unmap_archive(static_mapinfo); unmap_archive(dynamic_mapinfo); - release_reserved_spaces(archive_space_rs, class_space_rs); + release_reserved_spaces(total_space_rs, archive_space_rs, class_space_rs); } return result; @@ -1538,6 +1543,10 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File // Return: // // - On success: +// - total_space_rs will be reserved as whole for archive_space_rs and +// class_space_rs if UseCompressedClassPointers is true. +// On Windows, try reserve archive_space_rs and class_space_rs +// separately first if use_archive_base_addr is true. // - archive_space_rs will be reserved and large enough to host static and // if needed dynamic archive: [Base, A). // archive_space_rs.base and size will be aligned to CDS reserve @@ -1552,6 +1561,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo, bool use_archive_base_addr, + ReservedSpace& total_space_rs, ReservedSpace& archive_space_rs, ReservedSpace& class_space_rs) { @@ -1617,34 +1627,53 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma align_up(archive_space_size + gap_size + class_space_size, os::vm_allocation_granularity()); - ReservedSpace total_rs; - if (base_address != NULL) { - // Reserve at the given archive base address, or not at all. - total_rs = ReservedSpace(total_range_size, archive_space_alignment, - false /* bool large */, (char*) base_address); + assert(total_range_size > ccs_begin_offset, "must be"); + if (use_windows_memory_mapping() && use_archive_base_addr) { + if (base_address != nullptr) { + // On Windows, we cannot safely split a reserved memory space into two (see JDK-8255917). + // Hence, we optimistically reserve archive space and class space side-by-side. We only + // do this for use_archive_base_addr=true since for use_archive_base_addr=false case + // caller will not split the combined space for mapping, instead read the archive data + // via sequential file IO. + address ccs_base = base_address + archive_space_size + gap_size; + archive_space_rs = ReservedSpace(archive_space_size, archive_space_alignment, + false /* large */, (char*)base_address); + class_space_rs = ReservedSpace(class_space_size, class_space_alignment, + false /* large */, (char*)ccs_base); + } + if (!archive_space_rs.is_reserved() || !class_space_rs.is_reserved()) { + release_reserved_spaces(total_space_rs, archive_space_rs, class_space_rs); + return NULL; + } } else { - // Reserve at any address, but leave it up to the platform to choose a good one. - total_rs = Metaspace::reserve_address_space_for_compressed_classes(total_range_size); - } - - if (!total_rs.is_reserved()) { - return NULL; - } - - // Paranoid checks: - assert(base_address == NULL || (address)total_rs.base() == base_address, - "Sanity (" PTR_FORMAT " vs " PTR_FORMAT ")", p2i(base_address), p2i(total_rs.base())); - assert(is_aligned(total_rs.base(), archive_space_alignment), "Sanity"); - assert(total_rs.size() == total_range_size, "Sanity"); - assert(CompressedKlassPointers::is_valid_base((address)total_rs.base()), "Sanity"); + if (use_archive_base_addr && base_address != nullptr) { + total_space_rs = ReservedSpace(total_range_size, archive_space_alignment, + false /* bool large */, (char*) base_address); + } else { + // Reserve at any address, but leave it up to the platform to choose a good one. + total_space_rs = Metaspace::reserve_address_space_for_compressed_classes(total_range_size); + } - // Now split up the space into ccs and cds archive. For simplicity, just leave - // the gap reserved at the end of the archive space. - archive_space_rs = total_rs.first_part(ccs_begin_offset, - (size_t)os::vm_allocation_granularity(), - /*split=*/true); - class_space_rs = total_rs.last_part(ccs_begin_offset); + if (!total_space_rs.is_reserved()) { + return NULL; + } + // Paranoid checks: + assert(base_address == NULL || (address)total_space_rs.base() == base_address, + "Sanity (" PTR_FORMAT " vs " PTR_FORMAT ")", p2i(base_address), p2i(total_space_rs.base())); + assert(is_aligned(total_space_rs.base(), archive_space_alignment), "Sanity"); + assert(total_space_rs.size() == total_range_size, "Sanity"); + assert(CompressedKlassPointers::is_valid_base((address)total_space_rs.base()), "Sanity"); + + // Now split up the space into ccs and cds archive. For simplicity, just leave + // the gap reserved at the end of the archive space. Do not do real splitting. + archive_space_rs = total_space_rs.first_part(ccs_begin_offset, + (size_t)os::vm_allocation_granularity(), + /*split=*/false); + class_space_rs = total_space_rs.last_part(ccs_begin_offset); + MemTracker::record_virtual_memory_split_reserved(total_space_rs.base(), total_space_rs.size(), + ccs_begin_offset); + } assert(is_aligned(archive_space_rs.base(), archive_space_alignment), "Sanity"); assert(is_aligned(archive_space_rs.size(), archive_space_alignment), "Sanity"); assert(is_aligned(class_space_rs.base(), class_space_alignment), "Sanity"); @@ -1663,15 +1692,21 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma } -void MetaspaceShared::release_reserved_spaces(ReservedSpace& archive_space_rs, +void MetaspaceShared::release_reserved_spaces(ReservedSpace& total_space_rs, + ReservedSpace& archive_space_rs, ReservedSpace& class_space_rs) { - if (archive_space_rs.is_reserved()) { - log_debug(cds)("Released shared space (archive) " INTPTR_FORMAT, p2i(archive_space_rs.base())); - archive_space_rs.release(); - } - if (class_space_rs.is_reserved()) { - log_debug(cds)("Released shared space (classes) " INTPTR_FORMAT, p2i(class_space_rs.base())); - class_space_rs.release(); + if (total_space_rs.is_reserved()) { + log_debug(cds)("Released shared space (archive + class) " INTPTR_FORMAT, p2i(total_space_rs.base())); + total_space_rs.release(); + } else { + if (archive_space_rs.is_reserved()) { + log_debug(cds)("Released shared space (archive) " INTPTR_FORMAT, p2i(archive_space_rs.base())); + archive_space_rs.release(); + } + if (class_space_rs.is_reserved()) { + log_debug(cds)("Released shared space (classes) " INTPTR_FORMAT, p2i(class_space_rs.base())); + class_space_rs.release(); + } } } @@ -1715,6 +1750,7 @@ void MetaspaceShared::unmap_archive(FileMapInfo* mapinfo) { assert(UseSharedSpaces, "must be runtime"); if (mapinfo != NULL) { mapinfo->unmap_regions(archive_regions, archive_regions_count); + mapinfo->unmap_region(MetaspaceShared::bm); mapinfo->set_is_mapped(false); } } diff --git a/src/hotspot/share/memory/metaspaceShared.hpp b/src/hotspot/share/memory/metaspaceShared.hpp index d1f7740a4f8a4..7e9bed9a991d1 100644 --- a/src/hotspot/share/memory/metaspaceShared.hpp +++ b/src/hotspot/share/memory/metaspaceShared.hpp @@ -288,10 +288,12 @@ class MetaspaceShared : AllStatic { static char* reserve_address_space_for_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo, bool use_archive_base_addr, + ReservedSpace& total_space_rs, ReservedSpace& archive_space_rs, ReservedSpace& class_space_rs); - static void release_reserved_spaces(ReservedSpace& archive_space_rs, - ReservedSpace& class_space_rs); + static void release_reserved_spaces(ReservedSpace& total_space_rs, + ReservedSpace& archive_space_rs, + ReservedSpace& class_space_rs); static MapArchiveResult map_archive(FileMapInfo* mapinfo, char* mapped_base_address, ReservedSpace rs); static void unmap_archive(FileMapInfo* mapinfo); }; diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index d00847ce16a52..de1026068ac43 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1723,6 +1723,9 @@ bool os::release_memory(char* addr, size_t bytes) { } else { res = pd_release_memory(addr, bytes); } + if (!res) { + log_info(os)("os::release_memory failed (" PTR_FORMAT ", " SIZE_FORMAT ")", p2i(addr), bytes); + } return res; } diff --git a/src/hotspot/share/services/virtualMemoryTracker.cpp b/src/hotspot/share/services/virtualMemoryTracker.cpp index 930fb54300f1d..79f1103615499 100644 --- a/src/hotspot/share/services/virtualMemoryTracker.cpp +++ b/src/hotspot/share/services/virtualMemoryTracker.cpp @@ -444,7 +444,7 @@ bool VirtualMemoryTracker::add_committed_region(address addr, size_t size, assert(reserved_rgn->contain_region(addr, size), "Not completely contained"); bool result = reserved_rgn->add_committed_region(addr, size, stack); log_debug(nmt)("Add committed region \'%s\'(" INTPTR_FORMAT ", " SIZE_FORMAT ") %s", - rgn.flag_name(), p2i(rgn.base()), rgn.size(), (result ? "Succeeded" : "Failed")); + reserved_rgn->flag_name(), p2i(rgn.base()), rgn.size(), (result ? "Succeeded" : "Failed")); return result; } @@ -506,12 +506,26 @@ bool VirtualMemoryTracker::remove_released_region(address addr, size_t size) { return false; } - if (reserved_rgn->flag() == mtClassShared && - reserved_rgn->contain_region(addr, size)) { - // This is an unmapped CDS region, which is part of the reserved shared - // memory region. - // See special handling in VirtualMemoryTracker::add_reserved_region also. - return true; + if (reserved_rgn->flag() == mtClassShared) { + if (reserved_rgn->contain_region(addr, size)) { + // This is an unmapped CDS region, which is part of the reserved shared + // memory region. + // See special handling in VirtualMemoryTracker::add_reserved_region also. + return true; + } + + if (size > reserved_rgn->size()) { + // This is from release the whole region spanning from archive space to class space, + // so we release them altogether. + ReservedMemoryRegion class_rgn(addr + reserved_rgn->size(), + (size - reserved_rgn->size())); + ReservedMemoryRegion* cls_rgn = _reserved_regions->find(class_rgn); + assert(cls_rgn != NULL, "Class space region not recorded?"); + assert(cls_rgn->flag() == mtClass, "Must be class type"); + remove_released_region(reserved_rgn); + remove_released_region(cls_rgn); + return true; + } } VirtualMemorySummary::record_released_memory(size, reserved_rgn->flag()); diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 2d3959701ff05..45a7bbe6993c9 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -338,6 +338,7 @@ hotspot_appcds_dynamic = \ -runtime/cds/appcds/LambdaProxyClasslist.java \ -runtime/cds/appcds/LongClassListPath.java \ -runtime/cds/appcds/LotsOfClasses.java \ + -runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java \ -runtime/cds/appcds/NonExistClasspath.java \ -runtime/cds/appcds/RelativePath.java \ -runtime/cds/appcds/SharedArchiveConsistency.java \ diff --git a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java index 510cdee13f726..eae9a753d2637 100644 --- a/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java @@ -50,6 +50,9 @@ public class SharedBaseAddress { "0", // always let OS pick the base address at runtime (ASLR for CDS archive) }; + // failed pattern + private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed"; + public static void main(String[] args) throws Exception { for (String testEntry : testTable) { @@ -68,7 +71,8 @@ public static void main(String[] args) throws Exception { OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts); if (testEntry.equals("0")) { out.shouldContain("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.") - .shouldContain("Try to map archive(s) at an alternative address"); + .shouldContain("Try to map archive(s) at an alternative address") + .shouldNotMatch(failedPattern); } } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java b/test/hotspot/jtreg/runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java new file mode 100644 index 0000000000000..c3defbdeed0ed --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2020, 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 MismatchedPathTriggerMemoryRelease + * @summary Mismatched path at runtime will cause reserved memory released + * @requires vm.cds + * @library /test/lib + * @compile test-classes/Hello.java + * @run main MismatchedPathTriggerMemoryRelease + */ + +import jdk.test.lib.process.OutputAnalyzer; + +public class MismatchedPathTriggerMemoryRelease { + private static String ERR_MSGS[] = { + "UseSharedSpaces: shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)", + "UseSharedSpaces: Unable to map shared spaces"}; + private static String RELEASE_SPACE_MATCH = + "Released shared space\\s(\\(archive\\s*\\+\\s*class\\) | ?)0(x|X)[0-9a-fA-F]+$"; + private static String OS_RELEASE_MSG = "os::release_memory failed"; + + public static void main(String[] args) throws Exception { + String appJar = JarBuilder.getOrCreateHelloJar(); + + OutputAnalyzer dumpOutput = TestCommon.dump( + appJar, new String[] {"Hello"}, "-XX:SharedBaseAddress=0"); + TestCommon.checkDump(dumpOutput, "Loading classes to share"); + + // Normal exit + OutputAnalyzer execOutput = TestCommon.exec(appJar, "Hello"); + TestCommon.checkExec(execOutput, "Hello World"); + + // mismatched jar + execOutput = TestCommon.exec("non-exist.jar", + "-Xshare:auto", + "-Xlog:os,cds=debug", + "-XX:NativeMemoryTracking=detail", + "-XX:SharedBaseAddress=0", + "Hello"); + execOutput.shouldHaveExitValue(1); + for (String err : ERR_MSGS) { + execOutput.shouldContain(err); + } + execOutput.shouldMatch(RELEASE_SPACE_MATCH); + execOutput.shouldNotContain(OS_RELEASE_MSG); // os::release only log release failed message + } +} From da2415fed5cd82c3b12fba99f36e8bf0bd751d41 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 15 Dec 2020 17:18:48 +0000 Subject: [PATCH 241/504] 8257457: Update --release 16 symbol information for JDK 16 build 28 Reviewed-by: jjg --- make/data/symbols/java.base-G.sym.txt | 137 ++++++++++++++ make/data/symbols/jdk.compiler-G.sym.txt | 4 +- .../symbols/jdk.incubator.foreign-G.sym.txt | 168 +++++++++--------- make/data/symbols/jdk.net-G.sym.txt | 10 +- 4 files changed, 233 insertions(+), 86 deletions(-) diff --git a/make/data/symbols/java.base-G.sym.txt b/make/data/symbols/java.base-G.sym.txt index 54d0245aacbd8..774c74459b4d6 100644 --- a/make/data/symbols/java.base-G.sym.txt +++ b/make/data/symbols/java.base-G.sym.txt @@ -36,24 +36,40 @@ innerclass innerClass java/util/Spliterator$OfInt outerClass java/util/Spliterat innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 class name java/lang/Boolean +header extends java/lang/Object implements java/io/Serializable,java/lang/Comparable,java/lang/constant/Constable flags 31 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Comparable;Ljava/lang/constant/Constable; runtimeAnnotations @Ljdk/internal/ValueBased; +-method name descriptor (Z)V +-method name descriptor (Ljava/lang/String;)V -method name booleanValue descriptor ()Z -method name valueOf descriptor (Z)Ljava/lang/Boolean; method name booleanValue descriptor ()Z flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name valueOf descriptor (Z)Ljava/lang/Boolean; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (Z)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/Byte +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable; runtimeAnnotations @Ljdk/internal/ValueBased; -method name valueOf descriptor (B)Ljava/lang/Byte; +-method name descriptor (B)V +-method name descriptor (Ljava/lang/String;)V -method name byteValue descriptor ()B method name valueOf descriptor (B)Ljava/lang/Byte; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name byteValue descriptor ()B flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (B)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/Character +header extends java/lang/Object implements java/io/Serializable,java/lang/Comparable,java/lang/constant/Constable nestMembers java/lang/Character$UnicodeScript,java/lang/Character$UnicodeBlock,java/lang/Character$Subset flags 31 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Comparable;Ljava/lang/constant/Constable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/Character$UnicodeBlock outerClass java/lang/Character innerClassName UnicodeBlock flags 19 +innerclass innerClass java/lang/Character$UnicodeScript outerClass java/lang/Character innerClassName UnicodeScript flags 4019 +innerclass innerClass java/lang/Character$Subset outerClass java/lang/Character innerClassName Subset flags 9 +-method name descriptor (C)V -method name valueOf descriptor (C)Ljava/lang/Character; -method name charValue descriptor ()C -method name reverseBytes descriptor (C)C method name valueOf descriptor (C)Ljava/lang/Character; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name charValue descriptor ()C flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name reverseBytes descriptor (C)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (C)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/Class -method name isInstance descriptor (Ljava/lang/Object;)Z @@ -67,6 +83,7 @@ class name java/lang/Class -method name getRecordComponents descriptor ()[Ljava/lang/reflect/RecordComponent; -method name isRecord descriptor ()Z -method name isHidden descriptor ()Z +-method name permittedSubclasses descriptor ()[Ljava/lang/constant/ClassDesc; method name isInstance descriptor (Ljava/lang/Object;)Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name isAssignableFrom descriptor (Ljava/lang/Class;)Z flags 101 signature (Ljava/lang/Class<*>;)Z runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name isInterface descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; @@ -78,6 +95,7 @@ method name getRecordComponents descriptor ()[Ljava/lang/reflect/RecordComponent method name isRecord descriptor ()Z flags 1 method name cast descriptor (Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (Ljava/lang/Object;)TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name isHidden descriptor ()Z flags 101 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name getPermittedSubclasses descriptor ()[Ljava/lang/Class; flags 1 signature ()[Ljava/lang/Class<*>; classAnnotations @Ljdk/internal/PreviewFeature;(feature=eLjdk/internal/PreviewFeature$Feature;SEALED_CLASSES;,essentialAPI=Zfalse) runtimeAnnotations @Ljdk/internal/reflect/CallerSensitive; class name java/lang/Compiler header extends java/lang/Object flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") @@ -86,7 +104,11 @@ class name java/lang/Deprecated header extends java/lang/Object implements java/lang/annotation/Annotation flags 2601 runtimeAnnotations @Ljava/lang/annotation/Documented;@Ljava/lang/annotation/Retention;(value=eLjava/lang/annotation/RetentionPolicy;RUNTIME;)@Ljava/lang/annotation/Target;(value={eLjava/lang/annotation/ElementType;CONSTRUCTOR;eLjava/lang/annotation/ElementType;FIELD;eLjava/lang/annotation/ElementType;LOCAL_VARIABLE;eLjava/lang/annotation/ElementType;METHOD;eLjava/lang/annotation/ElementType;PACKAGE;eLjava/lang/annotation/ElementType;MODULE;eLjava/lang/annotation/ElementType;PARAMETER;eLjava/lang/annotation/ElementType;TYPE;}) class name java/lang/Double +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable,java/lang/constant/ConstantDesc flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable;Ljava/lang/constant/ConstantDesc; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 -method name valueOf descriptor (D)Ljava/lang/Double; +-method name descriptor (D)V +-method name descriptor (Ljava/lang/String;)V -method name doubleValue descriptor ()D -method name doubleToLongBits descriptor (D)J -method name doubleToRawLongBits descriptor (D)J @@ -96,9 +118,16 @@ method name doubleValue descriptor ()D flags 1 runtimeAnnotations @Ljdk/internal method name doubleToLongBits descriptor (D)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name doubleToRawLongBits descriptor (D)J flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name longBitsToDouble descriptor (J)D flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (D)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/Float +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable,java/lang/constant/ConstantDesc flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable;Ljava/lang/constant/ConstantDesc; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 -method name valueOf descriptor (F)Ljava/lang/Float; +-method name descriptor (F)V +-method name descriptor (D)V +-method name descriptor (Ljava/lang/String;)V -method name floatValue descriptor ()F -method name floatToIntBits descriptor (F)I -method name floatToRawIntBits descriptor (F)I @@ -108,6 +137,9 @@ method name floatValue descriptor ()F flags 1 runtimeAnnotations @Ljdk/internal/ method name floatToIntBits descriptor (F)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name floatToRawIntBits descriptor (F)I flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name intBitsToFloat descriptor (I)F flags 109 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (F)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (D)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/IllegalCallerException header extends java/lang/RuntimeException flags 21 @@ -116,8 +148,12 @@ class name java/lang/IndexOutOfBoundsException method name descriptor (J)V flags 1 class name java/lang/Integer +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable,java/lang/constant/ConstantDesc flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable;Ljava/lang/constant/ConstantDesc; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 -method name toString descriptor (I)Ljava/lang/String; -method name valueOf descriptor (I)Ljava/lang/Integer; +-method name descriptor (I)V +-method name descriptor (Ljava/lang/String;)V -method name intValue descriptor ()I -method name numberOfLeadingZeros descriptor (I)I -method name numberOfTrailingZeros descriptor (I)I @@ -130,12 +166,18 @@ method name numberOfLeadingZeros descriptor (I)I flags 9 runtimeAnnotations @Ljd method name numberOfTrailingZeros descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name bitCount descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name reverseBytes descriptor (I)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (I)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/LayerInstantiationException header extends java/lang/RuntimeException flags 21 class name java/lang/Long +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable,java/lang/constant/ConstantDesc flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable;Ljava/lang/constant/ConstantDesc; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 -method name valueOf descriptor (J)Ljava/lang/Long; +-method name descriptor (J)V +-method name descriptor (Ljava/lang/String;)V -method name longValue descriptor ()J -method name numberOfLeadingZeros descriptor (J)I -method name numberOfTrailingZeros descriptor (J)I @@ -147,6 +189,8 @@ method name numberOfLeadingZeros descriptor (J)I flags 9 runtimeAnnotations @Ljd method name numberOfTrailingZeros descriptor (J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name bitCount descriptor (J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name reverseBytes descriptor (J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (J)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/Math -method name signum descriptor (D)D @@ -249,16 +293,30 @@ method name clone descriptor ()Ljava/lang/Object; thrownTypes java/lang/CloneNot method name notify descriptor ()V flags 111 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name notifyAll descriptor ()V flags 111 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +class name java/lang/ProcessHandle +header extends java/lang/Object implements java/lang/Comparable nestMembers java/lang/ProcessHandle$Info flags 601 signature Ljava/lang/Object;Ljava/lang/Comparable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/ProcessHandle$Info outerClass java/lang/ProcessHandle innerClassName Info flags 609 + class name java/lang/Record header extends java/lang/Object flags 421 +class name java/lang/Runtime$Version +header extends java/lang/Object implements java/lang/Comparable nestHost java/lang/Runtime flags 31 signature Ljava/lang/Object;Ljava/lang/Comparable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime innerClassName Version flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + class name java/lang/Short +header extends java/lang/Number implements java/lang/Comparable,java/lang/constant/Constable flags 31 signature Ljava/lang/Number;Ljava/lang/Comparable;Ljava/lang/constant/Constable; runtimeAnnotations @Ljdk/internal/ValueBased; -method name valueOf descriptor (S)Ljava/lang/Short; +-method name descriptor (S)V +-method name descriptor (Ljava/lang/String;)V -method name shortValue descriptor ()S -method name reverseBytes descriptor (S)S method name valueOf descriptor (S)Ljava/lang/Short; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name shortValue descriptor ()S flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name reverseBytes descriptor (S)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name descriptor (S)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") +method name descriptor (Ljava/lang/String;)V thrownTypes java/lang/NumberFormatException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="9") class name java/lang/StrictMath -method name sqrt descriptor (D)D @@ -480,9 +538,11 @@ class name java/lang/module/ResolvedModule header extends java/lang/Object flags 31 class name java/lang/ref/Reference +-method name isEnqueued descriptor ()Z -method name get descriptor ()Ljava/lang/Object; method name get descriptor ()Ljava/lang/Object; flags 1 signature ()TT; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; method name refersTo descriptor (Ljava/lang/Object;)Z flags 11 signature (TT;)Z +method name isEnqueued descriptor ()Z flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="16") class name java/lang/reflect/AccessibleObject header extends java/lang/Object implements java/lang/reflect/AnnotatedElement flags 21 @@ -655,6 +715,59 @@ class name java/text/RuleBasedCollator header extends java/text/Collator flags 21 innerclass innerClass java/text/Normalizer$Form outerClass java/text/Normalizer innerClassName Form flags 4019 +class name java/time/Duration +header extends java/lang/Object implements java/time/temporal/TemporalAmount,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/TemporalAmount;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/Instant +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/LocalDate +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/time/chrono/ChronoLocalDate,java/io/Serializable flags 31 runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/LocalDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/time/chrono/ChronoLocalDateTime,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/time/chrono/ChronoLocalDateTime;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/LocalTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/MonthDay +header extends java/lang/Object implements java/time/temporal/TemporalAccessor,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/TemporalAccessor;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/OffsetDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/OffsetTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/Period +header extends java/lang/Object implements java/time/chrono/ChronoPeriod,java/io/Serializable flags 31 runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/Year +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/YearMonth +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/time/ZoneId +header extends java/lang/Object implements java/io/Serializable flags 421 runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/time/ZoneOffset +header extends java/time/ZoneId implements java/time/temporal/TemporalAccessor,java/time/temporal/TemporalAdjuster,java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/time/ZoneId;Ljava/time/temporal/TemporalAccessor;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/ZonedDateTime +header extends java/lang/Object implements java/time/temporal/Temporal,java/time/chrono/ChronoZonedDateTime,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/chrono/ChronoZonedDateTime;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + class name java/time/chrono/ChronoLocalDate header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable; innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 @@ -663,6 +776,18 @@ class name java/time/chrono/ChronoLocalDateTime header extends java/lang/Object implements java/time/temporal/Temporal,java/time/temporal/TemporalAdjuster,java/lang/Comparable flags 601 signature Ljava/lang/Object;Ljava/time/temporal/Temporal;Ljava/time/temporal/TemporalAdjuster;Ljava/lang/Comparable;>; innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +class name java/time/chrono/HijrahDate +header extends java/time/chrono/ChronoLocalDateImpl implements java/time/chrono/ChronoLocalDate,java/io/Serializable flags 31 signature Ljava/time/chrono/ChronoLocalDateImpl;Ljava/time/chrono/ChronoLocalDate;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/chrono/JapaneseDate +header extends java/time/chrono/ChronoLocalDateImpl implements java/time/chrono/ChronoLocalDate,java/io/Serializable flags 31 signature Ljava/time/chrono/ChronoLocalDateImpl;Ljava/time/chrono/ChronoLocalDate;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/chrono/MinguoDate +header extends java/time/chrono/ChronoLocalDateImpl implements java/time/chrono/ChronoLocalDate,java/io/Serializable flags 31 signature Ljava/time/chrono/ChronoLocalDateImpl;Ljava/time/chrono/ChronoLocalDate;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/time/chrono/ThaiBuddhistDate +header extends java/time/chrono/ChronoLocalDateImpl implements java/time/chrono/ChronoLocalDate,java/io/Serializable flags 31 signature Ljava/time/chrono/ChronoLocalDateImpl;Ljava/time/chrono/ChronoLocalDate;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/ValueBased; + class name java/time/format/DateTimeFormatterBuilder method name appendDayPeriodText descriptor (Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder; flags 1 @@ -711,6 +836,18 @@ header extends java/lang/Object flags 21 deprecated true runtimeAnnotations @Lja class name java/util/Observer header extends java/lang/Object flags 601 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(since="9") +class name java/util/Optional +header extends java/lang/Object flags 31 signature Ljava/lang/Object; runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/util/OptionalDouble +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/util/OptionalInt +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/ValueBased; + +class name java/util/OptionalLong +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/ValueBased; + class name java/util/TimeZone header extends java/lang/Object implements java/io/Serializable,java/lang/Cloneable flags 421 innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 diff --git a/make/data/symbols/jdk.compiler-G.sym.txt b/make/data/symbols/jdk.compiler-G.sym.txt index 8f44f88c24604..d48162647211e 100644 --- a/make/data/symbols/jdk.compiler-G.sym.txt +++ b/make/data/symbols/jdk.compiler-G.sym.txt @@ -93,7 +93,8 @@ class name com/sun/source/doctree/ReferenceTree header extends java/lang/Object implements com/sun/source/doctree/DocTree flags 601 class name com/sun/source/doctree/ReturnTree -header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 +header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree,com/sun/source/doctree/InlineTagTree flags 601 +method name isInline descriptor ()Z flags 1 class name com/sun/source/doctree/SeeTree header extends java/lang/Object implements com/sun/source/doctree/BlockTagTree flags 601 @@ -335,6 +336,7 @@ header extends java/lang/Object implements com/sun/source/util/SourcePositions f class name com/sun/source/util/DocTreeFactory header extends java/lang/Object flags 601 innerclass innerClass com/sun/source/doctree/AttributeTree$ValueKind outerClass com/sun/source/doctree/AttributeTree innerClassName ValueKind flags 4019 +method name newReturnTree descriptor (ZLjava/util/List;)Lcom/sun/source/doctree/ReturnTree; flags 1 signature (ZLjava/util/List<+Lcom/sun/source/doctree/DocTree;>;)Lcom/sun/source/doctree/ReturnTree; class name com/sun/source/util/DocTreePathScanner header extends com/sun/source/util/DocTreeScanner flags 21 signature Lcom/sun/source/util/DocTreeScanner; diff --git a/make/data/symbols/jdk.incubator.foreign-G.sym.txt b/make/data/symbols/jdk.incubator.foreign-G.sym.txt index 1ec39c418339d..5bb38702f4fa1 100644 --- a/make/data/symbols/jdk.incubator.foreign-G.sym.txt +++ b/make/data/symbols/jdk.incubator.foreign-G.sym.txt @@ -155,88 +155,88 @@ method name force descriptor (Ljdk/incubator/foreign/MemorySegment;)V flags 9 class name jdk/incubator/foreign/MemoryAccess header extends java/lang/Object flags 31 innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 -method name getByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)B flags 9 -method name setByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JB)V flags 9 -method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 -method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 -method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 -method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 -method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 -method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 -method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 -method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 -method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 -method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 -method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 -method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 -method name getAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 -method name setAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 -method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 -method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 -method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 -method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 -method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 -method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 -method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 -method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 -method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 -method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 -method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 -method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 -method name getByte descriptor (Ljdk/incubator/foreign/MemorySegment;)B flags 9 -method name setByte descriptor (Ljdk/incubator/foreign/MemorySegment;B)V flags 9 -method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;)C flags 9 -method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;C)V flags 9 -method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;)S flags 9 -method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;S)V flags 9 -method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;)I flags 9 -method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;I)V flags 9 -method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;)F flags 9 -method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;F)V flags 9 -method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;)J flags 9 -method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;J)V flags 9 -method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;)D flags 9 -method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;D)V flags 9 -method name getAddress descriptor (Ljdk/incubator/foreign/MemorySegment;)Ljdk/incubator/foreign/MemoryAddress; flags 9 -method name setAddress descriptor (Ljdk/incubator/foreign/MemorySegment;Ljdk/incubator/foreign/Addressable;)V flags 9 -method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)C flags 9 -method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;C)V flags 9 -method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)S flags 9 -method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;S)V flags 9 -method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)I flags 9 -method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;I)V flags 9 -method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)F flags 9 -method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;F)V flags 9 -method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)J flags 9 -method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;J)V flags 9 -method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)D flags 9 -method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;D)V flags 9 -method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 -method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 -method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 -method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 -method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 -method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 -method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 -method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 -method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 -method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 -method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 -method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 -method name getAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 -method name setAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 -method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 -method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 -method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 -method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 -method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 -method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 -method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 -method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 -method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 -method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 -method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 -method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 +method name getByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)B flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setByteAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JB)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setAddressAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setCharAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShortAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setIntAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloatAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLongAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDoubleAtOffset descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getByte descriptor (Ljdk/incubator/foreign/MemorySegment;)B flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setByte descriptor (Ljdk/incubator/foreign/MemorySegment;B)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;C)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;S)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;I)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;F)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;J)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;D)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getAddress descriptor (Ljdk/incubator/foreign/MemorySegment;)Ljdk/incubator/foreign/MemoryAddress; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setAddress descriptor (Ljdk/incubator/foreign/MemorySegment;Ljdk/incubator/foreign/Addressable;)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setChar descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;C)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShort descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;S)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setInt descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;I)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloat descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;F)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLong descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;J)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDouble descriptor (Ljdk/incubator/foreign/MemorySegment;Ljava/nio/ByteOrder;D)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JC)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JS)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JI)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JF)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JJ)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JD)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;J)Ljdk/incubator/foreign/MemoryAddress; flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setAddressAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjdk/incubator/foreign/Addressable;)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)C flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setCharAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;C)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)S flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setShortAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;S)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)I flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setIntAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;I)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)F flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setFloatAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;F)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)J flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setLongAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;J)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name getDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name setDoubleAtIndex descriptor (Ljdk/incubator/foreign/MemorySegment;JLjava/nio/ByteOrder;D)V flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; class name jdk/incubator/foreign/MemoryAddress header extends java/lang/Object implements jdk/incubator/foreign/Addressable flags 601 @@ -252,6 +252,10 @@ class name jdk/incubator/foreign/MemoryHandles -method name withOffset descriptor (Ljava/lang/invoke/VarHandle;J)Ljava/lang/invoke/VarHandle; -method name withStride descriptor (Ljava/lang/invoke/VarHandle;J)Ljava/lang/invoke/VarHandle; +class name jdk/incubator/foreign/MemoryLayout +method name bitOffsetHandle descriptor ([Ljdk/incubator/foreign/MemoryLayout$PathElement;)Ljava/lang/invoke/MethodHandle; flags 81 +method name byteOffsetHandle descriptor ([Ljdk/incubator/foreign/MemoryLayout$PathElement;)Ljava/lang/invoke/MethodHandle; flags 81 + class name jdk/incubator/foreign/MemoryLayouts field name ADDRESS descriptor Ljdk/incubator/foreign/ValueLayout; flags 19 diff --git a/make/data/symbols/jdk.net-G.sym.txt b/make/data/symbols/jdk.net-G.sym.txt index 9d38f61888888..6ed76819c2fe6 100644 --- a/make/data/symbols/jdk.net-G.sym.txt +++ b/make/data/symbols/jdk.net-G.sym.txt @@ -51,10 +51,14 @@ method name getOption descriptor (Ljava/net/DatagramSocket;Ljava/net/SocketOptio method name supportedOptions descriptor (Ljava/lang/Class;)Ljava/util/Set; flags 9 deprecated true signature (Ljava/lang/Class<*>;)Ljava/util/Set;>; runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="16") class name jdk/net/UnixDomainPrincipal -header extends java/lang/Object flags 31 +header extends java/lang/Record record true flags 31 +recordcomponent name user descriptor Ljava/nio/file/attribute/UserPrincipal; +recordcomponent name group descriptor Ljava/nio/file/attribute/GroupPrincipal; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 method name descriptor (Ljava/nio/file/attribute/UserPrincipal;Ljava/nio/file/attribute/GroupPrincipal;)V flags 1 -method name equals descriptor (Ljava/lang/Object;)Z flags 1 -method name hashCode descriptor ()I flags 1 method name user descriptor ()Ljava/nio/file/attribute/UserPrincipal; flags 1 method name group descriptor ()Ljava/nio/file/attribute/GroupPrincipal; flags 1 +method name toString descriptor ()Ljava/lang/String; flags 11 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 From 2273f9555abc793743d01cf1e9d2d84b9297144a Mon Sep 17 00:00:00 2001 From: Anton Kozlov Date: Tue, 15 Dec 2020 18:43:49 +0000 Subject: [PATCH 242/504] 8234930: Use MAP_JIT when allocating pages for code cache on macOS Reviewed-by: stuefe, iklam, burban --- src/hotspot/os/aix/os_aix.cpp | 6 +-- src/hotspot/os/bsd/os_bsd.cpp | 45 ++++++++++++++----- src/hotspot/os/linux/os_linux.cpp | 8 ++-- src/hotspot/os/posix/os_posix.cpp | 4 +- src/hotspot/os/windows/os_windows.cpp | 11 ++--- .../share/gc/z/zMarkStackAllocator.cpp | 2 +- .../share/memory/allocation.inline.hpp | 4 +- src/hotspot/share/memory/virtualspace.cpp | 28 ++++++------ src/hotspot/share/runtime/os.cpp | 14 +++--- src/hotspot/share/runtime/os.hpp | 14 +++--- .../runtime/test_committed_virtualmemory.cpp | 8 ++-- 11 files changed, 85 insertions(+), 59 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 15c7160fdcdcd..5ecc5aa5a9711 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1958,7 +1958,7 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, pd_commit_memory_or_exit(addr, size, exec, mesg); } -bool os::pd_uncommit_memory(char* addr, size_t size) { +bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { assert(is_aligned_to(addr, os::vm_page_size()), "addr " PTR_FORMAT " not aligned to vm_page_size (" PTR_FORMAT ")", p2i(addr), os::vm_page_size()); @@ -2035,7 +2035,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info } // Reserves and attaches a shared memory segment. -char* os::pd_reserve_memory(size_t bytes) { +char* os::pd_reserve_memory(size_t bytes, bool exec) { // Always round to os::vm_page_size(), which may be larger than 4K. bytes = align_up(bytes, os::vm_page_size()); @@ -2236,7 +2236,7 @@ char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, i // Reserve memory at an arbitrary address, only if that area is // available (and not reserved for something else). -char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes) { +char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool exec) { char* addr = NULL; // Always round to os::vm_page_size(), which may be larger than 4K. diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index c9aec705b9ffa..0344ac3e574fa 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1678,12 +1678,25 @@ static void warn_fail_commit_memory(char* addr, size_t size, bool exec, // problem. bool os::pd_commit_memory(char* addr, size_t size, bool exec) { int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) // XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with protection modes %x", p2i(addr), p2i(addr+size), prot); if (::mprotect(addr, size, prot) == 0) { return true; } +#elif defined(__APPLE__) + if (exec) { + // Do not replace MAP_JIT mappings, see JDK-8234930 + if (::mprotect(addr, size, prot) == 0) { + return true; + } + } else { + uintptr_t res = (uintptr_t) ::mmap(addr, size, prot, + MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); + if (res != (uintptr_t) MAP_FAILED) { + return true; + } + } #else uintptr_t res = (uintptr_t) ::mmap(addr, size, prot, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); @@ -1766,11 +1779,22 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info } -bool os::pd_uncommit_memory(char* addr, size_t size) { -#ifdef __OpenBSD__ +bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { +#if defined(__OpenBSD__) // XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD Events::log(NULL, "Protecting memory [" INTPTR_FORMAT "," INTPTR_FORMAT "] with PROT_NONE", p2i(addr), p2i(addr+size)); return ::mprotect(addr, size, PROT_NONE) == 0; +#elif defined(__APPLE__) + if (exec) { + if (::madvise(addr, size, MADV_FREE) != 0) { + return false; + } + return ::mprotect(addr, size, PROT_NONE) == 0; + } else { + uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, + MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); + return res != (uintptr_t) MAP_FAILED; + } #else uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); @@ -1791,9 +1815,10 @@ bool os::remove_stack_guard_pages(char* addr, size_t size) { // 'requested_addr' is only treated as a hint, the return value may or // may not start from the requested address. Unlike Bsd mmap(), this // function returns NULL to indicate failure. -static char* anon_mmap(char* requested_addr, size_t bytes) { +static char* anon_mmap(char* requested_addr, size_t bytes, bool exec) { // MAP_FIXED is intentionally left out, to leave existing mappings intact. - const int flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS; + const int flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS + MACOS_ONLY(| (exec ? MAP_JIT : 0)); // Map reserved/uncommitted pages PROT_NONE so we fail early if we // touch an uncommitted page. Otherwise, the read/write might @@ -1807,8 +1832,8 @@ static int anon_munmap(char * addr, size_t size) { return ::munmap(addr, size) == 0; } -char* os::pd_reserve_memory(size_t bytes) { - return anon_mmap(NULL /* addr */, bytes); +char* os::pd_reserve_memory(size_t bytes, bool exec) { + return anon_mmap(NULL /* addr */, bytes, exec); } bool os::pd_release_memory(char* addr, size_t size) { @@ -1893,7 +1918,7 @@ bool os::can_execute_large_page_memory() { char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, int file_desc) { assert(file_desc >= 0, "file_desc is not valid"); - char* result = pd_attempt_reserve_memory_at(requested_addr, bytes); + char* result = pd_attempt_reserve_memory_at(requested_addr, bytes, !ExecMem); if (result != NULL) { if (replace_existing_mapping_with_file_mapping(result, bytes, file_desc) == NULL) { vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory")); @@ -1905,7 +1930,7 @@ char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, i // Reserve memory at an arbitrary address, only if that area is // available (and not reserved for something else). -char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes) { +char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool exec) { // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, @@ -1918,7 +1943,7 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes) { // Bsd mmap allows caller to pass an address as hint; give it a try first, // if kernel honors the hint then we can return immediately. - char * addr = anon_mmap(requested_addr, bytes); + char * addr = anon_mmap(requested_addr, bytes, exec); if (addr == requested_addr) { return requested_addr; } diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 78ad6492c0594..cbeb35e93eefe 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3272,7 +3272,7 @@ struct bitmask* os::Linux::_numa_nodes_ptr; struct bitmask* os::Linux::_numa_interleave_bitmask; struct bitmask* os::Linux::_numa_membind_bitmask; -bool os::pd_uncommit_memory(char* addr, size_t size) { +bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); return res != (uintptr_t) MAP_FAILED; @@ -3516,7 +3516,7 @@ static int anon_munmap(char * addr, size_t size) { return ::munmap(addr, size) == 0; } -char* os::pd_reserve_memory(size_t bytes) { +char* os::pd_reserve_memory(size_t bytes, bool exec) { return anon_mmap(NULL, bytes); } @@ -4197,7 +4197,7 @@ bool os::can_execute_large_page_memory() { char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, int file_desc) { assert(file_desc >= 0, "file_desc is not valid"); - char* result = pd_attempt_reserve_memory_at(requested_addr, bytes); + char* result = pd_attempt_reserve_memory_at(requested_addr, bytes, !ExecMem); if (result != NULL) { if (replace_existing_mapping_with_file_mapping(result, bytes, file_desc) == NULL) { vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory")); @@ -4209,7 +4209,7 @@ char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, i // Reserve memory at an arbitrary address, only if that area is // available (and not reserved for something else). -char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes) { +char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool exec) { // Assert only that the size is a multiple of the page size, since // that's all that mmap requires, and since that's all we really know // about at this low abstraction level. If we need higher alignment, diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 8d959cfb9f891..08dda17ae4773 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -336,9 +336,9 @@ static char* chop_extra_memory(size_t size, size_t alignment, char* extra_base, // Multiple threads can race in this code, and can remap over each other with MAP_FIXED, // so on posix, unmap the section at the start and at the end of the chunk that we mapped // rather than unmapping and remapping the whole chunk to get requested alignment. -char* os::reserve_memory_aligned(size_t size, size_t alignment) { +char* os::reserve_memory_aligned(size_t size, size_t alignment, bool exec) { size_t extra_size = calculate_aligned_extra_size(size, alignment); - char* extra_base = os::reserve_memory(extra_size); + char* extra_base = os::reserve_memory(extra_size, exec); if (extra_base == NULL) { return NULL; } diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 36c5228c27204..b76e77e5e896b 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3262,7 +3262,8 @@ static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fi return aligned_base; } -char* os::reserve_memory_aligned(size_t size, size_t alignment) { +char* os::reserve_memory_aligned(size_t size, size_t alignment, bool exec) { + // exec can be ignored return map_or_reserve_memory_aligned(size, alignment, -1 /* file_desc */); } @@ -3270,13 +3271,13 @@ char* os::map_memory_to_file_aligned(size_t size, size_t alignment, int fd) { return map_or_reserve_memory_aligned(size, alignment, fd); } -char* os::pd_reserve_memory(size_t bytes) { - return pd_attempt_reserve_memory_at(NULL /* addr */, bytes); +char* os::pd_reserve_memory(size_t bytes, bool exec) { + return pd_attempt_reserve_memory_at(NULL /* addr */, bytes, exec); } // Reserve memory at an arbitrary address, only if that area is // available (and not reserved for something else). -char* os::pd_attempt_reserve_memory_at(char* addr, size_t bytes) { +char* os::pd_attempt_reserve_memory_at(char* addr, size_t bytes, bool exec) { assert((size_t)addr % os::vm_allocation_granularity() == 0, "reserve alignment"); assert(bytes % os::vm_page_size() == 0, "reserve page size"); @@ -3471,7 +3472,7 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, pd_commit_memory_or_exit(addr, size, exec, mesg); } -bool os::pd_uncommit_memory(char* addr, size_t bytes) { +bool os::pd_uncommit_memory(char* addr, size_t bytes, bool exec) { if (bytes == 0) { // Don't bother the OS with noops. return true; diff --git a/src/hotspot/share/gc/z/zMarkStackAllocator.cpp b/src/hotspot/share/gc/z/zMarkStackAllocator.cpp index 7673cca7a2d8b..dbb4e7f4711d1 100644 --- a/src/hotspot/share/gc/z/zMarkStackAllocator.cpp +++ b/src/hotspot/share/gc/z/zMarkStackAllocator.cpp @@ -42,7 +42,7 @@ ZMarkStackSpace::ZMarkStackSpace() : // Reserve address space const size_t size = ZMarkStackSpaceLimit; - const uintptr_t addr = (uintptr_t)os::reserve_memory(size, mtGC); + const uintptr_t addr = (uintptr_t)os::reserve_memory(size, !ExecMem, mtGC); if (addr == 0) { log_error_pd(gc, marking)("Failed to reserve address space for mark stacks"); return; diff --git a/src/hotspot/share/memory/allocation.inline.hpp b/src/hotspot/share/memory/allocation.inline.hpp index fb62038ed1ba5..e913c0c805371 100644 --- a/src/hotspot/share/memory/allocation.inline.hpp +++ b/src/hotspot/share/memory/allocation.inline.hpp @@ -56,7 +56,7 @@ template E* MmapArrayAllocator::allocate_or_null(size_t length, MEMFLAGS flags) { size_t size = size_for(length); - char* addr = os::reserve_memory(size, flags); + char* addr = os::reserve_memory(size, !ExecMem, flags); if (addr == NULL) { return NULL; } @@ -73,7 +73,7 @@ template E* MmapArrayAllocator::allocate(size_t length, MEMFLAGS flags) { size_t size = size_for(length); - char* addr = os::reserve_memory(size, flags); + char* addr = os::reserve_memory(size, !ExecMem, flags); if (addr == NULL) { vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "Allocator (reserve)"); } diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index eb705b559336c..c87de14abc717 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -81,27 +81,27 @@ ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment, } // Helper method -static char* attempt_map_or_reserve_memory_at(char* base, size_t size, int fd) { +static char* attempt_map_or_reserve_memory_at(char* base, size_t size, int fd, bool executable) { if (fd != -1) { return os::attempt_map_memory_to_file_at(base, size, fd); } - return os::attempt_reserve_memory_at(base, size); + return os::attempt_reserve_memory_at(base, size, executable); } // Helper method -static char* map_or_reserve_memory(size_t size, int fd) { +static char* map_or_reserve_memory(size_t size, int fd, bool executable) { if (fd != -1) { return os::map_memory_to_file(size, fd); } - return os::reserve_memory(size); + return os::reserve_memory(size, executable); } // Helper method -static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fd) { +static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fd, bool executable) { if (fd != -1) { return os::map_memory_to_file_aligned(size, alignment, fd); } - return os::reserve_memory_aligned(size, alignment); + return os::reserve_memory_aligned(size, alignment, executable); } // Helper method @@ -212,13 +212,13 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, // important. If available space is not detected, return NULL. if (requested_address != 0) { - base = attempt_map_or_reserve_memory_at(requested_address, size, _fd_for_heap); + base = attempt_map_or_reserve_memory_at(requested_address, size, _fd_for_heap, _executable); if (failed_to_reserve_as_requested(base, requested_address, size, false, _fd_for_heap != -1)) { // OS ignored requested address. Try different address. base = NULL; } } else { - base = map_or_reserve_memory(size, _fd_for_heap); + base = map_or_reserve_memory(size, _fd_for_heap, _executable); } if (base == NULL) return; @@ -230,7 +230,7 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, // Make sure that size is aligned size = align_up(size, alignment); - base = map_or_reserve_memory_aligned(size, alignment, _fd_for_heap); + base = map_or_reserve_memory_aligned(size, alignment, _fd_for_heap, _executable); if (requested_address != 0 && failed_to_reserve_as_requested(base, requested_address, size, false, _fd_for_heap != -1)) { @@ -414,13 +414,13 @@ void ReservedHeapSpace::try_reserve_heap(size_t size, } if (requested_address != 0) { - base = attempt_map_or_reserve_memory_at(requested_address, size, _fd_for_heap); + base = attempt_map_or_reserve_memory_at(requested_address, size, _fd_for_heap, executable()); } else { // Optimistically assume that the OSes returns an aligned base pointer. // When reserving a large address range, most OSes seem to align to at // least 64K. // If the returned memory is not aligned we will release and retry. - base = map_or_reserve_memory(size, _fd_for_heap); + base = map_or_reserve_memory(size, _fd_for_heap, executable()); } } if (base == NULL) { return; } @@ -1024,7 +1024,7 @@ void VirtualSpace::shrink_by(size_t size) { assert(middle_high_boundary() <= aligned_upper_new_high && aligned_upper_new_high + upper_needs <= upper_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_upper_new_high, upper_needs)) { + if (!os::uncommit_memory(aligned_upper_new_high, upper_needs, _executable)) { debug_only(warning("os::uncommit_memory failed")); return; } else { @@ -1035,7 +1035,7 @@ void VirtualSpace::shrink_by(size_t size) { assert(lower_high_boundary() <= aligned_middle_new_high && aligned_middle_new_high + middle_needs <= middle_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_middle_new_high, middle_needs)) { + if (!os::uncommit_memory(aligned_middle_new_high, middle_needs, _executable)) { debug_only(warning("os::uncommit_memory failed")); return; } else { @@ -1046,7 +1046,7 @@ void VirtualSpace::shrink_by(size_t size) { assert(low_boundary() <= aligned_lower_new_high && aligned_lower_new_high + lower_needs <= lower_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_lower_new_high, lower_needs)) { + if (!os::uncommit_memory(aligned_lower_new_high, lower_needs, _executable)) { debug_only(warning("os::uncommit_memory failed")); return; } else { diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index de1026068ac43..35e9ae5624507 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1645,8 +1645,8 @@ bool os::create_stack_guard_pages(char* addr, size_t bytes) { return os::pd_create_stack_guard_pages(addr, bytes); } -char* os::reserve_memory(size_t bytes, MEMFLAGS flags) { - char* result = pd_reserve_memory(bytes); +char* os::reserve_memory(size_t bytes, bool executable, MEMFLAGS flags) { + char* result = pd_reserve_memory(bytes, executable); if (result != NULL) { MemTracker::record_virtual_memory_reserve(result, bytes, CALLER_PC); if (flags != mtOther) { @@ -1657,8 +1657,8 @@ char* os::reserve_memory(size_t bytes, MEMFLAGS flags) { return result; } -char* os::attempt_reserve_memory_at(char* addr, size_t bytes) { - char* result = pd_attempt_reserve_memory_at(addr, bytes); +char* os::attempt_reserve_memory_at(char* addr, size_t bytes, bool executable) { + char* result = pd_attempt_reserve_memory_at(addr, bytes, executable); if (result != NULL) { MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC); } else { @@ -1697,16 +1697,16 @@ void os::commit_memory_or_exit(char* addr, size_t size, size_t alignment_hint, MemTracker::record_virtual_memory_commit((address)addr, size, CALLER_PC); } -bool os::uncommit_memory(char* addr, size_t bytes) { +bool os::uncommit_memory(char* addr, size_t bytes, bool executable) { bool res; if (MemTracker::tracking_level() > NMT_minimal) { Tracker tkr(Tracker::uncommit); - res = pd_uncommit_memory(addr, bytes); + res = pd_uncommit_memory(addr, bytes, executable); if (res) { tkr.record((address)addr, bytes); } } else { - res = pd_uncommit_memory(addr, bytes); + res = pd_uncommit_memory(addr, bytes, executable); } return res; } diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 33b3d9e14d02f..01ff7b258e31d 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -125,9 +125,9 @@ class os: AllStatic { static address _polling_page; static PageSizes _page_sizes; - static char* pd_reserve_memory(size_t bytes); + static char* pd_reserve_memory(size_t bytes, bool executable); - static char* pd_attempt_reserve_memory_at(char* addr, size_t bytes); + static char* pd_attempt_reserve_memory_at(char* addr, size_t bytes, bool executable); static bool pd_commit_memory(char* addr, size_t bytes, bool executable); static bool pd_commit_memory(char* addr, size_t size, size_t alignment_hint, @@ -139,7 +139,7 @@ class os: AllStatic { static void pd_commit_memory_or_exit(char* addr, size_t size, size_t alignment_hint, bool executable, const char* mesg); - static bool pd_uncommit_memory(char* addr, size_t bytes); + static bool pd_uncommit_memory(char* addr, size_t bytes, bool executable); static bool pd_release_memory(char* addr, size_t bytes); static char* pd_attempt_map_memory_to_file_at(char* addr, size_t bytes, int file_desc); @@ -327,14 +327,14 @@ class os: AllStatic { static int vm_allocation_granularity(); // Reserves virtual memory. - static char* reserve_memory(size_t bytes, MEMFLAGS flags = mtOther); + static char* reserve_memory(size_t bytes, bool executable = false, MEMFLAGS flags = mtOther); // Reserves virtual memory that starts at an address that is aligned to 'alignment'. - static char* reserve_memory_aligned(size_t size, size_t alignment); + static char* reserve_memory_aligned(size_t size, size_t alignment, bool executable = false); // Attempts to reserve the virtual memory at [addr, addr + bytes). // Does not overwrite existing mappings. - static char* attempt_reserve_memory_at(char* addr, size_t bytes); + static char* attempt_reserve_memory_at(char* addr, size_t bytes, bool executable = false); // Split a reserved memory region [base, base+size) into two regions [base, base+split) and // [base+split, base+size). @@ -356,7 +356,7 @@ class os: AllStatic { static void commit_memory_or_exit(char* addr, size_t size, size_t alignment_hint, bool executable, const char* mesg); - static bool uncommit_memory(char* addr, size_t bytes); + static bool uncommit_memory(char* addr, size_t bytes, bool executable = false); static bool release_memory(char* addr, size_t bytes); // A diagnostic function to print memory mappings in the given range. diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index d2539b7338204..7dbaee5e6f74e 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -101,8 +101,8 @@ class CommittedVirtualMemoryTest { static void test_committed_region_impl(size_t num_pages, size_t touch_pages, int* page_num) { const size_t page_sz = os::vm_page_size(); const size_t size = num_pages * page_sz; - char* base = os::reserve_memory(size, mtThreadStack); - bool result = os::commit_memory(base, size, false); + char* base = os::reserve_memory(size, !ExecMem, mtThreadStack); + bool result = os::commit_memory(base, size, !ExecMem); size_t index; ASSERT_NE(base, (char*)NULL); for (index = 0; index < touch_pages; index ++) { @@ -169,9 +169,9 @@ class CommittedVirtualMemoryTest { const size_t page_sz = os::vm_page_size(); const size_t num_pages = 4; const size_t size = num_pages * page_sz; - char* base = os::reserve_memory(size, mtTest); + char* base = os::reserve_memory(size, !ExecMem, mtTest); ASSERT_NE(base, (char*)NULL); - result = os::commit_memory(base, size, false); + result = os::commit_memory(base, size, !ExecMem); ASSERT_TRUE(result); // touch all pages From c37eabe73b9ad38eab7678678c23dac3f5cc3daf Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 15 Dec 2020 20:48:18 +0000 Subject: [PATCH 243/504] 8252148: vmError::controlled_crash should be #ifdef ASSERT and move tests to gtest Reviewed-by: iklam, stuefe --- src/hotspot/share/gc/shared/gc_globals.hpp | 3 - src/hotspot/share/prims/jni.cpp | 6 +- src/hotspot/share/runtime/globals.hpp | 17 ++-- src/hotspot/share/utilities/debug.cpp | 51 +++++++--- src/hotspot/share/utilities/vmError.cpp | 90 +++-------------- src/hotspot/share/utilities/vmError.hpp | 6 +- .../gtest/gc/g1/test_g1ServiceThread.cpp | 6 +- .../gtest/metaspace/test_allocationGuard.cpp | 2 +- .../gtest/metaspace/test_blocktree.cpp | 2 +- .../hotspot/gtest/runtime/test_mutex_rank.cpp | 12 +-- test/hotspot/gtest/runtime/test_os.cpp | 5 +- .../gtest/runtime/test_safepoint_locks.cpp | 8 +- .../gtest/utilities/test_growableArray.cpp | 4 +- test/hotspot/gtest/utilities/test_vmerror.cpp | 99 +++++++++++++++++++ test/hotspot/jtreg/TEST.groups | 1 - .../runtime/ErrorHandling/ErrorHandler.java | 90 ----------------- .../ShowRegistersOnAssertTest.java | 2 +- .../runtime/ErrorHandling/TestOnError.java | 2 +- 18 files changed, 190 insertions(+), 216 deletions(-) create mode 100644 test/hotspot/gtest/utilities/test_vmerror.cpp delete mode 100644 test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 02b101114bbf2..cc8372221a7f5 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -290,9 +290,6 @@ develop(uintx, MetadataAllocationFailALotInterval, 1000, \ "Metadata allocation failure a lot interval") \ \ - product(bool, ExecutingUnitTests, false, \ - "Whether the JVM is running unit tests or not") \ - \ product(bool, UseTLAB, true, \ "Use thread-local object allocation") \ \ diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index c8e4415aa8e7c..b2b02a3668f5f 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -3800,10 +3800,14 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) { #ifndef PRODUCT if (ReplayCompiles) ciReplay::replay(thread); +#endif +#ifdef ASSERT // Some platforms (like Win*) need a wrapper around these test // functions in order to properly handle error conditions. - VMError::test_error_handler(); + if (ErrorHandlerTest != 0) { + VMError::controlled_crash(ErrorHandlerTest); + } #endif // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index b9e7434038ebf..04b4ded6aa26c 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -493,19 +493,24 @@ const intx ObjectAlignmentInBytes = 8; develop(bool, ZapFillerObjects, trueInDebug, \ "Zap filler objects with 0xDEAFBABE") \ \ - notproduct(uintx, ErrorHandlerTest, 0, \ + product(bool, ExecutingUnitTests, false, \ + "Whether the JVM is running unit tests or not") \ + \ + develop(uintx, ErrorHandlerTest, 0, \ "If > 0, provokes an error after VM initialization; the value " \ - "determines which error to provoke. See test_error_handler() " \ + "determines which error to provoke. See controlled_crash() " \ "in vmError.cpp.") \ + range(0, 17) \ \ - notproduct(uintx, TestCrashInErrorHandler, 0, \ + develop(uintx, TestCrashInErrorHandler, 0, \ "If > 0, provokes an error inside VM error handler (a secondary " \ - "crash). see test_error_handler() in vmError.cpp") \ + "crash). see controlled_crash() in vmError.cpp") \ + range(0, 17) \ \ - notproduct(bool, TestSafeFetchInErrorHandler, false, \ + develop(bool, TestSafeFetchInErrorHandler, false , \ "If true, tests SafeFetch inside error handler.") \ \ - notproduct(bool, TestUnresponsiveErrorHandler, false, \ + develop(bool, TestUnresponsiveErrorHandler, false, \ "If true, simulates an unresponsive error handler.") \ \ develop(bool, Verbose, false, \ diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 9b970be5e6db3..7892cfc1ad583 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -238,6 +238,36 @@ void report_vm_error(const char* file, int line, const char* error_msg) report_vm_error(file, line, error_msg, "%s", ""); } + +static void print_error_for_unit_test(const char* message, const char* detail_fmt, va_list detail_args) { +#ifdef ASSERT + if (ExecutingUnitTests) { + char detail_msg[256]; + if (detail_fmt != NULL) { + // Special handling for the sake of gtest death tests which expect the assert + // message to be printed in one short line to stderr (see TEST_VM_ASSERT_MSG) and + // cannot be tweaked to accept our normal assert message. + va_list detail_args_copy; + va_copy(detail_args_copy, detail_args); + jio_vsnprintf(detail_msg, sizeof(detail_msg), detail_fmt, detail_args_copy); + + // the VM assert tests look for "assert failed: " + if (message == NULL) { + fprintf(stderr, "assert failed: %s", detail_msg); + } else { + if (strlen(detail_msg) > 0) { + fprintf(stderr, "assert failed: %s: %s", message, detail_msg); + } else { + fprintf(stderr, "assert failed: Error: %s", message); + } + } + ::fflush(stderr); + va_end(detail_args_copy); + } + } +#endif // ASSERT +} + void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...) { if (Debugging || error_is_suppressed(file, line)) return; @@ -250,20 +280,7 @@ void report_vm_error(const char* file, int line, const char* error_msg, const ch } #endif // CAN_SHOW_REGISTERS_ON_ASSERT -#ifdef ASSERT - if (detail_fmt != NULL && ExecutingUnitTests) { - // Special handling for the sake of gtest death tests which expect the assert - // message to be printed in one short line to stderr (see TEST_VM_ASSERT_MSG) and - // cannot be tweaked to accept our normal assert message. - va_list detail_args_copy; - va_copy(detail_args_copy, detail_args); - ::fputs("assert failed: ", stderr); - ::vfprintf(stderr, detail_fmt, detail_args_copy); - ::fputs("\n", stderr); - ::fflush(stderr); - va_end(detail_args_copy); - } -#endif + print_error_for_unit_test(error_msg, detail_fmt, detail_args); VMError::report_and_die(Thread::current_or_null(), context, file, line, error_msg, detail_fmt, detail_args); va_end(detail_args); @@ -285,6 +302,9 @@ void report_fatal(const char* file, int line, const char* detail_fmt, ...) context = g_assertion_context; } #endif // CAN_SHOW_REGISTERS_ON_ASSERT + + print_error_for_unit_test("fatal error", detail_fmt, detail_args); + VMError::report_and_die(Thread::current_or_null(), context, file, line, "fatal error", detail_fmt, detail_args); va_end(detail_args); } @@ -294,6 +314,9 @@ void report_vm_out_of_memory(const char* file, int line, size_t size, if (Debugging) return; va_list detail_args; va_start(detail_args, detail_fmt); + + print_error_for_unit_test(NULL, detail_fmt, detail_args); + VMError::report_and_die(Thread::current_or_null(), file, line, size, vm_err_type, detail_fmt, detail_args); va_end(detail_args); diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 9b0dc413bcda9..c22348307eec0 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -444,7 +444,7 @@ void VMError::report(outputStream* st, bool _verbose) { "Runtime Environment to continue."); } -#ifndef PRODUCT +#ifdef ASSERT // Error handler self tests // test secondary error handling. Test it twice, to test that resetting @@ -503,7 +503,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->print_cr("not possible; skipped."); } } -#endif // PRODUCT +#endif // ASSERT STEP("printing type of error") @@ -1737,7 +1737,7 @@ bool VMError::check_timeout() { } -#ifndef PRODUCT +#ifdef ASSERT typedef void (*voidfun_t)(); // Crash with an authentic sigfpe @@ -1765,47 +1765,13 @@ static void crash_with_segfault() { } // end: crash_with_segfault -void VMError::test_error_handler() { - controlled_crash(ErrorHandlerTest); -} - // crash in a controlled way: -// how can be one of: -// 1,2 - asserts -// 3,4 - guarantee -// 5-7 - fatal -// 8 - vm_exit_out_of_memory -// 9 - ShouldNotCallThis -// 10 - ShouldNotReachHere -// 11 - Unimplemented -// 12,13 - (not guaranteed) crashes +// 1 - assert +// 2 - guarantee // 14 - SIGSEGV // 15 - SIGFPE void VMError::controlled_crash(int how) { - if (how == 0) return; - - // If asserts are disabled, use the corresponding guarantee instead. - NOT_DEBUG(if (how <= 2) how += 2); - - const char* const str = "hello"; - const size_t num = (size_t)os::vm_page_size(); - - const char* const eol = os::line_separator(); - const char* const msg = "this message should be truncated during formatting"; - char * const dataPtr = NULL; // bad data pointer - const void (*funcPtr)(void); // bad function pointer -#if defined(PPC64) && !defined(ABI_ELFv2) - struct FunctionDescriptor functionDescriptor; - - functionDescriptor.set_entry((address) 0xF); - funcPtr = (const void(*)()) &functionDescriptor; -#else - funcPtr = (const void(*)()) 0xF; -#endif - - // Keep this in sync with test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java - // which tests cases 1 thru 13. // Case 14 is tested by test/hotspot/jtreg/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java. // Case 15 is tested by test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java. // Case 16 is tested by test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java. @@ -1821,30 +1787,10 @@ void VMError::controlled_crash(int how) { } switch (how) { - case 1: vmassert(str == NULL, "expected null"); break; - case 2: vmassert(num == 1023 && *str == 'X', - "num=" SIZE_FORMAT " str=\"%s\"", num, str); break; - case 3: guarantee(str == NULL, "expected null"); break; - case 4: guarantee(num == 1023 && *str == 'X', - "num=" SIZE_FORMAT " str=\"%s\"", num, str); break; - case 5: fatal("expected null"); break; - case 6: fatal("num=" SIZE_FORMAT " str=\"%s\"", num, str); break; - case 7: fatal("%s%s# %s%s# %s%s# %s%s# %s%s# " - "%s%s# %s%s# %s%s# %s%s# %s%s# " - "%s%s# %s%s# %s%s# %s%s# %s", - msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, - msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, - msg, eol, msg, eol, msg, eol, msg, eol, msg); break; - case 8: vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); break; - case 9: ShouldNotCallThis(); break; - case 10: ShouldNotReachHere(); break; - case 11: Unimplemented(); break; - // There's no guarantee the bad data pointer will crash us - // so "break" out to the ShouldNotReachHere(). - case 12: *dataPtr = '\0'; break; - // There's no guarantee the bad function pointer will crash us - // so "break" out to the ShouldNotReachHere(). - case 13: (*funcPtr)(); break; + case 1: assert(how == 0, "test assert"); break; + case 2: guarantee(how == 0, "test guarantee"); break; + + // The other cases are unused. case 14: crash_with_segfault(); break; case 15: crash_with_sigfpe(); break; case 16: { @@ -1858,19 +1804,11 @@ void VMError::controlled_crash(int how) { fatal("Force crash with a nested ThreadsListHandle."); } } - case 18: { - // Check for assert when allocating from resource area without a - // ResourceMark. There must not be a ResourceMark on the - // current stack when invoking this test case. - ResourceArea* area = Thread::current()->resource_area(); - assert(area->nesting() == 0, "unexpected ResourceMark"); - area->allocate_bytes(100); - break; - } - - default: tty->print_cr("ERROR: %d: unexpected test_num value.", how); + default: + // If another number is given, give a generic crash. + fatal("Crashing with number %d", how); } - tty->print_cr("VMError::controlled_crash: survived intentional crash. Did you suppress the assert?"); + tty->print_cr("controlled_crash: survived intentional crash. Did you suppress the assert?"); ShouldNotReachHere(); } -#endif // !PRODUCT +#endif // !ASSERT diff --git a/src/hotspot/share/utilities/vmError.hpp b/src/hotspot/share/utilities/vmError.hpp index 84baf8fec62c8..3c09b0c10c0ba 100644 --- a/src/hotspot/share/utilities/vmError.hpp +++ b/src/hotspot/share/utilities/vmError.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -183,9 +183,7 @@ class VMError : public AllStatic { // Support for avoiding multiple asserts static bool is_error_reported(); - // Test vmassert(), fatal(), guarantee(), etc. - NOT_PRODUCT(static void test_error_handler();) - NOT_PRODUCT(static void controlled_crash(int how);) + DEBUG_ONLY(static void controlled_crash(int how);) // returns an address which is guaranteed to generate a SIGSEGV on read, // for test purposes, which is not NULL and contains bits in every word diff --git a/test/hotspot/gtest/gc/g1/test_g1ServiceThread.cpp b/test/hotspot/gtest/gc/g1/test_g1ServiceThread.cpp index 5fe28daee4d57..dcdbfcc930f7d 100644 --- a/test/hotspot/gtest/gc/g1/test_g1ServiceThread.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1ServiceThread.cpp @@ -160,19 +160,19 @@ TEST_VM(G1ServiceTaskQueue, add_ordered) { #ifdef ASSERT TEST_VM_ASSERT_MSG(G1ServiceTaskQueue, pop_empty, - "Should never try to verify empty queue") { + ".*Should never try to verify empty queue") { G1ServiceTaskQueue queue; queue.pop(); } TEST_VM_ASSERT_MSG(G1ServiceTaskQueue, peek_empty, - "Should never try to verify empty queue") { + ".*Should never try to verify empty queue") { G1ServiceTaskQueue queue; queue.peek(); } TEST_VM_ASSERT_MSG(G1ServiceTaskQueue, set_time_in_queue, - "Not allowed to update time while in queue") { + ".*Not allowed to update time while in queue") { G1ServiceTaskQueue queue; TestTask a(100); queue.add_ordered(&a); diff --git a/test/hotspot/gtest/metaspace/test_allocationGuard.cpp b/test/hotspot/gtest/metaspace/test_allocationGuard.cpp index 2cae4f8bef175..76eca0740025a 100644 --- a/test/hotspot/gtest/metaspace/test_allocationGuard.cpp +++ b/test/hotspot/gtest/metaspace/test_allocationGuard.cpp @@ -44,7 +44,7 @@ using metaspace::Settings; // Note: We use TEST_VM_ASSERT_MSG. However, an assert is only triggered if allocation // guards are enabled; if guards are disabled for the gtests, this test would fail. // So for that case, we trigger a fake assert. -TEST_VM_ASSERT_MSG(metaspace, test_overwriter, "Corrupt block") { +TEST_VM_ASSERT_MSG(metaspace, test_overwriter, ".*failed: Corrupt block") { if (Settings::use_allocation_guard()) { MetaspaceGtestContext context; diff --git a/test/hotspot/gtest/metaspace/test_blocktree.cpp b/test/hotspot/gtest/metaspace/test_blocktree.cpp index 0925b1947f373..e149e9777fe95 100644 --- a/test/hotspot/gtest/metaspace/test_blocktree.cpp +++ b/test/hotspot/gtest/metaspace/test_blocktree.cpp @@ -218,7 +218,7 @@ TEST_VM(metaspace, BlockTree_print_test) { } // Test that an overwritten node would result in an assert and a printed tree -TEST_VM_ASSERT_MSG(metaspace, BlockTree_overwriter_test, "Invalid node") { +TEST_VM_ASSERT_MSG(metaspace, BlockTree_overwriter_test, ".*failed: Invalid node") { static const size_t sizes1[] = { 30, 17, 0 }; static const size_t sizes2[] = { 12, 12, 0 }; diff --git a/test/hotspot/gtest/runtime/test_mutex_rank.cpp b/test/hotspot/gtest/runtime/test_mutex_rank.cpp index 235e71afda925..2dffa06997ee4 100644 --- a/test/hotspot/gtest/runtime/test_mutex_rank.cpp +++ b/test/hotspot/gtest/runtime/test_mutex_rank.cpp @@ -45,7 +45,7 @@ TEST_OTHER_VM(MutexRank, mutex_lock_rank_in_order) { } TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderA, - "Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") { + ".* Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); @@ -59,7 +59,7 @@ TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderA, } TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderB, - "Attempting to acquire lock mutex_rankB/50 out of order with lock mutex_rankA/50 -- possible deadlock") { + ".* Attempting to acquire lock mutex_rankB/50 out of order with lock mutex_rankA/50 -- possible deadlock") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); @@ -89,7 +89,7 @@ TEST_OTHER_VM(MutexRank, mutex_trylock_rank_out_of_orderA) { } TEST_VM_ASSERT_MSG(MutexRank, mutex_trylock_rank_out_of_orderB, - "Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") { + ".* Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); @@ -119,7 +119,7 @@ TEST_OTHER_VM(MutexRank, monitor_wait_rank_in_order) { } TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order, - "Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 " + ".* Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 " "-- possible deadlock. Should wait on the least ranked monitor from all owned locks.") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); @@ -135,7 +135,7 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order, } TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order_trylock, - "Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 " + ".* Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 " "-- possible deadlock. Should wait on the least ranked monitor from all owned locks.") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); @@ -151,7 +151,7 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order_trylock, } TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_special, - "Attempting to wait on monitor monitor_rank_special_minus_one/5 while holding lock monitor_rank_special/6 " + ".* Attempting to wait on monitor monitor_rank_special_minus_one/5 while holding lock monitor_rank_special/6 " "-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank special.") { JavaThread* THREAD = JavaThread::current(); ThreadInVMfromNative invm(THREAD); diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index a16de0e351c06..1f1c270c4929f 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -150,7 +150,8 @@ TEST(os, test_random) { } #ifdef ASSERT -TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") { +TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, + "assert.min_pages > 0. failed: sanity") { size_t region_size = 16 * os::vm_page_size(); os::page_size_for_region_aligned(region_size, 0); // should assert } @@ -445,7 +446,7 @@ TEST_VM(os, release_multi_mappings) { // On debug this would assert. Test that too. // On other platforms, we are unable to recognize bad ranges. #ifdef ASSERT -TEST_VM_ASSERT_MSG(os, release_bad_ranges, "bad release") { +TEST_VM_ASSERT_MSG(os, release_bad_ranges, ".*bad release") { #else TEST_VM(os, release_bad_ranges) { #endif diff --git a/test/hotspot/gtest/runtime/test_safepoint_locks.cpp b/test/hotspot/gtest/runtime/test_safepoint_locks.cpp index e630300fd8c37..2254ca8079292 100644 --- a/test/hotspot/gtest/runtime/test_safepoint_locks.cpp +++ b/test/hotspot/gtest/runtime/test_safepoint_locks.cpp @@ -31,25 +31,25 @@ // Test mismatched safepoint check flag on lock declaration vs. lock acquisition. TEST_VM_ASSERT_MSG(SafepointLockAssertTest, always_check, - "This lock should always have a safepoint check for Java threads") { + ".*This lock should always have a safepoint check for Java threads: SFPT_Test_lock") { MutexLocker ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, Mutex::_safepoint_check_always), Mutex::_no_safepoint_check_flag); } TEST_VM_ASSERT_MSG(SafepointLockAssertTest, never_check, - "This lock should never have a safepoint check for Java thread") { + ".*This lock should never have a safepoint check for Java threads: SFPT_Test_lock") { MutexLocker ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, Mutex::_safepoint_check_never), Mutex::_safepoint_check_flag); } TEST_VM_ASSERT_MSG(SafepointLockAssertTest, special_locks, - "Special locks or below should never safepoint") { + ".*Special locks or below should never safepoint") { MutexLocker ml(new Mutex(Mutex::special, "SpecialTest_lock", /*vm_block*/true, Mutex::_safepoint_check_always), Mutex::_safepoint_check_flag); } TEST_VM_ASSERT_MSG(SafepointLockAssertTest, possible_safepoint_lock, - "Possible safepoint reached by thread that does not allow it") { + ".* Possible safepoint reached by thread that does not allow it") { JavaThread* thread = JavaThread::current(); ThreadInVMfromNative in_native(thread); MutexLocker ml(new Mutex(Mutex::special, "SpecialTest_lock", /*vm_block*/true, Mutex::_safepoint_check_never), diff --git a/test/hotspot/gtest/utilities/test_growableArray.cpp b/test/hotspot/gtest/utilities/test_growableArray.cpp index 2ead040ee394e..1990b45c413db 100644 --- a/test/hotspot/gtest/utilities/test_growableArray.cpp +++ b/test/hotspot/gtest/utilities/test_growableArray.cpp @@ -496,14 +496,14 @@ TEST_VM_F(GrowableArrayTest, where) { } TEST_VM_ASSERT_MSG(GrowableArrayAssertingTest, copy_with_embedded_cheap, - "Copying of CHeap arrays not supported") { + "assert.!on_C_heap... failed: Copying of CHeap arrays not supported") { WithEmbeddedArray s(1, mtTest); // Intentionally asserts that copy of CHeap arrays are not allowed WithEmbeddedArray c(s); } TEST_VM_ASSERT_MSG(GrowableArrayAssertingTest, assignment_with_embedded_cheap, - "Assignment of CHeap arrays not supported") { + "assert.!on_C_heap... failed: Assignment of CHeap arrays not supported") { WithEmbeddedArray s(1, mtTest); WithEmbeddedArray c(1, mtTest); diff --git a/test/hotspot/gtest/utilities/test_vmerror.cpp b/test/hotspot/gtest/utilities/test_vmerror.cpp new file mode 100644 index 0000000000000..46d475dd5b67f --- /dev/null +++ b/test/hotspot/gtest/utilities/test_vmerror.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2020, 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. + */ + +#include "precompiled.hpp" +#include "unittest.hpp" +#include "memory/allocation.hpp" +#include "memory/resourceArea.inline.hpp" +#include "runtime/thread.hpp" + +#ifdef ASSERT + +TEST_VM_ASSERT_MSG(vmErrorTest, resourceMark, + "fatal error: memory leak: allocating without ResourceMark") { + + // Check for assert when allocating from resource area without a + // ResourceMark. There must not be a ResourceMark on the + // current stack when invoking this test case. + ResourceArea* area = Thread::current()->resource_area(); + assert(area->nesting() == 0, "unexpected ResourceMark"); + area->allocate_bytes(100); +} + +const char* const str = "hello"; +const size_t num = 500; + +TEST_VM_ASSERT_MSG(vmErrorTest, assert1, "assert.str == NULL. failed: expected null") { + vmassert(str == NULL, "expected null"); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, assert2, "assert.num == 1023 && .str == 'X'. failed: num=500 str=\"hello\"") { + vmassert(num == 1023 && *str == 'X', + "num=" SIZE_FORMAT " str=\"%s\"", num, str); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, guarantee1, "guarantee.str == NULL. failed: expected null") { + guarantee(str == NULL, "expected null"); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, guarantee2, "guarantee.num == 1023 && .str == 'X'. failed: num=500 str=\"hello\"") { + guarantee(num == 1023 && *str == 'X', + "num=" SIZE_FORMAT " str=\"%s\"", num, str); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, fatal1, "fatal error: expected null") { + fatal("expected null"); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, fatal2, "fatal error: num=500 str=\"hello\"") { + fatal("num=" SIZE_FORMAT " str=\"%s\"", num, str); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, fatal3, "fatal error: this message should be truncated during formatting") { + const char* const eol = os::line_separator(); + const char* const msg = "this message should be truncated during formatting"; + fatal("%s%s# %s%s# %s%s# %s%s# %s%s# " + "%s%s# %s%s# %s%s# %s%s# %s%s# " + "%s%s# %s%s# %s%s# %s%s# %s", + msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, + msg, eol, msg, eol, msg, eol, msg, eol, msg, eol, + msg, eol, msg, eol, msg, eol, msg, eol, msg); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, out_of_memory1, "ChunkPool::allocate") { + const size_t num = (size_t)os::vm_page_size(); + vm_exit_out_of_memory(num, OOM_MALLOC_ERROR, "ChunkPool::allocate"); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, shouldnotcallthis1, "Error: ShouldNotCall") { + ShouldNotCallThis(); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, shouldnotreachhere1, "Error: ShouldNotReachHere") { + ShouldNotReachHere(); +} + +TEST_VM_ASSERT_MSG(vmErrorTest, unimplemented1, "Error: Unimplemented") { + Unimplemented(); +} +#endif // ASSERT diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 45a7bbe6993c9..299e94f9191f6 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -276,7 +276,6 @@ tier1_runtime = \ -runtime/CompressedOops/UseCompressedOops.java \ -runtime/ConstantPool/IntfMethod.java \ -runtime/ErrorHandling/CreateCoredumpOnCrash.java \ - -runtime/ErrorHandling/ErrorHandler.java \ -runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java \ -runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryErrorInMetaspace.java \ -runtime/ErrorHandling/TimeoutInErrorHandlingTest.java \ diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java b/test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java deleted file mode 100644 index 6ba23fb3295aa..0000000000000 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, 2020, 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 - * @requires (vm.debug == true) - * @bug 6888954 - * @bug 8015884 - * @summary Exercise HotSpot error handling code by invoking java with - * -XX:ErrorHandlerTest option to cause an error report. Check the results. - * @modules java.base/jdk.internal.misc - * @library /test/lib - * @run driver ErrorHandler - */ - -import jdk.test.lib.Platform; -import jdk.test.lib.process.ProcessTools; -import jdk.test.lib.process.OutputAnalyzer; - -public class ErrorHandler { - - public static OutputAnalyzer runTest(int testcase) throws Exception { - // The -XX:ErrorHandlerTest=N option requires debug bits. - return new OutputAnalyzer( - ProcessTools.createJavaProcessBuilder( - "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=" + testcase) - .start()); - } - - public static void main(String[] args) throws Exception { - // Keep this in sync with hotspot/src/share/vm/utilities/debug.cpp - int i = 1; - String[] strings = { - "assert(str == NULL) failed: expected null", - "assert(num == 1023 && *str == 'X') failed: num=", - "guarantee(str == NULL) failed: expected null", - "guarantee(num == 1023 && *str == 'X') failed: num=", - "fatal error: expected null", - "fatal error: num=", - "fatal error: this message should be truncated during formatting", - "ChunkPool::allocate", - "Error: ShouldNotCall()", - "Error: ShouldNotReachHere()", - "Error: Unimplemented()" - }; - - String[] patterns = { - "(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=", - // -XX:ErrorHandlerTest=13 is too unreliable. It sometimes fails to crash in the expected way. - // -XX:ErrorHandlerTest=14 is tested by SafeFetchInErrorHandlingTest.java - // -XX:ErrorHandlerTest=15 is tested by SecondaryErrorTest.java - // -XX:ErrorHandlerTest=16 is tested by ThreadsListHandleInErrorHandlingTest.java - // -XX:ErrorHandlerTest=17 is tested by NestedThreadsListHandleInErrorHandlingTest.java - }; - - for (String s : strings) { - runTest(i++).shouldContain(s); - } - - for (String p : patterns) { - runTest(i++).shouldMatch(p); - } - - // Tests after here could be handled by above iterations, but doing - // so would renumber ErrorHandlerTest cases, requiring updates a - // bunch of other test programs. - - runTest(18).shouldContain("memory leak: allocating without ResourceMark"); - } -} diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java index 93c41c60f78d9..f0e44564a0e8d 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java @@ -56,7 +56,7 @@ private static void do_test(boolean do_assert, // true - assert, false - guarant " with " + (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert") + "..."); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", - "-XX:ErrorHandlerTest=" + (do_assert ? "1" : "3"), + "-XX:ErrorHandlerTest=" + (do_assert ? "1" : "2"), (suppress_assert ? "-XX:SuppressErrorAt=/vmError.cpp" : ""), (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert"), "-version"); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java index eafacf63f39f4..776d1c9dfe78f 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java @@ -42,7 +42,7 @@ public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:-CreateCoredumpOnCrash", - "-XX:ErrorHandlerTest=12", // trigger potential SEGV + "-XX:ErrorHandlerTest=14", // trigger potential SEGV "-XX:OnError=echo " + msg, TestOnError.class.getName()); From e7aa5fe602a4ef4e89f36632eb3603e6df58a124 Mon Sep 17 00:00:00 2001 From: Pankaj Bansal Date: Tue, 15 Dec 2020 21:28:50 +0000 Subject: [PATCH 244/504] 8258427: Problem List some tests related to FileDialog for MacOS Reviewed-by: prr, serb --- test/jdk/ProblemList.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 6f861554826b7..de040a48a16ac 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -496,7 +496,7 @@ java/awt/Robot/RobotWheelTest/RobotWheelTest.java 8129827 generic-all java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8202926 linux-all java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java 8202790 macosx-all,linux-all -java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882 linux-all +java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882,8255898 linux-all,macosx-all java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8030121 macosx-all,linux-all java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java 7124275 macosx-all From 1f556d22caecd9bd63a303e1a3ed2b98c629079d Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 15 Dec 2020 21:31:00 +0000 Subject: [PATCH 245/504] 8258380: [JVMCI] don't clear InstalledCode reference when unloading JVMCI nmethods Reviewed-by: kvn, eosterlund --- src/hotspot/share/code/nmethod.cpp | 1 - src/hotspot/share/jvmci/jvmciRuntime.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 2971733e88386..351a1bb7e2ba5 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1270,7 +1270,6 @@ void nmethod::make_unloaded() { JVMCINMethodData* nmethod_data = jvmci_nmethod_data(); if (nmethod_data != NULL) { nmethod_data->invalidate_nmethod_mirror(this); - nmethod_data->clear_nmethod_mirror(this); } #endif } diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 8701c7c6d3528..9cb2356faecfb 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -714,6 +714,12 @@ void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) { HotSpotJVMCI::InstalledCode::set_entryPoint(jvmciEnv, nmethod_mirror, 0); } } + + if (_nmethod_mirror_index != -1 && nm->is_unloaded()) { + // Drop the reference to the nmethod mirror object but don't clear the actual oop reference. Otherwise + // it would appear that the nmethod didn't need to be unloaded in the first place. + _nmethod_mirror_index = -1; + } } JVMCIRuntime::JVMCIRuntime(int id) { From 7977e381ea9185dea063b09b3623accdbb97f560 Mon Sep 17 00:00:00 2001 From: Andrii Rodionov Date: Tue, 15 Dec 2020 21:37:38 +0000 Subject: [PATCH 246/504] 8254024: Enhance native libs for AWT and Swing to work with GraalVM Native Image Reviewed-by: serb, ihse, bobv --- .../libawt/awt/medialib/awt_ImagingLib.h | 4 +- .../unix/native/libawt/awt/awt_LoadLibrary.c | 41 ++++++++++++++--- .../unix/native/libawt/awt/awt_Mlib.c | 44 ++++++++++++++++++- .../unix/native/libawt_xawt/xawt/XToolkit.c | 14 +++++- 4 files changed, 92 insertions(+), 11 deletions(-) diff --git a/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h b/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h index f0dfec5b2baf5..b071f0103e43d 100644 --- a/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h +++ b/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, 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 @@ -39,7 +39,7 @@ typedef struct { typedef mlib_image *(*MlibCreateFP_t)(mlib_type, mlib_s32, mlib_s32, mlib_s32); typedef mlib_image *(*MlibCreateStructFP_t)(mlib_type, mlib_s32, mlib_s32, - mlib_s32, mlib_s32, void *); + mlib_s32, mlib_s32, const void *); typedef void (*MlibDeleteFP_t)(mlib_image *); typedef struct { diff --git a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c index 982226e653947..d5ce3f2edc33c 100644 --- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c +++ b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, 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 @@ -43,6 +43,13 @@ #define VERBOSE_AWT_DEBUG #endif +#ifdef STATIC_BUILD +extern void Java_sun_xawt_motif_XsessionWMcommand(JNIEnv *env, jobject this, +jobject frame, jstring jcommand); + +extern void Java_sun_xawt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jarray); +#endif + static void *awtHandle = NULL; typedef jint JNICALL JNI_OnLoad_type(JavaVM *vm, void *reserved); @@ -118,13 +125,13 @@ AWT_OnLoad(JavaVM *vm, void *reserved) } jvm = vm; - +#ifndef STATIC_BUILD /* Get address of this library and the directory containing it. */ dladdr((void *)AWT_OnLoad, &dlinfo); realpath((char *)dlinfo.dli_fname, buf); len = strlen(buf); p = strrchr(buf, '/'); - +#endif /* * The code below is responsible for: * 1. Loading appropriate awt library, i.e. libawt_xawt or libawt_headless @@ -156,8 +163,10 @@ AWT_OnLoad(JavaVM *vm, void *reserved) } #endif +#ifndef STATIC_BUILD /* Calculate library name to load */ strncpy(p, tk, MAXPATHLEN-len-1); +#endif if (fmProp) { (*env)->DeleteLocalRef(env, fmProp); @@ -166,6 +175,8 @@ AWT_OnLoad(JavaVM *vm, void *reserved) (*env)->DeleteLocalRef(env, fmanager); } + +#ifndef STATIC_BUILD jstring jbuf = JNU_NewStringPlatform(env, buf); CHECK_EXCEPTION_FATAL(env, "Could not allocate library name"); JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load", @@ -173,7 +184,7 @@ AWT_OnLoad(JavaVM *vm, void *reserved) jbuf); awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL); - +#endif return JNI_VERSION_1_2; } @@ -198,14 +209,16 @@ Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this, jobject frame, jstring jcommand); static XsessionWMcommand_type *XsessionWMcommand = NULL; - +#ifndef STATIC_BUILD if (XsessionWMcommand == NULL && awtHandle == NULL) { return; } XsessionWMcommand = (XsessionWMcommand_type *) dlsym(awtHandle, "Java_sun_awt_motif_XsessionWMcommand"); - +#else + XsessionWMcommand = (XsessionWMcommand_type *)Java_sun_xawt_motif_XsessionWMcommand; +#endif if (XsessionWMcommand == NULL) return; @@ -225,16 +238,30 @@ Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv) XsessionWMcommand_New_type(JNIEnv *env, jobjectArray jargv); static XsessionWMcommand_New_type *XsessionWMcommand = NULL; - +#ifndef STATIC_BUILD if (XsessionWMcommand == NULL && awtHandle == NULL) { return; } XsessionWMcommand = (XsessionWMcommand_New_type *) dlsym(awtHandle, "Java_sun_awt_motif_XsessionWMcommand_New"); +#else + XsessionWMcommand = (XsessionWMcommand_New_type *)Java_sun_xawt_motif_XsessionWMcommand_New; +#endif if (XsessionWMcommand == NULL) return; (*XsessionWMcommand)(env, jargv); } + +#ifdef STATIC_BUILD +__attribute__((weak)) void Java_sun_xawt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jarray) +{ +} + +__attribute__((weak)) void Java_sun_xawt_motif_XsessionWMcommand(JNIEnv *env, jobject this, + jobject frame, jstring jcommand) +{ +} +#endif diff --git a/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c b/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c index 7e0c89c1c785f..f87b51bb46a00 100644 --- a/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c +++ b/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, 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,9 +36,50 @@ #include "awt_Mlib.h" #include "java_awt_image_BufferedImage.h" +#ifdef STATIC_BUILD +#include "mlib_image.h" +#endif + static void start_timer(int numsec); static void stop_timer(int numsec, int ntimes); +#ifdef STATIC_BUILD +// Mapping functions to their names for runtime check +static mlibFnS_t sMlibFnsStatic[] = { + {j2d_mlib_ImageConvMxN, "j2d_mlib_ImageConvMxN"}, + {j2d_mlib_ImageAffine, "j2d_mlib_ImageAffine"}, + {j2d_mlib_ImageLookUp, "j2d_mlib_ImageLookUp"}, + {j2d_mlib_ImageConvKernelConvert, "j2d_mlib_ImageConvKernelConvert"}, +}; + +mlib_status awt_getImagingLib(JNIEnv *env, mlibFnS_t *sMlibFns, + mlibSysFnS_t *sMlibSysFns) { + mlibFnS_t *mptr; + int i; + char *fName; + mlibSysFnS_t tempSysFns; + mlib_status ret = MLIB_SUCCESS; + + tempSysFns.createFP = j2d_mlib_ImageCreate; + tempSysFns.createStructFP = j2d_mlib_ImageCreateStruct; + tempSysFns.deleteImageFP = j2d_mlib_ImageDelete; + *sMlibSysFns = tempSysFns; + + mptr = sMlibFns; + i = 0; + while (mptr[i].fname != NULL) { + fName = mptr[i].fname; + if(strcmp(fName, sMlibFnsStatic[i].fname) == 0) { + mptr[i].fptr = sMlibFnsStatic[i].fptr; + } else { + ret = MLIB_FAILURE; + } + i++; + } + + return ret; +} +#else /* * This is called by awt_ImagingLib.initLib() */ @@ -121,6 +162,7 @@ mlib_status awt_getImagingLib(JNIEnv *env, mlibFnS_t *sMlibFns, } return ret; } +#endif mlib_start_timer awt_setMlibStartTimer() { return start_timer; diff --git a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c index ac8d1fc154b5f..0196b39f9eca5 100644 --- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c +++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c @@ -300,9 +300,12 @@ Java_java_awt_TextField_initIDs { } +#ifndef STATIC_BUILD +// The same function exists in libawt.a::awt_LoadLibrary.c JNIEXPORT jboolean JNICALL AWTIsHeadless() { return JNI_FALSE; } +#endif JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls) { @@ -811,8 +814,13 @@ Window get_xawt_root_shell(JNIEnv *env) { */ JNIEXPORT void JNICALL -Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this, +#ifdef STATIC_BUILD +Java_sun_xawt_motif_XsessionWMcommand(JNIEnv *env, jobject this, jobject frame, jstring jcommand) +#else +Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this, + jobject frame, jstring jcommand) +#endif { const char *command; XTextProperty text_prop; @@ -856,7 +864,11 @@ Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this, * name. It's not! It's just a plain function. */ JNIEXPORT void JNICALL +#ifdef STATIC_BUILD +Java_sun_xawt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jarray) +#else Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jarray) +#endif { jsize length; char ** array; From 8bf46c7368e4296f7134cbc16b5f8f722b7d03e0 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Tue, 15 Dec 2020 21:42:01 +0000 Subject: [PATCH 247/504] 8258438: build error in test/hotspot/gtest/runtime/test_os.cpp Reviewed-by: dcubed, tschatzl --- test/hotspot/gtest/runtime/test_os.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index 1f1c270c4929f..ac8636af5fc72 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -523,7 +523,7 @@ TEST_VM(os, show_mappings_small_range) { TEST_VM(os, show_mappings_full_range) { // Reserve a small range and fill it with a marker string, should show up // on implementations displaying range snippets - char* p = os::reserve_memory(1 * M, mtInternal); + char* p = os::reserve_memory(1 * M, false, mtInternal); if (p != nullptr) { if (os::commit_memory(p, 1 * M, false)) { strcpy(p, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); From b97fe6c410368af4ba44c6e68643dcc6fd2e23f2 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Tue, 15 Dec 2020 22:49:35 +0000 Subject: [PATCH 248/504] 8258419: RSA cipher buffer cleanup Reviewed-by: valeriep --- .../com/sun/crypto/provider/RSACipher.java | 82 ++++++++++++------- .../classes/sun/security/rsa/RSACore.java | 4 +- .../classes/sun/security/rsa/RSAPadding.java | 41 ++++------ 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java b/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java index 64a94d7d0e740..1fdcd81accdcd 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,6 +25,7 @@ package com.sun.crypto.provider; +import java.util.Arrays; import java.util.Locale; import java.security.*; @@ -347,28 +348,40 @@ private byte[] doFinal() throws BadPaddingException, throw new IllegalBlockSizeException("Data must not be longer " + "than " + buffer.length + " bytes"); } + byte[] paddingCopy = null; + byte[] result = null; try { - byte[] data; switch (mode) { case MODE_SIGN: - data = padding.pad(buffer, 0, bufOfs); - return RSACore.rsa(data, privateKey, true); + paddingCopy = padding.pad(buffer, 0, bufOfs); + result = RSACore.rsa(paddingCopy, privateKey, true); + break; case MODE_VERIFY: byte[] verifyBuffer = RSACore.convert(buffer, 0, bufOfs); - data = RSACore.rsa(verifyBuffer, publicKey); - return padding.unpad(data); + paddingCopy = RSACore.rsa(verifyBuffer, publicKey); + result = padding.unpad(paddingCopy); + break; case MODE_ENCRYPT: - data = padding.pad(buffer, 0, bufOfs); - return RSACore.rsa(data, publicKey); + paddingCopy = padding.pad(buffer, 0, bufOfs); + result = RSACore.rsa(paddingCopy, publicKey); + break; case MODE_DECRYPT: byte[] decryptBuffer = RSACore.convert(buffer, 0, bufOfs); - data = RSACore.rsa(decryptBuffer, privateKey, false); - return padding.unpad(data); + paddingCopy = RSACore.rsa(decryptBuffer, privateKey, false); + result = padding.unpad(paddingCopy); + break; default: throw new AssertionError("Internal error"); } + return result; } finally { + Arrays.fill(buffer, 0, bufOfs, (byte)0); bufOfs = 0; + if (paddingCopy != null // will not happen + && paddingCopy != buffer // already cleaned + && paddingCopy != result) { // DO NOT CLEAN, THIS IS RESULT! + Arrays.fill(paddingCopy, (byte)0); + } } } @@ -404,6 +417,7 @@ protected int engineDoFinal(byte[] in, int inOfs, int inLen, byte[] out, byte[] result = doFinal(); int n = result.length; System.arraycopy(result, 0, out, outOfs, n); + Arrays.fill(result, (byte)0); return n; } @@ -414,15 +428,19 @@ protected byte[] engineWrap(Key key) throws InvalidKeyException, if ((encoded == null) || (encoded.length == 0)) { throw new InvalidKeyException("Could not obtain encoded key"); } - if (encoded.length > buffer.length) { - throw new InvalidKeyException("Key is too long for wrapping"); - } - update(encoded, 0, encoded.length); try { - return doFinal(); - } catch (BadPaddingException e) { - // should not occur - throw new InvalidKeyException("Wrapping failed", e); + if (encoded.length > buffer.length) { + throw new InvalidKeyException("Key is too long for wrapping"); + } + update(encoded, 0, encoded.length); + try { + return doFinal(); + } catch (BadPaddingException e) { + // should not occur + throw new InvalidKeyException("Wrapping failed", e); + } + } finally { + Arrays.fill(encoded, (byte)0); } } @@ -453,20 +471,26 @@ protected Key engineUnwrap(byte[] wrappedKey, String algorithm, throw new InvalidKeyException("Unwrapping failed", e); } - if (isTlsRsaPremasterSecret) { - if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { - throw new IllegalStateException( - "No TlsRsaPremasterSecretParameterSpec specified"); + try { + if (isTlsRsaPremasterSecret) { + if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new IllegalStateException( + "No TlsRsaPremasterSecretParameterSpec specified"); + } + + // polish the TLS premaster secret + encoded = KeyUtil.checkTlsPreMasterSecretKey( + ((TlsRsaPremasterSecretParameterSpec) spec).getClientVersion(), + ((TlsRsaPremasterSecretParameterSpec) spec).getServerVersion(), + random, encoded, (failover != null)); } - // polish the TLS premaster secret - encoded = KeyUtil.checkTlsPreMasterSecretKey( - ((TlsRsaPremasterSecretParameterSpec)spec).getClientVersion(), - ((TlsRsaPremasterSecretParameterSpec)spec).getServerVersion(), - random, encoded, (failover != null)); + return ConstructKeys.constructKey(encoded, algorithm, type); + } finally { + if (encoded != null) { + Arrays.fill(encoded, (byte) 0); + } } - - return ConstructKeys.constructKey(encoded, algorithm, type); } // see JCE spec diff --git a/src/java.base/share/classes/sun/security/rsa/RSACore.java b/src/java.base/share/classes/sun/security/rsa/RSACore.java index abf717fc8c26f..33534c87da452 100644 --- a/src/java.base/share/classes/sun/security/rsa/RSACore.java +++ b/src/java.base/share/classes/sun/security/rsa/RSACore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,12 +231,14 @@ private static byte[] toByteArray(BigInteger bi, int len) { if ((n == len + 1) && (b[0] == 0)) { byte[] t = new byte[len]; System.arraycopy(b, 1, t, 0, len); + Arrays.fill(b, (byte)0); return t; } // must be smaller assert (n < len); byte[] t = new byte[len]; System.arraycopy(b, 0, t, (len - n), n); + Arrays.fill(b, (byte)0); return t; } diff --git a/src/java.base/share/classes/sun/security/rsa/RSAPadding.java b/src/java.base/share/classes/sun/security/rsa/RSAPadding.java index fe054d5031474..c54dbdb8d4384 100644 --- a/src/java.base/share/classes/sun/security/rsa/RSAPadding.java +++ b/src/java.base/share/classes/sun/security/rsa/RSAPadding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -238,41 +238,33 @@ public int getMaxDataSize() { /** * Pad the data and return the padded block. */ - public byte[] pad(byte[] data, int ofs, int len) - throws BadPaddingException { - return pad(RSACore.convert(data, ofs, len)); + public byte[] pad(byte[] data) throws BadPaddingException { + return pad(data, 0, data.length); } /** * Pad the data and return the padded block. */ - public byte[] pad(byte[] data) throws BadPaddingException { - if (data.length > maxDataSize) { + public byte[] pad(byte[] data, int ofs, int len) + throws BadPaddingException { + if (len > maxDataSize) { throw new BadPaddingException("Data must be shorter than " + (maxDataSize + 1) + " bytes but received " - + data.length + " bytes."); + + len + " bytes."); } switch (type) { case PAD_NONE: - return data; + return RSACore.convert(data, ofs, len); case PAD_BLOCKTYPE_1: case PAD_BLOCKTYPE_2: - return padV15(data); + return padV15(data, ofs, len); case PAD_OAEP_MGF1: - return padOAEP(data); + return padOAEP(data, ofs, len); default: throw new AssertionError(); } } - /** - * Unpad the padded block and return the data. - */ - public byte[] unpad(byte[] padded, int ofs, int len) - throws BadPaddingException { - return unpad(RSACore.convert(padded, ofs, len)); - } - /** * Unpad the padded block and return the data. */ @@ -298,11 +290,10 @@ public byte[] unpad(byte[] padded) throws BadPaddingException { /** * PKCS#1 v1.5 padding (blocktype 1 and 2). */ - private byte[] padV15(byte[] data) throws BadPaddingException { + private byte[] padV15(byte[] data, int ofs, int len) throws BadPaddingException { byte[] padded = new byte[paddedSize]; - System.arraycopy(data, 0, padded, paddedSize - data.length, - data.length); - int psSize = paddedSize - 3 - data.length; + System.arraycopy(data, ofs, padded, paddedSize - len, len); + int psSize = paddedSize - 3 - len; int k = 0; padded[k++] = 0; padded[k++] = (byte)type; @@ -388,7 +379,7 @@ private byte[] unpadV15(byte[] padded) throws BadPaddingException { * PKCS#1 v2.0 OAEP padding (MGF1). * Paragraph references refer to PKCS#1 v2.1 (June 14, 2002) */ - private byte[] padOAEP(byte[] M) throws BadPaddingException { + private byte[] padOAEP(byte[] M, int ofs, int len) throws BadPaddingException { if (random == null) { random = JCAUtil.getSecureRandom(); } @@ -415,7 +406,7 @@ private byte[] padOAEP(byte[] M) throws BadPaddingException { int dbLen = EM.length - dbStart; // start of message M in EM - int mStart = paddedSize - M.length; + int mStart = paddedSize - len; // build DB // 2.b: Concatenate lHash, PS, a single octet with hexadecimal value @@ -424,7 +415,7 @@ private byte[] padOAEP(byte[] M) throws BadPaddingException { // (note that PS is all zeros) System.arraycopy(lHash, 0, EM, dbStart, hLen); EM[mStart - 1] = 1; - System.arraycopy(M, 0, EM, mStart, M.length); + System.arraycopy(M, ofs, EM, mStart, len); // produce maskedDB mgf.generateAndXor(EM, seedStart, seedLen, dbLen, EM, dbStart); From 4d6f31815323c072f8dd09d8cc26d7c54aa29879 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 15 Dec 2020 23:54:50 +0000 Subject: [PATCH 249/504] 8257726: Make -XX:+StressLdcRewrite option a diagnostic option Reviewed-by: lfoltan, stuefe, dcubed --- src/hotspot/share/runtime/globals.hpp | 10 +++++----- .../lang/instrument/RedefineMethodWithAnnotations.sh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 04b4ded6aa26c..9c15f291a06de 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -881,11 +881,11 @@ const intx ObjectAlignmentInBytes = 8; product(ccstr, TraceJVMTI, NULL, \ "Trace flags for JVMTI functions and events") \ \ - /* This option can change an EMCP method into an obsolete method. */ \ - /* This can affect tests that except specific methods to be EMCP. */ \ - /* This option should be used with caution. */ \ - product(bool, StressLdcRewrite, false, \ - "Force ldc -> ldc_w rewrite during RedefineClasses") \ + product(bool, StressLdcRewrite, false, DIAGNOSTIC, \ + "Force ldc -> ldc_w rewrite during RedefineClasses. " \ + "This option can change an EMCP method into an obsolete method " \ + "and can affect tests that expect specific methods to be EMCP. " \ + "This option should be used with caution.") \ \ product(bool, AllowRedefinitionToAddDeleteMethods, false, \ "(Deprecated) Allow redefinition to add and delete private " \ diff --git a/test/jdk/java/lang/instrument/RedefineMethodWithAnnotations.sh b/test/jdk/java/lang/instrument/RedefineMethodWithAnnotations.sh index 0e740278a7f1e..ed3ef4ef4122d 100644 --- a/test/jdk/java/lang/instrument/RedefineMethodWithAnnotations.sh +++ b/test/jdk/java/lang/instrument/RedefineMethodWithAnnotations.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2020, 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 @@ -68,7 +68,7 @@ cp "${TESTSRC}"/RedefineMethodWithAnnotationsAnnotations.java \ RedefineMethodWithAnnotationsAnnotations.java "${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodWithAnnotationsAgent.jar \ - -XX:+StressLdcRewrite -XX:+IgnoreUnrecognizedVMOptions \ + -XX:+UnlockDiagnosticVMOptions -XX:+StressLdcRewrite -XX:+IgnoreUnrecognizedVMOptions \ -cp "${TESTCLASSES}" RedefineMethodWithAnnotationsApp > output.log 2>&1 cat output.log From 1e77896838e15c334c9f5e0eaa17c23b321b5ca8 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 16 Dec 2020 00:00:12 +0000 Subject: [PATCH 250/504] 8236225: Remove expired flags in JDK 17 8256717: Expire the long term obsoleted VM flags Reviewed-by: coleenp, kvn --- src/hotspot/share/include/jmm.h | 4 +- src/hotspot/share/runtime/arguments.cpp | 38 +-- src/java.base/share/man/java.1 | 237 +++++++++--------- .../CommandLine/ObsoleteFlagErrorMessage.java | 11 +- .../runtime/CommandLine/PermGenFlagsTest.java | 51 ---- .../runtime/cds/SpaceUtilizationCheck.java | 8 - .../javaldr/GCSharedStringsDuringDump.java | 2 - 7 files changed, 128 insertions(+), 223 deletions(-) delete mode 100644 test/hotspot/jtreg/runtime/CommandLine/PermGenFlagsTest.java diff --git a/src/hotspot/share/include/jmm.h b/src/hotspot/share/include/jmm.h index 1c06be29b6aa2..d7788e7a4e841 100644 --- a/src/hotspot/share/include/jmm.h +++ b/src/hotspot/share/include/jmm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -84,7 +84,7 @@ typedef enum { JMM_INTERNAL_ATTRIBUTE_INDEX = 100, JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */ - JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */ + JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time */ JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */ JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */ JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */ diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 9e8144e35f382..5b262f6cffff4 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -518,7 +518,6 @@ static SpecialFlag const special_jvm_flags[] = { { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, - { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() }, { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, { "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() }, { "CriticalJNINatives", JDK_Version::jdk(16), JDK_Version::jdk(17), JDK_Version::jdk(18) }, @@ -537,42 +536,9 @@ static SpecialFlag const special_jvm_flags[] = { { "TLABStats", JDK_Version::jdk(12), JDK_Version::undefined(), JDK_Version::undefined() }, // -------------- Obsolete Flags - sorted by expired_in -------------- - { "PermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() }, - { "MaxPermSize", JDK_Version::undefined(), JDK_Version::jdk(8), JDK_Version::undefined() }, - { "SharedReadWriteSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() }, - { "SharedReadOnlySize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() }, - { "SharedMiscDataSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() }, - { "SharedMiscCodeSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() }, -#ifdef BSD - { "UseBsdPosixThreadCPUClocks", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "UseOprofile", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, +#ifdef ASSERT + { "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(17), JDK_Version::undefined() }, #endif - { "PrintVMQWaitTime", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "UseNewFieldLayout", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "UseSemaphoreGCThreadsSynchronization", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "ForceNUMA", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "InitialBootClassLoaderMetaspaceSize", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "UseLargePagesInMetaspace", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "InsertMemBarAfterArraycopy", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "Debugging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "UseRDPCForConstantTableBase", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "VerifyMergedCPBytecodes", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "PrintSharedSpaces", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceBiasedLocking", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceClassLoading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceClassLoadingPreorder", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceClassPaths", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceClassResolution", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceClassUnloading", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceExceptions", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceInvokeDynamic", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceLoaderConstraints", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceMethodHandles", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceMonitorInflation", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceSafepointCleanupTime", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceJVMTIObjectTagging", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "TraceRedefineClasses", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, - { "PrintJNIResolving", JDK_Version::undefined(), JDK_Version::jdk(16), JDK_Version::jdk(17) }, #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS // These entries will generate build errors. Their purpose is to test the macros. diff --git a/src/java.base/share/man/java.1 b/src/java.base/share/man/java.1 index fd78f50e1567d..8dddc7e1b14ed 100644 --- a/src/java.base/share/man/java.1 +++ b/src/java.base/share/man/java.1 @@ -22,7 +22,7 @@ .\"t .\" Automatically generated by Pandoc 2.3.1 .\" -.TH "JAVA" "1" "2020" "JDK 16" "JDK Commands" +.TH "JAVA" "1" "2020" "JDK 17" "JDK Commands" .hy .SH NAME .PP @@ -181,7 +181,7 @@ with new values added and old values removed. You\[aq]ll get an error message if you use a value of \f[I]N\f[R] that is no longer supported. The supported values of \f[I]N\f[R] are the current Java SE release -(\f[CB]16\f[R]) and a limited number of previous releases, detailed in the +(\f[CB]17\f[R]) and a limited number of previous releases, detailed in the command\-line help for \f[CB]javac\f[R], under the \f[CB]\-\-source\f[R] and \f[CB]\-\-release\f[R] options. .RE @@ -1120,72 +1120,6 @@ Updates \f[I]module\f[R] to open \f[I]package\f[R] to .RS .RE .TP -.B \f[CB]\-\-illegal\-access=\f[R]\f[I]parameter\f[R] -When present at run time, \f[CB]\-\-illegal\-access=\f[R] takes a keyword -\f[I]parameter\f[R] to specify a mode of operation: -.RS -.RS -.PP -\f[B]Note:\f[R] This option will be removed in a future release. -.RE -.IP \[bu] 2 -\f[CB]permit\f[R]: This mode opens each package in each module in the -run\-time image to code in all unnamed modules ( such as code on the -class path), if that package existed in JDK 8. -This enables both static access, (for example, by compiled bytecode, and -deep reflective access) through the platform\[aq]s various reflection -APIs. -The first reflective\-access operation to any such package causes a -warning to be issued. -However, no warnings are issued after the first occurrence. -This single warning describes how to enable further warnings. -This mode is the default for the current JDK but will change in a future -release. -.IP \[bu] 2 -\f[CB]warn\f[R]: This mode is identical to \f[CB]permit\f[R] except that a -warning message is issued for each illegal reflective\-access operation. -.IP \[bu] 2 -\f[CB]debug\f[R]: This mode is identical to \f[CB]warn\f[R] except that both -a warning message and a stack trace are issued for each illegal -reflective\-access operation. -.IP \[bu] 2 -\f[CB]deny\f[R]: This mode disables all illegal\-access operations except -for those enabled by other command\-line options, such as -\f[CB]\-\-add\-opens\f[R]. -This mode will become the default in a future release. -.PP -The default mode, \f[CB]\-\-illegal\-access=permit\f[R], is intended to -make you aware of code on the class path that reflectively accesses any -JDK\-internal APIs at least once. -To learn about all such accesses, you can use the \f[CB]warn\f[R] or the -\f[CB]debug\f[R] modes. -For each library or framework on the class path that requires illegal -access, you have two options: -.IP \[bu] 2 -If the component\[aq]s maintainers have already released a fixed version -that no longer uses JDK\-internal APIs then you can consider upgrading -to that version. -.IP \[bu] 2 -If the component still needs to be fixed, then you can contact its -maintainers and ask them to replace their use of JDK\-internal APIs with -the proper exported APIs. -.PP -If you must continue to use a component that requires illegal access, -then you can eliminate the warning messages by using one or more -\f[CB]\-\-add\-opens\f[R] options to open only those internal packages to -which access is required. -.PP -To verify that your application is ready for a future version of the -JDK, run it with \f[CB]\-\-illegal\-access=deny\f[R] along with any -necessary \f[CB]\-\-add\-opens\f[R] options. -Any remaining illegal\-access errors will most likely be due to static -references from compiled code to JDK\-internal APIs. -You can identify those by running the \f[B]jdeps\f[R] tool with the -\f[CB]\-\-jdk\-internals\f[R] option. -For performance reasons, the current JDK does not issue warnings for -illegal static\-access operations. -.RE -.TP .B \f[CB]\-\-limit\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...] Specifies the limit of the universe of observable modules. .RS @@ -3937,6 +3871,68 @@ future JDK release. They\[aq]re still accepted and acted upon, but a warning is issued when they\[aq]re used. .TP +.B \f[CB]\-\-illegal\-access=\f[R]\f[I]parameter\f[R] +When present at run time, \f[CB]\-\-illegal\-access=\f[R] takes a keyword +\f[I]parameter\f[R] to specify a mode of operation: +.RS +.RS +.PP +\f[B]Note:\f[R] This option will be removed in a future release. +.RE +.IP \[bu] 2 +\f[CB]permit\f[R]: This mode opens each package in each module in the +run\-time image to code in all unnamed modules ( such as code on the +class path), if that package existed in JDK 8. +This enables both static access, (for example, by compiled bytecode, and +deep reflective access) through the platform\[aq]s various reflection +APIs. +The first reflective\-access operation to any such package causes a +warning to be issued. +However, no warnings are issued after the first occurrence. +This single warning describes how to enable further warnings. +.IP \[bu] 2 +\f[CB]warn\f[R]: This mode is identical to \f[CB]permit\f[R] except that a +warning message is issued for each illegal reflective\-access operation. +.IP \[bu] 2 +\f[CB]debug\f[R]: This mode is identical to \f[CB]warn\f[R] except that both +a warning message and a stack trace are issued for each illegal +reflective\-access operation. +.IP \[bu] 2 +\f[CB]deny\f[R]: This mode disables all illegal\-access operations except +for those enabled by other command\-line options, such as +\f[CB]\-\-add\-opens\f[R]. +This mode is the default. +.PP +If your application does not work with the default mode of +\f[CB]\-\-illegal\-access=deny\f[R] then you can learn more about what is +going on with the \f[CB]warn\f[R] and \f[CB]debug\f[R] modes. +For each library or framework on the class path that requires illegal +access, you have two options: +.IP \[bu] 2 +If the component\[aq]s maintainers have already released a fixed version +that no longer uses JDK\-internal APIs then you can consider upgrading +to that version. +.IP \[bu] 2 +If the component still needs to be fixed, then you can contact its +maintainers and ask them to replace their use of JDK\-internal APIs with +the proper exported APIs. +.PP +If you must continue to use a component that requires illegal access, +then you can eliminate the warning messages by using one or more +\f[CB]\-\-add\-opens\f[R] options to open only those internal packages to +which access is required. +.PP +To verify that your application is ready for a future version of the +JDK, run it with \f[CB]\-\-illegal\-access=deny\f[R] along with any +necessary \f[CB]\-\-add\-opens\f[R] options. +Any remaining illegal\-access errors will most likely be due to static +references from compiled code to JDK\-internal APIs. +You can identify those by running the \f[B]jdeps\f[R] tool with the +\f[CB]\-\-jdk\-internals\f[R] option. +For performance reasons, the current JDK does not issue warnings for +illegal static\-access operations. +.RE +.TP .B \f[CB]\-Xfuture\f[R] Enables strict class\-file format checks that enforce close conformance to the class\-file format specification. @@ -4006,6 +4002,52 @@ The default value is 2. Use the option \f[CB]\-XX:MinRAMPercentage\f[R] instead. .RE .TP +.B \f[CB]\-XX:+UseBiasedLocking\f[R] +Enables the use of biased locking. +Some applications with significant amounts of uncontended +synchronization may attain significant speedups with this flag enabled, +but applications with certain patterns of locking may see slowdowns. +.RS +.PP +By default, this option is disabled. +.RE +.SH OBSOLETE JAVA OPTIONS +.PP +These \f[CB]java\f[R] options are still accepted but ignored, and a +warning is issued when they\[aq]re used. +.PP +None in JDK 17. +.SH REMOVED JAVA OPTIONS +.PP +These \f[CB]java\f[R] options have been removed in JDK 17 and using them +results in an error of: +.RS +.PP +\f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R] +.RE +.TP +.B \f[CB]\-XX:+UseMembar\f[R] +Enabled issuing membars on thread\-state transitions. +This option was disabled by default on all platforms except ARM servers, +where it was enabled. +.RS +.RE +.TP +.B \f[CB]\-XX:MaxPermSize=\f[R]\f[I]size\f[R] +Sets the maximum permanent generation space size (in bytes). +This option was deprecated in JDK 8 and superseded by the +\f[CB]\-XX:MaxMetaspaceSize\f[R] option. +.RS +.RE +.TP +.B \f[CB]\-XX:PermSize=\f[R]\f[I]size\f[R] +Sets the space (in bytes) allocated to the permanent generation that +triggers a garbage collection if it\[aq]s exceeded. +This option was deprecated in JDK 8 and superseded by the +\f[CB]\-XX:MetaspaceSize\f[R] option. +.RS +.RE +.TP .B \f[CB]\-XX:+TraceClassLoading\f[R] Enables tracing of classes as they are loaded. By default, this option is disabled and classes aren\[aq]t traced. @@ -4053,62 +4095,13 @@ The replacement Unified Logging syntax is \f[CB]\-Xlog:class+loader+constraints=info\f[R]. See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R]. .RE -.TP -.B \f[CB]\-XX:+UseBiasedLocking\f[R] -Enables the use of biased locking. -Some applications with significant amounts of uncontended -synchronization may attain significant speedups with this flag enabled, -but applications with certain patterns of locking may see slowdowns. -.RS -.PP -By default, this option is disabled. -.RE -.SH OBSOLETE JAVA OPTIONS -.PP -These \f[CB]java\f[R] options are still accepted but ignored, and a -warning is issued when they\[aq]re used. -.TP -.B \f[CB]\-XX:+UseMembar\f[R] -Enabled issuing membars on thread\-state transitions. -This option was disabled by default on all platforms except ARM servers, -where it was enabled. -.RS -.RE -.TP -.B \f[CB]\-XX:MaxPermSize=\f[R]\f[I]size\f[R] -Sets the maximum permanent generation space size (in bytes). -This option was deprecated in JDK 8 and superseded by the -\f[CB]\-XX:MaxMetaspaceSize\f[R] option. -.RS -.RE -.TP -.B \f[CB]\-XX:PermSize=\f[R]\f[I]size\f[R] -Sets the space (in bytes) allocated to the permanent generation that -triggers a garbage collection if it\[aq]s exceeded. -This option was deprecated in JDK 8 and superseded by the -\f[CB]\-XX:MetaspaceSize\f[R] option. -.RS -.RE -.SH REMOVED JAVA OPTIONS -.PP -These \f[CB]java\f[R] options have been removed in JDK 15 and using them -results in an error of: -.RS -.PP -\f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R] -.RE -.TP -.B \f[CB]\-XX:+UseParallelOldGC\f[R] -Enables the use of the parallel garbage collector for full GCs. -By default, this option is disabled. -Enabling it automatically enables the \f[CB]\-XX:+UseParallelGC\f[R] -option. -.RS -.RE .PP For the lists and descriptions of options removed in previous releases see the \f[I]Removed Java Options\f[R] section in: .IP \[bu] 2 +\f[B]Java Platform, Standard Edition Tools Reference, Release 16\f[R] +[https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html] +.IP \[bu] 2 \f[B]Java Platform, Standard Edition Tools Reference, Release 15\f[R] [https://docs.oracle.com/en/java/javase/15/docs/specs/man/java.html] .IP \[bu] 2 @@ -4794,6 +4787,10 @@ T} .TE .SS Convert Runtime Logging Flags to Xlog .PP +These legacy flags are no longer recognized and will cause an error if +used directly. +Use their unified logging equivalent instead. +.PP .TS tab(@); lw(15.0n) lw(20.2n) lw(34.7n). diff --git a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java index 560163808f6b2..0e700d73db43d 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -27,6 +27,7 @@ * @summary Newly obsolete command line options should still give useful error messages when used improperly. * @modules java.base/jdk.internal.misc * @library /test/lib + * @requires vm.debug == true * @run driver ObsoleteFlagErrorMessage */ @@ -36,20 +37,22 @@ public class ObsoleteFlagErrorMessage { public static void main(String[] args) throws Exception { + String flag = "DummyObsoleteTestFlag"; + // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449) ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:UseMembarPlusJunk", "-version"); + "-XX:" + flag + "PlusJunk", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Unrecognized VM option 'UseMembarPlusJunk'"); // Must identify bad option. + output.shouldContain("Unrecognized VM option '" + flag + "PlusJunk'"); // Must identify bad option. output.shouldHaveExitValue(1); // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989) ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder( - "-XX:+UseMembar", "-version"); + "-XX:+" + flag, "-version"); OutputAnalyzer output2 = new OutputAnalyzer(pb2.start()); output2.shouldContain("Ignoring option").shouldContain("support was removed"); - output2.shouldContain("UseMembar"); + output2.shouldContain(flag); } } diff --git a/test/hotspot/jtreg/runtime/CommandLine/PermGenFlagsTest.java b/test/hotspot/jtreg/runtime/CommandLine/PermGenFlagsTest.java deleted file mode 100644 index 3ce993f57d461..0000000000000 --- a/test/hotspot/jtreg/runtime/CommandLine/PermGenFlagsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8167446 - * @summary Commandline options PermSize and MaxPermSize should be recognized but ignored. - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @run driver PermGenFlagsTest - */ - -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.process.ProcessTools; - -public class PermGenFlagsTest { - public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:PermSize=22k", - "-version"); - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Ignoring option PermSize; support was removed in 8.0"); - output.shouldHaveExitValue(0); - - pb = ProcessTools.createJavaProcessBuilder("-XX:MaxPermSize=22k", - "-version"); - output = new OutputAnalyzer(pb.start()); - output.shouldContain("Ignoring option MaxPermSize; support was removed in 8.0"); - output.shouldHaveExitValue(0); - } -} diff --git a/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java b/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java index 470e0d690aa3e..0ffaa48d0b868 100644 --- a/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java +++ b/test/hotspot/jtreg/runtime/cds/SpaceUtilizationCheck.java @@ -49,15 +49,7 @@ public class SpaceUtilizationCheck { // [2] There must be no gap between two consecutive regions. public static void main(String[] args) throws Exception { - // (1) Default VM arguments test("-Xlog:cds=debug"); - - // (2) Use the now deprecated VM arguments. They should have no effect. - test("-Xlog:cds=debug", - "-XX:SharedReadWriteSize=128M", - "-XX:SharedReadOnlySize=128M", - "-XX:SharedMiscDataSize=128M", - "-XX:SharedMiscCodeSize=128M"); } static void test(String... extra_options) throws Exception { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java index 36604a4d7aa76..04f72039fe623 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java @@ -117,11 +117,9 @@ public static void main(String[] args) throws Throwable { "-XX:+UnlockDiagnosticVMOptions", extraOption, "-XX:+WhiteBoxAPI", - "-XX:SharedReadOnlySize=30m", gcLog, GCSharedStringsDuringDumpWb.class.getName()) .assertNormalExit(); } } } - From b5a3a5b6216aa75d76c1da7f9d94a3bb6238ef36 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Wed, 16 Dec 2020 02:37:29 +0000 Subject: [PATCH 251/504] 8258236: Segfault in ClassListParser::resolve_indy dumping static AppCDS archive Reviewed-by: redestad, coleenp --- .../share/classfile/classListParser.cpp | 4 + test/hotspot/jtreg/TEST.groups | 1 + .../LambdaVerificationFailedDuringDump.java | 50 +++++++ .../appcds/test-classes/BadInvokeDynamic.jcod | 136 ++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/LambdaVerificationFailedDuringDump.java create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/test-classes/BadInvokeDynamic.jcod diff --git a/src/hotspot/share/classfile/classListParser.cpp b/src/hotspot/share/classfile/classListParser.cpp index b123a1fd959cb..5a7766f0ce6b4 100644 --- a/src/hotspot/share/classfile/classListParser.cpp +++ b/src/hotspot/share/classfile/classListParser.cpp @@ -467,6 +467,10 @@ void ClassListParser::resolve_indy(Symbol* class_name_symbol, TRAPS) { Klass* klass = SystemDictionary::resolve_or_fail(class_name_symbol, class_loader, protection_domain, true, THREAD); // FIXME should really be just a lookup if (klass != NULL && klass->is_instance_klass()) { InstanceKlass* ik = InstanceKlass::cast(klass); + if (SystemDictionaryShared::has_class_failed_verification(ik)) { + // don't attempt to resolve indy on classes that has previously failed verification + return; + } MetaspaceShared::try_link_class(ik, THREAD); assert(!HAS_PENDING_EXCEPTION, "unexpected exception"); diff --git a/test/hotspot/jtreg/TEST.groups b/test/hotspot/jtreg/TEST.groups index 2d3959701ff05..a2b4b409c7c6a 100644 --- a/test/hotspot/jtreg/TEST.groups +++ b/test/hotspot/jtreg/TEST.groups @@ -336,6 +336,7 @@ hotspot_appcds_dynamic = \ -runtime/cds/appcds/ExtraSymbols.java \ -runtime/cds/appcds/LambdaEagerInit.java \ -runtime/cds/appcds/LambdaProxyClasslist.java \ + -runtime/cds/appcds/LambdaVerificationFailedDuringDump.java \ -runtime/cds/appcds/LongClassListPath.java \ -runtime/cds/appcds/LotsOfClasses.java \ -runtime/cds/appcds/NonExistClasspath.java \ diff --git a/test/hotspot/jtreg/runtime/cds/appcds/LambdaVerificationFailedDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/LambdaVerificationFailedDuringDump.java new file mode 100644 index 0000000000000..8afbd33bbb38d --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/LambdaVerificationFailedDuringDump.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2020, 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 Dumping of lambda proxy classes should not crash VM in case the caller class has failed verification. + * @requires vm.cds + * @library /test/lib + * @compile test-classes/BadInvokeDynamic.jcod + * @run driver LambdaVerificationFailedDuringDump + */ + +import jdk.test.lib.process.OutputAnalyzer; + +public class LambdaVerificationFailedDuringDump { + + public static void main(String[] args) throws Exception { + JarBuilder.build("badinvokedynamic", "BadInvokeDynamic"); + + String appJar = TestCommon.getTestJar("badinvokedynamic.jar"); + + OutputAnalyzer out = TestCommon.dump(appJar, + TestCommon.list("BadInvokeDynamic", + "@lambda-proxy BadInvokeDynamic run ()Ljava/lang/Runnable; ()V REF_invokeStatic BadInvokeDynamic lambda$doTest$0 ()V ()V")); + out.shouldContain("Preload Warning: Verification failed for BadInvokeDynamic") + .shouldContain("Skipping BadInvokeDynamic: Failed verification") + .shouldHaveExitValue(0); + } +} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/test-classes/BadInvokeDynamic.jcod b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/BadInvokeDynamic.jcod new file mode 100644 index 0000000000000..19e6c02ba2701 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/test-classes/BadInvokeDynamic.jcod @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2020, 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. + * + */ + +// Should get a verifier error at bytecode 15 for JVM_CONSTANT_NameAndType + +class BadInvokeDynamic { + 0xCAFEBABE; + 0; // minor version + 51; // version + [] { // Constant Pool + ; // first element is empty + Method #6 #15; // #1 + Field #16 #17; // #2 + String #18; // #3 + Method #19 #20; // #4 + class #21; // #5 + class #22; // #6 + Utf8 "hello"; // #7 + Utf8 "()V"; // #8 + Utf8 "Code"; // #9 + Utf8 "LineNumberTable"; // #10 + Utf8 "main"; // #11 + Utf8 "([Ljava/lang/String;)V"; // #12 + Utf8 "SourceFile"; // #13 + Utf8 "BadInvokeDynamic.java"; // #14 + NameAndType #7 #8; // #15 + class #23; // #16 + NameAndType #24 #25; // #17 + Utf8 "Hello World"; // #18 + class #26; // #19 + NameAndType #27 #28; // #20 + Utf8 "BadInvokeDynamic"; // #21 + Utf8 "java/lang/Object"; // #22 + Utf8 "java/lang/System"; // #23 + Utf8 "out"; // #24 + Utf8 "Ljava/io/PrintStream;"; // #25 + Utf8 "java/io/PrintStream"; // #26 + Utf8 "println"; // #27 + Utf8 "(Ljava/lang/String;)V"; // #28 + } // Constant Pool + + 0x0021; // access + #5;// this_cpx + #6;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #7; // name_cpx + #8; // sig_cpx + [] { // Attributes + Attr(#9) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#10) { // LineNumberTable + [] { // LineNumberTable + 0 1; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#9) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0xB200021203B60004; + 0x033CBA000F840102; + 0x840103840104B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#10) { // LineNumberTable + [] { // LineNumberTable + 0 3; + 8 4; + 10 5; + 13 6; + 16 7; + 19 8; + 22 9; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#13) { // SourceFile + #14; + } // end SourceFile + } // Attributes +} // end class BadInvokeDynamic From 47ba652d5a0783587b02cf3dbe5262c16eb43ab8 Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Wed, 16 Dec 2020 04:13:28 +0000 Subject: [PATCH 252/504] 8258455: problem list tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java Reviewed-by: dholmes, darcy --- test/langtools/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt index 38aa386de323e..c9f71106f0a63 100644 --- a/test/langtools/ProblemList.txt +++ b/test/langtools/ProblemList.txt @@ -75,3 +75,4 @@ tools/sjavac/ClasspathDependencies.java # # jdeps +tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java 8258421 generic-all Deprecation vs JDK-private annotation class From 17ace8339dd8235f3811e3975d9ccc77910b0c77 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 16 Dec 2020 04:36:43 +0000 Subject: [PATCH 253/504] 8258074: Move some flags related to compiler to compiler_globals.hpp Reviewed-by: kvn, coleenp --- src/hotspot/share/ci/bcEscapeAnalyzer.cpp | 1 + src/hotspot/share/ci/ciMethodData.cpp | 3 +- src/hotspot/share/ci/ciObjectFactory.cpp | 1 + .../share/compiler/compiler_globals.hpp | 410 ++++++++++++++++++ .../share/interpreter/invocationCounter.cpp | 1 + src/hotspot/share/oops/methodCounters.cpp | 44 +- src/hotspot/share/oops/methodCounters.hpp | 41 +- src/hotspot/share/prims/jni.cpp | 1 + src/hotspot/share/runtime/flags/allFlags.hpp | 16 +- src/hotspot/share/runtime/flags/jvmFlag.cpp | 16 +- src/hotspot/share/runtime/globals.hpp | 386 ----------------- test/hotspot/gtest/runtime/test_globals.cpp | 1 + 12 files changed, 481 insertions(+), 440 deletions(-) diff --git a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp index 82eca0d9667d1..02b8d87078f22 100644 --- a/src/hotspot/share/ci/bcEscapeAnalyzer.cpp +++ b/src/hotspot/share/ci/bcEscapeAnalyzer.cpp @@ -29,6 +29,7 @@ #include "ci/ciField.hpp" #include "ci/ciMethodBlocks.hpp" #include "ci/ciStreams.hpp" +#include "compiler/compiler_globals.hpp" #include "interpreter/bytecode.hpp" #include "oops/oop.inline.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index fef6e6f166d6f..03e10b73485d0 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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 @@ -27,6 +27,7 @@ #include "ci/ciMethodData.hpp" #include "ci/ciReplay.hpp" #include "ci/ciUtilities.inline.hpp" +#include "compiler/compiler_globals.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "runtime/deoptimization.hpp" diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp index 0f50c58ff6deb..6ce6a3b8639ca 100644 --- a/src/hotspot/share/ci/ciObjectFactory.cpp +++ b/src/hotspot/share/ci/ciObjectFactory.cpp @@ -44,6 +44,7 @@ #include "ci/ciUtilities.inline.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/systemDictionary.hpp" +#include "compiler/compiler_globals.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "memory/allocation.inline.hpp" #include "memory/universe.hpp" diff --git a/src/hotspot/share/compiler/compiler_globals.hpp b/src/hotspot/share/compiler/compiler_globals.hpp index 8867a328ce115..9cb81a44bd4e6 100644 --- a/src/hotspot/share/compiler/compiler_globals.hpp +++ b/src/hotspot/share/compiler/compiler_globals.hpp @@ -36,4 +36,414 @@ #include "jvmci/jvmci_globals.hpp" #endif +// TODO -- currently, even if all JIT compilers are disabled, the following flags +// are still available in HotSpot. This should eventually be fixed ... + +#define COMPILER_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + notproduct, \ + range, \ + constraint) \ + \ + /* compiler interface */ \ + \ + develop(bool, CIPrintCompilerName, false, \ + "when CIPrint is active, print the name of the active compiler") \ + \ + product(bool, CIPrintCompileQueue, false, DIAGNOSTIC, \ + "display the contents of the compile queue whenever a " \ + "compilation is enqueued") \ + \ + develop(bool, CIPrintRequests, false, \ + "display every request for compilation") \ + \ + product(bool, CITime, false, \ + "collect timing information for compilation") \ + \ + develop(bool, CITimeVerbose, false, \ + "be more verbose in compilation timings") \ + \ + develop(bool, CITimeEach, false, \ + "display timing information after each successful compilation") \ + \ + develop(bool, CICountOSR, false, \ + "use a separate counter when assigning ids to osr compilations") \ + \ + develop(bool, CICompileNatives, true, \ + "compile native methods if supported by the compiler") \ + \ + develop_pd(bool, CICompileOSR, \ + "compile on stack replacement methods if supported by the " \ + "compiler") \ + \ + develop(bool, CIPrintMethodCodes, false, \ + "print method bytecodes of the compiled code") \ + \ + develop(bool, CIPrintTypeFlow, false, \ + "print the results of ciTypeFlow analysis") \ + \ + develop(bool, CITraceTypeFlow, false, \ + "detailed per-bytecode tracing of ciTypeFlow analysis") \ + \ + product(bool, CICompilerCountPerCPU, false, \ + "1 compiler thread for log(N CPUs)") \ + \ + notproduct(intx, CICrashAt, -1, \ + "id of compilation to trigger assert in compiler thread for " \ + "the purpose of testing, e.g. generation of replay data") \ + \ + notproduct(bool, CIObjectFactoryVerify, false, \ + "enable potentially expensive verification in ciObjectFactory") \ + \ + develop(intx, CIStart, 0, \ + "The id of the first compilation to permit") \ + \ + develop(intx, CIStop, max_jint, \ + "The id of the last compilation to permit") \ + \ + develop(intx, CIStartOSR, 0, \ + "The id of the first osr compilation to permit " \ + "(CICountOSR must be on)") \ + \ + develop(intx, CIStopOSR, max_jint, \ + "The id of the last osr compilation to permit " \ + "(CICountOSR must be on)") \ + \ + develop(intx, CIBreakAtOSR, -1, \ + "The id of osr compilation to break at") \ + \ + develop(intx, CIBreakAt, -1, \ + "The id of compilation to break at") \ + \ + /* recompilation */ \ + \ + product(double, CompileThresholdScaling, 1.0, \ + "Factor to control when first compilation happens " \ + "(both with and without tiered compilation): " \ + "values greater than 1.0 delay counter overflow, " \ + "values between 0 and 1.0 rush counter overflow, " \ + "value of 1.0 leaves compilation thresholds unchanged " \ + "value of 0.0 is equivalent to -Xint. " \ + "" \ + "Flag can be set as per-method option. " \ + "If a value is specified for a method, compilation thresholds " \ + "for that method are scaled by both the value of the global flag "\ + "and the value of the per-method flag.") \ + range(0.0, DBL_MAX) \ + \ + product(intx, Tier0InvokeNotifyFreqLog, 7, \ + "Interpreter (tier 0) invocation notification frequency") \ + range(0, 30) \ + \ + product(intx, Tier2InvokeNotifyFreqLog, 11, \ + "C1 without MDO (tier 2) invocation notification frequency") \ + range(0, 30) \ + \ + product(intx, Tier3InvokeNotifyFreqLog, 10, \ + "C1 with MDO profiling (tier 3) invocation notification " \ + "frequency") \ + range(0, 30) \ + \ + product(intx, Tier23InlineeNotifyFreqLog, 20, \ + "Inlinee invocation (tiers 2 and 3) notification frequency") \ + range(0, 30) \ + \ + product(intx, Tier0BackedgeNotifyFreqLog, 10, \ + "Interpreter (tier 0) invocation notification frequency") \ + range(0, 30) \ + \ + product(intx, Tier2BackedgeNotifyFreqLog, 14, \ + "C1 without MDO (tier 2) invocation notification frequency") \ + range(0, 30) \ + \ + product(intx, Tier3BackedgeNotifyFreqLog, 13, \ + "C1 with MDO profiling (tier 3) invocation notification " \ + "frequency") \ + range(0, 30) \ + \ + product(intx, Tier2CompileThreshold, 0, \ + "threshold at which tier 2 compilation is invoked") \ + range(0, max_jint) \ + \ + product(intx, Tier2BackEdgeThreshold, 0, \ + "Back edge threshold at which tier 2 compilation is invoked") \ + range(0, max_jint) \ + \ + product(intx, Tier3InvocationThreshold, 200, \ + "Compile if number of method invocations crosses this " \ + "threshold") \ + range(0, max_jint) \ + \ + product(intx, Tier3MinInvocationThreshold, 100, \ + "Minimum invocation to compile at tier 3") \ + range(0, max_jint) \ + \ + product(intx, Tier3CompileThreshold, 2000, \ + "Threshold at which tier 3 compilation is invoked (invocation " \ + "minimum must be satisfied)") \ + range(0, max_jint) \ + \ + product(intx, Tier3BackEdgeThreshold, 60000, \ + "Back edge threshold at which tier 3 OSR compilation is invoked") \ + range(0, max_jint) \ + \ + product(intx, Tier3AOTInvocationThreshold, 10000, \ + "Compile if number of method invocations crosses this " \ + "threshold if coming from AOT") \ + range(0, max_jint) \ + \ + product(intx, Tier3AOTMinInvocationThreshold, 1000, \ + "Minimum invocation to compile at tier 3 if coming from AOT") \ + range(0, max_jint) \ + \ + product(intx, Tier3AOTCompileThreshold, 15000, \ + "Threshold at which tier 3 compilation is invoked (invocation " \ + "minimum must be satisfied) if coming from AOT") \ + range(0, max_jint) \ + \ + product(intx, Tier3AOTBackEdgeThreshold, 120000, \ + "Back edge threshold at which tier 3 OSR compilation is invoked " \ + "if coming from AOT") \ + range(0, max_jint) \ + \ + product(intx, Tier0AOTInvocationThreshold, 200, DIAGNOSTIC, \ + "Switch to interpreter to profile if the number of method " \ + "invocations crosses this threshold if coming from AOT " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier0AOTMinInvocationThreshold, 100, DIAGNOSTIC, \ + "Minimum number of invocations to switch to interpreter " \ + "to profile if coming from AOT " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier0AOTCompileThreshold, 2000, DIAGNOSTIC, \ + "Threshold at which to switch to interpreter to profile " \ + "if coming from AOT " \ + "(invocation minimum must be satisfied, " \ + "applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier0AOTBackEdgeThreshold, 60000, DIAGNOSTIC, \ + "Back edge threshold at which to switch to interpreter " \ + "to profile if coming from AOT " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier4InvocationThreshold, 5000, \ + "Compile if number of method invocations crosses this " \ + "threshold") \ + range(0, max_jint) \ + \ + product(intx, Tier4MinInvocationThreshold, 600, \ + "Minimum invocation to compile at tier 4") \ + range(0, max_jint) \ + \ + product(intx, Tier4CompileThreshold, 15000, \ + "Threshold at which tier 4 compilation is invoked (invocation " \ + "minimum must be satisfied)") \ + range(0, max_jint) \ + \ + product(intx, Tier4BackEdgeThreshold, 40000, \ + "Back edge threshold at which tier 4 OSR compilation is invoked") \ + range(0, max_jint) \ + \ + product(intx, Tier40InvocationThreshold, 5000, DIAGNOSTIC, \ + "Compile if number of method invocations crosses this " \ + "threshold (applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier40MinInvocationThreshold, 600, DIAGNOSTIC, \ + "Minimum number of invocations to compile at tier 4 " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier40CompileThreshold, 10000, DIAGNOSTIC, \ + "Threshold at which tier 4 compilation is invoked (invocation " \ + "minimum must be satisfied, applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier40BackEdgeThreshold, 15000, DIAGNOSTIC, \ + "Back edge threshold at which tier 4 OSR compilation is invoked " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier0Delay, 5, DIAGNOSTIC, \ + "If C2 queue size grows over this amount per compiler thread " \ + "do not start profiling in the interpreter " \ + "(applicable only with " \ + "CompilationMode=high-only|high-only-quick-internal)") \ + range(0, max_jint) \ + \ + product(intx, Tier3DelayOn, 5, \ + "If C2 queue size grows over this amount per compiler thread " \ + "stop compiling at tier 3 and start compiling at tier 2") \ + range(0, max_jint) \ + \ + product(intx, Tier3DelayOff, 2, \ + "If C2 queue size is less than this amount per compiler thread " \ + "allow methods compiled at tier 2 transition to tier 3") \ + range(0, max_jint) \ + \ + product(intx, Tier3LoadFeedback, 5, \ + "Tier 3 thresholds will increase twofold when C1 queue size " \ + "reaches this amount per compiler thread") \ + range(0, max_jint) \ + \ + product(intx, Tier4LoadFeedback, 3, \ + "Tier 4 thresholds will increase twofold when C2 queue size " \ + "reaches this amount per compiler thread") \ + range(0, max_jint) \ + \ + product(intx, TieredCompileTaskTimeout, 50, \ + "Kill compile task if method was not used within " \ + "given timeout in milliseconds") \ + range(0, max_intx) \ + \ + product(intx, TieredStopAtLevel, 4, \ + "Stop at given compilation level") \ + range(0, 4) \ + \ + product(intx, Tier0ProfilingStartPercentage, 200, \ + "Start profiling in interpreter if the counters exceed tier 3 " \ + "thresholds (tier 4 thresholds with " \ + "CompilationMode=high-only|high-only-quick-internal)" \ + "by the specified percentage") \ + range(0, max_jint) \ + \ + product(uintx, IncreaseFirstTierCompileThresholdAt, 50, \ + "Increase the compile threshold for C1 compilation if the code " \ + "cache is filled by the specified percentage") \ + range(0, 99) \ + \ + product(intx, TieredRateUpdateMinTime, 1, \ + "Minimum rate sampling interval (in milliseconds)") \ + range(0, max_intx) \ + \ + product(intx, TieredRateUpdateMaxTime, 25, \ + "Maximum rate sampling interval (in milliseconds)") \ + range(0, max_intx) \ + \ + product(ccstr, CompilationMode, "default", \ + "Compilation modes: " \ + "default: normal tiered compilation; " \ + "quick-only: C1-only mode; " \ + "high-only: C2/JVMCI-only mode; " \ + "high-only-quick-internal: C2/JVMCI-only mode, " \ + "with JVMCI compiler compiled with C1.") \ + \ + product(bool, PrintTieredEvents, false, \ + "Print tiered events notifications") \ + \ + product_pd(intx, OnStackReplacePercentage, \ + "NON_TIERED number of method invocations/branches (expressed as " \ + "% of CompileThreshold) before (re-)compiling OSR code") \ + constraint(OnStackReplacePercentageConstraintFunc, AfterErgo) \ + \ + product(intx, InterpreterProfilePercentage, 33, \ + "NON_TIERED number of method invocations/branches (expressed as " \ + "% of CompileThreshold) before profiling in the interpreter") \ + range(0, 100) \ + \ + /* compiler directives */ \ + \ + product(ccstrlist, CompileOnly, "", \ + "List of methods (pkg/class.name) to restrict compilation to") \ + \ + product(ccstr, CompileCommandFile, NULL, \ + "Read compiler commands from this file [.hotspot_compiler]") \ + \ + product(ccstr, CompilerDirectivesFile, NULL, DIAGNOSTIC, \ + "Read compiler directives from this file") \ + \ + product(ccstrlist, CompileCommand, "", \ + "Prepend to .hotspot_compiler; e.g. log,java/lang/String.") \ + \ + develop(bool, ReplayCompiles, false, \ + "Enable replay of compilations from ReplayDataFile") \ + \ + product(ccstr, ReplayDataFile, NULL, \ + "File containing compilation replay information" \ + "[default: ./replay_pid%p.log] (%p replaced with pid)") \ + \ + product(ccstr, InlineDataFile, NULL, \ + "File containing inlining replay information" \ + "[default: ./inline_pid%p.log] (%p replaced with pid)") \ + \ + develop(intx, ReplaySuppressInitializers, 2, \ + "Control handling of class initialization during replay: " \ + "0 - don't do anything special; " \ + "1 - treat all class initializers as empty; " \ + "2 - treat class initializers for application classes as empty; " \ + "3 - allow all class initializers to run during bootstrap but " \ + " pretend they are empty after starting replay") \ + range(0, 3) \ + \ + develop(bool, ReplayIgnoreInitErrors, false, \ + "Ignore exceptions thrown during initialization for replay") \ + \ + product(bool, DumpReplayDataOnError, true, \ + "Record replay data for crashing compiler threads") \ + \ + product(bool, CompilerDirectivesIgnoreCompileCommands, false, DIAGNOSTIC, \ + "Disable backwards compatibility for compile commands.") \ + \ + product(bool, CompilerDirectivesPrint, false, DIAGNOSTIC, \ + "Print compiler directives on installation.") \ + \ + product(int, CompilerDirectivesLimit, 50, DIAGNOSTIC, \ + "Limit on number of compiler directives.") \ + \ + /* Bytecode escape analysis estimation. */ \ + \ + product(bool, EstimateArgEscape, true, \ + "Analyze bytecodes to estimate escape state of arguments") \ + \ + product(intx, BCEATraceLevel, 0, \ + "How much tracing to do of bytecode escape analysis estimates " \ + "(0-3)") \ + range(0, 3) \ + \ + product(intx, MaxBCEAEstimateLevel, 5, \ + "Maximum number of nested calls that are analyzed by BC EA") \ + range(0, max_jint) \ + \ + product(intx, MaxBCEAEstimateSize, 150, \ + "Maximum bytecode size of a method to be analyzed by BC EA") \ + range(0, max_jint) \ + \ + /* misc compiler flags */ \ + \ + product(bool, AbortVMOnCompilationFailure, false, DIAGNOSTIC, \ + "Abort VM when method had failed to compile.") \ + \ + develop(intx, OSROnlyBCI, -1, \ + "OSR only at this bci. Negative values mean exclude that bci") \ + \ + develop(intx, DesiredMethodLimit, 8000, \ + "The desired maximum method size (in bytecodes) after inlining") \ + \ + product(bool, DontCompileHugeMethods, true, \ + "Do not compile methods > HugeMethodLimit") \ + \ + develop(intx, HugeMethodLimit, 8000, \ + "Don't compile methods larger than this if " \ + "+DontCompileHugeMethods") \ + \ + +// end of COMPILER_FLAGS + +DECLARE_FLAGS(COMPILER_FLAGS) + #endif // SHARE_COMPILER_COMPILER_GLOBALS_HPP diff --git a/src/hotspot/share/interpreter/invocationCounter.cpp b/src/hotspot/share/interpreter/invocationCounter.cpp index 7a45b0a654dff..764c82fc59a10 100644 --- a/src/hotspot/share/interpreter/invocationCounter.cpp +++ b/src/hotspot/share/interpreter/invocationCounter.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "compiler/compiler_globals.hpp" #include "interpreter/invocationCounter.hpp" void InvocationCounter::init() { diff --git a/src/hotspot/share/oops/methodCounters.cpp b/src/hotspot/share/oops/methodCounters.cpp index 104743e91a175..334a1eb5289a1 100644 --- a/src/hotspot/share/oops/methodCounters.cpp +++ b/src/hotspot/share/oops/methodCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2020, 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,10 +22,52 @@ * */ #include "precompiled.hpp" +#include "compiler/compiler_globals.hpp" #include "memory/metaspaceClosure.hpp" #include "oops/methodCounters.hpp" #include "runtime/handles.inline.hpp" +MethodCounters::MethodCounters(const methodHandle& mh) : +#if INCLUDE_AOT + _method(mh()), +#endif + _nmethod_age(INT_MAX) +#ifdef TIERED + , _rate(0), + _prev_time(0), + _highest_comp_level(0), + _highest_osr_comp_level(0) +#endif +{ + set_interpreter_invocation_count(0); + set_interpreter_throwout_count(0); + JVMTI_ONLY(clear_number_of_breakpoints()); + invocation_counter()->init(); + backedge_counter()->init(); + + if (StressCodeAging) { + set_nmethod_age(HotMethodDetectionLimit); + } + + // Set per-method thresholds. + double scale = 1.0; + CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale); + + int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale); + _interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift; + if (ProfileInterpreter) { + // If interpreter profiling is enabled, the backward branch limit + // is compared against the method data counter rather than an invocation + // counter, therefore no shifting of bits is required. + _interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100); + } else { + _interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift); + } + _interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift; + _invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; + _backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; +} + MethodCounters* MethodCounters::allocate(const methodHandle& mh, TRAPS) { ClassLoaderData* loader_data = mh->method_holder()->class_loader_data(); return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType, THREAD) MethodCounters(mh); diff --git a/src/hotspot/share/oops/methodCounters.hpp b/src/hotspot/share/oops/methodCounters.hpp index 38e2512ef5f52..a231273345991 100644 --- a/src/hotspot/share/oops/methodCounters.hpp +++ b/src/hotspot/share/oops/methodCounters.hpp @@ -70,46 +70,7 @@ class MethodCounters : public Metadata { u1 _highest_osr_comp_level; // Same for OSR level #endif - MethodCounters(const methodHandle& mh) : -#if INCLUDE_AOT - _method(mh()), -#endif - _nmethod_age(INT_MAX) -#ifdef TIERED - , _rate(0), - _prev_time(0), - _highest_comp_level(0), - _highest_osr_comp_level(0) -#endif - { - set_interpreter_invocation_count(0); - set_interpreter_throwout_count(0); - JVMTI_ONLY(clear_number_of_breakpoints()); - invocation_counter()->init(); - backedge_counter()->init(); - - if (StressCodeAging) { - set_nmethod_age(HotMethodDetectionLimit); - } - - // Set per-method thresholds. - double scale = 1.0; - CompilerOracle::has_option_value(mh, CompileCommand::CompileThresholdScaling, scale); - - int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale); - _interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift; - if (ProfileInterpreter) { - // If interpreter profiling is enabled, the backward branch limit - // is compared against the method data counter rather than an invocation - // counter, therefore no shifting of bits is required. - _interpreter_backward_branch_limit = (int)((int64_t)compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage) / 100); - } else { - _interpreter_backward_branch_limit = (int)(((int64_t)compile_threshold * OnStackReplacePercentage / 100) << InvocationCounter::count_shift); - } - _interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift; - _invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; - _backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; - } + MethodCounters(const methodHandle& mh); public: virtual bool is_methodCounters() const { return true; } diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index b2b02a3668f5f..a87b9446dc153 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -38,6 +38,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "compiler/compiler_globals.hpp" #include "gc/shared/gcLocker.inline.hpp" #include "interpreter/linkResolver.hpp" #include "jfr/jfrEvents.hpp" diff --git a/src/hotspot/share/runtime/flags/allFlags.hpp b/src/hotspot/share/runtime/flags/allFlags.hpp index 68e529e139c7b..cd62753cca664 100644 --- a/src/hotspot/share/runtime/flags/allFlags.hpp +++ b/src/hotspot/share/runtime/flags/allFlags.hpp @@ -28,9 +28,8 @@ #include "compiler/compiler_globals.hpp" #include "runtime/globals.hpp" -// Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at -// the top, as they are processed by jvmFlags.cpp in that -// order. +// Put LP64/ARCH/JVMCI/COMPILER1/COMPILER2 at the top, +// as they are processed by jvmFlag.cpp in that order. #define ALL_FLAGS( \ develop, \ @@ -50,6 +49,13 @@ range, \ constraint) \ \ + ARCH_FLAGS( \ + develop, \ + product, \ + notproduct, \ + range, \ + constraint) \ + \ JVMCI_ONLY(JVMCI_FLAGS( \ develop, \ develop_pd, \ @@ -77,9 +83,11 @@ range, \ constraint)) \ \ - ARCH_FLAGS( \ + COMPILER_FLAGS( \ develop, \ + develop_pd, \ product, \ + product_pd, \ notproduct, \ range, \ constraint) \ diff --git a/src/hotspot/share/runtime/flags/jvmFlag.cpp b/src/hotspot/share/runtime/flags/jvmFlag.cpp index 464f4a75f9652..c1a440f237d47 100644 --- a/src/hotspot/share/runtime/flags/jvmFlag.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlag.cpp @@ -466,7 +466,7 @@ const char* JVMFlag::flag_error_str(JVMFlag::Error error) { //---------------------------------------------------------------------- // Build flagTable[] -// Find out the number of LP64/JVMCI/COMPILER1/COMPILER1/ARCH flags, +// Find out the number of LP64/ARCH/JVMCI/COMPILER1/COMPILER2 flags, // for JVMFlag::flag_group() #define ENUM_F(type, name, ...) enum_##name, @@ -474,24 +474,24 @@ const char* JVMFlag::flag_error_str(JVMFlag::Error error) { // dev dev-pd pro pro-pd notpro range constraint enum FlagCounter_LP64 { LP64_RUNTIME_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_LP64 }; +enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH }; enum FlagCounter_JVMCI { JVMCI_ONLY(JVMCI_FLAGS( ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_JVMCI }; enum FlagCounter_C1 { COMPILER1_PRESENT(C1_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C1 }; enum FlagCounter_C2 { COMPILER2_PRESENT(C2_FLAGS(ENUM_F, ENUM_F, ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F)) num_flags_C2 }; -enum FlagCounter_ARCH { ARCH_FLAGS( ENUM_F, ENUM_F, ENUM_F, IGNORE_F, IGNORE_F) num_flags_ARCH }; const int first_flag_enum_LP64 = 0; -const int first_flag_enum_JVMCI = first_flag_enum_LP64 + num_flags_LP64; +const int first_flag_enum_ARCH = first_flag_enum_LP64 + num_flags_LP64; +const int first_flag_enum_JVMCI = first_flag_enum_ARCH + num_flags_ARCH; const int first_flag_enum_C1 = first_flag_enum_JVMCI + num_flags_JVMCI; const int first_flag_enum_C2 = first_flag_enum_C1 + num_flags_C1; -const int first_flag_enum_ARCH = first_flag_enum_C2 + num_flags_C2; -const int first_flag_enum_other = first_flag_enum_ARCH + num_flags_ARCH; +const int first_flag_enum_other = first_flag_enum_C2 + num_flags_C2; static constexpr int flag_group(int flag_enum) { - if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_LP64_PRODUCT; + if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_LP64_PRODUCT; + if (flag_enum < first_flag_enum_JVMCI) return JVMFlag::KIND_ARCH; if (flag_enum < first_flag_enum_C1) return JVMFlag::KIND_JVMCI; if (flag_enum < first_flag_enum_C2) return JVMFlag::KIND_C1; - if (flag_enum < first_flag_enum_ARCH) return JVMFlag::KIND_C2; - if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_ARCH; + if (flag_enum < first_flag_enum_other) return JVMFlag::KIND_C2; return 0; } diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 9c15f291a06de..233a861c6fd74 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -963,49 +963,6 @@ const intx ObjectAlignmentInBytes = 8; product(bool, VerifyBeforeIteration, false, DIAGNOSTIC, \ "Verify memory system before JVMTI iteration") \ \ - /* compiler interface */ \ - \ - develop(bool, CIPrintCompilerName, false, \ - "when CIPrint is active, print the name of the active compiler") \ - \ - product(bool, CIPrintCompileQueue, false, DIAGNOSTIC, \ - "display the contents of the compile queue whenever a " \ - "compilation is enqueued") \ - \ - develop(bool, CIPrintRequests, false, \ - "display every request for compilation") \ - \ - product(bool, CITime, false, \ - "collect timing information for compilation") \ - \ - develop(bool, CITimeVerbose, false, \ - "be more verbose in compilation timings") \ - \ - develop(bool, CITimeEach, false, \ - "display timing information after each successful compilation") \ - \ - develop(bool, CICountOSR, false, \ - "use a separate counter when assigning ids to osr compilations") \ - \ - develop(bool, CICompileNatives, true, \ - "compile native methods if supported by the compiler") \ - \ - develop_pd(bool, CICompileOSR, \ - "compile on stack replacement methods if supported by the " \ - "compiler") \ - \ - develop(bool, CIPrintMethodCodes, false, \ - "print method bytecodes of the compiled code") \ - \ - develop(bool, CIPrintTypeFlow, false, \ - "print the results of ciTypeFlow analysis") \ - \ - develop(bool, CITraceTypeFlow, false, \ - "detailed per-bytecode tracing of ciTypeFlow analysis") \ - \ - develop(intx, OSROnlyBCI, -1, \ - "OSR only at this bci. Negative values mean exclude that bci") \ - \ /* compiler */ \ \ /* notice: the max range value here is max_jint, not max_intx */ \ @@ -1380,26 +1337,6 @@ const intx ObjectAlignmentInBytes = 8; "When using recompilation, never interpret methods " \ "containing loops") \ \ - product(bool, DontCompileHugeMethods, true, \ - "Do not compile methods > HugeMethodLimit") \ - \ - /* Bytecode escape analysis estimation. */ \ - product(bool, EstimateArgEscape, true, \ - "Analyze bytecodes to estimate escape state of arguments") \ - \ - product(intx, BCEATraceLevel, 0, \ - "How much tracing to do of bytecode escape analysis estimates " \ - "(0-3)") \ - range(0, 3) \ - \ - product(intx, MaxBCEAEstimateLevel, 5, \ - "Maximum number of nested calls that are analyzed by BC EA") \ - range(0, max_jint) \ - \ - product(intx, MaxBCEAEstimateSize, 150, \ - "Maximum bytecode size of a method to be analyzed by BC EA") \ - range(0, max_jint) \ - \ product(intx, AllocatePrefetchStyle, 1, \ "0 = no prefetch, " \ "1 = generate prefetch instructions for each allocation, " \ @@ -1775,77 +1712,6 @@ const intx ObjectAlignmentInBytes = 8; develop(intx, TraceBytecodesAt, 0, \ "Trace bytecodes starting with specified bytecode number") \ \ - /* compiler interface */ \ - develop(intx, CIStart, 0, \ - "The id of the first compilation to permit") \ - \ - develop(intx, CIStop, max_jint, \ - "The id of the last compilation to permit") \ - \ - develop(intx, CIStartOSR, 0, \ - "The id of the first osr compilation to permit " \ - "(CICountOSR must be on)") \ - \ - develop(intx, CIStopOSR, max_jint, \ - "The id of the last osr compilation to permit " \ - "(CICountOSR must be on)") \ - \ - develop(intx, CIBreakAtOSR, -1, \ - "The id of osr compilation to break at") \ - \ - develop(intx, CIBreakAt, -1, \ - "The id of compilation to break at") \ - \ - product(ccstrlist, CompileOnly, "", \ - "List of methods (pkg/class.name) to restrict compilation to") \ - \ - product(ccstr, CompileCommandFile, NULL, \ - "Read compiler commands from this file [.hotspot_compiler]") \ - \ - product(ccstr, CompilerDirectivesFile, NULL, DIAGNOSTIC, \ - "Read compiler directives from this file") \ - \ - product(ccstrlist, CompileCommand, "", \ - "Prepend to .hotspot_compiler; e.g. log,java/lang/String.") \ - \ - develop(bool, ReplayCompiles, false, \ - "Enable replay of compilations from ReplayDataFile") \ - \ - product(ccstr, ReplayDataFile, NULL, \ - "File containing compilation replay information" \ - "[default: ./replay_pid%p.log] (%p replaced with pid)") \ - \ - product(ccstr, InlineDataFile, NULL, \ - "File containing inlining replay information" \ - "[default: ./inline_pid%p.log] (%p replaced with pid)") \ - \ - develop(intx, ReplaySuppressInitializers, 2, \ - "Control handling of class initialization during replay: " \ - "0 - don't do anything special; " \ - "1 - treat all class initializers as empty; " \ - "2 - treat class initializers for application classes as empty; " \ - "3 - allow all class initializers to run during bootstrap but " \ - " pretend they are empty after starting replay") \ - range(0, 3) \ - \ - develop(bool, ReplayIgnoreInitErrors, false, \ - "Ignore exceptions thrown during initialization for replay") \ - \ - product(bool, DumpReplayDataOnError, true, \ - "Record replay data for crashing compiler threads") \ - \ - product(bool, CICompilerCountPerCPU, false, \ - "1 compiler thread for log(N CPUs)") \ - \ - notproduct(intx, CICrashAt, -1, \ - "id of compilation to trigger assert in compiler thread for " \ - "the purpose of testing, e.g. generation of replay data") \ - notproduct(bool, CIObjectFactoryVerify, false, \ - "enable potentially expensive verification in ciObjectFactory") \ - \ - product(bool, AbortVMOnCompilationFailure, false, DIAGNOSTIC, \ - "Abort VM when method had failed to compile.") \ - \ /* Priorities */ \ product_pd(bool, UseThreadPriorities, "Use native thread priorities") \ \ @@ -1943,253 +1809,9 @@ const intx ObjectAlignmentInBytes = 8; "number of interpreted method invocations before (re-)compiling") \ constraint(CompileThresholdConstraintFunc, AfterErgo) \ \ - product(double, CompileThresholdScaling, 1.0, \ - "Factor to control when first compilation happens " \ - "(both with and without tiered compilation): " \ - "values greater than 1.0 delay counter overflow, " \ - "values between 0 and 1.0 rush counter overflow, " \ - "value of 1.0 leaves compilation thresholds unchanged " \ - "value of 0.0 is equivalent to -Xint. " \ - "" \ - "Flag can be set as per-method option. " \ - "If a value is specified for a method, compilation thresholds " \ - "for that method are scaled by both the value of the global flag "\ - "and the value of the per-method flag.") \ - range(0.0, DBL_MAX) \ - \ - product(intx, Tier0InvokeNotifyFreqLog, 7, \ - "Interpreter (tier 0) invocation notification frequency") \ - range(0, 30) \ - \ - product(intx, Tier2InvokeNotifyFreqLog, 11, \ - "C1 without MDO (tier 2) invocation notification frequency") \ - range(0, 30) \ - \ - product(intx, Tier3InvokeNotifyFreqLog, 10, \ - "C1 with MDO profiling (tier 3) invocation notification " \ - "frequency") \ - range(0, 30) \ - \ - product(intx, Tier23InlineeNotifyFreqLog, 20, \ - "Inlinee invocation (tiers 2 and 3) notification frequency") \ - range(0, 30) \ - \ - product(intx, Tier0BackedgeNotifyFreqLog, 10, \ - "Interpreter (tier 0) invocation notification frequency") \ - range(0, 30) \ - \ - product(intx, Tier2BackedgeNotifyFreqLog, 14, \ - "C1 without MDO (tier 2) invocation notification frequency") \ - range(0, 30) \ - \ - product(intx, Tier3BackedgeNotifyFreqLog, 13, \ - "C1 with MDO profiling (tier 3) invocation notification " \ - "frequency") \ - range(0, 30) \ - \ - product(intx, Tier2CompileThreshold, 0, \ - "threshold at which tier 2 compilation is invoked") \ - range(0, max_jint) \ - \ - product(intx, Tier2BackEdgeThreshold, 0, \ - "Back edge threshold at which tier 2 compilation is invoked") \ - range(0, max_jint) \ - \ - product(intx, Tier3InvocationThreshold, 200, \ - "Compile if number of method invocations crosses this " \ - "threshold") \ - range(0, max_jint) \ - \ - product(intx, Tier3MinInvocationThreshold, 100, \ - "Minimum invocation to compile at tier 3") \ - range(0, max_jint) \ - \ - product(intx, Tier3CompileThreshold, 2000, \ - "Threshold at which tier 3 compilation is invoked (invocation " \ - "minimum must be satisfied)") \ - range(0, max_jint) \ - \ - product(intx, Tier3BackEdgeThreshold, 60000, \ - "Back edge threshold at which tier 3 OSR compilation is invoked") \ - range(0, max_jint) \ - \ - product(intx, Tier3AOTInvocationThreshold, 10000, \ - "Compile if number of method invocations crosses this " \ - "threshold if coming from AOT") \ - range(0, max_jint) \ - \ - product(intx, Tier3AOTMinInvocationThreshold, 1000, \ - "Minimum invocation to compile at tier 3 if coming from AOT") \ - range(0, max_jint) \ - \ - product(intx, Tier3AOTCompileThreshold, 15000, \ - "Threshold at which tier 3 compilation is invoked (invocation " \ - "minimum must be satisfied) if coming from AOT") \ - range(0, max_jint) \ - \ - product(intx, Tier3AOTBackEdgeThreshold, 120000, \ - "Back edge threshold at which tier 3 OSR compilation is invoked " \ - "if coming from AOT") \ - range(0, max_jint) \ - \ - product(intx, Tier0AOTInvocationThreshold, 200, DIAGNOSTIC, \ - "Switch to interpreter to profile if the number of method " \ - "invocations crosses this threshold if coming from AOT " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier0AOTMinInvocationThreshold, 100, DIAGNOSTIC, \ - "Minimum number of invocations to switch to interpreter " \ - "to profile if coming from AOT " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier0AOTCompileThreshold, 2000, DIAGNOSTIC, \ - "Threshold at which to switch to interpreter to profile " \ - "if coming from AOT " \ - "(invocation minimum must be satisfied, " \ - "applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier0AOTBackEdgeThreshold, 60000, DIAGNOSTIC, \ - "Back edge threshold at which to switch to interpreter " \ - "to profile if coming from AOT " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier4InvocationThreshold, 5000, \ - "Compile if number of method invocations crosses this " \ - "threshold") \ - range(0, max_jint) \ - \ - product(intx, Tier4MinInvocationThreshold, 600, \ - "Minimum invocation to compile at tier 4") \ - range(0, max_jint) \ - \ - product(intx, Tier4CompileThreshold, 15000, \ - "Threshold at which tier 4 compilation is invoked (invocation " \ - "minimum must be satisfied)") \ - range(0, max_jint) \ - \ - product(intx, Tier4BackEdgeThreshold, 40000, \ - "Back edge threshold at which tier 4 OSR compilation is invoked") \ - range(0, max_jint) \ - \ - product(intx, Tier40InvocationThreshold, 5000, DIAGNOSTIC, \ - "Compile if number of method invocations crosses this " \ - "threshold (applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier40MinInvocationThreshold, 600, DIAGNOSTIC, \ - "Minimum number of invocations to compile at tier 4 " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier40CompileThreshold, 10000, DIAGNOSTIC, \ - "Threshold at which tier 4 compilation is invoked (invocation " \ - "minimum must be satisfied, applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier40BackEdgeThreshold, 15000, DIAGNOSTIC, \ - "Back edge threshold at which tier 4 OSR compilation is invoked " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier0Delay, 5, DIAGNOSTIC, \ - "If C2 queue size grows over this amount per compiler thread " \ - "do not start profiling in the interpreter " \ - "(applicable only with " \ - "CompilationMode=high-only|high-only-quick-internal)") \ - range(0, max_jint) \ - \ - product(intx, Tier3DelayOn, 5, \ - "If C2 queue size grows over this amount per compiler thread " \ - "stop compiling at tier 3 and start compiling at tier 2") \ - range(0, max_jint) \ - \ - product(intx, Tier3DelayOff, 2, \ - "If C2 queue size is less than this amount per compiler thread " \ - "allow methods compiled at tier 2 transition to tier 3") \ - range(0, max_jint) \ - \ - product(intx, Tier3LoadFeedback, 5, \ - "Tier 3 thresholds will increase twofold when C1 queue size " \ - "reaches this amount per compiler thread") \ - range(0, max_jint) \ - \ - product(intx, Tier4LoadFeedback, 3, \ - "Tier 4 thresholds will increase twofold when C2 queue size " \ - "reaches this amount per compiler thread") \ - range(0, max_jint) \ - \ - product(intx, TieredCompileTaskTimeout, 50, \ - "Kill compile task if method was not used within " \ - "given timeout in milliseconds") \ - range(0, max_intx) \ - \ - product(intx, TieredStopAtLevel, 4, \ - "Stop at given compilation level") \ - range(0, 4) \ - \ - product(intx, Tier0ProfilingStartPercentage, 200, \ - "Start profiling in interpreter if the counters exceed tier 3 " \ - "thresholds (tier 4 thresholds with " \ - "CompilationMode=high-only|high-only-quick-internal)" \ - "by the specified percentage") \ - range(0, max_jint) \ - \ - product(uintx, IncreaseFirstTierCompileThresholdAt, 50, \ - "Increase the compile threshold for C1 compilation if the code " \ - "cache is filled by the specified percentage") \ - range(0, 99) \ - \ - product(intx, TieredRateUpdateMinTime, 1, \ - "Minimum rate sampling interval (in milliseconds)") \ - range(0, max_intx) \ - \ - product(intx, TieredRateUpdateMaxTime, 25, \ - "Maximum rate sampling interval (in milliseconds)") \ - range(0, max_intx) \ - \ - product(ccstr, CompilationMode, "default", \ - "Compilation modes: " \ - "default: normal tiered compilation; " \ - "quick-only: C1-only mode; " \ - "high-only: C2/JVMCI-only mode; " \ - "high-only-quick-internal: C2/JVMCI-only mode, " \ - "with JVMCI compiler compiled with C1.") \ - \ product_pd(bool, TieredCompilation, \ "Enable tiered compilation") \ \ - product(bool, PrintTieredEvents, false, \ - "Print tiered events notifications") \ - \ - product_pd(intx, OnStackReplacePercentage, \ - "NON_TIERED number of method invocations/branches (expressed as " \ - "% of CompileThreshold) before (re-)compiling OSR code") \ - constraint(OnStackReplacePercentageConstraintFunc, AfterErgo) \ - \ - product(intx, InterpreterProfilePercentage, 33, \ - "NON_TIERED number of method invocations/branches (expressed as " \ - "% of CompileThreshold) before profiling in the interpreter") \ - range(0, 100) \ - \ - develop(intx, DesiredMethodLimit, 8000, \ - "The desired maximum method size (in bytecodes) after inlining") \ - \ - develop(intx, HugeMethodLimit, 8000, \ - "Don't compile methods larger than this if " \ - "+DontCompileHugeMethods") \ - \ /* Properties for Java libraries */ \ \ product(uint64_t, MaxDirectMemorySize, 0, \ @@ -2451,14 +2073,6 @@ const intx ObjectAlignmentInBytes = 8; range(0, max_intx) \ constraint(InitArrayShortSizeConstraintFunc, AfterErgo) \ \ - product(bool, CompilerDirectivesIgnoreCompileCommands, false, DIAGNOSTIC, \ - "Disable backwards compatibility for compile commands.") \ - \ - product(bool, CompilerDirectivesPrint, false, DIAGNOSTIC, \ - "Print compiler directives on installation.") \ - product(int, CompilerDirectivesLimit, 50, DIAGNOSTIC, \ - "Limit on number of compiler directives.") \ - \ product(ccstr, AllocateHeapAt, NULL, \ "Path to the directoy where a temporary file will be created " \ "to use as the backing store for Java Heap.") \ diff --git a/test/hotspot/gtest/runtime/test_globals.cpp b/test/hotspot/gtest/runtime/test_globals.cpp index 22233d5990d2b..bf44a6ce653e0 100644 --- a/test/hotspot/gtest/runtime/test_globals.cpp +++ b/test/hotspot/gtest/runtime/test_globals.cpp @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "compiler/compiler_globals.hpp" #include "runtime/globals.hpp" #include "runtime/flags/flagSetting.hpp" #include "runtime/flags/jvmFlag.hpp" From cdb53422e8f57aeee82eb535b1dc77b62c9b9783 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Wed, 16 Dec 2020 07:53:40 +0000 Subject: [PATCH 254/504] 8258252: Move PtrQueue enqueue to PtrQueueSet subclasses Reviewed-by: tschatzl, rkennke --- src/hotspot/share/gc/g1/g1BarrierSet.cpp | 9 ++- .../share/gc/g1/g1BarrierSetRuntime.cpp | 11 ++- .../share/gc/g1/g1BarrierSetRuntime.hpp | 9 ++- src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp | 31 +++++--- src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp | 29 ++++---- src/hotspot/share/gc/g1/g1EvacFailure.cpp | 14 +++- .../share/gc/g1/g1ParScanThreadState.hpp | 5 +- .../share/gc/g1/g1RedirtyCardsQueue.cpp | 16 ++-- .../share/gc/g1/g1RedirtyCardsQueue.hpp | 6 +- .../share/gc/g1/g1SATBMarkQueueSet.cpp | 10 ++- .../share/gc/g1/g1SATBMarkQueueSet.hpp | 4 +- src/hotspot/share/gc/shared/ptrQueue.cpp | 57 +++++++++------ src/hotspot/share/gc/shared/ptrQueue.hpp | 73 ++++++++++--------- src/hotspot/share/gc/shared/satbMarkQueue.cpp | 63 +++++++++------- src/hotspot/share/gc/shared/satbMarkQueue.hpp | 43 +++++------ .../shenandoahBarrierSet.inline.hpp | 5 +- .../share/gc/shenandoah/shenandoahRuntime.cpp | 3 +- .../shenandoah/shenandoahSATBMarkQueueSet.cpp | 12 +-- .../shenandoah/shenandoahSATBMarkQueueSet.hpp | 10 +-- .../shenandoah/shenandoahThreadLocalData.hpp | 2 +- src/hotspot/share/jvmci/jvmciRuntime.cpp | 14 ++-- src/hotspot/share/jvmci/jvmciRuntime.hpp | 8 +- 22 files changed, 251 insertions(+), 183 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.cpp b/src/hotspot/share/gc/g1/g1BarrierSet.cpp index 9243e1f319fed..90ddfa048d408 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.cpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.cpp @@ -65,7 +65,8 @@ G1BarrierSet::G1BarrierSet(G1CardTable* card_table) : void G1BarrierSet::enqueue(oop pre_val) { // Nulls should have been already filtered. assert(oopDesc::is_oop(pre_val, true), "Error"); - G1ThreadLocalData::satb_mark_queue(Thread::current()).enqueue(pre_val); + SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue(Thread::current()); + G1BarrierSet::satb_mark_queue_set().enqueue(queue, pre_val); } template void @@ -99,7 +100,8 @@ void G1BarrierSet::write_ref_field_post_slow(volatile CardValue* byte) { if (*byte != G1CardTable::dirty_card_val()) { *byte = G1CardTable::dirty_card_val(); Thread* thr = Thread::current(); - G1ThreadLocalData::dirty_card_queue(thr).enqueue(byte); + G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(thr); + G1BarrierSet::dirty_card_queue_set().enqueue(queue, byte); } } @@ -116,13 +118,14 @@ void G1BarrierSet::invalidate(MemRegion mr) { OrderAccess::storeload(); // Enqueue if necessary. Thread* thr = Thread::current(); + G1DirtyCardQueueSet& qset = G1BarrierSet::dirty_card_queue_set(); G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(thr); for (; byte <= last_byte; byte++) { CardValue bv = *byte; if ((bv != G1CardTable::g1_young_card_val()) && (bv != G1CardTable::dirty_card_val())) { *byte = G1CardTable::dirty_card_val(); - queue.enqueue(byte); + qset.enqueue(queue, byte); } } } diff --git a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp index 37a053468811d..fbb2c492a15cd 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp +++ b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -52,10 +52,13 @@ JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_pre_entry(oopDesc* orig, Jav } assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error"); // store the original value that was in the field reference - G1ThreadLocalData::satb_mark_queue(thread).enqueue(orig); + SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue(thread); + G1BarrierSet::satb_mark_queue_set().enqueue(queue, orig); JRT_END // G1 post write barrier slowpath -JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_post_entry(void* card_addr, JavaThread* thread)) - G1ThreadLocalData::dirty_card_queue(thread).enqueue(card_addr); +JRT_LEAF(void, G1BarrierSetRuntime::write_ref_field_post_entry(volatile G1CardTable::CardValue* card_addr, + JavaThread* thread)) + G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(thread); + G1BarrierSet::dirty_card_queue_set().enqueue(queue, card_addr); JRT_END diff --git a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.hpp b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.hpp index 89be1d9c3f5f7..366679f032ba9 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSetRuntime.hpp +++ b/src/hotspot/share/gc/g1/g1BarrierSetRuntime.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,8 @@ #ifndef SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP #define SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP -#include "memory/allocation.hpp" +#include "gc/g1/g1CardTable.hpp" +#include "memory/allStatic.hpp" #include "oops/oopsHierarchy.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" @@ -35,6 +36,8 @@ class JavaThread; class G1BarrierSetRuntime: public AllStatic { public: + using CardValue = G1CardTable::CardValue; + // Arraycopy stub generator static void write_ref_array_pre_oop_entry(oop* dst, size_t length); static void write_ref_array_pre_narrow_oop_entry(narrowOop* dst, size_t length); @@ -42,7 +45,7 @@ class G1BarrierSetRuntime: public AllStatic { // C2 slow-path runtime calls. static void write_ref_field_pre_entry(oopDesc* orig, JavaThread *thread); - static void write_ref_field_post_entry(void* card_addr, JavaThread* thread); + static void write_ref_field_post_entry(volatile CardValue* card_addr, JavaThread* thread); }; #endif // SHARE_GC_G1_G1BARRIERSETRUNTIME_HPP diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp index 05b51af06a298..3329704204a71 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1BufferNodeList.hpp" #include "gc/g1/g1CardTableEntryClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" @@ -71,14 +72,6 @@ void G1DirtyCardQueue::on_thread_detach() { dirty_card_qset()->record_detached_refinement_stats(_refinement_stats); } -void G1DirtyCardQueue::handle_completed_buffer() { - assert(!is_empty(), "precondition"); - _refinement_stats->inc_dirtied_cards(size()); - BufferNode* node = BufferNode::make_node_from_buffer(_buf, index()); - allocate_buffer(); - dirty_card_qset()->handle_completed_buffer(node, _refinement_stats); -} - // Assumed to be zero by concurrent threads. static uint par_ids_start() { return 0; } @@ -106,8 +99,28 @@ uint G1DirtyCardQueueSet::num_par_ids() { return (uint)os::initial_active_processor_count(); } +void G1DirtyCardQueueSet::enqueue(G1DirtyCardQueue& queue, + volatile CardValue* card_ptr) { + CardValue* value = const_cast(card_ptr); + if (!try_enqueue(queue, value)) { + handle_zero_index(queue); + retry_enqueue(queue, value); + } +} + +void G1DirtyCardQueueSet::handle_zero_index(G1DirtyCardQueue& queue) { + assert(queue.index() == 0, "precondition"); + BufferNode* old_node = exchange_buffer_with_new(queue); + if (old_node != nullptr) { + G1ConcurrentRefineStats* stats = queue.refinement_stats(); + stats->inc_dirtied_cards(buffer_size()); + handle_completed_buffer(old_node, stats); + } +} + void G1DirtyCardQueueSet::handle_zero_index_for_thread(Thread* t) { - G1ThreadLocalData::dirty_card_queue(t).handle_zero_index(); + G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(t); + G1BarrierSet::dirty_card_queue_set().handle_zero_index(queue); } #ifdef ASSERT diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp index 2b8b445154dd8..d9fabe034a738 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp @@ -27,6 +27,7 @@ #include "gc/g1/g1BufferNodeList.hpp" #include "gc/g1/g1FreeIdSet.hpp" +#include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" #include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" @@ -41,9 +42,6 @@ class Thread; class G1DirtyCardQueue: public PtrQueue { G1ConcurrentRefineStats* _refinement_stats; -protected: - virtual void handle_completed_buffer(); - public: G1DirtyCardQueue(G1DirtyCardQueueSet* qset); @@ -263,6 +261,19 @@ class G1DirtyCardQueueSet: public PtrQueueSet { // if none available. BufferNode* get_completed_buffer(); + // Called when queue is full or has no buffer. + void handle_zero_index(G1DirtyCardQueue& queue); + + // Enqueue the buffer, and optionally perform refinement by the mutator. + // Mutator refinement is only done by Java threads, and only if there + // are more than max_cards (possibly padded) cards in the completed + // buffers. Updates stats. + // + // Mutator refinement, if performed, stops processing a buffer if + // SuspendibleThreadSet::should_yield(), recording the incompletely + // processed buffer for later processing of the remainder. + void handle_completed_buffer(BufferNode* node, G1ConcurrentRefineStats* stats); + public: G1DirtyCardQueueSet(BufferNode::Allocator* allocator); ~G1DirtyCardQueueSet(); @@ -302,16 +313,8 @@ class G1DirtyCardQueueSet: public PtrQueueSet { G1BufferNodeList take_all_completed_buffers(); - // Helper for G1DirtyCardQueue::handle_completed_buffer(). - // Enqueue the buffer, and optionally perform refinement by the mutator. - // Mutator refinement is only done by Java threads, and only if there - // are more than max_cards (possibly padded) cards in the completed - // buffers. Updates stats. - // - // Mutator refinement, if performed, stops processing a buffer if - // SuspendibleThreadSet::should_yield(), recording the incompletely - // processed buffer for later processing of the remainder. - void handle_completed_buffer(BufferNode* node, G1ConcurrentRefineStats* stats); + using CardValue = G1CardTable::CardValue; + void enqueue(G1DirtyCardQueue& queue, volatile CardValue* card_ptr); // If there are more than stop_at cards in the completed buffers, pop // a buffer, refine its contents, and return true. Otherwise return diff --git a/src/hotspot/share/gc/g1/g1EvacFailure.cpp b/src/hotspot/share/gc/g1/g1EvacFailure.cpp index 0d2175ee2165c..f133383169697 100644 --- a/src/hotspot/share/gc/g1/g1EvacFailure.cpp +++ b/src/hotspot/share/gc/g1/g1EvacFailure.cpp @@ -40,6 +40,7 @@ class UpdateLogBuffersDeferred : public BasicOopIterateClosure { private: G1CollectedHeap* _g1h; + G1RedirtyCardsLocalQueueSet* _rdc_local_qset; G1RedirtyCardsQueue* _rdcq; G1CardTable* _ct; @@ -48,8 +49,13 @@ class UpdateLogBuffersDeferred : public BasicOopIterateClosure { size_t _last_enqueued_card; public: - UpdateLogBuffersDeferred(G1RedirtyCardsQueue* rdcq) : - _g1h(G1CollectedHeap::heap()), _rdcq(rdcq), _ct(_g1h->card_table()), _last_enqueued_card(SIZE_MAX) {} + UpdateLogBuffersDeferred(G1RedirtyCardsLocalQueueSet* rdc_local_qset, + G1RedirtyCardsQueue* rdcq) : + _g1h(G1CollectedHeap::heap()), + _rdc_local_qset(rdc_local_qset), + _rdcq(rdcq), + _ct(_g1h->card_table()), + _last_enqueued_card(SIZE_MAX) {} virtual void do_oop(narrowOop* p) { do_oop_work(p); } virtual void do_oop( oop* p) { do_oop_work(p); } @@ -67,7 +73,7 @@ class UpdateLogBuffersDeferred : public BasicOopIterateClosure { } size_t card_index = _ct->index_for(p); if (card_index != _last_enqueued_card) { - _rdcq->enqueue(_ct->byte_for_index(card_index)); + _rdc_local_qset->enqueue(*_rdcq, _ct->byte_for_index(card_index)); _last_enqueued_card = card_index; } } @@ -209,7 +215,7 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { _worker_id(worker_id), _rdc_local_qset(rdcqs), _rdcq(&_rdc_local_qset), - _log_buffer_cl(&_rdcq) { + _log_buffer_cl(&_rdc_local_qset, &_rdcq) { } ~RemoveSelfForwardPtrHRClosure() { diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp index 784b3b3aa695b..1f1617793e63c 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp @@ -88,8 +88,7 @@ class G1ParScanThreadState : public CHeapObj { // Used to check whether string dedup should be applied to an object. Klass* _string_klass_or_null; - G1RedirtyCardsQueue& redirty_cards_queue() { return _rdcq; } - G1CardTable* ct() { return _ct; } + G1CardTable* ct() { return _ct; } G1HeapRegionAttr dest(G1HeapRegionAttr original) const { assert(original.is_valid(), @@ -149,7 +148,7 @@ class G1ParScanThreadState : public CHeapObj { size_t card_index = ct()->index_for(p); // If the card hasn't been added to the buffer, do it. if (_last_enqueued_card != card_index) { - redirty_cards_queue().enqueue(ct()->byte_for_index(card_index)); + _rdc_local_qset.enqueue(_rdcq, ct()->byte_for_index(card_index)); _last_enqueued_card = card_index; } } diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp index d03c15bcb5de9..14d35e771cf79 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp @@ -28,7 +28,7 @@ #include "utilities/debug.hpp" #include "utilities/macros.hpp" -// G1RedirtyCardsQueueBase::LocalQSet +// G1RedirtyCardsLocalQueueSet G1RedirtyCardsLocalQueueSet::G1RedirtyCardsLocalQueueSet(G1RedirtyCardsQueueSet* shared_qset) : PtrQueueSet(shared_qset->allocator()), @@ -53,6 +53,16 @@ void G1RedirtyCardsLocalQueueSet::enqueue_completed_buffer(BufferNode* node) { } } +void G1RedirtyCardsLocalQueueSet::enqueue(G1RedirtyCardsQueue& queue, void* value) { + if (!try_enqueue(queue, value)) { + BufferNode* old_node = exchange_buffer_with_new(queue); + if (old_node != nullptr) { + enqueue_completed_buffer(old_node); + } + retry_enqueue(queue, value); + } +} + void G1RedirtyCardsLocalQueueSet::flush() { _shared_qset->add_bufferlist(_buffers); _buffers = G1BufferNodeList(); @@ -70,10 +80,6 @@ G1RedirtyCardsQueue::~G1RedirtyCardsQueue() { } #endif // ASSERT -void G1RedirtyCardsQueue::handle_completed_buffer() { - enqueue_completed_buffer(); -} - void G1RedirtyCardsQueue::flush() { flush_impl(); } diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp index 2a0d7636e18bc..5d113499e7ec9 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp @@ -29,6 +29,7 @@ #include "gc/shared/ptrQueue.hpp" #include "memory/padded.hpp" +class G1RedirtyCardsQueue; class G1RedirtyCardsQueueSet; // Provide G1RedirtyCardsQueue with a thread-local qset. It provides an @@ -42,6 +43,8 @@ class G1RedirtyCardsLocalQueueSet : public PtrQueueSet { G1RedirtyCardsLocalQueueSet(G1RedirtyCardsQueueSet* shared_qset); ~G1RedirtyCardsLocalQueueSet() NOT_DEBUG(= default); + void enqueue(G1RedirtyCardsQueue& queue, void* value); + // Add the buffer to the local list. virtual void enqueue_completed_buffer(BufferNode* node); @@ -51,9 +54,6 @@ class G1RedirtyCardsLocalQueueSet : public PtrQueueSet { // Worker-local queues of card table entries. class G1RedirtyCardsQueue : public PtrQueue { -protected: - virtual void handle_completed_buffer(); - public: G1RedirtyCardsQueue(G1RedirtyCardsLocalQueueSet* qset); ~G1RedirtyCardsQueue() NOT_DEBUG(= default); diff --git a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp index 7c7222039a0a3..15fbfb5c91aa4 100644 --- a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc/g1/g1BarrierSet.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" @@ -37,10 +38,11 @@ G1SATBMarkQueueSet::G1SATBMarkQueueSet(BufferNode::Allocator* allocator) : {} void G1SATBMarkQueueSet::handle_zero_index_for_thread(Thread* t) { - G1ThreadLocalData::satb_mark_queue(t).handle_zero_index(); + G1SATBMarkQueueSet& qset = G1BarrierSet::satb_mark_queue_set(); + qset.handle_zero_index(qset.satb_queue_for_thread(t)); } -SATBMarkQueue& G1SATBMarkQueueSet::satb_queue_for_thread(Thread* const t) const{ +SATBMarkQueue& G1SATBMarkQueueSet::satb_queue_for_thread(Thread* const t) const { return G1ThreadLocalData::satb_mark_queue(t); } @@ -113,6 +115,6 @@ class G1SATBMarkQueueFilterFn { } }; -void G1SATBMarkQueueSet::filter(SATBMarkQueue* queue) { +void G1SATBMarkQueueSet::filter(SATBMarkQueue& queue) { apply_filter(G1SATBMarkQueueFilterFn(), queue); } diff --git a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp index 71db65fd4741c..f7d690bf77881 100644 --- a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp +++ b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -39,7 +39,7 @@ class G1SATBMarkQueueSet : public SATBMarkQueueSet { static void handle_zero_index_for_thread(Thread* t); virtual SATBMarkQueue& satb_queue_for_thread(Thread* const t) const; - virtual void filter(SATBMarkQueue* queue); + virtual void filter(SATBMarkQueue& queue); }; #endif // SHARE_GC_G1_G1SATBMARKQUEUESET_HPP diff --git a/src/hotspot/share/gc/shared/ptrQueue.cpp b/src/hotspot/share/gc/shared/ptrQueue.cpp index b870ff2847bcc..35a7575b96b6b 100644 --- a/src/hotspot/share/gc/shared/ptrQueue.cpp +++ b/src/hotspot/share/gc/shared/ptrQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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 @@ -61,28 +61,6 @@ void PtrQueue::flush_impl() { } } -void PtrQueue::enqueue_known_active(void* ptr) { - while (_index == 0) { - handle_zero_index(); - } - - assert(_buf != NULL, "postcondition"); - assert(index() > 0, "postcondition"); - assert(index() <= capacity(), "invariant"); - _index -= _element_size; - _buf[index()] = ptr; -} - -void PtrQueue::handle_zero_index() { - assert(index() == 0, "precondition"); - - if (_buf != NULL) { - handle_completed_buffer(); - } else { - allocate_buffer(); - } -} - void PtrQueue::allocate_buffer() { _buf = qset()->allocate_buffer(); reset(); @@ -249,6 +227,39 @@ PtrQueueSet::PtrQueueSet(BufferNode::Allocator* allocator) : PtrQueueSet::~PtrQueueSet() {} +bool PtrQueueSet::try_enqueue(PtrQueue& queue, void* value) { + size_t index = queue.index(); + if (index == 0) return false; + void** buffer = queue.buffer(); + assert(buffer != nullptr, "no buffer but non-zero index"); + buffer[--index] = value; + queue.set_index(index); + return true; +} + +void PtrQueueSet::retry_enqueue(PtrQueue& queue, void* value) { + assert(queue.index() != 0, "precondition"); + assert(queue.buffer() != nullptr, "precondition"); + size_t index = queue.index(); + queue.buffer()[--index] = value; + queue.set_index(index); +} + +BufferNode* PtrQueueSet::exchange_buffer_with_new(PtrQueue& queue) { + BufferNode* node = nullptr; + void** buffer = queue.buffer(); + if (buffer != nullptr) { + node = BufferNode::make_node_from_buffer(buffer, queue.index()); + } + install_new_buffer(queue); + return node; +} + +void PtrQueueSet::install_new_buffer(PtrQueue& queue) { + queue.set_buffer(allocate_buffer()); + queue.set_index(buffer_size()); +} + void** PtrQueueSet::allocate_buffer() { BufferNode* node = _allocator->allocate(); return BufferNode::make_buffer_from_node(node); diff --git a/src/hotspot/share/gc/shared/ptrQueue.hpp b/src/hotspot/share/gc/shared/ptrQueue.hpp index 472608d10450d..035c3580dbdd9 100644 --- a/src/hotspot/share/gc/shared/ptrQueue.hpp +++ b/src/hotspot/share/gc/shared/ptrQueue.hpp @@ -32,9 +32,6 @@ #include "utilities/lockFreeStack.hpp" #include "utilities/sizes.hpp" -class Mutex; -class Monitor; - // There are various techniques that require threads to be able to log // addresses. For example, a generational write barrier might log // the addresses of modified old-generation objects. This type supports @@ -83,29 +80,11 @@ class PtrQueue { // The buffer. void** _buf; - size_t index() const { - return byte_index_to_index(_index); - } - - void set_index(size_t new_index) { - size_t byte_index = index_to_byte_index(new_index); - assert(byte_index <= capacity_in_bytes(), "precondition"); - _index = byte_index; - } - - size_t capacity() const { - return byte_index_to_index(capacity_in_bytes()); - } - PtrQueueSet* qset() const { return _qset; } // Process queue entries and release resources. void flush_impl(); - // Process (some of) the buffer and leave it in place for further use, - // or enqueue the buffer and allocate a new one. - virtual void handle_completed_buffer() = 0; - void allocate_buffer(); // Enqueue the current buffer in the qset and allocate a new buffer. @@ -120,26 +99,37 @@ class PtrQueue { public: - // Forcibly set empty. - void reset() { - if (_buf != NULL) { - _index = capacity_in_bytes(); - } + void** buffer() const { return _buf; } + void set_buffer(void** buffer) { _buf = buffer; } + + size_t index_in_bytes() const { + return _index; } - void enqueue(volatile void* ptr) { - enqueue((void*)(ptr)); + void set_index_in_bytes(size_t new_index) { + assert(is_aligned(new_index, _element_size), "precondition"); + assert(new_index <= capacity_in_bytes(), "precondition"); + _index = new_index; } - // Enqueues the given "obj". - void enqueue(void* ptr) { - if (!_active) return; - else enqueue_known_active(ptr); + size_t index() const { + return byte_index_to_index(index_in_bytes()); } - void handle_zero_index(); + void set_index(size_t new_index) { + set_index_in_bytes(index_to_byte_index(new_index)); + } - void enqueue_known_active(void* ptr); + size_t capacity() const { + return byte_index_to_index(capacity_in_bytes()); + } + + // Forcibly set empty. + void reset() { + if (_buf != NULL) { + _index = capacity_in_bytes(); + } + } // Return the size of the in-use region. size_t size() const { @@ -306,6 +296,21 @@ class PtrQueueSet { PtrQueueSet(BufferNode::Allocator* allocator); ~PtrQueueSet(); + // Add value to queue's buffer, returning true. If buffer is full + // or if queue doesn't have a buffer, does nothing and returns false. + bool try_enqueue(PtrQueue& queue, void* value); + + // Add value to queue's buffer. The queue must have a non-full buffer. + // Used after an initial try_enqueue has failed and the situation resolved. + void retry_enqueue(PtrQueue& queue, void* value); + + // Installs a new buffer into queue. + // Returns the old buffer, or null if queue didn't have a buffer. + BufferNode* exchange_buffer_with_new(PtrQueue& queue); + + // Installs a new buffer into queue. + void install_new_buffer(PtrQueue& queue); + public: // Return the associated BufferNode allocator. diff --git a/src/hotspot/share/gc/shared/satbMarkQueue.cpp b/src/hotspot/share/gc/shared/satbMarkQueue.cpp index 0cd9b30c952c3..1965863097928 100644 --- a/src/hotspot/share/gc/shared/satbMarkQueue.cpp +++ b/src/hotspot/share/gc/shared/satbMarkQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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 @@ -54,32 +54,6 @@ void SATBMarkQueue::flush() { flush_impl(); } -// This method will first apply filtering to the buffer. If filtering -// retains a small enough collection in the buffer, we can continue to -// use the buffer as-is, instead of enqueueing and replacing it. - -void SATBMarkQueue::handle_completed_buffer() { - // This method should only be called if there is a non-NULL buffer - // that is full. - assert(index() == 0, "pre-condition"); - assert(_buf != NULL, "pre-condition"); - - filter(); - - size_t threshold = satb_qset()->buffer_enqueue_threshold(); - // Ensure we'll enqueue completely full buffers. - assert(threshold > 0, "enqueue threshold = 0"); - // Ensure we won't enqueue empty buffers. - assert(threshold <= capacity(), - "enqueue threshold " SIZE_FORMAT " exceeds capacity " SIZE_FORMAT, - threshold, capacity()); - - if (index() < threshold) { - // Buffer is sufficiently full; enqueue and allocate a new one. - enqueue_completed_buffer(); - } // Else continue to accumulate in buffer. -} - void SATBMarkQueue::apply_closure_and_empty(SATBBufferClosure* cl) { assert(SafepointSynchronize::is_at_safepoint(), "SATB queues must only be processed at safepoints"); @@ -254,6 +228,41 @@ bool SATBMarkQueueSet::apply_closure_to_completed_buffer(SATBBufferClosure* cl) } } +void SATBMarkQueueSet::enqueue_known_active(SATBMarkQueue& queue, oop obj) { + assert(queue.is_active(), "precondition"); + void* value = cast_from_oop(obj); + if (!try_enqueue(queue, value)) { + handle_zero_index(queue); + retry_enqueue(queue, value); + } +} + +void SATBMarkQueueSet::handle_zero_index(SATBMarkQueue& queue) { + assert(queue.index() == 0, "precondition"); + if (queue.buffer() == nullptr) { + install_new_buffer(queue); + } else { + filter(queue); + if (should_enqueue_buffer(queue)) { + enqueue_completed_buffer(exchange_buffer_with_new(queue)); + } // Else continue to use the existing buffer. + } + assert(queue.buffer() != nullptr, "post condition"); + assert(queue.index() > 0, "post condition"); +} + +bool SATBMarkQueueSet::should_enqueue_buffer(SATBMarkQueue& queue) { + // Keep the current buffer if filtered index >= threshold. + size_t threshold = buffer_enqueue_threshold(); + // Ensure we'll enqueue completely full buffers. + assert(threshold > 0, "enqueue threshold = 0"); + // Ensure we won't enqueue empty buffers. + assert(threshold <= buffer_size(), + "enqueue threshold %zu exceeds capacity %zu", + threshold, buffer_size()); + return queue.index() < threshold; +} + // SATB buffer life-cycle - Per-thread queues obtain buffers from the // qset's buffer allocator, fill them, and push them onto the qset's // list. The GC concurrently pops buffers from the qset, processes diff --git a/src/hotspot/share/gc/shared/satbMarkQueue.hpp b/src/hotspot/share/gc/shared/satbMarkQueue.hpp index 951e858060353..352e9e5905a1d 100644 --- a/src/hotspot/share/gc/shared/satbMarkQueue.hpp +++ b/src/hotspot/share/gc/shared/satbMarkQueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, 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 @@ #include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" #include "memory/padded.hpp" +#include "oops/oopsHierarchy.hpp" class Thread; class Monitor; @@ -51,13 +52,6 @@ class SATBMarkQueue: public PtrQueue { // Filter out unwanted entries from the buffer. inline void filter(); - // Removes entries from the buffer that are no longer needed. - template - inline void apply_filter(Filter filter_out); - -protected: - virtual void handle_completed_buffer(); - public: SATBMarkQueue(SATBMarkQueueSet* qset); @@ -115,10 +109,14 @@ class SATBMarkQueueSet: public PtrQueueSet { SATBMarkQueueSet(BufferNode::Allocator* allocator); ~SATBMarkQueueSet(); + void handle_zero_index(SATBMarkQueue& queue); + + // Return true if the queue's buffer should be enqueued, even if not full. + // The default method uses the buffer enqueue threshold. + virtual bool should_enqueue_buffer(SATBMarkQueue& queue); + template - void apply_filter(Filter filter, SATBMarkQueue* queue) { - queue->apply_filter(filter); - } + void apply_filter(Filter filter, SATBMarkQueue& queue); public: virtual SATBMarkQueue& satb_queue_for_thread(Thread* const t) const = 0; @@ -134,14 +132,17 @@ class SATBMarkQueueSet: public PtrQueueSet { size_t buffer_enqueue_threshold() const { return _buffer_enqueue_threshold; } void set_buffer_enqueue_threshold_percentage(uint value); - virtual void filter(SATBMarkQueue* queue) = 0; - // If there exists some completed buffer, pop and process it, and // return true. Otherwise return false. Processing a buffer // consists of applying the closure to the active range of the // buffer; the leading entries may be excluded due to filtering. bool apply_closure_to_completed_buffer(SATBBufferClosure* cl); + void enqueue(SATBMarkQueue& queue, oop obj) { + if (queue.is_active()) enqueue_known_active(queue, obj); + } + void enqueue_known_active(SATBMarkQueue& queue, oop obj); + virtual void filter(SATBMarkQueue& queue) = 0; virtual void enqueue_completed_buffer(BufferNode* node); // The number of buffers in the list. Racy and not updated atomically @@ -169,17 +170,17 @@ inline SATBMarkQueueSet* SATBMarkQueue::satb_qset() const { } inline void SATBMarkQueue::filter() { - satb_qset()->filter(this); + satb_qset()->filter(*this); } -// Removes entries from the buffer that are no longer needed, as -// determined by filter. If e is a void* entry in the buffer, +// Removes entries from queue's buffer that are no longer needed, as +// determined by filter. If e is a void* entry in queue's buffer, // filter_out(e) must be a valid expression whose value is convertible // to bool. Entries are removed (filtered out) if the result is true, // retained if false. template -inline void SATBMarkQueue::apply_filter(Filter filter_out) { - void** buf = this->_buf; +inline void SATBMarkQueueSet::apply_filter(Filter filter_out, SATBMarkQueue& queue) { + void** buf = queue.buffer(); if (buf == NULL) { // nothing to do @@ -187,8 +188,8 @@ inline void SATBMarkQueue::apply_filter(Filter filter_out) { } // Two-fingered compaction toward the end. - void** src = &buf[this->index()]; - void** dst = &buf[this->capacity()]; + void** src = &buf[queue.index()]; + void** dst = &buf[buffer_size()]; assert(src <= dst, "invariant"); for ( ; src < dst; ++src) { // Search low to high for an entry to keep. @@ -206,7 +207,7 @@ inline void SATBMarkQueue::apply_filter(Filter filter_out) { } // dst points to the lowest retained entry, or the end of the buffer // if all the entries were filtered out. - this->set_index(dst - buf); + queue.set_index(dst - buf); } #endif // SHARE_GC_SHARED_SATBMARKQUEUE_HPP diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp index 4045997aed913..53b1c0b8d83dd 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp @@ -142,7 +142,8 @@ inline void ShenandoahBarrierSet::enqueue(oop obj) { // filtering here helps to avoid wasteful SATB queueing work to begin with. if (!_heap->requires_marking(obj)) return; - ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue_known_active(obj); + SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(Thread::current()); + _satb_mark_queue_set.enqueue_known_active(queue, obj); } template @@ -349,7 +350,7 @@ void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) { obj = fwd; } if (ENQUEUE && !ctx->is_marked_strong(obj)) { - queue.enqueue_known_active(obj); + _satb_mark_queue_set.enqueue_known_active(queue, obj); } } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp index d21c6d767463d..2a8de1fa5752f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRuntime.cpp @@ -47,7 +47,8 @@ JRT_LEAF(void, ShenandoahRuntime::write_ref_field_pre_entry(oopDesc* orig, JavaT shenandoah_assert_correct(NULL, orig); // store the original value that was in the field reference assert(ShenandoahThreadLocalData::satb_mark_queue(thread).is_active(), "Shouldn't be here otherwise"); - ShenandoahThreadLocalData::satb_mark_queue(thread).enqueue_known_active(orig); + SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread); + ShenandoahBarrierSet::satb_mark_queue_set().enqueue_known_active(queue, orig); JRT_END JRT_LEAF(oopDesc*, ShenandoahRuntime::load_reference_barrier_strong(oopDesc* src, oop* load_addr)) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp index 9bb132fd88399..caca8f9559732 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp @@ -49,14 +49,15 @@ class ShenandoahSATBMarkQueueFilterFn { } }; -void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) { +void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue& queue) { ShenandoahHeap* heap = ShenandoahHeap::heap(); apply_filter(ShenandoahSATBMarkQueueFilterFn(heap), queue); } -void ShenandoahSATBMarkQueue::handle_completed_buffer() { - SATBMarkQueue::handle_completed_buffer(); - if (!is_empty()) { +bool ShenandoahSATBMarkQueueSet::should_enqueue_buffer(SATBMarkQueue& queue) { + if (SATBMarkQueueSet::should_enqueue_buffer(queue)) { + return true; + } else if (queue.index() < buffer_size()) { // Is buffer not empty? Thread* t = Thread::current(); if (ShenandoahThreadLocalData::is_force_satb_flush(t)) { // Non-empty buffer is compacted, and we decided not to enqueue it. @@ -64,7 +65,8 @@ void ShenandoahSATBMarkQueue::handle_completed_buffer() { // This avoid dealing with these leftovers during the final-mark, after // the buffers are drained completely. See JDK-8205353 for more discussion. ShenandoahThreadLocalData::set_force_satb_flush(t, false); - enqueue_completed_buffer(); + return true; } } + return false; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp index fa216ad42e3fc..8af185563c4db 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp @@ -30,19 +30,15 @@ #include "runtime/mutex.hpp" #include "runtime/thread.hpp" -class ShenandoahSATBMarkQueue: public SATBMarkQueue { +class ShenandoahSATBMarkQueueSet : public SATBMarkQueueSet { protected: - virtual void handle_completed_buffer(); -public: - ShenandoahSATBMarkQueue(SATBMarkQueueSet* qset) : SATBMarkQueue(qset) {} -}; + virtual bool should_enqueue_buffer(SATBMarkQueue& queue); -class ShenandoahSATBMarkQueueSet : public SATBMarkQueueSet { public: ShenandoahSATBMarkQueueSet(BufferNode::Allocator* allocator); virtual SATBMarkQueue& satb_queue_for_thread(Thread* const t) const; - virtual void filter(SATBMarkQueue* queue); + virtual void filter(SATBMarkQueue& queue); }; #endif // SHARE_GC_SHENANDOAH_SHENANDOAHSATBMARKQUEUESET_HPP diff --git a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp index 5dfcb659d1140..212483510a392 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahThreadLocalData.hpp @@ -43,7 +43,7 @@ class ShenandoahThreadLocalData { // Evacuation OOM state uint8_t _oom_scope_nesting_level; bool _oom_during_evac; - ShenandoahSATBMarkQueue _satb_mark_queue; + SATBMarkQueue _satb_mark_queue; PLAB* _gclab; size_t _gclab_size; uint _worker_id; diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 8701c7c6d3528..e8f0ba69898c0 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -51,7 +51,7 @@ #include "runtime/reflectionUtils.hpp" #include "runtime/sharedRuntime.hpp" #if INCLUDE_G1GC -#include "gc/g1/g1ThreadLocalData.hpp" +#include "gc/g1/g1BarrierSetRuntime.hpp" #endif // INCLUDE_G1GC // Simple helper to see if the caller of a runtime stub which @@ -482,13 +482,13 @@ JRT_END #if INCLUDE_G1GC -JRT_LEAF(void, JVMCIRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj)) - G1ThreadLocalData::satb_mark_queue(thread).enqueue(obj); -JRT_END +void JVMCIRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj) { + G1BarrierSetRuntime::write_ref_field_pre_entry(obj, thread); +} -JRT_LEAF(void, JVMCIRuntime::write_barrier_post(JavaThread* thread, void* card_addr)) - G1ThreadLocalData::dirty_card_queue(thread).enqueue(card_addr); -JRT_END +void JVMCIRuntime::write_barrier_post(JavaThread* thread, volatile CardValue* card_addr) { + G1BarrierSetRuntime::write_ref_field_post_entry(card_addr, thread); +} #endif // INCLUDE_G1GC diff --git a/src/hotspot/share/jvmci/jvmciRuntime.hpp b/src/hotspot/share/jvmci/jvmciRuntime.hpp index 2f475f9e4470c..f29537739ddd2 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.hpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2020, 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,9 @@ #include "jvmci/jvmciExceptions.hpp" #include "jvmci/jvmciObject.hpp" #include "utilities/linkedlist.hpp" +#if INCLUDE_G1GC +#include "gc/g1/g1CardTable.hpp" +#endif // INCLUDE_G1GC class JVMCIEnv; class JVMCICompiler; @@ -396,8 +399,9 @@ class JVMCIRuntime: public CHeapObj { // followed by its address. static void log_object(JavaThread* thread, oopDesc* object, bool as_string, bool newline); #if INCLUDE_G1GC + using CardValue = G1CardTable::CardValue; static void write_barrier_pre(JavaThread* thread, oopDesc* obj); - static void write_barrier_post(JavaThread* thread, void* card); + static void write_barrier_post(JavaThread* thread, volatile CardValue* card); #endif static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child); From 0c8cc2cde47bed3d5c3edc203869068a0676812b Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 16 Dec 2020 09:01:27 +0000 Subject: [PATCH 255/504] 8258058: improve description of OutOfMemoryError relevant flags OutOfMemoryError thrown out of JVM doesn't notify hotspot, so debug.cpp::report_java_out_out_memory does not handle it. ie. Some options don't respect OOMEs from Java libraries. We need to make the description more clear to users. Reviewed-by: dholmes, jiefu --- src/hotspot/share/runtime/globals.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 233a861c6fd74..f9f1539193a2a 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -541,7 +541,8 @@ const intx ObjectAlignmentInBytes = 8; "for examples") \ \ product(ccstrlist, OnOutOfMemoryError, "", \ - "Run user-defined commands on first java.lang.OutOfMemoryError") \ + "Run user-defined commands on first java.lang.OutOfMemoryError " \ + "thrown from JVM") \ \ product(bool, HeapDumpBeforeFullGC, false, MANAGEABLE, \ "Dump heap to file before any major stop-the-world GC") \ @@ -550,7 +551,8 @@ const intx ObjectAlignmentInBytes = 8; "Dump heap to file after any major stop-the-world GC") \ \ product(bool, HeapDumpOnOutOfMemoryError, false, MANAGEABLE, \ - "Dump heap to file when java.lang.OutOfMemoryError is thrown") \ + "Dump heap to file when java.lang.OutOfMemoryError is thrown " \ + "from JVM") \ \ product(ccstr, HeapDumpPath, NULL, MANAGEABLE, \ "When HeapDumpOnOutOfMemoryError is on, the path (filename or " \ @@ -867,11 +869,12 @@ const intx ObjectAlignmentInBytes = 8; range(0, 2) \ \ product(bool, ExitOnOutOfMemoryError, false, \ - "JVM exits on the first occurrence of an out-of-memory error") \ + "JVM exits on the first occurrence of an out-of-memory error " \ + "thrown from JVM") \ \ product(bool, CrashOnOutOfMemoryError, false, \ "JVM aborts, producing an error log and core/mini dump, on the " \ - "first occurrence of an out-of-memory error") \ + "first occurrence of an out-of-memory error thrown from JVM") \ \ /* tracing */ \ \ From 72dfba8053ed5c159b832349ce5290b053ed37ad Mon Sep 17 00:00:00 2001 From: Julia Boes Date: Wed, 16 Dec 2020 10:46:39 +0000 Subject: [PATCH 256/504] 8257637: Update usage of "type" terminology in java.lang.annotation Reviewed-by: darcy --- .../java/lang/annotation/Annotation.java | 20 ++++++------ .../java/lang/annotation/Documented.java | 20 ++++++------ .../java/lang/annotation/ElementType.java | 30 +++++++++--------- .../IncompleteAnnotationException.java | 14 ++++----- .../java/lang/annotation/Inherited.java | 20 ++++++------ .../java/lang/annotation/Repeatable.java | 14 ++++----- .../java/lang/annotation/Retention.java | 12 +++---- .../java/lang/annotation/RetentionPolicy.java | 8 ++--- .../classes/java/lang/annotation/Target.java | 31 ++++++++++--------- 9 files changed, 86 insertions(+), 83 deletions(-) diff --git a/src/java.base/share/classes/java/lang/annotation/Annotation.java b/src/java.base/share/classes/java/lang/annotation/Annotation.java index cd1ed787ceb0c..0754991383138 100644 --- a/src/java.base/share/classes/java/lang/annotation/Annotation.java +++ b/src/java.base/share/classes/java/lang/annotation/Annotation.java @@ -26,16 +26,16 @@ package java.lang.annotation; /** - * The common interface extended by all annotation types. Note that an + * The common interface extended by all annotation interfaces. Note that an * interface that manually extends this one does not define - * an annotation type. Also note that this interface does not itself - * define an annotation type. + * an annotation interface. Also note that this interface does not itself + * define an annotation interface. * - * More information about annotation types can be found in section {@jls 9.6} of - * The Java Language Specification. + * More information about annotation interfaces can be found in section + * {@jls 9.6} of The Java Language Specification. * * The {@link java.lang.reflect.AnnotatedElement} interface discusses - * compatibility concerns when evolving an annotation type from being + * compatibility concerns when evolving an annotation interface from being * non-repeatable to being repeatable. * * @author Josh Bloch @@ -46,7 +46,7 @@ public interface Annotation { * Returns true if the specified object represents an annotation * that is logically equivalent to this one. In other words, * returns true if the specified object is an instance of the same - * annotation type as this instance, all of whose members are equal + * annotation interface as this instance, all of whose members are equal * to the corresponding member of this annotation, as defined below: * * *

      This implements the 'Language-Tag' production of BCP47, and - * so supports grandfathered (regular and irregular) as well as + * so supports legacy (regular and irregular, referred to as + * "Type: grandfathered" in BCP47) as well as * private use language tags. Stand alone private use tags are * represented as empty language and extension 'x-whatever', - * and grandfathered tags are converted to their canonical replacements + * and legacy tags are converted to their canonical replacements * where they exist. * - *

      Grandfathered tags with canonical replacements are as follows: + *

      Legacy tags with canonical replacements are as follows: * * - * + * * - * + * * * * @@ -1682,13 +1683,13 @@ public String toLanguageTag() { * *
      Grandfathered tags with canonical replacementsLegacy tags with canonical replacements
      grandfathered tagmodern replacement
      legacy tagmodern replacement
      art-lojbanjbo
      * - *

      Grandfathered tags with no modern replacement will be + *

      Legacy tags with no modern replacement will be * converted as follows: * * - * + * * - * + * * * * @@ -1700,7 +1701,7 @@ public String toLanguageTag() { * *
      Grandfathered tags with no modern replacementLegacy tags with no modern replacement
      grandfathered tagconverts to
      legacy tagconverts to
      cel-gaulishxtg-x-cel-gaulish
      * - *

      For a list of all grandfathered tags, see the + *

      For a list of all legacy tags, see the * IANA Language Subtag Registry (search for "Type: grandfathered"). * *

      Note: there is no guarantee that {@code toLanguageTag} @@ -2586,7 +2587,7 @@ public Builder setLocale(Locale locale) { * Resets the Builder to match the provided IETF BCP 47 * language tag. Discards the existing state. Null and the * empty string cause the builder to be reset, like {@link - * #clear}. Grandfathered tags (see {@link + * #clear}. Legacy tags (see {@link * Locale#forLanguageTag}) are converted to their canonical * form before being processed. Otherwise, the language tag * must be well-formed (see {@link Locale}) or an exception is @@ -2838,7 +2839,7 @@ public Builder clearExtensions() { * on this builder. * *

      This applies the conversions listed in {@link Locale#forLanguageTag} - * when constructing a Locale. (Grandfathered tags are handled in + * when constructing a Locale. (Legacy tags are handled in * {@link #setLanguageTag}.) * * @return A Locale. diff --git a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java index 6012e11b780e1..dd37f5174b82a 100644 --- a/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java +++ b/src/java.base/share/classes/jdk/internal/logger/BootstrapLogger.java @@ -847,7 +847,7 @@ public static boolean isBooted() { else return VM.isBooted(); } - // A bit of black magic. We try to find out the nature of the logging + // A bit of magic. We try to find out the nature of the logging // backend without actually loading it. private static enum LoggingBackend { // There is no LoggerFinder and JUL is not present diff --git a/src/java.base/share/classes/sun/util/locale/LanguageTag.java b/src/java.base/share/classes/sun/util/locale/LanguageTag.java index a2d745794abab..1ba11d9dca6d8 100644 --- a/src/java.base/share/classes/sun/util/locale/LanguageTag.java +++ b/src/java.base/share/classes/sun/util/locale/LanguageTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2020, 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 @@ -60,10 +60,10 @@ public class LanguageTag { private List variants = Collections.emptyList(); // variant subtags private List extensions = Collections.emptyList(); // extensions - // Map contains grandfathered tags and its preferred mappings from + // Map contains legacy language tags and its preferred mappings from // http://www.ietf.org/rfc/rfc5646.txt // Keys are lower-case strings. - private static final Map GRANDFATHERED = new HashMap<>(); + private static final Map LEGACY = new HashMap<>(); static { // grandfathered = irregular ; non-redundant tags registered @@ -127,7 +127,7 @@ public class LanguageTag { {"zh-xiang", "hsn"}, }; for (String[] e : entries) { - GRANDFATHERED.put(LocaleUtils.toLowerString(e[0]), e); + LEGACY.put(LocaleUtils.toLowerString(e[0]), e); } } @@ -188,8 +188,8 @@ public static LanguageTag parse(String languageTag, ParseStatus sts) { StringTokenIterator itr; - // Check if the tag is grandfathered - String[] gfmap = GRANDFATHERED.get(LocaleUtils.toLowerString(languageTag)); + // Check if the tag is a legacy language tag + String[] gfmap = LEGACY.get(LocaleUtils.toLowerString(languageTag)); if (gfmap != null) { // use preferred mapping itr = new StringTokenIterator(gfmap[1], SEP); diff --git a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java index 7e288709ac564..b22fc9ea474c1 100644 --- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java +++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java @@ -132,7 +132,7 @@ public class RMIConnectorServer extends JMXConnectorServer { * the serial form of any deserialized object. * The pattern must be in same format as used in * {@link java.io.ObjectInputFilter.Config#createFilter}. - * It may define a white list of permitted classes, a black list of + * It may define an allow-list of permitted classes, a reject-list of * rejected classes, a maximum depth for the deserialized objects, * etc. *

      @@ -149,7 +149,7 @@ public class RMIConnectorServer extends JMXConnectorServer { * classes they use in their serial form. *

      * Care must be taken when defining such a filter, as defining - * a white list too restrictive or a too wide a black list may + * an allow-list that is too narrow or a reject-list that is too wide may * prevent legitimate clients from interoperating with the * {@code JMXConnectorServer}. */ diff --git a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java index 5dacaf3d8f6f5..223986f4c27e2 100644 --- a/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java +++ b/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java @@ -441,7 +441,7 @@ private static ObjectInputFilter.Status registryFilter(ObjectInputFilter.FilterI if (registryFilter != null) { ObjectInputFilter.Status status = registryFilter.checkInput(filterInfo); if (status != ObjectInputFilter.Status.UNDECIDED) { - // The Registry filter can override the built-in white-list + // The Registry filter can override the built-in allow-list return status; } } diff --git a/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java b/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java index b1c9e6e8476b6..f2c1115b8791e 100644 --- a/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java +++ b/src/java.rmi/share/classes/sun/rmi/transport/DGCImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2020, 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 @@ -382,7 +382,7 @@ private static ObjectInputFilter.Status checkInput(ObjectInputFilter.FilterInfo if (dgcFilter != null) { ObjectInputFilter.Status status = dgcFilter.checkInput(filterInfo); if (status != ObjectInputFilter.Status.UNDECIDED) { - // The DGC filter can override the built-in white-list + // The DGC filter can override the built-in allow-list return status; } } diff --git a/test/jdk/java/lang/ClassLoader/Assert.java b/test/jdk/java/lang/ClassLoader/Assert.java index fb2376d45d4b3..d894fef5ef95f 100644 --- a/test/jdk/java/lang/ClassLoader/Assert.java +++ b/test/jdk/java/lang/ClassLoader/Assert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, 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 @@ -62,7 +62,7 @@ public static void main(String[] args) throws Exception { int[] switches = new int[7]; int switchSource = 0; - if (args.length == 0) { // This is master version + if (args.length == 0) { // This is the controller // This code is for an exhaustive test //while(switchSource < 2187) { @@ -92,7 +92,7 @@ public static void main(String[] args) throws Exception { new InputStreamReader(p.getInputStream())); String outString = blah.readLine(); while (outString != null) { - System.out.println("from slave:"+outString); + System.out.println("from BufferedReader:"+outString); outString = blah.readLine(); } } diff --git a/test/jdk/java/lang/management/ClassLoadingMXBean/LoadCounts.java b/test/jdk/java/lang/management/ClassLoadingMXBean/LoadCounts.java index 203e263496ae7..58ef8e36a8d4d 100644 --- a/test/jdk/java/lang/management/ClassLoadingMXBean/LoadCounts.java +++ b/test/jdk/java/lang/management/ClassLoadingMXBean/LoadCounts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,9 +119,9 @@ class SimpleOne {} class SimpleTwo {} class Chain { - Slave slave = new Slave(); + Worker worker = new Worker(); } -class Slave {} +class Worker {} class LeftHand extends ClassLoader { public LeftHand() { diff --git a/test/jdk/java/nio/channels/AsynchronousFileChannel/Lock.java b/test/jdk/java/nio/channels/AsynchronousFileChannel/Lock.java index 13a094e7d2510..93df642c27509 100644 --- a/test/jdk/java/nio/channels/AsynchronousFileChannel/Lock.java +++ b/test/jdk/java/nio/channels/AsynchronousFileChannel/Lock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, 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,13 +45,13 @@ public class Lock { static final Random rand = new Random(); public static void main(String[] args) throws Exception { - if (args.length > 0 && args[0].equals("-lockslave")) { + if (args.length > 0 && args[0].equals("-lockworker")) { int port = Integer.parseInt(args[1]); - runLockSlave(port); + runLockWorker(port); System.exit(0); } - LockSlaveMirror slave = startLockSlave(); + LockWorkerMirror worker = startLockWorker(); try { // create temporary file @@ -59,31 +59,31 @@ public static void main(String[] args) throws Exception { blah.deleteOnExit(); // run tests - testLockProtocol(blah, slave); - testAsyncClose(blah, slave); + testLockProtocol(blah, worker); + testAsyncClose(blah, worker); // eagerly clean-up blah.delete(); } finally { - slave.shutdown(); + worker.shutdown(); } } // test locking protocol - static void testLockProtocol(File file, LockSlaveMirror slave) + static void testLockProtocol(File file, LockWorkerMirror worker) throws Exception { FileLock fl; - // slave VM opens file and acquires exclusive lock - slave.open(file.getPath()).lock(); + // worker VM opens file and acquires exclusive lock + worker.open(file.getPath()).lock(); AsynchronousFileChannel ch = AsynchronousFileChannel .open(file.toPath(), READ, WRITE); // this VM tries to acquire lock - // (lock should not be acquire until released by slave VM) + // (lock should not be acquire until released by worker VM) Future result = ch.lock(); try { result.get(2, TimeUnit.SECONDS); @@ -91,15 +91,15 @@ static void testLockProtocol(File file, LockSlaveMirror slave) } catch (TimeoutException x) { } - // slave VM releases lock - slave.unlock(); + // worker VM releases lock + worker.unlock(); // this VM should now acquire lock fl = result.get(); fl.release(); - // slave VM acquires lock on range - slave.lock(0, 10, false); + // worker VM acquires lock on range + worker.lock(0, 10, false); // this VM acquires lock on non-overlapping range fl = ch.lock(10, 10, false).get(); @@ -107,19 +107,19 @@ static void testLockProtocol(File file, LockSlaveMirror slave) // done ch.close(); - slave.close(); + worker.close(); } // test close of channel with outstanding lock operation - static void testAsyncClose(File file, LockSlaveMirror slave) throws Exception { - // slave VM opens file and acquires exclusive lock - slave.open(file.getPath()).lock(); + static void testAsyncClose(File file, LockWorkerMirror worker) throws Exception { + // worker VM opens file and acquires exclusive lock + worker.open(file.getPath()).lock(); for (int i=0; i<100; i++) { AsynchronousFileChannel ch = AsynchronousFileChannel .open(file.toPath(), READ, WRITE); - // try to lock file (should not complete because file is locked by slave) + // try to lock file (should not complete because file is locked by worker) Future result = ch.lock(); try { result.get(rand.nextInt(100), TimeUnit.MILLISECONDS); @@ -142,12 +142,12 @@ static void testAsyncClose(File file, LockSlaveMirror slave) throws Exception { } } - slave.close(); + worker.close(); } - // starts a "lock slave" in another process, returning a mirror object to - // control the slave - static LockSlaveMirror startLockSlave() throws Exception { + // starts a "lock worker" in another process, returning a mirror object to + // control the worker + static LockWorkerMirror startLockWorker() throws Exception { ServerSocketChannel ssc = ServerSocketChannel.open() .bind(new InetSocketAddress(0)); int port = ((InetSocketAddress)(ssc.getLocalAddress())).getPort(); @@ -159,29 +159,29 @@ static LockSlaveMirror startLockSlave() throws Exception { String testClasses = System.getProperty("test.classes"); if (testClasses != null) command += " -cp " + testClasses; - command += " Lock -lockslave " + port; + command += " Lock -lockworker " + port; Process p = Runtime.getRuntime().exec(command); IOHandler.handle(p.getInputStream()); IOHandler.handle(p.getErrorStream()); - // wait for slave to connect + // wait for worker to connect SocketChannel sc = ssc.accept(); - return new LockSlaveMirror(sc); + return new LockWorkerMirror(sc); } - // commands that the slave understands + // commands that the worker understands static final String OPEN_CMD = "open"; static final String CLOSE_CMD = "close"; static final String LOCK_CMD = "lock"; static final String UNLOCK_CMD = "unlock"; static final char TERMINATOR = ';'; - // provides a proxy to a "lock slave" - static class LockSlaveMirror { + // provides a proxy to a "lock worker" + static class LockWorkerMirror { private final SocketChannel sc; - LockSlaveMirror(SocketChannel sc) { + LockWorkerMirror(SocketChannel sc) { this.sc = sc; } @@ -207,7 +207,7 @@ private void sendCommand(String cmd, String... params) throw new RuntimeException("Terminated expected"); } - LockSlaveMirror open(String file) throws IOException { + LockWorkerMirror open(String file) throws IOException { sendCommand(OPEN_CMD, file); return this; } @@ -216,20 +216,20 @@ void close() throws IOException { sendCommand(CLOSE_CMD); } - LockSlaveMirror lock() throws IOException { + LockWorkerMirror lock() throws IOException { sendCommand(LOCK_CMD); return this; } - LockSlaveMirror lock(long position, long size, boolean shared) + LockWorkerMirror lock(long position, long size, boolean shared) throws IOException { sendCommand(LOCK_CMD, position + "," + size + "," + shared); return this; } - LockSlaveMirror unlock() throws IOException { + LockWorkerMirror unlock() throws IOException { sendCommand(UNLOCK_CMD); return this; } @@ -268,8 +268,8 @@ public void run() { } } - // slave process that responds to simple commands a socket connection - static void runLockSlave(int port) throws Exception { + // worker process that responds to simple commands a socket connection + static void runLockWorker(int port) throws Exception { // establish connection to parent SocketChannel sc = SocketChannel.open(new InetSocketAddress(port)); diff --git a/test/jdk/java/nio/channels/SocketChannel/CloseRegisteredChannel.java b/test/jdk/java/nio/channels/SocketChannel/CloseRegisteredChannel.java index 04b752fd79dc9..ba0adb0f0b7fc 100644 --- a/test/jdk/java/nio/channels/SocketChannel/CloseRegisteredChannel.java +++ b/test/jdk/java/nio/channels/SocketChannel/CloseRegisteredChannel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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,8 +42,8 @@ public static void main(String[] args) throws Exception { SocketChannel client = SocketChannel.open (); client.connect (new InetSocketAddress (InetAddress.getLoopbackAddress(), port)); - SocketChannel slave = server.accept (); - slave.configureBlocking (true); + SocketChannel peer = server.accept(); + peer.configureBlocking(true); Selector selector = Selector.open (); client.configureBlocking (false); @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { client.close(); //System.out.println ("client.isOpen = " + client.isOpen()); System.out.println ("Will hang here..."); - int nb = slave.read (ByteBuffer.allocate (1024)); + int nb = peer.read(ByteBuffer.allocate (1024)); //System.out.println("read nb=" + nb); selector.close(); diff --git a/test/jdk/java/util/Locale/LSRDataTest.java b/test/jdk/java/util/Locale/LSRDataTest.java index a9633b77b28b9..81edf48b9b046 100644 --- a/test/jdk/java/util/Locale/LSRDataTest.java +++ b/test/jdk/java/util/Locale/LSRDataTest.java @@ -151,7 +151,7 @@ private static void processDataAndGenerateMaps(String type, + " A region/variant subtag \"" + preferred + "\" is registered for more than one subtags."); } - } else { // language, extlang, grandfathered, and redundant + } else { // language, extlang, legacy, and redundant if (!singleLangEquivMap.containsKey(preferred) && !multiLangEquivsMap.containsKey(preferred)) { // new entry add it into single equiv map diff --git a/test/jdk/java/util/Locale/LocaleEnhanceTest.java b/test/jdk/java/util/Locale/LocaleEnhanceTest.java index e0a671d5d880f..692a4e469ceca 100644 --- a/test/jdk/java/util/Locale/LocaleEnhanceTest.java +++ b/test/jdk/java/util/Locale/LocaleEnhanceTest.java @@ -504,7 +504,7 @@ public void testToLanguageTag() { public void testForLanguageTag() { // forLanguageTag implements the 'Language-Tag' production of - // BCP47, so it handles private use and grandfathered tags, + // BCP47, so it handles private use and legacy language tags, // unlike locale builder. Tags listed below (except for the // sample private use tags) come from 4646bis Feb 29, 2009. @@ -514,7 +514,7 @@ public void testForLanguageTag() { { "x-a-b-c", "x-a-b-c" }, { "x-a-12345678", "x-a-12345678" }, - // grandfathered tags with preferred mappings + // legacy language tags with preferred mappings { "i-ami", "ami" }, { "i-bnn", "bnn" }, { "i-hak", "hak" }, @@ -536,7 +536,7 @@ public void testForLanguageTag() { { "zh-min-nan", "nan" }, { "zh-xiang", "hsn" }, - // grandfathered irregular tags, no preferred mappings, drop illegal fields + // irregular legacy language tags, no preferred mappings, drop illegal fields // from end. If no subtag is mappable, fallback to 'und' { "i-default", "en-x-i-default" }, { "i-enochian", "x-i-enochian" }, @@ -548,7 +548,7 @@ public void testForLanguageTag() { for (int i = 0; i < tests.length; ++i) { String[] test = tests[i]; Locale locale = Locale.forLanguageTag(test[0]); - assertEquals("grandfathered case " + i, test[1], locale.toLanguageTag()); + assertEquals("legacy language tag case " + i, test[1], locale.toLanguageTag()); } // forLanguageTag ignores everything past the first place it encounters diff --git a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java index 9dc217eaa7cdd..1c688b2252431 100644 --- a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java +++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -238,7 +238,7 @@ public static void main(String[] args) throws Exception { boolean retry = false; do { try { - // blacklist String + // filter DefaultAgentFilterTest$MyTestObject testDefaultAgent("mgmt1.properties"); System.out.println("----\tTest FAILED !!"); throw new RuntimeException("---" + DefaultAgentFilterTest.class.getName() + " - No exception reported"); @@ -264,7 +264,7 @@ public static void main(String[] args) throws Exception { retry = false; do { try { - // blacklist non-existent class + // filter non-existent class testDefaultAgent("mgmt2.properties"); System.out.println("----\tTest PASSED !!"); } catch (Exception ex) { From 643ddc1320fdace9476c884d2e9d4e71deb5b0b1 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 17 Dec 2020 03:24:40 +0000 Subject: [PATCH 271/504] 8257882: Implement linkToNative intrinsic on AArch64 Reviewed-by: jvernee, mcimadamore, aph --- src/hotspot/cpu/aarch64/aarch64.ad | 24 ++- src/hotspot/cpu/aarch64/frame_aarch64.cpp | 5 + .../gc/z/zBarrierSetAssembler_aarch64.cpp | 4 +- .../cpu/aarch64/javaFrameAnchor_aarch64.hpp | 9 + .../cpu/aarch64/macroAssembler_aarch64.cpp | 5 +- .../cpu/aarch64/macroAssembler_aarch64.hpp | 4 +- src/hotspot/cpu/aarch64/register_aarch64.hpp | 81 +++++---- .../cpu/aarch64/sharedRuntime_aarch64.cpp | 172 +++++++++++++++++- .../cpu/aarch64/stubGenerator_aarch64.cpp | 4 +- .../templateInterpreterGenerator_aarch64.cpp | 5 +- .../linux_aarch64/thread_linux_aarch64.hpp | 4 + .../thread_windows_aarch64.hpp | 4 + test/jdk/java/foreign/TestIntrinsics.java | 2 +- 13 files changed, 266 insertions(+), 57 deletions(-) diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index 2d5ddfe86f15f..26c6b4e4b7270 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -1772,8 +1772,13 @@ int MachCallRuntimeNode::ret_addr_offset() { } int MachCallNativeNode::ret_addr_offset() { - ShouldNotReachHere(); - return -1; + // This is implemented using aarch64_enc_java_to_runtime as above. + CodeBlob *cb = CodeCache::find_blob(_entry_point); + if (cb) { + return 1 * NativeInstruction::instruction_size; + } else { + return 6 * NativeInstruction::instruction_size; + } } // Indicate if the safepoint node needs the polling page as an input @@ -16044,6 +16049,21 @@ instruct CallLeafNoFPDirect(method meth) ins_pipe(pipe_class_call); %} +instruct CallNativeDirect(method meth) +%{ + match(CallNative); + + effect(USE meth); + + ins_cost(CALL_COST); + + format %{ "CALL, native $meth" %} + + ins_encode( aarch64_enc_java_to_runtime(meth) ); + + ins_pipe(pipe_class_call); +%} + // Tail Call; Jump from runtime stub to Java code. // Also known as an 'interprocedural jump'. // Target of jump will eventually return to caller. diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp index 15c5e16f38060..e8ba2d180435d 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp @@ -354,6 +354,11 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const { assert(map->include_argument_oops(), "should be set by clear"); vmassert(jfa->last_Java_pc() != NULL, "not walkable"); frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); + + if (jfa->saved_fp_address()) { + update_map_with_saved_link(map, jfa->saved_fp_address()); + } + return fr; } diff --git a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp index 7ba655077ed43..eebf8089d9831 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp @@ -314,7 +314,7 @@ class ZSaveLiveRegisters { private: MacroAssembler* const _masm; RegSet _gp_regs; - RegSet _fp_regs; + FloatRegSet _fp_regs; public: void initialize(ZLoadBarrierStubC2* stub) { @@ -327,7 +327,7 @@ class ZSaveLiveRegisters { if (vm_reg->is_Register()) { _gp_regs += RegSet::of(vm_reg->as_Register()); } else if (vm_reg->is_FloatRegister()) { - _fp_regs += RegSet::of((Register)vm_reg->as_FloatRegister()); + _fp_regs += FloatRegSet::of(vm_reg->as_FloatRegister()); } else { fatal("Unknown register type"); } diff --git a/src/hotspot/cpu/aarch64/javaFrameAnchor_aarch64.hpp b/src/hotspot/cpu/aarch64/javaFrameAnchor_aarch64.hpp index 6ff3c037407e6..2d5b9a62b455f 100644 --- a/src/hotspot/cpu/aarch64/javaFrameAnchor_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/javaFrameAnchor_aarch64.hpp @@ -31,6 +31,9 @@ // FP value associated with _last_Java_sp: intptr_t* volatile _last_Java_fp; // pointer is volatile not what it points to + // (Optional) location of saved FP register, which GCs want to inspect + intptr_t** volatile _saved_fp_address; + public: // Each arch must define reset, save, restore // These are used by objects that only care about: @@ -44,6 +47,7 @@ OrderAccess::release(); _last_Java_fp = NULL; _last_Java_pc = NULL; + _saved_fp_address = NULL; } void copy(JavaFrameAnchor* src) { @@ -62,6 +66,8 @@ _last_Java_pc = src->_last_Java_pc; // Must be last so profiler will always see valid frame if has_last_frame() is true _last_Java_sp = src->_last_Java_sp; + + _saved_fp_address = src->_saved_fp_address; } bool walkable(void) { return _last_Java_sp != NULL && _last_Java_pc != NULL; } @@ -72,9 +78,12 @@ address last_Java_pc(void) { return _last_Java_pc; } + intptr_t** saved_fp_address(void) const { return _saved_fp_address; } + private: static ByteSize last_Java_fp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_fp); } + static ByteSize saved_fp_address_offset() { return byte_offset_of(JavaFrameAnchor, _saved_fp_address); } public: diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 4263329ddfdf2..31435b1b50f1b 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -318,6 +318,8 @@ void MacroAssembler::reset_last_Java_frame(bool clear_fp) { // Always clear the pc because it could have been set by make_walkable() str(zr, Address(rthread, JavaThread::last_Java_pc_offset())); + + str(zr, Address(rthread, JavaThread::saved_fp_address_offset())); } // Calls to C land @@ -5293,8 +5295,9 @@ void MacroAssembler::cache_wbsync(bool is_pre) { } void MacroAssembler::verify_sve_vector_length() { + // Make sure that native code does not change SVE vector length. + if (!UseSVE) return; Label verify_ok; - assert(UseSVE > 0, "should only be used for SVE"); movw(rscratch1, zr); sve_inc(rscratch1, B); subsw(zr, rscratch1, VM_Version::get_initial_sve_vector_length()); diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index c1fad8b10b8cd..3f4561edc25ff 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -474,8 +474,8 @@ class MacroAssembler: public Assembler { void push(RegSet regs, Register stack) { if (regs.bits()) push(regs.bits(), stack); } void pop(RegSet regs, Register stack) { if (regs.bits()) pop(regs.bits(), stack); } - void push_fp(RegSet regs, Register stack) { if (regs.bits()) push_fp(regs.bits(), stack); } - void pop_fp(RegSet regs, Register stack) { if (regs.bits()) pop_fp(regs.bits(), stack); } + void push_fp(FloatRegSet regs, Register stack) { if (regs.bits()) push_fp(regs.bits(), stack); } + void pop_fp(FloatRegSet regs, Register stack) { if (regs.bits()) pop_fp(regs.bits(), stack); } static RegSet call_clobbered_registers(); diff --git a/src/hotspot/cpu/aarch64/register_aarch64.hpp b/src/hotspot/cpu/aarch64/register_aarch64.hpp index c567791e593b9..5a152d62777d8 100644 --- a/src/hotspot/cpu/aarch64/register_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/register_aarch64.hpp @@ -63,10 +63,6 @@ class RegisterImpl: public AbstractRegisterImpl { bool has_byte_register() const { return 0 <= (intptr_t)this && (intptr_t)this < number_of_byte_registers; } const char* name() const; int encoding_nocheck() const { return (intptr_t)this; } - - // Return the bit which represents this register. This is intended - // to be ORed into a bitmask: for usage see class RegSet below. - uint64_t bit(bool should_set = true) const { return should_set ? 1 << encoding() : 0; } }; // The integer registers of the aarch64 architecture @@ -304,91 +300,93 @@ class ConcreteRegisterImpl : public AbstractRegisterImpl { static const int max_pr; }; -class RegSetIterator; +template class RegSetIterator; // A set of registers -class RegSet { +template +class AbstractRegSet { uint32_t _bitset; - RegSet(uint32_t bitset) : _bitset(bitset) { } + AbstractRegSet(uint32_t bitset) : _bitset(bitset) { } public: - RegSet() : _bitset(0) { } + AbstractRegSet() : _bitset(0) { } - RegSet(Register r1) : _bitset(r1->bit()) { } + AbstractRegSet(RegImpl r1) : _bitset(1 << r1->encoding()) { } - RegSet operator+(const RegSet aSet) const { - RegSet result(_bitset | aSet._bitset); + AbstractRegSet operator+(const AbstractRegSet aSet) const { + AbstractRegSet result(_bitset | aSet._bitset); return result; } - RegSet operator-(const RegSet aSet) const { - RegSet result(_bitset & ~aSet._bitset); + AbstractRegSet operator-(const AbstractRegSet aSet) const { + AbstractRegSet result(_bitset & ~aSet._bitset); return result; } - RegSet &operator+=(const RegSet aSet) { + AbstractRegSet &operator+=(const AbstractRegSet aSet) { *this = *this + aSet; return *this; } - RegSet &operator-=(const RegSet aSet) { + AbstractRegSet &operator-=(const AbstractRegSet aSet) { *this = *this - aSet; return *this; } - static RegSet of(Register r1) { - return RegSet(r1); + static AbstractRegSet of(RegImpl r1) { + return AbstractRegSet(r1); } - static RegSet of(Register r1, Register r2) { + static AbstractRegSet of(RegImpl r1, RegImpl r2) { return of(r1) + r2; } - static RegSet of(Register r1, Register r2, Register r3) { + static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3) { return of(r1, r2) + r3; } - static RegSet of(Register r1, Register r2, Register r3, Register r4) { + static AbstractRegSet of(RegImpl r1, RegImpl r2, RegImpl r3, RegImpl r4) { return of(r1, r2, r3) + r4; } - static RegSet range(Register start, Register end) { + static AbstractRegSet range(RegImpl start, RegImpl end) { uint32_t bits = ~0; bits <<= start->encoding(); bits <<= 31 - end->encoding(); bits >>= 31 - end->encoding(); - return RegSet(bits); + return AbstractRegSet(bits); } uint32_t bits() const { return _bitset; } private: - Register first() { - uint32_t first = _bitset & -_bitset; - return first ? as_Register(exact_log2(first)) : noreg; - } + RegImpl first(); public: - friend class RegSetIterator; + friend class RegSetIterator; - RegSetIterator begin(); + RegSetIterator begin(); }; +typedef AbstractRegSet RegSet; +typedef AbstractRegSet FloatRegSet; + +template class RegSetIterator { - RegSet _regs; + AbstractRegSet _regs; public: - RegSetIterator(RegSet x): _regs(x) {} + RegSetIterator(AbstractRegSet x): _regs(x) {} RegSetIterator(const RegSetIterator& mit) : _regs(mit._regs) {} RegSetIterator& operator++() { - Register r = _regs.first(); - if (r != noreg) + RegImpl r = _regs.first(); + if (r->is_valid()) _regs -= r; return *this; } @@ -400,13 +398,26 @@ class RegSetIterator { return ! (rhs == *this); } - Register operator*() { + RegImpl operator*() { return _regs.first(); } }; -inline RegSetIterator RegSet::begin() { - return RegSetIterator(*this); +template +inline RegSetIterator AbstractRegSet::begin() { + return RegSetIterator(*this); +} + +template <> +inline Register AbstractRegSet::first() { + uint32_t first = _bitset & -_bitset; + return first ? as_Register(exact_log2(first)) : noreg; +} + +template <> +inline FloatRegister AbstractRegSet::first() { + uint32_t first = _bitset & -_bitset; + return first ? as_FloatRegister(exact_log2(first)) : fnoreg; } #endif // CPU_AARCH64_REGISTER_AARCH64_HPP diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index ce0c617e325db..59fbff768cdab 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -1855,10 +1855,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // Force this write out before the read below __ dmb(Assembler::ISH); - if (UseSVE > 0) { - // Make sure that jni code does not change SVE vector length. - __ verify_sve_vector_length(); - } + __ verify_sve_vector_length(); // Check for safepoint operation in progress and/or pending suspend requests. { @@ -3071,9 +3068,168 @@ void OptoRuntime::generate_exception_blob() { } #endif // COMPILER2 +// --------------------------------------------------------------- + +class NativeInvokerGenerator : public StubCodeGenerator { + address _call_target; + int _shadow_space_bytes; + + const GrowableArray& _input_registers; + const GrowableArray& _output_registers; +public: + NativeInvokerGenerator(CodeBuffer* buffer, + address call_target, + int shadow_space_bytes, + const GrowableArray& input_registers, + const GrowableArray& output_registers) + : StubCodeGenerator(buffer, PrintMethodHandleStubs), + _call_target(call_target), + _shadow_space_bytes(shadow_space_bytes), + _input_registers(input_registers), + _output_registers(output_registers) {} + void generate(); + +private: +#ifdef ASSERT + bool target_uses_register(VMReg reg) { + return _input_registers.contains(reg) || _output_registers.contains(reg); + } +#endif +}; + +static const int native_invoker_code_size = 1024; + BufferBlob* SharedRuntime::make_native_invoker(address call_target, - int shadow_space_bytes, - const GrowableArray& input_registers, - const GrowableArray& output_registers) { - return NULL; + int shadow_space_bytes, + const GrowableArray& input_registers, + const GrowableArray& output_registers) { + BufferBlob* _invoke_native_blob = + BufferBlob::create("nep_invoker_blob", native_invoker_code_size); + if (_invoke_native_blob == NULL) + return NULL; // allocation failure + + CodeBuffer code(_invoke_native_blob); + NativeInvokerGenerator g(&code, call_target, shadow_space_bytes, input_registers, output_registers); + g.generate(); + code.log_section_sizes("nep_invoker_blob"); + + return _invoke_native_blob; +} + +void NativeInvokerGenerator::generate() { + assert(!(target_uses_register(rscratch1->as_VMReg()) + || target_uses_register(rscratch2->as_VMReg()) + || target_uses_register(rthread->as_VMReg())), + "Register conflict"); + + MacroAssembler* masm = _masm; + + __ set_last_Java_frame(sp, noreg, lr, rscratch1); + + __ enter(); + + // Store a pointer to the previous R29 (RFP) saved on the stack as it + // may contain an oop if PreserveFramePointer is off. This value is + // retrieved later by frame::sender_for_entry_frame() when the stack + // is walked. + __ mov(rscratch1, sp); + __ str(rscratch1, Address(rthread, JavaThread::saved_fp_address_offset())); + + // State transition + __ mov(rscratch1, _thread_in_native); + __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset())); + __ stlrw(rscratch1, rscratch2); + + assert(_shadow_space_bytes == 0, "not expecting shadow space on AArch64"); + + rt_call(masm, _call_target); + + __ mov(rscratch1, _thread_in_native_trans); + __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset())); + + // Force this write out before the read below + __ membar(Assembler::LoadLoad | Assembler::LoadStore | + Assembler::StoreLoad | Assembler::StoreStore); + + __ verify_sve_vector_length(); + + Label L_after_safepoint_poll; + Label L_safepoint_poll_slow_path; + + __ safepoint_poll(L_safepoint_poll_slow_path, true /* at_return */, true /* acquire */, false /* in_nmethod */); + + __ ldrw(rscratch1, Address(rthread, JavaThread::suspend_flags_offset())); + __ cbnzw(rscratch1, L_safepoint_poll_slow_path); + + __ bind(L_after_safepoint_poll); + + // change thread state + __ mov(rscratch1, _thread_in_Java); + __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset())); + __ stlrw(rscratch1, rscratch2); + + __ block_comment("reguard stack check"); + Label L_reguard; + Label L_after_reguard; + __ ldrb(rscratch1, Address(rthread, JavaThread::stack_guard_state_offset())); + __ cmpw(rscratch1, StackOverflow::stack_guard_yellow_reserved_disabled); + __ br(Assembler::EQ, L_reguard); + __ bind(L_after_reguard); + + __ reset_last_Java_frame(true); + + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(lr); + + ////////////////////////////////////////////////////////////////////////////// + + __ block_comment("{ L_safepoint_poll_slow_path"); + __ bind(L_safepoint_poll_slow_path); + + // Need to save the native result registers around any runtime calls. + RegSet spills; + FloatRegSet fp_spills; + for (int i = 0; i < _output_registers.length(); i++) { + VMReg output = _output_registers.at(i); + if (output->is_Register()) { + spills += RegSet::of(output->as_Register()); + } else if (output->is_FloatRegister()) { + fp_spills += FloatRegSet::of(output->as_FloatRegister()); + } + } + + __ push(spills, sp); + __ push_fp(fp_spills, sp); + + __ mov(c_rarg0, rthread); + assert(frame::arg_reg_save_area_bytes == 0, "not expecting frame reg save area"); + __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans))); + __ blr(rscratch1); + + __ pop_fp(fp_spills, sp); + __ pop(spills, sp); + + __ b(L_after_safepoint_poll); + __ block_comment("} L_safepoint_poll_slow_path"); + + ////////////////////////////////////////////////////////////////////////////// + + __ block_comment("{ L_reguard"); + __ bind(L_reguard); + + __ push(spills, sp); + __ push_fp(fp_spills, sp); + + rt_call(masm, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)); + + __ pop_fp(fp_spills, sp); + __ pop(spills, sp); + + __ b(L_after_reguard); + + __ block_comment("} L_reguard"); + + ////////////////////////////////////////////////////////////////////////////// + + __ flush(); } diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index 3022aacd40db5..6bb9ca308d535 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1319,7 +1319,7 @@ class StubGenerator: public StubCodeGenerator { = MacroAssembler::call_clobbered_registers() - rscratch1; __ mov(rscratch1, (uint64_t)0xdeadbeef); __ orr(rscratch1, rscratch1, rscratch1, Assembler::LSL, 32); - for (RegSetIterator it = clobbered.begin(); *it != noreg; ++it) { + for (RegSetIterator<> it = clobbered.begin(); *it != noreg; ++it) { __ mov(*it, rscratch1); } #endif @@ -5696,7 +5696,7 @@ class StubGenerator: public StubCodeGenerator { // Register allocation - RegSetIterator regs = (RegSet::range(r0, r26) - r18_tls).begin(); + RegSetIterator<> regs = (RegSet::range(r0, r26) - r18_tls).begin(); Pa_base = *regs; // Argument registers if (squaring) Pb_base = Pa_base; diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp index 2f5701e161125..486fd4077163a 100644 --- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp @@ -1373,10 +1373,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ push(dtos); __ push(ltos); - if (UseSVE > 0) { - // Make sure that jni code does not change SVE vector length. - __ verify_sve_vector_length(); - } + __ verify_sve_vector_length(); // change thread state __ mov(rscratch1, _thread_in_native_trans); diff --git a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp index 5a1f273c54866..8c52a6a99454c 100644 --- a/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp +++ b/src/hotspot/os_cpu/linux_aarch64/thread_linux_aarch64.hpp @@ -39,6 +39,10 @@ return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_fp_offset(); } + static ByteSize saved_fp_address_offset() { + return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::saved_fp_address_offset(); + } + bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); diff --git a/src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.hpp b/src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.hpp index bcf43c8b08829..64d7a65e62a64 100644 --- a/src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.hpp +++ b/src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.hpp @@ -38,6 +38,10 @@ return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_fp_offset(); } + static ByteSize saved_fp_address_offset() { + return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::saved_fp_address_offset(); + } + bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); diff --git a/test/jdk/java/foreign/TestIntrinsics.java b/test/jdk/java/foreign/TestIntrinsics.java index 6c3a2b96db7d1..01bf3c9212a78 100644 --- a/test/jdk/java/foreign/TestIntrinsics.java +++ b/test/jdk/java/foreign/TestIntrinsics.java @@ -23,7 +23,7 @@ /* * @test - * @requires os.arch=="amd64" | os.arch=="x86_64" + * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" * @run testng/othervm * -Djdk.internal.foreign.ProgrammableInvoker.USE_SPEC=true * -Djdk.internal.foreign.ProgrammableInvoker.USE_INTRINSICS=true From 513269d24e806a1f007dd1c3394f3ca20fbb132d Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 17 Dec 2020 03:32:46 +0000 Subject: [PATCH 272/504] 8196093: javax/swing/JComboBox/8072767/bug8072767.java fails Reviewed-by: prr --- test/jdk/ProblemList.txt | 1 - .../swing/JComboBox/8057893/bug8057893.java | 5 +++-- .../swing/JComboBox/8072767/bug8072767.java | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index c5fd9f24febec..5d32911944308 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -738,7 +738,6 @@ javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all -javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all diff --git a/test/jdk/javax/swing/JComboBox/8057893/bug8057893.java b/test/jdk/javax/swing/JComboBox/8057893/bug8057893.java index 5755d0998918c..3868ca361034b 100644 --- a/test/jdk/javax/swing/JComboBox/8057893/bug8057893.java +++ b/test/jdk/javax/swing/JComboBox/8057893/bug8057893.java @@ -35,7 +35,6 @@ * @test * @key headful * @bug 8057893 - * @author Alexander Scherbatiy * @summary JComboBox actionListener never receives "comboBoxEdited" * from getActionCommand * @run main bug8057893 @@ -47,7 +46,7 @@ public class bug8057893 { public static void main(String[] args) throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(50); + robot.setAutoDelay(100); EventQueue.invokeAndWait(() -> { frame = new JFrame(); @@ -66,10 +65,12 @@ public void actionPerformed(ActionEvent e) { frame.add(comboBox); frame.pack(); frame.setVisible(true); + frame.setLocationRelativeTo(null); comboBox.requestFocusInWindow(); }); robot.waitForIdle(); + robot.delay(1000); robot.keyPress(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A); diff --git a/test/jdk/javax/swing/JComboBox/8072767/bug8072767.java b/test/jdk/javax/swing/JComboBox/8072767/bug8072767.java index 9cfddd46cec83..56b6a99b062d9 100644 --- a/test/jdk/javax/swing/JComboBox/8072767/bug8072767.java +++ b/test/jdk/javax/swing/JComboBox/8072767/bug8072767.java @@ -39,7 +39,6 @@ * @test * @key headful * @bug 8072767 - * @author Alexander Scherbatiy * @summary DefaultCellEditor for comboBox creates ActionEvent with wrong source * object * @run main bug8072767 @@ -52,22 +51,23 @@ public class bug8072767 { private static JFrame frame; private static JTable table; - private static Point point; + private static volatile Point point; private static boolean testPass; public static void main(String[] args) throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(50); + robot.setAutoDelay(100); SwingUtilities.invokeAndWait(bug8072767::createAndShowGUI); robot.waitForIdle(); + robot.delay(1000); SwingUtilities.invokeAndWait(() -> { point = table.getLocationOnScreen(); Rectangle rect = table.getCellRect(0, 0, true); point.translate(rect.width / 2, rect.height / 2); }); robot.mouseMove(point.x, point.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_1); @@ -80,8 +80,8 @@ public static void main(String[] args) throws Exception { }); robot.mouseMove(point.x, point.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); SwingUtilities.invokeAndWait(() -> { @@ -98,7 +98,6 @@ private static void createAndShowGUI() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); - frame.setLocation(100, 100); table = new JTable( new String[][]{{TEST1}}, new String[]{"Header"}); @@ -108,5 +107,6 @@ private static void createAndShowGUI() { new DefaultCellEditor(comboBox)); frame.getContentPane().add(table); frame.setVisible(true); + frame.setLocationRelativeTo(null); } } From d77b49d1721b961cf79bcad7b213d72090073885 Mon Sep 17 00:00:00 2001 From: Prasanta Sadhukhan Date: Thu, 17 Dec 2020 04:36:02 +0000 Subject: [PATCH 273/504] 8258233: Reenable another fixed problemlisted test Reviewed-by: trebari, jdv --- test/jdk/ProblemList.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 5d32911944308..1372c377941b9 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -756,7 +756,6 @@ javax/swing/JFileChooser/8062561/bug8062561.java 8196466 linux-all,macosx-all javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java 8225045 linux-all javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all -javax/swing/JFileChooser/6868611/bug6868611.java 7059834 windows-all javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java 8065099,8208565 macosx-all,linux-all javax/swing/UIDefaults/6302464/bug6302464.java 8199079 macosx-all javax/swing/PopupFactory/8048506/bug8048506.java 8202660 windows-all From c11525a45e68f44c746859c1a699d185d51e7f91 Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Thu, 17 Dec 2020 04:42:19 +0000 Subject: [PATCH 274/504] 8257772: Vectorizing clear memory operation using AVX-512 masked operations Reviewed-by: thartmann, kvn --- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 195 +++++++++++++++--- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 17 +- src/hotspot/cpu/x86/vm_version_x86.cpp | 8 + src/hotspot/cpu/x86/x86.ad | 1 + src/hotspot/cpu/x86/x86_32.ad | 14 +- src/hotspot/cpu/x86/x86_64.ad | 14 +- src/hotspot/share/opto/memnode.cpp | 2 + .../bench/vm/compiler/ClearMemory.java | 178 ++++++++++++++++ 8 files changed, 401 insertions(+), 28 deletions(-) create mode 100644 test/micro/org/openjdk/bench/vm/compiler/ClearMemory.java diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 216add0e598d6..f1000eb32397d 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -4928,12 +4928,17 @@ void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_ } } -// clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers -void MacroAssembler::xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp) { +#if COMPILER2_OR_JVMCI + +// clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM/ZMM registers +void MacroAssembler::xmm_clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp) { // cnt - number of qwords (8-byte words). // base - start address, qword aligned. Label L_zero_64_bytes, L_loop, L_sloop, L_tail, L_end; - if (UseAVX >= 2) { + bool use64byteVector = MaxVectorSize == 64 && AVX3Threshold == 0; + if (use64byteVector) { + vpxor(xtmp, xtmp, xtmp, AVX_512bit); + } else if (MaxVectorSize >= 32) { vpxor(xtmp, xtmp, xtmp, AVX_256bit); } else { pxor(xtmp, xtmp); @@ -4941,9 +4946,8 @@ void MacroAssembler::xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp jmp(L_zero_64_bytes); BIND(L_loop); - if (UseAVX >= 2) { - vmovdqu(Address(base, 0), xtmp); - vmovdqu(Address(base, 32), xtmp); + if (MaxVectorSize >= 32) { + fill64_avx(base, 0, xtmp, use64byteVector); } else { movdqu(Address(base, 0), xtmp); movdqu(Address(base, 16), xtmp); @@ -4955,14 +4959,22 @@ void MacroAssembler::xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp BIND(L_zero_64_bytes); subptr(cnt, 8); jccb(Assembler::greaterEqual, L_loop); - addptr(cnt, 4); - jccb(Assembler::less, L_tail); - // Copy trailing 32 bytes - if (UseAVX >= 2) { - vmovdqu(Address(base, 0), xtmp); - } else { - movdqu(Address(base, 0), xtmp); - movdqu(Address(base, 16), xtmp); + + // Copy trailing 64 bytes + if (use64byteVector) { + addptr(cnt, 8); + jccb(Assembler::equal, L_end); + fill64_masked_avx(3, base, 0, xtmp, k2, cnt, rtmp, true); + jmp(L_end); + } else { + addptr(cnt, 4); + jccb(Assembler::less, L_tail); + if (MaxVectorSize >= 32) { + vmovdqu(Address(base, 0), xtmp); + } else { + movdqu(Address(base, 0), xtmp); + movdqu(Address(base, 16), xtmp); + } } addptr(base, 32); subptr(cnt, 4); @@ -4970,19 +4982,94 @@ void MacroAssembler::xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp BIND(L_tail); addptr(cnt, 4); jccb(Assembler::lessEqual, L_end); - decrement(cnt); + if (UseAVX > 2 && MaxVectorSize >= 32 && VM_Version::supports_avx512vl()) { + fill32_masked_avx(3, base, 0, xtmp, k2, cnt, rtmp); + } else { + decrement(cnt); - BIND(L_sloop); - movq(Address(base, 0), xtmp); - addptr(base, 8); - decrement(cnt); - jccb(Assembler::greaterEqual, L_sloop); + BIND(L_sloop); + movq(Address(base, 0), xtmp); + addptr(base, 8); + decrement(cnt); + jccb(Assembler::greaterEqual, L_sloop); + } BIND(L_end); } +// Clearing constant sized memory using YMM/ZMM registers. +void MacroAssembler::clear_mem(Register base, int cnt, Register rtmp, XMMRegister xtmp) { + assert(UseAVX > 2 && VM_Version::supports_avx512vlbw(), ""); + bool use64byteVector = MaxVectorSize > 32 && AVX3Threshold == 0; + + int vector64_count = (cnt & (~0x7)) >> 3; + cnt = cnt & 0x7; + + // 64 byte initialization loop. + vpxor(xtmp, xtmp, xtmp, use64byteVector ? AVX_512bit : AVX_256bit); + for (int i = 0; i < vector64_count; i++) { + fill64_avx(base, i * 64, xtmp, use64byteVector); + } + + // Clear remaining 64 byte tail. + int disp = vector64_count * 64; + if (cnt) { + switch (cnt) { + case 1: + movq(Address(base, disp), xtmp); + break; + case 2: + evmovdqu(T_LONG, k0, Address(base, disp), xtmp, Assembler::AVX_128bit); + break; + case 3: + movl(rtmp, 0x7); + kmovwl(k2, rtmp); + evmovdqu(T_LONG, k2, Address(base, disp), xtmp, Assembler::AVX_256bit); + break; + case 4: + evmovdqu(T_LONG, k0, Address(base, disp), xtmp, Assembler::AVX_256bit); + break; + case 5: + if (use64byteVector) { + movl(rtmp, 0x1F); + kmovwl(k2, rtmp); + evmovdqu(T_LONG, k2, Address(base, disp), xtmp, Assembler::AVX_512bit); + } else { + evmovdqu(T_LONG, k0, Address(base, disp), xtmp, Assembler::AVX_256bit); + movq(Address(base, disp + 32), xtmp); + } + break; + case 6: + if (use64byteVector) { + movl(rtmp, 0x3F); + kmovwl(k2, rtmp); + evmovdqu(T_LONG, k2, Address(base, disp), xtmp, Assembler::AVX_512bit); + } else { + evmovdqu(T_LONG, k0, Address(base, disp), xtmp, Assembler::AVX_256bit); + evmovdqu(T_LONG, k0, Address(base, disp + 32), xtmp, Assembler::AVX_128bit); + } + break; + case 7: + if (use64byteVector) { + movl(rtmp, 0x7F); + kmovwl(k2, rtmp); + evmovdqu(T_LONG, k2, Address(base, disp), xtmp, Assembler::AVX_512bit); + } else { + evmovdqu(T_LONG, k0, Address(base, disp), xtmp, Assembler::AVX_256bit); + movl(rtmp, 0x7); + kmovwl(k2, rtmp); + evmovdqu(T_LONG, k2, Address(base, disp + 32), xtmp, Assembler::AVX_256bit); + } + break; + default: + fatal("Unexpected length : %d\n",cnt); + break; + } + } +} + void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, XMMRegister xtmp, bool is_large) { - // cnt - number of qwords (8-byte words). - // base - start address, qword aligned. + // cnt - number of qwords (8-byte words). + // base - start address, qword aligned. // is_large - if optimizers know cnt is larger than InitArrayShortSize assert(base==rdi, "base register must be edi for rep stos"); assert(tmp==rax, "tmp register must be eax for rep stos"); @@ -4991,7 +5078,6 @@ void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, XMMReg "InitArrayShortSize should be the multiple of BytesPerLong"); Label DONE; - if (!is_large || !UseXMMForObjInit) { xorptr(tmp, tmp); } @@ -5021,8 +5107,7 @@ void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, XMMReg shlptr(cnt, 3); // convert to number of bytes rep_stosb(); } else if (UseXMMForObjInit) { - movptr(tmp, base); - xmm_clear_mem(tmp, cnt, xtmp); + xmm_clear_mem(base, cnt, tmp, xtmp); } else { NOT_LP64(shlptr(cnt, 1);) // convert to number of 32-bit words for 32-bit VM rep_stos(); @@ -5031,6 +5116,9 @@ void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, XMMReg BIND(DONE); } +#endif //COMPILER2_OR_JVMCI + + void MacroAssembler::generate_fill(BasicType t, bool aligned, Register to, Register value, Register count, Register rtmp, XMMRegister xtmp) { @@ -8050,6 +8138,63 @@ void MacroAssembler::evmovdqu(BasicType type, KRegister kmask, Address dst, XMMR } } +#if COMPILER2_OR_JVMCI + + +// Set memory operation for length "less than" 64 bytes. +void MacroAssembler::fill64_masked_avx(uint shift, Register dst, int disp, + XMMRegister xmm, KRegister mask, Register length, + Register temp, bool use64byteVector) { + assert(MaxVectorSize >= 32, "vector length should be >= 32"); + assert(shift != 0, "shift value should be 1 (short),2(int) or 3(long)"); + BasicType type[] = { T_BYTE, T_SHORT, T_INT, T_LONG}; + if (!use64byteVector) { + fill32_avx(dst, disp, xmm); + subptr(length, 32 >> shift); + fill32_masked_avx(shift, dst, disp + 32, xmm, mask, length, temp); + } else { + assert(MaxVectorSize == 64, "vector length != 64"); + movl(temp, 1); + shlxl(temp, temp, length); + subptr(temp, 1); + kmovwl(mask, temp); + evmovdqu(type[shift], mask, Address(dst, disp), xmm, Assembler::AVX_512bit); + } +} + + +void MacroAssembler::fill32_masked_avx(uint shift, Register dst, int disp, + XMMRegister xmm, KRegister mask, Register length, + Register temp) { + assert(MaxVectorSize >= 32, "vector length should be >= 32"); + assert(shift != 0, "shift value should be 1 (short), 2(int) or 3(long)"); + BasicType type[] = { T_BYTE, T_SHORT, T_INT, T_LONG}; + movl(temp, 1); + shlxl(temp, temp, length); + subptr(temp, 1); + kmovwl(mask, temp); + evmovdqu(type[shift], mask, Address(dst, disp), xmm, Assembler::AVX_256bit); +} + + +void MacroAssembler::fill32_avx(Register dst, int disp, XMMRegister xmm) { + assert(MaxVectorSize >= 32, "vector length should be >= 32"); + vmovdqu(Address(dst, disp), xmm); +} + +void MacroAssembler::fill64_avx(Register dst, int disp, XMMRegister xmm, bool use64byteVector) { + assert(MaxVectorSize >= 32, "vector length should be >= 32"); + BasicType type[] = {T_BYTE, T_SHORT, T_INT, T_LONG}; + if (!use64byteVector) { + fill32_avx(dst, disp, xmm); + fill32_avx(dst, disp + 32, xmm); + } else { + evmovdquq(Address(dst, disp), xmm, Assembler::AVX_512bit); + } +} + +#endif //COMPILER2_OR_JVMCI + #ifdef _LP64 void MacroAssembler::convert_f2i(Register dst, XMMRegister src) { diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index f1bb8f104c920..a90bc30452316 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -1680,8 +1680,11 @@ class MacroAssembler: public Assembler { // if 'is_large' is set, do not try to produce short loop void clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp, bool is_large); + // clear memory initialization sequence for constant size; + void clear_mem(Register base, int cnt, Register rtmp, XMMRegister xtmp); + // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers - void xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp); + void xmm_clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp); // Fill primitive arrays void generate_fill(BasicType t, bool aligned, @@ -1800,6 +1803,18 @@ class MacroAssembler: public Assembler { void byte_array_inflate(Register src, Register dst, Register len, XMMRegister tmp1, Register tmp2); + void fill64_masked_avx(uint shift, Register dst, int disp, + XMMRegister xmm, KRegister mask, Register length, + Register temp, bool use64byteVector = false); + + void fill32_masked_avx(uint shift, Register dst, int disp, + XMMRegister xmm, KRegister mask, Register length, + Register temp); + + void fill32_avx(Register dst, int disp, XMMRegister xmm); + + void fill64_avx(Register dst, int dis, XMMRegister xmm, bool use64byteVector = false); + #ifdef _LP64 void convert_f2i(Register dst, XMMRegister src); void convert_d2i(Register dst, XMMRegister src); diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 0069a0c500cd9..eac8c54367e80 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1529,6 +1529,14 @@ void VM_Version::get_processor_features() { } } +#ifdef COMPILER2 + if (is_intel() && MaxVectorSize > 16) { + if (FLAG_IS_DEFAULT(UseFastStosb)) { + UseFastStosb = false; + } + } +#endif + // Use XMM/YMM MOVDQU instruction for Object Initialization if (!UseFastStosb && UseSSE >= 2 && UseUnalignedLoadStores) { if (FLAG_IS_DEFAULT(UseXMMForObjInit)) { diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index bf4596f9fc47d..bffa966751afc 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1601,6 +1601,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType return false; } break; + case Op_ClearArray: case Op_VectorMaskGen: case Op_LoadVectorMasked: case Op_StoreVectorMasked: diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 173fb224590bf..92817041e3633 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -11439,7 +11439,7 @@ instruct MoveL2D_reg_reg_sse(regD dst, eRegL src, regD tmp) %{ // ======================================================================= // fast clearing of an array instruct rep_stos(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Universe dummy, eFlagsReg cr) %{ - predicate(!((ClearArrayNode*)n)->is_large()); + predicate(!((ClearArrayNode*)n)->is_large() && !n->in(2)->bottom_type()->is_int()->is_con()); match(Set dummy (ClearArray cnt base)); effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr); @@ -11546,6 +11546,18 @@ instruct rep_stos_large(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Unive ins_pipe( pipe_slow ); %} +instruct rep_stos_im(immI cnt, eRegP base, regD tmp, rRegI zero, Universe dummy, eFlagsReg cr) +%{ + predicate(!((ClearArrayNode*)n)->is_large() && n->in(2)->bottom_type()->is_int()->is_con()); + match(Set dummy (ClearArray cnt base)); + effect(TEMP tmp, TEMP zero, KILL cr); + format %{ "clear_mem_imm $base , $cnt \n\t" %} + ins_encode %{ + __ clear_mem($base$$Register, $cnt$$constant, $zero$$Register, $tmp$$XMMRegister); + %} + ins_pipe(pipe_slow); +%} + instruct string_compareL(eDIRegP str1, eCXRegI cnt1, eSIRegP str2, eDXRegI cnt2, eAXRegI result, regD tmp1, eFlagsReg cr) %{ predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index bfde7da82498f..dbe4be518f8d2 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -10747,7 +10747,7 @@ instruct MoveL2D_reg_reg(regD dst, rRegL src) %{ instruct rep_stos(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero, Universe dummy, rFlagsReg cr) %{ - predicate(!((ClearArrayNode*)n)->is_large()); + predicate(!((ClearArrayNode*)n)->is_large() && !n->in(2)->bottom_type()->is_long()->is_con()); match(Set dummy (ClearArray cnt base)); effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr); @@ -10853,6 +10853,18 @@ instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero, ins_pipe(pipe_slow); %} +instruct rep_stos_im(immL cnt, rRegP base, regD tmp, rRegI zero, Universe dummy, rFlagsReg cr) +%{ + predicate(!((ClearArrayNode*)n)->is_large() && n->in(2)->bottom_type()->is_long()->is_con()); + match(Set dummy (ClearArray cnt base)); + effect(TEMP tmp, TEMP zero, KILL cr); + format %{ "clear_mem_imm $base , $cnt \n\t" %} + ins_encode %{ + __ clear_mem($base$$Register, $cnt$$constant, $zero$$Register, $tmp$$XMMRegister); + %} + ins_pipe(pipe_slow); +%} + instruct string_compareL(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, rax_RegI result, legRegD tmp1, rFlagsReg cr) %{ diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index dbec14a171dc0..67347f10b8155 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -3053,6 +3053,8 @@ Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Assemblers are responsible to produce fast hardware clears for it. if (size > InitArrayShortSize) { return new ClearArrayNode(in(0), in(1), in(2), in(3), true); + } else if (size > 2 && Matcher::match_rule_supported_vector(Op_ClearArray, 4, T_LONG)) { + return NULL; } Node *mem = in(1); if( phase->type(mem)==Type::TOP ) return NULL; diff --git a/test/micro/org/openjdk/bench/vm/compiler/ClearMemory.java b/test/micro/org/openjdk/bench/vm/compiler/ClearMemory.java new file mode 100644 index 0000000000000..5a3f7a3581dee --- /dev/null +++ b/test/micro/org/openjdk/bench/vm/compiler/ClearMemory.java @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2020, 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 org.openjdk.bench.vm.compiler; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Fork; + +import org.openjdk.jmh.infra.Blackhole; + +import java.util.concurrent.TimeUnit; + +@Fork(jvmArgsPrepend = {"-XX:-EliminateAllocations", "-XX:-DoEscapeAnalysis"}) +@BenchmarkMode(Mode.Throughput) +@OutputTimeUnit(TimeUnit.SECONDS) +@State(Scope.Thread) +public class ClearMemory { + class Payload8 { + public long f0; + public long f1; + public long f2; + public long f3; + public long f4; + public long f5; + public long f6; + public long f7; + + public Payload8() { + this.f0 = 1; + } + } + + class Payload7 { + public long f0; + public long f1; + public long f2; + public long f3; + public long f4; + public long f5; + public long f6; + + public Payload7() { + this.f0 = 1; + } + } + + class Payload6 { + public long f0; + public long f1; + public long f2; + public long f3; + public long f4; + public long f5; + + public Payload6() { + this.f0 = 1; + } + } + + class Payload5 { + public long f0; + public long f1; + public long f2; + public long f3; + public long f4; + + public Payload5() { + this.f0 = 1; + } + } + + class Payload4 { + public long f0; + public long f1; + public long f2; + public long f3; + + public Payload4() { + this.f0 = 1; + } + } + + @Setup + public void Setup() { + } + + @Benchmark + public void testClearMemory1K(Blackhole bh) { + Object [] objs = new Object[64]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory2K(Blackhole bh) { + Object [] objs = new Object[128]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory4K(Blackhole bh) { + Object [] objs = new Object[256]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory8K(Blackhole bh) { + Object [] objs = new Object[512]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory16K(Blackhole bh) { + Object [] objs = new Object[1024]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory32K(Blackhole bh) { + Object [] objs = new Object[2048]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory1M(Blackhole bh) { + Object [] objs = new Object[65536]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory8M(Blackhole bh) { + Object [] objs = new Object[524288]; + bh.consume(objs); + } + @Benchmark + public void testClearMemory56B(Blackhole bh) { + Payload7 obj = new Payload7(); + bh.consume(obj); + } + @Benchmark + public void testClearMemory48B(Blackhole bh) { + Payload6 obj = new Payload6(); + bh.consume(obj); + } + @Benchmark + public void testClearMemory40B(Blackhole bh) { + Payload5 obj = new Payload5(); + bh.consume(obj); + } + @Benchmark + public void testClearMemory32B(Blackhole bh) { + Payload4 obj = new Payload4(); + bh.consume(obj); + } + @Benchmark + public void testClearMemory24B(Blackhole bh) { + Payload4 obj = new Payload4(); + bh.consume(obj); + } +} From 178c00182c4ae040333d33eb193beae4b55d25d6 Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Thu, 17 Dec 2020 05:26:11 +0000 Subject: [PATCH 275/504] 8258479: Minor cleanups in VMError Reviewed-by: lfoltan, coleenp --- src/hotspot/os/posix/vmError_posix.cpp | 3 +- src/hotspot/os/windows/vmError_windows.cpp | 4 +- .../gc/parallel/parallelScavengeHeap.cpp | 2 +- src/hotspot/share/runtime/threadSMR.cpp | 3 +- src/hotspot/share/utilities/decoder.cpp | 15 +-- src/hotspot/share/utilities/events.hpp | 4 +- src/hotspot/share/utilities/vmError.cpp | 116 +++++++++--------- src/hotspot/share/utilities/vmError.hpp | 22 ++-- 8 files changed, 78 insertions(+), 91 deletions(-) diff --git a/src/hotspot/os/posix/vmError_posix.cpp b/src/hotspot/os/posix/vmError_posix.cpp index 80022dbbda395..798097ba8243b 100644 --- a/src/hotspot/os/posix/vmError_posix.cpp +++ b/src/hotspot/os/posix/vmError_posix.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020 SAP SE. 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 @@ -132,7 +133,7 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) { VMError::report_and_die(NULL, sig, pc, info, ucVoid); } -void VMError::reset_signal_handlers() { +void VMError::install_secondary_signal_handler() { for (int i = 0; i < NUM_SIGNALS; i++) { save_signal(i, SIGNALS[i]); os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler)); diff --git a/src/hotspot/os/windows/vmError_windows.cpp b/src/hotspot/os/windows/vmError_windows.cpp index fb539a9e131d9..3c899e54245e5 100644 --- a/src/hotspot/os/windows/vmError_windows.cpp +++ b/src/hotspot/os/windows/vmError_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -44,7 +44,7 @@ LONG WINAPI crash_handler(struct _EXCEPTION_POINTERS* exceptionInfo) { return EXCEPTION_CONTINUE_SEARCH; } -void VMError::reset_signal_handlers() { +void VMError::install_secondary_signal_handler() { SetUnhandledExceptionFilter(crash_handler); } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 32bc3dd5c3684..9b1dc325659a1 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -603,7 +603,7 @@ HeapWord* ParallelScavengeHeap::block_start(const void* addr) const { assert(young_gen()->is_in(addr), "addr should be in allocated part of young gen"); // called from os::print_location by find or VMError - if (Debugging || VMError::fatal_error_in_progress()) return NULL; + if (Debugging || VMError::is_error_reported()) return NULL; Unimplemented(); } else if (old_gen()->is_in_reserved(addr)) { assert(old_gen()->is_in(addr), diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index 41c5af29dc01a..7e91eefd39411 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -540,8 +540,7 @@ void SafeThreadsListPtr::verify_hazard_ptr_scanned() { return; } - if (VMError::is_error_reported() && - VMError::get_first_error_tid() == os::current_thread_id()) { + if (VMError::is_error_reported_in_current_thread()) { // If there is an error reported by this thread it may use ThreadsList even // if it's unsafe. return; diff --git a/src/hotspot/share/utilities/decoder.cpp b/src/hotspot/share/utilities/decoder.cpp index 8f7ff7739c229..e60ae9f94ba41 100644 --- a/src/hotspot/share/utilities/decoder.cpp +++ b/src/hotspot/share/utilities/decoder.cpp @@ -1,5 +1,6 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020 SAP SE. 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 +26,6 @@ #include "precompiled.hpp" #include "jvm.h" #include "memory/allocation.inline.hpp" -#include "runtime/os.hpp" #include "utilities/decoder.hpp" #include "utilities/vmError.hpp" @@ -84,19 +84,16 @@ Mutex* Decoder::shared_decoder_lock() { } bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) { - bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid(); - if (error_handling_thread) { + if (VMError::is_error_reported_in_current_thread()) { return get_error_handler_instance()->decode(addr, buf, buflen, offset, modulepath, demangle); } else { MutexLocker locker(shared_decoder_lock(), Mutex::_no_safepoint_check_flag); return get_shared_instance()->decode(addr, buf, buflen, offset, modulepath, demangle); } - } bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) { - bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid(); - if (error_handling_thread) { + if (VMError::is_error_reported_in_current_thread()) { return get_error_handler_instance()->decode(addr, buf, buflen, offset, base); } else { MutexLocker locker(shared_decoder_lock(), Mutex::_no_safepoint_check_flag); @@ -104,10 +101,8 @@ bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const voi } } - bool Decoder::demangle(const char* symbol, char* buf, int buflen) { - bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid(); - if (error_handling_thread) { + if (VMError::is_error_reported_in_current_thread()) { return get_error_handler_instance()->demangle(symbol, buf, buflen); } else { MutexLocker locker(shared_decoder_lock(), Mutex::_no_safepoint_check_flag); diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp index 0b1d442d8b33b..911537a915223 100644 --- a/src/hotspot/share/utilities/events.hpp +++ b/src/hotspot/share/utilities/events.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ -127,7 +127,7 @@ template class EventLogBase : public EventLog { bool should_log() { // Don't bother adding new entries when we're crashing. This also // avoids mutating the ring buffer when printing the log. - return !VMError::fatal_error_in_progress(); + return !VMError::is_error_reported(); } // Print the contents of the log diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index c22348307eec0..10f790a618efa 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020 SAP SE. 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 @@ -63,10 +64,25 @@ #include #endif // PRODUCT -bool VMError::_error_reported = false; - -// call this when the VM is dying--it might loosen some asserts -bool VMError::is_error_reported() { return _error_reported; } +bool VMError::coredump_status; +char VMError::coredump_message[O_BUFLEN]; +int VMError::_current_step; +const char* VMError::_current_step_info; +volatile jlong VMError::_reporting_start_time = -1; +volatile bool VMError::_reporting_did_timeout = false; +volatile jlong VMError::_step_start_time = -1; +volatile bool VMError::_step_did_timeout = false; +volatile intptr_t VMError::_first_error_tid = -1; +int VMError::_id; +const char* VMError::_message; +char VMError::_detail_msg[1024]; +Thread* VMError::_thread; +address VMError::_pc; +void* VMError::_siginfo; +void* VMError::_context; +const char* VMError::_filename; +int VMError::_lineno; +size_t VMError::_size; // returns an address which is guaranteed to generate a SIGSEGV on read, // for test purposes, which is not NULL and contains bits in every word @@ -80,7 +96,7 @@ void* VMError::get_segfault_address() { } // List of environment variables that should be reported in error log file. -const char *env_list[] = { +static const char* env_list[] = { // All platforms "JAVA_HOME", "JAVA_TOOL_OPTIONS", "_JAVA_OPTIONS", "CLASSPATH", "PATH", "USERNAME", @@ -151,9 +167,6 @@ static void print_bug_submit_message(outputStream *out, Thread *thread) { out->print_raw_cr("#"); } -bool VMError::coredump_status; -char VMError::coredump_message[O_BUFLEN]; - void VMError::record_coredump_status(const char* message, bool status) { coredump_status = status; strncpy(coredump_message, message, sizeof(coredump_message)); @@ -358,40 +371,15 @@ static void report_vm_version(outputStream* st, char* buf, int buflen) { ); } -// This is the main function to report a fatal error. Only one thread can -// call this function, so we don't need to worry about MT-safety. But it's -// possible that the error handler itself may crash or die on an internal -// error, for example, when the stack/heap is badly damaged. We must be -// able to handle recursive errors that happen inside error handler. -// -// Error reporting is done in several steps. If a crash or internal error -// occurred when reporting an error, the nested signal/exception handler -// can skip steps that are already (or partially) done. Error reporting will -// continue from the next step. This allows us to retrieve and print -// information that may be unsafe to get after a fatal error. If it happens, -// you may find nested report_and_die() frames when you look at the stack -// in a debugger. -// -// In general, a hang in error handler is much worse than a crash or internal -// error, as it's harder to recover from a hang. Deadlock can happen if we -// try to grab a lock that is already owned by current thread, or if the -// owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the -// error handler and all the functions it called should avoid grabbing any -// lock. An important thing to notice is that memory allocation needs a lock. -// -// We should avoid using large stack allocated buffers. Many errors happen -// when stack space is already low. Making things even worse is that there -// could be nested report_and_die() calls on stack (see above). Only one -// thread can report error, so large buffers are statically allocated in data -// segment. - -int VMError::_current_step; -const char* VMError::_current_step_info; +// Returns true if at least one thread reported a fatal error and fatal error handling is in process. +bool VMError::is_error_reported() { + return _first_error_tid != -1; +} -volatile jlong VMError::_reporting_start_time = -1; -volatile bool VMError::_reporting_did_timeout = false; -volatile jlong VMError::_step_start_time = -1; -volatile bool VMError::_step_did_timeout = false; +// Returns true if the current thread reported a fatal error. +bool VMError::is_error_reported_in_current_thread() { + return _first_error_tid == os::current_thread_id(); +} // Helper, return current timestamp for timeout handling. jlong VMError::get_current_timestamp() { @@ -422,6 +410,32 @@ void VMError::clear_step_start_time() { return Atomic::store(&_step_start_time, (jlong)0); } +// This is the main function to report a fatal error. Only one thread can +// call this function, so we don't need to worry about MT-safety. But it's +// possible that the error handler itself may crash or die on an internal +// error, for example, when the stack/heap is badly damaged. We must be +// able to handle recursive errors that happen inside error handler. +// +// Error reporting is done in several steps. If a crash or internal error +// occurred when reporting an error, the nested signal/exception handler +// can skip steps that are already (or partially) done. Error reporting will +// continue from the next step. This allows us to retrieve and print +// information that may be unsafe to get after a fatal error. If it happens, +// you may find nested report_and_die() frames when you look at the stack +// in a debugger. +// +// In general, a hang in error handler is much worse than a crash or internal +// error, as it's harder to recover from a hang. Deadlock can happen if we +// try to grab a lock that is already owned by current thread, or if the +// owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the +// error handler and all the functions it called should avoid grabbing any +// lock. An important thing to notice is that memory allocation needs a lock. +// +// We should avoid using large stack allocated buffers. Many errors happen +// when stack space is already low. Making things even worse is that there +// could be nested report_and_die() calls on stack (see above). Only one +// thread can report error, so large buffers are statically allocated in data +// segment. void VMError::report(outputStream* st, bool _verbose) { # define BEGIN if (_current_step == 0) { _current_step = __LINE__; @@ -654,7 +668,6 @@ void VMError::report(outputStream* st, bool _verbose) { os::print_summary_info(st, buf, sizeof(buf)); } - STEP("printing date and time") if (_verbose) { @@ -695,7 +708,6 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP("printing stack bounds") if (_verbose) { @@ -1240,8 +1252,6 @@ void VMError::print_vm_info(outputStream* st) { st->print_cr("END."); } -volatile intptr_t VMError::_first_error_tid = -1; - /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ static int expand_and_open(const char* pattern, bool overwrite_existing, char* buf, size_t buflen, size_t pos) { int fd = -1; @@ -1298,17 +1308,6 @@ static int prepare_log_file(const char* pattern, const char* default_pattern, bo return fd; } -int VMError::_id; -const char* VMError::_message; -char VMError::_detail_msg[1024]; -Thread* VMError::_thread; -address VMError::_pc; -void* VMError::_siginfo; -void* VMError::_context; -const char* VMError::_filename; -int VMError::_lineno; -size_t VMError::_size; - void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context, const char* detail_fmt, ...) { @@ -1395,9 +1394,6 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt _size = size; jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args); - // first time - _error_reported = true; - reporting_started(); if (!TestUnresponsiveErrorHandler) { // Record reporting_start_time unless we're running the @@ -1420,7 +1416,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt // reset signal handlers or exception filter; make sure recursive crashes // are handled properly. - reset_signal_handlers(); + install_secondary_signal_handler(); } else { #if defined(_WINDOWS) // If UseOSErrorReporting we call this for each level of the call stack diff --git a/src/hotspot/share/utilities/vmError.hpp b/src/hotspot/share/utilities/vmError.hpp index 3c09b0c10c0ba..05b6993769874 100644 --- a/src/hotspot/share/utilities/vmError.hpp +++ b/src/hotspot/share/utilities/vmError.hpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020 SAP SE. 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 @@ -84,13 +85,9 @@ class VMError : public AllStatic { // Whether or not the last error reporting step did timeout. static volatile bool _step_did_timeout; - static bool _error_reported; - - public: - - // set signal handlers on Solaris/Linux or the default exception filter - // on Windows, to handle recursive crashes. - static void reset_signal_handlers(); + // Install secondary signal handler to handle secondary faults during error reporting + // (see VMError::crash_handler) + static void install_secondary_signal_handler(); // handle -XX:+ShowMessageBoxOnError. buf is used to format the message string static void show_message_box(char* buf, int buflen); @@ -171,18 +168,17 @@ class VMError : public AllStatic { // signal was not changed by error reporter static address get_resetted_sighandler(int sig); - // check to see if fatal error reporting is in progress - static bool fatal_error_in_progress() { return _first_error_tid != -1; } - - static intptr_t get_first_error_tid() { return _first_error_tid; } - // Called by the WatcherThread to check if error reporting has timed-out. // Returns true if error reporting has not completed within the ErrorLogTimeout limit. static bool check_timeout(); - // Support for avoiding multiple asserts + // Returns true if at least one thread reported a fatal error and + // fatal error handling is in process. static bool is_error_reported(); + // Returns true if the current thread reported a fatal error. + static bool is_error_reported_in_current_thread(); + DEBUG_ONLY(static void controlled_crash(int how);) // returns an address which is guaranteed to generate a SIGSEGV on read, From 41f312eb647470353f3cf1640ef0fbd32b07f283 Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Thu, 17 Dec 2020 08:06:35 +0000 Subject: [PATCH 276/504] 8254023: A module declaration is not allowed to be a target of an annotation that lacks an @Target meta-annotation Reviewed-by: jfranck, vromero --- .../com/sun/tools/javac/comp/Check.java | 2 +- .../javac/annotations/8254023/T8254023.java | 29 +++++++++ .../annotations/8254023/module-info.java | 25 ++++++++ .../javac/annotations/8254023/test/A.java | 26 ++++++++ .../javac/modules/AnnotationProcessing.java | 62 ++++++++++++++++++- .../javac/modules/AnnotationsOnModules.java | 39 +++++++++++- 6 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 test/langtools/tools/javac/annotations/8254023/T8254023.java create mode 100644 test/langtools/tools/javac/annotations/8254023/module-info.java create mode 100644 test/langtools/tools/javac/annotations/8254023/test/A.java diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 1ca0645ad6515..801ea604a05f0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -119,7 +119,7 @@ protected Check(Context context) { names = Names.instance(context); dfltTargetMeta = new Name[] { names.PACKAGE, names.TYPE, names.FIELD, names.RECORD_COMPONENT, names.METHOD, names.CONSTRUCTOR, - names.ANNOTATION_TYPE, names.LOCAL_VARIABLE, names.PARAMETER}; + names.ANNOTATION_TYPE, names.LOCAL_VARIABLE, names.PARAMETER, names.MODULE }; log = Log.instance(context); rs = Resolve.instance(context); syms = Symtab.instance(context); diff --git a/test/langtools/tools/javac/annotations/8254023/T8254023.java b/test/langtools/tools/javac/annotations/8254023/T8254023.java new file mode 100644 index 0000000000000..f9c59716bf3e8 --- /dev/null +++ b/test/langtools/tools/javac/annotations/8254023/T8254023.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020, 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 8254023 + * @summary A module declaration is not allowed to be a target of an annotation that lacks an (at)Target meta-annotation + * @compile module-info.java test/A.java + */ diff --git a/test/langtools/tools/javac/annotations/8254023/module-info.java b/test/langtools/tools/javac/annotations/8254023/module-info.java new file mode 100644 index 0000000000000..bc8011775dfcc --- /dev/null +++ b/test/langtools/tools/javac/annotations/8254023/module-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020, 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.A +module test { } diff --git a/test/langtools/tools/javac/annotations/8254023/test/A.java b/test/langtools/tools/javac/annotations/8254023/test/A.java new file mode 100644 index 0000000000000..fbd0dfb32fa02 --- /dev/null +++ b/test/langtools/tools/javac/annotations/8254023/test/A.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020, 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 test; + +public @interface A { } diff --git a/test/langtools/tools/javac/modules/AnnotationProcessing.java b/test/langtools/tools/javac/modules/AnnotationProcessing.java index 68e0794e8eb02..1bf870bc54e50 100644 --- a/test/langtools/tools/javac/modules/AnnotationProcessing.java +++ b/test/langtools/tools/javac/modules/AnnotationProcessing.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8133884 8162711 8133896 8172158 8172262 8173636 8175119 8189747 8236842 + * @bug 8133884 8162711 8133896 8172158 8172262 8173636 8175119 8189747 8236842 8254023 * @summary Verify that annotation processing works. * @library /tools/lib * @modules @@ -517,6 +517,66 @@ public SourceVersion getSupportedSourceVersion() { } + @Test + public void testAnnotationsWithoutTargetInModuleInfo(Path base) throws Exception { + Path moduleSrc = base.resolve("module-src"); + Path m1 = moduleSrc.resolve("m1"); + + tb.writeJavaFiles(m1, + "@test.A module m1x { exports test; }", + "package test; public @interface A { }", + "package test; public @interface B { }"); + + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + + List expectedLog = List.of("Note: m1x/test.A AP Invoked", + "Note: m1x/test.A AP Invoked"); + + List actualLog = new JavacTask(tb) + .options("-processor", AnnotationsWithoutTargetInModuleInfo.class.getName() + + "," + AnnotationsWithoutTargetNotInModuleInfo.class.getName()) + .outdir(classes) + .files(findJavaFiles(m1)) + .run() + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + tb.checkEqual(expectedLog, actualLog); + } + + @SupportedAnnotationTypes("m1x/test.A") + public static final class AnnotationsWithoutTargetInModuleInfo extends AbstractProcessor { + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + processingEnv.getMessager().printMessage(Kind.NOTE, "m1x/test.A AP Invoked"); + return false; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + } + + @SupportedAnnotationTypes("m1x/test.B") + public static final class AnnotationsWithoutTargetNotInModuleInfo extends AbstractProcessor { + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + processingEnv.getMessager().printMessage(Kind.NOTE, "m1x/test.B AP Invoked"); + return false; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + } + @Test public void testGenerateInMultiModeAPI(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); diff --git a/test/langtools/tools/javac/modules/AnnotationsOnModules.java b/test/langtools/tools/javac/modules/AnnotationsOnModules.java index 5d03bdef5a328..001a07b48aa18 100644 --- a/test/langtools/tools/javac/modules/AnnotationsOnModules.java +++ b/test/langtools/tools/javac/modules/AnnotationsOnModules.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8159602 8170549 8171255 8171322 + * @bug 8159602 8170549 8171255 8171322 8254023 * @summary Test annotations on module declaration. * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -51,6 +51,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.TypeElement; +import com.sun.tools.classfile.Annotation; import com.sun.tools.classfile.Attribute; import com.sun.tools.classfile.ClassFile; import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute; @@ -410,6 +411,42 @@ public void testAnnotationWithImportAmbiguity(Path base) throws Exception { } + @Test + public void testAnnotationWithoutTarget(Path base) throws Exception { + Path moduleSrc = base.resolve("module-src"); + Path m1 = moduleSrc.resolve("m1x"); + + tb.writeJavaFiles(m1, + "@test.A module m1x { exports test; }", + "package test; public @interface A { }"); + + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + + new JavacTask(tb) + .options("--module-source-path", moduleSrc.toString()) + .outdir(classes) + .files(findJavaFiles(m1)) + .run() + .writeAll(); + + ClassFile cf = ClassFile.read(classes.resolve("m1x").resolve("module-info.class")); + var invisibleAnnotations = (RuntimeInvisibleAnnotations_attribute) cf.attributes.map.get(Attribute.RuntimeInvisibleAnnotations); + + if (invisibleAnnotations == null) { + throw new AssertionError("Annotations not found!"); + } + int length = invisibleAnnotations.annotations.length; + if (length != 1) { + throw new AssertionError("Incorrect number of annotations: " + length); + } + Annotation annotation = invisibleAnnotations.annotations[0]; + String annotationName = cf.constant_pool.getUTF8Value(annotation.type_index).toString(); + if (!"Ltest/A;".equals(annotationName)) { + throw new AssertionError("Incorrect annotation name: " + annotationName); + } + } + @Test public void testModuleInfoAnnotationsInAPI(Path base) throws Exception { Path moduleSrc = base.resolve("module-src"); From 04a1e5b75b2c3c1d5a923fe79b7fa76dd2961956 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 17 Dec 2020 08:09:19 +0000 Subject: [PATCH 277/504] 8258505: [TESTBUG] TestDivZeroWithSplitIf.java fails due to missing UnlockDiagnosticVMOptions Reviewed-by: thartmann, kvn, dcubed --- .../hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java b/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java index 2d43ebc53d40f..eff1f1ca1d896 100644 --- a/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java +++ b/test/hotspot/jtreg/compiler/loopopts/TestDivZeroWithSplitIf.java @@ -28,7 +28,7 @@ * @summary Verify that zero check is executed before division/modulo operation. * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test - * -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf + * -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf */ package compiler.loopopts; From 83be8a902cee867c0e9d400e762f61896eb6df80 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 17 Dec 2020 10:05:09 +0000 Subject: [PATCH 278/504] 8247732: validate user-input intrinsic_ids in ControlIntrinsic renew webrev to the latest jdk. fixed a typo and a bug. Add constraints for both DisableIntrinsic and ControlIntrinsics. Add tests to cover different use cases of them. Reviewed-by: neliasso, thartmann --- .../share/compiler/compilerDirectives.cpp | 2 +- .../share/compiler/compilerDirectives.hpp | 41 +++++++++- src/hotspot/share/compiler/compilerOracle.cpp | 12 ++- .../share/compiler/directivesParser.cpp | 16 ++++ src/hotspot/share/compiler/methodMatcher.cpp | 2 +- .../share/runtime/flags/jvmFlagAccess.cpp | 6 ++ .../flags/jvmFlagConstraintsCompiler.cpp | 25 ++++++ .../flags/jvmFlagConstraintsCompiler.hpp | 2 + .../share/runtime/flags/jvmFlagLimit.hpp | 1 + src/hotspot/share/runtime/globals.hpp | 2 + .../commands/ControlIntrinsicTest.java | 56 +++++++++++++ .../compiler/compilercontrol/control_off.txt | 1 - .../directives/ControlIntrinsicTest.java | 56 +++++++++++++ .../jcmd/ControlIntrinsicTest.java | 56 +++++++++++++ .../jcmd/PrintDirectivesTest.java | 9 ++- .../parser/HugeDirectiveUtil.java | 9 ++- .../share/IntrinsicCommand.java | 80 +++++++++++++++++++ .../compilercontrol/share/MultiCommand.java | 21 ++++- .../share/processors/CommandProcessor.java | 46 +++++++++-- .../scenario/AbstractCommandBuilder.java | 7 +- .../share/scenario/Command.java | 1 + .../share/scenario/CommandFileBuilder.java | 15 +++- .../share/scenario/CommandGenerator.java | 10 +++ .../share/scenario/CommandOptionsBuilder.java | 28 ++++--- .../share/scenario/CompileCommand.java | 33 ++++++++ .../share/scenario/DirectiveBuilder.java | 3 + .../share/scenario/DirectiveWriter.java | 3 +- .../share/scenario/Executor.java | 8 +- .../share/scenario/JcmdCommand.java | 11 +++ .../share/scenario/Scenario.java | 33 ++++++-- .../compilercontrol/share/scenario/State.java | 13 +++ .../intrinsics/IntrinsicDisabledTest.java | 14 ++-- 32 files changed, 574 insertions(+), 48 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/compilercontrol/commands/ControlIntrinsicTest.java create mode 100644 test/hotspot/jtreg/compiler/compilercontrol/directives/ControlIntrinsicTest.java create mode 100644 test/hotspot/jtreg/compiler/compilercontrol/jcmd/ControlIntrinsicTest.java create mode 100644 test/hotspot/jtreg/compiler/compilercontrol/share/IntrinsicCommand.java diff --git a/src/hotspot/share/compiler/compilerDirectives.cpp b/src/hotspot/share/compiler/compilerDirectives.cpp index 830d63a94b501..de46030ad9791 100644 --- a/src/hotspot/share/compiler/compilerDirectives.cpp +++ b/src/hotspot/share/compiler/compilerDirectives.cpp @@ -280,7 +280,7 @@ DirectiveSet::~DirectiveSet() { // 2) cloned() returns a pointer that points to the cloned DirectiveSet. // Users should only use cloned() when they need to update DirectiveSet. // -// In the end, users need invoke commit() to finalize the pending changes. +// In the end, users need to invoke commit() to finalize the pending changes. // If cloning happens, the smart pointer will return the new pointer after releasing the original // one on DirectivesStack. If cloning doesn't happen, it returns the original intact pointer. class DirectiveSetPtr { diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 2f97755645ca1..539635a382333 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -166,9 +166,11 @@ void print(outputStream* st) { } }; -// Iterator of ControlIntrinsic -// if disable_all is true, it accepts DisableIntrinsic(deprecated) and all intrinsics -// appear in the list are to disable +// Iterator of ControlIntrinsic=+_id1,-_id2,+_id3,... +// +// If disable_all is set, it accepts DisableIntrinsic and all intrinsic Ids +// appear in the list are disabled. Arguments don't have +/- prefix. eg. +// DisableIntrinsic=_id1,_id2,_id3,... class ControlIntrinsicIter { private: bool _enabled; @@ -188,6 +190,39 @@ class ControlIntrinsicIter { ControlIntrinsicIter& operator++(); }; +class ControlIntrinsicValidator { + private: + bool _valid; + char* _bad; + + public: + ControlIntrinsicValidator(ccstrlist option, bool disable_all) : _valid(true), _bad(nullptr) { + for (ControlIntrinsicIter iter(option, disable_all); *iter != NULL && _valid; ++iter) { + if (vmIntrinsics::_none == vmIntrinsics::find_id(*iter)) { + const size_t len = MIN2(strlen(*iter), 63) + 1; // cap len to a value we know is enough for all intrinsic names + _bad = NEW_C_HEAP_ARRAY(char, len, mtCompiler); + // strncpy always writes len characters. If the source string is shorter, the function fills the remaining bytes with NULLs. + strncpy(_bad, *iter, len); + _valid = false; + } + } + } + + ~ControlIntrinsicValidator() { + if (_bad != NULL) { + FREE_C_HEAP_ARRAY(char, _bad); + } + } + + bool is_valid() const { + return _valid; + } + + const char* what() const { + return _bad; + } +}; + class CompilerDirectives : public CHeapObj { private: CompilerDirectives* _next; diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index e0d7b2883780c..74bcdcf01e7bd 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "jvm.h" #include "classfile/symbolTable.hpp" +#include "compiler/compilerDirectives.hpp" #include "compiler/compilerOracle.hpp" #include "compiler/methodMatcher.hpp" #include "memory/allocation.inline.hpp" @@ -300,7 +301,7 @@ static void register_command(TypedMethodOptionMatcher* matcher, any_set = true; } if (!CompilerOracle::be_quiet()) { - // Print out the succesful registration of a comile command + // Print out the successful registration of a compile command ttyLocker ttyl; tty->print("CompileCommand: %s ", option2name(option)); matcher->print(); @@ -588,6 +589,15 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read, next_value += bytes_read; end_value = next_value-1; } + + if (option == CompileCommand::ControlIntrinsic || option == CompileCommand::DisableIntrinsic) { + ControlIntrinsicValidator validator(value, (option == CompileCommand::DisableIntrinsic)); + + if (!validator.is_valid()) { + jio_snprintf(errorbuf, buf_size, "Unrecognized intrinsic detected in %s: %s", option2name(option), validator.what()); + } + } + register_command(matcher, option, (ccstr) value); return; } else { diff --git a/src/hotspot/share/compiler/directivesParser.cpp b/src/hotspot/share/compiler/directivesParser.cpp index 504da1a8f9e80..af17030648f02 100644 --- a/src/hotspot/share/compiler/directivesParser.cpp +++ b/src/hotspot/share/compiler/directivesParser.cpp @@ -319,6 +319,22 @@ bool DirectivesParser::set_option_flag(JSON_TYPE t, JSON_VAL* v, const key* opti strncpy(s, v->str.start, v->str.length + 1); s[v->str.length] = '\0'; (set->*test)((void *)&s); + + if (strncmp(option_key->name, "ControlIntrinsic", 16) == 0) { + ControlIntrinsicValidator validator(s, false/*disabled_all*/); + + if (!validator.is_valid()) { + error(VALUE_ERROR, "Unrecognized intrinsic detected in ControlIntrinsic: %s", validator.what()); + return false; + } + } else if (strncmp(option_key->name, "DisableIntrinsic", 16) == 0) { + ControlIntrinsicValidator validator(s, true/*disabled_all*/); + + if (!validator.is_valid()) { + error(VALUE_ERROR, "Unrecognized intrinsic detected in DisableIntrinsic: %s", validator.what()); + return false; + } + } } break; diff --git a/src/hotspot/share/compiler/methodMatcher.cpp b/src/hotspot/share/compiler/methodMatcher.cpp index fe4ffc1306c79..2d70b5f63f29f 100644 --- a/src/hotspot/share/compiler/methodMatcher.cpp +++ b/src/hotspot/share/compiler/methodMatcher.cpp @@ -359,7 +359,7 @@ void MethodMatcher::print_base(outputStream* st) { BasicMatcher* BasicMatcher::parse_method_pattern(char* line, const char*& error_msg, bool expect_trailing_chars) { assert(error_msg == NULL, "Don't call here with error_msg already set"); - BasicMatcher *bm = new BasicMatcher(); + BasicMatcher* bm = new BasicMatcher(); MethodMatcher::parse_method_pattern(line, error_msg, bm); if (error_msg != NULL) { delete bm; diff --git a/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp b/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp index 51aeb0860813d..4695aab8fa427 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp @@ -357,6 +357,12 @@ JVMFlag::Error JVMFlagAccess::check_range(const JVMFlag* flag, bool verbose) { } JVMFlag::Error JVMFlagAccess::check_constraint(const JVMFlag* flag, void * func, bool verbose) { + const int type_enum = flag->type(); + if (type_enum == JVMFlag::TYPE_ccstr || type_enum == JVMFlag::TYPE_ccstrlist) { + // ccstr and ccstrlist are the same type. + return ((JVMFlagConstraintFunc_ccstr)func)(flag->get_ccstr(), verbose); + } + return access_impl(flag)->check_constraint(flag, func, verbose); } diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp index 80a1db91b15a3..6a865e288bf1f 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "code/relocInfo.hpp" #include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerDirectives.hpp" #include "oops/metadata.hpp" #include "runtime/os.hpp" #include "interpreter/invocationCounter.hpp" @@ -413,3 +414,27 @@ JVMFlag::Error LoopStripMiningIterConstraintFunc(uintx value, bool verbose) { return JVMFlag::SUCCESS; } #endif // COMPILER2 + +JVMFlag::Error DisableIntrinsicConstraintFunc(ccstrlist value, bool verbose) { + ControlIntrinsicValidator validator(value, true/*disabled_all*/); + if (!validator.is_valid()) { + JVMFlag::printError(verbose, + "Unrecognized intrinsic detected in DisableIntrinsic: %s\n", + validator.what()); + return JVMFlag::VIOLATES_CONSTRAINT; + } + + return JVMFlag::SUCCESS; +} + +JVMFlag::Error ControlIntrinsicConstraintFunc(ccstrlist value, bool verbose) { + ControlIntrinsicValidator validator(value, false/*disabled_all*/); + if (!validator.is_valid()) { + JVMFlag::printError(verbose, + "Unrecognized intrinsic detected in ControlIntrinsic: %s\n", + validator.what()); + return JVMFlag::VIOLATES_CONSTRAINT; + } + + return JVMFlag::SUCCESS; +} \ No newline at end of file diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp index 85048b0836205..adacbf08e895e 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp @@ -51,6 +51,8 @@ f(uintx, TypeProfileLevelConstraintFunc) \ f(intx, InitArrayShortSizeConstraintFunc) \ f(int , RTMTotalCountIncrRateConstraintFunc) \ + f(ccstrlist, DisableIntrinsicConstraintFunc) \ + f(ccstrlist, ControlIntrinsicConstraintFunc) \ COMPILER2_PRESENT( \ f(intx, InteriorEntryAlignmentConstraintFunc) \ f(intx, NodeLimitFudgeFactorConstraintFunc) \ diff --git a/src/hotspot/share/runtime/flags/jvmFlagLimit.hpp b/src/hotspot/share/runtime/flags/jvmFlagLimit.hpp index d3d6a26a9723f..28d2d3cfcd03c 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagLimit.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlagLimit.hpp @@ -48,6 +48,7 @@ typedef JVMFlag::Error (*JVMFlagConstraintFunc_uintx)(uintx value, bool verbose) typedef JVMFlag::Error (*JVMFlagConstraintFunc_uint64_t)(uint64_t value, bool verbose); typedef JVMFlag::Error (*JVMFlagConstraintFunc_size_t)(size_t value, bool verbose); typedef JVMFlag::Error (*JVMFlagConstraintFunc_double)(double value, bool verbose); +typedef JVMFlag::Error (*JVMFlagConstraintFunc_ccstr)(ccstr value, bool verbose); // A JVMFlagLimit is created for each JVMFlag that has a range() and/or constraint() in its declaration in // the globals_xxx.hpp file. diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index f9f1539193a2a..0dd3f530147d5 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -365,10 +365,12 @@ const intx ObjectAlignmentInBytes = 8; \ product(ccstrlist, DisableIntrinsic, "", DIAGNOSTIC, \ "do not expand intrinsics whose (internal) names appear here") \ + constraint(DisableIntrinsicConstraintFunc,AfterErgo) \ \ product(ccstrlist, ControlIntrinsic, "", DIAGNOSTIC, \ "Control intrinsics using a list of +/- (internal) names, " \ "separated by commas") \ + constraint(ControlIntrinsicConstraintFunc,AfterErgo) \ \ develop(bool, TraceCallFixup, false, \ "Trace all call fixups") \ diff --git a/test/hotspot/jtreg/compiler/compilercontrol/commands/ControlIntrinsicTest.java b/test/hotspot/jtreg/compiler/compilercontrol/commands/ControlIntrinsicTest.java new file mode 100644 index 0000000000000..293013b678ba1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/compilercontrol/commands/ControlIntrinsicTest.java @@ -0,0 +1,56 @@ +/* + * Copyright Amazon.com Inc. 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 8247732 + * @summary Tests CompileCommand=ControlIntrinsic,*.*,+_id + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * @run driver compiler.compilercontrol.commands.ControlIntrinsicTest + */ + +package compiler.compilercontrol.commands; + +import compiler.compilercontrol.share.IntrinsicCommand; +import compiler.compilercontrol.share.IntrinsicCommand.IntrinsicId; +import compiler.compilercontrol.share.scenario.Scenario; + +public class ControlIntrinsicTest { + public static void main(String[] args) { + IntrinsicId ids[] = new IntrinsicId[3]; + + ids[0] = new IntrinsicId("_newArray", true); + ids[1] = new IntrinsicId("_minF", false); + ids[2] = new IntrinsicId("_copyOf", true); + new IntrinsicCommand(Scenario.Type.OPTION, ids).test(); + + // even though intrinsic ids are invalid, hotspot returns 0 + ids[0] = new IntrinsicId("brokenIntrinsic", true); + ids[1] = new IntrinsicId("invalidIntrinsic", false); + new IntrinsicCommand(Scenario.Type.OPTION, ids).test(); + } +} diff --git a/test/hotspot/jtreg/compiler/compilercontrol/control_off.txt b/test/hotspot/jtreg/compiler/compilercontrol/control_off.txt index 2eec82b3d347c..3fb128f7a0876 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/control_off.txt +++ b/test/hotspot/jtreg/compiler/compilercontrol/control_off.txt @@ -2,6 +2,5 @@ { match: "*.helper", PrintAssembly: false, - DisableIntrinsic:"x" } ] diff --git a/test/hotspot/jtreg/compiler/compilercontrol/directives/ControlIntrinsicTest.java b/test/hotspot/jtreg/compiler/compilercontrol/directives/ControlIntrinsicTest.java new file mode 100644 index 0000000000000..c6a36a459c7d6 --- /dev/null +++ b/test/hotspot/jtreg/compiler/compilercontrol/directives/ControlIntrinsicTest.java @@ -0,0 +1,56 @@ +/* + * Copyright Amazon.com Inc. 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 8247732 + * @summary Tests -XX:CompilerDirectivesFile=directives.json + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * @run driver compiler.compilercontrol.directives.ControlIntrinsicTest + */ + +package compiler.compilercontrol.directives; + +import compiler.compilercontrol.share.IntrinsicCommand; +import compiler.compilercontrol.share.IntrinsicCommand.IntrinsicId; +import compiler.compilercontrol.share.scenario.Scenario; + +public class ControlIntrinsicTest { + public static void main(String[] args) { + IntrinsicId ids[] = new IntrinsicId[3]; + + ids[0] = new IntrinsicId("_newArray", true); + ids[1] = new IntrinsicId("_minF", false); + ids[2] = new IntrinsicId("_copyOf", true); + new IntrinsicCommand(Scenario.Type.DIRECTIVE, ids).test(); + + // invalid compileCommands, hotspot exits with non-zero retval + ids[0] = new IntrinsicId("brokenIntrinsic", true); + ids[1] = new IntrinsicId("invalidIntrinsic", false); + new IntrinsicCommand(Scenario.Type.DIRECTIVE, ids).test(); + } +} diff --git a/test/hotspot/jtreg/compiler/compilercontrol/jcmd/ControlIntrinsicTest.java b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/ControlIntrinsicTest.java new file mode 100644 index 0000000000000..77f991f89a870 --- /dev/null +++ b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/ControlIntrinsicTest.java @@ -0,0 +1,56 @@ +/* + * Copyright Amazon.com Inc. 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 8247732 + * @summary Test ControlIntrinsic via jcmd + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * @run driver compiler.compilercontrol.jcmd.ControlIntrinsicTest + */ + +package compiler.compilercontrol.jcmd; + +import compiler.compilercontrol.share.IntrinsicCommand; +import compiler.compilercontrol.share.IntrinsicCommand.IntrinsicId; +import compiler.compilercontrol.share.scenario.Scenario; + +public class ControlIntrinsicTest { + public static void main(String[] args) { + IntrinsicId ids[] = new IntrinsicId[3]; + + ids[0] = new IntrinsicId("_newArray", true); + ids[1] = new IntrinsicId("_minF", false); + ids[2] = new IntrinsicId("_copyOf", true); + new IntrinsicCommand(Scenario.Type.JCMD, ids).test(); + + // will get error message but jcmd process still return 0 + ids[0] = new IntrinsicId("brokenIntrinsic", true); + ids[1] = new IntrinsicId("invalidIntrinsic", false); + new IntrinsicCommand(Scenario.Type.JCMD, ids).test(); + } +} diff --git a/test/hotspot/jtreg/compiler/compilercontrol/jcmd/PrintDirectivesTest.java b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/PrintDirectivesTest.java index 70df3e95a1bc1..394a2354a4111 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/jcmd/PrintDirectivesTest.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/jcmd/PrintDirectivesTest.java @@ -48,6 +48,8 @@ import java.lang.reflect.Executable; +import static compiler.compilercontrol.share.IntrinsicCommand.VALID_INTRINSIC_SAMPLES; + public class PrintDirectivesTest extends AbstractTestBase { private static final int AMOUNT = Utils.getRandomInstance().nextInt( Integer.getInteger("compiler.compilercontrol.jcmd." @@ -63,6 +65,8 @@ public void test() { Scenario.Builder builder = Scenario.getBuilder(); // Add some commands with directives file for (int i = 0; i < AMOUNT; i++) { + String argument = null; + Executable exec = Utils.getRandomElement(METHODS).first; MethodDescriptor methodDescriptor = getValidMethodDescriptor(exec); Command command = cmdGen.generateCommand(); @@ -70,9 +74,12 @@ public void test() { // skip invalid command command = Command.COMPILEONLY; } + if (command == Command.INTRINSIC) { + argument = Utils.getRandomElement(VALID_INTRINSIC_SAMPLES); + } CompileCommand compileCommand = new CompileCommand(command, methodDescriptor, cmdGen.generateCompiler(), - Scenario.Type.DIRECTIVE); + Scenario.Type.DIRECTIVE, argument); builder.add(compileCommand); } // print all directives diff --git a/test/hotspot/jtreg/compiler/compilercontrol/parser/HugeDirectiveUtil.java b/test/hotspot/jtreg/compiler/compilercontrol/parser/HugeDirectiveUtil.java index d51bde5f77bbe..6db9a99586296 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/parser/HugeDirectiveUtil.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/parser/HugeDirectiveUtil.java @@ -36,6 +36,8 @@ import java.util.Random; import java.util.stream.Collectors; +import static compiler.compilercontrol.share.IntrinsicCommand.VALID_INTRINSIC_SAMPLES; + /** * Creates a huge directive file */ @@ -82,8 +84,11 @@ public static void createMatchObject(List descriptors, file.emitCompiler(Utils.getRandomElement( Scenario.Compiler.values())); // add option inside the compiler block - file.option(Utils.getRandomElement(DirectiveWriter.Option.values()), - random.nextBoolean()); + DirectiveWriter.Option option = Utils.getRandomElement(DirectiveWriter.Option.values()); + file.option(option, + option != DirectiveWriter.Option.INTRINSIC + ? random.nextBoolean() + : "\"" + Utils.getRandomElement(VALID_INTRINSIC_SAMPLES) + "\""); file.end(); // ends compiler block // add standalone option, enable can't be used standalone diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/IntrinsicCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/IntrinsicCommand.java new file mode 100644 index 0000000000000..c977f8c74f712 --- /dev/null +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/IntrinsicCommand.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2015, 2020, 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 compiler.compilercontrol.share; + +import compiler.compilercontrol.share.method.MethodDescriptor; +import compiler.compilercontrol.share.scenario.Command; +import compiler.compilercontrol.share.scenario.CommandGenerator; +import compiler.compilercontrol.share.scenario.CompileCommand; +import compiler.compilercontrol.share.scenario.Scenario; +import jdk.test.lib.Utils; + +import java.lang.reflect.Executable; +import java.util.Arrays; +import java.util.stream.Collectors; + +public class IntrinsicCommand extends AbstractTestBase { + public static String[] VALID_INTRINSIC_SAMPLES = {"+_fabs", "-_maxF", "+_newArray", "-_isDigit", "+_putInt"}; + public static String[] INVALID_INTRINSIC_SAMPLES = {"+fabs", "-maxF"}; + + public static class IntrinsicId { + private String id; + private boolean enable; + + public IntrinsicId(String id, boolean enable) { + this.id = id; + this.enable = enable; + } + + @Override + public String toString() { + return (enable ? "+" : "-") + id; + } + } + + private final Command command; + private final Scenario.Type type; + private String intrinsic_ids; + + public IntrinsicCommand(Scenario.Type type, IntrinsicId[] intrinsic_ids) { + this.command = Command.INTRINSIC; + this.type = type; + this.intrinsic_ids = Arrays.stream(intrinsic_ids).map(id -> id.toString()) + .collect(Collectors.joining(",")); + } + + @Override + public void test() { + Scenario.Builder builder = Scenario.getBuilder(); + Executable exec = Utils.getRandomElement(METHODS).first; + MethodDescriptor md = getValidMethodDescriptor(exec); + CommandGenerator cmdGen = new CommandGenerator(); + + CompileCommand compileCommand = cmdGen.generateCompileCommand(command, + md, type, intrinsic_ids); + builder.add(compileCommand); + Scenario scenario = builder.build(); + scenario.execute(); + } +} diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java index 2683c35670890..ae7a4264e976c 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java @@ -34,6 +34,9 @@ import java.util.ArrayList; import java.util.List; +import static compiler.compilercontrol.share.IntrinsicCommand.VALID_INTRINSIC_SAMPLES; +import static compiler.compilercontrol.share.IntrinsicCommand.INVALID_INTRINSIC_SAMPLES; + public class MultiCommand extends AbstractTestBase { private final List testCases; @@ -51,11 +54,22 @@ public static AbstractTestBase generateRandomTest(boolean validOnly) { CommandGenerator cmdGen = new CommandGenerator(); List commands = cmdGen.generateCommands(); List testCases = new ArrayList<>(); + for (Command cmd : commands) { + String argument = null; + if (validOnly && cmd == Command.NONEXISTENT) { // replace with a valid command cmd = Command.EXCLUDE; } + if (cmd == Command.INTRINSIC) { + if (validOnly) { + argument = Utils.getRandomElement(VALID_INTRINSIC_SAMPLES); + } else { + argument = Utils.getRandomElement(INVALID_INTRINSIC_SAMPLES); + } + } + Executable exec = Utils.getRandomElement(METHODS).first; MethodDescriptor md; if (validOnly) { @@ -63,7 +77,12 @@ public static AbstractTestBase generateRandomTest(boolean validOnly) { } else { md = AbstractTestBase.METHOD_GEN.generateRandomDescriptor(exec); } - CompileCommand cc = cmdGen.generateCompileCommand(cmd, md, null); + CompileCommand cc; + if (cmd == Command.INTRINSIC) { + cc = cmdGen.generateCompileCommand(cmd, md, null, argument); + } else { + cc = cmdGen.generateCompileCommand(cmd, md, null); + } testCases.add(cc); } return new MultiCommand(testCases); diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/processors/CommandProcessor.java b/test/hotspot/jtreg/compiler/compilercontrol/share/processors/CommandProcessor.java index 947f0a4ad96e0..d798943ad691c 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/processors/CommandProcessor.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/processors/CommandProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,6 +23,7 @@ package compiler.compilercontrol.share.processors; +import compiler.compilercontrol.share.scenario.Command; import compiler.compilercontrol.share.scenario.CompileCommand; import jdk.test.lib.Asserts; import jdk.test.lib.process.OutputAnalyzer; @@ -38,6 +39,8 @@ public class CommandProcessor implements Consumer { private static final String INVALID_COMMAND_MSG = "CompileCommand: " + "\\b(unrecognized command|Bad pattern|" + "An error occurred during parsing)\\b"; + private static final String WARNING_COMMAND_MSG = "CompileCommand: An error occurred during parsing"; + private final Iterator nonQuietedIterator; private final Iterator quietedIterator; @@ -60,11 +63,16 @@ public void accept(OutputAnalyzer outputAnalyzer) { } private void check(String input) { + // -XX:CompileCommand(File) ignores invalid items + if (input.equals(WARNING_COMMAND_MSG)) { + return; + } + if (nonQuietedIterator.hasNext()) { CompileCommand command = nonQuietedIterator.next(); if (command.isValid()) { Asserts.assertTrue(input.contains(getOutputString(command)), - getOutputString(command) + "missing in output"); + getOutputString(command) + " missing in output"); } else { Asserts.assertTrue(input.matches(INVALID_COMMAND_MSG), "Error message missing for: " + getOutputString( @@ -82,9 +90,35 @@ private void check(String input) { } } - private String getOutputString(CompileCommand command) { - return "CompileCommand: " - + command.command.name + " " - + command.methodDescriptor.getCanonicalString(); + // the output here must match hotspot compilerOracle.cpp::register_command + // tty->print("CompileCommand: %s ", option2name(option)); + // matcher->print(); + private String getOutputString(CompileCommand cc) { + StringBuilder sb = new StringBuilder("CompileCommand: "); + // ControlIntrinsic output example: + // CompileCommand: ControlIntrinsic *Klass.-()V const char* ControlIntrinsic = '+_newArray -_minF +_copyOf' + sb.append(cc.command.name); + sb.append(" "); + sb.append(cc.methodDescriptor.getCanonicalString()); + if (cc.command == Command.INTRINSIC) { + sb.append(" const char* "); + sb.append("ControlIntrinsic = '"); + + if (cc.argument != null) { + boolean initial = true; + for (String id: cc.argument.split(",")) { + if(!initial) { + sb.append(" "); + } + else { + initial = false; + } + sb.append(id); + } + } + sb.append("'"); + } + + return sb.toString(); } } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java index 6d550c9d7795d..1831663a60393 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java @@ -63,8 +63,11 @@ public List getCompileCommands() { @Override public boolean isValid() { - // -XX:CompileCommand(File) ignores invalid items - return true; + boolean isValid = true; + for (CompileCommand cmd : compileCommands) { + isValid &= cmd.isValid(); + } + return isValid; } /* diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java index e60fe0e7fe7eb..edbf4298bb917 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java @@ -39,6 +39,7 @@ public enum Command { "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE), PRINT("print", ""), QUIET("quiet", ""), + INTRINSIC("ControlIntrinsic", ""), NONEXISTENT("nonexistent", ""); // wrong command for a negative case /** diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandFileBuilder.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandFileBuilder.java index 071ec2fa4fd81..7b1b5f8ae5ea1 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandFileBuilder.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandFileBuilder.java @@ -27,6 +27,7 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import java.util.function.Function; /** * Creates CompileCommandFile from the given array of commands @@ -40,11 +41,21 @@ public CommandFileBuilder(String fileName) { @Override public List getOptions() { + Function mapper = cc -> { + StringBuilder sb = new StringBuilder(cc.command.name); + sb.append(" "); + sb.append(cc.methodDescriptor.getString()); + if (cc.argument != null) { + sb.append(" "); + sb.append(cc.argument); + } + return sb.toString(); + }; + // Create CommandFile try (PrintWriter pw = new PrintWriter(fileName)) { compileCommands.stream() - .map(cc -> cc.command.name + " " - + cc.methodDescriptor.getString()) + .map(mapper) .forEach(pw::println); if (pw.checkError()) { throw new Error("TESTBUG: write error"); diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandGenerator.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandGenerator.java index 11704b1df99ef..5f1033b7fc5b1 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandGenerator.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandGenerator.java @@ -24,6 +24,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; +import jdk.test.lib.Asserts; import jdk.test.lib.Utils; import java.util.List; @@ -88,6 +89,15 @@ public CompileCommand generateCompileCommand(Command command, return type.createCompileCommand(command, md, generateCompiler()); } + public CompileCommand generateCompileCommand(Command command, + MethodDescriptor md, Scenario.Type type, String argument) { + if (type == null) { + type = Utils.getRandomElement(Scenario.Type.values()); + } + return type.createCompileCommand(command, md, generateCompiler(), argument); + } + + /** * Generates type of compiler that should be used for the command, or null * if any or all compilers should be used diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandOptionsBuilder.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandOptionsBuilder.java index 8afabf3025b88..e15a8ce6f6531 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandOptionsBuilder.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandOptionsBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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,22 +23,32 @@ package compiler.compilercontrol.share.scenario; -import compiler.compilercontrol.share.method.MethodDescriptor; - +import java.util.function.Function; import java.util.List; import java.util.stream.Collectors; +import static compiler.compilercontrol.share.method.MethodDescriptor.Separator.COMMA; /** * Creates VM options by adding CompileCommand prefix to commands */ public class CommandOptionsBuilder extends AbstractCommandBuilder { @Override public List getOptions() { - return compileCommands.stream() - .map(cc -> "-XX:CompileCommand=" - + cc.command.name - + MethodDescriptor.Separator.COMMA.symbol - + cc.methodDescriptor.getString()) - .collect(Collectors.toList()); + Function mapper = cc -> { + StringBuilder sb = new StringBuilder("-XX:CompileCommand="); + sb.append(cc.command.name); + sb.append(COMMA.symbol); + sb.append(cc.methodDescriptor.getString()); + if (cc.argument != null) { + sb.append(COMMA.symbol); + sb.append(cc.argument); + } + return sb.toString(); + }; + + List options = compileCommands.stream() + .map(mapper).collect(Collectors.toList()); + + return options; } } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CompileCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CompileCommand.java index a22a45191a194..a011fd7a7f3c0 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CompileCommand.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CompileCommand.java @@ -33,6 +33,7 @@ public class CompileCommand { public final MethodDescriptor methodDescriptor; public final Scenario.Compiler compiler; public final Scenario.Type type; + public final String argument; public CompileCommand(Command command, MethodDescriptor methodDescriptor, @@ -42,8 +43,22 @@ public CompileCommand(Command command, this.methodDescriptor = methodDescriptor; this.compiler = compiler; this.type = type; + this.argument = null; } + public CompileCommand(Command command, + MethodDescriptor methodDescriptor, + Scenario.Compiler compiler, + Scenario.Type type, + String argument) { + this.command = command; + this.methodDescriptor = methodDescriptor; + this.compiler = compiler; + this.type = type; + this.argument = argument; + } + + /** * Shows that this compile command is valid * @@ -53,6 +68,24 @@ public boolean isValid() { if (command == Command.NONEXISTENT) { return false; } + // -XX:CompileCommand(File) ignores invalid items + // Invalid intrinsic ids in CompilerDirectivesFile will force hotspot to exit with non-zero value. + if (command == Command.INTRINSIC && type == Scenario.Type.DIRECTIVE) { + if (argument != null) { + String[] ids = argument.split(","); + for (String id : ids) { + char ch = id.charAt(0); + + // Not a strict check. + // a valid ControlIntrinsic argument is separated by ",", each one starts with '+' or '-'. + // intrinsicId starts with '_' + if ((ch != '+' && ch != '-') || id.charAt(1) != '_') { + return false; + } + } + } + } + return methodDescriptor.isValid(); } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveBuilder.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveBuilder.java index 3797d1f28107d..3e0fee57e2b1a 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveBuilder.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveBuilder.java @@ -212,6 +212,9 @@ private void handleCommand(DirectiveWriter dirFile, CompileCommand cmd) { case PRINT: dirFile.option(DirectiveWriter.Option.PRINT_ASSEMBLY, true); break; + case INTRINSIC: + dirFile.option(DirectiveWriter.Option.INTRINSIC, "\"" + cmd.argument + "\""); + break; case NONEXISTENT: dirFile.write(JSONFile.Element.PAIR, command.name); dirFile.write(JSONFile.Element.OBJECT); diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveWriter.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveWriter.java index 414771a8edf07..85b85dfd6a883 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveWriter.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/DirectiveWriter.java @@ -192,7 +192,8 @@ public enum Option { PRINT_ASSEMBLY("PrintAssembly"), LOG("Log"), EXCLUDE("Exclude"), - ENABLE("Enable"); + ENABLE("Enable"), + INTRINSIC("ControlIntrinsic"); public final String string; diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java index 19ebd612e7ccc..8a868e89ee6c9 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Executor.java @@ -85,7 +85,7 @@ public List execute() { vmOptions.add(execClass); OutputAnalyzer output; try (ServerSocket serverSocket = new ServerSocket(0)) { - if (isValid) { + { // Get port test VM will connect to int port = serverSocket.getLocalPort(); if (port == -1) { @@ -150,7 +150,11 @@ private void connectTestVM(ServerSocket serverSocket) { pw.println(); } } catch (IOException e) { - throw new Error("Failed to write data: " + e.getMessage(), e); + // hotspot process may exit because of invalid directives, + // suppress the IOException of closed socket. + if (!e.getMessage().equals("Socket closed")) { + throw new Error("Failed to write data: " + e.getMessage(), e); + } } } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/JcmdCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/JcmdCommand.java index 4e38ab5f1a5a0..5ac50237893fd 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/JcmdCommand.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/JcmdCommand.java @@ -37,6 +37,17 @@ public JcmdCommand(Command command, this.jcmdType = jcmdType; } + public JcmdCommand(Command command, + MethodDescriptor methodDescriptor, + Scenario.Compiler compiler, + Scenario.Type type, + Scenario.JcmdType jcmdType, + String argument) { + super(command, methodDescriptor, compiler, type, argument); + this.jcmdType = jcmdType; + } + + /** * Enchances parent's class method with the the JCMDtype printing: * {@code ... JCMDType: } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java index f10b74ad1b600..785ee5aa17178 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Scenario.java @@ -110,18 +110,23 @@ private Scenario(boolean isValid, public void execute() { List outputList = executor.execute(); // The first one contains output from the test VM - OutputAnalyzer mainOuput = outputList.get(0); + OutputAnalyzer mainOutput = outputList.get(0); if (isValid) { - mainOuput.shouldHaveExitValue(0); - processors.forEach(processor -> processor.accept(mainOuput)); + mainOutput.shouldHaveExitValue(0); + processors.forEach(processor -> processor.accept(mainOutput)); // only the last output contains directives got from print command List last = new ArrayList<>(); last.add(outputList.get(outputList.size() - 1)); jcmdProcessor.accept(last); } else { - Asserts.assertNE(mainOuput.getExitValue(), 0, "VM should exit with " - + "error for incorrect directives"); - mainOuput.shouldContain("Parsing of compiler directives failed"); + // two cases for invalid inputs. + if (mainOutput.getExitValue() == 0) { + mainOutput.shouldContain("CompileCommand: An error occurred during parsing"); + } else { + Asserts.assertNE(mainOutput.getExitValue(), 0, "VM should exit with " + + "error for incorrect directives"); + mainOutput.shouldContain("Parsing of compiler directives failed"); + } } } @@ -164,8 +169,8 @@ private JcmdType(String command) { * Type of the compile command */ public static enum Type { - OPTION(""), - FILE("command_file"), + OPTION(""), // CompilerOracle: -XX:CompileCommand= + FILE("command_file"), // CompilerOracle: -XX:CompileCommandFile= DIRECTIVE("directives.json"), JCMD("jcmd_directives.json") { @Override @@ -174,6 +179,13 @@ public CompileCommand createCompileCommand(Command command, return new JcmdCommand(command, md, compiler, this, JcmdType.ADD); } + + @Override + public CompileCommand createCompileCommand(Command command, + MethodDescriptor md, Compiler compiler, String argument) { + return new JcmdCommand(command, md, compiler, this, + JcmdType.ADD, argument); + } }; public final String fileName; @@ -183,6 +195,11 @@ public CompileCommand createCompileCommand(Command command, return new CompileCommand(command, md, compiler, this); } + public CompileCommand createCompileCommand(Command command, + MethodDescriptor md, Compiler compiler, String argument) { + return new CompileCommand(command, md, compiler, this, argument); + } + private Type(String fileName) { this.fileName = fileName; } diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/State.java b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/State.java index 82a46e7dc6993..afb2457de34a5 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/State.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/State.java @@ -42,6 +42,7 @@ public class State { private Optional printAssembly = Optional.empty(); private Optional printInline = Optional.empty(); private Optional log = Optional.empty(); + private Optional controlIntrinsic = Optional.empty(); public State() { Arrays.fill(compile, Optional.empty()); @@ -275,6 +276,12 @@ public void setPrintInline(boolean value) { printInline = Optional.of(value); } + public void setControlIntrinsic(String argument) { + if (argument != null) { + controlIntrinsic = Optional.of(argument); + } + } + public boolean isLog() { return log.orElse(false); } @@ -314,6 +321,9 @@ public void apply(CompileCommand compileCommand) { case PRINT: setPrintAssembly(true); break; + case INTRINSIC: + setControlIntrinsic(compileCommand.argument); + break; case QUIET: case NONEXISTENT: // doesn't apply the state @@ -368,6 +378,9 @@ public static State merge(State low, State high) { result.printInline = mergeOptional(high.printInline, low.printInline); // set LogCompilation result.log = mergeOptional(high.log, low.log); + // set controlIntrinsic + result.controlIntrinsic = mergeOptional(high.controlIntrinsic, low.controlIntrinsic); + return result; } diff --git a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java index ea253dcbc9ddb..2dbf26d962851 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java +++ b/test/hotspot/jtreg/compiler/intrinsics/IntrinsicDisabledTest.java @@ -44,19 +44,19 @@ * -XX:+WhiteBoxAPI * -XX:ControlIntrinsic=-_putCharVolatile,-_putInt * -XX:ControlIntrinsic=-_putIntVolatile - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,ControlIntrinsic,-_getCharVolatile,-_getInt - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,ControlIntrinsic,-_getIntVolatile + * -XX:CompileCommand=ControlIntrinsic,jdk.internal.misc.Unsafe::putChar,-_getCharVolatile,-_getInt + * -XX:CompileCommand=ControlIntrinsic,jdk.internal.misc.Unsafe::putCharVolatile,-_getIntVolatile * compiler.intrinsics.IntrinsicDisabledTest * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI - * -XX:ControlIntrinsic=+putIntVolatile,+_putCharVolatile,+_putInt + * -XX:ControlIntrinsic=+_putIntVolatile,+_putCharVolatile,+_putInt * -XX:DisableIntrinsic=_putCharVolatile,_putInt * -XX:DisableIntrinsic=_putIntVolatile - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,ControlIntrinsic,+_getCharVolatile,+_getInt - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,ControlIntrinsic,+_getIntVolatile - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putChar,ccstrlist,DisableIntrinsic,_getCharVolatile,_getInt - * -XX:CompileCommand=option,jdk.internal.misc.Unsafe::putCharVolatile,ccstrlist,DisableIntrinsic,_getIntVolatile + * -XX:CompileCommand=ControlIntrinsic,jdk.internal.misc.Unsafe::putChar,+_getCharVolatile,+_getInt + * -XX:CompileCommand=ControlIntrinsic,jdk.internal.misc.Unsafe::putCharVolatile,+_getIntVolatile + * -XX:CompileCommand=DisableIntrinsic,jdk.internal.misc.Unsafe::putChar,_getCharVolatile,_getInt + * -XX:CompileCommand=DisableIntrinsic,jdk.internal.misc.Unsafe::putCharVolatile,_getIntVolatile * compiler.intrinsics.IntrinsicDisabledTest */ From 952dc704024d44c8f37449382fe769320f9dad1c Mon Sep 17 00:00:00 2001 From: Julia Boes Date: Thu, 17 Dec 2020 11:32:58 +0000 Subject: [PATCH 279/504] 8257636: Update usage of "type" terminology in java.lang.Class and java.lang.reflect Reviewed-by: darcy --- .../share/classes/java/lang/Class.java | 74 +++++++++---------- .../java/lang/reflect/AnnotatedArrayType.java | 4 +- .../java/lang/reflect/AnnotatedElement.java | 2 +- .../reflect/AnnotatedParameterizedType.java | 6 +- .../java/lang/reflect/AnnotatedType.java | 6 +- .../java/lang/reflect/Constructor.java | 2 +- .../classes/java/lang/reflect/Field.java | 6 +- .../java/lang/reflect/GenericArrayType.java | 4 +- .../reflect/GenericSignatureFormatError.java | 6 +- .../classes/java/lang/reflect/Method.java | 7 +- .../java/lang/reflect/ParameterizedType.java | 12 +-- .../classes/java/lang/reflect/Proxy.java | 9 ++- .../java/lang/reflect/ProxyGenerator.java | 5 +- .../java/lang/reflect/RecordComponent.java | 4 +- 14 files changed, 74 insertions(+), 73 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 16d5dc6e5dc6b..cf8c873357787 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -91,8 +91,8 @@ /** * Instances of the class {@code Class} represent classes and - * interfaces in a running Java application. An enum type and a record - * type are kinds of class; an annotation type is a kind of + * interfaces in a running Java application. An enum class and a record + * class are kinds of class; an annotation interface is a kind of * interface. Every array also belongs to a class that is reflected as * a {@code Class} object that is shared by all arrays with the same * element type and number of dimensions. The primitive Java types @@ -131,7 +131,7 @@ * * * It is also possible to get the {@code Class} object for a named - * type (or for {@code void}) using a class literal. + * class or interface (or for {@code void}) using a class literal. * For example: * *

      @@ -159,8 +159,8 @@ * {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClass(byte[], boolean, MethodHandles.Lookup.ClassOption...) * Lookup::defineHiddenClass} is a {@linkplain Class#isHidden() hidden} * class or interface. - * All kinds of class, including enum types and record types, may be - * hidden classes; all kinds of interface, including annotation types, + * All kinds of class, including enum classes and record classes, may be + * hidden classes; all kinds of interface, including annotation interfaces, * may be hidden interfaces. * * The {@linkplain #getName() name of a hidden class or interface} is @@ -294,7 +294,7 @@ public String toGenericString() { if (isAnnotation()) { sb.append('@'); } - if (isInterface()) { // Note: all annotation types are interfaces + if (isInterface()) { // Note: all annotation interfaces are interfaces sb.append("interface"); } else { if (isEnum()) @@ -767,11 +767,11 @@ public Void run() { /** * Returns true if this {@code Class} object represents an annotation - * type. Note that if this method returns true, {@link #isInterface()} - * would also return true, as all annotation types are also interfaces. + * interface. Note that if this method returns true, {@link #isInterface()} + * would also return true, as all annotation interfaces are also interfaces. * * @return {@code true} if this {@code Class} object represents an annotation - * type; {@code false} otherwise + * interface; {@code false} otherwise * @since 1.5 */ public boolean isAnnotation() { @@ -1298,8 +1298,8 @@ private Class elementType() { * {@code null} otherwise. * * In particular, this method returns {@code null} if the underlying - * class is a local or anonymous class immediately enclosed by a type - * declaration, instance initializer or static initializer. + * class is a local or anonymous class immediately enclosed by a class or + * interface declaration, instance initializer or static initializer. * * @return the immediately enclosing method of the underlying class, if * that class is a local or anonymous class; otherwise {@code null}. @@ -1456,8 +1456,8 @@ private static Class toClass(Type o) { * the immediately enclosing constructor of the underlying * class. Returns {@code null} otherwise. In particular, this * method returns {@code null} if the underlying class is a local - * or anonymous class immediately enclosed by a type declaration, - * instance initializer or static initializer. + * or anonymous class immediately enclosed by a class or + * interface declaration, instance initializer or static initializer. * * @return the immediately enclosing constructor of the underlying class, if * that class is a local or anonymous class; otherwise {@code null}. @@ -1650,9 +1650,9 @@ private String getSimpleName0() { } /** - * Return an informative string for the name of this type. + * Return an informative string for the name of this class or interface. * - * @return an informative string for the name of this type + * @return an informative string for the name of this class or interface * @since 1.8 */ public String getTypeName() { @@ -2371,7 +2371,7 @@ public Field[] getDeclaredFields() throws SecurityException { * * * - * @jls 8.10 Record Types + * @jls 8.10 Record Classes * @since 16 */ @CallerSensitive @@ -2392,14 +2392,14 @@ public RecordComponent[] getRecordComponents() { * Class} object, including public, protected, default (package) * access, and private methods, but excluding inherited methods. * - *

      If this {@code Class} object represents a type that has multiple - * declared methods with the same name and parameter types, but different - * return types, then the returned array has a {@code Method} object for - * each such method. + *

      If this {@code Class} object represents a class or interface that + * has multiple declared methods with the same name and parameter types, + * but different return types, then the returned array has a {@code Method} + * object for each such method. * - *

      If this {@code Class} object represents a type that has a class - * initialization method {@code }, then the returned array does - * not have a corresponding {@code Method} object. + *

      If this {@code Class} object represents a class or interface that + * has a class initialization method {@code }, then the returned + * array does not have a corresponding {@code Method} object. * *

      If this {@code Class} object represents a class or interface with no * declared methods, then the returned array has length 0. @@ -3671,13 +3671,13 @@ public boolean desiredAssertionStatus() { * Returns true if and only if this class was declared as an enum in the * source code. * - * Note that {@link java.lang.Enum} is not itself an enum type. + * Note that {@link java.lang.Enum} is not itself an enum class. * * Also note that if an enum constant is declared with a class body, * the class of that enum constant object is an anonymous class - * and not the class of the declaring enum type. The + * and not the class of the declaring enum class. The * {@link Enum#getDeclaringClass} method of an enum constant can - * be used to get the class of the enum type declaring the + * be used to get the class of the enum class declaring the * constant. * * @return true if and only if this class was declared as an enum in the @@ -3702,11 +3702,11 @@ public boolean isEnum() { * components; {@link #getRecordComponents()} returns a non-null but * possibly empty value for a record. * - *

      Note that class {@link Record} is not a record type and thus invoking - * this method on class {@code Record} returns {@code false}. + *

      Note that class {@link Record} is not a record class and thus + * invoking this method on class {@code Record} returns {@code false}. * * @return true if and only if this class is a record class, otherwise false - * @jls 8.10 Record Types + * @jls 8.10 Record Classes * @since 16 */ public boolean isRecord() { @@ -3730,12 +3730,12 @@ private static ReflectionFactory getReflectionFactory() { /** * Returns the elements of this enum class or null if this - * Class object does not represent an enum type. + * Class object does not represent an enum class. * * @return an array containing the values comprising the enum class * represented by this {@code Class} object in the order they're * declared, or null if this {@code Class} object does not - * represent an enum type + * represent an enum class * @since 1.5 */ public T[] getEnumConstants() { @@ -3745,7 +3745,7 @@ public T[] getEnumConstants() { /** * Returns the elements of this enum class or null if this - * Class object does not represent an enum type; + * Class object does not represent an enum class; * identical to getEnumConstants except that the result is * uncloned, cached, and shared by all callers. */ @@ -3788,7 +3788,7 @@ Map enumConstantDirectory() { T[] universe = getEnumConstantsShared(); if (universe == null) throw new IllegalArgumentException( - getName() + " is not an enum type"); + getName() + " is not an enum class"); directory = new HashMap<>((int)(universe.length / 0.75f) + 1); for (T constant : universe) { directory.put(((Enum)constant).name(), constant); @@ -4024,7 +4024,7 @@ private AnnotationData createAnnotationData(int classRedefinedCount) { return new AnnotationData(annotations, declaredAnnotations, classRedefinedCount); } - // Annotation types cache their internal (AnnotationType) form + // Annotation interfaces cache their internal (AnnotationType) form @SuppressWarnings("UnusedDeclaration") private transient volatile AnnotationType annotationType; @@ -4050,10 +4050,10 @@ Map, Annotation> getDeclaredAnnotationMap() { * Returns an {@code AnnotatedType} object that represents the use of a * type to specify the superclass of the entity represented by this {@code * Class} object. (The use of type Foo to specify the superclass - * in '... extends Foo' is distinct from the declaration of type + * in '... extends Foo' is distinct from the declaration of class * Foo.) * - *

      If this {@code Class} object represents a type whose declaration + *

      If this {@code Class} object represents a class whose declaration * does not explicitly indicate an annotated superclass, then the return * value is an {@code AnnotatedType} object representing an element with no * annotations. @@ -4082,7 +4082,7 @@ public AnnotatedType getAnnotatedSuperclass() { * of types to specify superinterfaces of the entity represented by this * {@code Class} object. (The use of type Foo to specify a * superinterface in '... implements Foo' is distinct from the - * declaration of type Foo.) + * declaration of interface Foo.) * *

      If this {@code Class} object represents a class, the return value is * an array containing objects representing the uses of interface types to diff --git a/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java b/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java index fa9ccc03686b4..3d99eefa5af13 100644 --- a/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java +++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java @@ -46,8 +46,8 @@ public interface AnnotatedArrayType extends AnnotatedType { /** * Returns the potentially annotated type that this type is a member of, if - * this type represents a nested type. For example, if this type is - * {@code @TA O.I}, return a representation of {@code @TA O}. + * this type represents a nested class or interface. For example, if this + * type is {@code @TA O.I}, return a representation of {@code @TA O}. * *

      Returns {@code null} for an {@code AnnotatedType} that is an instance * of {@code AnnotatedArrayType}. diff --git a/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java b/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java index 933ffab3e7377..ef5b962be93c2 100644 --- a/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java +++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedElement.java @@ -248,7 +248,7 @@ * *

      Similarly, attempting to read an enum-valued member will result in * a {@link EnumConstantNotPresentException} if the enum constant in the - * annotation is no longer present in the enum type. + * annotation is no longer present in the enum class. * *

      If an annotation type T is (meta-)annotated with an * {@code @Repeatable} annotation whose value element indicates a type diff --git a/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java b/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java index fc32e91011616..9ecf35f828fa0 100644 --- a/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java +++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java @@ -49,13 +49,13 @@ public interface AnnotatedParameterizedType extends AnnotatedType { * {@code @TA O.I}, return a representation of {@code @TA O}. * *

      Returns {@code null} if this {@code AnnotatedType} represents a - * top-level type, or a local or anonymous class, or a primitive type, or - * void. + * top-level class or interface, or a local or anonymous class, or + * a primitive type, or void. * * @return an {@code AnnotatedType} object representing the potentially * annotated type that this type is a member of, or {@code null} * @throws TypeNotPresentException if the owner type - * refers to a non-existent type declaration + * refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if the owner type * refers to a parameterized type that cannot be instantiated * for any reason diff --git a/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java b/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java index 662cdd42e3606..9525d3638fdd0 100644 --- a/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java +++ b/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java @@ -55,8 +55,8 @@ public interface AnnotatedType extends AnnotatedElement { * {@code @TA O.I}, return a representation of {@code @TA O}. * *

      Returns {@code null} if this {@code AnnotatedType} represents a - * top-level type, or a local or anonymous class, or a primitive type, or - * void. + * top-level class or interface, or a local or anonymous class, or + * a primitive type, or void. * *

      Returns {@code null} if this {@code AnnotatedType} is an instance of * {@code AnnotatedArrayType}, {@code AnnotatedTypeVariable}, or @@ -69,7 +69,7 @@ public interface AnnotatedType extends AnnotatedElement { * @return an {@code AnnotatedType} object representing the potentially * annotated type that this type is a member of, or {@code null} * @throws TypeNotPresentException if the owner type - * refers to a non-existent type declaration + * refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if the owner type * refers to a parameterized type that cannot be instantiated * for any reason diff --git a/src/java.base/share/classes/java/lang/reflect/Constructor.java b/src/java.base/share/classes/java/lang/reflect/Constructor.java index ed8c9c59f4e0d..7a2309c25f118 100644 --- a/src/java.base/share/classes/java/lang/reflect/Constructor.java +++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java @@ -462,7 +462,7 @@ void specificToGenericStringHeader(StringBuilder sb) { * after possible unwrapping, a parameter value * cannot be converted to the corresponding formal * parameter type by a method invocation conversion; if - * this constructor pertains to an enum type. + * this constructor pertains to an enum class. * @throws InstantiationException if the class that declares the * underlying constructor represents an abstract class. * @throws InvocationTargetException if the underlying constructor diff --git a/src/java.base/share/classes/java/lang/reflect/Field.java b/src/java.base/share/classes/java/lang/reflect/Field.java index 4c1e394f78c31..28fa076816b4f 100644 --- a/src/java.base/share/classes/java/lang/reflect/Field.java +++ b/src/java.base/share/classes/java/lang/reflect/Field.java @@ -206,10 +206,10 @@ public int getModifiers() { /** * Returns {@code true} if this field represents an element of - * an enumerated type; returns {@code false} otherwise. + * an enumerated class; returns {@code false} otherwise. * * @return {@code true} if and only if this field represents an element of - * an enumerated type. + * an enumerated class. * @since 1.5 */ public boolean isEnumConstant() { @@ -258,7 +258,7 @@ public Class getType() { * The Java Virtual Machine Specification * @throws TypeNotPresentException if the generic type * signature of the underlying field refers to a non-existent - * type declaration + * class or interface declaration * @throws MalformedParameterizedTypeException if the generic * signature of the underlying field refers to a parameterized type * that cannot be instantiated for any reason diff --git a/src/java.base/share/classes/java/lang/reflect/GenericArrayType.java b/src/java.base/share/classes/java/lang/reflect/GenericArrayType.java index ad4e047f74895..80a280ef33f1c 100644 --- a/src/java.base/share/classes/java/lang/reflect/GenericArrayType.java +++ b/src/java.base/share/classes/java/lang/reflect/GenericArrayType.java @@ -44,8 +44,8 @@ public interface GenericArrayType extends Type { * * @return a {@code Type} object representing the component type * of this array - * @throws TypeNotPresentException if the underlying array type's - * component type refers to a non-existent type declaration + * @throws TypeNotPresentException if the underlying array type's component + * type refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if the * underlying array type's component type refers to a * parameterized type that cannot be instantiated for any reason diff --git a/src/java.base/share/classes/java/lang/reflect/GenericSignatureFormatError.java b/src/java.base/share/classes/java/lang/reflect/GenericSignatureFormatError.java index 7200e49f7c3cb..0d2b6c6720011 100644 --- a/src/java.base/share/classes/java/lang/reflect/GenericSignatureFormatError.java +++ b/src/java.base/share/classes/java/lang/reflect/GenericSignatureFormatError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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,8 @@ /** * Thrown when a syntactically malformed signature attribute is - * encountered by a reflective method that needs to interpret the - * generic signature information for a type, method or constructor. + * encountered by a reflective method that needs to interpret the generic + * signature information for a class or interface, method or constructor. * * @since 1.5 */ diff --git a/src/java.base/share/classes/java/lang/reflect/Method.java b/src/java.base/share/classes/java/lang/reflect/Method.java index 567ae8be660ad..080851cc9eeb3 100644 --- a/src/java.base/share/classes/java/lang/reflect/Method.java +++ b/src/java.base/share/classes/java/lang/reflect/Method.java @@ -282,9 +282,9 @@ public Class getReturnType() { * specified in * The Java Virtual Machine Specification * @throws TypeNotPresentException if the underlying method's - * return type refers to a non-existent type declaration + * return type refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if the - * underlying method's return typed refers to a parameterized + * underlying method's return type refers to a parameterized * type that cannot be instantiated for any reason * @since 1.5 */ @@ -603,8 +603,7 @@ public boolean isSynthetic() { * method; returns {@code false} otherwise. * * A default method is a public non-abstract instance method, that - * is, a non-static method with a body, declared in an interface - * type. + * is, a non-static method with a body, declared in an interface. * * @return true if and only if this method is a default * method as defined by the Java Language Specification. diff --git a/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java b/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java index 62d6b7bf9e501..99016623a3e48 100644 --- a/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java +++ b/src/java.base/share/classes/java/lang/reflect/ParameterizedType.java @@ -32,15 +32,15 @@ * *

      A parameterized type is created the first time it is needed by a * reflective method, as specified in this package. When a - * parameterized type p is created, the generic type declaration that - * p instantiates is resolved, and all type arguments of p are created + * parameterized type p is created, the generic class or interface declaration + * that p instantiates is resolved, and all type arguments of p are created * recursively. See {@link java.lang.reflect.TypeVariable * TypeVariable} for details on the creation process for type * variables. Repeated creation of a parameterized type has no effect. * *

      Instances of classes that implement this interface must implement * an equals() method that equates any two instances that share the - * same generic type declaration and have equal type parameters. + * same generic class or interface declaration and have equal type parameters. * * @jls 4.5 Parameterized Types * @since 1.5 @@ -56,8 +56,8 @@ public interface ParameterizedType extends Type { * * @return an array of {@code Type} objects representing the actual type * arguments to this type - * @throws TypeNotPresentException if any of the - * actual type arguments refers to a non-existent type declaration + * @throws TypeNotPresentException if any of the actual type arguments + * refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if any of the * actual type parameters refer to a parameterized type that cannot * be instantiated for any reason @@ -86,7 +86,7 @@ public interface ParameterizedType extends Type { * this type is a member of. If this type is a top-level type, * {@code null} is returned * @throws TypeNotPresentException if the owner type - * refers to a non-existent type declaration + * refers to a non-existent class or interface declaration * @throws MalformedParameterizedTypeException if the owner type * refers to a parameterized type that cannot be instantiated * for any reason diff --git a/src/java.base/share/classes/java/lang/reflect/Proxy.java b/src/java.base/share/classes/java/lang/reflect/Proxy.java index ad123b55118e7..1d03c37aae741 100644 --- a/src/java.base/share/classes/java/lang/reflect/Proxy.java +++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java @@ -240,10 +240,11 @@ * *

      * A dynamic module can read the modules of all of the superinterfaces of a proxy - * class and the modules of the types referenced by all public method signatures - * of a proxy class. If a superinterface or a referenced type, say {@code T}, - * is in a non-exported package, the {@linkplain Module module} of {@code T} is - * updated to export the package of {@code T} to the dynamic module. + * class and the modules of the classes and interfaces referenced by + * all public method signatures of a proxy class. If a superinterface or + * a referenced class or interface, say {@code T}, is in a non-exported package, + * the {@linkplain Module module} of {@code T} is updated to export the + * package of {@code T} to the dynamic module. * *

      Methods Duplicated in Multiple Proxy Interfaces

      * diff --git a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java index 5932113bd789b..ba595d473ef4b 100644 --- a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java +++ b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java @@ -203,10 +203,11 @@ public Void run() { } /** - * Return an array of the type names from an array of Classes. + * Return an array of the class and interface names from an array of Classes. * * @param classes an array of classes or interfaces - * @return the array of class names; or null if there are no classes + * @return the array of class and interface names; or null if classes is + * null or empty */ private static String[] typeNames(List> classes) { if (classes == null || classes.size() == 0) diff --git a/src/java.base/share/classes/java/lang/reflect/RecordComponent.java b/src/java.base/share/classes/java/lang/reflect/RecordComponent.java index 50d36418631a0..bca4705ca8711 100644 --- a/src/java.base/share/classes/java/lang/reflect/RecordComponent.java +++ b/src/java.base/share/classes/java/lang/reflect/RecordComponent.java @@ -43,7 +43,7 @@ * * @see Class#getRecordComponents() * @see java.lang.Record - * @jls 8.10 Record Types + * @jls 8.10 Record Classes * @since 16 */ public final class RecordComponent implements AnnotatedElement { @@ -83,7 +83,7 @@ public Class getType() { } /** - * Returns a {@code String} that describes the generic type signature for + * Returns a {@code String} that describes the generic type signature for * this record component. * * @return a {@code String} that describes the generic type signature for From 6aa8eed3524f0c98bed367425ce052a1608cb578 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 17 Dec 2020 13:35:09 +0000 Subject: [PATCH 280/504] 8258415: gtest for committed memory leaks reservation Reviewed-by: hseigel, stuefe --- test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index 7dbaee5e6f74e..83e6315c589f8 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, 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 @@ -202,6 +202,8 @@ class CommittedVirtualMemoryTest { ASSERT_TRUE(result); ASSERT_EQ(2 * page_sz, committed_size); ASSERT_EQ(committed_start, (address)(base + page_sz)); + + os::release_memory(base, size); } }; From 61390d8e452058efe00ca8ce833baa879fbb9c9e Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Thu, 17 Dec 2020 14:18:00 +0000 Subject: [PATCH 281/504] 8257999: Parallel GC crash in gc/parallel/TestDynShrinkHeap.java: new region is not in covered_region Reviewed-by: sjohanss, tschatzl --- src/hotspot/share/gc/parallel/psOldGen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/parallel/psOldGen.cpp b/src/hotspot/share/gc/parallel/psOldGen.cpp index 51500f8c3075f..5d23956d466d9 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.cpp +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp @@ -35,6 +35,7 @@ #include "logging/log.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +#include "runtime/orderAccess.hpp" #include "utilities/align.hpp" PSOldGen::PSOldGen(ReservedSpace rs, size_t initial_size, size_t min_size, @@ -380,7 +381,9 @@ void PSOldGen::post_resize() { WorkGang* workers = Thread::current()->is_VM_thread() ? &ParallelScavengeHeap::heap()->workers() : NULL; - // ALWAYS do this last!! + // Ensure the space bounds are updated and made visible to other + // threads after the other data structures have been resized. + OrderAccess::storestore(); object_space()->initialize(new_memregion, SpaceDecorator::DontClear, SpaceDecorator::DontMangle, From 7aac4dc17573b7df2af8aa3d1f01add56b30ad02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Thu, 17 Dec 2020 14:34:44 +0000 Subject: [PATCH 282/504] 8257621: JFR StringPool misses cached items across consecutive recordings Reviewed-by: egahlin --- src/hotspot/share/jfr/jni/jfrJniMethod.cpp | 8 +-- src/hotspot/share/jfr/jni/jfrJniMethod.hpp | 4 +- .../jfr/jni/jfrJniMethodRegistration.cpp | 3 +- .../checkpoint/jfrCheckpointManager.cpp | 22 ++----- .../types/traceid/jfrTraceIdEpoch.cpp | 3 +- .../types/traceid/jfrTraceIdEpoch.hpp | 21 ++----- .../recorder/service/jfrRecorderService.cpp | 10 +-- .../jfr/recorder/stringpool/jfrStringPool.cpp | 50 +++------------ .../jfr/recorder/stringpool/jfrStringPool.hpp | 4 +- src/hotspot/share/jfr/utilities/jfrSignal.hpp | 51 +++++++++++++++ .../classes/jdk/jfr/internal/EventWriter.java | 5 ++ .../share/classes/jdk/jfr/internal/JVM.java | 13 +--- .../classes/jdk/jfr/internal/StringPool.java | 63 +++++++------------ test/jdk/ProblemList.txt | 1 - 14 files changed, 106 insertions(+), 152 deletions(-) create mode 100644 src/hotspot/share/jfr/utilities/jfrSignal.hpp diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index 3e8404e145c0c..306691746b3ad 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -160,10 +160,6 @@ NO_TRANSITION(jboolean, jfr_is_available(JNIEnv* env, jclass jvm)) return !Jfr::is_disabled() ? JNI_TRUE : JNI_FALSE; NO_TRANSITION_END -NO_TRANSITION(jlong, jfr_get_epoch_address(JNIEnv* env, jobject jvm)) - return JfrTraceIdEpoch::epoch_address(); -NO_TRANSITION_END - NO_TRANSITION(jlong, jfr_get_unloaded_event_classes_count(JNIEnv* env, jobject jvm)) return JfrKlassUnloading::event_class_count(); NO_TRANSITION_END @@ -327,8 +323,8 @@ JVM_ENTRY_NO_ENV(jlong, jfr_type_id(JNIEnv* env, jobject jvm, jclass jc)) return JfrTraceId::load_raw(jc); JVM_END -JVM_ENTRY_NO_ENV(jboolean, jfr_add_string_constant(JNIEnv* env, jclass jvm, jboolean epoch, jlong id, jstring string)) - return JfrStringPool::add(epoch == JNI_TRUE, id, string, thread) ? JNI_TRUE : JNI_FALSE; +JVM_ENTRY_NO_ENV(jboolean, jfr_add_string_constant(JNIEnv* env, jclass jvm, jlong id, jstring string)) + return JfrStringPool::add(id, string, thread); JVM_END JVM_ENTRY_NO_ENV(void, jfr_set_force_instrumentation(JNIEnv* env, jobject jvm, jboolean force_instrumentation)) diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp index a193df55f9f23..aedfa03c0e51e 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp @@ -120,9 +120,7 @@ jboolean JNICALL jfr_event_writer_flush(JNIEnv* env, jclass cls, jobject writer, void JNICALL jfr_flush(JNIEnv* env, jobject jvm); void JNICALL jfr_abort(JNIEnv* env, jobject jvm, jstring errorMsg); -jlong JNICALL jfr_get_epoch_address(JNIEnv* env, jobject jvm); - -jboolean JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jboolean epoch, jlong id, jstring string); +jboolean JNICALL jfr_add_string_constant(JNIEnv* env, jclass jvm, jlong id, jstring string); void JNICALL jfr_uncaught_exception(JNIEnv* env, jobject jvm, jobject thread, jthrowable throwable); diff --git a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp index 2d11467dc193c..db7dd149a3905 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp @@ -75,8 +75,7 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) { (char*)"flush", (char*)"()V", (void*)jfr_flush, (char*)"setRepositoryLocation", (char*)"(Ljava/lang/String;)V", (void*)jfr_set_repository_location, (char*)"abort", (char*)"(Ljava/lang/String;)V", (void*)jfr_abort, - (char*)"getEpochAddress", (char*)"()J",(void*)jfr_get_epoch_address, - (char*)"addStringConstant", (char*)"(ZJLjava/lang/String;)Z", (void*)jfr_add_string_constant, + (char*)"addStringConstant", (char*)"(JLjava/lang/String;)Z", (void*)jfr_add_string_constant, (char*)"uncaughtException", (char*)"(Ljava/lang/Thread;Ljava/lang/Throwable;)V", (void*)jfr_uncaught_exception, (char*)"setForceInstrumentation", (char*)"(Z)V", (void*)jfr_set_force_instrumentation, (char*)"getUnloadedEventClassCount", (char*)"()J", (void*)jfr_get_unloaded_event_classes_count, diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp index a66241b1fcf8a..e5cd7a9fa47d4 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp @@ -42,6 +42,7 @@ #include "jfr/utilities/jfrBigEndian.hpp" #include "jfr/utilities/jfrIterator.hpp" #include "jfr/utilities/jfrLinkedList.inline.hpp" +#include "jfr/utilities/jfrSignal.hpp" #include "jfr/utilities/jfrThreadIterator.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "jfr/writers/jfrJavaEventWriter.hpp" @@ -57,22 +58,7 @@ typedef JfrCheckpointManager::BufferPtr BufferPtr; -static volatile bool constant_pending = false; - -static bool is_constant_pending() { - if (Atomic::load_acquire(&constant_pending)) { - Atomic::release_store(&constant_pending, false); // reset - return true; - } - return false; -} - -static void set_constant_pending() { - if (!Atomic::load_acquire(&constant_pending)) { - Atomic::release_store(&constant_pending, true); - } -} - +static JfrSignal _new_checkpoint; static JfrCheckpointManager* _instance = NULL; JfrCheckpointManager& JfrCheckpointManager::instance() { @@ -231,7 +217,7 @@ BufferPtr JfrCheckpointManager::flush(BufferPtr old, size_t used, size_t request // indicates a lease is being returned release(old); // signal completion of a new checkpoint - set_constant_pending(); + _new_checkpoint.signal(); return NULL; } BufferPtr new_buffer = lease(old, thread, used + requested); @@ -474,7 +460,7 @@ size_t JfrCheckpointManager::flush_type_set() { elements = ::flush_type_set(thread); } } - if (is_constant_pending()) { + if (_new_checkpoint.is_signaled()) { WriteOperation wo(_chunkwriter); MutexedWriteOperation mwo(wo); _thread_local_mspace->iterate(mwo); // current epoch list diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp index 66f05828d6c04..03c3ad48ea22c 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp @@ -26,9 +26,9 @@ #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" #include "runtime/safepoint.hpp" +JfrSignal JfrTraceIdEpoch::_tag_state; bool JfrTraceIdEpoch::_epoch_state = false; bool JfrTraceIdEpoch::_synchronizing = false; -volatile bool JfrTraceIdEpoch::_changed_tag_state = false; void JfrTraceIdEpoch::begin_epoch_shift() { assert(SafepointSynchronize::is_at_safepoint(), "invariant"); @@ -43,3 +43,4 @@ void JfrTraceIdEpoch::end_epoch_shift() { OrderAccess::storestore(); _synchronizing = false; } + diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp index 33044922e9399..6cc32a1f3881a 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDEPOCH_HPP #define SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEIDEPOCH_HPP +#include "jfr/utilities/jfrSignal.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" @@ -54,21 +55,13 @@ class JfrTraceIdEpoch : AllStatic { friend class JfrCheckpointManager; private: + static JfrSignal _tag_state; static bool _epoch_state; static bool _synchronizing; - static volatile bool _changed_tag_state; static void begin_epoch_shift(); static void end_epoch_shift(); - static bool changed_tag_state() { - return Atomic::load_acquire(&_changed_tag_state); - } - - static void set_tag_state(bool value) { - Atomic::release_store(&_changed_tag_state, value); - } - public: static bool epoch() { return _epoch_state; @@ -115,17 +108,11 @@ class JfrTraceIdEpoch : AllStatic { } static bool has_changed_tag_state() { - if (changed_tag_state()) { - set_tag_state(false); - return true; - } - return false; + return _tag_state.is_signaled(); } static void set_changed_tag_state() { - if (!changed_tag_state()) { - set_tag_state(true); - } + _tag_state.signal(); } }; diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp index dc6c812e3aeab..243fd5d4ce93e 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp @@ -314,9 +314,7 @@ static size_t write_storage(JfrStorage& storage, JfrChunkWriter& chunkwriter) { } typedef Content StringPool; -typedef Content StringPoolSafepoint; typedef WriteCheckpointEvent WriteStringPool; -typedef WriteCheckpointEvent WriteStringPoolSafepoint; static u4 flush_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) { StringPool sp(string_pool); @@ -330,12 +328,6 @@ static u4 write_stringpool(JfrStringPool& string_pool, JfrChunkWriter& chunkwrit return invoke(wsp); } -static u4 write_stringpool_safepoint(JfrStringPool& string_pool, JfrChunkWriter& chunkwriter) { - StringPoolSafepoint sps(string_pool); - WriteStringPoolSafepoint wsps(chunkwriter, sps, TYPE_STRING); - return invoke(wsps); -} - typedef Content FlushTypeSetFunctor; typedef WriteContent FlushTypeSet; @@ -569,7 +561,7 @@ void JfrRecorderService::safepoint_write() { assert(SafepointSynchronize::is_at_safepoint(), "invariant"); _checkpoint_manager.begin_epoch_shift(); if (_string_pool.is_modified()) { - write_stringpool_safepoint(_string_pool, _chunkwriter); + write_stringpool(_string_pool, _chunkwriter); } _checkpoint_manager.on_rotation(); _storage.write_at_safepoint(); diff --git a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp index de836b00064cf..f9d84d3dd26c5 100644 --- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp +++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp @@ -32,6 +32,7 @@ #include "jfr/recorder/stringpool/jfrStringPool.hpp" #include "jfr/recorder/stringpool/jfrStringPoolWriter.hpp" #include "jfr/utilities/jfrLinkedList.inline.hpp" +#include "jfr/utilities/jfrSignal.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "logging/log.hpp" #include "runtime/atomic.hpp" @@ -40,44 +41,19 @@ typedef JfrStringPool::BufferPtr BufferPtr; -static JfrStringPool* _instance = NULL; -static uint64_t store_generation = 0; -static uint64_t serialized_generation = 0; - -inline void set_generation(uint64_t value, uint64_t* const dest) { - assert(dest != NULL, "invariant"); - Atomic::release_store(dest, value); -} - -static void increment_store_generation() { - const uint64_t current_serialized = Atomic::load_acquire(&serialized_generation); - const uint64_t current_stored = Atomic::load_acquire(&store_generation); - if (current_serialized == current_stored) { - set_generation(current_serialized + 1, &store_generation); - } -} - -static bool increment_serialized_generation() { - const uint64_t current_stored = Atomic::load_acquire(&store_generation); - const uint64_t current_serialized = Atomic::load_acquire(&serialized_generation); - if (current_stored != current_serialized) { - set_generation(current_stored, &serialized_generation); - return true; - } - return false; -} +static JfrSignal _new_string; bool JfrStringPool::is_modified() { - return increment_serialized_generation(); + return _new_string.is_signaled(); } +static JfrStringPool* _instance = NULL; + JfrStringPool& JfrStringPool::instance() { return *_instance; } JfrStringPool* JfrStringPool::create(JfrChunkWriter& cw) { - store_generation = 0; - serialized_generation = 0; assert(_instance == NULL, "invariant"); _instance = new JfrStringPool(cw); return _instance; @@ -155,20 +131,16 @@ BufferPtr JfrStringPool::lease(Thread* thread, size_t size /* 0 */) { return buffer; } -bool JfrStringPool::add(bool epoch, jlong id, jstring string, JavaThread* jt) { +jboolean JfrStringPool::add(jlong id, jstring string, JavaThread* jt) { assert(jt != NULL, "invariant"); - const bool current_epoch = JfrTraceIdEpoch::epoch(); - if (current_epoch != epoch) { - return current_epoch; - } { JfrStringPoolWriter writer(jt); writer.write(id); writer.write(string); writer.inc_nof_strings(); } - increment_store_generation(); - return current_epoch; + _new_string.signal(); + return JNI_TRUE; } template