diff -Nru openjdk-lts-11~28/debian/buildwatch.sh openjdk-lts-11.0.2+9/debian/buildwatch.sh --- openjdk-lts-11~28/debian/buildwatch.sh 2015-06-16 09:38:27.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/buildwatch.sh 2019-01-22 12:28:12.000000000 +0000 @@ -1,40 +1,67 @@ #! /bin/sh +# +# Output something to stdout every so often so buildd won't kill +# the build when building +# + builddir=$1 echo $$ > buildwatch.pid -maxwait=$(expr 180 \* 60) -wait=$maxwait -ival=$(expr 30 \* 60) -#ival=3 - -while [ $wait -gt 0 ]; do - sleep $ival - wait=$(expr $wait - $ival) - state= - if ps x | grep -v grep | egrep -qs '/cc1|jar|java|gij'; then - state="compiler/java/jar running ..." - wait=$maxwait - fi +time_unit="m" +timer=0 +sleep_for=3 +time_up_at=180 +upd_every=30 # use a multiple of $sleep_for + +reset_timer() { timer=0; } +inc_timer() { timer=$(expr $timer + $sleep_for); } +time_up() { [ $timer -ge $time_up_at ]; } +can_update() { [ $(expr $timer % $upd_every) -eq 0 ]; } +do_sleep() { sleep ${sleep_for}${time_unit} && inc_timer; } + +is_running() { + ps x | grep -v grep | egrep -qs $@ + return $? +} + +cleanup() { + # find any hs_err_pid files generated during the build and print them out + # this helps debugging what went wrong during builds + find . -type f -name 'hs_err_pid*.log' -printf "[$0] === HOTSPOT ERROR LOG ===\n[$0] %p (last modification at %t)\n" -exec cat {} \; +} - new_quiet=$(ls -l $builddir/openjdk*/build/*/tmp/rt-orig.jar $builddir/openjdk*/build/*/lib/tools.jar $builddir/openjdk*/build/*/lib/ct.sym 2>&1 | md5sum) - if [ "$old_quiet" != "$new_quiet" ]; then - state="assembling jar file ..." - wait=$maxwait - fi - old_quiet=$new_quiet +for sig in INT QUIT HUP TERM; do trap "cleanup; trap - $sig EXIT; kill -s $sig "'"$$"' "$sig"; done +trap cleanup EXIT - new_noisy=$(ls -l $builddir/mauve-*/mauve_output* jtreg_output-* 2>&1 | md5sum) - if [ "$old_noisy" != "$new_noisy" ]; then - wait=$maxwait - elif [ -n "$state" ]; then - echo $state +while ! time_up; do + if [ ! -f buildwatch.pid ]; then + echo "[$0] pidfile removed" && break + fi + if ! is_running '/make'; then + echo "[$0] no make process detected (build done?)" && break fi - old_noisy=$new_noisy - if [ ! -f buildwatch.pid ]; then - echo "buildwatch exit" - exit 0 + do_sleep + can_update || continue + + new_noisy=$(ls -l test/jtreg_output-* 2>&1 | md5sum) + new_quiet=$(ls -l $builddir/openjdk*/build/*/tmp/rt-orig.jar $builddir/openjdk*/build/*/lib/tools.jar $builddir/openjdk*/build/*/lib/ct.sym 2>&1 | md5sum) + if [ -n "$old_noisy" -a "$old_noisy" != "$new_noisy" ]; then + # jtreg updated test files, so it should be updating stdout in its own + # keep quiet and restart timer + reset_timer + elif [ -n "$old_quiet" -a "$old_quiet" != "$new_quiet" ]; then + reset_timer + echo "[$0] assembling jar file ..." + elif is_running '/cc1|jar|java|gij'; then + echo "[$0] compiler/java/jar running ..." + reset_timer fi + old_noisy=$new_noisy + old_quiet=$new_quiet done + +echo "[$0] exiting" +rm -f buildwatch.pid diff -Nru openjdk-lts-11~28/debian/changelog openjdk-lts-11.0.2+9/debian/changelog --- openjdk-lts-11~28/debian/changelog 2018-10-10 19:10:01.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/changelog 2019-02-06 17:25:09.000000000 +0000 @@ -1,15 +1,105 @@ -openjdk-lts (11~28-3ubuntu2) cosmic; urgency=medium +openjdk-lts (11.0.2+9-3ubuntu1~18.04.1) bionic-security; urgency=medium - * debian/rules: - - limit the tests that we run for the hotspot, langtools, - and jdk testsuites to improve build times and also to - prevent running unstable or failing tests. - - fix 'if' clause for definition of the TIME command. - - remove guava jar from test classpath, no longer required. - * debian/control, debian/control.in: add a breaks clause to - clojure1.8 <= 1.8.0-7ubuntu1~. + * Backport from Disco. LP: #1814133. - -- Tiago Stürmer Daitx Wed, 10 Oct 2018 19:10:01 +0000 + -- Tiago Stürmer Daitx Wed, 06 Feb 2019 17:25:09 +0000 + +openjdk-lts (11.0.2+9-3ubuntu1) disco; urgency=medium + + * Sync packages with 11.0.2+9-3: + - Fix Zero on sparc64 (Adrian Glaubitz). Closes: #920315. + - Link zero on alpha with --no-relax (Michael Cree). Addresses: #920161. + - Don't run the tests on alpha, causing build failure. + - jhsdb isn't built on alpha. + - Backport the fix for 8214002 (cannot use italic font style if the font + has embedded bitmap). LP: #1799014. + * Sync packages with 11.0.2+9-2: + - Fix file permissions for autopkg tests. + + -- Matthias Klose Thu, 24 Jan 2019 15:14:20 +0100 + +openjdk-lts (11.0.2+9-1ubuntu3) disco; urgency=medium + + * Fix file permissions for autopkg tests. + + -- Matthias Klose Tue, 22 Jan 2019 14:39:45 +0100 + +openjdk-lts (11.0.2+9-1ubuntu1) disco; urgency=medium + + * Sync packages with 11.0.2+9-1: + - OpenJDK 11.0.2 release (build 9). + + - Backport the fix for S8212233. Closes: #920020, #919798. + - debian/buildwatch.sh: use same code from openjdk-8. + - debian/control.in, debian/control: + - add fixed build depends for jtreg and xfvb. + - remove Conflicts: oracle-java11-installer. (LP: #1782630) + - debian/rules: + - call the same testsuites scripts used for autopkgtest. + - removed jtreg and xvfb build dependency logic and moved the bdeps + into debian/control.in. + - added gen-autopackage rule to generate autopkgtest scripts from + templates. + - copy flight recorder configuration files. + - fix logging in langtools testing. + - don't ignore/exclude the release file from the jdk package, it is + required by jtreg tests and autopkgtests will fail without it. + - don't run nashorn testsuite. + - update dep8 tests: + - debian/tests/control: updated to run openjdk-11 tests. + - debian/tests/hotspot, debian/tests/jaxp, debian/tests/jdk, + debian/tests/langtools: use the new jt .sh scripts. + - debian/tests/jtdiff-autopkgtest.sh: diff build time and autopkgtest + JTreports to show what changed. + - debian/tests/jtreg-autopkgtest.in: template to generate the jtreg + script used by the autopkgtest tests. + - debian/tests/jtdiff-autopkgtest.sh: used by the scripts to report + any differences between the autopkgtest and the tests results + generated during the openjdk package build. + - debian/tests/jtreg-autopkgtest.sh: used by the scripts to run jtreg + and put the resulting artifacts in the right places, by default will + remove all non .jtr files after it is done to preserve space. + - debian/tests/hotspot, debian/tests/jaxp, debian/tests/jdk, + debian/tests/langtools: run same testsuites as build time and + compare the results. + - debian/tests/valid-tests: no longer needed, removed. + + * Sync packages with 11.0.2+7-1: + - OpenJDK 11.0.2 release. + + - Update VCS attributes in the control file. Closes: #909736. + - Prefer OpenJDK 11 over OpenJDK 10 as the bootstrap OpenJDK for + recent releases. Closes: #915600. + + -- Matthias Klose Tue, 22 Jan 2019 13:30:45 +0100 + +openjdk-lts (11.0.1+13-3ubuntu1) disco; urgency=medium + + * Sync packages with 11.0.1+13-3: + - Tighten dependency on debhelper on recent releases. Closes: #911694. + - Reproducible properties file header when SOURCE_DATE_EPOCH is specified. + Closes: #914278. + - Add SOURCE_DATE_EPOCH support to the javadoc tool. Closes: #783938. + - Disable AArch64 intrinsics for sin, cos and log. Closes: #910188. + LP: #1796982. + - Add support for DEB_BUILD_OPTIONS=terse. Closes: #912211. + + -- Matthias Klose Fri, 30 Nov 2018 12:15:34 +0100 + +openjdk-lts (11.0.1+13-2ubuntu1) cosmic; urgency=medium + + * Sync packages with 11.0.1+13-2: + - OpenJDK 11.0.1 releae + - debian/rules: + - limit the tests that we run for the hotspot, langtools, + and jdk testsuites to improve build times and also to + prevent running unstable or failing tests. + - fix 'if' clause for definition of the TIME command. + - remove guava jar from test classpath, no longer required. + - debian/control, debian/control.in: add a breaks clause to + clojure1.8 <= 1.8.0-7ubuntu1~. + + -- Matthias Klose Wed, 17 Oct 2018 09:19:23 +0200 openjdk-lts (11~28-3ubuntu1) cosmic; urgency=medium diff -Nru openjdk-lts-11~28/debian/control openjdk-lts-11.0.2+9/debian/control --- openjdk-lts-11~28/debian/control 2018-10-10 19:10:01.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/control 2019-02-06 17:23:26.000000000 +0000 @@ -4,23 +4,24 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: OpenJDK Team Uploaders: Matthias Klose -Build-Depends: debhelper (>= 9.20141010), dpkg-dev (>= 1.17.14), +Build-Depends: debhelper (>= 11), m4, lsb-release, zip, unzip, sharutils, gawk, cpio, pkg-config, procps, wdiff, fastjar (>= 2:0.96-0ubuntu2), + jtreg, testng, time, + xvfb, xauth, xfonts-base, libgl1-mesa-dri [!x32], xfwm4, x11-xkb-utils, dbus-x11, autoconf, automake, autotools-dev, ant, ant-optional, - g++-8, - openjdk-10-jdk-headless | openjdk-11-jdk-headless, + g++-7, + openjdk-11-jdk-headless | openjdk-10-jdk-headless, libxtst-dev, libxi-dev, libxt-dev, libxaw7-dev, libxrender-dev, libcups2-dev, libasound2-dev, liblcms2-dev, libfreetype6-dev (>= 2.2.1), libxinerama-dev, libkrb5-dev, xsltproc, libpcsclite-dev, libgtk-3-dev, libelf-dev, libfontconfig1-dev, libffi-dev, zlib1g-dev, libattr1-dev, libpng-dev, libjpeg-dev, libgif-dev, libnss3-dev (>= 2:3.17.1), - jtreg (>= 4.2-b10-1~), xvfb, xauth, xfonts-base, libgl1-mesa-dri [!x32], twm | metacity, twm | dbus-x11, x11-xkb-utils, - testng, time, openjdk-11-jdk-headless , + openjdk-11-jdk-headless , Build-Depends-Indep: graphviz, pandoc, -Standards-Version: 4.2.1 +Standards-Version: 4.3.0 Homepage: http://openjdk.java.net/ -Vcs-Bzr: http://bazaar.launchpad.net/~openjdk/openjdk/openjdk11 -Vcs-Browser: https://code.launchpad.net/~openjdk/openjdk/openjdk11 +Vcs-Git: https://git.launchpad.net/~openjdk/ubuntu/+source/openjdk/+git/openjdk -b openjdk-11 +Vcs-Browser: https://code.launchpad.net/~openjdk/ubuntu/+source/openjdk/+git/openjdk/+ref/openjdk-11 Package: openjdk-11-jdk-headless Architecture: alpha amd64 armel armhf arm64 i386 ia64 mips mipsel mips64 mips64el powerpc powerpcspe ppc64 ppc64el m68k sh4 sparc sparc64 s390x x32 kfreebsd-i386 kfreebsd-amd64 diff -Nru openjdk-lts-11~28/debian/control.in openjdk-lts-11.0.2+9/debian/control.in --- openjdk-lts-11~28/debian/control.in 2018-10-10 19:10:01.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/control.in 2019-01-22 12:28:12.000000000 +0000 @@ -7,6 +7,8 @@ Build-Depends: @bd_debhelper@ m4, lsb-release, zip, unzip, sharutils, gawk, cpio, pkg-config, procps, wdiff, @bd_fastjar@ + jtreg, testng, time, + xvfb, xauth, xfonts-base, libgl1-mesa-dri [!x32], xfwm4, x11-xkb-utils, dbus-x11, @bd_autotools@ @bd_ant@ @bd_gcc@ @bd_bootstrap@ @@ -14,13 +16,12 @@ @bd_zero@ @bd_syslibs@ @bd_pulsejava@ @bd_systemtap@ @bd_nss@ - @bd_jtreg@ @bd_xvfb@ - testng, time, @bd_cross@ + @bd_cross@ Build-Depends-Indep: graphviz, pandoc, -Standards-Version: 4.2.1 +Standards-Version: 4.3.0 Homepage: http://openjdk.java.net/ -Vcs-Bzr: http://bazaar.launchpad.net/~openjdk/openjdk/openjdk11 -Vcs-Browser: https://code.launchpad.net/~openjdk/openjdk/openjdk11 +Vcs-Git: https://git.launchpad.net/~openjdk/ubuntu/+source/openjdk/+git/openjdk -b openjdk-11 +Vcs-Browser: https://code.launchpad.net/~openjdk/ubuntu/+source/openjdk/+git/openjdk/+ref/openjdk-11 Package: @basename@-jdk-headless Architecture: @any_archs@ diff -Nru openjdk-lts-11~28/debian/patches/8212233.diff openjdk-lts-11.0.2+9/debian/patches/8212233.diff --- openjdk-lts-11~28/debian/patches/8212233.diff 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/8212233.diff 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,240 @@ + +# HG changeset patch +# User jjg +# Date 1547579125 28800 +# Node ID 8ce4083fc831b1142b2eaeaed334b08f81b6d049 +# Parent 314c5b5d9369c3dbef9b4fa70e97d6d6901dea94 +8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module." +Reviewed-by: hannesw, pmuthuswamy + +--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java ++++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * 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,8 @@ import jdk.javadoc.internal.doclets.tool + import jdk.javadoc.internal.doclets.toolkit.util.DocPath; + import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; + ++import java.util.Collections; ++ + /** + * Writes a file that tries to redirect to an alternate page. + * The redirect uses JavaScript, if enabled, falling back on +--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java ++++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. + * 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,8 @@ import javax.lang.model.element.PackageE + import javax.tools.Diagnostic; + import javax.tools.DocumentationTool; + ++import com.sun.tools.javac.code.Flags; ++import com.sun.tools.javac.code.Symbol.ModuleSymbol; + import jdk.javadoc.doclet.Reporter; + import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; + +@@ -269,6 +271,12 @@ public class Extern { + ModuleElement moduleElement = configuration.utils.containingModule(packageElement); + Map pkgMap = packageItems.get(configuration.utils.getModuleName(moduleElement)); + item = (pkgMap != null) ? pkgMap.get(configuration.utils.getPackageName(packageElement)) : null; ++ if (item == null && isAutomaticModule(moduleElement)) { ++ pkgMap = packageItems.get(configuration.utils.getModuleName(null)); ++ if (pkgMap != null) { ++ item = pkgMap.get(configuration.utils.getPackageName(packageElement)); ++ } ++ } + } + return item; + } +@@ -419,8 +427,21 @@ public class Extern { + throw new Fault(configuration.getText("doclet.linkMismatch_PackagedLinkedtoModule", + path), null); + } else if (moduleName == null) +- throw new Fault(configuration.getText("doclet.linkMismatch_ModuleLinkedtoPackage", +- path), null); ++ // suppress the error message in the case of automatic modules ++ if (!isAutomaticModule(me)) { ++ throw new Fault(configuration.getText("doclet.linkMismatch_ModuleLinkedtoPackage", ++ path), null); ++ } ++ } ++ } ++ ++ // The following should be replaced by a new method such as Elements.isAutomaticModule ++ private boolean isAutomaticModule(ModuleElement me) { ++ if (me == null) { ++ return false; ++ } else { ++ ModuleSymbol msym = (ModuleSymbol) me; ++ return (msym.flags() & Flags.AUTOMATIC_MODULE) != 0; + } + } + } +--- /dev/null ++++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithAutomaticModule.java +@@ -0,0 +1,155 @@ ++/* ++ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. ++ * 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 8212233 ++ * @summary The code being documented uses modules but the packages defined in $URL are in the unnamed module. ++ * @library /tools/lib ../lib ++ * @modules ++ * jdk.javadoc/jdk.javadoc.internal.tool ++ * jdk.compiler/com.sun.tools.javac.api ++ * jdk.compiler/com.sun.tools.javac.main ++ * @build JavadocTester toolbox.JarTask toolbox.JavacTask toolbox.ModuleBuilder toolbox.ToolBox ++ * @run main TestLinkOptionWithAutomaticModule ++ */ ++ ++import java.io.IOException; ++import java.nio.file.Files; ++import java.nio.file.Path; ++ ++import toolbox.JarTask; ++import toolbox.JavacTask; ++import toolbox.ModuleBuilder; ++import toolbox.ToolBox; ++ ++public class TestLinkOptionWithAutomaticModule extends JavadocTester { ++ ++ public static void main(String... args) throws Exception { ++ TestLinkOptionWithAutomaticModule tester = new TestLinkOptionWithAutomaticModule(); ++ tester.runTests(m -> new Object[]{ Path.of(m.getName()) }); ++ } ++ ++ final ToolBox tb = new ToolBox(); ++ private Path libJar; ++ private Path libAPI; ++ ++ TestLinkOptionWithAutomaticModule() throws IOException { ++ initLib(); ++ } ++ ++ private void initLib() throws IOException { ++ // create library: write source, compile it, jar it ++ Path lib = Path.of("lib"); ++ Path libSrc = lib.resolve("src"); ++ tb.writeJavaFiles(libSrc, "package lib; public class LibClass { }"); ++ Path libClasses = Files.createDirectories(lib.resolve("classes")); ++ ++ new JavacTask(tb) ++ .outdir(libClasses) ++ .files(tb.findJavaFiles(libSrc)) ++ .run() ++ .writeAll(); ++ ++ libJar = lib.resolve("MyLib.jar"); ++ new JarTask(tb, libJar) ++ .baseDir(libClasses) ++ .files(".") ++ .run(); ++ ++ libAPI = lib.resolve("api"); ++ javadoc("-d", libAPI.toString(), ++ "-sourcepath", libSrc.toString(), ++ "lib"); ++ checkExit(Exit.OK); ++ } ++ ++ @Test ++ public void testLinkUnnamedToAutomaticModule(Path base) throws IOException { ++ ++ // create API referring to library ++ Path src = base.resolve("src"); ++ tb.writeJavaFiles(src, "package p; public class MyClass extends lib.LibClass { }"); ++ ++ // run javadoc with library as automatic module ++ Path api = base.resolve("api"); ++ javadoc("-d", api.toString(), ++ "-sourcepath", src.toString(), ++ "--add-modules", "MyLib", ++ "--module-path", libJar.toString(), ++ "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(), ++ "p"); ++ checkExit(Exit.OK); ++ checkOutput("p/MyClass.html", true, ++ "extends LibClass"); ++ } ++ ++ @Test ++ public void testLinkNamedToAutomaticModule(Path base) throws IOException { ++ ++ // create API referring to library ++ Path src = base.resolve("src"); ++ new ModuleBuilder(tb, "my.module") ++ .exports("p") ++ .requires("MyLib") ++ .classes("package p; public class MyClass extends lib.LibClass { }") ++ .write(src); ++ ++ // run javadoc with library as automatic module ++ Path api = base.resolve("api"); ++ javadoc("-d", api.toString(), ++ "--module-source-path", src.toString(), ++ "--module-path", libJar.toString(), ++ "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(), ++ "--module", "my.module"); ++ checkExit(Exit.OK); ++ checkOutput("my.module/p/MyClass.html", true, ++ "extends LibClass"); ++ } ++ ++ @Test ++ public void testLinkNamedToUnnamedModule(Path base) throws IOException { ++ ++ // create API referring to library ++ Path src = base.resolve("src"); ++ new ModuleBuilder(tb, "my.module") ++ .exports("p") ++ .classes("package p; public class MyClass extends lib.LibClass { }") ++ .write(src); ++ ++ // run javadoc with library as unnamed module ++ Path api = base.resolve("api"); ++ javadoc("-d", api.toString(), ++ "--module-source-path", src.toString(), ++ "--add-reads", "my.module=ALL-UNNAMED", ++ "--class-path", libJar.toString(), ++ "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(), ++ "--module", "my.module"); ++ checkExit(Exit.OK); ++ checkOutput("my.module/p/MyClass.html", true, ++ "extends LibClass"); ++ } ++} diff -Nru openjdk-lts-11~28/debian/patches/8214002.diff openjdk-lts-11.0.2+9/debian/patches/8214002.diff --- openjdk-lts-11~28/debian/patches/8214002.diff 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/8214002.diff 2019-01-24 14:14:20.000000000 +0000 @@ -0,0 +1,112 @@ + +# HG changeset patch +# User itakiguchi +# Date 1544043590 28800 +# Node ID 7ed5edf6ba0c0d9afc75d6efb2ef14301f0db15b +# Parent fcbea0fb586c1bd8b807df186c459bad7885a96c +8214002: Cannot use italic font style if the font has embedded bitmap +Reviewed-by: prr + +--- a/src/java.desktop/share/native/libfontmanager/freetypeScaler.c ++++ b/src/java.desktop/share/native/libfontmanager/freetypeScaler.c +@@ -680,7 +680,7 @@ Java_sun_font_FreetypeFontScaler_getGlyp + UInt16 width, height; + GlyphInfo *glyphInfo; + int glyph_index; +- int renderFlags = FT_LOAD_RENDER, target; ++ int renderFlags = FT_LOAD_DEFAULT, target; + FT_GlyphSlot ftglyph; + + FTScalerContext* context = +--- /dev/null ++++ b/test/jdk/java/awt/font/TextLayout/FontGlyphCompare.java +@@ -0,0 +1,89 @@ ++/* ++ * 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. ++ * ++ */ ++ ++/* @test ++ * @bug 8214002 ++ * @requires (os.family == "windows") ++ * @summary verify MS Mincho's Plain & Italic style ++ */ ++ ++import java.awt.Font; ++import java.awt.Color; ++import java.awt.Graphics; ++import java.awt.Graphics2D; ++import java.awt.RenderingHints; ++import java.awt.image.BufferedImage; ++ ++public class FontGlyphCompare { ++ ++ static BufferedImage getFontImage(Font font, String text) { ++ int x = 1; ++ int y = 15; ++ int w = 10; ++ int h = 18; ++ BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); ++ Graphics2D g = (Graphics2D)bi.getGraphics(); ++ g.setColor(Color.black); ++ g.fillRect(0, 0, w, h); ++ g.setColor(Color.white); ++ g.setFont(font); ++ g.drawString(text, x, y); ++ return bi; ++ } ++ ++ public static void main(String[] args) throws Exception { ++ String osName = System.getProperty("os.name"); ++ System.out.println("OS is " + osName); ++ osName = osName.toLowerCase(); ++ if (!osName.startsWith("windows")) { ++ return; ++ } ++ Font msMincho = new Font("MS Mincho", Font.PLAIN, 16); ++ String family = msMincho.getFamily(java.util.Locale.ENGLISH); ++ if (!family.equalsIgnoreCase("MS Mincho")) { ++ System.out.println("Japanese fonts not installed"); ++ return; ++ } ++ String s = "|"; ++ BufferedImage bi1 = getFontImage(new Font("MS Mincho", Font.PLAIN, 16), s); ++ int h1 = bi1.getHeight(); ++ int w1 = bi1.getWidth(); ++ BufferedImage bi2 = getFontImage(new Font("MS Mincho", Font.ITALIC, 16), s); ++ int h2 = bi2.getHeight(); ++ int w2 = bi2.getWidth(); ++ if ((h1 == h2) && (w1 == w2)) { ++ int cnt = 0; ++ for(int yy = 0; yy < h1; yy++) { ++ for(int xx = 0; xx < w1; xx++) { ++ if (bi1.getRGB(xx, yy) != bi2.getRGB(xx, yy)) { ++ cnt++; ++ } ++ } ++ } ++ if (cnt == 0) { ++ throw new Exception("Test failed"); ++ } ++ } ++ } ++} diff -Nru openjdk-lts-11~28/debian/patches/Don-t-optimize-fdlibm-fork-for-Zero-on-linux-sparc-Z.patch openjdk-lts-11.0.2+9/debian/patches/Don-t-optimize-fdlibm-fork-for-Zero-on-linux-sparc-Z.patch --- openjdk-lts-11~28/debian/patches/Don-t-optimize-fdlibm-fork-for-Zero-on-linux-sparc-Z.patch 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/Don-t-optimize-fdlibm-fork-for-Zero-on-linux-sparc-Z.patch 2019-01-24 14:14:20.000000000 +0000 @@ -0,0 +1,32 @@ +From 7ce2609d6ff5299f2ed3ff6850a3cab4a16125f8 Mon Sep 17 00:00:00 2001 +From: John Paul Adrian Glaubitz +Date: Fri, 21 Dec 2018 15:18:17 +0300 +Subject: [PATCH] Don't optimize fdlibm-fork for Zero on linux-sparc (Zero) + +--- + make/hotspot/lib/JvmOverrideFiles.gmk | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk +index 7d45dd331a..79c014e82a 100644 +--- a/make/hotspot/lib/JvmOverrideFiles.gmk ++++ b/make/hotspot/lib/JvmOverrideFiles.gmk +@@ -49,6 +49,15 @@ LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE) + # by using -ffp-contract=off on GCC/Clang platforms. + ifneq ($(FDLIBM_CFLAGS), ) + LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM) ++ # Don't optimize fdlibm-fork for Zero on Linux sparc ++ # See JDK-XXXX ++ ifeq ($(call check-jvm-feature, zero), true) ++ ifeq ($(OPENJDK_TARGET_OS), linux) ++ ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc) ++ LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE) ++ endif ++ endif ++ endif + endif + + ifeq ($(OPENJDK_TARGET_OS), linux) +-- +2.19.1 + diff -Nru openjdk-lts-11~28/debian/patches/m68k-support.diff openjdk-lts-11.0.2+9/debian/patches/m68k-support.diff --- openjdk-lts-11~28/debian/patches/m68k-support.diff 2018-07-26 07:29:02.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/m68k-support.diff 2019-01-22 12:28:12.000000000 +0000 @@ -6,9 +6,8 @@ # Parent b0fcf59be3918afcaa13d1f97343968c2c467ffe JDK-NNNNNNN: Zero needs alignment fixes for linux-m68k -diff -r b0fcf59be391 -r 418a697aef91 make/data/x11wrappergen/sizes-32-linux-m68k.txt ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/make/data/x11wrappergen/sizes-32-linux-m68k.txt Sat Jul 21 16:45:01 2018 +0200 +--- /dev/null ++++ b/make/data/x11wrappergen/sizes-32-linux-m68k.txt @@ -0,0 +1,1017 @@ +long 4 +int 4 @@ -1027,10 +1026,9 @@ +XTextProperty.format 8 +XTextProperty.nitems 12 +XTextProperty 16 -diff -r b0fcf59be391 -r 418a697aef91 make/gensrc/GensrcX11Wrappers.gmk ---- a/make/gensrc/GensrcX11Wrappers.gmk Fri Jul 20 14:48:41 2018 -0700 -+++ b/make/gensrc/GensrcX11Wrappers.gmk Sat Jul 21 16:45:01 2018 +0200 -@@ -33,9 +33,14 @@ +--- a/make/gensrc/GensrcX11Wrappers.gmk ++++ b/make/gensrc/GensrcX11Wrappers.gmk +@@ -33,9 +33,14 @@ GENSRC_X11WRAPPERS_MARKER := $(GENSRC_X1 # Put the generated Java classes used to interface X11 from awt here. GENSRC_X11WRAPPERS_OUTPUTDIR := $(GENSRC_X11WRAPPERS_OUTPUT_TOP)/sun/awt/X11 @@ -1046,10 +1044,9 @@ # Run the tool on the offset files to generate several Java classes used in awt. $(GENSRC_X11WRAPPERS_MARKER): $(BUILD_TOOLS_JDK) $(GENSRC_X11WRAPPERS_DATA) \ -diff -r b0fcf59be391 -r 418a697aef91 src/hotspot/share/memory/allocation.hpp ---- a/src/hotspot/share/memory/allocation.hpp Fri Jul 20 14:48:41 2018 -0700 -+++ b/src/hotspot/share/memory/allocation.hpp Sat Jul 21 16:45:01 2018 +0200 -@@ -209,7 +209,7 @@ +--- a/src/hotspot/share/memory/allocation.hpp ++++ b/src/hotspot/share/memory/allocation.hpp +@@ -209,7 +209,7 @@ template class CHeapObj ALL void operator delete(void* p) { FreeHeap(p); } void operator delete [] (void* p) { FreeHeap(p); } @@ -1058,7 +1055,7 @@ // Base class for objects allocated on the stack only. // Calling new or delete will result in fatal error. -@@ -223,7 +223,7 @@ +@@ -223,7 +223,7 @@ class StackObj ALLOCATION_SUPER_CLASS_SP #endif void operator delete(void* p); void operator delete [](void* p); @@ -1067,7 +1064,7 @@ // Base class for objects stored in Metaspace. // Calling delete will result in fatal error. -@@ -311,7 +311,7 @@ +@@ -311,7 +311,7 @@ class MetaspaceObj { // that should be read-only by default. See symbol.hpp for an example. This function // is used by the templates in metaspaceClosure.hpp static bool is_read_only_by_default() { return false; } @@ -1076,7 +1073,7 @@ // Base class for classes that constitute name spaces. -@@ -401,7 +401,7 @@ +@@ -401,7 +401,7 @@ class ResourceObj ALLOCATION_SUPER_CLASS void operator delete(void* p); void operator delete [](void* p); @@ -1085,10 +1082,9 @@ // One of the following macros must be used when allocating an array // or object to determine whether it should reside in the C heap on in -diff -r b0fcf59be391 -r 418a697aef91 src/hotspot/share/oops/constMethod.hpp ---- a/src/hotspot/share/oops/constMethod.hpp Fri Jul 20 14:48:41 2018 -0700 -+++ b/src/hotspot/share/oops/constMethod.hpp Sat Jul 21 16:45:01 2018 +0200 -@@ -559,6 +559,6 @@ +--- a/src/hotspot/share/oops/constMethod.hpp ++++ b/src/hotspot/share/oops/constMethod.hpp +@@ -559,6 +559,6 @@ private: // Verify void verify_on(outputStream* st); @@ -1096,21 +1092,19 @@ +} __attribute__ ((aligned (4))); #endif // SHARE_VM_OOPS_CONSTMETHODOOP_HPP -diff -r b0fcf59be391 -r 418a697aef91 src/hotspot/share/oops/oop.hpp ---- a/src/hotspot/share/oops/oop.hpp Fri Jul 20 14:48:41 2018 -0700 -+++ b/src/hotspot/share/oops/oop.hpp Sat Jul 21 16:45:01 2018 +0200 -@@ -331,6 +331,6 @@ - assert(has_klass_gap(), "only applicable to compressed klass pointers"); - return klass_offset_in_bytes() + sizeof(narrowKlass); - } +--- a/src/hotspot/share/oops/oop.hpp ++++ b/src/hotspot/share/oops/oop.hpp +@@ -338,6 +338,6 @@ class oopDesc { + static void* load_oop_raw(oop obj, int offset); + static bool is_valid(oop obj); + static oop oop_or_null(address addr); -}; +} __attribute__ ((aligned (4))); #endif // SHARE_VM_OOPS_OOP_HPP -diff -r b0fcf59be391 -r 418a697aef91 src/java.base/unix/native/libjli/java_md_solinux.c ---- a/src/java.base/unix/native/libjli/java_md_solinux.c Fri Jul 20 14:48:41 2018 -0700 -+++ b/src/java.base/unix/native/libjli/java_md_solinux.c Sat Jul 21 16:45:01 2018 +0200 -@@ -727,12 +727,24 @@ +--- a/src/java.base/unix/native/libjli/java_md_solinux.c ++++ b/src/java.base/unix/native/libjli/java_md_solinux.c +@@ -727,12 +727,24 @@ void SplashFreeLibrary() { } } @@ -1135,7 +1129,7 @@ #ifndef __solaris__ pthread_t tid; pthread_attr_t attr; -@@ -744,7 +756,7 @@ +@@ -744,7 +756,7 @@ ContinueInNewThread0(int (JNICALL *conti } pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads @@ -1144,7 +1138,7 @@ void * tmp; pthread_join(tid, &tmp); rslt = (int)(intptr_t)tmp; -@@ -762,7 +774,7 @@ +@@ -762,7 +774,7 @@ ContinueInNewThread0(int (JNICALL *conti #else /* __solaris__ */ thread_t tid; long flags = 0; diff -Nru openjdk-lts-11~28/debian/patches/mips-sigset.diff openjdk-lts-11.0.2+9/debian/patches/mips-sigset.diff --- openjdk-lts-11~28/debian/patches/mips-sigset.diff 2018-07-19 18:16:21.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/mips-sigset.diff 2019-01-22 12:28:12.000000000 +0000 @@ -1,6 +1,6 @@ --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp -@@ -4487,14 +4487,16 @@ bool os::Linux::signal_handlers_are_inst +@@ -4508,14 +4508,16 @@ bool os::Linux::signal_handlers_are_inst // For signal-chaining struct sigaction sigact[NSIG]; @@ -21,7 +21,7 @@ struct sigaction* os::Linux::get_chained_signal_action(int sig) { struct sigaction *actp = NULL; -@@ -4569,7 +4571,7 @@ bool os::Linux::chained_handler(int sig, +@@ -4590,7 +4592,7 @@ bool os::Linux::chained_handler(int sig, } struct sigaction* os::Linux::get_preinstalled_handler(int sig) { @@ -30,7 +30,7 @@ return &sigact[sig]; } return NULL; -@@ -4578,7 +4580,7 @@ struct sigaction* os::Linux::get_preinst +@@ -4599,7 +4601,7 @@ struct sigaction* os::Linux::get_preinst void os::Linux::save_preinstalled_handler(int sig, struct sigaction& oldAct) { assert(sig > 0 && sig < NSIG, "vm signal out of expected range"); sigact[sig] = oldAct; diff -Nru openjdk-lts-11~28/debian/patches/reproducible-javadoc-timestamp.diff openjdk-lts-11.0.2+9/debian/patches/reproducible-javadoc-timestamp.diff --- openjdk-lts-11~28/debian/patches/reproducible-javadoc-timestamp.diff 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/reproducible-javadoc-timestamp.diff 2018-11-30 11:17:37.000000000 +0000 @@ -0,0 +1,41 @@ +Description: Makes the timestamp in the javadoc files reproducible when SOURCE_DATE_EPOCH is specified +Author: Emmanuel Bourg +Forwarded: no +--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java ++++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java +@@ -256,6 +256,9 @@ + */ + public Content toContent() { + Date now = showTimestamp ? calendar.getTime() : null; ++ if (now != null && System.getenv("SOURCE_DATE_EPOCH") != null) { ++ now = new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); ++ } + + HtmlTree tree = new HtmlTree(HtmlTag.HEAD); + if (showGeneratedBy) { +@@ -269,6 +272,9 @@ + + if (showMetaCreated) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); ++ if (System.getenv("SOURCE_DATE_EPOCH") != null) { ++ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); ++ } + tree.addContent(HtmlTree.META( + (htmlVersion == HtmlVersion.HTML5) ? "dc.created" : "date", + dateFormat.format(now))); +@@ -298,7 +304,14 @@ + private Comment getGeneratedBy(boolean timestamp, Date now) { + String text = "Generated by javadoc"; // marker string, deliberately not localized + if (timestamp) { +- text += " ("+ docletVersion + ") on " + now; ++ text += " ("+ docletVersion + ") on "; ++ if (System.getenv("SOURCE_DATE_EPOCH") == null) { ++ text += now; ++ } else { ++ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); ++ fmt.setTimeZone(TimeZone.getTimeZone("UTC")); ++ text += fmt.format(now); ++ } + } + return new Comment(text); + } diff -Nru openjdk-lts-11~28/debian/patches/reproducible-properties-timestamp.diff openjdk-lts-11.0.2+9/debian/patches/reproducible-properties-timestamp.diff --- openjdk-lts-11~28/debian/patches/reproducible-properties-timestamp.diff 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/reproducible-properties-timestamp.diff 2018-11-30 11:17:37.000000000 +0000 @@ -0,0 +1,37 @@ +Description: Makes the timestamp in the properties files header reproducible when SOURCE_DATE_EPOCH is specified +Author: Emmanuel Bourg +Forwarded: no +--- a/src/java.base/share/classes/java/util/Properties.java ++++ b/src/java.base/share/classes/java/util/Properties.java +@@ -905,7 +905,7 @@ + if (comments != null) { + writeComments(bw, comments); + } +- bw.write("#" + new Date().toString()); ++ bw.write("#" + getFormattedTimestamp()); + bw.newLine(); + synchronized (this) { + for (Map.Entry e : entrySet()) { +@@ -1555,4 +1555,22 @@ + } + this.map = map; + } ++ ++ /** ++ * Returns a formatted timestamp to be used in the properties file header. ++ * The date used is the current date, unless the SOURCE_DATE_EPOCH ++ * environment variable is specified. In this case the format used is ++ * locale and timezone insensitive to ensure the output is reproducible. ++ */ ++ private String getFormattedTimestamp() { ++ if (System.getenv("SOURCE_DATE_EPOCH") == null) { ++ return new Date().toString(); ++ } else { ++ // Use the SOURCE_DATE_EPOCH timestamp and make the format locale/timezone insensitive ++ java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss z", java.util.Locale.ENGLISH); ++ fmt.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); ++ Date date = new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))); ++ return fmt.format(date); ++ } ++ } + } diff -Nru openjdk-lts-11~28/debian/patches/s390x-zEC12.diff openjdk-lts-11.0.2+9/debian/patches/s390x-zEC12.diff --- openjdk-lts-11~28/debian/patches/s390x-zEC12.diff 2018-07-19 18:16:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/s390x-zEC12.diff 2019-01-22 12:28:12.000000000 +0000 @@ -1,6 +1,6 @@ --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 -@@ -720,6 +720,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], +@@ -741,6 +741,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], fi elif test "x$FLAGS_CPU" = xs390x; then $1_CFLAGS_CPU="-mbackchain -march=z10" diff -Nru openjdk-lts-11~28/debian/patches/series openjdk-lts-11.0.2+9/debian/patches/series --- openjdk-lts-11~28/debian/patches/series 2018-10-03 02:16:04.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/series 2019-01-24 14:14:20.000000000 +0000 @@ -31,3 +31,8 @@ generated-headers.patch parallel-build-fix.diff m68k-support.diff +reproducible-properties-timestamp.diff +reproducible-javadoc-timestamp.diff +8212233.diff +Don-t-optimize-fdlibm-fork-for-Zero-on-linux-sparc-Z.patch +8214002.diff diff -Nru openjdk-lts-11~28/debian/patches/system-pcsclite.diff openjdk-lts-11.0.2+9/debian/patches/system-pcsclite.diff --- openjdk-lts-11~28/debian/patches/system-pcsclite.diff 2018-07-19 18:15:51.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/system-pcsclite.diff 2019-01-22 12:28:12.000000000 +0000 @@ -52,7 +52,7 @@ +]) --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in -@@ -734,6 +734,7 @@ ENABLE_AOT:=@ENABLE_AOT@ +@@ -738,6 +738,7 @@ ENABLE_AOT:=@ENABLE_AOT@ ENABLE_INTREE_EC:=@ENABLE_INTREE_EC@ USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@ USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@ diff -Nru openjdk-lts-11~28/debian/patches/workaround_expand_exec_shield_cs_limit.diff openjdk-lts-11.0.2+9/debian/patches/workaround_expand_exec_shield_cs_limit.diff --- openjdk-lts-11~28/debian/patches/workaround_expand_exec_shield_cs_limit.diff 2018-07-19 18:16:06.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/patches/workaround_expand_exec_shield_cs_limit.diff 2019-01-22 12:28:12.000000000 +0000 @@ -11,7 +11,7 @@ /* --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp -@@ -5036,7 +5036,7 @@ jint os::init_2(void) { +@@ -5057,7 +5057,7 @@ jint os::init_2(void) { Linux::capture_initial_stack(JavaThread::stack_size_at_create()); } diff -Nru openjdk-lts-11~28/debian/rules openjdk-lts-11.0.2+9/debian/rules --- openjdk-lts-11~28/debian/rules 2018-10-10 19:10:01.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/rules 2019-01-24 14:14:20.000000000 +0000 @@ -47,6 +47,10 @@ multiarch_dir = /$(DEB_HOST_MULTIARCH) hotspot_archs = amd64 i386 arm64 armhf ppc64 ppc64el sparc64 s390x kfreebsd-amd64 kfreebsd-i386 +jtreg_archs = $(hotspot_archs) alpha ia64 powerpc powerpcspe ppc64 sh4 x32 +#jtreg_archs += armel +#jtreg_archs += mips mipsel mips64 mips64el + # FIXME: use bootcycle builds for zero archs? bootcycle_build = $(if $(filter $(DEB_HOST_ARCH), $(hotspot_archs)),yes) bootcycle_build = $(if $(filter $(DEB_HOST_ARCH), amd64 i386),yes) @@ -83,13 +87,18 @@ v_upstream := $(shell echo $(PKGVERSION) | sed 's/-[^-][^-]*$$//') v_pkgrel := $(shell echo $(PKGVERSION) | sed 's/^.*-//') # FIXME. currently v_upstream like 11~4 -v_upbase := $(word 1, $(subst ~, , $(v_upstream))) -v_upbuild := $(word 2, $(subst ~, , $(v_upstream))) +v_upbase := $(word 1, $(subst +, , $(v_upstream))) +v_upbuild := $(word 2, $(subst +, , $(v_upstream))) +#v_upbase := $(word 1, $(subst ~, , $(v_upstream))) +#v_upbuild := $(word 2, $(subst ~, , $(v_upstream))) # that should be the package version ... -ifneq ($(PKGVERSION),$(v_upbase)~$(v_upbuild)-$(v_pkgrel)) - $(error wrong version: $(v_upbase)$(v_upbuild)-$(v_pkgrel) should be: $(PKGVERSION)) +ifneq ($(PKGVERSION),$(v_upbase)+$(v_upbuild)-$(v_pkgrel)) + $(error wrong version: $(v_upbase)+$(v_upbuild)-$(v_pkgrel) should be: $(PKGVERSION)) endif +#ifneq ($(PKGVERSION),$(v_upbase)~$(v_upbuild)-$(v_pkgrel)) +# $(error wrong version: $(v_upbase)~$(v_upbuild)-$(v_pkgrel) should be: $(PKGVERSION)) +#endif ifneq (,$(DEB_HOST_MULTIARCH)) jdirname = java-$(shortver)-$(origin)-$(DEB_HOST_ARCH) @@ -129,8 +138,9 @@ endif with_check = $(if $(findstring nocheck, $(DEB_BUILD_OPTIONS)),,yes) -ifneq (,$(filter $(DEB_HOST_ARCH), armel)) - #with_check = disabled running check on $(DEB_HOST_ARCH) +# see Debian #920161 +ifneq (,$(filter $(DEB_HOST_ARCH), alpha)) + with_check = disabled running check on $(DEB_HOST_ARCH) endif with_docs = $(if $(findstring nodocs, $(DEB_BUILD_OPTIONS)),,yes) @@ -165,7 +175,6 @@ export DEBIAN_JDK_BASE_DIR := /$(basedir) BOOTJDK_HOME := $(strip $(subst /bin/javac,, $(firstword $(wildcard \ - /usr/lib/jvm/java-9-openjdk-$(DEB_BUILD_ARCH)/bin/javac \ /usr/lib/jvm/java-10-openjdk-$(DEB_BUILD_ARCH)/bin/javac \ /usr/lib/jvm/java-11-openjdk-$(DEB_BUILD_ARCH)/bin/javac \ )))) @@ -211,6 +220,10 @@ export EXTRA_CXXFLAGS_ZERO := $(shell $(dpkg_buildflags_zero) --get CXXFLAGS) export EXTRA_LDFLAGS_ZERO := $(shell $(dpkg_buildflags_zero) --get LDFLAGS) +ifeq ($(DEB_HOST_ARCH),alpha) + export EXTRA_LDFLAGS_ZERO += -Wl,--no-relax +endif + # for JDK: jdk/make/common/Defs.gmk # Don't overwrite JDK opt level : # 1) with forced -03, it cause wrong Math.* computations, see #679292 and #678228 @@ -277,37 +290,8 @@ with_nss = yes -ifneq (,$(filter $(distrel),squeeze wheezy lucid precise trusty xenial)) - with_check = -endif -ifeq (,$(filter $(distrel),squeeze wheezy jessie lucid precise trusty)) - bd_jtreg = jtreg (>= 4.2-b10-1~), -endif - on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd ] && echo yes) -ifeq ($(derivative),Debian) - with_wm = $(notdir $(firstword $(wildcard /usr/bin/metacity /usr/bin/twm))) - ifneq (,$(findstring twm, $(with_wm))) - with_wm_args = -f $(CURDIR)/bin/jtreg.tmwrc - endif - bd_wm = twm | metacity, twm | dbus-x11, -else - with_wm = $(notdir $(firstword $(wildcard /usr/bin/metacity /usr/bin/twm))) - with_wm_args = - ifneq (,$(findstring twm, $(with_wm))) - with_wm_args = -f $(CURDIR)/bin/jtreg.tmwrc - endif - ifneq (,$(filter $(distrel),saucy raring quantal precise lucid)) - bd_wm = metacity | twm, dbus-x11, - else - bd_wm = twm | metacity, twm | dbus-x11, - endif -endif -ifeq ($(with_wm),metacity) - with_wm_prefix = dbus-launch --exit-with-session -endif - CONFIGURE_ARGS = # GNU/kFreeBSD don't support epoll syscall so don't try to check of it. @@ -328,7 +312,9 @@ CONFIGURE_ARGS += --enable-zero endif -EXTRA_BUILD_ENV += MAKE_VERBOSE=y QUIETLY= LOG=debug +ifeq (,$(filter $(DEB_BUILD_OPTIONS), terse)) + EXTRA_BUILD_ENV += MAKE_VERBOSE=y QUIETLY= LOG=debug +endif # timestamp skew on kFreeBSD EXTRA_BUILD_ENV += IGNORE_OLD_CONFIG=true @@ -474,7 +460,7 @@ ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64)) jdk_hl_tools += jaotc endif -ifeq (,$(filter $(DEB_HOST_ARCH), armel ia64 m68k mips mipsel mips64el powerpc s390x x32)) +ifeq (,$(filter $(DEB_HOST_ARCH), alpha armel ia64 m68k mips mipsel mips64el powerpc s390x x32)) jdk_hl_tools += jhsdb endif jdk_tools = jconsole @@ -487,17 +473,24 @@ # build dependencies bd_autotools = autoconf, automake, autotools-dev, -bd_bootstrap = openjdk-10-jdk-headless | openjdk-11-jdk-headless, +ifneq (,$(filter $(distrel),squeeze wheezy jessie precise trusty xenial)) + bd_bootstrap = openjdk-10-jdk-headless | openjdk-11-jdk-headless, + else + bd_bootstrap = openjdk-11-jdk-headless | openjdk-10-jdk-headless, +endif ifeq (,$(filter $(distrel),squeeze wheezy jessie precise trusty xenial)) bd_cross += \ $(basename)-jdk-headless , -else - old_debhelper = yes endif -ifeq ($(old_debhelper),yes) + +ifneq (,$(filter $(distrel),squeeze wheezy jessie precise trusty)) + old_debhelper = veryold bd_debhelper = debhelper (>= 9), -else +else ifneq (,$(filter $(distrel), stretch xenial)) + old_debhelper = old bd_debhelper = debhelper (>= 9.20141010), dpkg-dev (>= 1.17.14), +else + bd_debhelper = debhelper (>= 11), endif # This section should be in sync with "CC/CXX" definition @@ -540,7 +533,6 @@ bd_ant = ant, ant-optional, bd_fastjar = fastjar (>= 2:0.96-0ubuntu2), -bd_xvfb = xvfb, xauth, xfonts-base, libgl1-mesa-dri [!x32], $(bd_wm) x11-xkb-utils, ifeq ($(with_pulse),yes) bd_pulsejava = libpulse-dev (>= 0.9.12), endif @@ -683,12 +675,10 @@ -e 's/@bd_gcc@/$(bd_gcc)/g' \ -e 's/@bd_syslibs@/$(bd_syslibs)/g' \ -e 's/@bd_fastjar@/$(bd_fastjar)/g' \ - -e 's/@bd_xvfb@/$(bd_xvfb)/g' \ -e 's/@bd_pulsejava@/$(bd_pulsejava)/g' \ -e 's/@bd_nss@/$(bd_nss)/g' \ -e 's/@bd_systemtap@/$(bd_systemtap)/g' \ -e 's/@bd_ant@/$(bd_ant)/g' \ - -e 's/@bd_jtreg@/$(bd_jtreg)/g' \ -e 's/@core_fonts@/$(core_fonts)/g' \ -e 's/@cjk_fonts@/$(cjk_fonts)/g' \ -e 's/@any_archs@/$(any_archs)/g' \ @@ -707,6 +697,12 @@ exit 1; \ fi +debian/tests/%.sh: debian/tests/%.in debian/rules + sed -e 's/@jtreg_archs@/$(jtreg_archs)/g' $< > $@; + chmod +x $@ + +gen-autopkgtests: debian/tests/jtreg-autopkgtest.sh + packaging-files: for f in debian/*.in; do \ case "$$f" in debian/control.in) continue; esac; \ @@ -839,12 +835,8 @@ mkdir -p stamps touch $@ -check_archs = $(hotspot_archs) alpha ia64 powerpc powerpcspe ppc64 sh4 x32 -#check_archs += armel -#check_archs += mips mipsel mips64 mips64el - ifeq ($(with_check),yes) - ifneq (,$(filter $(DEB_HOST_ARCH), $(check_archs))) + ifneq (,$(filter $(DEB_HOST_ARCH), $(jtreg_archs))) with_jtreg_check = $(default_vm) endif @@ -856,18 +848,6 @@ endif endif -# these are best guesses depending on the architecture and the build machines -# some tests require 4min to run, so set the minimum timeout to 3 x 2min. -ifneq (,$(filter $(DEB_HOST_ARCH), alpha armel armhf ia64 m68k mips mipsel mips64 mips64el powerpc powerpcspe x32)) - JTREG_OPTIONS = -timeout:5 -else - JTREG_OPTIONS = -timeout:3 -endif - -ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf)) - JTREG_OPTIONS += -Xmx256M -vmoption:-Xmx256M -endif - build_stamps = \ stamps/build \ $(if $(filter $(DEB_HOST_ARCH),$(altzero_archs)),stamps/zero-build) @@ -921,6 +901,11 @@ $(builddir)/$(sdkimg)/lib/zero touch $@ +stamps/prune-build-dir: + -find $(builddir) -mindepth 2 ! -path '$(builddir)/$(sdkimg)/*' -delete + rm -rf $(zbuilddir) + touch $@ + stamps/build-docs: stamps/build @echo '========== $@ ==========' mkdir -p $(builddir)/images/docs @@ -928,59 +913,18 @@ $(MAKE) -C $(builddir) docs touch $@ -stamps/xvfb-check: - mkdir -p bin jtreg-test-output - ( \ - echo '#!/bin/sh'; \ - echo '$(with_wm_prefix) $(with_wm) $(with_wm_args) &'; \ - echo 'pid=$$!'; \ - echo 'sleep 3'; \ - echo '"$$@"'; \ - echo 'kill -9 $$pid'; \ - ) > bin/my-jtreg-run - chmod 755 bin/my-jtreg-run - mkdir -p jtreg-test-output -ifeq (,$(wildcard /usr/bin/$(with_wm))) - echo 'xvfb-run -a -e $(CURDIR)/jtreg-test-output/xvfb-run.log -s "-extension GLX" "$$@"' > bin/my-xvfb-run -else - echo 'xvfb-run -a -e $(CURDIR)/jtreg-test-output/xvfb-run.log -s "-extension GLX" my-jtreg-run "$$@"' > bin/my-xvfb-run - ifeq ($(with_wm),twm) - grep -v '^include-menu-defs' /etc/X11/twm/system.twmrc-menu > bin/jtreg.tmwrc - echo RandomPlacement >> bin/jtreg.tmwrc - endif -endif - if ! /bin/sh bin/my-xvfb-run true ; then \ - echo "error running $$(cat bin/my-xvfb-run)"; \ - cat jtreg-test-output/xvfb-run.log; \ - sed -i 's/ -s *"[^"]*"//' bin/my-xvfb-run; \ - if ! /bin/sh bin/my-xvfb-run true ; then \ - echo "error running $$(cat bin/my-xvfb-run)"; \ - cat jtreg-test-output/xvfb-run.log; \ - rm -f bin/my-xvfb-run; \ - fi; \ - fi - if [ -f bin/my-xvfb-run ]; then \ - echo "using $$(cat bin/my-xvfb-run)"; \ - fi - touch $@ - -XVFB_RUN_CMD = xvfb-run -a -e $(CURDIR)/jtreg-test-output/xvfb-run.log -s "-extension GLX" -ifneq (,$(wildcard /usr/bin/$(with_wm))) - XVFB_RUN_CMD += $(CURDIR)/bin/my-jtreg-run -endif - -stamps/jtreg-check-default: stamps/build stamps/xvfb-check +stamps/jtreg-check-default: stamps/build $(MAKE) -f debian/rules jtreg-run-check VMNAME=$(default_vm) VMARGS= \ - $(if $(filter $(default_vm),hotspot),TEST_SUITES='hotspot langtools jaxp nashorn jdk',TEST_SUITES='hotspot langtools jaxp nashorn') -# TEST_SUITES='hotspot langtools jaxp nashorn' + $(if $(filter $(default_vm),hotspot),TEST_SUITES='hotspot langtools jaxp jdk',TEST_SUITES='hotspot langtools jaxp') +# TEST_SUITES='hotspot langtools jaxp' touch $@ -stamps/jtreg-check-zero: stamps/build stamps/xvfb-check +stamps/jtreg-check-zero: stamps/build $(MAKE) -f debian/rules jtreg-run-check VMNAME=zero VMARGS='-vmoption:-zero' \ - TEST_SUITES='hotspot langtools jaxp nashorn' + TEST_SUITES='hotspot langtools jaxp' touch $@ -jtreg-run-check: +jtreg-run-check: stamps/prune-build-dir mkdir -p jtreg-test-output ifneq (,$(filter $(VMNAME), $(with_jtreg_check))) if [ ! -f $(builddir)/$(sdkimg)/conf/security/java.security.install ]; then \ @@ -995,7 +939,7 @@ @echo "BEGIN jtreg" $(TIME) $(MAKE) -f debian/rules -k jtregcheck \ $(if $(TEST_SUITES),TEST_SUITES="$(TEST_SUITES)") \ - JTREG_OPTIONS='$(VMARGS) $(JTREG_OPTIONS)' \ + JTREG_OPTIONS='$(VMARGS)' \ 2>&1 | tee jtreg-test-output/jtreg_output-$(VMNAME) @echo "END jtreg" @@ -1004,7 +948,7 @@ $(builddir)/$(sdkimg)/conf/security/java.security; \ fi - for i in check-hotspot.log check-jaxp.log check-jdk.log check-langtools.log check-nashorn.log jtreg-summary.log; do \ + for i in check-hotspot.log check-jaxp.log check-jdk.log check-langtools.log jtreg-summary.log; do \ if [ -f jtreg-test-output/$$i ]; then \ mv jtreg-test-output/$$i jtreg-test-output/$${i%*.log}-$(VMNAME).log; \ else \ @@ -1016,36 +960,13 @@ -cat jtreg-test-output/jtreg-summary-$(VMNAME).log @echo "END jtreg-summary-$(VMNAME)" - : # kill testsuite processes still hanging - @pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "killing processes..."; \ - $(jtreg_processes); \ - kill -1 $$pids; \ - sleep 2; \ - pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "trying harder..."; \ - $(jtreg_processes); \ - kill -9 $$pids; \ - sleep 2; \ - fi; \ - else \ - echo "nothing to cleanup"; \ - fi; \ - pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "leftover processes..."; \ - $(jtreg_processes); \ - fi - - -for i in hotspot langtools nashorn jaxp jdk; do \ + -for i in hotspot langtools jaxp jdk; do \ test -f jtreg-test-output/check-$$i-$(VMNAME).log || continue; \ for t in $$(egrep '^(FAILED|Error)' jtreg-test-output/check-$$i-$(VMNAME).log | grep -v '^Error: Some tests failed or other problems occurred.$$' | sed -e 's/.* \(.*\)\.[^.#]\+\(#id[0-9]*\)\?$$/\1\2/' -e 's/#id/_id/'); do \ echo jtreg-test-output/$$i/JTwork/$$t.jtr; \ done; \ done | sort -u > jtreg-test-output/failed_tests-$(VMNAME).list; \ - GZIP=-9vn tar -C . -c -z -f jtreg-test-output/failed_tests-$(VMNAME).tar.gz -T jtreg-test-output/failed_tests-$(VMNAME).list + GZIP=-9vn tar --ignore-failed-read -C . -c -z -f jtreg-test-output/failed_tests-$(VMNAME).tar.gz -T jtreg-test-output/failed_tests-$(VMNAME).list GZIP=-9vn tar -C . -c -z -f jtreg-test-output/jtreport-$(VMNAME).tar.gz jtreg-test-output/*/JTreport/ else echo "jtreg harness not run for this build" > jtreg-test-output/jtreg_output-$(VMNAME) @@ -1054,77 +975,32 @@ # ---------------------------------------------------------------------------- # jtreg targets taken from IcedTea -export JTREG_HOME=/usr/share/java - TESTS_TO_RUN = $(addprefix check-,$(TEST_SUITES)) check-hotspot: stamps/build - mkdir -p jtreg-test-output/hotspot/JTwork jtreg-test-output/hotspot/JTreport - JT_JAVA=$(BOOTJDK_HOME) $(TIME) jtreg -v1 -a -ignore:quiet \ - -w:jtreg-test-output/hotspot/JTwork -r:jtreg-test-output/hotspot/JTreport \ - -agentvm -conc:auto \ - -jdk:$(builddir)/$(sdkimg) \ - $(JTREG_OPTIONS) \ - -exclude:test/hotspot/jtreg/ProblemList.txt \ - -dir:$(CURDIR)/$(srcdir)/test/hotspot/jtreg \ - :hotspot_compiler :hotspot_gc :hotspot_runtime :hotspot_serviceability \ - | tee jtreg-test-output/$@.log + mkdir -p jtreg-test-output/hotspot + JTREG_OPTIONS=$(JTREG_OPTIONS) VMNAME=$(VMNAME) JDK_DIR=$(builddir)/$(sdkimg) \ + AUTOPKGTEST_TMP=/tmp/ AUTOPKGTEST_ARTIFACTS=jtreg-test-output/hotspot/ \ + $(TIME) debian/tests/hotspot | tee jtreg-test-output/$@.log + check-langtools: stamps/build - mkdir -p jtreg-test-output/langtools/JTwork jtreg-test-output/langtools/JTreport - JT_JAVA=$(BOOTJDK_HOME) $(TIME) jtreg -v1 -a -ignore:quiet \ - -w:jtreg-test-output/langtools/JTwork -r:jtreg-test-output/langtools/JTreport \ - -agentvm -conc:auto \ - -jdk:$(builddir)/$(sdkimg) \ - $(JTREG_OPTIONS) \ - -exclude:test/langtools/ProblemList.txt \ - -dir:$(CURDIR)/$(srcdir)/test/langtools \ - jdk tools lib - | tee jtreg-test-output/$@.log - -check-nashorn: stamps/build - mkdir -p jtreg-test-output/nashorn/JTwork jtreg-test-output/nashorn/JTreport - JT_JAVA=$(BOOTJDK_HOME) $(TIME) jtreg -v1 -a -ignore:quiet \ - -w:jtreg-test-output/nashorn/JTwork -r:jtreg-test-output/nashorn/JTreport \ - -agentvm -conc:auto \ - -jdk:$(builddir)/$(sdkimg) \ - $(JTREG_OPTIONS) \ - -exclude:test/nashorn/ProblemList.txt \ - $(CURDIR)/$(srcdir)/test/nashorn \ - | tee jtreg-test-output/$@.log + mkdir -p jtreg-test-output/langtools + JTREG_OPTIONS=$(JTREG_OPTIONS) VMNAME=$(VMNAME) JDK_DIR=$(builddir)/$(sdkimg) \ + AUTOPKGTEST_TMP=/tmp/ AUTOPKGTEST_ARTIFACTS=jtreg-test-output/langtools/ \ + $(TIME) debian/tests/langtools | tee jtreg-test-output/$@.log check-jaxp: stamps/build - mkdir -p jtreg-test-output/jaxp/JTwork jtreg-test-output/jaxp/JTreport - JT_JAVA=$(BOOTJDK_HOME) $(TIME) jtreg -v1 -a -ignore:quiet \ - -w:jtreg-test-output/jaxp/JTwork -r:jtreg-test-output/jaxp/JTreport \ - -agentvm -conc:auto \ - -jdk:$(builddir)/$(sdkimg) \ - $(JTREG_OPTIONS) \ - -exclude:test/jaxp/ProblemList.txt \ - $(CURDIR)/$(srcdir)/test/jaxp \ - | tee jtreg-test-output/$@.log - -check-jdk: stamps/build stamps/xvfb-check - mkdir -p jtreg-test-output/jdk/JTwork jtreg-test-output/jdk/JTreport - set -x; \ - $(TIME) \ - $(if $(DISPLAY),,$(XVFB_RUN_CMD)) \ - env JT_JAVA=$(BOOTJDK_HOME) jtreg -v1 -a -ignore:quiet \ - -w:jtreg-test-output/jdk/JTwork -r:jtreg-test-output/jdk/JTreport \ - -agentvm -conc:auto \ - -jdk:$(builddir)/$(sdkimg) \ - $(JTREG_OPTIONS) \ - -exclude:test/jdk/ProblemList.txt \ - -dir:$(CURDIR)/$(srcdir)/test/jdk \ - :jdk_stable \ - | tee jtreg-test-output/$@.log - -# FIXME: this might need some adjustment for other OS than Linux -jtreg_processes = ps x -ww -o pid,ppid,args \ - | awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,/scratch)/' \ - | $(SED) 's,$(CURDIR)/$(builddir)/$(sdkimg),,g;s,$(CURDIR),,g' -jtreg_pids = ps x --no-headers -ww -o pid,ppid,args \ - | awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,$(CURDIR)/$(builddir)/$(sdkimg))/ {print $$1}' + mkdir -p jtreg-test-output/jaxp + JTREG_OPTIONS=$(JTREG_OPTIONS) VMNAME=$(VMNAME) JDK_DIR=$(builddir)/$(sdkimg) \ + AUTOPKGTEST_TMP=/tmp/ AUTOPKGTEST_ARTIFACTS=jtreg-test-output/langtools/ \ + $(TIME) debian/tests/jaxp | tee jtreg-test-output/$@.log + +check-jdk: stamps/build + mkdir -p jtreg-test-output/jdk + JTREG_OPTIONS=$(JTREG_OPTIONS) VMNAME=$(VMNAME) JDK_DIR=$(builddir)/$(sdkimg) \ + AUTOPKGTEST_TMP=/tmp/ AUTOPKGTEST_ARTIFACTS=jtreg-test-output/jdk/ \ + $(TIME) debian/tests/jdk | tee jtreg-test-output/$@.log jtregcheck: $(TESTS_TO_RUN) for i in $(TEST_SUITES); do \ @@ -1132,29 +1008,6 @@ egrep -v '^(Passed:|Directory|Re[a-z]+\ written\ to)' jtreg-test-output/check-$$i.log; \ done | tee jtreg-test-output/jtreg-summary.log - : # kill testsuite processes still hanging - @pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "killing processes..."; \ - $(jtreg_processes); \ - kill -1 $$pids; \ - sleep 2; \ - pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "try harder..."; \ - $(jtreg_processes); \ - kill -9 $$pids; \ - sleep 2; \ - fi; \ - else \ - echo "nothing to cleanup"; \ - fi; \ - pids=$$($(jtreg_pids)); \ - if [ -n "$$pids" ]; then \ - echo "leftover processes..."; \ - $(jtreg_processes); \ - fi - # ---------------------------------------------------------------------------- clean: debian-clean @@ -1225,6 +1078,7 @@ mkdir -p $(d)/$(etcdir)/security/policy/limited mkdir -p $(d)/$(etcdir)/security/policy/unlimited mkdir -p $(d)/$(etcdir)/management + mkdir -p $(d)/$(etcdir)/jfr ifeq (0,1) : # rename templates (comments only) to config files, @@ -1277,6 +1131,8 @@ lib/psfontj2d.properties \ lib/psfont.properties.ja \ lib/swing.properties \ + lib/jfr/default.jfc \ + lib/jfr/profile.jfc \ conf/management/jmxremote.access \ conf/management/management.properties \ conf/security/java.policy \ @@ -1469,9 +1325,9 @@ : # FIXME: the targets are not installed ... rm -rfv $(d)/$(basedir)/lib/jfr - dh_install --sourcedir=debian/tmp -XLICENSE -Xrelease -ifneq ($(old_debhelper),yes) - dh_missing --sourcedir=debian/tmp --fail-missing -XLICENSE -Xrelease + dh_install --sourcedir=debian/tmp -XLICENSE +ifeq (,$(findstring old, $(old_debhelper))) + dh_missing --sourcedir=debian/tmp --fail-missing -XLICENSE endif find $(d_jrehl) $(d_jre) $(d_jrez) \ @@ -1794,9 +1650,9 @@ NO_PKG_MANGLE=1 \ dh_builddeb -a $(nodemo) $(nojrez) #$(bd_options) -#is_release = yes -hg_project = jdk11 -hg_tag = jdk-11+28 +is_release = yes +hg_project = jdk11u +hg_tag = jdk-11.0.2+9 package_version = $(subst jdk-,,$(hg_tag)) ifneq ($(is_release),yes) package_version := $(subst +,~,$(package_version)) diff -Nru openjdk-lts-11~28/debian/tests/control openjdk-lts-11.0.2+9/debian/tests/control --- openjdk-lts-11~28/debian/tests/control 2018-03-15 09:43:38.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/control 2019-01-22 12:28:12.000000000 +0000 @@ -1,8 +1,7 @@ -Test-Command: debian/tests/jtreg-autopkgtest hotspot -Depends: openjdk-11-jdk, jtreg, dpkg-dev, gcc +Tests: hotspot, jaxp, langtools +Depends: @, jtreg, testng, gcc +Restrictions: allow-stderr, skippable -Test-Command: debian/tests/jtreg-autopkgtest langtools -Depends: openjdk-11-jdk, jtreg, dpkg-dev, gcc - -Test-Command: debian/tests/jtreg-autopkgtest jdk -Depends: openjdk-11-jdk, jtreg, dpkg-dev, gcc, xfwm4, xvfb +Tests: jdk +Depends: @, jtreg, testng, gcc, xfwm4, xvfb, dbus-x11 +Restrictions: allow-stderr, skippable diff -Nru openjdk-lts-11~28/debian/tests/hotspot openjdk-lts-11.0.2+9/debian/tests/hotspot --- openjdk-lts-11~28/debian/tests/hotspot 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/hotspot 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,12 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +debian/tests/jtreg-autopkgtest.sh \ + -exclude:test/hotspot/jtreg/ProblemList.txt \ + -dir:test/hotspot/jtreg \ + :hotspot_compiler :hotspot_gc :hotspot_runtime :hotspot_serviceability + +debian/tests/jtdiff-autopkgtest.sh hotspot diff -Nru openjdk-lts-11~28/debian/tests/jaxp openjdk-lts-11.0.2+9/debian/tests/jaxp --- openjdk-lts-11~28/debian/tests/jaxp 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jaxp 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +debian/tests/jtreg-autopkgtest.sh -exclude:test/jaxp/ProblemList.txt test/jaxp +debian/tests/jtdiff-autopkgtest.sh jaxp diff -Nru openjdk-lts-11~28/debian/tests/jdk openjdk-lts-11.0.2+9/debian/tests/jdk --- openjdk-lts-11~28/debian/tests/jdk 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jdk 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,26 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +# TODO: native library support + +cleanup() { + pid="$(jobs -p)" + [ -n "$pid" ] && pkill -P ${pid} + pkill -9 -P $$ +} + +for sig in INT QUIT HUP TERM; do trap "cleanup; trap - $sig EXIT; kill -s $sig "'"$$"' "$sig"; done +trap cleanup EXIT + +export HOME="$(pwd)/jdk/test/" +export XAUTHORITY="${HOME}/.Xauthority" +export DISPLAY=:10 + +debian/tests/start-xvfb.sh 10 & +sleep 3 + +debian/tests/jtreg-autopkgtest.sh -exclude:test/jdk/ProblemList.txt test/jdk:jdk_stable +debian/tests/jtdiff-autopkgtest.sh jdk diff -Nru openjdk-lts-11~28/debian/tests/jtdiff-autopkgtest.sh openjdk-lts-11.0.2+9/debian/tests/jtdiff-autopkgtest.sh --- openjdk-lts-11~28/debian/tests/jtdiff-autopkgtest.sh 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jtdiff-autopkgtest.sh 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,36 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +testsuite=$1 +shift + +if [ -z "${AUTOPKGTEST_TMP+x}" ] || [ -z "${AUTOPKGTEST_ARTIFACTS+x}" ]; then + echo "Environment variables AUTOPKGTEST_TMP and AUTOPKGTEST_ARTIFACTS must be set" >&2 + exit 1 +fi + +host_arch=${DEB_HOST_ARCH:-$(dpkg --print-architecture)} + +export JTREG_HOME=/usr/share/java +export JT_JAVA="${JT_JAVA:-/usr/lib/jvm/java-11-openjdk-${host_arch}}" + +vmname=${VMNAME:-hotspot} + +jt_report_tb="/usr/share/doc/openjdk-11-jdk/test-${host_arch}/jtreport-${vmname}.tar.gz" +build_report_dir="${AUTOPKGTEST_TMP}/jtreg-test-output/${testsuite}/JTreport" + +if [ ! -f "${jt_report_tb}" ]; then + echo "Unable to compare jtreg results: no build jtreport found for ${vmname}/${host_arch}." + echo "Reason: '${jt_report_tb}' does not exist." + exit 77 +fi + +# extract testsuite results from original openjdk build +[ -d "${build_report_dir}" ] || \ + tar -xf "${jt_report_tb}" -C "${AUTOPKGTEST_TMP}" + +jtdiff -o "${AUTOPKGTEST_ARTIFACTS}/jtdiff.html" "${build_report_dir}" "${AUTOPKGTEST_ARTIFACTS}/JTreport" || true +jtdiff "${build_report_dir}" "${AUTOPKGTEST_ARTIFACTS}/JTreport" | tee "${AUTOPKGTEST_ARTIFACTS}/jtdiff.txt" diff -Nru openjdk-lts-11~28/debian/tests/jtreg-autopkgtest openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest --- openjdk-lts-11~28/debian/tests/jtreg-autopkgtest 2016-10-30 16:11:20.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -#!/bin/bash -set -o errexit -set -o errtrace -set -o pipefail -set -o nounset - -testsuite=$1 -shift 1 - -tmp_dir="${AUTOPKGTEST_TMP:-/tmp/autopkgtest/tmp}" -result_dir="${AUTOPKGTEST_ARTIFACTS:-/tmp/autopkgtest/artifact}" - -testsuite_dir="${tmp_dir}/${testsuite}" - -work_dir="${result_dir}/${testsuite}/JTwork" -report_dir="${result_dir}/${testsuite}/JTreport" - -pids="" - -mkdir -p "${tmp_dir}" "${work_dir}" "${report_dir}" - -source <(dpkg-architecture -s) - -tarball=${testsuite}.tar.xz -case ${testsuite} in - hotspot) - if [ ${DEB_BUILD_ARCH} == "arm64" ]; then - tarball=hotspot-aarch64.tar.xz - elif [ ${DEB_BUILD_ARCH} == "armhf" ]; then - tarball=hotspot-aarch32.tar.xz - fi - ;; - jdk) - xvfb-run --auto-servernum --server-num=10 \ - --error-file=${AUTOPKGTEST_ARTIFACTS}/xvfb-run.log \ - -f ${AUTOPKGTEST_TMP}/Xauthority-xvfb \ - --server-args="-extension GLX -screen 0 1600x900x24" \ - xfwm4 & - pids+=" $!" - ;; - langtools) ;; - *) exit 1;; -esac - -# unpack testsuite tarball -d="$(head -1 <(tar tf ${tarball}) | sed 's,/.*,,')" -tar -C "${tmp_dir}" -x -f ${tarball} "${d}/test/" -mv "${tmp_dir}/${d}" "${testsuite_dir}" - -# from debian/rules -# these are best guesses depending on the architecture and the build machines -# some tests require 4min to run, so set the minimum timeout to 3 x 2min. -jt_timeout="3" -if [[ "alpha armel armhf ia64 m68k mips mipsel mips64 mips64el powerpc powerpcspe x32" == *"${DEB_HOST_ARCH}"* ]]; then - jt_timeout="5" -fi - -# grab additional options from command line args -jt_options="$@" -if [[ "armel" == *"${DEB_HOST_ARCH}"* ]]; then - jt_options+=" -Xmx256M" -fi - -# jtreg will use default-java if JT_JAVA is not set -export JT_JAVA=/usr/lib/jvm/java-8-openjdk-${DEB_HOST_ARCH} - -jtreg ${jt_options} \ - -verbose:1 \ - -automatic \ - -ignore:quiet \ - -agentvm \ - -conc:auto \ - -timeout:${jt_timeout} \ - -jdk:${JT_JAVA} \ - -exclude:debian/excludelist.${testsuite}.jtx \ - -w:${work_dir} \ - -r:${report_dir} \ - ${testsuite_dir}/test \ - | tee ${result_dir}/check-${testsuite}-stdout.log \ - 2> ${result_dir}/check-${testsuite}-stderr.log - -if [ -n "${pids}" ]; then - kill ${pids} 2>&1 || true - sleep 5 - kill -9 ${pids} || true -fi diff -Nru openjdk-lts-11~28/debian/tests/jtreg-autopkgtest.in openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest.in --- openjdk-lts-11~28/debian/tests/jtreg-autopkgtest.in 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest.in 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,89 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +if [ -z "${AUTOPKGTEST_TMP+x}" ] || [ -z "${AUTOPKGTEST_ARTIFACTS+x}" ]; then + echo "Environment variables AUTOPKGTEST_TMP and AUTOPKGTEST_ARTIFACTS must be set" >&2 + exit 1 +fi + +host_arch=${DEB_HOST_ARCH:-$(dpkg --print-architecture)} + +export JTREG_HOME=/usr/share/java +export JT_JAVA="${JT_JAVA:-/usr/lib/jvm/java-11-openjdk-${host_arch}}" +JDK_DIR="${JDK_DIR:-$JT_JAVA}" + +jtreg_version="$(dpkg-query -W jtreg | cut -f2)" + +# set additional jtreg options +jt_options="${JTREG_OPTIONS:-}" +if [[ "armel" == *"${host_arch}"* ]]; then + jt_options+=" -Xmx256M" +fi +if dpkg --compare-versions ${jtreg_version} ge 4.2; then + jt_options+=" -conc:auto" +fi + +# check java binary +if [ ! -x "${JDK_DIR}/bin/java" ]; then + echo "Error: '${JDK_DIR}/bin/java' is not an executable." >&2 + exit 1 +fi + +# restrict the tests to a few archs (set from debian/rules) +if ! echo "${host_arch}" | grep -E "^($(echo @jtreg_archs@ | tr ' ' '|'))$"; then + echo "Error: ${host_arch} is not on the jtreg_archs list, ignoring it." + exit 77 +fi + +jtreg_processes() { + ps x -ww -o pid,ppid,args \ + | awk '$2 == 1 && $3 ~ /^\/scratch/' \ + | sed "s,${JDK_DIR},,g;s,$(pwd),,g" +} + +jtreg_pids() { + ps x --no-headers -ww -o pid,ppid,args \ + | awk "\$2 == 1 && \$3 ~ /^${JDK_DIR//\//\\/}/ {print \$1}" +} + +cleanup() { + # kill testsuite processes still hanging + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] killing processes..." + jtreg_processes + kill -1 $pids + sleep 2 + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] try harder..." + jtreg_processes + kill -9 $pids + sleep 2 + fi + else + echo "[$0] nothing to cleanup" + fi + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] leftover processes..." + $(jtreg_processes) + fi +} + +trap "cleanup" EXIT INT TERM ERR + +jtreg ${jt_options} \ + -verbose:summary \ + -automatic \ + -retain:none \ + -ignore:quiet \ + -agentvm \ + -timeout:5 \ + -workDir:"${AUTOPKGTEST_ARTIFACTS}/JTwork" \ + -reportDir:"${AUTOPKGTEST_ARTIFACTS}/JTreport" \ + -jdk:${JDK_DIR} \ + $@ diff -Nru openjdk-lts-11~28/debian/tests/jtreg-autopkgtest.sh openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest.sh --- openjdk-lts-11~28/debian/tests/jtreg-autopkgtest.sh 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/jtreg-autopkgtest.sh 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,89 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +if [ -z "${AUTOPKGTEST_TMP+x}" ] || [ -z "${AUTOPKGTEST_ARTIFACTS+x}" ]; then + echo "Environment variables AUTOPKGTEST_TMP and AUTOPKGTEST_ARTIFACTS must be set" >&2 + exit 1 +fi + +host_arch=${DEB_HOST_ARCH:-$(dpkg --print-architecture)} + +export JTREG_HOME=/usr/share/java +export JT_JAVA="${JT_JAVA:-/usr/lib/jvm/java-11-openjdk-${host_arch}}" +JDK_DIR="${JDK_DIR:-$JT_JAVA}" + +jtreg_version="$(dpkg-query -W jtreg | cut -f2)" + +# set additional jtreg options +jt_options="${JTREG_OPTIONS:-}" +if [[ "armel" == *"${host_arch}"* ]]; then + jt_options+=" -Xmx256M" +fi +if dpkg --compare-versions ${jtreg_version} ge 4.2; then + jt_options+=" -conc:auto" +fi + +# check java binary +if [ ! -x "${JDK_DIR}/bin/java" ]; then + echo "Error: '${JDK_DIR}/bin/java' is not an executable." >&2 + exit 1 +fi + +# restrict the tests to a few archs (set from debian/rules) +if ! echo "${host_arch}" | grep -E "^($(echo amd64 i386 arm64 armhf ppc64 ppc64el sparc64 s390x kfreebsd-amd64 kfreebsd-i386 alpha ia64 powerpc powerpcspe ppc64 sh4 x32 | tr ' ' '|'))$"; then + echo "Error: ${host_arch} is not on the jtreg_archs list, ignoring it." + exit 77 +fi + +jtreg_processes() { + ps x -ww -o pid,ppid,args \ + | awk '$2 == 1 && $3 ~ /^\/scratch/' \ + | sed "s,${JDK_DIR},,g;s,$(pwd),,g" +} + +jtreg_pids() { + ps x --no-headers -ww -o pid,ppid,args \ + | awk "\$2 == 1 && \$3 ~ /^${JDK_DIR//\//\\/}/ {print \$1}" +} + +cleanup() { + # kill testsuite processes still hanging + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] killing processes..." + jtreg_processes + kill -1 $pids + sleep 2 + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] try harder..." + jtreg_processes + kill -9 $pids + sleep 2 + fi + else + echo "[$0] nothing to cleanup" + fi + pids="$(jtreg_pids)" + if [ -n "$pids" ]; then + echo "[$0] leftover processes..." + $(jtreg_processes) + fi +} + +trap "cleanup" EXIT INT TERM ERR + +jtreg ${jt_options} \ + -verbose:summary \ + -automatic \ + -retain:none \ + -ignore:quiet \ + -agentvm \ + -timeout:5 \ + -workDir:"${AUTOPKGTEST_ARTIFACTS}/JTwork" \ + -reportDir:"${AUTOPKGTEST_ARTIFACTS}/JTreport" \ + -jdk:${JDK_DIR} \ + $@ diff -Nru openjdk-lts-11~28/debian/tests/langtools openjdk-lts-11.0.2+9/debian/tests/langtools --- openjdk-lts-11~28/debian/tests/langtools 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/langtools 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +debian/tests/jtreg-autopkgtest.sh -exclude:test/langtools/ProblemList.txt -dir:test/langtools jdk tools lib +debian/tests/jtdiff-autopkgtest.sh langtools diff -Nru openjdk-lts-11~28/debian/tests/start-xvfb.sh openjdk-lts-11.0.2+9/debian/tests/start-xvfb.sh --- openjdk-lts-11~28/debian/tests/start-xvfb.sh 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/start-xvfb.sh 2019-01-22 12:28:12.000000000 +0000 @@ -0,0 +1,19 @@ +#!/bin/bash +set -o errexit +set -o errtrace +set -o pipefail +set -o nounset + +if [ -z "${AUTOPKGTEST_TMP+x}" ] || [ -z "${AUTOPKGTEST_ARTIFACTS+x}" ]; then + echo "Environment variables AUTOPKGTEST_TMP and AUTOPKGTEST_ARTIFACTS must be set" >&2 + exit 1 +fi + +export HOME="${HOME:-${AUTOPKGTEST_TMP}}" +export XAUTHORITY="${HOME}/.Xauthority" + +exec xvfb-run --server-num=${1:-10} \ + --error-file="${AUTOPKGTEST_ARTIFACTS}/xvfb-run.log" \ + --auth-file=${XAUTHORITY} \ + --server-args="-fbdir ${AUTOPKGTEST_TMP} -pixdepths 8 16 24 32 -extension GLX -screen 0 1600x900x24" \ + xfwm4 diff -Nru openjdk-lts-11~28/debian/tests/valid-tests openjdk-lts-11.0.2+9/debian/tests/valid-tests --- openjdk-lts-11~28/debian/tests/valid-tests 2016-10-30 16:11:20.000000000 +0000 +++ openjdk-lts-11.0.2+9/debian/tests/valid-tests 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -#!/bin/bash - -testsuite_dir=$1 - -fgrep -r --include='*.java' --include='*.sh' --files-with-match @test ${testsuite_dir} | xargs fgrep -L '@ignore' | sort -d -i diff -Nru openjdk-lts-11~28/.hg_archival.txt openjdk-lts-11.0.2+9/.hg_archival.txt --- openjdk-lts-11~28/.hg_archival.txt 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/.hg_archival.txt 2019-01-18 04:23:48.000000000 +0000 @@ -1,4 +1,5 @@ repo: fd16c54261b32be1aaedd863b7e856801b7f8543 -node: 76072a077ee1d815152d45d1692c4b36c53c5c49 +node: 144d476b6efe527c5e9ebf19af93398913c5450f branch: default -tag: jdk-11+28 +tag: jdk-11.0.2+9 +tag: jdk-11.0.2-ga diff -Nru openjdk-lts-11~28/.hgtags openjdk-lts-11.0.2+9/.hgtags --- openjdk-lts-11~28/.hgtags 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/.hgtags 2019-01-18 04:23:48.000000000 +0000 @@ -501,3 +501,31 @@ 331888ea4a788df801b1edf8836646cd25fc758b jdk-11+25 945ba9278a272a5477ffb1b3ea1b04174fed8036 jdk-11+26 9d7d74c6f2cbe522e39fa22dc557fdd3f79b32ad jdk-11+27 +76072a077ee1d815152d45d1692c4b36c53c5c49 jdk-11+28 +c01cc45790f871adec30acc90742b521d57a2fff jdk-11.0.1+0 +1353ec839c82de926bfacd2c7976b6b652d4afb0 jdk-11.0.1+1 +a285bd7cfedb40cb3086e61e17fc04c96b739d03 jdk-11.0.1+2 +a285bd7cfedb40cb3086e61e17fc04c96b739d03 jdk-11.0.1+2 +0000000000000000000000000000000000000000 jdk-11.0.1+2 +fc55f0667af5ea3b21e40a59e2a88b1b82e65e62 jdk-11.0.1+2 +781b5d8f2f75ae4dfdafc85630e5dbd31e324ed1 jdk-11.0.1+3 +b5b1dd7e6f9d86aedf7141e9279342fae257bd67 jdk-11.0.1+4 +d6efeebf554c918bfab50f89939eb11121e18432 jdk-11.0.1+5 +db768cfe2141b3eb9ef53d7104002a0532c8c977 jdk-11.0.1+6 +88a221c0bad0cee441767106776628550d660a82 jdk-11.0.1+7 +c2b23a17d3ff92235aed8e8d04642d7a6eaecf54 jdk-11.0.1+8 +adb9933aa8c68e6dec6b441133f3955fe7366206 jdk-11.0.1+9 +a86e14193fc8ea98835fd3e2f867447164c7af53 jdk-11.0.1+10 +0343f9aacae2d4a9e6df4e61087837166a6a477c jdk-11.0.1+11 +c0431cf9c38e5c56eedc680e007a94c4279a8f13 jdk-11.0.1+12 +8513ac27b65198d2e6562fb7da6e9c99b9fdcf51 jdk-11.0.1+13 +7da060835810b5fbd4a7493ea1c98e9a4338f30d jdk-11.0.2+0 +2be95a1bf50877cafba791c2f342953bd4a6412e jdk-11.0.2+1 +b4b16f510f48e2dd4bea007b60fddf69af0f6c10 jdk-11.0.2+2 +8a8606a3bdf2dbe0698bef375e6a4b47df0efb1a jdk-11.0.2+3 +0db90dec8c39bc38058afa11b7fda607ee259d01 jdk-11.0.2+4 +ff1f7723c4e88822fd60bcacd55824e1d3da6d36 jdk-11.0.2+5 +c6fd7ff3e96f3e6f4913d026a90c6c454a7a35c8 jdk-11.0.2+6 +a01e0cc0105972acc3b5e213dbe2b84acaee5be3 jdk-11.0.2+7 +a01e0cc0105972acc3b5e213dbe2b84acaee5be3 jdk-11.0.2-ga +fe85e2f43a1c893cb410308106b0f31b814aebb8 jdk-11.0.2+8 diff -Nru openjdk-lts-11~28/make/autoconf/flags-cflags.m4 openjdk-lts-11.0.2+9/make/autoconf/flags-cflags.m4 --- openjdk-lts-11~28/make/autoconf/flags-cflags.m4 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/autoconf/flags-cflags.m4 2019-01-18 04:23:48.000000000 +0000 @@ -106,11 +106,17 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], [ + # By default don't set any specific assembler debug + # info flags for toolchains unless we know they work. + # See JDK-8207057. + ASFLAGS_DEBUG_SYMBOLS="" # Debug symbols if test "x$TOOLCHAIN_TYPE" = xgcc; then CFLAGS_DEBUG_SYMBOLS="-g" + ASFLAGS_DEBUG_SYMBOLS="-g" elif test "x$TOOLCHAIN_TYPE" = xclang; then CFLAGS_DEBUG_SYMBOLS="-g" + ASFLAGS_DEBUG_SYMBOLS="-g" elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then # -g0 enables debug symbols without disabling inlining. CFLAGS_DEBUG_SYMBOLS="-g0 -xs" @@ -121,6 +127,7 @@ fi AC_SUBST(CFLAGS_DEBUG_SYMBOLS) + AC_SUBST(ASFLAGS_DEBUG_SYMBOLS) ]) AC_DEFUN([FLAGS_SETUP_WARNINGS], @@ -366,6 +373,20 @@ FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_]) + COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off" + # Check that the compiler supports -ffp-contract=off flag + # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty + # otherwise. + # These flags are required for GCC-based builds of + # fdlibm with optimization without losing precision. + # Notably, -ffp-contract=off needs to be added for GCC >= 4.6. + if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then + FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}], + IF_TRUE: [FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}], + IF_FALSE: [FDLIBM_CFLAGS=""]) + fi + AC_SUBST(FDLIBM_CFLAGS) + # Tests are only ever compiled for TARGET CFLAGS_TESTLIB="$CFLAGS_JDKLIB" CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB" @@ -473,8 +494,8 @@ fi if test "x$TOOLCHAIN_TYPE" = xgcc; then - TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new" - TOOLCHAIN_CFLAGS_JDK="-pipe" + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector" + TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector" TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!) CXXSTD_CXXFLAG="-std=gnu++98" diff -Nru openjdk-lts-11~28/make/autoconf/spec.gmk.in openjdk-lts-11.0.2+9/make/autoconf/spec.gmk.in --- openjdk-lts-11~28/make/autoconf/spec.gmk.in 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/autoconf/spec.gmk.in 2019-01-18 04:23:48.000000000 +0000 @@ -444,6 +444,7 @@ LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@ LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@ +FDLIBM_CFLAGS := @FDLIBM_CFLAGS@ JVM_CFLAGS := @JVM_CFLAGS@ JVM_LDFLAGS := @JVM_LDFLAGS@ JVM_ASFLAGS := @JVM_ASFLAGS@ @@ -534,6 +535,7 @@ ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@ CFLAGS_DEBUG_SYMBOLS:=@CFLAGS_DEBUG_SYMBOLS@ +ASFLAGS_DEBUG_SYMBOLS:=@ASFLAGS_DEBUG_SYMBOLS@ # # Compress (or not) jars diff -Nru openjdk-lts-11~28/make/autoconf/version-numbers openjdk-lts-11.0.2+9/make/autoconf/version-numbers --- openjdk-lts-11~28/make/autoconf/version-numbers 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/autoconf/version-numbers 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. # 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,9 +27,9 @@ DEFAULT_VERSION_FEATURE=11 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=0 +DEFAULT_VERSION_UPDATE=2 DEFAULT_VERSION_PATCH=0 -DEFAULT_VERSION_DATE=2018-09-25 +DEFAULT_VERSION_DATE=2019-01-15 DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11" diff -Nru openjdk-lts-11~28/make/common/NativeCompilation.gmk openjdk-lts-11.0.2+9/make/common/NativeCompilation.gmk --- openjdk-lts-11~28/make/common/NativeCompilation.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/common/NativeCompilation.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -251,6 +251,7 @@ $$($$($1_BASE)_SYSROOT_CFLAGS) $1_BASE_CXXFLAGS := $$($$($1_BASE)_CXXFLAGS) $$($$($1_BASE)_EXTRA_CXXFLAGS) \ $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_EXTRA_CXXFLAGS) + $1_BASE_ASFLAGS := $$($$($1_BASE)_ASFLAGS) $$($$($1_BASE)_EXTRA_ASFLAGS) ifneq ($$(filter %.c, $$($1_FILENAME)), ) # Compile as a C file @@ -266,7 +267,7 @@ $1_DEP_FLAG := $(C_FLAG_DEPS) else ifneq ($$(filter %.s %.S, $$($1_FILENAME)), ) # Compile as assembler file - $1_FLAGS := $$($$($1_BASE)_ASFLAGS) + $1_FLAGS := $$($1_BASE_ASFLAGS) $1_COMPILER := $(AS) $1_DEP_FLAG := else ifneq ($$(filter %.cpp %.cc %.mm, $$($1_FILENAME)), ) @@ -576,6 +577,7 @@ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true) $1_EXTRA_CFLAGS += $$(CFLAGS_DEBUG_SYMBOLS) $1_EXTRA_CXXFLAGS += $$(CFLAGS_DEBUG_SYMBOLS) + $1_EXTRA_ASFLAGS += $$(ASFLAGS_DEBUG_SYMBOLS) endif ifneq ($$($1_REORDER), ) diff -Nru openjdk-lts-11~28/make/common/TestFilesCompilation.gmk openjdk-lts-11.0.2+9/make/common/TestFilesCompilation.gmk --- openjdk-lts-11~28/make/common/TestFilesCompilation.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/common/TestFilesCompilation.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -94,7 +94,7 @@ CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \ LIBS := $$($1_LIBS_$$(name)), \ - OPTIMIZATION := LOW, \ + OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \ COPY_DEBUG_SYMBOLS := false, \ STRIP_SYMBOLS := false, \ )) \ diff -Nru openjdk-lts-11~28/make/data/currency/CurrencyData.properties openjdk-lts-11.0.2+9/make/data/currency/CurrencyData.properties --- openjdk-lts-11~28/make/data/currency/CurrencyData.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/currency/CurrencyData.properties 2019-01-18 04:23:48.000000000 +0000 @@ -32,7 +32,7 @@ # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. -dataVersion=167 +dataVersion=169 # List of all valid ISO 4217 currency codes. # To ensure compatibility, do not remove codes. @@ -54,7 +54,7 @@ SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLL694-SOS706-\ SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\ TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\ - UYU858-UZS860-VEB862-VEF937-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\ + UYU858-UZS860-VEB862-VEF937-VES928-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\ XBB956-XBC957-XBD958-XCD951-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\ XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWL932-\ ZWN942-ZWR935 @@ -509,7 +509,7 @@ SJ=NOK # Sint Maarten (Dutch part) SX=ANG -# SWAZILAND +# ESWATINI SZ=SZL # SWEDEN SE=SEK @@ -564,7 +564,7 @@ # VANUATU VU=VUV # VENEZUELA (BOLIVARIAN REPUBLIC OF) -VE=VEF +VE=VES # VIET NAM VN=VND # VIRGIN ISLANDS, BRITISH diff -Nru openjdk-lts-11~28/make/data/tzdata/africa openjdk-lts-11.0.2+9/make/data/tzdata/africa --- openjdk-lts-11~28/make/data/tzdata/africa 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/africa 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Africa and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -29,7 +31,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2017-04-09): +# From Paul Eggert (2018-05-27): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -74,13 +76,15 @@ # I vaguely recall 'WAT' also being used for -01 in the past but # cannot now come up with solid citations. # -# I invented the following abbreviations; corrections are welcome! -# +02 WAST West Africa Summer Time (no longer used) -# +03 CAST Central Africa Summer Time (no longer used) -# +03 SAST South Africa Summer Time (no longer used) +# I invented the following abbreviations in the 1990s: +# +02 WAST West Africa Summer Time +# +03 CAST Central Africa Summer Time +# +03 SAST South Africa Summer Time # +03 EAT East Africa Time -# 'EAT' also seems to have caught on; the others are rare but are paired -# with better-attested non-DST abbreviations. +# 'EAT' seems to have caught on and is in current timestamps, and though +# the other abbreviations are rarer and are only in past timestamps, +# they are paired with better-attested non-DST abbreviations. +# Corrections are welcome. # Algeria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -385,6 +389,13 @@ # Eritrea # Ethiopia # See Africa/Nairobi. +# +# Unfortunately tzdb records only Western clock time in use in Ethiopia, +# as the tzdb format is not up to properly recording a common Ethiopian +# timekeeping practice that is based on solar time. See: +# Mortada D. If you have a meeting in Ethiopia, you'd better double +# check the time. PRI's The World. 2015-01-30 15:15 -05. +# https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time # Gabon # See Africa/Lagos. @@ -856,94 +867,61 @@ # agrees # with the patch. -# From Paul Eggert (2015-06-08): -# For now, guess that later spring and fall transitions will use 2015's rules, -# and guess that Morocco will switch to standard time at 03:00 the last -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after -# Ramadan. To implement this, transition dates for 2016 through 2037 were -# determined by running the following program under GNU Emacs 24.3, with the -# results integrated by hand into the table below. -# (let ((islamic-year 1437)) -# (require 'cal-islam) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (sunday 0)) -# (while (/= sunday (mod (setq a (1- a)) 7))) -# (while (/= sunday (mod b 7)) -# (setq b (1+ b))) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Mohamed Essedik Najd (2018-10-26): +# Today, a Moroccan government council approved the perpetual addition +# of 60 minutes to the regular Moroccan timezone. +# From Brian Inglis (2018-10-26): +# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S - -Rule Morocco 1939 only - Sep 12 0:00 1:00 S +Rule Morocco 1939 only - Sep 12 0:00 1:00 - Rule Morocco 1939 only - Nov 19 0:00 0 - -Rule Morocco 1940 only - Feb 25 0:00 1:00 S +Rule Morocco 1940 only - Feb 25 0:00 1:00 - Rule Morocco 1945 only - Nov 18 0:00 0 - -Rule Morocco 1950 only - Jun 11 0:00 1:00 S +Rule Morocco 1950 only - Jun 11 0:00 1:00 - Rule Morocco 1950 only - Oct 29 0:00 0 - -Rule Morocco 1967 only - Jun 3 12:00 1:00 S +Rule Morocco 1967 only - Jun 3 12:00 1:00 - Rule Morocco 1967 only - Oct 1 0:00 0 - -Rule Morocco 1974 only - Jun 24 0:00 1:00 S +Rule Morocco 1974 only - Jun 24 0:00 1:00 - Rule Morocco 1974 only - Sep 1 0:00 0 - -Rule Morocco 1976 1977 - May 1 0:00 1:00 S +Rule Morocco 1976 1977 - May 1 0:00 1:00 - Rule Morocco 1976 only - Aug 1 0:00 0 - Rule Morocco 1977 only - Sep 28 0:00 0 - -Rule Morocco 1978 only - Jun 1 0:00 1:00 S +Rule Morocco 1978 only - Jun 1 0:00 1:00 - Rule Morocco 1978 only - Aug 4 0:00 0 - -Rule Morocco 2008 only - Jun 1 0:00 1:00 S +Rule Morocco 2008 only - Jun 1 0:00 1:00 - Rule Morocco 2008 only - Sep 1 0:00 0 - -Rule Morocco 2009 only - Jun 1 0:00 1:00 S +Rule Morocco 2009 only - Jun 1 0:00 1:00 - Rule Morocco 2009 only - Aug 21 0:00 0 - -Rule Morocco 2010 only - May 2 0:00 1:00 S +Rule Morocco 2010 only - May 2 0:00 1:00 - Rule Morocco 2010 only - Aug 8 0:00 0 - -Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Apr 3 0:00 1:00 - Rule Morocco 2011 only - Jul 31 0:00 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 - Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Aug 20 2:00 1:00 - Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S +Rule Morocco 2013 only - Aug 10 2:00 1:00 - +Rule Morocco 2013 2018 - Oct lastSun 3:00 0 - +Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 - Rule Morocco 2014 only - Jun 28 3:00 0 - -Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2014 only - Aug 2 2:00 1:00 - Rule Morocco 2015 only - Jun 14 3:00 0 - -Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2015 only - Jul 19 2:00 1:00 - Rule Morocco 2016 only - Jun 5 3:00 0 - -Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2016 only - Jul 10 2:00 1:00 - Rule Morocco 2017 only - May 21 3:00 0 - -Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2017 only - Jul 2 2:00 1:00 - Rule Morocco 2018 only - May 13 3:00 0 - -Rule Morocco 2018 only - Jun 17 2:00 1:00 S -Rule Morocco 2019 only - May 5 3:00 0 - -Rule Morocco 2019 only - Jun 9 2:00 1:00 S -Rule Morocco 2020 only - Apr 19 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 11 3:00 0 - -Rule Morocco 2021 only - May 16 2:00 1:00 S -Rule Morocco 2022 only - May 8 2:00 1:00 S -Rule Morocco 2023 only - Apr 23 2:00 1:00 S -Rule Morocco 2024 only - Apr 14 2:00 1:00 S -Rule Morocco 2025 only - Apr 6 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 19 3:00 0 - -Rule Morocco 2037 only - Oct 4 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco WE%sT 1984 Mar 16 - 1:00 - CET 1986 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 1984 Mar 16 + 1:00 - +01 1986 + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Western Sahara # @@ -958,7 +936,8 @@ Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún -1:00 - -01 1976 Apr 14 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Mozambique # diff -Nru openjdk-lts-11~28/make/data/tzdata/antarctica openjdk-lts-11.0.2+9/make/data/tzdata/antarctica --- openjdk-lts-11~28/make/data/tzdata/antarctica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/antarctica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Antarctica and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/make/data/tzdata/asia openjdk-lts-11.0.2+9/make/data/tzdata/asia --- openjdk-lts-11~28/make/data/tzdata/asia 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/asia 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Asia and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -29,7 +31,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2017-01-13): +# From Paul Eggert (2018-06-19): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -58,7 +60,8 @@ # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). # -# The following alphabetic abbreviations appear in these tables: +# The following alphabetic abbreviations appear in these tables +# (corrections are welcome): # std dst # LMT Local Mean Time # 2:00 EET EEST Eastern European Time @@ -67,11 +70,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China +# 8:00 PST PDT* Philippine Standard Time # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time +# *I invented the abbreviation PDT; see "Philippines" below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -304,6 +309,29 @@ # China +# From Paul Eggert (2018-10-02): +# The following comes from Table 1 of: +# Li Yu. Research on the daylight saving movement in 1940s Shanghai. +# Nanjing Journal of Social Sciences. 2014;(2):144-50. +# http://oversea.cnki.net/kns55/detail.aspx?dbname=CJFD2014&filename=NJSH201402020 +# The table lists dates only; I am guessing 00:00 and 24:00 transition times. +# Also, the table lists the planned end of DST in 1949, but the corresponding +# zone line cuts this off on May 28, when the Communists took power. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Shang 1940 only - Jun 1 0:00 1:00 D +Rule Shang 1940 only - Oct 12 24:00 0 S +Rule Shang 1941 only - Mar 15 0:00 1:00 D +Rule Shang 1941 only - Nov 1 24:00 0 S +Rule Shang 1942 only - Jan 31 0:00 1:00 D +Rule Shang 1945 only - Sep 1 24:00 0 S +Rule Shang 1946 only - May 15 0:00 1:00 D +Rule Shang 1946 only - Sep 30 24:00 0 S +Rule Shang 1947 only - Apr 15 0:00 1:00 D +Rule Shang 1947 only - Oct 31 24:00 0 S +Rule Shang 1948 1949 - May 1 0:00 1:00 D +Rule Shang 1948 1949 - Sep 30 24:00 0 S #plan + # From Guy Harris: # People's Republic of China. Yes, they really have only one time zone. @@ -330,18 +358,33 @@ # time - sort of", Los Angeles Times, 1986-05-05 ... [says] that China began # observing daylight saving time in 1986. -# From Paul Eggert (2014-06-30): -# Shanks & Pottenger have China switching to a single time zone in 1980, but -# this doesn't seem to be correct. They also write that China observed summer -# DST from 1986 through 1991, which seems to match the above commentary, so -# go with them for DST rules as follows: -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Shang 1940 only - Jun 3 0:00 1:00 D -Rule Shang 1940 1941 - Oct 1 0:00 0 S -Rule Shang 1941 only - Mar 16 0:00 1:00 D -Rule PRC 1986 only - May 4 0:00 1:00 D -Rule PRC 1986 1991 - Sep Sun>=11 0:00 0 S -Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D +# From P Chan (2018-05-07): +# The start and end time of DST in China [from 1986 on] should be 2:00 +# (i.e. 2:00 to 3:00 at the start and 2:00 to 1:00 at the end).... +# Government notices about summer time: +# +# 1986-04-12 http://www.zj.gov.cn/attach/zfgb/198608.pdf p.21-22 +# (To establish summer time from 1986. On 4 May, set the clocks ahead one hour +# at 2 am. On 14 September, set the clocks backward one hour at 2 am.) +# +# 1987-02-15 http://www.gov.cn/gongbao/shuju/1987/gwyb198703.pdf p.114 +# (Summer time in 1987 to start from 12 April until 13 September) +# +# 1987-09-09 http://www.gov.cn/gongbao/shuju/1987/gwyb198721.pdf p.709 +# (From 1988, summer time to start from 2 am of the first Sunday of mid-April +# until 2 am of the first Sunday of mid-September) +# +# 1992-03-03 http://www.gov.cn/gongbao/shuju/1992/gwyb199205.pdf p.152 +# (To suspend summer time from 1992) +# +# The first page of People's Daily on 12 April 1988 stating that summer time +# to begin on 17 April. +# http://data.people.com.cn/pic/101p/1988/04/1988041201.jpg + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule PRC 1986 only - May 4 2:00 1:00 D +Rule PRC 1986 1991 - Sep Sun>=11 2:00 0 S +Rule PRC 1987 1991 - Apr Sun>=11 2:00 1:00 D # From Anthony Fok (2001-12-20): # BTW, I did some research on-line and found some info regarding these five @@ -363,10 +406,11 @@ # Alois Treindl kindly sent me translations of the following two sources: # # (1) -# Guo Qingsheng (National Time-Service Center, CAS, Xi'an 710600, China) +# Guo Qing-sheng (National Time-Service Center, CAS, Xi'an 710600, China) # Beijing Time at the Beginning of the PRC # China Historical Materials of Science and Technology -# (Zhongguo ke ji shi liao, 中国科技史料), Vol. 24, No. 1 (2003) +# (Zhongguo ke ji shi liao, 中国科技史料). 2003;24(1):5-9. +# http://oversea.cnki.net/kcms/detail/detail.aspx?filename=ZGKS200301000&dbname=CJFD2003 # It gives evidence that at the beginning of the PRC, Beijing time was # officially apparent solar time! However, Guo also says that the # evidence is dubious, as the relevant institute of astronomy had not @@ -543,7 +587,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Beijing time, used throughout China; represented by Shanghai. Zone Asia/Shanghai 8:05:43 - LMT 1901 - 8:00 Shang C%sT 1949 + 8:00 Shang C%sT 1949 May 28 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) @@ -772,24 +816,140 @@ 8:00 Taiwan C%sT # Macau (Macao, Aomen) -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 D -Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 S -Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 D -Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 D -Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 D -Rule Macau 1965 only - Oct 31 0:00 0 S -Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 D -Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 S -Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 D -Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 S -Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S -Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D -Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D -Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S -# See Europe/Lisbon for info about the 1912 transition. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u +# +# From P Chan (2018-05-10): +# * LegisMac +# http://legismac.safp.gov.mo/legismac/descqry/Descqry.jsf?lang=pt +# A database for searching titles of legal documents of Macau in +# Chinese and Portuguese. The term "HORÁRIO DE VERÃO" can be used for +# searching decrees about summer time. +# * Archives of Macao +# http://www.archives.gov.mo/en/bo/ +# It contains images of old official gazettes. +# * The Macao Meteorological and Geophysical Bureau have a page listing the +# summer time history. But it is not complete and has some mistakes. +# http://www.smg.gov.mo/smg/geophysics/e_t_Summer%20Time.htm +# Macau adopted GMT+8 on 30 Oct 1904 to follow Hong Kong. Clocks were +# advanced by 25 minutes and 50 seconds. Which means the LMT used was +# +7:34:10. As stated in the "Portaria No. 204" dated 21 October 1904 +# and published in the Official Gazette on 29 October 1904. +# http://igallery.icm.gov.mo/Images/Archives/BO/MO_AH_PUB_BO_1904_10/MO_AH_PUB_BO_1904_10_00025_Grey.JPG +# +# Therefore the 1911 decree of Portugal did not change time in Macau. +# +# From LegisMac, here is a list of decrees that changed the time ... +# [Decree Gazette-no. date; titles omitted in this quotation] +# DIL 732 BOCM 51 1941.12.20 +# DIL 764 BOCM 9S 1942.04.30 +# DIL 781 BOCM 21 1942.10.10 +# PT 3434 BOCM 8S 1943.04.17 +# PT 3504 BOCM 20 1943.09.25 +# PT 3843 BOCM 39 1945.09.29 +# PT 3961 BOCM 17 1946.04.27 +# PT 4026 BOCM 39 1946.09.28 +# PT 4153 BOCM 16 1947.04.10 +# PT 4271 BOCM 48 1947.11.29 +# PT 4374 BOCM 18 1948.05.01 +# PT 4465 BOCM 44 1948.10.30 +# PT 4590 BOCM 14 1949.04.02 +# PT 4666 BOCM 44 1949.10.29 +# PT 4771 BOCM 12 1950.03.25 +# PT 4838 BOCM 43 1950.10.28 +# PT 4946 BOCM 12 1951.03.24 +# PT 5025 BO 43 1951.10.27 +# PT 5149 BO 14 1952.04.05 +# PT 5251 BO 43 1952.10.25 +# PT 5366 BO 13 1953.03.28 +# PT 5444 BO 44 1953.10.31 +# PT 5540 BO 12 1954.03.20 +# PT 5589 BO 44 1954.10.30 +# PT 5676 BO 12 1955.03.19 +# PT 5739 BO 45 1955.11.05 +# PT 5823 BO 11 1956.03.17 +# PT 5891 BO 44 1956.11.03 +# PT 5981 BO 12 1957.03.23 +# PT 6064 BO 43 1957.10.26 +# PT 6172 BO 12 1958.03.22 +# PT 6243 BO 43 1958.10.25 +# PT 6341 BO 12 1959.03.21 +# PT 6411 BO 43 1959.10.24 +# PT 6514 BO 11 1960.03.12 +# PT 6584 BO 44 1960.10.29 +# PT 6721 BO 10 1961.03.11 +# PT 6815 BO 43 1961.10.28 +# PT 6947 BO 10 1962.03.10 +# PT 7080 BO 43 1962.10.27 +# PT 7218 BO 12 1963.03.23 +# PT 7340 BO 43 1963.10.26 +# PT 7491 BO 11 1964.03.14 +# PT 7664 BO 43 1964.10.24 +# PT 7846 BO 15 1965.04.10 +# PT 7979 BO 42 1965.10.16 +# PT 8146 BO 15 1966.04.09 +# PT 8252 BO 41 1966.10.08 +# PT 8429 BO 15 1967.04.15 +# PT 8540 BO 41 1967.10.14 +# PT 8735 BO 15 1968.04.13 +# PT 8860 BO 41 1968.10.12 +# PT 9035 BO 16 1969.04.19 +# PT 9156 BO 42 1969.10.18 +# PT 9328 BO 15 1970.04.11 +# PT 9418 BO 41 1970.10.10 +# PT 9587 BO 14 1971.04.03 +# PT 9702 BO 41 1971.10.09 +# PT 38-A/72 BO 14 1972.04.01 +# PT 126-A/72 BO 41 1972.10.07 +# PT 61/73 BO 14 1973.04.07 +# PT 182/73 BO 40 1973.10.06 +# PT 282/73 BO 51 1973.12.22 +# PT 177/74 BO 41 1974.10.12 +# PT 51/75 BO 15 1975.04.12 +# PT 173/75 BO 41 1975.10.11 +# PT 67/76/M BO 14 1976.04.03 +# PT 169/76/M BO 41 1976.10.09 +# PT 78/79/M BO 19 1979.05.12 +# PT 166/79/M BO 42 1979.10.20 +# Note that DIL 732 does not belong to "HORÁRIO DE VERÃO" according to +# LegisMac.... Note that between 1942 and 1945, the time switched +# between GMT+9 and GMT+10. Also in 1965 and 1965 the DST ended at 2:30am. + +# From Paul Eggert (2018-05-10): +# The 1904 decree says that Macau changed from the meridian of +# Fortaleza do Monte, presumably the basis for the 7:34:10 for LMT. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Macau 1942 1943 - Apr 30 23:00 1:00 - +Rule Macau 1942 only - Nov 17 23:00 0 - +Rule Macau 1943 only - Sep 30 23:00 0 S +Rule Macau 1946 only - Apr 30 23:00s 1:00 D +Rule Macau 1946 only - Sep 30 23:00s 0 S +Rule Macau 1947 only - Apr 19 23:00s 1:00 D +Rule Macau 1947 only - Nov 30 23:00s 0 S +Rule Macau 1948 only - May 2 23:00s 1:00 D +Rule Macau 1948 only - Oct 31 23:00s 0 S +Rule Macau 1949 1950 - Apr Sat>=1 23:00s 1:00 D +Rule Macau 1949 1950 - Oct lastSat 23:00s 0 S +Rule Macau 1951 only - Mar 31 23:00s 1:00 D +Rule Macau 1951 only - Oct 28 23:00s 0 S +Rule Macau 1952 1953 - Apr Sat>=1 23:00s 1:00 D +Rule Macau 1952 only - Nov 1 23:00s 0 S +Rule Macau 1953 1954 - Oct lastSat 23:00s 0 S +Rule Macau 1954 1956 - Mar Sat>=17 23:00s 1:00 D +Rule Macau 1955 only - Nov 5 23:00s 0 S +Rule Macau 1956 1964 - Nov Sun>=1 03:30 0 S +Rule Macau 1957 1964 - Mar Sun>=18 03:30 1:00 D +Rule Macau 1965 1973 - Apr Sun>=16 03:30 1:00 D +Rule Macau 1965 1966 - Oct Sun>=16 02:30 0 S +Rule Macau 1967 1976 - Oct Sun>=16 03:30 0 S +Rule Macau 1973 only - Dec 30 03:30 1:00 D +Rule Macau 1975 1976 - Apr Sun>=16 03:30 1:00 D +Rule Macau 1979 only - May 13 03:30 1:00 D +Rule Macau 1979 only - Oct Sun>=16 03:30 0 S + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Macau 7:34:10 - LMT 1904 Oct 30 + 8:00 - CST 1941 Dec 21 23:00 + 9:00 Macau +09/+10 1945 Sep 30 24:00 8:00 Macau C%sT @@ -1494,9 +1654,29 @@ # http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm # ... In summary, it is written as follows. From 24:00 on the first Saturday # in May, until 0:00 on the day after the second Saturday in September. + +# From Phake Nick (2018-09-27): +# [T]he webpage authored by National Astronomical Observatory of Japan +# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EF.html +# ... mentioned that using Showa 23 (year 1948) as example, 13pm of September +# 11 in summer time will equal to 0am of September 12 in standard time. +# It cited a document issued by the Liaison Office which briefly existed +# during the postwar period of Japan, where the detail on implementation +# of the summer time is described in the document. +# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EFB2C6BBFEB9EFA4CEBCC2BBDCA4CBA4C4A4A4A4C6.pdf +# The text in the document do instruct a fall back to occur at +# September 11, 13pm in summer time, while ordinary citizens can +# change the clock before they sleep. +# +# From Paul Eggert (2018-09-27): +# This instruction is equivalent to "Sat>=8 25:00", so use that. zic treats +# it like "Sun>=9 01:00", which is not quite the same but is the best we can +# do in any POSIX or C platform. The "25:00" assumes zic from 2007 or later, +# which should be safe now. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Japan 1948 only - May Sat>=1 24:00 1:00 D -Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D @@ -1878,7 +2058,7 @@ 5:00 - +05 # Mangghystaū (KZ-MAN) # Aqtau was not founded until 1963, but it represents an inhabited region, -# so include time stamps before 1963. +# so include timestamps before 1963. Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 5:00 - +05 1981 Oct 1 @@ -2018,6 +2198,10 @@ # Assembly, as published in Rodong Sinmun. # From Tim Parenti (2018-04-29): # It appears to be the front page story at the top in the right-most column. +# +# From Paul Eggert (2018-05-04): +# The BBC reported that the transition was from 23:30 to 24:00 today. +# https://www.bbc.com/news/world-asia-44010705 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 @@ -2030,7 +2214,7 @@ 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Aug 24 9:00 - KST 2015 Aug 15 00:00 - 8:30 - KST 2018 May 5 + 8:30 - KST 2018 May 4 23:30 9:00 - KST ############################################################################### @@ -2780,19 +2964,35 @@ # Philippine Star 2014-08-05 # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 - -Rule Phil 1937 only - Feb 1 0:00 0 - -Rule Phil 1954 only - Apr 12 0:00 1:00 - -Rule Phil 1954 only - Jul 1 0:00 0 - -Rule Phil 1978 only - Mar 22 0:00 1:00 - -Rule Phil 1978 only - Sep 21 0:00 0 - +# From Paul Goyette (2018-06-15): +# In the Philippines, there is a national law, Republic Act No. 10535 +# which declares the official time here as "Philippine Standard Time". +# The act [1] even specifies use of PST as the abbreviation, although +# the FAQ provided by PAGASA [2] uses the "acronym PhST to distinguish +# it from the Pacific Standard Time (PST)." +# [1] http://www.officialgazette.gov.ph/2013/05/15/republic-act-no-10535/ +# [2] https://www1.pagasa.dost.gov.ph/index.php/astronomy/philippine-standard-time#republic-act-10535 +# +# From Paul Eggert (2018-06-19): +# I surveyed recent news reports, and my impression is that "PST" is +# more popular among reliable English-language news sources. This is +# not just a measure of Google hit counts: it's also the sizes and +# influence of the sources. There is no current abbreviation for DST, +# so use "PDT", the usual American style. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Phil 1936 only - Nov 1 0:00 1:00 D +Rule Phil 1937 only - Feb 1 0:00 0 S +Rule Phil 1954 only - Apr 12 0:00 1:00 D +Rule Phil 1954 only - Jul 1 0:00 0 S +Rule Phil 1978 only - Mar 22 0:00 1:00 D +Rule Phil 1978 only - Sep 21 0:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 8:04:00 - LMT 1899 May 11 - 8:00 Phil +08/+09 1942 May - 9:00 - +09 1944 Nov - 8:00 Phil +08/+09 + 8:00 Phil P%sT 1942 May + 9:00 - JST 1944 Nov + 8:00 Phil P%sT # Qatar # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2803,15 +3003,34 @@ # Saudi Arabia # -# From Paul Eggert (2014-07-15): +# From Paul Eggert (2018-08-29): # Time in Saudi Arabia and other countries in the Arabian peninsula was not -# standardized until relatively recently; we don't know when, and possibly it +# standardized until 1968 or so; we don't know exactly when, and possibly it # has never been made official. Richard P Hunt, in "Islam city yielding to # modern times", New York Times (1961-04-09), p 20, wrote that only airlines # observed standard time, and that people in Jeddah mostly observed quasi-solar # time, doing so by setting their watches at sunrise to 6 o'clock (or to 12 # o'clock for "Arab" time). # +# Timekeeping differed depending on who you were and which part of Saudi +# Arabia you were in. In 1969, Elias Antar wrote that although a common +# practice had been to set one's watch to 12:00 (i.e., midnight) at sunset - +# which meant that the time on one side of a mountain could differ greatly from +# the time on the other side - many foreigners set their watches to 6pm +# instead, while airlines instead used UTC +03 (except in Dhahran, where they +# used UTC +04), Aramco used UTC +03 with DST, and the Trans-Arabian Pipe Line +# Company used Aramco time in eastern Saudi Arabia and airline time in western. +# (The American Military Aid Advisory Group used plain UTC.) Antar writes, +# "A man named Higgins, so the story goes, used to run a local power +# station. One day, the whole thing became too much for Higgins and he +# assembled his staff and laid down the law. 'I've had enough of this,' he +# shrieked. 'It is now 12 o'clock Higgins Time, and from now on this station is +# going to run on Higgins Time.' And so, until last year, it did." See: +# Antar E. Dinner at When? Saudi Aramco World, 1969 March/April. 2-3. +# http://archive.aramcoworld.com/issue/196902/dinner.at.when.htm +# newspapers.com says a similar story about Higgins was published in the Port +# Angeles (WA) Evening News, 1965-03-10, page 5, but I lack access to the text. +# # The TZ database cannot represent quasi-solar time; airline time is the best # we can do. The 1946 foreign air news digest of the U.S. Civil Aeronautics # Board (OCLC 42299995) reported that the "... Arabian Government, inaugurated @@ -2821,7 +3040,8 @@ # # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two # time zones; the other zone, at UT +04, was in the far eastern part of -# the country. Ignore this, as it's before our 1970 cutoff. +# the country. Presumably this is documenting airline time. Ignore this, +# as it's before our 1970 cutoff. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 diff -Nru openjdk-lts-11~28/make/data/tzdata/australasia openjdk-lts-11.0.2+9/make/data/tzdata/australasia --- openjdk-lts-11~28/make/data/tzdata/australasia 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/australasia 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Australasia and environs, and for much of the Pacific + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -384,8 +386,15 @@ # Dominic Fok writes (2017-08-20) that DST ends 2018-01-14, citing # Extraordinary Government of Fiji Gazette Supplement No. 21 (2017-08-27), # [Legal Notice No. 41] of an order of the previous day by J Usamate. + +# From Raymond Kumar (2018-07-13): +# http://www.fijitimes.com/government-approves-2018-daylight-saving/ +# ... The daylight saving period will end at 3am on Sunday January 13, 2019. +# +# From Paul Eggert (2018-07-15): # For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 14. Although ad hoc, it matches +# the first Sunday on or after January 13. January transitions reportedly +# depend on when school terms start. Although the guess is ad hoc, it matches # transitions since late 2014 and seems more likely to match future # practice than guessing no DST. @@ -399,7 +408,7 @@ Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=14 3:00 0 - +Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff -Nru openjdk-lts-11~28/make/data/tzdata/backward openjdk-lts-11.0.2+9/make/data/tzdata/backward --- openjdk-lts-11~28/make/data/tzdata/backward 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/backward 2019-01-18 04:23:48.000000000 +0000 @@ -21,10 +21,12 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb links for backward compatibility + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# This file provides links between current names for time zones +# This file provides links between current names for timezones # and their old names. Many names changed in late 1993. # Link TARGET LINK-NAME diff -Nru openjdk-lts-11~28/make/data/tzdata/etcetera openjdk-lts-11.0.2+9/make/data/tzdata/etcetera --- openjdk-lts-11~28/make/data/tzdata/etcetera 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/etcetera 2019-01-18 04:23:48.000000000 +0000 @@ -21,12 +21,14 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for ships at sea and other miscellany + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # These entries are mostly present for historical reasons, so that # people in areas not otherwise covered by the tz files could "zic -l" -# to a time zone that was right for their area. These days, the +# to a timezone that was right for their area. These days, the # tz files cover almost all the inhabited world, and the only practical # need now for the entries that are not on UTC are for ships at sea # that cannot use POSIX TZ settings. diff -Nru openjdk-lts-11~28/make/data/tzdata/europe openjdk-lts-11.0.2+9/make/data/tzdata/europe --- openjdk-lts-11~28/make/data/tzdata/europe 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/europe 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Europe and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -540,7 +542,7 @@ # # To work around this problem, the build procedure can translate the # following data into two forms, one with negative SAVE values and the -# other form with a traditional approximation for Irish time stamps +# other form with a traditional approximation for Irish timestamps # after 1971-10-31 02:00 UTC; although this approximation has tm_isdst # flags that are reversed, its UTC offsets are correct and this often # suffices. This source file currently uses only nonnegative SAVE @@ -2450,6 +2452,33 @@ # administratively part of Sakhalin oblast', they appear to have # remained on UTC+11 along with Magadan. +# From Marat Nigametzianov (2018-07-16): +# this is link to order from 1956 about timezone in USSR +# http://astro.uni-altai.ru/~orion/blog/2011/11/novyie-granitsyi-chasovyih-poyasov-v-sssr/ +# +# From Paul Eggert (2018-07-16): +# Perhaps someone could translate the above-mentioned link and use it +# to correct our data for the ex-Soviet Union. It cites the following: +# «Поясное время и новые границы часовых поясов» / сост. П.Н. Долгов, +# отв. ред. Г.Д. Бурдун - М: Комитет стандартов, мер и измерительных +# приборов при Совете Министров СССР, Междуведомственная комиссия +# единой службы времени, 1956 г. +# This book looks like it would be a helpful resource for the Soviet +# Union through 1956. Although a copy was in the Scientific Library +# of Tomsk State University, I have not been able to track down a copy nearby. +# +# From Stepan Golosunov (2018-07-21): +# http://astro.uni-altai.ru/~orion/blog/2015/05/center-reforma-ischisleniya-vremeni-br-na-territorii-sssr-v-1957-godu-center/ +# says that the 1956 decision to change time belts' borders was not +# implemented as planned in 1956 and the change happened in 1957. +# There is also the problem that actual time zones were different from +# the official time belts (and from many time belts' maps) as there were +# numerous exceptions to application of time belt rules. For example, +# https://ru.wikipedia.org/wiki/Московское_время#Перемещение_границы_применения_московского_времени_на_восток +# says that by 1962 there were many regions in the 3rd time belt that +# were on Moscow time, referring to a 1962 map. By 1989 number of such +# exceptions grew considerably. + # From Tim Parenti (2014-07-06): # The comments detailing the coverage of each Russian zone are meant to assist # with maintenance only and represent our best guesses as to which regions @@ -2460,9 +2489,6 @@ # future stability. ISO 3166-2:RU codes are also listed for first-level # divisions where available. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] - - # From Tim Parenti (2014-07-03): # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast @@ -2730,6 +2756,15 @@ # 34 RU-VGG Volgograd Oblast # The 1988 transition is from USSR act No. 5 (1988-01-04). +# From Alexander Fetisov (2018-09-20): +# Volgograd region in southern Russia (Europe/Volgograd) change +# timezone from UTC+3 to UTC+4 from 28oct2018. +# http://sozd.parliament.gov.ru/bill/452878-7 +# +# From Stepan Golosunov (2018-10-11): +# The law has been published today on +# http://publication.pravo.gov.ru/Document/View/0001201810110037 + Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 3:00 - +03 1930 Jun 21 4:00 - +04 1961 Nov 11 @@ -2738,7 +2773,8 @@ 4:00 - +04 1992 Mar 29 2:00s 3:00 Russia +03/+04 2011 Mar 27 2:00s 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 + 3:00 - +03 2018 Oct 28 2:00s + 4:00 - +04 # From Paul Eggert (2016-11-11): # Europe/Saratov covers: @@ -3427,7 +3463,8 @@ #Rule NatSpain 1937 only - May 22 23:00 1:00 S #Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - #Rule NatSpain 1938 only - Mar 26 23:00 1:00 S -# The following rules are copied from Morocco from 1967 through 1978. +# The following rules are copied from Morocco from 1967 through 1978, +# except with "S" letters. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S @@ -3447,6 +3484,7 @@ 0:00 1:00 WEST 1918 Oct 7 23:00 0:00 - WET 1924 0:00 Spain WE%sT 1929 + 0:00 - WET 1967 # Help zishrink.awk. 0:00 SpainAfrica WE%sT 1984 Mar 16 1:00 - CET 1986 1:00 EU CE%sT @@ -3632,7 +3670,7 @@ # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): -# Prefer the above sources to Shanks & Pottenger for time stamps after 1985. +# Prefer the above sources to Shanks & Pottenger for timestamps after 1985. # From Steffen Thorsen (2007-03-09): # Starting 2007 though, it seems that they are adopting EU's 1:00 UTC @@ -3842,10 +3880,29 @@ # * Ukrainian Government's Resolution of 20.03.1992, No. 139. # http://www.uazakon.com/documents/date_8u/pg_grcasa.htm +# From Paul Eggert (2018-10-03): +# As is usual in tzdb, Ukrainian zones use the most common English spellings. +# For example, tzdb uses Europe/Kiev, as "Kiev" is the most common spelling in +# English for Ukraine's capital, even though it is certainly wrong as a +# transliteration of the Ukrainian "Київ". This is similar to tzdb's use of +# Europe/Prague, which is certainly wrong as a transliteration of the Czech +# "Praha". ("Kiev" came from old Slavic via Russian to English, and "Prague" +# came from old Slavic via French to English, so the two cases have something +# in common.) Admittedly English-language spelling of Ukrainian names is +# controversial, and some day "Kyiv" may become substantially more popular in +# English; in the meantime, stick with the traditional English "Kiev" as that +# means less disruption for our users. +# +# Anyway, none of the common English-language spellings (Kiev, Kyiv, Kieff, +# Kijeff, Kijev, Kiyef, Kiyeff) do justice to the common pronunciation in +# Ukrainian, namely [ˈkɪjiu̯] (IPA). This pronunciation has nothing like an +# English "v" or "f", and instead trails off with what an English-speaker +# would call a demure "oo" sound, and it would would be better anglicized as +# "Kuiyu". Here's a sound file, if you would like to do as the Kuiyuvians do: +# https://commons.wikimedia.org/wiki/File:Uk-Київ.ogg + # Zone NAME GMTOFF RULES FORMAT [UNTIL] -# Most of Ukraine since 1970 has been like Kiev. -# "Kyiv" is the transliteration of the Ukrainian name, but -# "Kiev" is more common in English. +# This represents most of Ukraine. See above for the spelling of "Kiev". Zone Europe/Kiev 2:02:04 - LMT 1880 2:02:04 - KMT 1924 May 2 # Kiev Mean Time 2:00 - EET 1930 Jun 21 diff -Nru openjdk-lts-11~28/make/data/tzdata/factory openjdk-lts-11.0.2+9/make/data/tzdata/factory --- openjdk-lts-11~28/make/data/tzdata/factory 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/factory 2019-01-18 04:23:48.000000000 +0000 @@ -21,11 +21,13 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for noncommittal factory settings + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# For distributors who don't want to put time zone specification in -# their installation procedures. Users that run 'date' will get the +# For distributors who don't want to specify a timezone in their +# installation procedures. Users who run 'date' will get the # time zone abbreviation "-00", indicating that the actual time zone # is unknown. diff -Nru openjdk-lts-11~28/make/data/tzdata/leapseconds openjdk-lts-11.0.2+9/make/data/tzdata/leapseconds --- openjdk-lts-11~28/make/data/tzdata/leapseconds 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/leapseconds 2019-01-18 04:23:48.000000000 +0000 @@ -26,21 +26,25 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which is copied from: -# ftp://ftp.nist.gov/pub/time/leap-seconds.list +# leap-seconds.list file, which can be copied from +# +# or +# or . # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds -# https://www.eecis.udel.edu/~mills/leap.html +# . # The International Earth Rotation and Reference Systems Service # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space); see -# Levine J. Coordinated Universal Time and the leap second. +# (which measures the true angular orientation of the earth in space) +# and publishes leap second data in a copyrighted file +# . +# See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 -# http://ieeexplore.ieee.org/document/7909995/ +# . # There were no leap seconds before 1972, because the official mechanism # accounting for the discrepancy between atomic time and the earth's rotation -# did not exist until the early 1970s. +# did not exist. # The correction (+ or -) is made at the given time, so lines # will typically look like: @@ -48,10 +52,7 @@ # or # Leap YEAR MON DAY 23:59:59 - R/S -# If the leapsecond is Rolling (R) the given time is local time. -# If the leapsecond is Stationary (S) the given time is UTC. - -# Leap YEAR MONTH DAY HH:MM:SS CORR R/S +# If the leap second is Rolling (R) the given time is local time (unused here). Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -80,5 +81,9 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S -# Updated through IERS Bulletin C55 -# File expires on: 28 December 2018 +# POSIX timestamps for the data in this file: +#updated 1467936000 +#expires 1561680000 + +# Updated through IERS Bulletin C56 +# File expires on: 28 June 2019 diff -Nru openjdk-lts-11~28/make/data/tzdata/northamerica openjdk-lts-11.0.2+9/make/data/tzdata/northamerica --- openjdk-lts-11~28/make/data/tzdata/northamerica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/northamerica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for North and Central America and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -71,7 +73,7 @@ # # Most of the US soon followed suit. See: # Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56. -# http://dx.doi.org/10.2307/3105430 +# https://dx.doi.org/10.2307/3105430 # From Paul Eggert (2005-04-16): # That 1883 transition occurred at 12:00 new time, not at 12:00 old time. @@ -460,6 +462,19 @@ # western South Dakota, far western Texas (El Paso County, Hudspeth County, # and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming # +# From Paul Eggert (2018-10-25): +# On 1921-03-04 federal law placed all of Texas into the central time zone. +# However, El Paso ignored the law for decades and continued to observe +# mountain time, on the grounds that that's what they had always done +# and they weren't about to let the federal government tell them what to do. +# Eventually the federal government gave in and changed the law on +# 1970-04-10 to match what El Paso was actually doing. Although +# that's slightly after our 1970 cutoff, there is no need to create a +# separate zone for El Paso since they were ignoring the law anyway. See: +# Long T. El Pasoans were time rebels, fought to stay in Mountain zone. +# El Paso Times. 2018-10-24 06:40 -06. +# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/ +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D Rule Denver 1920 only - Oct lastSun 2:00 0 S @@ -729,9 +744,7 @@ Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 - -10:30 - HST 1942 Feb 9 2:00 - -10:30 1:00 HDT 1945 Sep 30 2:00 - -10:30 - HST 1947 Jun 8 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. diff -Nru openjdk-lts-11~28/make/data/tzdata/pacificnew openjdk-lts-11.0.2+9/make/data/tzdata/pacificnew --- openjdk-lts-11~28/make/data/tzdata/pacificnew 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/pacificnew 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for proposed US election time (this file is obsolete) + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/make/data/tzdata/southamerica openjdk-lts-11.0.2+9/make/data/tzdata/southamerica --- openjdk-lts-11~28/make/data/tzdata/southamerica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/southamerica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for South America and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -415,7 +417,7 @@ # standard time, so let's do that here too. This does not change UTC # offsets, only tm_isdst and the time zone abbreviations. One minor # plus is that this silences a zic complaint that there's no POSIX TZ -# setting for time stamps past 2038. +# setting for timestamps past 2038. # Zone NAME GMTOFF RULES FORMAT [UNTIL] # @@ -948,6 +950,14 @@ # ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html # From Steffen Thorsen (2017-12-20): # http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm +# +# From Fábio Gomes (2018-10-04): +# The Brazilian president just announced a new change on this year DST. +# It was scheduled to start on November 4th and it was changed to November 18th. +# From Rodrigo Brüning Wessler (2018-10-15): +# The Brazilian government just announced that the change in DST was +# canceled.... Maybe the president Michel Temer also woke up one hour +# earlier today. :) Rule Brazil 2018 max - Nov Sun>=1 0:00 1:00 - Rule Brazil 2023 only - Feb Sun>=22 0:00 0 - Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 - @@ -1254,6 +1264,24 @@ # they will switch from -03 to -04 one hour after Santiago does that day. # For now, assume that they will not revert. +# From Juan Correa (2018-08-13): +# As of moments ago, the Ministry of Energy in Chile has announced the new +# schema for DST. ... Announcement in video (in Spanish): +# https://twitter.com/MinEnergia/status/1029000399129374720 +# From Yonathan Dossow (2018-08-13): +# The video says "first Saturday of September", we all know it means Sunday at +# midnight. +# From Tim Parenti (2018-08-13): +# Translating the captions on the video at 0:44-0:55, "We want to announce as +# Government that from 2019, Winter Time will be increased to 5 months, between +# the first Saturday of April and the first Saturday of September." +# At 2:08-2:20, "The Magallanes region will maintain its current time, as +# decided by the citizens during 2017, but our Government will promote a +# regional dialogue table to gather their opinion on this matter." +# https://twitter.com/MinEnergia/status/1029009354001973248 +# "We will keep the new time policy unchanged for at least the next 4 years." +# So we extend the new rules on Saturdays at 24:00 mainland time indefinitely. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Chile 1927 1931 - Sep 1 0:00 1:00 - Rule Chile 1928 1932 - Apr 1 0:00 0 - @@ -1287,8 +1315,10 @@ Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 - Rule Chile 2012 2014 - Apr Sun>=23 3:00u 0 - Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 - -Rule Chile 2016 max - May Sun>=9 3:00u 0 - -Rule Chile 2016 max - Aug Sun>=9 4:00u 1:00 - +Rule Chile 2016 2018 - May Sun>=9 3:00u 0 - +Rule Chile 2016 2018 - Aug Sun>=9 4:00u 1:00 - +Rule Chile 2019 max - Apr Sun>=2 3:00u 0 - +Rule Chile 2019 max - Sep Sun>=2 4:00u 1:00 - # IATA SSIM anomalies: (1992-02) says 1992-03-14; # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] diff -Nru openjdk-lts-11~28/make/data/tzdata/systemv openjdk-lts-11.0.2+9/make/data/tzdata/systemv --- openjdk-lts-11~28/make/data/tzdata/systemv 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/systemv 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for System V rules (this file is obsolete) + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/make/data/tzdata/VERSION openjdk-lts-11.0.2+9/make/data/tzdata/VERSION --- openjdk-lts-11~28/make/data/tzdata/VERSION 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/VERSION 2019-01-18 04:23:48.000000000 +0000 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2018e +tzdata2018g diff -Nru openjdk-lts-11~28/make/data/tzdata/zone.tab openjdk-lts-11.0.2+9/make/data/tzdata/zone.tab --- openjdk-lts-11~28/make/data/tzdata/zone.tab 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/data/tzdata/zone.tab 2019-01-18 04:23:48.000000000 +0000 @@ -21,12 +21,12 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# tz zone descriptions (deprecated version) +# tzdb timezone descriptions (deprecated version) # # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # -# From Paul Eggert (2014-07-31): +# From Paul Eggert (2018-06-27): # This file is intended as a backward-compatibility aid for older programs. # New programs should use zone1970.tab. This file is like zone1970.tab (see # zone1970.tab's comments), but with the following additional restrictions: @@ -35,13 +35,13 @@ # 2. The first data column contains exactly one country code. # # Because of (2), each row stands for an area that is the intersection -# of a region identified by a country code and of a zone where civil +# of a region identified by a country code and of a timezone where civil # clocks have agreed since 1970; this is a narrower definition than # that of zone1970.tab. # -# This table is intended as an aid for users, to help them select time -# zone data entries appropriate for their practical needs. It is not -# intended to take or endorse any position on legal or territorial claims. +# This table is intended as an aid for users, to help them select timezones +# appropriate for their practical needs. It is not intended to take or +# endorse any position on legal or territorial claims. # #country- #code coordinates TZ comments @@ -291,7 +291,7 @@ MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas) MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar -MO +2214+11335 Asia/Macau +MO +221150+1133230 Asia/Macau MP +1512+14545 Pacific/Saipan MQ +1436-06105 America/Martinique MR +1806-01557 Africa/Nouakchott diff -Nru openjdk-lts-11~28/make/hotspot/lib/JvmOverrideFiles.gmk openjdk-lts-11.0.2+9/make/hotspot/lib/JvmOverrideFiles.gmk --- openjdk-lts-11~28/make/hotspot/lib/JvmOverrideFiles.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/hotspot/lib/JvmOverrideFiles.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -30,7 +30,7 @@ # status for individual files on specific platforms. ifeq ($(TOOLCHAIN_TYPE), gcc) - BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0 + BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_CXXFLAGS := -fno-var-tracking-assignments BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized @@ -38,20 +38,26 @@ BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized endif +LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE) +# If the FDLIBM_CFLAGS variable is non-empty we know +# that the fdlibm-fork in hotspot can get optimized +# by using -ffp-contract=off on GCC/Clang platforms. +ifneq ($(FDLIBM_CFLAGS), ) + LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM) +endif + ifeq ($(OPENJDK_TARGET_OS), linux) BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64 BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64 - ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86) - BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE) - BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE) - - ifeq ($(TOOLCHAIN_TYPE), clang) - JVM_PRECOMPILED_HEADER_EXCLUDE := \ - sharedRuntimeTrig.cpp \ - sharedRuntimeTrans.cpp \ - # - endif + BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + + ifeq ($(TOOLCHAIN_TYPE), clang) + JVM_PRECOMPILED_HEADER_EXCLUDE := \ + sharedRuntimeTrig.cpp \ + sharedRuntimeTrans.cpp \ + # endif ifeq ($(OPENJDK_TARGET_CPU), x86) @@ -120,8 +126,8 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx) # The copied fdlibm routines in these files must not be optimized - BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE) - BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE) + BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) + BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG) ifeq ($(TOOLCHAIN_TYPE), clang) # NOTE: The old build tested clang version to make sure this workaround # for the clang bug was still needed. diff -Nru openjdk-lts-11~28/make/lib/CoreLibraries.gmk openjdk-lts-11.0.2+9/make/lib/CoreLibraries.gmk --- openjdk-lts-11~28/make/lib/CoreLibraries.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/lib/CoreLibraries.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -39,20 +39,15 @@ BUILD_LIBFDLIBM_OPTIMIZATION := HIGH endif -ifeq ($(OPENJDK_TARGET_OS), linux) - ifeq ($(OPENJDK_TARGET_CPU), ppc64) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), ppc64le) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), s390x) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - else ifeq ($(OPENJDK_TARGET_CPU), aarch64) - BUILD_LIBFDLIBM_OPTIMIZATION := HIGH - endif +# If FDLIBM_CFLAGS is non-empty we know that we can optimize +# fdlibm when adding those extra C flags. Currently GCC, +# and clang only. +ifneq ($(FDLIBM_CFLAGS), ) + BUILD_LIBFDLIBM_OPTIMIZATION := LOW endif LIBFDLIBM_SRC := $(TOPDIR)/src/java.base/share/native/libfdlibm -LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) +LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) $(FDLIBM_CFLAGS) ifneq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \ @@ -64,11 +59,7 @@ CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \ CFLAGS_windows_debug := -DLOGGING, \ CFLAGS_aix := -qfloat=nomaf, \ - CFLAGS_linux_ppc64 := -ffp-contract=off, \ - CFLAGS_linux_ppc64le := -ffp-contract=off, \ - CFLAGS_linux_s390x := -ffp-contract=off, \ - CFLAGS_linux_aarch64 := -ffp-contract=off, \ - DISABLED_WARNINGS_gcc := sign-compare misleading-indentation, \ + DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \ DISABLED_WARNINGS_microsoft := 4146 4244 4018, \ ARFLAGS := $(ARFLAGS), \ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \ diff -Nru openjdk-lts-11~28/make/lib/Lib-java.base.gmk openjdk-lts-11.0.2+9/make/lib/Lib-java.base.gmk --- openjdk-lts-11~28/make/lib/Lib-java.base.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/lib/Lib-java.base.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -55,7 +55,7 @@ LIBS_solaris := -lnsl -lsocket $(LIBDL), \ LIBS_aix := $(LIBDL),\ LIBS_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib winhttp.lib \ - delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \ + urlmon.lib delayimp.lib $(WIN_JAVA_LIB) advapi32.lib, \ LIBS_macosx := -framework CoreFoundation -framework CoreServices, \ )) @@ -138,6 +138,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \ NAME := jsig, \ + OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ diff -Nru openjdk-lts-11~28/make/lib/Lib-jdk.hotspot.agent.gmk openjdk-lts-11.0.2+9/make/lib/Lib-jdk.hotspot.agent.gmk --- openjdk-lts-11~28/make/lib/Lib-jdk.hotspot.agent.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/lib/Lib-jdk.hotspot.agent.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -44,7 +44,12 @@ ifeq ($(OPENJDK_TARGET_CPU), x86_64) SA_CXXFLAGS := -DWIN64 else - SA_CXXFLAGS := -RTC1 + # Only add /RTC1 flag for debug builds as it's + # incompatible with release type builds. See + # https://msdn.microsoft.com/en-us/library/8wtf2dfz.aspx + ifeq ($(DEBUG_LEVEL),slowdebug) + SA_CXXFLAGS := -RTC1 + endif endif endif @@ -52,7 +57,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \ NAME := saproc, \ - OPTIMIZATION := NONE, \ + OPTIMIZATION := HIGH, \ DISABLED_WARNINGS_microsoft := 4267, \ DISABLED_WARNINGS_gcc := sign-compare, \ DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \ diff -Nru openjdk-lts-11~28/make/test/JtregNativeHotspot.gmk openjdk-lts-11.0.2+9/make/test/JtregNativeHotspot.gmk --- openjdk-lts-11~28/make/test/JtregNativeHotspot.gmk 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/make/test/JtregNativeHotspot.gmk 2019-01-18 04:23:48.000000000 +0000 @@ -139,6 +139,15 @@ -I$(VM_TESTBASE_DIR)/nsk/share/native \ -I$(VM_TESTBASE_DIR)/nsk/share/jni +NO_FRAMEPOINTER_CFLAGS := +ifeq ($(OPENJDK_TARGET_OS),linux) + NO_FRAMEPOINTER_CFLAGS := -fomit-frame-pointer +endif + +BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libNoFramePointer := $(NO_FRAMEPOINTER_CFLAGS) +# Optimization -O3 needed, HIGH == -O3 +BUILD_HOTSPOT_JTREG_LIBRARIES_OPTIMIZATION_libNoFramePointer := HIGH + BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES) BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES) diff -Nru openjdk-lts-11~28/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java openjdk-lts-11.0.2+9/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java --- openjdk-lts-11~28/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessorImplBase.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,3 +1,34 @@ +/* + * + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package java2d; import java.awt.Color; diff -Nru openjdk-lts-11~28/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java openjdk-lts-11.0.2+9/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java --- openjdk-lts-11~28/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/demo/share/jfc/J2Ddemo/java2d/DemoInstVarsAccessor.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,3 +1,34 @@ +/* + * + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package java2d; import java.awt.Color; diff -Nru openjdk-lts-11~28/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -2789,7 +2789,10 @@ } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { + // tmp must be unused + assert(tmp->is_illegal(), "wasting a register if tmp is allocated"); + if (left->is_single_cpu()) { assert(dest->is_single_cpu(), "expect single result reg"); __ negw(dest->as_register(), left->as_register()); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -5741,15 +5741,18 @@ } if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dlog)) { - StubRoutines::_dlog = generate_dlog(); + // disabled pending fix and retest of generated code via JDK-8210858 + // StubRoutines::_dlog = generate_dlog(); } if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dsin)) { - StubRoutines::_dsin = generate_dsin_dcos(/* isCos = */ false); + // disabled pending fix and retest of generated code via JDK-8210461 + // StubRoutines::_dsin = generate_dsin_dcos(/* isCos = */ false); } if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dcos)) { - StubRoutines::_dcos = generate_dsin_dcos(/* isCos = */ true); + // disabled pending fix and retest of generated code via JDK-8210461 + // StubRoutines::_dcos = generate_dsin_dcos(/* isCos = */ true); } } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -44,24 +44,30 @@ #define __ masm-> #ifndef PRODUCT -extern "C" void bad_compiled_vtable_index(JavaThread* thread, - oop receiver, - int index); +extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int index); #endif VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - const int aarch64_code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new(aarch64_code_length) VtableStub(true, vtable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), aarch64_code_length); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ lea(r16, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); __ incrementw(Address(r16)); @@ -78,21 +84,35 @@ #ifndef PRODUCT if (DebugVtables) { Label L; + // TODO: find upper bound for this debug code. + start_pc = __ pc(); + // check offset vs vtable length __ ldrw(rscratch1, Address(r16, Klass::vtable_length_offset())); __ cmpw(rscratch1, vtable_index * vtableEntry::size()); __ br(Assembler::GT, L); __ enter(); __ mov(r2, vtable_index); - __ call_VM(noreg, - CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, r2); + + __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, r2); + const ptrdiff_t estimate = 256; + const ptrdiff_t codesize = __ pc() - start_pc; + slop_delta = estimate - codesize; // call_VM varies in length, depending on data + slop_bytes += slop_delta; + assert(slop_delta >= 0, "vtable #%d: Code size estimate (%d) for DebugVtables too small, required: %d", vtable_index, (int)estimate, (int)codesize); + __ leave(); __ bind(L); } #endif // PRODUCT + start_pc = __ pc(); __ lookup_virtual_method(r16, vtable_index, rmethod); + slop_delta = 8 - (int)(__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); +#ifndef PRODUCT if (DebugVtables) { Label L; __ cbz(rmethod, L); @@ -101,6 +121,8 @@ __ stop("Vtable entry is NULL"); __ bind(L); } +#endif // PRODUCT + // r0: receiver klass // rmethod: Method* // r2: receiver @@ -108,43 +130,46 @@ __ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); __ br(rscratch1); - __ flush(); + masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d", - vtable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - - s->set_exception_points(npe_addr, ame_addr); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - // Note well: pd_code_size_limit is the absolute minimum we can get - // away with. If you add code here, bump the code stub size - // returned by pd_code_size_limit! - const int code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new(code_length) VtableStub(false, itable_index); - ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { + return NULL; + } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ lea(r10, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); __ incrementw(Address(r10)); } #endif + // get receiver (need to skip return address on top of stack) + assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); + // Entry arguments: // rscratch2: CompiledICHolder // j_rarg0: Receiver - // Most registers are in use; we'll use r16, rmethod, r10, r11 const Register recv_klass_reg = r10; const Register holder_klass_reg = r16; // declaring interface klass (DECC) @@ -157,8 +182,8 @@ __ ldr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset())); __ ldr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset())); - // get receiver (need to skip return address on top of stack) - assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); + start_pc = __ pc(); + // get receiver klass (also an implicit null-check) address npe_addr = __ pc(); __ load_klass(recv_klass_reg, j_rarg0); @@ -172,16 +197,25 @@ L_no_such_interface, /*return_method=*/false); + const ptrdiff_t typecheckSize = __ pc() - start_pc; + start_pc = __ pc(); + // Get selected method from declaring class and itable index __ load_klass(recv_klass_reg, j_rarg0); // restore recv_klass_reg __ lookup_interface_method(// inputs: rec. class, interface, itable index - recv_klass_reg, holder_klass_reg, itable_index, - // outputs: method, scan temp. reg - rmethod, temp_reg, - L_no_such_interface); - - // method (rmethod): Method* - // j_rarg0: receiver + recv_klass_reg, holder_klass_reg, itable_index, + // outputs: method, scan temp. reg + rmethod, temp_reg, + L_no_such_interface); + + const ptrdiff_t lookupSize = __ pc() - start_pc; + + // Reduce "estimate" such that "padding" does not drop below 8. + const ptrdiff_t estimate = 152; + const ptrdiff_t codesize = typecheckSize + lookupSize; + slop_delta = (int)(estimate - codesize); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); #ifdef ASSERT if (DebugVtables) { @@ -206,92 +240,17 @@ // We force resolving of the call site by jumping to the "handle // wrong method" stub, and so let the interpreter runtime do all the // dirty work. + assert(SharedRuntime::get_handle_wrong_method_stub() != NULL, "check initialization order"); __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); - __ flush(); - - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", - itable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); + masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, 0); - s->set_exception_points(npe_addr, ame_addr); return s; } - -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - int size = DebugVtables ? 216 : 0; - if (CountCompiledCalls) - size += 6 * 4; - // FIXME: vtable stubs only need 36 bytes - if (is_vtable_stub) - size += 52; - else - size += 176; - return size; - - // In order to tune these parameters, run the JVM with VM options - // +PrintMiscellaneous and +WizardMode to see information about - // actual itable stubs. Run it with -Xmx31G -XX:+UseCompressedOops. - // - // If Universe::narrow_klass_base is nonzero, decoding a compressed - // class can take zeveral instructions. - // - // The JVM98 app. _202_jess has a megamorphic interface call. - // The itable code looks like this: - - // ldr xmethod, [xscratch2,#CompiledICHolder::holder_klass_offset] - // ldr x0, [xscratch2] - // ldr w10, [x1,#oopDesc::klass_offset_in_bytes] - // mov xheapbase, #0x3c000000 // #narrow_klass_base - // movk xheapbase, #0x3f7, lsl #32 - // add x10, xheapbase, x10 - // mov xheapbase, #0xe7ff0000 // #heapbase - // movk xheapbase, #0x3f7, lsl #32 - // ldr w11, [x10,#vtable_length_offset] - // add x11, x10, x11, uxtx #3 - // add x11, x11, #itableMethodEntry::method_offset_in_bytes - // ldr x10, [x11] - // cmp xmethod, x10 - // b.eq found_method - // search: - // cbz x10, no_such_interface - // add x11, x11, #0x10 - // ldr x10, [x11] - // cmp xmethod, x10 - // b.ne search - // found_method: - // ldr w10, [x1,#oopDesc::klass_offset_in_bytes] - // mov xheapbase, #0x3c000000 // #narrow_klass_base - // movk xheapbase, #0x3f7, lsl #32 - // add x10, xheapbase, x10 - // mov xheapbase, #0xe7ff0000 // #heapbase - // movk xheapbase, #0x3f7, lsl #32 - // ldr w11, [x10,#vtable_length_offset] - // add x11, x10, x11, uxtx #3 - // add x11, x11, #itableMethodEntry::method_offset_in_bytes - // add x10, x10, #itentry_off - // ldr xmethod, [x11] - // cmp x0, xmethod - // b.eq found_method2 - // search2: - // cbz xmethod, 0x000003ffa872e6cc - // add x11, x11, #0x10 - // ldr xmethod, [x11] - // cmp x0, xmethod - // b.ne search2 - // found_method2: - // ldr w11, [x11,#itableOffsetEntry::offset_offset_in_bytes] - // ldr xmethod, [x10,w11,uxtw] - // ldr xscratch1, [xmethod,#Method::from_compiled_offset] - // br xscratch1 - // no_such_interface: - // b throw_ICCE_entry - +int VtableStub::pd_code_alignment() { + // aarch64 cache line size is not an architected constant. We just align on 4 bytes (instruction size). + const unsigned int icache_line_size = 4; + return icache_line_size; } - -int VtableStub::pd_code_alignment() { return 4; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp --- openjdk-lts-11~28/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -3258,7 +3258,9 @@ } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { + // tmp must be unused + assert(tmp->is_illegal(), "wasting a register if tmp is allocated"); if (left->is_single_cpu()) { assert (dest->type() == T_INT, "unexpected result type"); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/arm/vtableStubs_arm.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/arm/vtableStubs_arm.cpp --- openjdk-lts-11~28/src/hotspot/cpu/arm/vtableStubs_arm.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/arm/vtableStubs_arm.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -48,17 +48,31 @@ #endif VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - const int code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new(code_length) VtableStub(true, vtable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); +#if (!defined(PRODUCT) && defined(COMPILER2)) + if (CountCompiledCalls) { + // Implementation required? + } +#endif + assert(VtableStub::receiver_location() == R0->as_VMReg(), "receiver expected in R0"); const Register tmp = Rtemp; // Rtemp OK, should be free at call sites @@ -66,17 +80,33 @@ address npe_addr = __ pc(); __ load_klass(tmp, R0); - { - int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index * vtableEntry::size_in_bytes(); - int method_offset = vtableEntry::method_offset_in_bytes() + entry_offset; - - assert ((method_offset & (wordSize - 1)) == 0, "offset should be aligned"); - int offset_mask = AARCH64_ONLY(0xfff << LogBytesPerWord) NOT_AARCH64(0xfff); - if (method_offset & ~offset_mask) { - __ add(tmp, tmp, method_offset & ~offset_mask); +#ifndef PRODUCT + if (DebugVtables) { + // Implementation required? } - __ ldr(Rmethod, Address(tmp, method_offset & offset_mask)); +#endif + + start_pc = __ pc(); + { // lookup virtual method + int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index * vtableEntry::size_in_bytes(); + int method_offset = vtableEntry::method_offset_in_bytes() + entry_offset; + + assert ((method_offset & (wordSize - 1)) == 0, "offset should be aligned"); + int offset_mask = AARCH64_ONLY(0xfff << LogBytesPerWord) NOT_AARCH64(0xfff); + if (method_offset & ~offset_mask) { + __ add(tmp, tmp, method_offset & ~offset_mask); + } + __ ldr(Rmethod, Address(tmp, method_offset & offset_mask)); + } + slop_delta = 8 - (int)(__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); + +#ifndef PRODUCT + if (DebugVtables) { + // Implementation required? } +#endif address ame_addr = __ pc(); #ifdef AARCH64 @@ -87,35 +117,36 @@ #endif // AARCH64 masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d", - vtable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // FIXME ARM: need correct 'slop' - below is x86 code - // shut the door on sizing bugs - //int slop = 8; // 32-bit offset is this much larger than a 13-bit one - //assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); - - s->set_exception_points(npe_addr, ame_addr); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - const int code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new(code_length) VtableStub(false, itable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; - ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); +#if (!defined(PRODUCT) && defined(COMPILER2)) + if (CountCompiledCalls) { + // Implementation required? + } +#endif + assert(VtableStub::receiver_location() == R0->as_VMReg(), "receiver expected in R0"); // R0-R3 / R0-R7 registers hold the arguments and cannot be spoiled @@ -123,15 +154,16 @@ const Register Rintf = AARCH64_ONLY(R10) NOT_AARCH64(R5); const Register Rscan = AARCH64_ONLY(R11) NOT_AARCH64(R6); + Label L_no_such_interface; + assert_different_registers(Ricklass, Rclass, Rintf, Rscan, Rtemp); - // Calculate the start of itable (itable goes after vtable) - const int scale = exact_log2(vtableEntry::size_in_bytes()); + start_pc = __ pc(); + + // get receiver klass (also an implicit null-check) address npe_addr = __ pc(); __ load_klass(Rclass, R0); - Label L_no_such_interface; - // Receiver subtype check against REFC. __ ldr(Rintf, Address(Ricklass, CompiledICHolder::holder_klass_offset())); __ lookup_interface_method(// inputs: rec. class, interface, itable index @@ -140,6 +172,9 @@ noreg, Rscan, Rtemp, L_no_such_interface); + const ptrdiff_t typecheckSize = __ pc() - start_pc; + start_pc = __ pc(); + // Get Method* and entry point for compiler __ ldr(Rintf, Address(Ricklass, CompiledICHolder::holder_metadata_offset())); __ lookup_interface_method(// inputs: rec. class, interface, itable index @@ -148,6 +183,21 @@ Rmethod, Rscan, Rtemp, L_no_such_interface); + const ptrdiff_t lookupSize = __ pc() - start_pc; + + // Reduce "estimate" such that "padding" does not drop below 8. + const ptrdiff_t estimate = 140; + const ptrdiff_t codesize = typecheckSize + lookupSize; + slop_delta = (int)(estimate - codesize); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); + +#ifndef PRODUCT + if (DebugVtables) { + // Implementation required? + } +#endif + address ame_addr = __ pc(); #ifdef AARCH64 @@ -158,7 +208,6 @@ #endif // AARCH64 __ bind(L_no_such_interface); - // Handle IncompatibleClassChangeError in itable stubs. // More detailed error message. // We force resolving of the call site by jumping to the "handle @@ -168,43 +217,13 @@ __ jump(SharedRuntime::get_handle_wrong_method_stub(), relocInfo::runtime_call_type, Rtemp); masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, 0); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", - itable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // FIXME ARM: need correct 'slop' - below is x86 code - // shut the door on sizing bugs - //int slop = 8; // 32-bit offset is this much larger than a 13-bit one - //assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); - - s->set_exception_points(npe_addr, ame_addr); return s; } -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - int instr_count; - - if (is_vtable_stub) { - // vtable stub size - instr_count = NOT_AARCH64(4) AARCH64_ONLY(5); - } else { - // itable stub size - instr_count = NOT_AARCH64(31) AARCH64_ONLY(31); - } - -#ifdef AARCH64 - if (UseCompressedClassPointers) { - instr_count += MacroAssembler::instr_count_for_decode_klass_not_null(); - } -#endif // AARCH64 - - return instr_count * Assembler::InstructionSize; -} - int VtableStub::pd_code_alignment() { - return 8; + // ARM32 cache line size is not an architected constant. We just align on word size. + const unsigned int icache_line_size = wordSize; + return icache_line_size; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -2840,7 +2840,9 @@ } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { + // tmp must be unused + assert(tmp->is_illegal(), "wasting a register if tmp is allocated"); assert(left->is_register(), "can only handle registers"); if (left->is_single_cpu()) { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/frame_ppc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/frame_ppc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/frame_ppc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/frame_ppc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -67,8 +67,8 @@ return false; } - // Unextended sp must be within the stack and above or equal sp - bool unextended_sp_safe = (unextended_sp < thread->stack_base()) && (unextended_sp >= sp); + // Unextended sp must be within the stack + bool unextended_sp_safe = (unextended_sp < thread->stack_base()); if (!unextended_sp_safe) { return false; @@ -76,9 +76,10 @@ // An fp must be within the stack and above (but not equal) sp. bool fp_safe = (fp <= thread->stack_base()) && (fp > sp); - // an interpreter fp must be within the stack and above (but not equal) sp - bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && - ((fp - sp) >= (ijava_state_size + top_ijava_frame_abi_size)); + // An interpreter fp must be within the stack and above (but not equal) sp. + // Moreover, it must be at least the size of the ijava_state structure. + bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && + ((fp - sp) >= ijava_state_size); // We know sp/unextended_sp are safe, only fp is questionable here diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/ppc.ad openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/ppc.ad --- openjdk-lts-11~28/src/hotspot/cpu/ppc/ppc.ad 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/ppc.ad 2019-01-18 04:23:48.000000000 +0000 @@ -908,6 +908,7 @@ // ---------------------------- reg_class vs_reg( + // Attention: Only these ones are saved & restored at safepoint by RegisterSaver. VSR32, VSR33, VSR34, @@ -928,18 +929,7 @@ VSR49, VSR50, VSR51 -// VSR52, // nv! -// VSR53, // nv! -// VSR54, // nv! -// VSR55, // nv! -// VSR56, // nv! -// VSR57, // nv! -// VSR58, // nv! -// VSR59, // nv! -// VSR60, // nv! -// VSR61, // nv! -// VSR62, // nv! -// VSR63 // nv! + // VSR52-VSR63 // nv! ); %} diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/register_ppc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/register_ppc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/register_ppc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/register_ppc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2017 SAP SE. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 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 @@ -26,11 +26,6 @@ #include "precompiled.hpp" #include "register_ppc.hpp" -const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers * 2; -const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::max_gpr + - FloatRegisterImpl::number_of_registers * 2; -const int ConcreteRegisterImpl::max_cnd = ConcreteRegisterImpl::max_fpr + - ConditionRegisterImpl::number_of_registers; const char* RegisterImpl::name() const { const char* names[number_of_registers] = { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/register_ppc.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/register_ppc.hpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/register_ppc.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/register_ppc.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2017 SAP SE. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 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 @@ -515,6 +515,7 @@ // accessors int encoding() const { assert(is_valid(), "invalid register"); return value(); } + inline VMReg as_VMReg(); // testers bool is_valid() const { return 0 <= value() && value() < number_of_registers; } @@ -668,21 +669,16 @@ class ConcreteRegisterImpl : public AbstractRegisterImpl { public: enum { + max_gpr = RegisterImpl::number_of_registers * 2, + max_fpr = max_gpr + FloatRegisterImpl::number_of_registers * 2, + max_vsr = max_fpr + VectorSRegisterImpl::number_of_registers, + max_cnd = max_vsr + ConditionRegisterImpl::number_of_registers, + max_spr = max_cnd + SpecialRegisterImpl::number_of_registers, // This number must be large enough to cover REG_COUNT (defined by c2) registers. // There is no requirement that any ordering here matches any ordering c2 gives // it's optoregs. - number_of_registers = - ( RegisterImpl::number_of_registers + - FloatRegisterImpl::number_of_registers ) - * 2 // register halves - + ConditionRegisterImpl::number_of_registers // condition code registers - + SpecialRegisterImpl::number_of_registers // special registers - + VectorSRegisterImpl::number_of_registers // VSX registers + number_of_registers = max_spr }; - - static const int max_gpr; - static const int max_fpr; - static const int max_cnd; }; // Common register declarations used in assembler code. diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -75,10 +75,12 @@ int* out_frame_size_in_bytes, bool generate_oop_map, int return_pc_adjustment, - ReturnPCLocation return_pc_location); + ReturnPCLocation return_pc_location, + bool save_vectors = false); static void restore_live_registers_and_pop_frame(MacroAssembler* masm, int frame_size_in_bytes, - bool restore_ctr); + bool restore_ctr, + bool save_vectors = false); static void push_frame_and_save_argument_registers(MacroAssembler* masm, Register r_temp, @@ -97,14 +99,16 @@ // Constants and data structures: typedef enum { - int_reg = 0, - float_reg = 1, - special_reg = 2 + int_reg, + float_reg, + special_reg, + vs_reg } RegisterType; typedef enum { reg_size = 8, half_reg_size = reg_size / 2, + vs_reg_size = 16 } RegisterConstants; typedef struct { @@ -115,15 +119,18 @@ }; -#define RegisterSaver_LiveSpecialReg(regname) \ - { RegisterSaver::special_reg, regname->encoding(), regname->as_VMReg() } - #define RegisterSaver_LiveIntReg(regname) \ { RegisterSaver::int_reg, regname->encoding(), regname->as_VMReg() } #define RegisterSaver_LiveFloatReg(regname) \ { RegisterSaver::float_reg, regname->encoding(), regname->as_VMReg() } +#define RegisterSaver_LiveSpecialReg(regname) \ + { RegisterSaver::special_reg, regname->encoding(), regname->as_VMReg() } + +#define RegisterSaver_LiveVSReg(regname) \ + { RegisterSaver::vs_reg, regname->encoding(), regname->as_VMReg() } + static const RegisterSaver::LiveRegType RegisterSaver_LiveRegs[] = { // Live registers which get spilled to the stack. Register // positions in this array correspond directly to the stack layout. @@ -201,14 +208,42 @@ RegisterSaver_LiveIntReg( R28 ), RegisterSaver_LiveIntReg( R29 ), RegisterSaver_LiveIntReg( R30 ), - RegisterSaver_LiveIntReg( R31 ), // must be the last register (see save/restore functions below) + RegisterSaver_LiveIntReg( R31 ) // must be the last register (see save/restore functions below) +}; + +static const RegisterSaver::LiveRegType RegisterSaver_LiveVSRegs[] = { + // + // live vector scalar registers (optional, only these ones are used by C2): + // + RegisterSaver_LiveVSReg( VSR32 ), + RegisterSaver_LiveVSReg( VSR33 ), + RegisterSaver_LiveVSReg( VSR34 ), + RegisterSaver_LiveVSReg( VSR35 ), + RegisterSaver_LiveVSReg( VSR36 ), + RegisterSaver_LiveVSReg( VSR37 ), + RegisterSaver_LiveVSReg( VSR38 ), + RegisterSaver_LiveVSReg( VSR39 ), + RegisterSaver_LiveVSReg( VSR40 ), + RegisterSaver_LiveVSReg( VSR41 ), + RegisterSaver_LiveVSReg( VSR42 ), + RegisterSaver_LiveVSReg( VSR43 ), + RegisterSaver_LiveVSReg( VSR44 ), + RegisterSaver_LiveVSReg( VSR45 ), + RegisterSaver_LiveVSReg( VSR46 ), + RegisterSaver_LiveVSReg( VSR47 ), + RegisterSaver_LiveVSReg( VSR48 ), + RegisterSaver_LiveVSReg( VSR49 ), + RegisterSaver_LiveVSReg( VSR50 ), + RegisterSaver_LiveVSReg( VSR51 ) }; + OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssembler* masm, int* out_frame_size_in_bytes, bool generate_oop_map, int return_pc_adjustment, - ReturnPCLocation return_pc_location) { + ReturnPCLocation return_pc_location, + bool save_vectors) { // Push an abi_reg_args-frame and store all registers which may be live. // If requested, create an OopMap: Record volatile registers as // callee-save values in an OopMap so their save locations will be @@ -218,15 +253,16 @@ // If return_pc_adjustment != 0 adjust the return pc by return_pc_adjustment. // Updated return pc is returned in R31 (if not return_pc_is_pre_saved). - int i; - int offset; - // calcualte frame size const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / sizeof(RegisterSaver::LiveRegType); - const int register_save_size = regstosave_num * reg_size; + const int vsregstosave_num = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) / + sizeof(RegisterSaver::LiveRegType)) + : 0; + const int register_save_size = regstosave_num * reg_size + vsregstosave_num * vs_reg_size; const int frame_size_in_bytes = align_up(register_save_size, frame::alignment_in_bytes) + frame::abi_reg_args_size; + *out_frame_size_in_bytes = frame_size_in_bytes; const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); const int register_save_offset = frame_size_in_bytes - register_save_size; @@ -236,17 +272,18 @@ BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {"); - // Save some registers in the last slots of the not yet pushed frame so that we - // can use them as scratch regs. - __ std(R31, - reg_size, R1_SP); - __ std(R30, -2*reg_size, R1_SP); - assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size), - "consistency check"); + // push a new frame + __ push_frame(frame_size_in_bytes, noreg); + + // Save some registers in the last (non-vector) slots of the new frame so we + // can use them as scratch regs or to determine the return pc. + __ std(R31, frame_size_in_bytes - reg_size - vsregstosave_num * vs_reg_size, R1_SP); + __ std(R30, frame_size_in_bytes - 2*reg_size - vsregstosave_num * vs_reg_size, R1_SP); // save the flags // Do the save_LR_CR by hand and adjust the return pc if requested. __ mfcr(R30); - __ std(R30, _abi(cr), R1_SP); + __ std(R30, frame_size_in_bytes + _abi(cr), R1_SP); switch (return_pc_location) { case return_pc_is_lr: __ mflr(R31); break; case return_pc_is_pre_saved: assert(return_pc_adjustment == 0, "unsupported"); break; @@ -257,14 +294,12 @@ if (return_pc_adjustment != 0) { __ addi(R31, R31, return_pc_adjustment); } - __ std(R31, _abi(lr), R1_SP); + __ std(R31, frame_size_in_bytes + _abi(lr), R1_SP); } - // push a new frame - __ push_frame(frame_size_in_bytes, R30); - // save all registers (ints and floats) - offset = register_save_offset; + int offset = register_save_offset; + for (int i = 0; i < regstosave_num; i++) { int reg_num = RegisterSaver_LiveRegs[i].reg_num; int reg_type = RegisterSaver_LiveRegs[i].reg_type; @@ -302,6 +337,22 @@ offset += reg_size; } + for (int i = 0; i < vsregstosave_num; i++) { + int reg_num = RegisterSaver_LiveVSRegs[i].reg_num; + int reg_type = RegisterSaver_LiveVSRegs[i].reg_type; + + __ li(R30, offset); + __ stxvd2x(as_VectorSRegister(reg_num), R30, R1_SP); + + if (generate_oop_map) { + map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), + RegisterSaver_LiveVSRegs[i].vmreg); + } + offset += vs_reg_size; + } + + assert(offset == frame_size_in_bytes, "consistency check"); + BLOCK_COMMENT("} push_frame_reg_args_and_save_live_registers"); // And we're done. @@ -313,18 +364,22 @@ // saved. void RegisterSaver::restore_live_registers_and_pop_frame(MacroAssembler* masm, int frame_size_in_bytes, - bool restore_ctr) { - int i; - int offset; + bool restore_ctr, + bool save_vectors) { const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / sizeof(RegisterSaver::LiveRegType); - const int register_save_size = regstosave_num * reg_size; + const int vsregstosave_num = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) / + sizeof(RegisterSaver::LiveRegType)) + : 0; + const int register_save_size = regstosave_num * reg_size + vsregstosave_num * vs_reg_size; + const int register_save_offset = frame_size_in_bytes - register_save_size; BLOCK_COMMENT("restore_live_registers_and_pop_frame {"); // restore all registers (ints and floats) - offset = register_save_offset; + int offset = register_save_offset; + for (int i = 0; i < regstosave_num; i++) { int reg_num = RegisterSaver_LiveRegs[i].reg_num; int reg_type = RegisterSaver_LiveRegs[i].reg_type; @@ -356,14 +411,30 @@ offset += reg_size; } - // pop the frame - __ pop_frame(); + for (int i = 0; i < vsregstosave_num; i++) { + int reg_num = RegisterSaver_LiveVSRegs[i].reg_num; + int reg_type = RegisterSaver_LiveVSRegs[i].reg_type; + + __ li(R31, offset); + __ lxvd2x(as_VectorSRegister(reg_num), R31, R1_SP); + + offset += vs_reg_size; + } + + assert(offset == frame_size_in_bytes, "consistency check"); + + // restore link and the flags + __ ld(R31, frame_size_in_bytes + _abi(lr), R1_SP); + __ mtlr(R31); - // restore the flags - __ restore_LR_CR(R31); + __ ld(R31, frame_size_in_bytes + _abi(cr), R1_SP); + __ mtcr(R31); // restore scratch register's value - __ ld(R31, -reg_size, R1_SP); + __ ld(R31, frame_size_in_bytes - reg_size - vsregstosave_num * vs_reg_size, R1_SP); + + // pop the frame + __ addi(R1_SP, R1_SP, frame_size_in_bytes); BLOCK_COMMENT("} restore_live_registers_and_pop_frame"); } @@ -447,15 +518,13 @@ // Restore the registers that might be holding a result. void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes) { - int i; - int offset; const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / sizeof(RegisterSaver::LiveRegType); - const int register_save_size = regstosave_num * reg_size; + const int register_save_size = regstosave_num * reg_size; // VS registers not relevant here. const int register_save_offset = frame_size_in_bytes - register_save_size; // restore all result registers (ints and floats) - offset = register_save_offset; + int offset = register_save_offset; for (int i = 0; i < regstosave_num; i++) { int reg_num = RegisterSaver_LiveRegs[i].reg_num; int reg_type = RegisterSaver_LiveRegs[i].reg_type; @@ -479,6 +548,8 @@ } offset += reg_size; } + + assert(offset == frame_size_in_bytes, "consistency check"); } // Is vector's size (in bytes) bigger than a size saved by default? @@ -3109,12 +3180,14 @@ __ tabort_(); } + bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP); + // Save registers, fpu state, and flags. Set R31 = return pc. map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, &frame_size_in_bytes, /*generate_oop_map=*/ true, /*return_pc_adjustment=*/0, - return_pc_location); + return_pc_location, save_vectors); // The following is basically a call_VM. However, we need the precise // address of the call in order to generate an oopmap. Hence, we do all the @@ -3148,7 +3221,7 @@ // Exception pending RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, - /*restore_ctr=*/true); + /*restore_ctr=*/true, save_vectors); BLOCK_COMMENT(" Jump to forward_exception_entry."); // Jump to forward_exception_entry, with the issuing PC in LR @@ -3175,7 +3248,7 @@ // Normal exit, restore registers and exit. RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, - /*restore_ctr=*/true); + /*restore_ctr=*/true, save_vectors); __ blr(); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2013 SAP SE. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 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 @@ -28,16 +28,21 @@ inline VMReg RegisterImpl::as_VMReg() { if (this == noreg) return VMRegImpl::Bad(); + // Two halfs, multiply by 2. return VMRegImpl::as_VMReg(encoding() << 1); } -// Since we don't have two halfs here, don't multiply by 2. -inline VMReg ConditionRegisterImpl::as_VMReg() { +inline VMReg FloatRegisterImpl::as_VMReg() { + // Two halfs, multiply by 2. + return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); +} + +inline VMReg VectorSRegisterImpl::as_VMReg() { return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_fpr); } -inline VMReg FloatRegisterImpl::as_VMReg() { - return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); +inline VMReg ConditionRegisterImpl::as_VMReg() { + return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_vsr); } inline VMReg SpecialRegisterImpl::as_VMReg() { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -39,36 +39,39 @@ #define __ masm-> -#ifdef PRODUCT -#define BLOCK_COMMENT(str) // nothing -#else -#define BLOCK_COMMENT(str) __ block_comment(str) -#endif -#define BIND(label) bind(label); BLOCK_COMMENT(#label ":") - #ifndef PRODUCT extern "C" void bad_compiled_vtable_index(JavaThread* thread, oopDesc* receiver, int index); #endif -// Used by compiler only; may use only caller saved, non-argument -// registers. +// Used by compiler only; may use only caller saved, non-argument registers. VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - // PPC port: use fixed size. - const int code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new (code_length) VtableStub(true, vtable_index); - + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 8; // just a two-instruction safety net + int slop_delta = 0; + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { + start_pc = __ pc(); + int load_const_maxLen = 5*BytesPerInstWord; // load_const generates 5 instructions. Assume that as max size for laod_const_optimized int offs = __ load_const_optimized(R11_scratch1, SharedRuntime::nof_megamorphic_calls_addr(), R12_scratch2, true); + slop_delta = load_const_maxLen - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ lwz(R12_scratch2, offs, R11_scratch1); __ addi(R12_scratch2, R12_scratch2, 1); __ stw(R12_scratch2, offs, R11_scratch1); @@ -77,17 +80,13 @@ assert(VtableStub::receiver_location() == R3_ARG1->as_VMReg(), "receiver expected in R3_ARG1"); - // Get receiver klass. const Register rcvr_klass = R11_scratch1; - - // We might implicit NULL fault here. address npe_addr = __ pc(); // npe = null pointer exception + // check if we must do an explicit check (implicit checks disabled, offset too large). __ null_check(R3, oopDesc::klass_offset_in_bytes(), /*implicit only*/NULL); + // Get receiver klass. __ load_klass(rcvr_klass, R3); - // Set method (in case of interpreted method), and destination address. - int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes(); - #ifndef PRODUCT if (DebugVtables) { Label L; @@ -102,7 +101,9 @@ } #endif - int v_off = entry_offset + vtableEntry::method_offset_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(); __ ld(R19_method, (RegisterOrConstant)v_off, rcvr_klass); @@ -116,40 +117,48 @@ } #endif - // If the vtable entry is null, the method is abstract. address ame_addr = __ pc(); // ame = abstract method error + // if the vtable entry is null, the method is abstract + // NOTE: for vtable dispatches, the vtable entry will never be null. + __ null_check(R19_method, in_bytes(Method::from_compiled_offset()), /*implicit only*/NULL); __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method); __ mtctr(R12_scratch2); __ bctr(); masm->flush(); - - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - - s->set_exception_points(npe_addr, ame_addr); + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - // PPC port: use fixed size. - const int code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new (code_length) VtableStub(false, itable_index); - + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 8; // just a two-instruction safety net + int slop_delta = 0; - ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); - address start_pc; + int load_const_maxLen = 5*BytesPerInstWord; // load_const generates 5 instructions. Assume that as max size for laod_const_optimized -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { + start_pc = __ pc(); int offs = __ load_const_optimized(R11_scratch1, SharedRuntime::nof_megamorphic_calls_addr(), R12_scratch2, true); + slop_delta = load_const_maxLen - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ lwz(R12_scratch2, offs, R11_scratch1); __ addi(R12_scratch2, R12_scratch2, 1); __ stw(R12_scratch2, offs, R11_scratch1); @@ -209,33 +218,22 @@ // wrong method" stub, and so let the interpreter runtime do all the // dirty work. __ bind(L_no_such_interface); + start_pc = __ pc(); __ load_const_optimized(R11_scratch1, SharedRuntime::get_handle_wrong_method_stub(), R12_scratch2); + slop_delta = load_const_maxLen - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ mtctr(R11_scratch1); __ bctr(); masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, 0); - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - - s->set_exception_points(npe_addr, ame_addr); return s; } -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (DebugVtables || CountCompiledCalls || VerifyOops) { - return 1000; - } - int size = is_vtable_stub ? 20 + 8 : 164 + 20; // Plain + safety - if (UseCompressedClassPointers) { - size += MacroAssembler::instr_size_for_decode_klass_not_null(); - } - if (!ImplicitNullChecks || !os::zero_page_read_protected()) { - size += is_vtable_stub ? 8 : 12; - } - return size; -} - int VtableStub::pd_code_alignment() { + // Power cache line size is 128 bytes, but we want to limit alignment loss. const unsigned int icache_line_size = 32; return icache_line_size; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -2850,7 +2850,9 @@ ShouldNotCallThis(); // There are no delay slots on ZARCH_64. } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { + // tmp must be unused + assert(tmp->is_illegal(), "wasting a register if tmp is allocated"); assert(left->is_register(), "can only handle registers"); if (left->is_single_cpu()) { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.cpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -53,14 +53,135 @@ bool frame::safe_for_sender(JavaThread *thread) { bool safe = false; - address cursp = (address)sp(); - address curfp = (address)fp(); - if ((cursp != NULL && curfp != NULL && - (cursp <= thread->stack_base() && cursp >= thread->stack_base() - thread->stack_size())) && - (curfp <= thread->stack_base() && curfp >= thread->stack_base() - thread->stack_size())) { - safe = true; + address sp = (address)_sp; + address fp = (address)_fp; + address unextended_sp = (address)_unextended_sp; + + // Consider stack guards when trying to determine "safe" stack pointers + static size_t stack_guard_size = os::uses_stack_guard_pages() ? + JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_reserved_zone_size() : 0; + size_t usable_stack_size = thread->stack_size() - stack_guard_size; + + // sp must be within the usable part of the stack (not in guards) + bool sp_safe = (sp < thread->stack_base()) && + (sp >= thread->stack_base() - usable_stack_size); + + + if (!sp_safe) { + return false; + } + + // Unextended sp must be within the stack + bool unextended_sp_safe = (unextended_sp < thread->stack_base()); + + if (!unextended_sp_safe) { + return false; + } + + // An fp must be within the stack and above (but not equal) sp. + bool fp_safe = (fp <= thread->stack_base()) && (fp > sp); + // An interpreter fp must be within the stack and above (but not equal) sp. + // Moreover, it must be at least the size of the z_ijava_state structure. + bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && + ((fp - sp) >= z_ijava_state_size); + + // We know sp/unextended_sp are safe, only fp is questionable here + + // If the current frame is known to the code cache then we can attempt to + // to construct the sender and do some validation of it. This goes a long way + // toward eliminating issues when we get in frame construction code + + if (_cb != NULL ) { + // Entry frame checks + if (is_entry_frame()) { + // An entry frame must have a valid fp. + return fp_safe && is_entry_frame_valid(thread); + } + + // Now check if the frame is complete and the test is + // reliable. Unfortunately we can only check frame completeness for + // runtime stubs. Other generic buffer blobs are more + // problematic so we just assume they are OK. Adapter blobs never have a + // complete frame and are never OK. nmethods should be OK on s390. + if (!_cb->is_frame_complete_at(_pc)) { + if (_cb->is_adapter_blob() || _cb->is_runtime_stub()) { + return false; + } + } + + // Could just be some random pointer within the codeBlob. + if (!_cb->code_contains(_pc)) { + return false; + } + + if (is_interpreted_frame() && !fp_interp_safe) { + return false; + } + + z_abi_160* sender_abi = (z_abi_160*) fp; + intptr_t* sender_sp = (intptr_t*) sender_abi->callers_sp; + address sender_pc = (address) sender_abi->return_pc; + + // We must always be able to find a recognizable pc. + CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc); + if (sender_blob == NULL) { + return false; + } + + // Could be a zombie method + if (sender_blob->is_zombie() || sender_blob->is_unloaded()) { + return false; + } + + // It should be safe to construct the sender though it might not be valid. + + frame sender(sender_sp, sender_pc); + + // Do we have a valid fp? + address sender_fp = (address) sender.fp(); + + // sender_fp must be within the stack and above (but not + // equal) current frame's fp. + if (sender_fp > thread->stack_base() || sender_fp <= fp) { + return false; + } + + // If the potential sender is the interpreter then we can do some more checking. + if (Interpreter::contains(sender_pc)) { + return sender.is_interpreted_frame_valid(thread); + } + + // Could just be some random pointer within the codeBlob. + if (!sender.cb()->code_contains(sender_pc)) { + return false; + } + + // We should never be able to see an adapter if the current frame is something from code cache. + if (sender_blob->is_adapter_blob()) { + return false; + } + + if (sender.is_entry_frame()) { + return sender.is_entry_frame_valid(thread); + } + + // Frame size is always greater than zero. If the sender frame size is zero or less, + // something is really weird and we better give up. + if (sender_blob->frame_size() <= 0) { + return false; + } + + return true; } - return safe; + + // Must be native-compiled frame. Since sender will try and use fp to find + // linkages it must be safe + + if (!fp_safe) { + return false; + } + + return true; } bool frame::is_interpreted_frame() const { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.hpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -491,9 +491,12 @@ static int interpreter_frame_interpreterstate_size_in_bytes(); static int interpreter_frame_monitor_size_in_bytes(); - private: // template interpreter state + inline z_ijava_state* ijava_state_unchecked() const; + + private: + inline z_ijava_state* ijava_state() const; // Where z_ijava_state.monitors is saved. diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.inline.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.inline.hpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/frame_s390.inline.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/frame_s390.inline.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -77,8 +77,13 @@ #endif // template interpreter state -inline frame::z_ijava_state* frame::ijava_state() const { +inline frame::z_ijava_state* frame::ijava_state_unchecked() const { z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size); + return state; +} + +inline frame::z_ijava_state* frame::ijava_state() const { + z_ijava_state* state = ijava_state_unchecked(); assert(state->magic == (intptr_t) frame::z_istate_magic_number, "wrong z_ijava_state in interpreter frame (no magic found)"); return state; diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/macroAssembler_s390.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/macroAssembler_s390.cpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/macroAssembler_s390.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/macroAssembler_s390.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -465,19 +465,8 @@ z_xihf(r1, -1); } } else { // Distinct src and dst registers. - if (VM_Version::has_DistinctOpnds()) { - load_const_optimized(r1, -1); - z_xgrk(r1, r2, r1); - } else { - if (wide) { - z_lgr(r1, r2); - z_xilf(r1, -1); - z_xihf(r1, -1); - } else { - z_lr(r1, r2); - z_xilf(r1, -1); - } - } + load_const_optimized(r1, -1); + z_xgr(r1, r2); } } @@ -1158,8 +1147,10 @@ // Make sure to keep code size constant -> no value-dependent optimizations. // Do not kill condition code. void MacroAssembler::load_const(Register t, long x) { - Assembler::z_iihf(t, (int)(x >> 32)); - Assembler::z_iilf(t, (int)(x & 0xffffffff)); + // Note: Right shift is only cleanly defined for unsigned types + // or for signed types with nonnegative values. + Assembler::z_iihf(t, (long)((unsigned long)x >> 32)); + Assembler::z_iilf(t, (long)((unsigned long)x & 0xffffffffUL)); } // Load a 32bit constant into a 64bit register, sign-extend or zero-extend. @@ -1256,8 +1247,10 @@ // CPU-version dependend patching of load_const. void MacroAssembler::patch_const(address a, long x) { assert(is_load_const(a), "not a load of a constant"); - set_imm32((address)a, (int) ((x >> 32) & 0xffffffff)); - set_imm32((address)(a + 6), (int)(x & 0xffffffff)); + // Note: Right shift is only cleanly defined for unsigned types + // or for signed types with nonnegative values. + set_imm32((address)a, (long)((unsigned long)x >> 32)); + set_imm32((address)(a + 6), (long)((unsigned long)x & 0xffffffffUL)); } // Patching the value of CPU version dependent load_const_32to64 sequence. @@ -1461,13 +1454,17 @@ // 64 bit value: | part1 | part2 | part3 | part4 | // At least one part is not zero! - int part1 = ((x >> 32) & 0xffff0000) >> 16; - int part2 = (x >> 32) & 0x0000ffff; - int part3 = (x & 0xffff0000) >> 16; - int part4 = (x & 0x0000ffff); + // Note: Right shift is only cleanly defined for unsigned types + // or for signed types with nonnegative values. + int part1 = (int)((unsigned long)x >> 48) & 0x0000ffff; + int part2 = (int)((unsigned long)x >> 32) & 0x0000ffff; + int part3 = (int)((unsigned long)x >> 16) & 0x0000ffff; + int part4 = (int)x & 0x0000ffff; + int part12 = (int)((unsigned long)x >> 32); + int part34 = (int)x; // Lower word only (unsigned). - if ((part1 == 0) && (part2 == 0)) { + if (part12 == 0) { if (part3 == 0) { if (emit) z_llill(t, part4); return 4; @@ -1476,12 +1473,12 @@ if (emit) z_llilh(t, part3); return 4; } - if (emit) z_llilf(t, (int)(x & 0xffffffff)); + if (emit) z_llilf(t, part34); return 6; } // Upper word only. - if ((part3 == 0) && (part4 == 0)) { + if (part34 == 0) { if (part1 == 0) { if (emit) z_llihl(t, part2); return 4; @@ -1490,13 +1487,13 @@ if (emit) z_llihh(t, part1); return 4; } - if (emit) z_llihf(t, (int)(x >> 32)); + if (emit) z_llihf(t, part12); return 6; } // Lower word only (signed). if ((part1 == 0x0000ffff) && (part2 == 0x0000ffff) && ((part3 & 0x00008000) != 0)) { - if (emit) z_lgfi(t, (int)(x & 0xffffffff)); + if (emit) z_lgfi(t, part34); return 6; } @@ -1511,7 +1508,7 @@ len += 4; } } else { - if (emit) z_llihf(t, (int)(x >> 32)); + if (emit) z_llihf(t, part12); len += 6; } @@ -1524,7 +1521,7 @@ len += 4; } } else { - if (emit) z_iilf(t, (int)(x & 0xffffffff)); + if (emit) z_iilf(t, part34); len += 6; } return len; diff -Nru openjdk-lts-11~28/src/hotspot/cpu/s390/vtableStubs_s390.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/vtableStubs_s390.cpp --- openjdk-lts-11~28/src/hotspot/cpu/s390/vtableStubs_s390.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/s390/vtableStubs_s390.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2017 SAP SE. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018 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 @@ -37,9 +37,6 @@ #include "opto/runtime.hpp" #endif -// Machine-dependent part of VtableStubs: create vtableStub of correct -// size and initialize its code. - #define __ masm-> #ifndef PRODUCT @@ -48,123 +45,140 @@ // Used by compiler only; may use only caller saved, non-argument registers. VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - - const int code_length = VtableStub::pd_code_size_limit(true); - VtableStub *s = new(code_length) VtableStub(true, vtable_index); - if (s == NULL) { // Indicates OOM In the code cache. + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); - MacroAssembler *masm = new MacroAssembler(&cb); - int padding_bytes = 0; + CodeBuffer cb(s->entry_point(), stub_code_length); + MacroAssembler* masm = new MacroAssembler(&cb); #if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { - // Count unused bytes - // worst case actual size - padding_bytes += __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::nof_megamorphic_calls_addr(), true); - + // worst case actual size + slop_delta = __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::nof_megamorphic_calls_addr(), true); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); // Use generic emitter for direct memory increment. // Abuse Z_method as scratch register for generic emitter. // It is loaded further down anyway before it is first used. + // No dynamic code size variance here, increment is 1, always. __ add2mem_32(Address(Z_R1_scratch), 1, Z_method); } #endif assert(VtableStub::receiver_location() == Z_R2->as_VMReg(), "receiver expected in Z_ARG1"); - // Get receiver klass. - // Must do an explicit check if implicit checks are disabled. - address npe_addr = __ pc(); // npe == NULL ptr exception + const Register rcvr_klass = Z_R1_scratch; + address npe_addr = __ pc(); // npe == NULL ptr exception + // check if we must do an explicit check (implicit checks disabled, offset too large). __ null_check(Z_ARG1, Z_R1_scratch, oopDesc::klass_offset_in_bytes()); - const Register rcvr_klass = Z_R1_scratch; + // Get receiver klass. __ load_klass(rcvr_klass, Z_ARG1); - // Set method (in case of interpreted method), and destination address. - int entry_offset = in_bytes(Klass::vtable_start_offset()) + - vtable_index * vtableEntry::size_in_bytes(); - #ifndef PRODUCT if (DebugVtables) { - Label L; + NearLabel L; // Check offset vs vtable length. const Register vtable_idx = Z_R0_scratch; - // Count unused bytes. - // worst case actual size - padding_bytes += __ load_const_size() - __ load_const_optimized_rtn_len(vtable_idx, vtable_index*vtableEntry::size_in_bytes(), true); + // worst case actual size + slop_delta = __ load_const_size() - __ load_const_optimized_rtn_len(vtable_idx, vtable_index*vtableEntry::size(), true); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); - assert(Immediate::is_uimm12(in_bytes(Klass::vtable_length_offset())), "disp to large"); + assert(Displacement::is_shortDisp(in_bytes(Klass::vtable_length_offset())), "disp to large"); __ z_cl(vtable_idx, in_bytes(Klass::vtable_length_offset()), rcvr_klass); __ z_brl(L); __ z_lghi(Z_ARG3, vtable_index); // Debug code, don't optimize. __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), Z_ARG1, Z_ARG3, false); // Count unused bytes (assume worst case here). - padding_bytes += 12; + slop_bytes += 12; __ bind(L); } #endif - int v_off = entry_offset + vtableEntry::method_offset_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(); + // Set method (in case of interpreted method), and destination address. // Duplicate safety code from enc_class Java_Dynamic_Call_dynTOC. if (Displacement::is_validDisp(v_off)) { __ z_lg(Z_method/*method oop*/, v_off, rcvr_klass/*class oop*/); // Account for the load_const in the else path. - padding_bytes += __ load_const_size(); + slop_delta = __ load_const_size(); } else { // Worse case, offset does not fit in displacement field. - __ load_const(Z_method, v_off); // Z_method temporarily holds the offset value. + // worst case actual size + slop_delta = __ load_const_size() - __ load_const_optimized_rtn_len(Z_method, v_off, true); __ z_lg(Z_method/*method oop*/, 0, Z_method/*method offset*/, rcvr_klass/*class oop*/); } + slop_bytes += slop_delta; #ifndef PRODUCT if (DebugVtables) { - Label L; + NearLabel L; __ z_ltgr(Z_method, Z_method); __ z_brne(L); - __ stop("Vtable entry is ZERO",102); + __ stop("Vtable entry is ZERO", 102); __ bind(L); } #endif - address ame_addr = __ pc(); // ame = abstract method error - - // Must do an explicit check if implicit checks are disabled. + // Must do an explicit check if offset too large or implicit checks are disabled. + address ame_addr = __ pc(); __ null_check(Z_method, Z_R1_scratch, in_bytes(Method::from_compiled_offset())); __ z_lg(Z_R1_scratch, in_bytes(Method::from_compiled_offset()), Z_method); __ z_br(Z_R1_scratch); masm->flush(); - - s->set_exception_points(npe_addr, ame_addr); + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - const int code_length = VtableStub::pd_code_size_limit(false); - VtableStub *s = new(code_length) VtableStub(false, itable_index); - if (s == NULL) { // Indicates OOM in the code cache. + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); + // Can be NULL if there is no free space in the code cache. + if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; ResourceMark rm; - CodeBuffer cb(s->entry_point(), code_length); - MacroAssembler *masm = new MacroAssembler(&cb); - int padding_bytes = 0; + CodeBuffer cb(s->entry_point(), stub_code_length); + MacroAssembler* masm = new MacroAssembler(&cb); #if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { - // Count unused bytes - // worst case actual size - padding_bytes += __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::nof_megamorphic_calls_addr(), true); - + // worst case actual size + slop_delta = __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::nof_megamorphic_calls_addr(), true); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); // Use generic emitter for direct memory increment. - // Use Z_tmp_1 as scratch register for generic emitter. - __ add2mem_32((Z_R1_scratch), 1, Z_tmp_1); + // Abuse Z_method as scratch register for generic emitter. + // It is loaded further down anyway before it is first used. + // No dynamic code size variance here, increment is 1, always. + __ add2mem_32(Address(Z_R1_scratch), 1, Z_method); } #endif @@ -178,7 +192,7 @@ interface = Z_tmp_2; // Get receiver klass. - // Must do an explicit check if implicit checks are disabled. + // Must do an explicit check if offset too large or implicit checks are disabled. address npe_addr = __ pc(); // npe == NULL ptr exception __ null_check(Z_ARG1, Z_R1_scratch, oopDesc::klass_offset_in_bytes()); __ load_klass(rcvr_klass, Z_ARG1); @@ -195,10 +209,10 @@ #ifndef PRODUCT if (DebugVtables) { - Label ok1; + NearLabel ok1; __ z_ltgr(Z_method, Z_method); __ z_brne(ok1); - __ stop("method is null",103); + __ stop("method is null", 103); __ bind(ok1); } #endif @@ -213,39 +227,24 @@ // Handle IncompatibleClassChangeError in itable stubs. __ bind(no_such_interface); - // Count unused bytes - // worst case actual size - // We force resolving of the call site by jumping to - // the "handle wrong method" stub, and so let the + // more detailed IncompatibleClassChangeError + // we force re-resolving of the call site by jumping to + // the "handle wrong method" stub, thus letting the // interpreter runtime do all the dirty work. - padding_bytes += __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::get_handle_wrong_method_stub(), true); + // worst case actual size + slop_delta = __ load_const_size() - __ load_const_optimized_rtn_len(Z_R1_scratch, (long)SharedRuntime::get_handle_wrong_method_stub(), true); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ z_br(Z_R1_scratch); masm->flush(); + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, 0); - s->set_exception_points(npe_addr, ame_addr); return s; } -// In order to tune these parameters, run the JVM with VM options -// +PrintMiscellaneous and +WizardMode to see information about -// actual itable stubs. Run it with -Xmx31G -XX:+UseCompressedOops. -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - int size = DebugVtables ? 216 : 0; - if (CountCompiledCalls) { - size += 6 * 4; - } - size += is_vtable_stub ? 36 : 140; - if (UseCompressedClassPointers) { - size += MacroAssembler::instr_size_for_decode_klass_not_null(); - } - if (!ImplicitNullChecks) { - size += 36; - } - return size; -} - int VtableStub::pd_code_alignment() { + // System z cache line size is 256 bytes, but octoword-alignment is quite ok. const unsigned int icache_line_size = 32; return icache_line_size; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -3024,7 +3024,9 @@ } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { + // tmp must be unused + assert(tmp->is_illegal(), "wasting a register if tmp is allocated"); assert(left->is_register(), "can only handle registers"); if (left->is_single_cpu()) { diff -Nru openjdk-lts-11~28/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp --- openjdk-lts-11~28/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -41,32 +41,38 @@ #define __ masm-> - #ifndef PRODUCT extern "C" void bad_compiled_vtable_index(JavaThread* thread, oopDesc* receiver, int index); #endif // Used by compiler only; may use only caller saved, non-argument registers -// NOTE: %%%% if any change is made to this stub make sure that the function -// pd_code_size_limit is changed to ensure the correct size for VtableStub VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - const int sparc_code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new(sparc_code_length) VtableStub(true, vtable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), sparc_code_length); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + const int index_dependent_slop = ((vtable_index < 512) ? 2 : 0)*BytesPerInstWord; // code size change with transition from 13-bit to 32-bit constant (@index == 512?). + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ inc_counter(SharedRuntime::nof_megamorphic_calls_addr(), G5, G3_scratch); } -#endif /* PRODUCT */ +#endif // PRODUCT assert(VtableStub::receiver_location() == O0->as_VMReg(), "receiver expected in O0"); @@ -74,20 +80,33 @@ address npe_addr = __ pc(); __ load_klass(O0, G3_scratch); - // set Method* (in case of interpreted method), and destination address #ifndef PRODUCT if (DebugVtables) { Label L; // check offset vs vtable length __ ld(G3_scratch, in_bytes(Klass::vtable_length_offset()), G5); __ cmp_and_br_short(G5, vtable_index*vtableEntry::size(), Assembler::greaterUnsigned, Assembler::pt, L); + + // set generates 8 instructions (worst case), 1 instruction (best case) + start_pc = __ pc(); __ set(vtable_index, O2); + slop_delta = __ worst_case_insts_for_set()*BytesPerInstWord - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); + + // there is no variance in call_VM() emitted code. __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), O0, O2); __ bind(L); } #endif + // set Method* (in case of interpreted method), and destination address + start_pc = __ pc(); __ lookup_virtual_method(G3_scratch, vtable_index, G5_method); + // lookup_virtual_method generates 3 instructions (worst case), 1 instruction (best case) + slop_delta = 3*BytesPerInstWord - (int)(__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); #ifndef PRODUCT if (DebugVtables) { @@ -109,37 +128,41 @@ __ delayed()->nop(); masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, index_dependent_slop); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d", - vtable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one - assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); - - s->set_exception_points(npe_addr, ame_addr); return s; } -// NOTE: %%%% if any change is made to this stub make sure that the function -// pd_code_size_limit is changed to ensure the correct size for VtableStub VtableStub* VtableStubs::create_itable_stub(int itable_index) { - const int sparc_code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + const int index_dependent_slop = ((itable_index < 512) ? 2 : 0)*BytesPerInstWord; // code size change with transition from 13-bit to 32-bit constant (@index == 512?). - ResourceMark rm; - CodeBuffer cb(s->entry_point(), sparc_code_length); + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); +#if (!defined(PRODUCT) && defined(COMPILER2)) + if (CountCompiledCalls) { +// Use G3_scratch, G4_scratch as work regs for inc_counter. +// These are defined before use further down. + __ inc_counter(SharedRuntime::nof_megamorphic_calls_addr(), G3_scratch, G4_scratch); + } +#endif // PRODUCT + Register G3_Klass = G3_scratch; Register G5_icholder = G5; // Passed in as an argument Register G4_interface = G4_scratch; @@ -160,16 +183,11 @@ // and so those registers are not available here. __ save(SP,-frame::register_save_words*wordSize,SP); -#ifndef PRODUCT - if (CountCompiledCalls) { - __ inc_counter(SharedRuntime::nof_megamorphic_calls_addr(), L0, L1); - } -#endif /* PRODUCT */ - - Label L_no_such_interface; - + Label L_no_such_interface; Register L5_method = L5; + start_pc = __ pc(); + // Receiver subtype check against REFC. __ ld_ptr(G5_icholder, CompiledICHolder::holder_klass_offset(), G4_interface); __ lookup_interface_method(// inputs: rec. class, interface, itable index @@ -179,6 +197,9 @@ L_no_such_interface, /*return_method=*/ false); + const ptrdiff_t typecheckSize = __ pc() - start_pc; + start_pc = __ pc(); + // Get Method* and entrypoint for compiler __ ld_ptr(G5_icholder, CompiledICHolder::holder_metadata_offset(), G4_interface); __ lookup_interface_method(// inputs: rec. class, interface, itable index @@ -187,6 +208,19 @@ L5_method, L2, L3, L_no_such_interface); + const ptrdiff_t lookupSize = __ pc() - start_pc; + + // Reduce "estimate" such that "padding" does not drop below 8. + // Do not target a left-over number of zero, because a very + // large vtable or itable offset (> 4K) will require an extra + // sethi/or pair of instructions. + // Found typecheck(60) + lookup(72) to exceed previous extimate (32*4). + const ptrdiff_t estimate = 36*BytesPerInstWord; + const ptrdiff_t codesize = typecheckSize + lookupSize + index_dependent_slop; + slop_delta = (int)(estimate - codesize); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); + #ifndef PRODUCT if (DebugVtables) { Label L01; @@ -222,88 +256,12 @@ __ delayed()->restore(); masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, index_dependent_slop); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", - itable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one - assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); - - s->set_exception_points(npe_addr, ame_addr); return s; } - -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (DebugVtables || CountCompiledCalls || VerifyOops) return 1000; - else { - const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets) - if (is_vtable_stub) { - // ld;ld;ld,jmp,nop - const int basic = 5*BytesPerInstWord + - // shift;add for load_klass (only shift with zero heap based) - (UseCompressedClassPointers ? - MacroAssembler::instr_size_for_decode_klass_not_null() : 0); - return basic + slop; - } else { - const int basic = 54 * BytesPerInstWord + - // shift;add for load_klass (only shift with zero heap based) - (UseCompressedClassPointers ? - MacroAssembler::instr_size_for_decode_klass_not_null() : 0); - return (basic + slop); - } - } - - // In order to tune these parameters, run the JVM with VM options - // +PrintMiscellaneous and +WizardMode to see information about - // actual itable stubs. Look for lines like this: - // itable #1 at 0x5551212[116] left over: 8 - // Reduce the constants so that the "left over" number is 8 - // Do not aim at a left-over number of zero, because a very - // large vtable or itable offset (> 4K) will require an extra - // sethi/or pair of instructions. - // - // The JVM98 app. _202_jess has a megamorphic interface call. - // The itable code looks like this: - // Decoding VtableStub itbl[1]@16 - // ld [ %o0 + 4 ], %g3 - // save %sp, -64, %sp - // ld [ %g3 + 0xe8 ], %l2 - // sll %l2, 2, %l2 - // add %l2, 0x134, %l2 - // add %g3, %l2, %l2 - // add %g3, 4, %g3 - // ld [ %l2 ], %l5 - // brz,pn %l5, throw_icce - // cmp %l5, %g5 - // be %icc, success - // add %l2, 8, %l2 - // loop: - // ld [ %l2 ], %l5 - // brz,pn %l5, throw_icce - // cmp %l5, %g5 - // bne,pn %icc, loop - // add %l2, 8, %l2 - // success: - // ld [ %l2 + -4 ], %l2 - // ld [ %g3 + %l2 ], %l5 - // restore %l5, 0, %g5 - // ld [ %g5 + 0x44 ], %g3 - // jmp %g3 - // nop - // throw_icce: - // sethi %hi(throw_ICCE_entry), %g3 - // ! 5 more instructions here, LP64_ONLY - // jmp %g3 + %lo(throw_ICCE_entry) - // restore -} - - int VtableStub::pd_code_alignment() { // UltraSPARC cache line size is 8 instructions: const unsigned int icache_line_size = 32; diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/assembler_x86.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/assembler_x86.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/assembler_x86.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/assembler_x86.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1773,7 +1773,7 @@ void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xE6); emit_int8((unsigned char)(0xC0 | encode)); @@ -1781,7 +1781,7 @@ void Assembler::cvtdq2ps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5B); emit_int8((unsigned char)(0xC0 | encode)); @@ -1889,7 +1889,7 @@ void Assembler::cvttpd2dq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xE6); emit_int8((unsigned char)(0xC0 | encode)); @@ -2199,7 +2199,7 @@ void Assembler::movapd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x28); @@ -2209,7 +2209,7 @@ void Assembler::movaps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x28); emit_int8((unsigned char)(0xC0 | encode)); @@ -2217,7 +2217,7 @@ void Assembler::movlhps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x16); emit_int8((unsigned char)(0xC0 | encode)); @@ -2234,7 +2234,7 @@ void Assembler::movddup(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse3(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x12); @@ -2465,8 +2465,7 @@ void Assembler::movdqa(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_int8((unsigned char)(0xC0 | encode)); @@ -2475,7 +2474,7 @@ void Assembler::movdqa(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2485,7 +2484,7 @@ void Assembler::movdqu(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2494,7 +2493,7 @@ void Assembler::movdqu(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_int8((unsigned char)(0xC0 | encode)); @@ -2503,7 +2502,7 @@ void Assembler::movdqu(Address dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); simd_prefix(src, xnoreg, dst, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); @@ -2514,7 +2513,7 @@ // Move Unaligned 256bit Vector void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) { assert(UseAVX > 0, ""); - InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_int8((unsigned char)(0xC0 | encode)); @@ -2523,7 +2522,7 @@ void Assembler::vmovdqu(XMMRegister dst, Address src) { assert(UseAVX > 0, ""); InstructionMark im(this); - InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2533,7 +2532,7 @@ void Assembler::vmovdqu(Address dst, XMMRegister src) { assert(UseAVX > 0, ""); InstructionMark im(this); - InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); // swap src<->dst for encoding @@ -2581,9 +2580,8 @@ void Assembler::evmovdqub(XMMRegister dst, KRegister mask, Address src, int vector_len) { assert(VM_Version::supports_avx512vlbw(), ""); - assert(is_vector_masking(), ""); // For stub code use only InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_embedded_opmask_register_specifier(mask); attributes.set_is_evex_instruction(); @@ -2605,10 +2603,9 @@ } void Assembler::evmovdquw(XMMRegister dst, KRegister mask, Address src, int vector_len) { - assert(is_vector_masking(), ""); assert(VM_Version::supports_avx512vlbw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_embedded_opmask_register_specifier(mask); attributes.set_is_evex_instruction(); @@ -2646,7 +2643,7 @@ void Assembler::evmovdqul(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2656,7 +2653,7 @@ void Assembler::evmovdqul(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false , /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true , /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); @@ -2668,7 +2665,7 @@ assert(VM_Version::supports_evex(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); attributes.set_is_evex_instruction(); @@ -2679,7 +2676,7 @@ void Assembler::evmovdquq(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2689,7 +2686,7 @@ void Assembler::evmovdquq(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); @@ -2701,7 +2698,7 @@ assert(VM_Version::supports_evex(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); attributes.set_is_evex_instruction(); @@ -2752,7 +2749,7 @@ void Assembler::movlpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -3417,7 +3414,7 @@ void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_len) { assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x00); emit_int8(0xC0 | encode); @@ -3426,7 +3423,7 @@ void Assembler::vperm2i128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8) { assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x46); emit_int8(0xC0 | encode); @@ -3435,7 +3432,7 @@ void Assembler::vperm2f128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x06); emit_int8(0xC0 | encode); @@ -3465,7 +3462,7 @@ void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_2(), ""); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x61); emit_operand(dst, src); @@ -3474,7 +3471,7 @@ void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x61); emit_int8((unsigned char)(0xC0 | encode)); @@ -3484,7 +3481,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::pcmpeqb(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x74); emit_int8((unsigned char)(0xC0 | encode)); @@ -3493,7 +3490,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x74); emit_int8((unsigned char)(0xC0 | encode)); @@ -3512,7 +3509,7 @@ void Assembler::evpcmpgtb(KRegister kdst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx512vlbw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); int dst_enc = kdst->encoding(); @@ -3522,10 +3519,9 @@ } void Assembler::evpcmpgtb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) { - assert(is_vector_masking(), ""); assert(VM_Version::supports_avx512vlbw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); attributes.set_embedded_opmask_register_specifier(mask); @@ -3538,7 +3534,7 @@ void Assembler::evpcmpuw(KRegister kdst, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len) { assert(VM_Version::supports_avx512vlbw(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x3E); @@ -3547,9 +3543,8 @@ } void Assembler::evpcmpuw(KRegister kdst, KRegister mask, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len) { - assert(is_vector_masking(), ""); assert(VM_Version::supports_avx512vlbw(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.reset_is_clear_context(); attributes.set_embedded_opmask_register_specifier(mask); attributes.set_is_evex_instruction(); @@ -3562,7 +3557,7 @@ void Assembler::evpcmpuw(KRegister kdst, XMMRegister nds, Address src, ComparisonPredicate vcc, int vector_len) { assert(VM_Version::supports_avx512vlbw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); int dst_enc = kdst->encoding(); @@ -3575,7 +3570,7 @@ void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx512bw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); int dst_enc = kdst->encoding(); @@ -3586,9 +3581,8 @@ void Assembler::evpcmpeqb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx512vlbw(), ""); - assert(is_vector_masking(), ""); // For stub code use only InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_reg_mask */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_reg_mask */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); attributes.set_embedded_opmask_register_specifier(mask); @@ -3601,7 +3595,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::pcmpeqw(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x75); emit_int8((unsigned char)(0xC0 | encode)); @@ -3610,7 +3604,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x75); emit_int8((unsigned char)(0xC0 | encode)); @@ -3641,7 +3635,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x76); emit_int8((unsigned char)(0xC0 | encode)); @@ -3650,7 +3644,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::vpcmpeqd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x76); emit_int8((unsigned char)(0xC0 | encode)); @@ -3659,7 +3653,7 @@ // In this context, kdst is written the mask used to process the equal components void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); attributes.reset_is_clear_context(); int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -3670,7 +3664,7 @@ void Assembler::evpcmpeqd(KRegister kdst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); attributes.reset_is_clear_context(); attributes.set_is_evex_instruction(); @@ -3683,7 +3677,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::pcmpeqq(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x29); emit_int8((unsigned char)(0xC0 | encode)); @@ -3692,7 +3686,7 @@ // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::vpcmpeqq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x29); emit_int8((unsigned char)(0xC0 | encode)); @@ -3701,7 +3695,7 @@ // In this context, kdst is written the mask used to process the equal components void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.reset_is_clear_context(); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -3713,7 +3707,7 @@ void Assembler::evpcmpeqq(KRegister kdst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.reset_is_clear_context(); attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); @@ -3725,7 +3719,7 @@ void Assembler::pmovmskb(Register dst, XMMRegister src) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD7); emit_int8((unsigned char)(0xC0 | encode)); @@ -3733,7 +3727,7 @@ void Assembler::vpmovmskb(Register dst, XMMRegister src) { assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD7); emit_int8((unsigned char)(0xC0 | encode)); @@ -3741,7 +3735,7 @@ void Assembler::pextrd(Register dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x16); emit_int8((unsigned char)(0xC0 | encode)); @@ -3750,7 +3744,7 @@ void Assembler::pextrd(Address dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit); simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x16); @@ -3760,7 +3754,7 @@ void Assembler::pextrq(Register dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x16); emit_int8((unsigned char)(0xC0 | encode)); @@ -3769,7 +3763,7 @@ void Assembler::pextrq(Address dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x16); @@ -3779,7 +3773,7 @@ void Assembler::pextrw(Register dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xC5); emit_int8((unsigned char)(0xC0 | encode)); @@ -3788,7 +3782,7 @@ void Assembler::pextrw(Address dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_16bit); simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x15); @@ -3798,7 +3792,7 @@ void Assembler::pextrb(Address dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_8bit); simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x14); @@ -3808,7 +3802,7 @@ void Assembler::pinsrd(XMMRegister dst, Register src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x22); emit_int8((unsigned char)(0xC0 | encode)); @@ -3817,7 +3811,7 @@ void Assembler::pinsrd(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x22); @@ -3827,7 +3821,7 @@ void Assembler::pinsrq(XMMRegister dst, Register src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x22); emit_int8((unsigned char)(0xC0 | encode)); @@ -3836,7 +3830,7 @@ void Assembler::pinsrq(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x22); @@ -3846,7 +3840,7 @@ void Assembler::pinsrw(XMMRegister dst, Register src, int imm8) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xC4); emit_int8((unsigned char)(0xC0 | encode)); @@ -3855,7 +3849,7 @@ void Assembler::pinsrw(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse2(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_16bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xC4); @@ -3865,7 +3859,7 @@ void Assembler::pinsrb(XMMRegister dst, Address src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_8bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x20); @@ -3876,7 +3870,7 @@ void Assembler::pmovzxbw(XMMRegister dst, Address src) { assert(VM_Version::supports_sse4_1(), ""); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x30); @@ -3885,7 +3879,7 @@ void Assembler::pmovzxbw(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x30); emit_int8((unsigned char)(0xC0 | encode)); @@ -3895,7 +3889,7 @@ assert(VM_Version::supports_avx(), ""); InstructionMark im(this); assert(dst != xnoreg, "sanity"); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x30); @@ -3906,7 +3900,7 @@ assert(vector_len == AVX_128bit? VM_Version::supports_avx() : vector_len == AVX_256bit? VM_Version::supports_avx2() : vector_len == AVX_512bit? VM_Version::supports_avx512bw() : 0, ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x30); emit_int8((unsigned char) (0xC0 | encode)); @@ -3914,11 +3908,10 @@ void Assembler::evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len) { - assert(is_vector_masking(), ""); assert(VM_Version::supports_avx512vlbw(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_embedded_opmask_register_specifier(mask); attributes.set_is_evex_instruction(); @@ -3930,7 +3923,7 @@ assert(VM_Version::supports_avx512vlbw(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes); @@ -3939,11 +3932,10 @@ } void Assembler::evpmovwb(Address dst, KRegister mask, XMMRegister src, int vector_len) { - assert(is_vector_masking(), ""); assert(VM_Version::supports_avx512vlbw(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); attributes.reset_is_clear_context(); attributes.set_embedded_opmask_register_specifier(mask); @@ -3957,7 +3949,7 @@ assert(VM_Version::supports_evex(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_QVM, /* input_size_in_bits */ EVEX_NObit); attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes); @@ -3969,7 +3961,7 @@ assert(vector_len == AVX_128bit? VM_Version::supports_avx() : vector_len == AVX_256bit? VM_Version::supports_avx2() : vector_len == AVX_512bit? VM_Version::supports_evex() : 0, " "); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x33); emit_int8((unsigned char)(0xC0 | encode)); @@ -4002,7 +3994,7 @@ void Assembler::vpopcntd(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_vpopcntdq(), "must support vpopcntdq feature"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x55); @@ -4082,7 +4074,7 @@ void Assembler::pshufb(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_ssse3(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x00); emit_int8((unsigned char)(0xC0 | encode)); @@ -4101,7 +4093,7 @@ void Assembler::pshufb(XMMRegister dst, Address src) { assert(VM_Version::supports_ssse3(), ""); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x00); @@ -4112,7 +4104,7 @@ assert(isByte(mode), "invalid value"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x70); emit_int8((unsigned char)(0xC0 | encode)); @@ -4124,7 +4116,7 @@ vector_len == AVX_256bit? VM_Version::supports_avx2() : 0, ""); NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x70); emit_int8((unsigned char)(0xC0 | encode)); @@ -4136,7 +4128,7 @@ NOT_LP64(assert(VM_Version::supports_sse2(), "")); assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x70); @@ -4147,7 +4139,7 @@ void Assembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) { assert(isByte(mode), "invalid value"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x70); emit_int8((unsigned char)(0xC0 | encode)); @@ -4159,7 +4151,7 @@ NOT_LP64(assert(VM_Version::supports_sse2(), "")); assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x70); @@ -4180,7 +4172,7 @@ void Assembler::psrldq(XMMRegister dst, int shift) { // Shift left 128 bit value in dst XMMRegister by shift number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); emit_int8((unsigned char)(0xC0 | encode)); @@ -4190,7 +4182,7 @@ void Assembler::pslldq(XMMRegister dst, int shift) { // Shift left 128 bit value in dst XMMRegister by shift number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); // XMM7 is for /7 encoding: 66 0F 73 /7 ib int encode = simd_prefix_and_encode(xmm7, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); @@ -4202,7 +4194,7 @@ assert(VM_Version::supports_sse4_1(), ""); assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x17); emit_operand(dst, src); @@ -4210,7 +4202,7 @@ void Assembler::ptest(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x17); emit_int8((unsigned char)(0xC0 | encode)); @@ -4219,7 +4211,7 @@ void Assembler::vptest(XMMRegister dst, Address src) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); assert(dst != xnoreg, "sanity"); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -4229,7 +4221,7 @@ void Assembler::vptest(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x17); emit_int8((unsigned char)(0xC0 | encode)); @@ -4239,7 +4231,7 @@ NOT_LP64(assert(VM_Version::supports_sse2(), "")); assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x60); @@ -4248,7 +4240,7 @@ void Assembler::punpcklbw(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x60); emit_int8((unsigned char)(0xC0 | encode)); @@ -4258,7 +4250,7 @@ NOT_LP64(assert(VM_Version::supports_sse2(), "")); assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes"); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x62); @@ -4267,7 +4259,7 @@ void Assembler::punpckldq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x62); emit_int8((unsigned char)(0xC0 | encode)); @@ -4275,7 +4267,7 @@ void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x6C); @@ -4324,7 +4316,7 @@ void Assembler::rcpps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x53); emit_int8((unsigned char)(0xC0 | encode)); @@ -4332,7 +4324,7 @@ void Assembler::rcpss(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x53); emit_int8((unsigned char)(0xC0 | encode)); @@ -4456,7 +4448,7 @@ void Assembler::palignr(XMMRegister dst, XMMRegister src, int imm8) { assert(VM_Version::supports_ssse3(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x0F); emit_int8((unsigned char)(0xC0 | encode)); @@ -4467,7 +4459,7 @@ assert(vector_len == AVX_128bit? VM_Version::supports_avx() : vector_len == AVX_256bit? VM_Version::supports_avx2() : 0, ""); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x0F); emit_int8((unsigned char)(0xC0 | encode)); @@ -4476,7 +4468,8 @@ void Assembler::evalignq(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x3); emit_int8((unsigned char)(0xC0 | encode)); @@ -4628,7 +4621,7 @@ if (UseAVX > 0 ) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); vex_prefix(dst, 0, 0, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xAE); emit_operand(as_Register(3), dst); @@ -5102,7 +5095,7 @@ void Assembler::addpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); @@ -5112,7 +5105,7 @@ void Assembler::addpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5123,7 +5116,7 @@ void Assembler::addps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -5131,7 +5124,7 @@ void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); @@ -5140,7 +5133,7 @@ void Assembler::vaddps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -5149,7 +5142,7 @@ void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5160,7 +5153,7 @@ void Assembler::vaddps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x58); @@ -5169,7 +5162,7 @@ void Assembler::subpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); @@ -5178,7 +5171,7 @@ void Assembler::subps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -5186,7 +5179,7 @@ void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); @@ -5195,7 +5188,7 @@ void Assembler::vsubps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -5204,7 +5197,7 @@ void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5215,7 +5208,7 @@ void Assembler::vsubps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); @@ -5224,7 +5217,7 @@ void Assembler::mulpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); @@ -5234,7 +5227,7 @@ void Assembler::mulpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5244,7 +5237,7 @@ void Assembler::mulps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -5252,7 +5245,7 @@ void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); @@ -5261,7 +5254,7 @@ void Assembler::vmulps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -5270,7 +5263,7 @@ void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5281,7 +5274,7 @@ void Assembler::vmulps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x59); @@ -5290,7 +5283,7 @@ void Assembler::vfmadd231pd(XMMRegister dst, XMMRegister src1, XMMRegister src2, int vector_len) { assert(VM_Version::supports_fma(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xB8); emit_int8((unsigned char)(0xC0 | encode)); @@ -5298,7 +5291,7 @@ void Assembler::vfmadd231ps(XMMRegister dst, XMMRegister src1, XMMRegister src2, int vector_len) { assert(VM_Version::supports_fma(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xB8); emit_int8((unsigned char)(0xC0 | encode)); @@ -5307,7 +5300,7 @@ void Assembler::vfmadd231pd(XMMRegister dst, XMMRegister src1, Address src2, int vector_len) { assert(VM_Version::supports_fma(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xB8); @@ -5317,7 +5310,7 @@ void Assembler::vfmadd231ps(XMMRegister dst, XMMRegister src1, Address src2, int vector_len) { assert(VM_Version::supports_fma(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src2, src1->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xB8); @@ -5326,7 +5319,7 @@ void Assembler::divpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); @@ -5335,7 +5328,7 @@ void Assembler::divps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -5343,7 +5336,7 @@ void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); @@ -5352,7 +5345,7 @@ void Assembler::vdivps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -5361,7 +5354,7 @@ void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5372,7 +5365,7 @@ void Assembler::vdivps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); @@ -5381,7 +5374,7 @@ void Assembler::vsqrtpd(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x51); @@ -5391,7 +5384,7 @@ void Assembler::vsqrtpd(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5401,7 +5394,7 @@ void Assembler::vsqrtps(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x51); emit_int8((unsigned char)(0xC0 | encode)); @@ -5410,7 +5403,7 @@ void Assembler::vsqrtps(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x51); @@ -5419,7 +5412,7 @@ void Assembler::andpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); @@ -5428,7 +5421,7 @@ void Assembler::andps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_int8((unsigned char)(0xC0 | encode)); @@ -5437,7 +5430,7 @@ void Assembler::andps(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x54); @@ -5447,7 +5440,7 @@ void Assembler::andpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5457,7 +5450,7 @@ void Assembler::vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); @@ -5466,7 +5459,7 @@ void Assembler::vandps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_int8((unsigned char)(0xC0 | encode)); @@ -5475,7 +5468,7 @@ void Assembler::vandpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5486,7 +5479,7 @@ void Assembler::vandps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x54); @@ -5495,7 +5488,7 @@ void Assembler::unpckhpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x15); @@ -5504,7 +5497,7 @@ void Assembler::unpcklpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x14); @@ -5513,7 +5506,7 @@ void Assembler::xorpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); @@ -5522,7 +5515,7 @@ void Assembler::xorps(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_int8((unsigned char)(0xC0 | encode)); @@ -5531,7 +5524,7 @@ void Assembler::xorpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5542,7 +5535,7 @@ void Assembler::xorps(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); simd_prefix(dst, dst, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x57); @@ -5551,7 +5544,7 @@ void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); @@ -5560,7 +5553,7 @@ void Assembler::vxorps(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_int8((unsigned char)(0xC0 | encode)); @@ -5569,7 +5562,7 @@ void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5580,7 +5573,7 @@ void Assembler::vxorps(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8(0x57); @@ -5591,7 +5584,7 @@ void Assembler::vphaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx() && (vector_len == 0) || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x01); emit_int8((unsigned char)(0xC0 | encode)); @@ -5600,7 +5593,7 @@ void Assembler::vphaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx() && (vector_len == 0) || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x02); emit_int8((unsigned char)(0xC0 | encode)); @@ -5624,7 +5617,7 @@ void Assembler::paddd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFE); emit_int8((unsigned char)(0xC0 | encode)); @@ -5633,7 +5626,7 @@ void Assembler::paddd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFE); emit_operand(dst, src); @@ -5641,7 +5634,7 @@ void Assembler::paddq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD4); @@ -5650,7 +5643,7 @@ void Assembler::phaddw(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse3(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x01); emit_int8((unsigned char)(0xC0 | encode)); @@ -5658,7 +5651,7 @@ void Assembler::phaddd(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse3(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x02); emit_int8((unsigned char)(0xC0 | encode)); @@ -5682,7 +5675,7 @@ void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFE); emit_int8((unsigned char)(0xC0 | encode)); @@ -5690,7 +5683,7 @@ void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD4); @@ -5720,7 +5713,7 @@ void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFE); @@ -5730,7 +5723,7 @@ void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5755,7 +5748,7 @@ } void Assembler::psubd(XMMRegister dst, XMMRegister src) { - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFA); emit_int8((unsigned char)(0xC0 | encode)); @@ -5763,7 +5756,7 @@ void Assembler::psubq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFB); @@ -5788,7 +5781,7 @@ void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFA); emit_int8((unsigned char)(0xC0 | encode)); @@ -5796,7 +5789,7 @@ void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFB); @@ -5826,7 +5819,7 @@ void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFA); @@ -5836,7 +5829,7 @@ void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -5854,7 +5847,7 @@ void Assembler::pmulld(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse4_1(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); emit_int8((unsigned char)(0xC0 | encode)); @@ -5870,7 +5863,7 @@ void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); emit_int8((unsigned char)(0xC0 | encode)); @@ -5878,7 +5871,7 @@ void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 2, "requires some form of EVEX"); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); @@ -5898,7 +5891,7 @@ void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); @@ -5908,7 +5901,7 @@ void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 2, "requires some form of EVEX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); attributes.set_is_evex_instruction(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -5929,7 +5922,7 @@ void Assembler::pslld(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM6 is for /6 encoding: 66 0F 72 /6 ib int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -5939,7 +5932,7 @@ void Assembler::psllq(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM6 is for /6 encoding: 66 0F 73 /6 ib int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); @@ -5957,7 +5950,7 @@ void Assembler::pslld(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF2); emit_int8((unsigned char)(0xC0 | encode)); @@ -5965,7 +5958,7 @@ void Assembler::psllq(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF3); @@ -5985,7 +5978,7 @@ void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM6 is for /6 encoding: 66 0F 72 /6 ib int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -5995,7 +5988,7 @@ void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); // XMM6 is for /6 encoding: 66 0F 73 /6 ib int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -6014,7 +6007,7 @@ void Assembler::vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF2); emit_int8((unsigned char)(0xC0 | encode)); @@ -6022,7 +6015,7 @@ void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF3); @@ -6042,7 +6035,7 @@ void Assembler::psrld(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM2 is for /2 encoding: 66 0F 72 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -6054,7 +6047,7 @@ // Do not confuse it with psrldq SSE2 instruction which // shifts 128 bit value in xmm register by number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); // XMM2 is for /2 encoding: 66 0F 73 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -6073,7 +6066,7 @@ void Assembler::psrld(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD2); emit_int8((unsigned char)(0xC0 | encode)); @@ -6081,7 +6074,7 @@ void Assembler::psrlq(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD3); @@ -6100,7 +6093,7 @@ void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM2 is for /2 encoding: 66 0F 72 /2 ib int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -6110,7 +6103,7 @@ void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); // XMM2 is for /2 encoding: 66 0F 73 /2 ib int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); @@ -6129,7 +6122,7 @@ void Assembler::vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD2); emit_int8((unsigned char)(0xC0 | encode)); @@ -6137,7 +6130,7 @@ void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD3); @@ -6146,7 +6139,7 @@ void Assembler::evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx512bw(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x10); @@ -6155,7 +6148,7 @@ void Assembler::evpsllvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx512bw(), ""); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x12); @@ -6175,7 +6168,7 @@ void Assembler::psrad(XMMRegister dst, int shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM4 is for /4 encoding: 66 0F 72 /4 ib int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -6193,7 +6186,7 @@ void Assembler::psrad(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xE2); emit_int8((unsigned char)(0xC0 | encode)); @@ -6211,7 +6204,7 @@ void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); // XMM4 is for /4 encoding: 66 0F 71 /4 ib int encode = vex_prefix_and_encode(xmm4->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x72); @@ -6229,7 +6222,7 @@ void Assembler::vpsrad(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xE2); emit_int8((unsigned char)(0xC0 | encode)); @@ -6239,7 +6232,7 @@ // logical operations packed integers void Assembler::pand(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6247,7 +6240,7 @@ void Assembler::vpand(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6256,7 +6249,7 @@ void Assembler::vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDB); @@ -6265,7 +6258,7 @@ void Assembler::vpandq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6274,16 +6267,25 @@ void Assembler::pandn(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDF); emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::vpandn(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0xDF); + emit_int8((unsigned char)(0xC0 | encode)); +} + + void Assembler::por(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6291,7 +6293,7 @@ void Assembler::vpor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6300,7 +6302,7 @@ void Assembler::vpor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEB); @@ -6309,7 +6311,7 @@ void Assembler::vporq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEB); emit_int8((unsigned char)(0xC0 | encode)); @@ -6318,7 +6320,7 @@ void Assembler::pxor(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEF); emit_int8((unsigned char)(0xC0 | encode)); @@ -6326,7 +6328,7 @@ void Assembler::vpxor(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEF); emit_int8((unsigned char)(0xC0 | encode)); @@ -6335,7 +6337,7 @@ void Assembler::vpxor(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xEF); @@ -6369,8 +6371,7 @@ void Assembler::vinserti128(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_avx2(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x38); emit_int8((unsigned char)(0xC0 | encode)); @@ -6383,9 +6384,8 @@ assert(VM_Version::supports_avx2(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x38); @@ -6398,7 +6398,8 @@ void Assembler::vinserti32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x38); emit_int8((unsigned char)(0xC0 | encode)); @@ -6413,10 +6414,10 @@ assert(VM_Version::supports_avx(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); - int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); + attributes.set_is_evex_instruction(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x18); emit_operand(dst, src); @@ -6430,9 +6431,10 @@ void Assembler::vinserti64x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); - emit_int8(0x38); + emit_int8(0x3A); emit_int8((unsigned char)(0xC0 | encode)); // 0x00 - insert into lower 256 bits // 0x01 - insert into upper 256 bits @@ -6445,8 +6447,7 @@ void Assembler::vinsertf128(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_avx(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x18); emit_int8((unsigned char)(0xC0 | encode)); @@ -6459,9 +6460,8 @@ assert(VM_Version::supports_avx(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x18); @@ -6472,16 +6472,16 @@ } void Assembler::vinsertf32x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_evex(), ""); + assert(VM_Version::supports_avx2(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x18); emit_int8((unsigned char)(0xC0 | encode)); // 0x00 - insert into q0 128 bits (0..127) // 0x01 - insert into q1 128 bits (128..255) - // 0x02 - insert into q2 128 bits (256..383) - // 0x03 - insert into q3 128 bits (384..511) + // 0x02 - insert into q0 128 bits (256..383) + // 0x03 - insert into q1 128 bits (384..512) emit_int8(imm8 & 0x03); } @@ -6489,24 +6489,24 @@ assert(VM_Version::supports_avx(), ""); assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); - int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x18); emit_operand(dst, src); // 0x00 - insert into q0 128 bits (0..127) // 0x01 - insert into q1 128 bits (128..255) - // 0x02 - insert into q2 128 bits (256..383) - // 0x03 - insert into q3 128 bits (384..511) + // 0x02 - insert into q0 128 bits (256..383) + // 0x03 - insert into q1 128 bits (384..512) emit_int8(imm8 & 0x03); } void Assembler::vinsertf64x4(XMMRegister dst, XMMRegister nds, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x1A); emit_int8((unsigned char)(0xC0 | encode)); @@ -6520,8 +6520,9 @@ assert(dst != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); InstructionMark im(this); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_64bit); + attributes.set_is_evex_instruction(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x1A); emit_operand(dst, src); @@ -6534,10 +6535,9 @@ // vextracti forms void Assembler::vextracti128(XMMRegister dst, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_avx(), ""); + assert(VM_Version::supports_avx2(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x39); emit_int8((unsigned char)(0xC0 | encode)); @@ -6550,9 +6550,8 @@ assert(VM_Version::supports_avx2(), ""); assert(src != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); attributes.reset_is_clear_context(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); @@ -6564,10 +6563,10 @@ } void Assembler::vextracti32x4(XMMRegister dst, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_avx(), ""); + assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x39); emit_int8((unsigned char)(0xC0 | encode)); @@ -6583,9 +6582,10 @@ assert(src != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); InstructionMark im(this); - InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); attributes.reset_is_clear_context(); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x39); emit_operand(src, dst); @@ -6599,7 +6599,8 @@ void Assembler::vextracti64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_avx512dq(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x39); emit_int8((unsigned char)(0xC0 | encode)); @@ -6613,7 +6614,8 @@ void Assembler::vextracti64x4(XMMRegister dst, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x3B); emit_int8((unsigned char)(0xC0 | encode)); @@ -6622,14 +6624,28 @@ emit_int8(imm8 & 0x01); } - +void Assembler::vextracti64x4(Address dst, XMMRegister src, uint8_t imm8) { + assert(VM_Version::supports_evex(), ""); + assert(src != xnoreg, "sanity"); + assert(imm8 <= 0x01, "imm8: %u", imm8); + InstructionMark im(this); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_64bit); + attributes.reset_is_clear_context(); + attributes.set_is_evex_instruction(); + vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8(0x38); + emit_operand(src, dst); + // 0x00 - extract from lower 256 bits + // 0x01 - extract from upper 256 bits + emit_int8(imm8 & 0x01); +} // vextractf forms void Assembler::vextractf128(XMMRegister dst, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_avx(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); @@ -6642,9 +6658,8 @@ assert(VM_Version::supports_avx(), ""); assert(src != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); - int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_256bit; InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); attributes.reset_is_clear_context(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); @@ -6656,10 +6671,10 @@ } void Assembler::vextractf32x4(XMMRegister dst, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_avx(), ""); + assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - int vector_len = VM_Version::supports_evex() ? AVX_512bit : AVX_256bit; - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); @@ -6675,9 +6690,10 @@ assert(src != xnoreg, "sanity"); assert(imm8 <= 0x03, "imm8: %u", imm8); InstructionMark im(this); - InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4, /* input_size_in_bits */ EVEX_32bit); attributes.reset_is_clear_context(); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x19); emit_operand(src, dst); @@ -6691,7 +6707,8 @@ void Assembler::vextractf64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_avx512dq(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); @@ -6705,7 +6722,8 @@ void Assembler::vextractf64x4(XMMRegister dst, XMMRegister src, uint8_t imm8) { assert(VM_Version::supports_evex(), ""); assert(imm8 <= 0x01, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x1B); emit_int8((unsigned char)(0xC0 | encode)); @@ -6719,9 +6737,10 @@ assert(src != xnoreg, "sanity"); assert(imm8 <= 0x01, "imm8: %u", imm8); InstructionMark im(this); - InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T4,/* input_size_in_bits */ EVEX_64bit); attributes.reset_is_clear_context(); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x1B); emit_operand(src, dst); @@ -6730,38 +6749,17 @@ emit_int8(imm8 & 0x01); } - -// legacy word/dword replicate -void Assembler::vpbroadcastw(XMMRegister dst, XMMRegister src) { - assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); - int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - emit_int8(0x79); - emit_int8((unsigned char)(0xC0 | encode)); -} - -void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) { - assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(AVX_256bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); - int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - emit_int8(0x58); - emit_int8((unsigned char)(0xC0 | encode)); -} - - -// xmm/mem sourced byte/word/dword/qword replicate - // duplicate 1-byte integer data from src into programmed locations in dest : requires AVX512BW and AVX512VL -void Assembler::evpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x78); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastb(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastb(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); @@ -6773,16 +6771,16 @@ } // duplicate 2-byte integer data from src into programmed locations in dest : requires AVX512BW and AVX512VL -void Assembler::evpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x79); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastw(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastw(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); @@ -6793,20 +6791,22 @@ emit_operand(dst, src); } +// xmm/mem sourced byte/word/dword/qword replicate + // duplicate 4-byte integer data from src into programmed locations in dest : requires AVX512VL -void Assembler::evpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); +void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len) { + assert(UseAVX >= 2, ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastd(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastd(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -6815,20 +6815,20 @@ } // duplicate 8-byte integer data from src into programmed locations in dest : requires AVX512VL -void Assembler::evpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); +void Assembler::vpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastq(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastq(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx2(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); // swap src<->dst for encoding @@ -6839,7 +6839,7 @@ void Assembler::evbroadcasti64x2(XMMRegister dst, XMMRegister src, int vector_len) { assert(vector_len != Assembler::AVX_128bit, ""); assert(VM_Version::supports_avx512dq(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x5A); @@ -6851,7 +6851,7 @@ assert(VM_Version::supports_avx512dq(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); attributes.set_address_attributes(/* tuple_type */ EVEX_T2, /* input_size_in_bits */ EVEX_64bit); // swap src<->dst for encoding @@ -6863,19 +6863,19 @@ // scalar single/double precision replicate // duplicate single precision data from src into programmed locations in dest : requires AVX512VL -void Assembler::evpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); +void Assembler::vpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x18); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastss(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastss(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -6884,20 +6884,20 @@ } // duplicate double precision data from src into programmed locations in dest : requires AVX512VL -void Assembler::evpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); +void Assembler::vpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx(), ""); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); } -void Assembler::evpbroadcastsd(XMMRegister dst, Address src, int vector_len) { - assert(VM_Version::supports_evex(), ""); +void Assembler::vpbroadcastsd(XMMRegister dst, Address src, int vector_len) { + assert(VM_Version::supports_avx(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); attributes.set_rex_vex_w_reverted(); // swap src<->dst for encoding @@ -6911,7 +6911,7 @@ // duplicate 1-byte integer data from src into programmed locations in dest : requires AVX512BW and AVX512VL void Assembler::evpbroadcastb(XMMRegister dst, Register src, int vector_len) { - assert(VM_Version::supports_evex(), ""); + assert(VM_Version::supports_avx512bw(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -6921,7 +6921,7 @@ // duplicate 2-byte integer data from src into programmed locations in dest : requires AVX512BW and AVX512VL void Assembler::evpbroadcastw(XMMRegister dst, Register src, int vector_len) { - assert(VM_Version::supports_evex(), ""); + assert(VM_Version::supports_avx512bw(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -6932,7 +6932,7 @@ // duplicate 4-byte integer data from src into programmed locations in dest : requires AVX512VL void Assembler::evpbroadcastd(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x7C); @@ -6942,7 +6942,7 @@ // duplicate 8-byte integer data from src into programmed locations in dest : requires AVX512VL void Assembler::evpbroadcastq(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x7C); @@ -6967,7 +6967,7 @@ // Carry-Less Multiplication Quadword void Assembler::pclmulqdq(XMMRegister dst, XMMRegister src, int mask) { assert(VM_Version::supports_clmul(), ""); - InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x44); emit_int8((unsigned char)(0xC0 | encode)); @@ -6977,7 +6977,7 @@ // Carry-Less Multiplication Quadword void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) { assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), ""); - InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x44); emit_int8((unsigned char)(0xC0 | encode)); @@ -7568,7 +7568,7 @@ emit_int8(byte3); // P2: byte 4 as zL'Lbv'aaa - // kregs are implemented in the low 3 bits as aaa (hard code k1, it will be initialized for now) + // kregs are implemented in the low 3 bits as aaa int byte4 = (_attributes->is_no_reg_mask()) ? 0 : _attributes->get_embedded_opmask_register_specifier(); @@ -7597,35 +7597,25 @@ set_attributes(attributes); attributes->set_current_assembler(this); - // if vector length is turned off, revert to AVX for vectors smaller than 512-bit - if (UseAVX > 2 && _legacy_mode_vl && attributes->uses_vl()) { - switch (attributes->get_vector_len()) { - case AVX_128bit: - case AVX_256bit: - attributes->set_is_legacy_mode(); - break; - } - } - - // For pure EVEX check and see if this instruction - // is allowed in legacy mode and has resources which will - // fit in it. Pure EVEX instructions will use set_is_evex_instruction in their definition, - // else that field is set when we encode to EVEX - if (UseAVX > 2 && !attributes->is_legacy_mode() && - !_is_managed && !attributes->is_evex_instruction()) { - if (!_legacy_mode_vl && attributes->get_vector_len() != AVX_512bit) { - bool check_register_bank = NOT_IA32(true) IA32_ONLY(false); - if (check_register_bank) { - // check nds_enc and xreg_enc for upper bank usage - if (nds_enc < 16 && xreg_enc < 16) { + // For EVEX instruction (which is not marked as pure EVEX instruction) check and see if this instruction + // is allowed in legacy mode and has resources which will fit in it. + // Pure EVEX instructions will have is_evex_instruction set in their definition. + if (!attributes->is_legacy_mode()) { + if (UseAVX > 2 && !attributes->is_evex_instruction() && !_is_managed) { + if ((attributes->get_vector_len() != AVX_512bit) && (nds_enc < 16) && (xreg_enc < 16)) { attributes->set_is_legacy_mode(); - } - } else { - attributes->set_is_legacy_mode(); } } } + if (UseAVX > 2) { + assert(((!attributes->uses_vl()) || + (attributes->get_vector_len() == AVX_512bit) || + (!_legacy_mode_vl) || + (attributes->is_legacy_mode())),"XMM register should be 0-15"); + assert(((nds_enc < 16 && xreg_enc < 16) || (!attributes->is_legacy_mode())),"XMM register should be 0-15"); + } + _is_managed = false; if (UseAVX > 2 && !attributes->is_legacy_mode()) { @@ -7653,43 +7643,31 @@ bool vex_x = false; set_attributes(attributes); attributes->set_current_assembler(this); - bool check_register_bank = NOT_IA32(true) IA32_ONLY(false); - // if vector length is turned off, revert to AVX for vectors smaller than 512-bit - if (UseAVX > 2 && _legacy_mode_vl && attributes->uses_vl()) { - switch (attributes->get_vector_len()) { - case AVX_128bit: - case AVX_256bit: - if (check_register_bank) { - if (dst_enc >= 16 || nds_enc >= 16 || src_enc >= 16) { - // up propagate arithmetic instructions to meet RA requirements - attributes->set_vector_len(AVX_512bit); - } else { + // For EVEX instruction (which is not marked as pure EVEX instruction) check and see if this instruction + // is allowed in legacy mode and has resources which will fit in it. + // Pure EVEX instructions will have is_evex_instruction set in their definition. + if (!attributes->is_legacy_mode()) { + if (UseAVX > 2 && !attributes->is_evex_instruction() && !_is_managed) { + if ((!attributes->uses_vl() || (attributes->get_vector_len() != AVX_512bit)) && + (dst_enc < 16) && (nds_enc < 16) && (src_enc < 16)) { attributes->set_is_legacy_mode(); - } - } else { - attributes->set_is_legacy_mode(); } - break; } } - // For pure EVEX check and see if this instruction - // is allowed in legacy mode and has resources which will - // fit in it. Pure EVEX instructions will use set_is_evex_instruction in their definition, - // else that field is set when we encode to EVEX - if (UseAVX > 2 && !attributes->is_legacy_mode() && - !_is_managed && !attributes->is_evex_instruction()) { - if (!_legacy_mode_vl && attributes->get_vector_len() != AVX_512bit) { - if (check_register_bank) { - // check dst_enc, nds_enc and src_enc for upper bank usage - if (dst_enc < 16 && nds_enc < 16 && src_enc < 16) { - attributes->set_is_legacy_mode(); - } - } else { - attributes->set_is_legacy_mode(); - } - } + if (UseAVX > 2) { + // All the scalar fp instructions (with uses_vl as false) can have legacy_mode as false + // Instruction with uses_vl true are vector instructions + // All the vector instructions with AVX_512bit length can have legacy_mode as false + // All the vector instructions with < AVX_512bit length can have legacy_mode as false if AVX512vl() is supported + // Rest all should have legacy_mode set as true + assert(((!attributes->uses_vl()) || + (attributes->get_vector_len() == AVX_512bit) || + (!_legacy_mode_vl) || + (attributes->is_legacy_mode())),"XMM register should be 0-15"); + // Instruction with legacy_mode true should have dst, nds and src < 15 + assert(((dst_enc < 16 && nds_enc < 16 && src_enc < 16) || (!attributes->is_legacy_mode())),"XMM register should be 0-15"); } _is_managed = false; @@ -7741,7 +7719,7 @@ void Assembler::cmppd(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) { assert(VM_Version::supports_avx(), ""); assert(!VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xC2); emit_int8((unsigned char)(0xC0 | encode)); @@ -7751,7 +7729,7 @@ void Assembler::blendvpd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) { assert(VM_Version::supports_avx(), ""); assert(!VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x4B); emit_int8((unsigned char)(0xC0 | encode)); @@ -7762,7 +7740,7 @@ void Assembler::cmpps(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len) { assert(VM_Version::supports_avx(), ""); assert(!VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xC2); emit_int8((unsigned char)(0xC0 | encode)); @@ -7772,7 +7750,7 @@ void Assembler::blendvps(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len) { assert(VM_Version::supports_avx(), ""); assert(!VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x4A); emit_int8((unsigned char)(0xC0 | encode)); @@ -7782,7 +7760,7 @@ void Assembler::vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len) { assert(VM_Version::supports_avx2(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8((unsigned char)0x02); emit_int8((unsigned char)(0xC0 | encode)); @@ -7791,7 +7769,7 @@ void Assembler::shlxl(Register dst, Register src1, Register src2) { assert(VM_Version::supports_bmi2(), ""); - InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src2->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xF7); emit_int8((unsigned char)(0xC0 | encode)); @@ -7799,7 +7777,7 @@ void Assembler::shlxq(Register dst, Register src1, Register src2) { assert(VM_Version::supports_bmi2(), ""); - InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ true); int encode = vex_prefix_and_encode(dst->encoding(), src2->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8((unsigned char)0xF7); emit_int8((unsigned char)(0xC0 | encode)); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/assembler_x86.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/assembler_x86.hpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/assembler_x86.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/assembler_x86.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -871,11 +871,6 @@ void clear_managed(void) { _is_managed = false; } bool is_managed(void) { return _is_managed; } - // Following functions are for stub code use only - void set_vector_masking(void) { _vector_masking = true; } - void clear_vector_masking(void) { _vector_masking = false; } - bool is_vector_masking(void) { return _vector_masking; } - void lea(Register dst, Address src); void mov(Register dst, Register src); @@ -2089,6 +2084,7 @@ // Andn packed integers void pandn(XMMRegister dst, XMMRegister src); + void vpandn(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); // Or packed integers void por(XMMRegister dst, XMMRegister src); @@ -2126,6 +2122,7 @@ void vextracti32x4(Address dst, XMMRegister src, uint8_t imm8); void vextracti64x2(XMMRegister dst, XMMRegister src, uint8_t imm8); void vextracti64x4(XMMRegister dst, XMMRegister src, uint8_t imm8); + void vextracti64x4(Address dst, XMMRegister src, uint8_t imm8); // vextractf forms void vextractf128(XMMRegister dst, XMMRegister src, uint8_t imm8); @@ -2136,28 +2133,24 @@ void vextractf64x4(XMMRegister dst, XMMRegister src, uint8_t imm8); void vextractf64x4(Address dst, XMMRegister src, uint8_t imm8); - // legacy xmm sourced word/dword replicate - void vpbroadcastw(XMMRegister dst, XMMRegister src); - void vpbroadcastd(XMMRegister dst, XMMRegister src); - // xmm/mem sourced byte/word/dword/qword replicate - void evpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastb(XMMRegister dst, Address src, int vector_len); - void evpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastw(XMMRegister dst, Address src, int vector_len); - void evpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastd(XMMRegister dst, Address src, int vector_len); - void evpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastq(XMMRegister dst, Address src, int vector_len); + void vpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastb(XMMRegister dst, Address src, int vector_len); + void vpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastw(XMMRegister dst, Address src, int vector_len); + void vpbroadcastd(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastd(XMMRegister dst, Address src, int vector_len); + void vpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastq(XMMRegister dst, Address src, int vector_len); void evbroadcasti64x2(XMMRegister dst, XMMRegister src, int vector_len); void evbroadcasti64x2(XMMRegister dst, Address src, int vector_len); // scalar single/double precision replicate - void evpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastss(XMMRegister dst, Address src, int vector_len); - void evpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len); - void evpbroadcastsd(XMMRegister dst, Address src, int vector_len); + void vpbroadcastss(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastss(XMMRegister dst, Address src, int vector_len); + void vpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastsd(XMMRegister dst, Address src, int vector_len); // gpr sourced byte/word/dword/qword replicate void evpbroadcastb(XMMRegister dst, Register src, int vector_len); @@ -2204,7 +2197,7 @@ int vector_len, // The length of vector to be applied in encoding - for both AVX and EVEX bool rex_vex_w, // Width of data: if 32-bits or less, false, else if 64-bit or specially defined, true bool legacy_mode, // Details if either this instruction is conditionally encoded to AVX or earlier if true else possibly EVEX - bool no_reg_mask, // when true, k0 is used when EVEX encoding is chosen, else k1 is used under the same condition + bool no_reg_mask, // when true, k0 is used when EVEX encoding is chosen, else embedded_opmask_register_specifier is used bool uses_vl) // This instruction may have legacy constraints based on vector length for EVEX : _avx_vector_len(vector_len), @@ -2220,7 +2213,7 @@ _is_clear_context(true), _is_extended_context(false), _current_assembler(NULL), - _embedded_opmask_register_specifier(1) { // hard code k1, it will be initialized for now + _embedded_opmask_register_specifier(0) { // hard code k0 if (UseAVX < 3) _legacy_mode = true; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -68,7 +68,6 @@ static jlong *double_signflip_pool = double_quadword(&fp_signmask_pool[4*2], (jlong)UCONST64(0x8000000000000000), (jlong)UCONST64(0x8000000000000000)); - NEEDS_CLEANUP // remove this definitions ? const Register IC_Klass = rax; // where the IC klass is cached const Register SYNC_header = rax; // synchronization header @@ -650,7 +649,7 @@ case T_FLOAT: { if (dest->is_single_xmm()) { - if (c->is_zero_float()) { + if (LP64_ONLY(UseAVX < 2 &&) c->is_zero_float()) { __ xorps(dest->as_xmm_float_reg(), dest->as_xmm_float_reg()); } else { __ movflt(dest->as_xmm_float_reg(), @@ -672,7 +671,7 @@ case T_DOUBLE: { if (dest->is_double_xmm()) { - if (c->is_zero_double()) { + if (LP64_ONLY(UseAVX < 2 &&) c->is_zero_double()) { __ xorpd(dest->as_xmm_double_reg(), dest->as_xmm_double_reg()); } else { __ movdbl(dest->as_xmm_double_reg(), @@ -2397,16 +2396,25 @@ } -void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, LIR_Opr dest, LIR_Op* op) { +void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr tmp, LIR_Opr dest, LIR_Op* op) { if (value->is_double_xmm()) { switch(code) { case lir_abs : { - if (dest->as_xmm_double_reg() != value->as_xmm_double_reg()) { - __ movdbl(dest->as_xmm_double_reg(), value->as_xmm_double_reg()); +#ifdef _LP64 + if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { + assert(tmp->is_valid(), "need temporary"); + __ vpandn(dest->as_xmm_double_reg(), tmp->as_xmm_double_reg(), value->as_xmm_double_reg(), 2); + } else +#endif + { + if (dest->as_xmm_double_reg() != value->as_xmm_double_reg()) { + __ movdbl(dest->as_xmm_double_reg(), value->as_xmm_double_reg()); + } + assert(!tmp->is_valid(), "do not need temporary"); + __ andpd(dest->as_xmm_double_reg(), + ExternalAddress((address)double_signmask_pool)); } - __ andpd(dest->as_xmm_double_reg(), - ExternalAddress((address)double_signmask_pool)); } break; @@ -3733,7 +3741,7 @@ } -void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) { +void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp) { if (left->is_single_cpu()) { __ negl(left->as_register()); move_regs(left->as_register(), dest->as_register()); @@ -3758,24 +3766,36 @@ #endif // _LP64 } else if (dest->is_single_xmm()) { - if (left->as_xmm_float_reg() != dest->as_xmm_float_reg()) { - __ movflt(dest->as_xmm_float_reg(), left->as_xmm_float_reg()); - } - if (UseAVX > 0) { - __ vnegatess(dest->as_xmm_float_reg(), dest->as_xmm_float_reg(), - ExternalAddress((address)float_signflip_pool)); - } else { +#ifdef _LP64 + if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { + assert(tmp->is_valid(), "need temporary"); + assert_different_registers(left->as_xmm_float_reg(), tmp->as_xmm_float_reg()); + __ vpxor(dest->as_xmm_float_reg(), tmp->as_xmm_float_reg(), left->as_xmm_float_reg(), 2); + } + else +#endif + { + assert(!tmp->is_valid(), "do not need temporary"); + if (left->as_xmm_float_reg() != dest->as_xmm_float_reg()) { + __ movflt(dest->as_xmm_float_reg(), left->as_xmm_float_reg()); + } __ xorps(dest->as_xmm_float_reg(), ExternalAddress((address)float_signflip_pool)); } } else if (dest->is_double_xmm()) { - if (left->as_xmm_double_reg() != dest->as_xmm_double_reg()) { - __ movdbl(dest->as_xmm_double_reg(), left->as_xmm_double_reg()); - } - if (UseAVX > 0) { - __ vnegatesd(dest->as_xmm_double_reg(), dest->as_xmm_double_reg(), - ExternalAddress((address)double_signflip_pool)); - } else { +#ifdef _LP64 + if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { + assert(tmp->is_valid(), "need temporary"); + assert_different_registers(left->as_xmm_double_reg(), tmp->as_xmm_double_reg()); + __ vpxor(dest->as_xmm_double_reg(), tmp->as_xmm_double_reg(), left->as_xmm_double_reg(), 2); + } + else +#endif + { + assert(!tmp->is_valid(), "do not need temporary"); + if (left->as_xmm_double_reg() != dest->as_xmm_double_reg()) { + __ movdbl(dest->as_xmm_double_reg(), left->as_xmm_double_reg()); + } __ xorpd(dest->as_xmm_double_reg(), ExternalAddress((address)double_signflip_pool)); } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -320,7 +320,21 @@ value.set_destroys_register(); value.load_item(); LIR_Opr reg = rlock(x); - __ negate(value.result(), reg); + + LIR_Opr tmp = LIR_OprFact::illegalOpr; +#ifdef _LP64 + if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { + if (x->type()->tag() == doubleTag) { + tmp = new_register(T_DOUBLE); + __ move(LIR_OprFact::doubleConst(-0.0), tmp); + } + else if (x->type()->tag() == floatTag) { + tmp = new_register(T_FLOAT); + __ move(LIR_OprFact::floatConst(-0.0), tmp); + } + } +#endif + __ negate(value.result(), reg, tmp); set_result(x, round_item(reg)); } @@ -748,8 +762,17 @@ LIR_Opr calc_input = value.result(); LIR_Opr calc_result = rlock_result(x); + LIR_Opr tmp = LIR_OprFact::illegalOpr; +#ifdef _LP64 + if (UseAVX > 2 && (!VM_Version::supports_avx512vl()) && + (x->id() == vmIntrinsics::_dabs)) { + tmp = new_register(T_DOUBLE); + __ move(LIR_OprFact::doubleConst(-0.0), tmp); + } +#endif + switch(x->id()) { - case vmIntrinsics::_dabs: __ abs (calc_input, calc_result, LIR_OprFact::illegalOpr); break; + case vmIntrinsics::_dabs: __ abs (calc_input, calc_result, tmp); break; case vmIntrinsics::_dsqrt: __ sqrt (calc_input, calc_result, LIR_OprFact::illegalOpr); break; default: ShouldNotReachHere(); } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/globals_x86.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/globals_x86.hpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/globals_x86.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/globals_x86.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -119,7 +119,7 @@ product(bool, UseStoreImmI16, true, \ "Use store immediate 16-bits value instruction on x86") \ \ - product(intx, UseAVX, 2, \ + product(intx, UseAVX, 3, \ "Highest supported AVX instructions set on x86/x64") \ range(0, 99) \ \ diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/macroAssembler_x86.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/macroAssembler_x86.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/macroAssembler_x86.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -3123,16 +3123,6 @@ } } -void MacroAssembler::push_zmm(XMMRegister reg) { - lea(rsp, Address(rsp, -64)); // Use lea to not affect flags - evmovdqul(Address(rsp, 0), reg, Assembler::AVX_512bit); -} - -void MacroAssembler::pop_zmm(XMMRegister reg) { - evmovdqul(reg, Address(rsp, 0), Assembler::AVX_512bit); - lea(rsp, Address(rsp, 64)); // Use lea to not affect flags -} - void MacroAssembler::fremr(Register tmp) { save_rax(tmp); { Label L; @@ -3457,7 +3447,9 @@ } } +#ifdef COMPILER2 void MacroAssembler::setvectmask(Register dst, Register src) { + guarantee(PostLoopMultiversioning, "must be"); Assembler::movl(dst, 1); Assembler::shlxl(dst, dst, src); Assembler::decl(dst); @@ -3466,8 +3458,10 @@ } void MacroAssembler::restorevectmask() { + guarantee(PostLoopMultiversioning, "must be"); Assembler::knotwl(k1, k0); } +#endif // COMPILER2 void MacroAssembler::movdbl(XMMRegister dst, AddressLiteral src) { if (reachable(src)) { @@ -3513,27 +3507,18 @@ } void MacroAssembler::movdqu(Address dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl() && (src->encoding() > 15)) { - Assembler::vextractf32x4(dst, src, 0); - } else { + assert(((src->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::movdqu(dst, src); - } } void MacroAssembler::movdqu(XMMRegister dst, Address src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl() && (dst->encoding() > 15)) { - Assembler::vinsertf32x4(dst, dst, src, 0); - } else { + assert(((dst->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::movdqu(dst, src); - } } void MacroAssembler::movdqu(XMMRegister dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - Assembler::evmovdqul(dst, src, Assembler::AVX_512bit); - } else { + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::movdqu(dst, src); - } } void MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src, Register scratchReg) { @@ -3546,28 +3531,18 @@ } void MacroAssembler::vmovdqu(Address dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl() && (src->encoding() > 15)) { - vextractf64x4_low(dst, src); - } else { + assert(((src->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::vmovdqu(dst, src); - } } void MacroAssembler::vmovdqu(XMMRegister dst, Address src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl() && (dst->encoding() > 15)) { - vinsertf64x4_low(dst, src); - } else { + assert(((dst->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::vmovdqu(dst, src); - } } void MacroAssembler::vmovdqu(XMMRegister dst, XMMRegister src) { - if (UseAVX > 2 && !VM_Version::supports_avx512vl()) { - Assembler::evmovdqul(dst, src, Assembler::AVX_512bit); - } - else { + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); Assembler::vmovdqu(dst, src); - } } void MacroAssembler::vmovdqu(XMMRegister dst, AddressLiteral src) { @@ -3851,187 +3826,43 @@ } void MacroAssembler::pcmpeqb(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::pcmpeqb(dst, src); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::pcmpeqb(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pcmpeqb(xmm0, src); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pcmpeqb(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::pcmpeqb(xmm1, xmm0); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::pcmpeqb(dst, src); } void MacroAssembler::pcmpeqw(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::pcmpeqw(dst, src); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::pcmpeqw(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pcmpeqw(xmm0, src); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pcmpeqw(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::pcmpeqw(xmm1, xmm0); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::pcmpeqw(dst, src); } void MacroAssembler::pcmpestri(XMMRegister dst, Address src, int imm8) { - int dst_enc = dst->encoding(); - if (dst_enc < 16) { - Assembler::pcmpestri(dst, src, imm8); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pcmpestri(xmm0, src, imm8); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } + assert((dst->encoding() < 16),"XMM register should be 0-15"); + Assembler::pcmpestri(dst, src, imm8); } void MacroAssembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::pcmpestri(dst, src, imm8); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pcmpestri(xmm0, src, imm8); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pcmpestri(dst, xmm0, imm8); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::pcmpestri(xmm1, xmm0, imm8); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert((dst->encoding() < 16 && src->encoding() < 16),"XMM register should be 0-15"); + Assembler::pcmpestri(dst, src, imm8); } void MacroAssembler::pmovzxbw(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::pmovzxbw(dst, src); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::pmovzxbw(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pmovzxbw(xmm0, src); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pmovzxbw(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::pmovzxbw(xmm1, xmm0); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::pmovzxbw(dst, src); } void MacroAssembler::pmovzxbw(XMMRegister dst, Address src) { - int dst_enc = dst->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::pmovzxbw(dst, src); - } else if (dst_enc < 16) { - Assembler::pmovzxbw(dst, src); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pmovzxbw(xmm0, src); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::pmovzxbw(dst, src); } void MacroAssembler::pmovmskb(Register dst, XMMRegister src) { - int src_enc = src->encoding(); - if (src_enc < 16) { - Assembler::pmovmskb(dst, src); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pmovmskb(dst, xmm0); - pop_zmm(xmm0); - } + assert((src->encoding() < 16),"XMM register should be 0-15"); + Assembler::pmovmskb(dst, src); } void MacroAssembler::ptest(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::ptest(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::ptest(xmm0, src); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::ptest(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::ptest(xmm1, xmm0); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert((dst->encoding() < 16 && src->encoding() < 16),"XMM register should be 0-15"); + Assembler::ptest(dst, src); } void MacroAssembler::sqrtsd(XMMRegister dst, AddressLiteral src) { @@ -4160,187 +3991,33 @@ } void MacroAssembler::vabsss(XMMRegister dst, XMMRegister nds, XMMRegister src, AddressLiteral negate_field, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if ((dst_enc < 16) && (nds_enc < 16)) { - vandps(dst, nds, negate_field, vector_len); - } else if ((src_enc < 16) && (dst_enc < 16)) { - evmovdqul(src, nds, Assembler::AVX_512bit); - vandps(dst, src, negate_field, vector_len); - } else if (src_enc < 16) { - evmovdqul(src, nds, Assembler::AVX_512bit); - vandps(src, src, negate_field, vector_len); - evmovdqul(dst, src, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - evmovdqul(src, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandps(dst, xmm0, negate_field, vector_len); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - } else { - if (src_enc != dst_enc) { - evmovdqul(src, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandps(xmm0, xmm0, negate_field, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandps(xmm0, xmm0, negate_field, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vldq()),"XMM register should be 0-15"); + vandps(dst, nds, negate_field, vector_len); } void MacroAssembler::vabssd(XMMRegister dst, XMMRegister nds, XMMRegister src, AddressLiteral negate_field, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if ((dst_enc < 16) && (nds_enc < 16)) { - vandpd(dst, nds, negate_field, vector_len); - } else if ((src_enc < 16) && (dst_enc < 16)) { - evmovdqul(src, nds, Assembler::AVX_512bit); - vandpd(dst, src, negate_field, vector_len); - } else if (src_enc < 16) { - evmovdqul(src, nds, Assembler::AVX_512bit); - vandpd(src, src, negate_field, vector_len); - evmovdqul(dst, src, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - evmovdqul(src, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandpd(dst, xmm0, negate_field, vector_len); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - } else { - if (src_enc != dst_enc) { - evmovdqul(src, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandpd(xmm0, xmm0, negate_field, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - vandpd(xmm0, xmm0, negate_field, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vldq()),"XMM register should be 0-15"); + vandpd(dst, nds, negate_field, vector_len); } void MacroAssembler::vpaddb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpaddb(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpaddb(dst, dst, src, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for src - evmovdqul(nds, src, Assembler::AVX_512bit); - Assembler::vpaddb(dst, dst, nds, vector_len); - } else if ((src_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpaddb(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds as scatch for xmm0 to hold src - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpaddb(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpaddb(xmm0, xmm0, xmm1, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpaddb(dst, nds, src, vector_len); } void MacroAssembler::vpaddb(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpaddb(dst, nds, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpaddb(dst, dst, src, vector_len); - } else if (nds_enc < 16) { - // implies dst_enc in upper bank with src as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpaddb(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs in upper bank - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpaddb(xmm0, xmm0, src, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()), "XMM register should be 0-15"); + Assembler::vpaddb(dst, nds, src, vector_len); } void MacroAssembler::vpaddw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpaddw(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpaddw(dst, dst, src, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for src - evmovdqul(nds, src, Assembler::AVX_512bit); - Assembler::vpaddw(dst, dst, nds, vector_len); - } else if ((src_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpaddw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds as scatch for xmm0 to hold src - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpaddw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpaddw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpaddw(dst, nds, src, vector_len); } void MacroAssembler::vpaddw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpaddw(dst, nds, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpaddw(dst, dst, src, vector_len); - } else if (nds_enc < 16) { - // implies dst_enc in upper bank with src as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpaddw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs in upper bank - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpaddw(xmm0, xmm0, src, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpaddw(dst, nds, src, vector_len); } void MacroAssembler::vpand(XMMRegister dst, XMMRegister nds, AddressLiteral src, int vector_len) { @@ -4352,624 +4029,109 @@ } } -void MacroAssembler::vpbroadcastw(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpbroadcastw(dst, src); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpbroadcastw(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpbroadcastw(xmm0, src); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpbroadcastw(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::vpbroadcastw(xmm1, xmm0); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } +void MacroAssembler::vpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len) { + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpbroadcastw(dst, src, vector_len); } void MacroAssembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - assert(dst_enc == nds_enc, ""); - if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpcmpeqb(dst, nds, src, vector_len); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpcmpeqb(xmm0, xmm0, src, vector_len); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpcmpeqb(dst, dst, xmm0, vector_len); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::vpcmpeqb(xmm1, xmm1, xmm0, vector_len); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpcmpeqb(dst, nds, src, vector_len); } void MacroAssembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - assert(dst_enc == nds_enc, ""); - if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpcmpeqw(dst, nds, src, vector_len); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpcmpeqw(xmm0, xmm0, src, vector_len); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpcmpeqw(dst, dst, xmm0, vector_len); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::vpcmpeqw(xmm1, xmm1, xmm0, vector_len); - movdqu(dst, xmm1); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpcmpeqw(dst, nds, src, vector_len); } void MacroAssembler::vpmovzxbw(XMMRegister dst, Address src, int vector_len) { - int dst_enc = dst->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpmovzxbw(dst, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpmovzxbw(dst, src, vector_len); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpmovzxbw(xmm0, src, vector_len); - movdqu(dst, xmm0); - pop_zmm(xmm0); - } + assert(((dst->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpmovzxbw(dst, src, vector_len); } void MacroAssembler::vpmovmskb(Register dst, XMMRegister src) { - int src_enc = src->encoding(); - if (src_enc < 16) { - Assembler::vpmovmskb(dst, src); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpmovmskb(dst, xmm0); - pop_zmm(xmm0); - } + assert((src->encoding() < 16),"XMM register should be 0-15"); + Assembler::vpmovmskb(dst, src); } void MacroAssembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpmullw(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpmullw(dst, dst, src, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for src - evmovdqul(nds, src, Assembler::AVX_512bit); - Assembler::vpmullw(dst, dst, nds, vector_len); - } else if ((src_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpmullw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds as scatch for xmm0 to hold src - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpmullw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpmullw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpmullw(dst, nds, src, vector_len); } void MacroAssembler::vpmullw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpmullw(dst, nds, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpmullw(dst, dst, src, vector_len); - } else if (nds_enc < 16) { - // implies dst_enc in upper bank with src as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpmullw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs in upper bank - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpmullw(xmm0, xmm0, src, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpmullw(dst, nds, src, vector_len); } void MacroAssembler::vpsubb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsubb(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpsubb(dst, dst, src, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for src - evmovdqul(nds, src, Assembler::AVX_512bit); - Assembler::vpsubb(dst, dst, nds, vector_len); - } else if ((src_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsubb(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds as scatch for xmm0 to hold src - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpsubb(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsubb(xmm0, xmm0, xmm1, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsubb(dst, nds, src, vector_len); } void MacroAssembler::vpsubb(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsubb(dst, nds, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpsubb(dst, dst, src, vector_len); - } else if (nds_enc < 16) { - // implies dst_enc in upper bank with src as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsubb(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs in upper bank - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsubw(xmm0, xmm0, src, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsubb(dst, nds, src, vector_len); } void MacroAssembler::vpsubw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int src_enc = src->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsubw(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vpsubw(dst, dst, src, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for src - evmovdqul(nds, src, Assembler::AVX_512bit); - Assembler::vpsubw(dst, dst, nds, vector_len); - } else if ((src_enc < 16) && (nds_enc < 16)) { - // use nds as scratch for dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsubw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds as scatch for xmm0 to hold src - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vpsubw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsubw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && src->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsubw(dst, nds, src, vector_len); } void MacroAssembler::vpsubw(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsubw(dst, nds, src, vector_len); - } else if (dst_enc < 16) { - Assembler::vpsubw(dst, dst, src, vector_len); - } else if (nds_enc < 16) { - // implies dst_enc in upper bank with src as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsubw(nds, nds, src, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs in upper bank - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsubw(xmm0, xmm0, src, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsubw(dst, nds, src, vector_len); } void MacroAssembler::vpsraw(XMMRegister dst, XMMRegister nds, XMMRegister shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int shift_enc = shift->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsraw(dst, nds, shift, vector_len); - } else if ((dst_enc < 16) && (shift_enc < 16)) { - Assembler::vpsraw(dst, dst, shift, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds_enc as scratch with shift - evmovdqul(nds, shift, Assembler::AVX_512bit); - Assembler::vpsraw(dst, dst, nds, vector_len); - } else if ((shift_enc < 16) && (nds_enc < 16)) { - // use nds as scratch with dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsraw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds to save a copy of xmm0 and hold shift - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsraw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else if (nds_enc < 16) { - // use nds as dest as temps - evmovdqul(nds, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsraw(nds, nds, xmm0, vector_len); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, shift, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsllw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(xmm1, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && shift->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsraw(dst, nds, shift, vector_len); } void MacroAssembler::vpsraw(XMMRegister dst, XMMRegister nds, int shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsraw(dst, nds, shift, vector_len); - } else if (dst_enc < 16) { - Assembler::vpsraw(dst, dst, shift, vector_len); - } else if (nds_enc < 16) { - // use nds as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsraw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // use nds as scratch for xmm0 - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsraw(xmm0, xmm0, shift, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsraw(dst, nds, shift, vector_len); } void MacroAssembler::vpsrlw(XMMRegister dst, XMMRegister nds, XMMRegister shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int shift_enc = shift->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsrlw(dst, nds, shift, vector_len); - } else if ((dst_enc < 16) && (shift_enc < 16)) { - Assembler::vpsrlw(dst, dst, shift, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds_enc as scratch with shift - evmovdqul(nds, shift, Assembler::AVX_512bit); - Assembler::vpsrlw(dst, dst, nds, vector_len); - } else if ((shift_enc < 16) && (nds_enc < 16)) { - // use nds as scratch with dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsrlw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds to save a copy of xmm0 and hold shift - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsrlw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else if (nds_enc < 16) { - // use nds as dest as temps - evmovdqul(nds, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsrlw(nds, nds, xmm0, vector_len); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, shift, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsllw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(xmm1, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && shift->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsrlw(dst, nds, shift, vector_len); } void MacroAssembler::vpsrlw(XMMRegister dst, XMMRegister nds, int shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsrlw(dst, nds, shift, vector_len); - } else if (dst_enc < 16) { - Assembler::vpsrlw(dst, dst, shift, vector_len); - } else if (nds_enc < 16) { - // use nds as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsrlw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // use nds as scratch for xmm0 - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsrlw(xmm0, xmm0, shift, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsrlw(dst, nds, shift, vector_len); } void MacroAssembler::vpsllw(XMMRegister dst, XMMRegister nds, XMMRegister shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - int shift_enc = shift->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsllw(dst, nds, shift, vector_len); - } else if ((dst_enc < 16) && (shift_enc < 16)) { - Assembler::vpsllw(dst, dst, shift, vector_len); - } else if ((dst_enc < 16) && (nds_enc < 16)) { - // use nds_enc as scratch with shift - evmovdqul(nds, shift, Assembler::AVX_512bit); - Assembler::vpsllw(dst, dst, nds, vector_len); - } else if ((shift_enc < 16) && (nds_enc < 16)) { - // use nds as scratch with dst - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsllw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else if (dst_enc < 16) { - // use nds to save a copy of xmm0 and hold shift - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsllw(dst, dst, xmm0, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } else if (nds_enc < 16) { - // use nds as dest as temps - evmovdqul(nds, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, shift, Assembler::AVX_512bit); - Assembler::vpsllw(nds, nds, xmm0, vector_len); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // worse case scenario, all regs are in the upper bank - push_zmm(xmm1); - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm1, shift, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsllw(xmm0, xmm0, xmm1, vector_len); - evmovdqul(xmm1, dst, Assembler::AVX_512bit); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - pop_zmm(xmm1); - } + assert(((dst->encoding() < 16 && shift->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsllw(dst, nds, shift, vector_len); } void MacroAssembler::vpsllw(XMMRegister dst, XMMRegister nds, int shift, int vector_len) { - int dst_enc = dst->encoding(); - int nds_enc = nds->encoding(); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpsllw(dst, nds, shift, vector_len); - } else if (dst_enc < 16) { - Assembler::vpsllw(dst, dst, shift, vector_len); - } else if (nds_enc < 16) { - // use nds as scratch - evmovdqul(nds, dst, Assembler::AVX_512bit); - Assembler::vpsllw(nds, nds, shift, vector_len); - evmovdqul(dst, nds, Assembler::AVX_512bit); - } else { - // use nds as scratch for xmm0 - evmovdqul(nds, xmm0, Assembler::AVX_512bit); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vpsllw(xmm0, xmm0, shift, vector_len); - evmovdqul(xmm0, nds, Assembler::AVX_512bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::vpsllw(dst, nds, shift, vector_len); } void MacroAssembler::vptest(XMMRegister dst, XMMRegister src) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if ((dst_enc < 16) && (src_enc < 16)) { - Assembler::vptest(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::vptest(xmm0, src); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::vptest(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - movdqu(xmm0, src); - movdqu(xmm1, dst); - Assembler::vptest(xmm1, xmm0); - pop_zmm(xmm1); - pop_zmm(xmm0); - } + assert((dst->encoding() < 16 && src->encoding() < 16),"XMM register should be 0-15"); + Assembler::vptest(dst, src); } -// This instruction exists within macros, ergo we cannot control its input -// when emitted through those patterns. void MacroAssembler::punpcklbw(XMMRegister dst, XMMRegister src) { - if (VM_Version::supports_avx512nobw()) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (dst_enc == src_enc) { - if (dst_enc < 16) { - Assembler::punpcklbw(dst, src); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::punpcklbw(xmm0, xmm0); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } - } else { - if ((src_enc < 16) && (dst_enc < 16)) { - Assembler::punpcklbw(dst, src); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::punpcklbw(xmm0, src); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::punpcklbw(dst, xmm0); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - Assembler::punpcklbw(xmm0, xmm1); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm1); - pop_zmm(xmm0); - } - } - } else { - Assembler::punpcklbw(dst, src); - } + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::punpcklbw(dst, src); } void MacroAssembler::pshufd(XMMRegister dst, Address src, int mode) { - if (VM_Version::supports_avx512vl()) { - Assembler::pshufd(dst, src, mode); - } else { - int dst_enc = dst->encoding(); - if (dst_enc < 16) { - Assembler::pshufd(dst, src, mode); - } else { - push_zmm(xmm0); - Assembler::pshufd(xmm0, src, mode); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } - } + assert(((dst->encoding() < 16) || VM_Version::supports_avx512vl()),"XMM register should be 0-15"); + Assembler::pshufd(dst, src, mode); } -// This instruction exists within macros, ergo we cannot control its input -// when emitted through those patterns. void MacroAssembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) { - if (VM_Version::supports_avx512nobw()) { - int dst_enc = dst->encoding(); - int src_enc = src->encoding(); - if (dst_enc == src_enc) { - if (dst_enc < 16) { - Assembler::pshuflw(dst, src, mode); - } else { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pshuflw(xmm0, xmm0, mode); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } - } else { - if ((src_enc < 16) && (dst_enc < 16)) { - Assembler::pshuflw(dst, src, mode); - } else if (src_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - Assembler::pshuflw(xmm0, src, mode); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm0); - } else if (dst_enc < 16) { - push_zmm(xmm0); - evmovdqul(xmm0, src, Assembler::AVX_512bit); - Assembler::pshuflw(dst, xmm0, mode); - pop_zmm(xmm0); - } else { - push_zmm(xmm0); - push_zmm(xmm1); - evmovdqul(xmm0, dst, Assembler::AVX_512bit); - evmovdqul(xmm1, src, Assembler::AVX_512bit); - Assembler::pshuflw(xmm0, xmm1, mode); - evmovdqul(dst, xmm0, Assembler::AVX_512bit); - pop_zmm(xmm1); - pop_zmm(xmm0); - } - } - } else { - Assembler::pshuflw(dst, src, mode); - } + assert(((dst->encoding() < 16 && src->encoding() < 16) || VM_Version::supports_avx512vlbw()),"XMM register should be 0-15"); + Assembler::pshuflw(dst, src, mode); } void MacroAssembler::vandpd(XMMRegister dst, XMMRegister nds, AddressLiteral src, int vector_len) { @@ -5045,47 +4207,13 @@ } void MacroAssembler::vnegatess(XMMRegister dst, XMMRegister nds, AddressLiteral src) { - int nds_enc = nds->encoding(); - int dst_enc = dst->encoding(); - bool dst_upper_bank = (dst_enc > 15); - bool nds_upper_bank = (nds_enc > 15); - if (VM_Version::supports_avx512novl() && - (nds_upper_bank || dst_upper_bank)) { - if (dst_upper_bank) { - push_zmm(xmm0); - movflt(xmm0, nds); - vxorps(xmm0, xmm0, src, Assembler::AVX_128bit); - movflt(dst, xmm0); - pop_zmm(xmm0); - } else { - movflt(dst, nds); - vxorps(dst, dst, src, Assembler::AVX_128bit); - } - } else { - vxorps(dst, nds, src, Assembler::AVX_128bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vldq()),"XMM register should be 0-15"); + vxorps(dst, nds, src, Assembler::AVX_128bit); } void MacroAssembler::vnegatesd(XMMRegister dst, XMMRegister nds, AddressLiteral src) { - int nds_enc = nds->encoding(); - int dst_enc = dst->encoding(); - bool dst_upper_bank = (dst_enc > 15); - bool nds_upper_bank = (nds_enc > 15); - if (VM_Version::supports_avx512novl() && - (nds_upper_bank || dst_upper_bank)) { - if (dst_upper_bank) { - push_zmm(xmm0); - movdbl(xmm0, nds); - vxorpd(xmm0, xmm0, src, Assembler::AVX_128bit); - movdbl(dst, xmm0); - pop_zmm(xmm0); - } else { - movdbl(dst, nds); - vxorpd(dst, dst, src, Assembler::AVX_128bit); - } - } else { - vxorpd(dst, nds, src, Assembler::AVX_128bit); - } + assert(((dst->encoding() < 16 && nds->encoding() < 16) || VM_Version::supports_avx512vldq()),"XMM register should be 0-15"); + vxorpd(dst, nds, src, Assembler::AVX_128bit); } void MacroAssembler::vxorpd(XMMRegister dst, XMMRegister nds, AddressLiteral src, int vector_len) { @@ -6083,12 +5211,15 @@ // Clear upper bits of YMM registers to avoid SSE <-> AVX transition penalty. vzeroupper(); // Reset k1 to 0xffff. - if (VM_Version::supports_evex()) { + +#ifdef COMPILER2 + if (PostLoopMultiversioning && VM_Version::supports_evex()) { push(rcx); movl(rcx, 0xffff); kmovwl(k1, rcx); pop(rcx); } +#endif // COMPILER2 #ifndef _LP64 // Either restore the x87 floating pointer control word after returning @@ -7226,7 +6357,7 @@ cmpl(cnt1, 2*stride); jcc(Assembler::less, SCAN_TO_8_CHAR_INIT); movdl(vec1, ch); - vpbroadcastw(vec1, vec1); + vpbroadcastw(vec1, vec1, Assembler::AVX_256bit); vpxor(vec2, vec2); movl(tmp, cnt1); andl(tmp, 0xFFFFFFF0); //vector count (in chars) @@ -7729,8 +6860,6 @@ VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()) { - set_vector_masking(); // opening of the stub context for programming mask registers - Label test_64_loop, test_tail; Register tmp3_aliased = len; @@ -7759,15 +6888,12 @@ testl(tmp1, -1); jcc(Assembler::zero, FALSE_LABEL); - // Save k1 - kmovql(k3, k1); - // ~(~0 << len) applied up to two times (for 32-bit scenario) #ifdef _LP64 mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); shlxq(tmp3_aliased, tmp3_aliased, tmp1); notq(tmp3_aliased); - kmovql(k1, tmp3_aliased); + kmovql(k3, tmp3_aliased); #else Label k_init; jmp(k_init); @@ -7776,7 +6902,7 @@ // data required to compose 64 1's to the instruction stream // We emit 64 byte wide series of elements from 0..63 which later on would // be used as a compare targets with tail count contained in tmp1 register. - // Result would be a k1 register having tmp1 consecutive number or 1 + // Result would be a k register having tmp1 consecutive number or 1 // counting from least significant bit. address tmp = pc(); emit_int64(0x0706050403020100); @@ -7792,18 +6918,14 @@ lea(len, InternalAddress(tmp)); // create mask to test for negative byte inside a vector evpbroadcastb(vec1, tmp1, Assembler::AVX_512bit); - evpcmpgtb(k1, vec1, Address(len, 0), Assembler::AVX_512bit); + evpcmpgtb(k3, vec1, Address(len, 0), Assembler::AVX_512bit); #endif - evpcmpgtb(k2, k1, vec2, Address(ary1, 0), Assembler::AVX_512bit); - ktestq(k2, k1); - // Restore k1 - kmovql(k1, k3); + evpcmpgtb(k2, k3, vec2, Address(ary1, 0), Assembler::AVX_512bit); + ktestq(k2, k3); jcc(Assembler::notZero, TRUE_LABEL); jmp(FALSE_LABEL); - - clear_vector_masking(); // closing of the stub context for programming mask registers } else { movl(result, len); // copy @@ -7821,7 +6943,7 @@ movl(tmp1, 0x80808080); // create mask to test for Unicode chars in vector movdl(vec2, tmp1); - vpbroadcastd(vec2, vec2); + vpbroadcastd(vec2, vec2, Assembler::AVX_256bit); bind(COMPARE_WIDE_VECTORS); vmovdqu(vec1, Address(ary1, len, Address::times_1)); @@ -8243,15 +7365,11 @@ { assert( UseSSE >= 2, "supported cpu only" ); Label L_fill_32_bytes_loop, L_check_fill_8_bytes, L_fill_8_bytes_loop, L_fill_8_bytes; - if (UseAVX > 2) { - movl(rtmp, 0xffff); - kmovwl(k1, rtmp); - } movdl(xtmp, value); if (UseAVX > 2 && UseUnalignedLoadStores) { // Fill 64-byte chunks Label L_fill_64_bytes_loop, L_check_fill_32_bytes; - evpbroadcastd(xtmp, xtmp, Assembler::AVX_512bit); + vpbroadcastd(xtmp, xtmp, Assembler::AVX_512bit); subl(count, 16 << shift); jcc(Assembler::less, L_check_fill_32_bytes); @@ -8274,7 +7392,7 @@ } else if (UseAVX == 2 && UseUnalignedLoadStores) { // Fill 64-byte chunks Label L_fill_64_bytes_loop, L_check_fill_32_bytes; - vpbroadcastd(xtmp, xtmp); + vpbroadcastd(xtmp, xtmp, Assembler::AVX_256bit); subl(count, 16 << shift); jcc(Assembler::less, L_check_fill_32_bytes); @@ -8415,7 +7533,7 @@ Label L_chars_32_check, L_copy_32_chars, L_copy_32_chars_exit; movl(tmp5, 0xff00ff00); // create mask to test for Unicode chars in vector movdl(tmp1Reg, tmp5); - vpbroadcastd(tmp1Reg, tmp1Reg); + vpbroadcastd(tmp1Reg, tmp1Reg, Assembler::AVX_256bit); jmp(L_chars_32_check); bind(L_copy_32_chars); @@ -8989,7 +8107,6 @@ if ((UseAVX > 2) && VM_Version::supports_avx512vlbw()) { - set_vector_masking(); // opening of the stub context for programming mask registers cmpq(length, 64); jcc(Assembler::less, VECTOR32_TAIL); movq(tmp1, length); @@ -9012,19 +8129,15 @@ bind(VECTOR64_TAIL); // AVX512 code to compare upto 63 byte vectors. - // Save k1 - kmovql(k3, k1); mov64(tmp2, 0xFFFFFFFFFFFFFFFF); shlxq(tmp2, tmp2, tmp1); notq(tmp2); - kmovql(k1, tmp2); + kmovql(k3, tmp2); - evmovdqub(rymm0, k1, Address(obja, result), Assembler::AVX_512bit); - evpcmpeqb(k7, k1, rymm0, Address(objb, result), Assembler::AVX_512bit); + evmovdqub(rymm0, k3, Address(obja, result), Assembler::AVX_512bit); + evpcmpeqb(k7, k3, rymm0, Address(objb, result), Assembler::AVX_512bit); - ktestql(k7, k1); - // Restore k1 - kmovql(k1, k3); + ktestql(k7, k3); jcc(Assembler::below, SAME_TILL_END); // not mismatch bind(VECTOR64_NOT_EQUAL); @@ -9035,7 +8148,6 @@ shrq(result); jmp(DONE); bind(VECTOR32_TAIL); - clear_vector_masking(); // closing of the stub context for programming mask registers } cmpq(length, 8); @@ -9795,11 +8907,6 @@ // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge // context for the registers used, where all instructions below are using 128-bit mode // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - movl(tmp, 0xffff); - kmovwl(k1, tmp); - } - lea(table, ExternalAddress(StubRoutines::crc_table_addr())); notl(crc); // ~crc cmpl(len, 16); @@ -10461,9 +9568,7 @@ VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()) { - set_vector_masking(); // opening of the stub context for programming mask registers - - Label copy_32_loop, copy_loop_tail, restore_k1_return_zero; + Label copy_32_loop, copy_loop_tail; // alignement Label post_alignement; @@ -10478,9 +9583,6 @@ movl(result, 0x00FF); evpbroadcastw(tmp2Reg, result, Assembler::AVX_512bit); - // Save k1 - kmovql(k3, k1); - testl(len, -64); jcc(Assembler::zero, post_alignement); @@ -10497,14 +9599,14 @@ movl(result, 0xFFFFFFFF); shlxl(result, result, tmp5); notl(result); - kmovdl(k1, result); + kmovdl(k3, result); - evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit); - evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); - ktestd(k2, k1); - jcc(Assembler::carryClear, restore_k1_return_zero); + evmovdquw(tmp1Reg, k3, Address(src, 0), Assembler::AVX_512bit); + evpcmpuw(k2, k3, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); + ktestd(k2, k3); + jcc(Assembler::carryClear, return_zero); - evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit); + evpmovwb(Address(dst, 0), k3, tmp1Reg, Assembler::AVX_512bit); addptr(src, tmp5); addptr(src, tmp5); @@ -10527,7 +9629,7 @@ evmovdquw(tmp1Reg, Address(src, len, Address::times_2), Assembler::AVX_512bit); evpcmpuw(k2, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); kortestdl(k2, k2); - jcc(Assembler::carryClear, restore_k1_return_zero); + jcc(Assembler::carryClear, return_zero); // All elements in current processed chunk are valid candidates for // compression. Write a truncated byte elements to the memory. @@ -10538,8 +9640,6 @@ bind(copy_loop_tail); // bail out when there is nothing to be done testl(tmp5, 0xFFFFFFFF); - // Restore k1 - kmovql(k1, k3); jcc(Assembler::zero, return_length); movl(len, tmp5); @@ -10549,24 +9649,15 @@ shlxl(result, result, len); notl(result); - kmovdl(k1, result); + kmovdl(k3, result); - evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit); - evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); - ktestd(k2, k1); - jcc(Assembler::carryClear, restore_k1_return_zero); - - evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit); - // Restore k1 - kmovql(k1, k3); - jmp(return_length); - - bind(restore_k1_return_zero); - // Restore k1 - kmovql(k1, k3); - jmp(return_zero); + evmovdquw(tmp1Reg, k3, Address(src, 0), Assembler::AVX_512bit); + evpcmpuw(k2, k3, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); + ktestd(k2, k3); + jcc(Assembler::carryClear, return_zero); - clear_vector_masking(); // closing of the stub context for programming mask registers + evpmovwb(Address(dst, 0), k3, tmp1Reg, Assembler::AVX_512bit); + jmp(return_length); } if (UseSSE42Intrinsics) { Label copy_32_loop, copy_16, copy_tail; @@ -10680,8 +9771,6 @@ VM_Version::supports_avx512vlbw() && VM_Version::supports_bmi2()) { - set_vector_masking(); // opening of the stub context for programming mask registers - Label copy_32_loop, copy_tail; Register tmp3_aliased = len; @@ -10714,22 +9803,15 @@ testl(tmp2, -1); // we don't destroy the contents of tmp2 here jcc(Assembler::zero, done); - // Save k1 - kmovql(k2, k1); - // ~(~0 << length), where length is the # of remaining elements to process movl(tmp3_aliased, -1); shlxl(tmp3_aliased, tmp3_aliased, tmp2); notl(tmp3_aliased); - kmovdl(k1, tmp3_aliased); - evpmovzxbw(tmp1, k1, Address(src, 0), Assembler::AVX_512bit); - evmovdquw(Address(dst, 0), k1, tmp1, Assembler::AVX_512bit); + kmovdl(k2, tmp3_aliased); + evpmovzxbw(tmp1, k2, Address(src, 0), Assembler::AVX_512bit); + evmovdquw(Address(dst, 0), k2, tmp1, Assembler::AVX_512bit); - // Restore k1 - kmovql(k1, k2); jmp(done); - - clear_vector_masking(); // closing of the stub context for programming mask registers } if (UseSSE42Intrinsics) { Label copy_16_loop, copy_8_loop, copy_bytes, copy_new_tail, copy_tail; diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/macroAssembler_x86.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/macroAssembler_x86.hpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/macroAssembler_x86.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/macroAssembler_x86.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -156,9 +156,11 @@ void incrementq(Register reg, int value = 1); void incrementq(Address dst, int value = 1); +#ifdef COMPILER2 // special instructions for EVEX void setvectmask(Register dst, Register src); void restorevectmask(); +#endif // Support optimal SSE move instructions. void movflt(XMMRegister dst, XMMRegister src) { @@ -478,10 +480,6 @@ // from register xmm0. Otherwise, the value is stored from the FPU stack. void store_double(Address dst); - // Save/restore ZMM (512bit) register on stack. - void push_zmm(XMMRegister reg); - void pop_zmm(XMMRegister reg); - // pushes double TOS element of FPU stack on CPU stack; pops from FPU stack void push_fTOS(); @@ -1210,9 +1208,11 @@ void vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { Assembler::vpand(dst, nds, src, vector_len); } void vpand(XMMRegister dst, XMMRegister nds, AddressLiteral src, int vector_len); - void vpbroadcastw(XMMRegister dst, XMMRegister src); + void vpbroadcastw(XMMRegister dst, XMMRegister src, int vector_len); + void vpbroadcastw(XMMRegister dst, Address src, int vector_len) { Assembler::vpbroadcastw(dst, src, vector_len); } void vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); + void vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); void vpmovzxbw(XMMRegister dst, Address src, int vector_len); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -153,12 +153,6 @@ __ movptr(saved_rsi, rsi); __ movptr(saved_rbx, rbx); - // provide initial value for required masks - if (UseAVX > 2) { - __ movl(rbx, 0xffff); - __ kmovwl(k1, rbx); - } - // save and initialize %mxcsr if (sse_save) { Label skip_ldmx; @@ -679,12 +673,7 @@ void xmm_copy_forward(Register from, Register to_from, Register qword_count) { assert( UseSSE >= 2, "supported cpu only" ); Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit; - if (UseAVX > 2) { - __ push(rbx); - __ movl(rbx, 0xffff); - __ kmovwl(k1, rbx); - __ pop(rbx); - } + // Copy 64-byte chunks __ jmpb(L_copy_64_bytes); __ align(OptoLoopAlignment); @@ -2115,14 +2104,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - __ movptr(from, from_param); __ movptr(key, key_param); @@ -2222,14 +2203,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - __ movptr(from, from_param); __ movptr(key, key_param); @@ -2356,14 +2329,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame handleSOERegisters(true /*saving*/); - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - // load registers from incoming parameters const Address from_param(rbp, 8+0); const Address to_param (rbp, 8+4); @@ -2532,14 +2497,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame handleSOERegisters(true /*saving*/); - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - // load registers from incoming parameters const Address from_param(rbp, 8+0); const Address to_param (rbp, 8+4); @@ -2693,14 +2650,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame handleSOERegisters(true /*saving*/); // save rbx, rsi, rdi - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - // load registers from incoming parameters const Address from_param(rbp, 8+0); const Address to_param (rbp, 8+4); @@ -3154,14 +3103,6 @@ __ enter(); handleSOERegisters(true); // Save registers - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rdx, 0xffff); - __ kmovdl(k1, rdx); - } - __ movptr(state, state_param); __ movptr(subkeyH, subkeyH_param); __ movptr(data, data_param); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -254,10 +254,7 @@ __ movptr(r13_save, r13); __ movptr(r14_save, r14); __ movptr(r15_save, r15); - if (UseAVX > 2) { - __ movl(rbx, 0xffff); - __ kmovwl(k1, rbx); - } + #ifdef _WIN64 int last_reg = 15; if (UseAVX > 2) { @@ -1221,10 +1218,6 @@ __ align(OptoLoopAlignment); if (UseUnalignedLoadStores) { Label L_end; - if (UseAVX > 2) { - __ movl(to, 0xffff); - __ kmovwl(k1, to); - } // Copy 64-bytes per iteration __ BIND(L_loop); if (UseAVX > 2) { @@ -1305,10 +1298,6 @@ __ align(OptoLoopAlignment); if (UseUnalignedLoadStores) { Label L_end; - if (UseAVX > 2) { - __ movl(to, 0xffff); - __ kmovwl(k1, to); - } // Copy 64-bytes per iteration __ BIND(L_loop); if (UseAVX > 2) { @@ -2957,14 +2946,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); @@ -3059,14 +3040,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - // keylen could be only {11, 13, 15} * 4 = {44, 52, 60} __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT))); @@ -3179,14 +3152,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - #ifdef _WIN64 // on win64, fill len_reg from stack position __ movl(len_reg, len_mem); @@ -3380,14 +3345,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - #ifdef _WIN64 // on win64, fill len_reg from stack position __ movl(len_reg, len_mem); @@ -3854,14 +3811,6 @@ __ enter(); // required for proper stackwalking of RuntimeStub frame - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - #ifdef _WIN64 // allocate spill slots for r13, r14 enum { @@ -4436,14 +4385,6 @@ __ enter(); - // For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge - // context for the registers used, where all instructions below are using 128-bit mode - // On EVEX without VL and BW, these instructions will all be AVX. - if (VM_Version::supports_avx512vlbw()) { - __ movl(rax, 0xffff); - __ kmovql(k1, rax); - } - __ movdqu(xmm_temp10, ExternalAddress(StubRoutines::x86::ghash_long_swap_mask_addr())); __ movdqu(xmm_temp0, Address(state, 0)); @@ -4713,7 +4654,6 @@ __ push(r13); __ push(r14); __ push(r15); - __ push(rbx); // arguments const Register source = c_rarg0; // Source Array @@ -4742,8 +4682,6 @@ __ cmpl(length, 0); __ jcc(Assembler::lessEqual, L_exit); - // Save k1 value in rbx - __ kmovql(rbx, k1); __ lea(r11, ExternalAddress(StubRoutines::x86::base64_charset_addr())); // check if base64 charset(isURL=0) or base64 url charset(isURL=1) needs to be loaded __ cmpl(isURL, 0); @@ -4754,7 +4692,7 @@ __ BIND(L_processdata); __ movdqu(xmm16, ExternalAddress(StubRoutines::x86::base64_gather_mask_addr())); // Set 64 bits of K register. - __ evpcmpeqb(k1, xmm16, xmm16, Assembler::AVX_512bit); + __ evpcmpeqb(k3, xmm16, xmm16, Assembler::AVX_512bit); __ evmovdquq(xmm12, ExternalAddress(StubRoutines::x86::base64_bswap_mask_addr()), Assembler::AVX_256bit, r13); __ evmovdquq(xmm13, ExternalAddress(StubRoutines::x86::base64_right_shift_mask_addr()), Assembler::AVX_512bit, r13); __ evmovdquq(xmm14, ExternalAddress(StubRoutines::x86::base64_left_shift_mask_addr()), Assembler::AVX_512bit, r13); @@ -4833,17 +4771,17 @@ __ vextracti64x4(xmm4, xmm5, 1); __ vpmovzxwd(xmm7, xmm4, Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm4, k2, Address(r11, xmm0, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm5, k2, Address(r11, xmm1, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm8, k2, Address(r11, xmm2, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm9, k2, Address(r11, xmm3, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm10, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm11, k2, Address(r11, xmm7, Address::times_4, 0), Assembler::AVX_512bit); //Down convert dword to byte. Final output is 16*6 = 96 bytes long @@ -4879,9 +4817,9 @@ __ vpmovzxwd(xmm6, xmm9, Assembler::AVX_512bit); __ vextracti64x4(xmm9, xmm1, 1); __ vpmovzxwd(xmm5, xmm9, Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm8, k2, Address(r11, xmm6, Address::times_4, 0), Assembler::AVX_512bit); - __ kmovql(k2, k1); + __ kmovql(k2, k3); __ evpgatherdd(xmm10, k2, Address(r11, xmm5, Address::times_4, 0), Assembler::AVX_512bit); __ evpmovdb(Address(dest, dp, Address::times_1, 0), xmm8, Assembler::AVX_512bit); __ evpmovdb(Address(dest, dp, Address::times_1, 16), xmm10, Assembler::AVX_512bit); @@ -4937,9 +4875,6 @@ __ addq(source, 3); __ jmp(L_process3); __ BIND(L_exit); - // restore k1 register value - __ kmovql(k1, rbx); - __ pop(rbx); __ pop(r15); __ pop(r14); __ pop(r13); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/vm_version_x86.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vm_version_x86.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/vm_version_x86.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vm_version_x86.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -401,9 +401,7 @@ // load value into all 64 bytes of zmm7 register __ movl(rcx, VM_Version::ymm_test_value()); __ movdl(xmm0, rcx); - __ movl(rcx, 0xffff); - __ kmovwl(k1, rcx); - __ evpbroadcastd(xmm0, xmm0, Assembler::AVX_512bit); + __ vpbroadcastd(xmm0, xmm0, Assembler::AVX_512bit); __ evmovdqul(xmm7, xmm0, Assembler::AVX_512bit); #ifdef _LP64 __ evmovdqul(xmm8, xmm0, Assembler::AVX_512bit); @@ -885,7 +883,7 @@ FLAG_SET_DEFAULT(UseSHA, false); } - if (supports_sha() && UseSHA) { + if (supports_sha() && supports_sse4_1() && UseSHA) { if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) { FLAG_SET_DEFAULT(UseSHA1Intrinsics, true); } @@ -894,7 +892,7 @@ FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); } - if (UseSHA) { + if (supports_sse4_1() && UseSHA) { if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/vm_version_x86.hpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vm_version_x86.hpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/vm_version_x86.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vm_version_x86.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -816,7 +816,10 @@ static bool supports_avx512cd() { return (_features & CPU_AVX512CD) != 0; } static bool supports_avx512bw() { return (_features & CPU_AVX512BW) != 0; } static bool supports_avx512vl() { return (_features & CPU_AVX512VL) != 0; } - static bool supports_avx512vlbw() { return (supports_avx512bw() && supports_avx512vl()); } + static bool supports_avx512vlbw() { return (supports_evex() && supports_avx512bw() && supports_avx512vl()); } + static bool supports_avx512vldq() { return (supports_evex() && supports_avx512dq() && supports_avx512vl()); } + static bool supports_avx512vlbwdq() { return (supports_evex() && supports_avx512vl() && + supports_avx512bw() && supports_avx512dq()); } static bool supports_avx512novl() { return (supports_evex() && !supports_avx512vl()); } static bool supports_avx512nobw() { return (supports_evex() && !supports_avx512bw()); } static bool supports_avx256only() { return (supports_avx2() && !supports_evex()); } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vtableStubs_x86_32.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -55,25 +55,34 @@ // Available now, but may become callee-save at some point: // rsi, rdi // Note that rax and rdx are also used for return values. -// + VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - const int i486_code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), i486_code_length); - MacroAssembler* masm = new MacroAssembler(&cb); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + // No variance was detected in vtable stub sizes. Setting index_dependent_slop == 0 will unveil any deviation from this observation. + const int index_dependent_slop = 0; -#ifndef PRODUCT + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); + MacroAssembler* masm = new MacroAssembler(&cb); +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); } -#endif /* PRODUCT */ +#endif // get receiver (need to skip return address on top of stack) assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx"); @@ -85,11 +94,21 @@ #ifndef PRODUCT if (DebugVtables) { Label L; + start_pc = __ pc(); // check offset vs vtable length __ cmpl(Address(rax, Klass::vtable_length_offset()), vtable_index*vtableEntry::size()); + slop_delta = 6 - (__ pc() - start_pc); // cmpl varies in length, depending on data + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); + __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); + // VTABLE TODO: find upper bound for call_VM length. + start_pc = __ pc(); __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx); + slop_delta = 480 - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ bind(L); } #endif // PRODUCT @@ -97,8 +116,13 @@ const Register method = rbx; // load Method* and target address + start_pc = __ pc(); __ lookup_virtual_method(rax, vtable_index, method); + slop_delta = 6 - (int)(__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); +#ifndef PRODUCT if (DebugVtables) { Label L; __ cmpptr(method, (int32_t)NULL_WORD); @@ -108,55 +132,53 @@ __ stop("Vtable entry is NULL"); __ bind(L); } +#endif // PRODUCT - // rax,: receiver klass + // rax: receiver klass // method (rbx): Method* // rcx: receiver address ame_addr = __ pc(); __ jmp( Address(method, Method::from_compiled_offset())); masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, index_dependent_slop); - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d", - vtable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 3; // 32-bit offset is this much larger than an 8-bit one - assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); - - s->set_exception_points(npe_addr, ame_addr); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - // Note well: pd_code_size_limit is the absolute minimum we can get away with. If you - // add code here, bump the code stub size returned by pd_code_size_limit! - const int i486_code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new(i486_code_length) VtableStub(false, itable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + const int index_dependent_slop = (itable_index == 0) ? 4 : // code size change with transition from 8-bit to 32-bit constant (@index == 32). + (itable_index < 32) ? 3 : 0; // index == 0 generates even shorter code. - ResourceMark rm; - CodeBuffer cb(s->entry_point(), i486_code_length); + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); - // Entry arguments: - // rax: CompiledICHolder - // rcx: Receiver - -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); } #endif /* PRODUCT */ + // Entry arguments: + // rax: CompiledICHolder + // rcx: Receiver + // Most registers are in use; we'll use rax, rbx, rsi, rdi // (If we need to make rsi, rdi callee-save, do a push/pop here.) const Register recv_klass_reg = rsi; @@ -171,10 +193,12 @@ Label L_no_such_interface; // get receiver klass (also an implicit null-check) - address npe_addr = __ pc(); assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx"); + address npe_addr = __ pc(); __ load_klass(recv_klass_reg, rcx); + start_pc = __ pc(); + // Receiver subtype check against REFC. // Destroys recv_klass_reg value. __ lookup_interface_method(// inputs: rec. class, interface @@ -184,6 +208,9 @@ L_no_such_interface, /*return_method=*/false); + const ptrdiff_t typecheckSize = __ pc() - start_pc; + start_pc = __ pc(); + // Get selected method from declaring class and itable index const Register method = rbx; __ load_klass(recv_klass_reg, rcx); // restore recv_klass_reg @@ -193,19 +220,30 @@ method, temp_reg, L_no_such_interface); + const ptrdiff_t lookupSize = __ pc() - start_pc; + + // We expect we need index_dependent_slop extra bytes. Reason: + // The emitted code in lookup_interface_method changes when itable_index exceeds 31. + // For windows, a narrow estimate was found to be 104. Other OSes not tested. + const ptrdiff_t estimate = 104; + const ptrdiff_t codesize = typecheckSize + lookupSize + index_dependent_slop; + slop_delta = (int)(estimate - codesize); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); + // method (rbx): Method* // rcx: receiver #ifdef ASSERT if (DebugVtables) { - Label L1; - __ cmpptr(method, (int32_t)NULL_WORD); - __ jcc(Assembler::equal, L1); - __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD); - __ jcc(Assembler::notZero, L1); - __ stop("Method* is null"); - __ bind(L1); - } + Label L1; + __ cmpptr(method, (int32_t)NULL_WORD); + __ jcc(Assembler::equal, L1); + __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD); + __ jcc(Assembler::notZero, L1); + __ stop("Method* is null"); + __ bind(L1); + } #endif // ASSERT address ame_addr = __ pc(); @@ -219,70 +257,15 @@ // dirty work. __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); - __ flush(); - - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", - itable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 3; // 32-bit offset is this much larger than an 8-bit one - assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); + masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, index_dependent_slop); - s->set_exception_points(npe_addr, ame_addr); return s; } - - -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (is_vtable_stub) { - // Vtable stub size - return (DebugVtables ? 210 : 16) + (CountCompiledCalls ? 6 : 0); - } else { - // Itable stub size - return (DebugVtables ? 256 : 110) + (CountCompiledCalls ? 6 : 0); - } - // In order to tune these parameters, run the JVM with VM options - // +PrintMiscellaneous and +WizardMode to see information about - // actual itable stubs. Look for lines like this: - // itable #1 at 0x5551212[65] left over: 3 - // Reduce the constants so that the "left over" number is >=3 - // for the common cases. - // Do not aim at a left-over number of zero, because a - // large vtable or itable index (> 16) will require a 32-bit - // immediate displacement instead of an 8-bit one. - // - // The JVM98 app. _202_jess has a megamorphic interface call. - // The itable code looks like this: - // Decoding VtableStub itbl[1]@1 - // mov 0x4(%ecx),%esi - // mov 0xe8(%esi),%edi - // lea 0x130(%esi,%edi,4),%edi - // add $0x7,%edi - // and $0xfffffff8,%edi - // lea 0x4(%esi),%esi - // mov (%edi),%ebx - // cmp %ebx,%eax - // je success - // loop: - // test %ebx,%ebx - // je throw_icce - // add $0x8,%edi - // mov (%edi),%ebx - // cmp %ebx,%eax - // jne loop - // success: - // mov 0x4(%edi),%edi - // mov (%esi,%edi,1),%ebx - // jmp *0x44(%ebx) - // throw_icce: - // jmp throw_ICCE_entry -} - int VtableStub::pd_code_alignment() { - return wordSize; + // x86 cache line size is 64 bytes, but we want to limit alignment loss. + const unsigned int icache_line_size = wordSize; + return icache_line_size; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp --- openjdk-lts-11~28/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/vtableStubs_x86_64.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -42,24 +42,32 @@ #define __ masm-> #ifndef PRODUCT -extern "C" void bad_compiled_vtable_index(JavaThread* thread, - oop receiver, - int index); +extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int index); #endif VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { - const int amd64_code_length = VtableStub::pd_code_size_limit(true); - VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(true); + VtableStub* s = new(stub_code_length) VtableStub(true, vtable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } - ResourceMark rm; - CodeBuffer cb(s->entry_point(), amd64_code_length); + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + // No variance was detected in vtable stub sizes. Setting index_dependent_slop == 0 will unveil any deviation from this observation. + const int index_dependent_slop = 0; + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); MacroAssembler* masm = new MacroAssembler(&cb); -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); } @@ -77,22 +85,35 @@ #ifndef PRODUCT if (DebugVtables) { Label L; + start_pc = __ pc(); // check offset vs vtable length - __ cmpl(Address(rax, Klass::vtable_length_offset()), - vtable_index * vtableEntry::size()); + __ cmpl(Address(rax, Klass::vtable_length_offset()), vtable_index*vtableEntry::size()); + slop_delta = 12 - (__ pc() - start_pc); // cmpl varies in length, depending on data + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); + __ jcc(Assembler::greater, L); __ movl(rbx, vtable_index); - __ call_VM(noreg, - CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, rbx); + // VTABLE TODO: find upper bound for call_VM length. + start_pc = __ pc(); + __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, rbx); + slop_delta = 480 - (__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); __ bind(L); } #endif // PRODUCT - // load Method* and target address const Register method = rbx; + // load Method* and target address + start_pc = __ pc(); __ lookup_virtual_method(rax, vtable_index, method); + slop_delta = 8 - (int)(__ pc() - start_pc); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "negative slop(%d) encountered, adjust code size estimate!", slop_delta); +#ifndef PRODUCT if (DebugVtables) { Label L; __ cmpptr(method, (int32_t)NULL_WORD); @@ -102,50 +123,48 @@ __ stop("Vtable entry is NULL"); __ bind(L); } +#endif // PRODUCT + // rax: receiver klass - // rbx: Method* + // method (rbx): Method* // rcx: receiver address ame_addr = __ pc(); __ jmp( Address(rbx, Method::from_compiled_offset())); - __ flush(); - - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d", - vtable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 3; // 32-bit offset is this much larger than an 8-bit one - assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); + masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, index_dependent_slop); - s->set_exception_points(npe_addr, ame_addr); return s; } VtableStub* VtableStubs::create_itable_stub(int itable_index) { - // Note well: pd_code_size_limit is the absolute minimum we can get - // away with. If you add code here, bump the code stub size - // returned by pd_code_size_limit! - const int amd64_code_length = VtableStub::pd_code_size_limit(false); - VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index); + // Read "A word on VtableStub sizing" in share/code/vtableStubs.hpp for details on stub sizing. + const int stub_code_length = code_size_limit(false); + VtableStub* s = new(stub_code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } + // Count unused bytes in instruction sequences of variable size. + // We add them to the computed buffer size in order to avoid + // overflow in subsequently generated stubs. + address start_pc; + int slop_bytes = 0; + int slop_delta = 0; + const int index_dependent_slop = (itable_index == 0) ? 4 : // code size change with transition from 8-bit to 32-bit constant (@index == 16). + (itable_index < 16) ? 3 : 0; // index == 0 generates even shorter code. + + ResourceMark rm; + CodeBuffer cb(s->entry_point(), stub_code_length); + MacroAssembler *masm = new MacroAssembler(&cb); - ResourceMark rm; - CodeBuffer cb(s->entry_point(), amd64_code_length); - MacroAssembler* masm = new MacroAssembler(&cb); - -#ifndef PRODUCT +#if (!defined(PRODUCT) && defined(COMPILER2)) if (CountCompiledCalls) { __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); } -#endif +#endif // PRODUCT // Entry arguments: // rax: CompiledICHolder @@ -158,17 +177,19 @@ const Register resolved_klass_reg = rbx; // resolved interface klass (REFC) const Register temp_reg = r11; - Label L_no_such_interface; - const Register icholder_reg = rax; __ movptr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset())); __ movptr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset())); + Label L_no_such_interface; + // get receiver klass (also an implicit null-check) assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); address npe_addr = __ pc(); __ load_klass(recv_klass_reg, j_rarg0); + start_pc = __ pc(); + // Receiver subtype check against REFC. // Destroys recv_klass_reg value. __ lookup_interface_method(// inputs: rec. class, interface @@ -178,6 +199,9 @@ L_no_such_interface, /*return_method=*/false); + const ptrdiff_t typecheckSize = __ pc() - start_pc; + start_pc = __ pc(); + // Get selected method from declaring class and itable index const Register method = rbx; __ load_klass(recv_klass_reg, j_rarg0); // restore recv_klass_reg @@ -187,6 +211,17 @@ method, temp_reg, L_no_such_interface); + const ptrdiff_t lookupSize = __ pc() - start_pc; + + // We expect we need index_dependent_slop extra bytes. Reason: + // The emitted code in lookup_interface_method changes when itable_index exceeds 15. + // For linux, a very narrow estimate would be 112, but Solaris requires some more space (130). + const ptrdiff_t estimate = 136; + const ptrdiff_t codesize = typecheckSize + lookupSize + index_dependent_slop; + slop_delta = (int)(estimate - codesize); + slop_bytes += slop_delta; + assert(slop_delta >= 0, "itable #%d: Code size estimate (%d) for lookup_interface_method too small, required: %d", itable_index, (int)estimate, (int)codesize); + // If we take a trap while this arg is on the stack we will not // be able to walk the stack properly. This is not an issue except // when there are mistakes in this assembly code that could generate @@ -207,8 +242,6 @@ } #endif // ASSERT - // rbx: Method* - // j_rarg0: receiver address ame_addr = __ pc(); __ jmp(Address(method, Method::from_compiled_offset())); @@ -220,68 +253,15 @@ // dirty work. __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); - __ flush(); - - if (PrintMiscellaneous && (WizardMode || Verbose)) { - tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", - itable_index, p2i(s->entry_point()), - (int)(s->code_end() - s->entry_point()), - (int)(s->code_end() - __ pc())); - } - guarantee(__ pc() <= s->code_end(), "overflowed buffer"); - // shut the door on sizing bugs - int slop = 3; // 32-bit offset is this much larger than an 8-bit one - assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); + masm->flush(); + slop_bytes += index_dependent_slop; // add'l slop for size variance due to large itable offsets + bookkeeping(masm, tty, s, npe_addr, ame_addr, false, itable_index, slop_bytes, index_dependent_slop); - s->set_exception_points(npe_addr, ame_addr); return s; } -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - if (is_vtable_stub) { - // Vtable stub size - return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) + - (UseCompressedClassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0); - } else { - // Itable stub size - return (DebugVtables ? 512 : 140) + (CountCompiledCalls ? 13 : 0) + - (UseCompressedClassPointers ? 2 * MacroAssembler::instr_size_for_decode_klass_not_null() : 0); - } - // In order to tune these parameters, run the JVM with VM options - // +PrintMiscellaneous and +WizardMode to see information about - // actual itable stubs. Look for lines like this: - // itable #1 at 0x5551212[71] left over: 3 - // Reduce the constants so that the "left over" number is >=3 - // for the common cases. - // Do not aim at a left-over number of zero, because a - // large vtable or itable index (>= 32) will require a 32-bit - // immediate displacement instead of an 8-bit one. - // - // The JVM98 app. _202_jess has a megamorphic interface call. - // The itable code looks like this: - // Decoding VtableStub itbl[1]@12 - // mov 0x8(%rsi),%r10 - // mov 0x198(%r10),%r11d - // lea 0x218(%r10,%r11,8),%r11 - // lea 0x8(%r10),%r10 - // mov (%r11),%rbx - // cmp %rbx,%rax - // je success - // loop: - // test %rbx,%rbx - // je throw_icce - // add $0x10,%r11 - // mov (%r11),%rbx - // cmp %rbx,%rax - // jne loop - // success: - // mov 0x8(%r11),%r11d - // mov (%r10,%r11,1),%rbx - // jmpq *0x60(%rbx) - // throw_icce: - // jmpq throw_ICCE_entry -} - int VtableStub::pd_code_alignment() { - return wordSize; + // x86 cache line size is 64 bytes, but we want to limit alignment loss. + const unsigned int icache_line_size = wordSize; + return icache_line_size; } diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/x86_32.ad openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86_32.ad --- openjdk-lts-11~28/src/hotspot/cpu/x86/x86_32.ad 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86_32.ad 2019-01-18 04:23:48.000000000 +0000 @@ -4101,6 +4101,15 @@ interface(REG_INTER); %} +// Float register operands +operand vlRegF() %{ + constraint(ALLOC_IN_RC(float_reg_vl)); + match(RegF); + + format %{ %} + interface(REG_INTER); +%} + // XMM Double register operands operand regD() %{ predicate( UseSSE>=2 ); @@ -4110,6 +4119,15 @@ interface(REG_INTER); %} +// Double register operands +operand vlRegD() %{ + constraint(ALLOC_IN_RC(double_reg_vl)); + match(RegD); + + format %{ %} + interface(REG_INTER); +%} + // Vectors : note, we use legacy registers to avoid extra (unneeded in 32-bit VM) // runtime code generation via reg_class_dynamic. operand vecS() %{ @@ -4120,6 +4138,14 @@ interface(REG_INTER); %} +operand legVecS() %{ + constraint(ALLOC_IN_RC(vectors_reg_legacy)); + match(VecS); + + format %{ %} + interface(REG_INTER); +%} + operand vecD() %{ constraint(ALLOC_IN_RC(vectord_reg_legacy)); match(VecD); @@ -4128,6 +4154,14 @@ interface(REG_INTER); %} +operand legVecD() %{ + constraint(ALLOC_IN_RC(vectord_reg_legacy)); + match(VecD); + + format %{ %} + interface(REG_INTER); +%} + operand vecX() %{ constraint(ALLOC_IN_RC(vectorx_reg_legacy)); match(VecX); @@ -4136,6 +4170,14 @@ interface(REG_INTER); %} +operand legVecX() %{ + constraint(ALLOC_IN_RC(vectorx_reg_legacy)); + match(VecX); + + format %{ %} + interface(REG_INTER); +%} + operand vecY() %{ constraint(ALLOC_IN_RC(vectory_reg_legacy)); match(VecY); @@ -4144,6 +4186,14 @@ interface(REG_INTER); %} +operand legVecY() %{ + constraint(ALLOC_IN_RC(vectory_reg_legacy)); + match(VecY); + + format %{ %} + interface(REG_INTER); +%} + //----------Memory Operands---------------------------------------------------- // Direct Memory Operand operand direct(immP addr) %{ @@ -6515,6 +6565,26 @@ ins_pipe( pipe_slow ); %} +// Load Double +instruct MoveD2VL(vlRegD dst, regD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load double (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load Double +instruct MoveVL2D(regD dst, vlRegD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load double (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Store XMM register to memory (single-precision floating point) // MOVSS instruction instruct storeF(memory mem, regF src) %{ @@ -6528,6 +6598,26 @@ ins_pipe( pipe_slow ); %} +// Load Float +instruct MoveF2VL(vlRegF dst, regF src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load float (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load Float +instruct MoveVL2F(regF dst, vlRegF src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load float (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Store Float instruct storeFPR( memory mem, regFPR1 src) %{ predicate(UseSSE==0); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/x86_64.ad openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86_64.ad --- openjdk-lts-11~28/src/hotspot/cpu/x86/x86_64.ad 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86_64.ad 2019-01-18 04:23:48.000000000 +0000 @@ -3678,6 +3678,15 @@ interface(REG_INTER); %} +// Float register operands +operand vlRegF() %{ + constraint(ALLOC_IN_RC(float_reg_vl)); + match(RegF); + + format %{ %} + interface(REG_INTER); +%} + // Double register operands operand regD() %{ constraint(ALLOC_IN_RC(double_reg)); @@ -3687,9 +3696,27 @@ interface(REG_INTER); %} +// Double register operands +operand vlRegD() %{ + constraint(ALLOC_IN_RC(double_reg_vl)); + match(RegD); + + format %{ %} + interface(REG_INTER); +%} + // Vectors operand vecS() %{ - constraint(ALLOC_IN_RC(vectors_reg)); + constraint(ALLOC_IN_RC(vectors_reg_vlbwdq)); + match(VecS); + + format %{ %} + interface(REG_INTER); +%} + +// Vectors +operand legVecS() %{ + constraint(ALLOC_IN_RC(vectors_reg_legacy)); match(VecS); format %{ %} @@ -3697,7 +3724,15 @@ %} operand vecD() %{ - constraint(ALLOC_IN_RC(vectord_reg)); + constraint(ALLOC_IN_RC(vectord_reg_vlbwdq)); + match(VecD); + + format %{ %} + interface(REG_INTER); +%} + +operand legVecD() %{ + constraint(ALLOC_IN_RC(vectord_reg_legacy)); match(VecD); format %{ %} @@ -3705,7 +3740,15 @@ %} operand vecX() %{ - constraint(ALLOC_IN_RC(vectorx_reg)); + constraint(ALLOC_IN_RC(vectorx_reg_vlbwdq)); + match(VecX); + + format %{ %} + interface(REG_INTER); +%} + +operand legVecX() %{ + constraint(ALLOC_IN_RC(vectorx_reg_legacy)); match(VecX); format %{ %} @@ -3713,7 +3756,15 @@ %} operand vecY() %{ - constraint(ALLOC_IN_RC(vectory_reg)); + constraint(ALLOC_IN_RC(vectory_reg_vlbwdq)); + match(VecY); + + format %{ %} + interface(REG_INTER); +%} + +operand legVecY() %{ + constraint(ALLOC_IN_RC(vectory_reg_legacy)); match(VecY); format %{ %} @@ -5309,6 +5360,26 @@ ins_pipe(pipe_slow); // XXX %} +// Load Float +instruct MoveF2VL(vlRegF dst, regF src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load float (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load Float +instruct MoveVL2F(regF dst, vlRegF src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load float (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Load Double instruct loadD_partial(regD dst, memory mem) %{ @@ -5336,6 +5407,26 @@ ins_pipe(pipe_slow); // XXX %} +// Load Double +instruct MoveD2VL(vlRegD dst, regD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load double (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load Double +instruct MoveVL2D(regD dst, vlRegD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load double (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Load Effective Address instruct leaP8(rRegP dst, indOffset8 mem) %{ @@ -10880,7 +10971,7 @@ %} instruct string_compareL(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, - rax_RegI result, regD tmp1, rFlagsReg cr) + rax_RegI result, legVecS tmp1, rFlagsReg cr) %{ predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL); match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); @@ -10896,7 +10987,7 @@ %} instruct string_compareU(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, - rax_RegI result, regD tmp1, rFlagsReg cr) + rax_RegI result, legVecS tmp1, rFlagsReg cr) %{ predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); @@ -10912,7 +11003,7 @@ %} instruct string_compareLU(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2, - rax_RegI result, regD tmp1, rFlagsReg cr) + rax_RegI result, legVecS tmp1, rFlagsReg cr) %{ predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU); match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); @@ -10928,7 +11019,7 @@ %} instruct string_compareUL(rsi_RegP str1, rdx_RegI cnt1, rdi_RegP str2, rcx_RegI cnt2, - rax_RegI result, regD tmp1, rFlagsReg cr) + rax_RegI result, legVecS tmp1, rFlagsReg cr) %{ predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL); match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); @@ -10945,7 +11036,7 @@ // fast search of substring with known size. instruct string_indexof_conL(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, immI int_cnt2, - rbx_RegI result, regD vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -10974,7 +11065,7 @@ // fast search of substring with known size. instruct string_indexof_conU(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, immI int_cnt2, - rbx_RegI result, regD vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -11003,7 +11094,7 @@ // fast search of substring with known size. instruct string_indexof_conUL(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, immI int_cnt2, - rbx_RegI result, regD vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rax_RegI cnt2, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); @@ -11031,7 +11122,7 @@ %} instruct string_indexofL(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, rax_RegI cnt2, - rbx_RegI result, regD vec, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::LL)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -11048,7 +11139,7 @@ %} instruct string_indexofU(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, rax_RegI cnt2, - rbx_RegI result, regD vec, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -11065,7 +11156,7 @@ %} instruct string_indexofUL(rdi_RegP str1, rdx_RegI cnt1, rsi_RegP str2, rax_RegI cnt2, - rbx_RegI result, regD vec, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics && (((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UL)); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); @@ -11082,7 +11173,7 @@ %} instruct string_indexofU_char(rdi_RegP str1, rdx_RegI cnt1, rax_RegI ch, - rbx_RegI result, regD vec1, regD vec2, regD vec3, rcx_RegI tmp, rFlagsReg cr) + rbx_RegI result, legVecS vec1, legVecS vec2, legVecS vec3, rcx_RegI tmp, rFlagsReg cr) %{ predicate(UseSSE42Intrinsics); match(Set result (StrIndexOfChar (Binary str1 cnt1) ch)); @@ -11097,7 +11188,7 @@ // fast string equals instruct string_equals(rdi_RegP str1, rsi_RegP str2, rcx_RegI cnt, rax_RegI result, - regD tmp1, regD tmp2, rbx_RegI tmp3, rFlagsReg cr) + legVecS tmp1, legVecS tmp2, rbx_RegI tmp3, rFlagsReg cr) %{ match(Set result (StrEquals (Binary str1 str2) cnt)); effect(TEMP tmp1, TEMP tmp2, USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL tmp3, KILL cr); @@ -11113,7 +11204,7 @@ // fast array equals instruct array_equalsB(rdi_RegP ary1, rsi_RegP ary2, rax_RegI result, - regD tmp1, regD tmp2, rcx_RegI tmp3, rbx_RegI tmp4, rFlagsReg cr) + legVecS tmp1, legVecS tmp2, rcx_RegI tmp3, rbx_RegI tmp4, rFlagsReg cr) %{ predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL); match(Set result (AryEq ary1 ary2)); @@ -11129,7 +11220,7 @@ %} instruct array_equalsC(rdi_RegP ary1, rsi_RegP ary2, rax_RegI result, - regD tmp1, regD tmp2, rcx_RegI tmp3, rbx_RegI tmp4, rFlagsReg cr) + legVecS tmp1, legVecS tmp2, rcx_RegI tmp3, rbx_RegI tmp4, rFlagsReg cr) %{ predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (AryEq ary1 ary2)); @@ -11145,7 +11236,7 @@ %} instruct has_negatives(rsi_RegP ary1, rcx_RegI len, rax_RegI result, - regD tmp1, regD tmp2, rbx_RegI tmp3, rFlagsReg cr) + legVecS tmp1, legVecS tmp2, rbx_RegI tmp3, rFlagsReg cr) %{ match(Set result (HasNegatives ary1 len)); effect(TEMP tmp1, TEMP tmp2, USE_KILL ary1, USE_KILL len, KILL tmp3, KILL cr); @@ -11160,7 +11251,7 @@ %} // fast char[] to byte[] compression -instruct string_compress(rsi_RegP src, rdi_RegP dst, rdx_RegI len, regD tmp1, regD tmp2, regD tmp3, regD tmp4, +instruct string_compress(rsi_RegP src, rdi_RegP dst, rdx_RegI len, legVecS tmp1, legVecS tmp2, legVecS tmp3, legVecS tmp4, rcx_RegI tmp5, rax_RegI result, rFlagsReg cr) %{ match(Set result (StrCompressedCopy src (Binary dst len))); effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL tmp5, KILL cr); @@ -11176,7 +11267,7 @@ // fast byte[] to char[] inflation instruct string_inflate(Universe dummy, rsi_RegP src, rdi_RegP dst, rdx_RegI len, - regD tmp1, rcx_RegI tmp2, rFlagsReg cr) %{ + legVecS tmp1, rcx_RegI tmp2, rFlagsReg cr) %{ match(Set dummy (StrInflatedCopy src (Binary dst len))); effect(TEMP tmp1, TEMP tmp2, USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr); @@ -11190,7 +11281,7 @@ // encode char[] to byte[] in ISO_8859_1 instruct encode_iso_array(rsi_RegP src, rdi_RegP dst, rdx_RegI len, - regD tmp1, regD tmp2, regD tmp3, regD tmp4, + legVecS tmp1, legVecS tmp2, legVecS tmp3, legVecS tmp4, rcx_RegI tmp5, rax_RegI result, rFlagsReg cr) %{ match(Set result (EncodeISOArray src (Binary dst len))); effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL tmp5, KILL cr); diff -Nru openjdk-lts-11~28/src/hotspot/cpu/x86/x86.ad openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86.ad --- openjdk-lts-11~28/src/hotspot/cpu/x86/x86.ad 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/x86/x86.ad 2019-01-18 04:23:48.000000000 +0000 @@ -729,6 +729,7 @@ ); reg_class_dynamic float_reg(float_reg_evex, float_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic float_reg_vl(float_reg_evex, float_reg_legacy, %{ VM_Version::supports_evex() && VM_Version::supports_avx512vl() %} ); // Class for pre evex double registers reg_class double_reg_legacy(XMM0, XMM0b, @@ -789,6 +790,7 @@ ); reg_class_dynamic double_reg(double_reg_evex, double_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic double_reg_vl(double_reg_evex, double_reg_legacy, %{ VM_Version::supports_evex() && VM_Version::supports_avx512vl() %} ); // Class for pre evex 32bit vector registers reg_class vectors_reg_legacy(XMM0, @@ -849,6 +851,7 @@ ); reg_class_dynamic vectors_reg(vectors_reg_evex, vectors_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic vectors_reg_vlbwdq(vectors_reg_evex, vectors_reg_legacy, %{ VM_Version::supports_avx512vlbwdq() %} ); // Class for all 64bit vector registers reg_class vectord_reg_legacy(XMM0, XMM0b, @@ -909,6 +912,7 @@ ); reg_class_dynamic vectord_reg(vectord_reg_evex, vectord_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic vectord_reg_vlbwdq(vectord_reg_evex, vectord_reg_legacy, %{ VM_Version::supports_avx512vlbwdq() %} ); // Class for all 128bit vector registers reg_class vectorx_reg_legacy(XMM0, XMM0b, XMM0c, XMM0d, @@ -969,6 +973,7 @@ ); reg_class_dynamic vectorx_reg(vectorx_reg_evex, vectorx_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic vectorx_reg_vlbwdq(vectorx_reg_evex, vectorx_reg_legacy, %{ VM_Version::supports_avx512vlbwdq() %} ); // Class for all 256bit vector registers reg_class vectory_reg_legacy(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h, @@ -1029,9 +1034,10 @@ ); reg_class_dynamic vectory_reg(vectory_reg_evex, vectory_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic vectory_reg_vlbwdq(vectory_reg_evex, vectory_reg_legacy, %{ VM_Version::supports_avx512vlbwdq() %} ); // Class for all 512bit vector registers -reg_class vectorz_reg(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h, XMM0i, XMM0j, XMM0k, XMM0l, XMM0m, XMM0n, XMM0o, XMM0p, +reg_class vectorz_reg_evex(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h, XMM0i, XMM0j, XMM0k, XMM0l, XMM0m, XMM0n, XMM0o, XMM0p, XMM1, XMM1b, XMM1c, XMM1d, XMM1e, XMM1f, XMM1g, XMM1h, XMM1i, XMM1j, XMM1k, XMM1l, XMM1m, XMM1n, XMM1o, XMM1p, XMM2, XMM2b, XMM2c, XMM2d, XMM2e, XMM2f, XMM2g, XMM2h, XMM2i, XMM2j, XMM2k, XMM2l, XMM2m, XMM2n, XMM2o, XMM2p, XMM3, XMM3b, XMM3c, XMM3d, XMM3e, XMM3f, XMM3g, XMM3h, XMM3i, XMM3j, XMM3k, XMM3l, XMM3m, XMM3n, XMM3o, XMM3p, @@ -1067,6 +1073,30 @@ #endif ); +// Class for restricted 512bit vector registers +reg_class vectorz_reg_legacy(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h, XMM0i, XMM0j, XMM0k, XMM0l, XMM0m, XMM0n, XMM0o, XMM0p, + XMM1, XMM1b, XMM1c, XMM1d, XMM1e, XMM1f, XMM1g, XMM1h, XMM1i, XMM1j, XMM1k, XMM1l, XMM1m, XMM1n, XMM1o, XMM1p, + XMM2, XMM2b, XMM2c, XMM2d, XMM2e, XMM2f, XMM2g, XMM2h, XMM2i, XMM2j, XMM2k, XMM2l, XMM2m, XMM2n, XMM2o, XMM2p, + XMM3, XMM3b, XMM3c, XMM3d, XMM3e, XMM3f, XMM3g, XMM3h, XMM3i, XMM3j, XMM3k, XMM3l, XMM3m, XMM3n, XMM3o, XMM3p, + XMM4, XMM4b, XMM4c, XMM4d, XMM4e, XMM4f, XMM4g, XMM4h, XMM4i, XMM4j, XMM4k, XMM4l, XMM4m, XMM4n, XMM4o, XMM4p, + XMM5, XMM5b, XMM5c, XMM5d, XMM5e, XMM5f, XMM5g, XMM5h, XMM5i, XMM5j, XMM5k, XMM5l, XMM5m, XMM5n, XMM5o, XMM5p, + XMM6, XMM6b, XMM6c, XMM6d, XMM6e, XMM6f, XMM6g, XMM6h, XMM6i, XMM6j, XMM6k, XMM6l, XMM6m, XMM6n, XMM6o, XMM6p, + XMM7, XMM7b, XMM7c, XMM7d, XMM7e, XMM7f, XMM7g, XMM7h, XMM7i, XMM7j, XMM7k, XMM7l, XMM7m, XMM7n, XMM7o, XMM7p +#ifdef _LP64 + ,XMM8, XMM8b, XMM8c, XMM8d, XMM8e, XMM8f, XMM8g, XMM8h, XMM8i, XMM8j, XMM8k, XMM8l, XMM8m, XMM8n, XMM8o, XMM8p, + XMM9, XMM9b, XMM9c, XMM9d, XMM9e, XMM9f, XMM9g, XMM9h, XMM9i, XMM9j, XMM9k, XMM9l, XMM9m, XMM9n, XMM9o, XMM9p, + XMM10, XMM10b, XMM10c, XMM10d, XMM10e, XMM10f, XMM10g, XMM10h, XMM10i, XMM10j, XMM10k, XMM10l, XMM10m, XMM10n, XMM10o, XMM10p, + XMM11, XMM11b, XMM11c, XMM11d, XMM11e, XMM11f, XMM11g, XMM11h, XMM11i, XMM11j, XMM11k, XMM11l, XMM11m, XMM11n, XMM11o, XMM11p, + XMM12, XMM12b, XMM12c, XMM12d, XMM12e, XMM12f, XMM12g, XMM12h, XMM12i, XMM12j, XMM12k, XMM12l, XMM12m, XMM12n, XMM12o, XMM12p, + XMM13, XMM13b, XMM13c, XMM13d, XMM13e, XMM13f, XMM13g, XMM13h, XMM13i, XMM13j, XMM13k, XMM13l, XMM13m, XMM13n, XMM13o, XMM13p, + XMM14, XMM14b, XMM14c, XMM14d, XMM14e, XMM14f, XMM14g, XMM14h, XMM14i, XMM14j, XMM14k, XMM14l, XMM14m, XMM14n, XMM14o, XMM14p, + XMM15, XMM15b, XMM15c, XMM15d, XMM15e, XMM15f, XMM15g, XMM15h, XMM15i, XMM15j, XMM15k, XMM15l, XMM15m, XMM15n, XMM15o, XMM15p +#endif + ); + +reg_class_dynamic vectorz_reg(vectorz_reg_evex, vectorz_reg_legacy, %{ VM_Version::supports_evex() %} ); +reg_class_dynamic vectorz_reg_vl(vectorz_reg_evex, vectorz_reg_legacy, %{ VM_Version::supports_evex() && VM_Version::supports_avx512vl() %} ); + reg_class xmm0_reg(XMM0, XMM0b, XMM0c, XMM0d); reg_class ymm0_reg(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h); reg_class zmm0_reg(XMM0, XMM0b, XMM0c, XMM0d, XMM0e, XMM0f, XMM0g, XMM0h, XMM0i, XMM0j, XMM0k, XMM0l, XMM0m, XMM0n, XMM0o, XMM0p); @@ -1487,6 +1517,8 @@ // AVX1 supports 256bit vectors only for FLOAT and DOUBLE. if (UseAVX > 0 && (bt == T_FLOAT || bt == T_DOUBLE)) size = (UseAVX > 2) ? 64 : 32; + if (UseAVX > 2 && (bt == T_BYTE || bt == T_SHORT || bt == T_CHAR)) + size = (VM_Version::supports_avx512bw()) ? 64 : 32; // Use flag to limit vector size. size = MIN2(size,(int)MaxVectorSize); // Minimum 2 values in vector (or 4 for bytes). @@ -1528,7 +1560,7 @@ return MIN2(size,max_size); } -// Vector ideal reg corresponding to specidied size in bytes +// Vector ideal reg corresponding to specified size in bytes const uint Matcher::vector_ideal_reg(int size) { assert(MaxVectorSize >= size, ""); switch(size) { @@ -1648,10 +1680,28 @@ case Op_VecS: // copy whole register case Op_VecD: case Op_VecX: +#ifndef LP64 __ movdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo])); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ movdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo])); + } else { + __ vpxor(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[dst_lo]), 2); + __ vinserti32x4(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 0x0); + } +#endif break; case Op_VecY: +#ifndef LP64 __ vmovdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo])); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ vmovdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo])); + } else { + __ vpxor(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[dst_lo]), 2); + __ vinserti64x4(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 0x0); + } +#endif break; case Op_VecZ: __ evmovdquq(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 2); @@ -1703,10 +1753,28 @@ __ movq(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); break; case Op_VecX: +#ifndef LP64 __ movdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ movdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); + } else { + __ vpxor(as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), 2); + __ vinserti32x4(as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset),0x0); + } +#endif break; case Op_VecY: +#ifndef LP64 __ vmovdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ vmovdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); + } else { + __ vpxor(as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), 2); + __ vinserti64x4(as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset),0x0); + } +#endif break; case Op_VecZ: __ evmovdquq(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset), 2); @@ -1723,10 +1791,28 @@ __ movq(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); break; case Op_VecX: +#ifndef LP64 __ movdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ movdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); + } + else { + __ vextracti32x4(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), 0x0); + } +#endif break; case Op_VecY: +#ifndef LP64 __ vmovdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); +#else + if ((UseAVX < 3) || VM_Version::supports_avx512vl()) { + __ vmovdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); + } + else { + __ vextracti64x4(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), as_XMMRegister(Matcher::_regEncode[reg]), 0x0); + } +#endif break; case Op_VecZ: __ evmovdquq(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), 2); @@ -1908,7 +1994,6 @@ // in the ADLC because operands constitute user defined types which are used in // instruction definitions. -// This one generically applies only for evex, so only one version operand vecZ() %{ constraint(ALLOC_IN_RC(vectorz_reg)); match(VecZ); @@ -1917,6 +2002,14 @@ interface(REG_INTER); %} +operand legVecZ() %{ + constraint(ALLOC_IN_RC(vectorz_reg_vl)); + match(VecZ); + + format %{ %} + interface(REG_INTER); +%} + // Comparison Code for FP conditional move operand cmpOp_vcmppd() %{ match(Bool); @@ -2547,49 +2640,8 @@ ins_pipe(pipe_slow); %} -instruct absF_reg_reg(regF dst, regF src) %{ - predicate(VM_Version::supports_avxonly()); - match(Set dst (AbsF src)); - ins_cost(150); - format %{ "vandps $dst, $src, [0x7fffffff]\t# abs float by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vandps($dst$$XMMRegister, $src$$XMMRegister, - ExternalAddress(float_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} - -#ifdef _LP64 -instruct absF_reg_reg_evex(regF dst, regF src) %{ - predicate(UseAVX > 2 && VM_Version::supports_avx512vl()); - match(Set dst (AbsF src)); - ins_cost(150); - format %{ "vandps $dst, $src, [0x7fffffff]\t# abs float by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vandps($dst$$XMMRegister, $src$$XMMRegister, - ExternalAddress(float_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} - -instruct absF_reg_reg_evex_special(regF dst, regF src1, regF src2) %{ - predicate(VM_Version::supports_avx512novl()); - match(Set dst (AbsF src1)); - effect(TEMP src2); - ins_cost(150); - format %{ "vabsss $dst, $src1, $src2, [0x7fffffff]\t# abs float by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vabsss($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, - ExternalAddress(float_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} -#else // _LP64 -instruct absF_reg_reg_evex(regF dst, regF src) %{ - predicate(UseAVX > 2); +instruct absF_reg_reg(vlRegF dst, vlRegF src) %{ + predicate(UseAVX > 0); match(Set dst (AbsF src)); ins_cost(150); format %{ "vandps $dst, $src, [0x7fffffff]\t# abs float by sign masking" %} @@ -2600,7 +2652,6 @@ %} ins_pipe(pipe_slow); %} -#endif instruct absD_reg(regD dst) %{ predicate((UseSSE>=2) && (UseAVX == 0)); @@ -2614,51 +2665,8 @@ ins_pipe(pipe_slow); %} -instruct absD_reg_reg(regD dst, regD src) %{ - predicate(VM_Version::supports_avxonly()); - match(Set dst (AbsD src)); - ins_cost(150); - format %{ "vandpd $dst, $src, [0x7fffffffffffffff]\t" - "# abs double by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vandpd($dst$$XMMRegister, $src$$XMMRegister, - ExternalAddress(double_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} - -#ifdef _LP64 -instruct absD_reg_reg_evex(regD dst, regD src) %{ - predicate(UseAVX > 2 && VM_Version::supports_avx512vl()); - match(Set dst (AbsD src)); - ins_cost(150); - format %{ "vandpd $dst, $src, [0x7fffffffffffffff]\t" - "# abs double by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vandpd($dst$$XMMRegister, $src$$XMMRegister, - ExternalAddress(double_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} - -instruct absD_reg_reg_evex_special(regD dst, regD src1, regD src2) %{ - predicate(VM_Version::supports_avx512novl()); - match(Set dst (AbsD src1)); - effect(TEMP src2); - ins_cost(150); - format %{ "vabssd $dst, $src1, $src2, [0x7fffffffffffffff]\t# abs float by sign masking" %} - ins_encode %{ - int vector_len = 0; - __ vabssd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, - ExternalAddress(double_signmask()), vector_len); - %} - ins_pipe(pipe_slow); -%} -#else // _LP64 -instruct absD_reg_reg_evex(regD dst, regD src) %{ - predicate(UseAVX > 2); +instruct absD_reg_reg(vlRegD dst, vlRegD src) %{ + predicate(UseAVX > 0); match(Set dst (AbsD src)); ins_cost(150); format %{ "vandpd $dst, $src, [0x7fffffffffffffff]\t" @@ -2670,7 +2678,6 @@ %} ins_pipe(pipe_slow); %} -#endif instruct negF_reg(regF dst) %{ predicate((UseSSE>=1) && (UseAVX == 0)); @@ -2683,7 +2690,7 @@ ins_pipe(pipe_slow); %} -instruct negF_reg_reg(regF dst, regF src) %{ +instruct negF_reg_reg(vlRegF dst, vlRegF src) %{ predicate(UseAVX > 0); match(Set dst (NegF src)); ins_cost(150); @@ -2707,11 +2714,11 @@ ins_pipe(pipe_slow); %} -instruct negD_reg_reg(regD dst, regD src) %{ +instruct negD_reg_reg(vlRegD dst, vlRegD src) %{ predicate(UseAVX > 0); match(Set dst (NegD src)); ins_cost(150); - format %{ "vnegatess $dst, $src, [0x8000000000000000]\t" + format %{ "vnegatesd $dst, $src, [0x8000000000000000]\t" "# neg double by sign flipping" %} ins_encode %{ __ vnegatesd($dst$$XMMRegister, $src$$XMMRegister, @@ -2835,6 +2842,7 @@ // ====================VECTOR INSTRUCTIONS===================================== + // Load vectors (4 bytes long) instruct loadV4(vecS dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 4); @@ -2847,6 +2855,26 @@ ins_pipe( pipe_slow ); %} +// Load vectors (4 bytes long) +instruct MoveVecS2Leg(legVecS dst, vecS src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load vector (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load vectors (4 bytes long) +instruct MoveLeg2VecS(vecS dst, legVecS src) %{ + match(Set dst src); + format %{ "movss $dst,$src\t! load vector (4 bytes)" %} + ins_encode %{ + __ movflt($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Load vectors (8 bytes long) instruct loadV8(vecD dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 8); @@ -2859,6 +2887,26 @@ ins_pipe( pipe_slow ); %} +// Load vectors (8 bytes long) +instruct MoveVecD2Leg(legVecD dst, vecD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load vector (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load vectors (8 bytes long) +instruct MoveLeg2VecD(vecD dst, legVecD src) %{ + match(Set dst src); + format %{ "movsd $dst,$src\t! load vector (8 bytes)" %} + ins_encode %{ + __ movdbl($dst$$XMMRegister, $src$$XMMRegister); + %} + ins_pipe( fpu_reg_reg ); +%} + // Load vectors (16 bytes long) instruct loadV16(vecX dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 16); @@ -2871,6 +2919,36 @@ ins_pipe( pipe_slow ); %} +// Load vectors (16 bytes long) +instruct MoveVecX2Leg(legVecX dst, vecX src) %{ + match(Set dst src); + format %{ "movdqu $dst,$src\t! load vector (16 bytes)" %} + ins_encode %{ + if (UseAVX < 2 || VM_Version::supports_avx512vl()) { + __ movdqu($dst$$XMMRegister, $src$$XMMRegister); + } else { + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + } + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load vectors (16 bytes long) +instruct MoveLeg2VecX(vecX dst, legVecX src) %{ + match(Set dst src); + format %{ "movdqu $dst,$src\t! load vector (16 bytes)" %} + ins_encode %{ + if (UseAVX < 2 || VM_Version::supports_avx512vl()) { + __ movdqu($dst$$XMMRegister, $src$$XMMRegister); + } else { + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + } + %} + ins_pipe( fpu_reg_reg ); +%} + // Load vectors (32 bytes long) instruct loadV32(vecY dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 32); @@ -2883,6 +2961,36 @@ ins_pipe( pipe_slow ); %} +// Load vectors (32 bytes long) +instruct MoveVecY2Leg(legVecY dst, vecY src) %{ + match(Set dst src); + format %{ "vmovdqu $dst,$src\t! load vector (32 bytes)" %} + ins_encode %{ + if (UseAVX < 2 || VM_Version::supports_avx512vl()) { + __ vmovdqu($dst$$XMMRegister, $src$$XMMRegister); + } else { + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + } + %} + ins_pipe( fpu_reg_reg ); +%} + +// Load vectors (32 bytes long) +instruct MoveLeg2VecY(vecY dst, legVecY src) %{ + match(Set dst src); + format %{ "vmovdqu $dst,$src\t! load vector (32 bytes)" %} + ins_encode %{ + if (UseAVX < 2 || VM_Version::supports_avx512vl()) { + __ vmovdqu($dst$$XMMRegister, $src$$XMMRegister); + } else { + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + } + %} + ins_pipe( fpu_reg_reg ); +%} + // Load vectors (64 bytes long) instruct loadV64_dword(vecZ dst, memory mem) %{ predicate(n->as_LoadVector()->memory_size() == 64 && n->as_LoadVector()->element_size() <= 4); @@ -2909,6 +3017,26 @@ ins_pipe( pipe_slow ); %} +instruct MoveVecZ2Leg(legVecZ dst, vecZ src) %{ + match(Set dst src); + format %{ "vmovdquq $dst k0,$src\t! Move vector (64 bytes)" %} + ins_encode %{ + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + %} + ins_pipe( fpu_reg_reg ); +%} + +instruct MoveLeg2VecZ(vecZ dst, legVecZ src) %{ + match(Set dst src); + format %{ "vmovdquq $dst k0,$src\t! Move vector (64 bytes)" %} + ins_encode %{ + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $src$$XMMRegister, vector_len); + %} + ins_pipe( fpu_reg_reg ); +%} + // Store vectors instruct storeV4(memory mem, vecS src) %{ predicate(n->as_StoreVector()->memory_size() == 4); @@ -3068,6 +3196,44 @@ ins_pipe( pipe_slow ); %} +instruct Repl64B(legVecZ dst, rRegI src) %{ + predicate(n->as_Vector()->length() == 64 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateB src)); + format %{ "movd $dst,$src\n\t" + "punpcklbw $dst,$dst\n\t" + "pshuflw $dst,$dst,0x00\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate64B" %} + ins_encode %{ + __ movdl($dst$$XMMRegister, $src$$Register); + __ punpcklbw($dst$$XMMRegister, $dst$$XMMRegister); + __ pshuflw($dst$$XMMRegister, $dst$$XMMRegister, 0x00); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl64B_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 64 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateB (LoadB mem))); + format %{ "punpcklbw $dst,$mem\n\t" + "pshuflw $dst,$dst,0x00\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate64B" %} + ins_encode %{ + __ punpcklbw($dst$$XMMRegister, $mem$$Address); + __ pshuflw($dst$$XMMRegister, $dst$$XMMRegister, 0x00); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl16B_imm(vecX dst, immI con) %{ predicate(n->as_Vector()->length() == 16 && !VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB con)); @@ -3094,6 +3260,22 @@ ins_pipe( pipe_slow ); %} +instruct Repl64B_imm(legVecZ dst, immI con) %{ + predicate(n->as_Vector()->length() == 64 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateB con)); + format %{ "movq $dst,[$constantaddress]\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate64B($con)" %} + ins_encode %{ + __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 1))); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl4S(vecD dst, rRegI src) %{ predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS src)); @@ -3198,6 +3380,56 @@ ins_pipe( pipe_slow ); %} +instruct Repl32S(legVecZ dst, rRegI src) %{ + predicate(n->as_Vector()->length() == 32 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateS src)); + format %{ "movd $dst,$src\n\t" + "pshuflw $dst,$dst,0x00\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate32S" %} + ins_encode %{ + __ movdl($dst$$XMMRegister, $src$$Register); + __ pshuflw($dst$$XMMRegister, $dst$$XMMRegister, 0x00); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl32S_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 32 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateS (LoadS mem))); + format %{ "pshuflw $dst,$mem,0x00\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate32S" %} + ins_encode %{ + __ pshuflw($dst$$XMMRegister, $mem$$Address, 0x00); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl32S_imm(legVecZ dst, immI con) %{ + predicate(n->as_Vector()->length() == 32 && !VM_Version::supports_avx512vlbw()); + match(Set dst (ReplicateS con)); + format %{ "movq $dst,[$constantaddress]\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate32S($con)" %} + ins_encode %{ + __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 2))); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl4I(vecX dst, rRegI src) %{ predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateI src)); @@ -3246,6 +3478,36 @@ ins_pipe( pipe_slow ); %} +instruct Repl16I(legVecZ dst, rRegI src) %{ + predicate(n->as_Vector()->length() == 16 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateI src)); + format %{ "movd $dst,$src\n\t" + "pshufd $dst,$dst,0x00\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate16I" %} + ins_encode %{ + __ movdl($dst$$XMMRegister, $src$$Register); + __ pshufd($dst$$XMMRegister, $dst$$XMMRegister, 0x00); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl16I_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 16 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateI (LoadI mem))); + format %{ "pshufd $dst,$mem,0x00\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate16I" %} + ins_encode %{ + __ pshufd($dst$$XMMRegister, $mem$$Address, 0x00); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl4I_imm(vecX dst, immI con) %{ predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateI con)); @@ -3272,6 +3534,22 @@ ins_pipe( pipe_slow ); %} +instruct Repl16I_imm(legVecZ dst, immI con) %{ + predicate(n->as_Vector()->length() == 16 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateI con)); + format %{ "movq $dst,[$constantaddress]\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate16I($con)" %} + ins_encode %{ + __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 4))); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + // Long could be loaded into xmm register directly from memory. instruct Repl2L_mem(vecX dst, memory mem) %{ predicate(n->as_Vector()->length() == 2 && !VM_Version::supports_avx512vlbw()); @@ -3300,8 +3578,24 @@ %} ins_pipe( pipe_slow ); %} + +instruct Repl8L(legVecZ dst, rRegL src) %{ + predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateL src)); + format %{ "movdq $dst,$src\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8L" %} + ins_encode %{ + __ movdq($dst$$XMMRegister, $src$$Register); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} #else // _LP64 -instruct Repl4L(vecY dst, eRegL src, regD tmp) %{ +instruct Repl4L(vecY dst, eRegL src, vecY tmp) %{ predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateL src)); effect(TEMP dst, USE src, TEMP tmp); @@ -3319,6 +3613,27 @@ %} ins_pipe( pipe_slow ); %} + +instruct Repl8L(legVecZ dst, eRegL src, legVecZ tmp) %{ + predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateL src)); + effect(TEMP dst, USE src, TEMP tmp); + format %{ "movdl $dst,$src.lo\n\t" + "movdl $tmp,$src.hi\n\t" + "punpckldq $dst,$tmp\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8L" %} + ins_encode %{ + __ movdl($dst$$XMMRegister, $src$$Register); + __ movdl($tmp$$XMMRegister, HIGH_FROM_LOW($src$$Register)); + __ punpckldq($dst$$XMMRegister, $tmp$$XMMRegister); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} #endif // _LP64 instruct Repl4L_imm(vecY dst, immL con) %{ @@ -3335,6 +3650,22 @@ ins_pipe( pipe_slow ); %} +instruct Repl8L_imm(legVecZ dst, immL con) %{ + predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateL con)); + format %{ "movq $dst,[$constantaddress]\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8L($con)" %} + ins_encode %{ + __ movq($dst$$XMMRegister, $constantaddress($con)); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl4L_mem(vecY dst, memory mem) %{ predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateL (LoadL mem))); @@ -3349,6 +3680,22 @@ ins_pipe( pipe_slow ); %} +instruct Repl8L_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateL (LoadL mem))); + format %{ "movq $dst,$mem\n\t" + "punpcklqdq $dst,$dst\n\t" + "vinserti128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8L" %} + ins_encode %{ + __ movq($dst$$XMMRegister, $mem$$Address); + __ punpcklqdq($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl2F_mem(vecD dst, memory mem) %{ predicate(n->as_Vector()->length() == 2 && UseAVX > 0 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateF (LoadF mem))); @@ -3369,8 +3716,8 @@ ins_pipe( pipe_slow ); %} -instruct Repl8F(vecY dst, regF src) %{ - predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); +instruct Repl8F(vecY dst, vlRegF src) %{ + predicate(n->as_Vector()->length() == 8 && UseAVX > 0 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateF src)); format %{ "pshufd $dst,$src,0x00\n\t" "vinsertf128_high $dst,$dst\t! replicate8F" %} @@ -3393,6 +3740,34 @@ ins_pipe( pipe_slow ); %} +instruct Repl16F(legVecZ dst, vlRegF src) %{ + predicate(n->as_Vector()->length() == 16 && UseAVX > 0 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateF src)); + format %{ "pshufd $dst,$src,0x00\n\t" + "vinsertf128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate16F" %} + ins_encode %{ + __ pshufd($dst$$XMMRegister, $src$$XMMRegister, 0x00); + __ vinsertf128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl16F_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 16 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateF (LoadF mem))); + format %{ "pshufd $dst,$mem,0x00\n\t" + "vinsertf128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate16F" %} + ins_encode %{ + __ pshufd($dst$$XMMRegister, $mem$$Address, 0x00); + __ vinsertf128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + instruct Repl2F_zero(vecD dst, immF0 zero) %{ predicate(n->as_Vector()->length() == 2 && UseAVX < 3); match(Set dst (ReplicateF zero)); @@ -3434,8 +3809,8 @@ ins_pipe( pipe_slow ); %} -instruct Repl4D(vecY dst, regD src) %{ - predicate(n->as_Vector()->length() == 4 && !VM_Version::supports_avx512vl()); +instruct Repl4D(vecY dst, vlRegD src) %{ + predicate(n->as_Vector()->length() == 4 && UseAVX > 0 && !VM_Version::supports_avx512vl()); match(Set dst (ReplicateD src)); format %{ "pshufd $dst,$src,0x44\n\t" "vinsertf128_high $dst,$dst\t! replicate4D" %} @@ -3458,6 +3833,34 @@ ins_pipe( pipe_slow ); %} +instruct Repl8D(legVecZ dst, vlRegD src) %{ + predicate(n->as_Vector()->length() == 8 && UseAVX > 0 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateD src)); + format %{ "pshufd $dst,$src,0x44\n\t" + "vinsertf128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8D" %} + ins_encode %{ + __ pshufd($dst$$XMMRegister, $src$$XMMRegister, 0x44); + __ vinsertf128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + +instruct Repl8D_mem(legVecZ dst, memory mem) %{ + predicate(n->as_Vector()->length() == 8 && !VM_Version::supports_avx512vl()); + match(Set dst (ReplicateD (LoadD mem))); + format %{ "pshufd $dst,$mem,0x44\n\t" + "vinsertf128_high $dst,$dst\t" + "vinserti64x4 $dst,$dst,$dst,0x1\t! replicate8D" %} + ins_encode %{ + __ pshufd($dst$$XMMRegister, $mem$$Address, 0x44); + __ vinsertf128_high($dst$$XMMRegister, $dst$$XMMRegister); + __ vinserti64x4($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, 0x1); + %} + ins_pipe( pipe_slow ); +%} + // Replicate double (8 byte) scalar zero to be vector instruct Repl2D_zero(vecX dst, immD0 zero) %{ predicate(n->as_Vector()->length() == 2 && UseAVX < 3); @@ -3736,7 +4139,7 @@ ins_pipe( pipe_slow ); %} #else // _LP64 -instruct Repl2L(vecX dst, eRegL src, regD tmp) %{ +instruct Repl2L(vecX dst, eRegL src, vecX tmp) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (ReplicateL src)); effect(TEMP dst, USE src, TEMP tmp); @@ -3791,7 +4194,7 @@ %} // Replicate float (4 byte) scalar to be vector -instruct Repl2F(vecD dst, regF src) %{ +instruct Repl2F(vecD dst, vlRegF src) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (ReplicateF src)); format %{ "pshufd $dst,$dst,0x00\t! replicate2F" %} @@ -3801,7 +4204,7 @@ ins_pipe( fpu_reg_reg ); %} -instruct Repl4F(vecX dst, regF src) %{ +instruct Repl4F(vecX dst, vlRegF src) %{ predicate(n->as_Vector()->length() == 4); match(Set dst (ReplicateF src)); format %{ "pshufd $dst,$dst,0x00\t! replicate4F" %} @@ -3812,7 +4215,7 @@ %} // Replicate double (8 bytes) scalar to be vector -instruct Repl2D(vecX dst, regD src) %{ +instruct Repl2D(vecX dst, vlRegD src) %{ predicate(n->as_Vector()->length() == 2); match(Set dst (ReplicateD src)); format %{ "pshufd $dst,$src,0x44\t! replicate2D" %} @@ -3825,31 +4228,31 @@ // ====================EVEX REPLICATE============================================= instruct Repl4B_mem_evex(vecS dst, memory mem) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB (LoadB mem))); format %{ "vpbroadcastb $dst,$mem\t! replicate4B" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8B_mem_evex(vecD dst, memory mem) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB (LoadB mem))); format %{ "vpbroadcastb $dst,$mem\t! replicate8B" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl16B_evex(vecX dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB src)); - format %{ "vpbroadcastb $dst,$src\t! replicate16B" %} + format %{ "evpbroadcastb $dst,$src\t! replicate16B" %} ins_encode %{ int vector_len = 0; __ evpbroadcastb($dst$$XMMRegister, $src$$Register, vector_len); @@ -3858,20 +4261,20 @@ %} instruct Repl16B_mem_evex(vecX dst, memory mem) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB (LoadB mem))); format %{ "vpbroadcastb $dst,$mem\t! replicate16B" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl32B_evex(vecY dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB src)); - format %{ "vpbroadcastb $dst,$src\t! replicate32B" %} + format %{ "evpbroadcastb $dst,$src\t! replicate32B" %} ins_encode %{ int vector_len = 1; __ evpbroadcastb($dst$$XMMRegister, $src$$Register, vector_len); @@ -3880,20 +4283,20 @@ %} instruct Repl32B_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB (LoadB mem))); format %{ "vpbroadcastb $dst,$mem\t! replicate32B" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl64B_evex(vecZ dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 64 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateB src)); - format %{ "vpbroadcastb $dst,$src\t! upper replicate64B" %} + format %{ "evpbroadcastb $dst,$src\t! upper replicate64B" %} ins_encode %{ int vector_len = 2; __ evpbroadcastb($dst$$XMMRegister, $src$$Register, vector_len); @@ -3902,51 +4305,51 @@ %} instruct Repl64B_mem_evex(vecZ dst, memory mem) %{ - predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 64 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateB (LoadB mem))); format %{ "vpbroadcastb $dst,$mem\t! replicate64B" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl16B_imm_evex(vecX dst, immI con) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastb $dst,$dst\t! replicate16B" %} ins_encode %{ int vector_len = 0; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 1))); - __ evpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl32B_imm_evex(vecY dst, immI con) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateB con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastb $dst,$dst\t! replicate32B" %} ins_encode %{ int vector_len = 1; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 1))); - __ evpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl64B_imm_evex(vecZ dst, immI con) %{ - predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 64 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateB con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastb $dst,$dst\t! upper replicate64B" %} ins_encode %{ int vector_len = 2; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 1))); - __ evpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -3964,9 +4367,9 @@ %} instruct Repl4S_evex(vecD dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS src)); - format %{ "vpbroadcastw $dst,$src\t! replicate4S" %} + format %{ "evpbroadcastw $dst,$src\t! replicate4S" %} ins_encode %{ int vector_len = 0; __ evpbroadcastw($dst$$XMMRegister, $src$$Register, vector_len); @@ -3975,20 +4378,20 @@ %} instruct Repl4S_mem_evex(vecD dst, memory mem) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS (LoadS mem))); format %{ "vpbroadcastw $dst,$mem\t! replicate4S" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8S_evex(vecX dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS src)); - format %{ "vpbroadcastw $dst,$src\t! replicate8S" %} + format %{ "evpbroadcastw $dst,$src\t! replicate8S" %} ins_encode %{ int vector_len = 0; __ evpbroadcastw($dst$$XMMRegister, $src$$Register, vector_len); @@ -3997,20 +4400,20 @@ %} instruct Repl8S_mem_evex(vecX dst, memory mem) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS (LoadS mem))); format %{ "vpbroadcastw $dst,$mem\t! replicate8S" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl16S_evex(vecY dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS src)); - format %{ "vpbroadcastw $dst,$src\t! replicate16S" %} + format %{ "evpbroadcastw $dst,$src\t! replicate16S" %} ins_encode %{ int vector_len = 1; __ evpbroadcastw($dst$$XMMRegister, $src$$Register, vector_len); @@ -4019,20 +4422,20 @@ %} instruct Repl16S_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS (LoadS mem))); format %{ "vpbroadcastw $dst,$mem\t! replicate16S" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl32S_evex(vecZ dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateS src)); - format %{ "vpbroadcastw $dst,$src\t! replicate32S" %} + format %{ "evpbroadcastw $dst,$src\t! replicate32S" %} ins_encode %{ int vector_len = 2; __ evpbroadcastw($dst$$XMMRegister, $src$$Register, vector_len); @@ -4041,51 +4444,51 @@ %} instruct Repl32S_mem_evex(vecZ dst, memory mem) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateS (LoadS mem))); format %{ "vpbroadcastw $dst,$mem\t! replicate32S" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8S_imm_evex(vecX dst, immI con) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastw $dst,$dst\t! replicate8S" %} ins_encode %{ int vector_len = 0; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 2))); - __ evpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl16S_imm_evex(vecY dst, immI con) %{ - predicate(n->as_Vector()->length() == 16 && VM_Version::supports_avx512vlbw()); + predicate(n->as_Vector()->length() == 16 && UseAVX > 2 && VM_Version::supports_avx512vlbw()); match(Set dst (ReplicateS con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastw $dst,$dst\t! replicate16S" %} ins_encode %{ int vector_len = 1; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 2))); - __ evpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl32S_imm_evex(vecZ dst, immI con) %{ - predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw()); + predicate(n->as_Vector()->length() == 32 && UseAVX > 2 && VM_Version::supports_avx512bw()); match(Set dst (ReplicateS con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastw $dst,$dst\t! replicate32S" %} ins_encode %{ int vector_len = 2; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 2))); - __ evpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4103,9 +4506,9 @@ %} instruct Repl4I_evex(vecX dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI src)); - format %{ "vpbroadcastd $dst,$src\t! replicate4I" %} + format %{ "evpbroadcastd $dst,$src\t! replicate4I" %} ins_encode %{ int vector_len = 0; __ evpbroadcastd($dst$$XMMRegister, $src$$Register, vector_len); @@ -4114,20 +4517,20 @@ %} instruct Repl4I_mem_evex(vecX dst, memory mem) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI (LoadI mem))); format %{ "vpbroadcastd $dst,$mem\t! replicate4I" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8I_evex(vecY dst, rRegI src) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI src)); - format %{ "vpbroadcastd $dst,$src\t! replicate8I" %} + format %{ "evpbroadcastd $dst,$src\t! replicate8I" %} ins_encode %{ int vector_len = 1; __ evpbroadcastd($dst$$XMMRegister, $src$$Register, vector_len); @@ -4136,12 +4539,12 @@ %} instruct Repl8I_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI (LoadI mem))); format %{ "vpbroadcastd $dst,$mem\t! replicate8I" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4149,7 +4552,7 @@ instruct Repl16I_evex(vecZ dst, rRegI src) %{ predicate(n->as_Vector()->length() == 16 && UseAVX > 2); match(Set dst (ReplicateI src)); - format %{ "vpbroadcastd $dst,$src\t! replicate16I" %} + format %{ "evpbroadcastd $dst,$src\t! replicate16I" %} ins_encode %{ int vector_len = 2; __ evpbroadcastd($dst$$XMMRegister, $src$$Register, vector_len); @@ -4163,33 +4566,33 @@ format %{ "vpbroadcastd $dst,$mem\t! replicate16I" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl4I_imm_evex(vecX dst, immI con) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI con)); format %{ "movq $dst,[$constantaddress]\t! replicate8I($con)\n\t" "vpbroadcastd $dst,$dst\t! replicate4I" %} ins_encode %{ int vector_len = 0; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 4))); - __ evpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8I_imm_evex(vecY dst, immI con) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateI con)); format %{ "movq $dst,[$constantaddress]\t! replicate8I($con)\n\t" "vpbroadcastd $dst,$dst\t! replicate8I" %} ins_encode %{ int vector_len = 1; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 4))); - __ evpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4202,7 +4605,7 @@ ins_encode %{ int vector_len = 2; __ movq($dst$$XMMRegister, $constantaddress(replicate8_imm($con$$constant, 4))); - __ evpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4222,9 +4625,9 @@ // Replicate long (8 byte) scalar to be vector #ifdef _LP64 instruct Repl4L_evex(vecY dst, rRegL src) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateL src)); - format %{ "vpbroadcastq $dst,$src\t! replicate4L" %} + format %{ "evpbroadcastq $dst,$src\t! replicate4L" %} ins_encode %{ int vector_len = 1; __ evpbroadcastq($dst$$XMMRegister, $src$$Register, vector_len); @@ -4235,7 +4638,7 @@ instruct Repl8L_evex(vecZ dst, rRegL src) %{ predicate(n->as_Vector()->length() == 8 && UseAVX > 2); match(Set dst (ReplicateL src)); - format %{ "vpbroadcastq $dst,$src\t! replicate8L" %} + format %{ "evpbroadcastq $dst,$src\t! replicate8L" %} ins_encode %{ int vector_len = 2; __ evpbroadcastq($dst$$XMMRegister, $src$$Register, vector_len); @@ -4244,7 +4647,7 @@ %} #else // _LP64 instruct Repl4L_evex(vecY dst, eRegL src, regD tmp) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateL src)); effect(TEMP dst, USE src, TEMP tmp); format %{ "movdl $dst,$src.lo\n\t" @@ -4256,12 +4659,12 @@ __ movdl($dst$$XMMRegister, $src$$Register); __ movdl($tmp$$XMMRegister, HIGH_FROM_LOW($src$$Register)); __ punpckldq($dst$$XMMRegister, $tmp$$XMMRegister); - __ evpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct Repl8L_evex(vecZ dst, eRegL src, regD tmp) %{ +instruct Repl8L_evex(legVecZ dst, eRegL src, legVecZ tmp) %{ predicate(n->as_Vector()->length() == 8 && UseAVX > 2); match(Set dst (ReplicateL src)); effect(TEMP dst, USE src, TEMP tmp); @@ -4274,21 +4677,21 @@ __ movdl($dst$$XMMRegister, $src$$Register); __ movdl($tmp$$XMMRegister, HIGH_FROM_LOW($src$$Register)); __ punpckldq($dst$$XMMRegister, $tmp$$XMMRegister); - __ evpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} #endif // _LP64 instruct Repl4L_imm_evex(vecY dst, immL con) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateL con)); format %{ "movq $dst,[$constantaddress]\n\t" "vpbroadcastq $dst,$dst\t! replicate4L" %} ins_encode %{ int vector_len = 1; __ movq($dst$$XMMRegister, $constantaddress($con)); - __ evpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4301,29 +4704,29 @@ ins_encode %{ int vector_len = 2; __ movq($dst$$XMMRegister, $constantaddress($con)); - __ evpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl2L_mem_evex(vecX dst, memory mem) %{ - predicate(n->as_Vector()->length() == 2 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 2 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateL (LoadL mem))); format %{ "vpbroadcastd $dst,$mem\t! replicate2L" %} ins_encode %{ int vector_len = 0; - __ evpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl4L_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateL (LoadL mem))); format %{ "vpbroadcastd $dst,$mem\t! replicate4L" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4334,7 +4737,7 @@ format %{ "vpbroadcastd $dst,$mem\t! replicate8L" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastq($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4352,23 +4755,23 @@ %} instruct Repl8F_evex(vecY dst, regF src) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateF src)); - format %{ "vbroadcastss $dst,$src\t! replicate8F" %} + format %{ "vpbroadcastss $dst,$src\t! replicate8F" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastss($dst$$XMMRegister, $src$$XMMRegister, vector_len); + __ vpbroadcastss($dst$$XMMRegister, $src$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl8F_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 8 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 8 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateF (LoadF mem))); format %{ "vbroadcastss $dst,$mem\t! replicate8F" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastss($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastss($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4376,10 +4779,10 @@ instruct Repl16F_evex(vecZ dst, regF src) %{ predicate(n->as_Vector()->length() == 16 && UseAVX > 2); match(Set dst (ReplicateF src)); - format %{ "vbroadcastss $dst,$src\t! replicate16F" %} + format %{ "vpbroadcastss $dst,$src\t! replicate16F" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastss($dst$$XMMRegister, $src$$XMMRegister, vector_len); + __ vpbroadcastss($dst$$XMMRegister, $src$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4390,7 +4793,7 @@ format %{ "vbroadcastss $dst,$mem\t! replicate16F" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastss($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastss($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4444,23 +4847,23 @@ %} instruct Repl4D_evex(vecY dst, regD src) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateD src)); - format %{ "vbroadcastsd $dst,$src\t! replicate4D" %} + format %{ "vpbroadcastsd $dst,$src\t! replicate4D" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastsd($dst$$XMMRegister, $src$$XMMRegister, vector_len); + __ vpbroadcastsd($dst$$XMMRegister, $src$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} instruct Repl4D_mem_evex(vecY dst, memory mem) %{ - predicate(n->as_Vector()->length() == 4 && VM_Version::supports_avx512vl()); + predicate(n->as_Vector()->length() == 4 && UseAVX > 2 && VM_Version::supports_avx512vl()); match(Set dst (ReplicateD (LoadD mem))); format %{ "vbroadcastsd $dst,$mem\t! replicate4D" %} ins_encode %{ int vector_len = 1; - __ evpbroadcastsd($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastsd($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4468,10 +4871,10 @@ instruct Repl8D_evex(vecZ dst, regD src) %{ predicate(n->as_Vector()->length() == 8 && UseAVX > 2); match(Set dst (ReplicateD src)); - format %{ "vbroadcastsd $dst,$src\t! replicate8D" %} + format %{ "vpbroadcastsd $dst,$src\t! replicate8D" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastsd($dst$$XMMRegister, $src$$XMMRegister, vector_len); + __ vpbroadcastsd($dst$$XMMRegister, $src$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4482,7 +4885,7 @@ format %{ "vbroadcastsd $dst,$mem\t! replicate8D" %} ins_encode %{ int vector_len = 2; - __ evpbroadcastsd($dst$$XMMRegister, $mem$$Address, vector_len); + __ vpbroadcastsd($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} @@ -4525,7 +4928,7 @@ // ====================REDUCTION ARITHMETIC======================================= -instruct rsadd2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, regF tmp, regF tmp2) %{ +instruct rsadd2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, vecD tmp, vecD tmp2) %{ predicate(UseSSE > 2 && UseAVX == 0); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp2, TEMP tmp); @@ -4544,7 +4947,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, regF tmp, regF tmp2) %{ +instruct rvadd2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, vecD tmp, vecD tmp2) %{ predicate(VM_Version::supports_avxonly()); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4562,7 +4965,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd2I_reduction_reg_evex(rRegI dst, rRegI src1, vecD src2, regF tmp, regF tmp2) %{ +instruct rvadd2I_reduction_reg_evex(rRegI dst, rRegI src1, vecD src2, vecD tmp, vecD tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4582,7 +4985,7 @@ ins_pipe( pipe_slow ); %} -instruct rsadd4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rsadd4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseSSE > 2 && UseAVX == 0); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4603,7 +5006,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rvadd4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(VM_Version::supports_avxonly()); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4623,7 +5026,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd4I_reduction_reg_evex(rRegI dst, rRegI src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rvadd4I_reduction_reg_evex(rRegI dst, rRegI src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4647,7 +5050,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd8I_reduction_reg(rRegI dst, rRegI src1, vecY src2, regF tmp, regF tmp2) %{ +instruct rvadd8I_reduction_reg(rRegI dst, rRegI src1, vecY src2, vecY tmp, vecY tmp2) %{ predicate(VM_Version::supports_avxonly()); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4671,7 +5074,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd8I_reduction_reg_evex(rRegI dst, rRegI src1, vecY src2, regF tmp, regF tmp2) %{ +instruct rvadd8I_reduction_reg_evex(rRegI dst, rRegI src1, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4699,7 +5102,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd16I_reduction_reg_evex(rRegI dst, rRegI src1, vecZ src2, regF tmp, regF tmp2, regF tmp3) %{ +instruct rvadd16I_reduction_reg_evex(rRegI dst, rRegI src1, legVecZ src2, legVecZ tmp, legVecZ tmp2, legVecZ tmp3) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2, TEMP tmp3); @@ -4731,7 +5134,7 @@ %} #ifdef _LP64 -instruct rvadd2L_reduction_reg(rRegL dst, rRegL src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rvadd2L_reduction_reg(rRegL dst, rRegL src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4750,7 +5153,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd4L_reduction_reg(rRegL dst, rRegL src1, vecY src2, regF tmp, regF tmp2) %{ +instruct rvadd4L_reduction_reg(rRegL dst, rRegL src1, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4773,7 +5176,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd8L_reduction_reg(rRegL dst, rRegL src1, vecZ src2, regF tmp, regF tmp2) %{ +instruct rvadd8L_reduction_reg(rRegL dst, rRegL src1, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -4801,7 +5204,7 @@ %} #endif -instruct rsadd2F_reduction_reg(regF dst, vecD src2, regF tmp) %{ +instruct rsadd2F_reduction_reg(regF dst, vecD src2, vecD tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (AddReductionVF dst src2)); effect(TEMP dst, TEMP tmp); @@ -4816,7 +5219,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd2F_reduction_reg(regF dst, vecD src2, regF tmp) %{ +instruct rvadd2F_reduction_reg(regF dst, vecD src2, vecD tmp) %{ predicate(UseAVX > 0); match(Set dst (AddReductionVF dst src2)); effect(TEMP dst, TEMP tmp); @@ -4831,7 +5234,7 @@ ins_pipe( pipe_slow ); %} -instruct rsadd4F_reduction_reg(regF dst, vecX src2, regF tmp) %{ +instruct rsadd4F_reduction_reg(regF dst, vecX src2, vecX tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (AddReductionVF dst src2)); effect(TEMP dst, TEMP tmp); @@ -4854,7 +5257,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd4F_reduction_reg(regF dst, vecX src2, regF tmp) %{ +instruct rvadd4F_reduction_reg(regF dst, vecX src2, vecX tmp) %{ predicate(UseAVX > 0); match(Set dst (AddReductionVF dst src2)); effect(TEMP tmp, TEMP dst); @@ -4877,7 +5280,7 @@ ins_pipe( pipe_slow ); %} -instruct radd8F_reduction_reg(regF dst, vecY src2, regF tmp, regF tmp2) %{ +instruct radd8F_reduction_reg(regF dst, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 0); match(Set dst (AddReductionVF dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -4916,7 +5319,7 @@ ins_pipe( pipe_slow ); %} -instruct radd16F_reduction_reg(regF dst, vecZ src2, regF tmp, regF tmp2) %{ +instruct radd16F_reduction_reg(regF dst, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVF dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -4987,7 +5390,7 @@ ins_pipe( pipe_slow ); %} -instruct rsadd2D_reduction_reg(regD dst, vecX src2, regD tmp) %{ +instruct rsadd2D_reduction_reg(regD dst, vecX src2, vecX tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (AddReductionVD dst src2)); effect(TEMP tmp, TEMP dst); @@ -5002,7 +5405,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd2D_reduction_reg(regD dst, vecX src2, regD tmp) %{ +instruct rvadd2D_reduction_reg(regD dst, vecX src2, vecX tmp) %{ predicate(UseAVX > 0); match(Set dst (AddReductionVD dst src2)); effect(TEMP tmp, TEMP dst); @@ -5017,14 +5420,14 @@ ins_pipe( pipe_slow ); %} -instruct rvadd4D_reduction_reg(regD dst, vecY src2, regD tmp, regD tmp2) %{ +instruct rvadd4D_reduction_reg(regD dst, vecY src2, vecX tmp, vecX tmp2) %{ predicate(UseAVX > 0); match(Set dst (AddReductionVD dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); format %{ "vaddsd $dst,$dst,$src2\n\t" "pshufd $tmp,$src2,0xE\n\t" "vaddsd $dst,$dst,$tmp\n\t" - "vextractf32x4 $tmp2,$src2,0x1\n\t" + "vextractf128 $tmp2,$src2,0x1\n\t" "vaddsd $dst,$dst,$tmp2\n\t" "pshufd $tmp,$tmp2,0xE\n\t" "vaddsd $dst,$dst,$tmp\t! add reduction4D" %} @@ -5032,7 +5435,7 @@ __ vaddsd($dst$$XMMRegister, $dst$$XMMRegister, $src2$$XMMRegister); __ pshufd($tmp$$XMMRegister, $src2$$XMMRegister, 0xE); __ vaddsd($dst$$XMMRegister, $dst$$XMMRegister, $tmp$$XMMRegister); - __ vextractf32x4($tmp2$$XMMRegister, $src2$$XMMRegister, 0x1); + __ vextractf128($tmp2$$XMMRegister, $src2$$XMMRegister, 0x1); __ vaddsd($dst$$XMMRegister, $dst$$XMMRegister, $tmp2$$XMMRegister); __ pshufd($tmp$$XMMRegister, $tmp2$$XMMRegister, 0xE); __ vaddsd($dst$$XMMRegister, $dst$$XMMRegister, $tmp$$XMMRegister); @@ -5040,7 +5443,7 @@ ins_pipe( pipe_slow ); %} -instruct rvadd8D_reduction_reg(regD dst, vecZ src2, regD tmp, regD tmp2) %{ +instruct rvadd8D_reduction_reg(regD dst, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2); match(Set dst (AddReductionVD dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -5079,7 +5482,7 @@ ins_pipe( pipe_slow ); %} -instruct rsmul2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, regF tmp, regF tmp2) %{ +instruct rsmul2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, vecD tmp, vecD tmp2) %{ predicate(UseSSE > 3 && UseAVX == 0); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5098,7 +5501,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, regF tmp, regF tmp2) %{ +instruct rvmul2I_reduction_reg(rRegI dst, rRegI src1, vecD src2, vecD tmp, vecD tmp2) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5118,7 +5521,7 @@ ins_pipe( pipe_slow ); %} -instruct rsmul4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rsmul4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseSSE > 3 && UseAVX == 0); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5141,7 +5544,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rvmul4I_reduction_reg(rRegI dst, rRegI src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5165,8 +5568,8 @@ ins_pipe( pipe_slow ); %} -instruct rvmul8I_reduction_reg(rRegI dst, rRegI src1, vecY src2, regF tmp, regF tmp2) %{ - predicate(UseAVX > 0); +instruct rvmul8I_reduction_reg(rRegI dst, rRegI src1, vecY src2, vecY tmp, vecY tmp2) %{ + predicate(UseAVX > 1); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2); format %{ "vextracti128_high $tmp,$src2\n\t" @@ -5193,7 +5596,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul16I_reduction_reg(rRegI dst, rRegI src1, vecZ src2, regF tmp, regF tmp2, regF tmp3) %{ +instruct rvmul16I_reduction_reg(rRegI dst, rRegI src1, legVecZ src2, legVecZ tmp, legVecZ tmp2, legVecZ tmp3) %{ predicate(UseAVX > 2); match(Set dst (MulReductionVI src1 src2)); effect(TEMP tmp, TEMP tmp2, TEMP tmp3); @@ -5225,7 +5628,7 @@ %} #ifdef _LP64 -instruct rvmul2L_reduction_reg(rRegL dst, rRegL src1, vecX src2, regF tmp, regF tmp2) %{ +instruct rvmul2L_reduction_reg(rRegL dst, rRegL src1, vecX src2, vecX tmp, vecX tmp2) %{ predicate(UseAVX > 2 && VM_Version::supports_avx512dq()); match(Set dst (MulReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5244,7 +5647,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul4L_reduction_reg(rRegL dst, rRegL src1, vecY src2, regF tmp, regF tmp2) %{ +instruct rvmul4L_reduction_reg(rRegL dst, rRegL src1, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 2 && VM_Version::supports_avx512dq()); match(Set dst (MulReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5267,7 +5670,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul8L_reduction_reg(rRegL dst, rRegL src1, vecZ src2, regF tmp, regF tmp2) %{ +instruct rvmul8L_reduction_reg(rRegL dst, rRegL src1, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2 && VM_Version::supports_avx512dq()); match(Set dst (MulReductionVL src1 src2)); effect(TEMP tmp, TEMP tmp2); @@ -5295,7 +5698,7 @@ %} #endif -instruct rsmul2F_reduction(regF dst, vecD src2, regF tmp) %{ +instruct rsmul2F_reduction(regF dst, vecD src2, vecD tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (MulReductionVF dst src2)); effect(TEMP dst, TEMP tmp); @@ -5310,7 +5713,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul2F_reduction_reg(regF dst, vecD src2, regF tmp) %{ +instruct rvmul2F_reduction_reg(regF dst, vecD src2, vecD tmp) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVF dst src2)); effect(TEMP tmp, TEMP dst); @@ -5325,7 +5728,7 @@ ins_pipe( pipe_slow ); %} -instruct rsmul4F_reduction_reg(regF dst, vecX src2, regF tmp) %{ +instruct rsmul4F_reduction_reg(regF dst, vecX src2, vecX tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (MulReductionVF dst src2)); effect(TEMP dst, TEMP tmp); @@ -5348,7 +5751,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul4F_reduction_reg(regF dst, vecX src2, regF tmp) %{ +instruct rvmul4F_reduction_reg(regF dst, vecX src2, vecX tmp) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVF dst src2)); effect(TEMP tmp, TEMP dst); @@ -5371,7 +5774,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul8F_reduction_reg(regF dst, vecY src2, regF tmp, regF tmp2) %{ +instruct rvmul8F_reduction_reg(regF dst, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVF dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -5410,7 +5813,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul16F_reduction_reg(regF dst, vecZ src2, regF tmp, regF tmp2) %{ +instruct rvmul16F_reduction_reg(regF dst, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2); match(Set dst (MulReductionVF dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -5481,7 +5884,7 @@ ins_pipe( pipe_slow ); %} -instruct rsmul2D_reduction_reg(regD dst, vecX src2, regD tmp) %{ +instruct rsmul2D_reduction_reg(regD dst, vecX src2, vecX tmp) %{ predicate(UseSSE >= 1 && UseAVX == 0); match(Set dst (MulReductionVD dst src2)); effect(TEMP dst, TEMP tmp); @@ -5496,7 +5899,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul2D_reduction_reg(regD dst, vecX src2, regD tmp) %{ +instruct rvmul2D_reduction_reg(regD dst, vecX src2, vecX tmp) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVD dst src2)); effect(TEMP tmp, TEMP dst); @@ -5511,7 +5914,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul4D_reduction_reg(regD dst, vecY src2, regD tmp, regD tmp2) %{ +instruct rvmul4D_reduction_reg(regD dst, vecY src2, vecY tmp, vecY tmp2) %{ predicate(UseAVX > 0); match(Set dst (MulReductionVD dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -5534,7 +5937,7 @@ ins_pipe( pipe_slow ); %} -instruct rvmul8D_reduction_reg(regD dst, vecZ src2, regD tmp, regD tmp2) %{ +instruct rvmul8D_reduction_reg(regD dst, legVecZ src2, legVecZ tmp, legVecZ tmp2) %{ predicate(UseAVX > 2); match(Set dst (MulReductionVD dst src2)); effect(TEMP tmp, TEMP dst, TEMP tmp2); @@ -5588,8 +5991,8 @@ ins_pipe( pipe_slow ); %} -instruct vadd4B_reg_avx(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); +instruct vadd4B_reg(vecS dst, vecS src1, vecS src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (AddVB src1 src2)); format %{ "vpaddb $dst,$src1,$src2\t! add packed4B" %} ins_encode %{ @@ -5599,56 +6002,44 @@ ins_pipe( pipe_slow ); %} -instruct vadd4B_reg_evex(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} -instruct vadd4B_reg_evex_special(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (AddVB dst src2)); - effect(TEMP src1); - format %{ "vpaddb $dst,$dst,$src2\t! add packed4B" %} +instruct vadd4B_mem(vecS dst, vecS src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVB src (LoadVector mem))); + format %{ "vpaddb $dst,$src,$mem\t! add packed4B" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4B_mem_avx(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed4B" %} +instruct vadd8B(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVB dst src)); + format %{ "paddb $dst,$src\t! add packed8B" %} ins_encode %{ - int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ paddb($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd4B_mem_evex(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed4B" %} +instruct vadd8B_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVB src1 src2)); + format %{ "vpaddb $dst,$src1,$src2\t! add packed8B" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4B_mem_evex_special(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddb $dst,$src,$mem\t! add packed4B" %} + +instruct vadd8B_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVB src (LoadVector mem))); + format %{ "vpaddb $dst,$src,$mem\t! add packed8B" %} ins_encode %{ int vector_len = 0; __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); @@ -5656,20 +6047,20 @@ ins_pipe( pipe_slow ); %} -instruct vadd8B(vecD dst, vecD src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +instruct vadd16B(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 16); match(Set dst (AddVB dst src)); - format %{ "paddb $dst,$src\t! add packed8B" %} + format %{ "paddb $dst,$src\t! add packed16B" %} ins_encode %{ __ paddb($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd8B_reg_avx(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vadd16B_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 16); match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed8B" %} + format %{ "vpaddb $dst,$src1,$src2\t! add packed16B" %} ins_encode %{ int vector_len = 0; __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); @@ -5677,1101 +6068,655 @@ ins_pipe( pipe_slow ); %} -instruct vadd8B_reg_evex(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed8B" %} +instruct vadd16B_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 16); + match(Set dst (AddVB src (LoadVector mem))); + format %{ "vpaddb $dst,$src,$mem\t! add packed16B" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8B_reg_evex_special(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (AddVB dst src2)); - effect(TEMP src1); - format %{ "vpaddb $dst,$dst,$src2\t! add packed8B" %} +instruct vadd32B_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 32); + match(Set dst (AddVB src1 src2)); + format %{ "vpaddb $dst,$src1,$src2\t! add packed32B" %} ins_encode %{ - int vector_len = 0; + int vector_len = 1; __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8B_mem_avx(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vadd32B_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 32); match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed8B" %} + format %{ "vpaddb $dst,$src,$mem\t! add packed32B" %} ins_encode %{ - int vector_len = 0; + int vector_len = 1; __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8B_mem_evex(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed8B" %} +instruct vadd64B_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); + match(Set dst (AddVB src1 src2)); + format %{ "vpaddb $dst,$src1,$src2\t! add packed64B" %} ins_encode %{ - int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8B_mem_evex_special(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddb $dst,$src,$mem\t! add packed8B" %} +instruct vadd64B_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); + match(Set dst (AddVB src (LoadVector mem))); + format %{ "vpaddb $dst,$src,$mem\t! add packed64B" %} ins_encode %{ - int vector_len = 0; + int vector_len = 2; __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16B(vecX dst, vecX src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 16); - match(Set dst (AddVB dst src)); - format %{ "paddb $dst,$src\t! add packed16B" %} +// Shorts/Chars vector add +instruct vadd2S(vecS dst, vecS src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVS dst src)); + format %{ "paddw $dst,$src\t! add packed2S" %} ins_encode %{ - __ paddb($dst$$XMMRegister, $src$$XMMRegister); + __ paddw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_reg_avx(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 16); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed16B" %} +instruct vadd2S_reg(vecS dst, vecS src1, vecS src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVS src1 src2)); + format %{ "vpaddw $dst,$src1,$src2\t! add packed2S" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_reg_evex(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed16B" %} +instruct vadd2S_mem(vecS dst, vecS src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVS src (LoadVector mem))); + format %{ "vpaddw $dst,$src,$mem\t! add packed2S" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_reg_evex_special(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (AddVB dst src2)); - effect(TEMP src1); - format %{ "vpaddb $dst,$dst,$src2\t! add packed16B" %} +instruct vadd4S(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVS dst src)); + format %{ "paddw $dst,$src\t! add packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ paddw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_mem_avx(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 16); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed16B" %} +instruct vadd4S_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVS src1 src2)); + format %{ "vpaddw $dst,$src1,$src2\t! add packed4S" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_mem_evex(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed16B" %} +instruct vadd4S_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVS src (LoadVector mem))); + format %{ "vpaddw $dst,$src,$mem\t! add packed4S" %} ins_encode %{ int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16B_mem_evex_special(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddb $dst,$src,$mem\t! add packed16B" %} +instruct vadd8S(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVS dst src)); + format %{ "paddw $dst,$src\t! add packed8S" %} ins_encode %{ - int vector_len = 0; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ paddw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_reg_avx(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 32); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); +instruct vadd8S_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVS src1 src2)); + format %{ "vpaddw $dst,$src1,$src2\t! add packed8S" %} + ins_encode %{ + int vector_len = 0; + __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_reg_evex(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed32B" %} +instruct vadd8S_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVS src (LoadVector mem))); + format %{ "vpaddw $dst,$src,$mem\t! add packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 0; + __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_reg_evex_special(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 32); - match(Set dst (AddVB dst src2)); - effect(TEMP src1); - format %{ "vpaddb $dst,$dst,$src2\t! add packed32B" %} +instruct vadd16S_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (AddVS src1 src2)); + format %{ "vpaddw $dst,$src1,$src2\t! add packed16S" %} ins_encode %{ int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_mem_avx(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 32); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed32B" %} +instruct vadd16S_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (AddVS src (LoadVector mem))); + format %{ "vpaddw $dst,$src,$mem\t! add packed16S" %} ins_encode %{ int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_mem_evex(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed32B" %} +instruct vadd32S_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + match(Set dst (AddVS src1 src2)); + format %{ "vpaddw $dst,$src1,$src2\t! add packed32S" %} ins_encode %{ - int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32B_mem_evex_special(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (AddVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddb $dst,$src,$mem\t! add packed32B" %} +instruct vadd32S_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + match(Set dst (AddVS src (LoadVector mem))); + format %{ "vpaddw $dst,$src,$mem\t! add packed32S" %} ins_encode %{ - int vector_len = 1; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd64B_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); - match(Set dst (AddVB src1 src2)); - format %{ "vpaddb $dst,$src1,$src2\t! add packed64B" %} +// Integers vector add +instruct vadd2I(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVI dst src)); + format %{ "paddd $dst,$src\t! add packed2I" %} ins_encode %{ - int vector_len = 2; - __ vpaddb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ paddd($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd64B_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); - match(Set dst (AddVB src (LoadVector mem))); - format %{ "vpaddb $dst,$src,$mem\t! add packed64B" %} +instruct vadd2I_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVI src1 src2)); + format %{ "vpaddd $dst,$src1,$src2\t! add packed2I" %} ins_encode %{ - int vector_len = 2; - __ vpaddb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 0; + __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -// Shorts/Chars vector add -instruct vadd2S(vecS dst, vecS src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVS dst src)); - format %{ "paddw $dst,$src\t! add packed2S" %} +instruct vadd2I_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVI src (LoadVector mem))); + format %{ "vpaddd $dst,$src,$mem\t! add packed2I" %} ins_encode %{ - __ paddw($dst$$XMMRegister, $src$$XMMRegister); + int vector_len = 0; + __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_reg_avx(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed2S" %} +instruct vadd4I(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVI dst src)); + format %{ "paddd $dst,$src\t! add packed4I" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ paddd($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_reg_evex(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed2S" %} +instruct vadd4I_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVI src1 src2)); + format %{ "vpaddd $dst,$src1,$src2\t! add packed4I" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_reg_evex_special(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (AddVS dst src2)); - effect(TEMP src1); - format %{ "vpaddw $dst,$dst,$src2\t! add packed2S" %} +instruct vadd4I_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVI src (LoadVector mem))); + format %{ "vpaddd $dst,$src,$mem\t! add packed4I" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_mem_avx(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed2S" %} +instruct vadd8I_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 8); + match(Set dst (AddVI src1 src2)); + format %{ "vpaddd $dst,$src1,$src2\t! add packed8I" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 1; + __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_mem_evex(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed2S" %} +instruct vadd8I_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 8); + match(Set dst (AddVI src (LoadVector mem))); + format %{ "vpaddd $dst,$src,$mem\t! add packed8I" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 1; + __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2S_mem_evex_special(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (AddVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddw $dst,$src,$mem\t! add packed2S" %} +instruct vadd16I_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 16); + match(Set dst (AddVI src1 src2)); + format %{ "vpaddd $dst,$src1,$src2\t! add packed16I" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S(vecD dst, vecD src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVS dst src)); - format %{ "paddw $dst,$src\t! add packed4S" %} +instruct vadd16I_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 16); + match(Set dst (AddVI src (LoadVector mem))); + format %{ "vpaddd $dst,$src,$mem\t! add packed16I" %} ins_encode %{ - __ paddw($dst$$XMMRegister, $src$$XMMRegister); + int vector_len = 2; + __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_reg_avx(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed4S" %} +// Longs vector add +instruct vadd2L(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVL dst src)); + format %{ "paddq $dst,$src\t! add packed2L" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ paddq($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_reg_evex(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed4S" %} +instruct vadd2L_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVL src1 src2)); + format %{ "vpaddq $dst,$src1,$src2\t! add packed2L" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_reg_evex_special(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (AddVS dst src2)); - effect(TEMP src1); - format %{ "vpaddw $dst,$dst,$src2\t! add packed4S" %} +instruct vadd2L_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVL src (LoadVector mem))); + format %{ "vpaddq $dst,$src,$mem\t! add packed2L" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_mem_avx(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed4S" %} +instruct vadd4L_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 4); + match(Set dst (AddVL src1 src2)); + format %{ "vpaddq $dst,$src1,$src2\t! add packed4L" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 1; + __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_mem_evex(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed4S" %} +instruct vadd4L_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 4); + match(Set dst (AddVL src (LoadVector mem))); + format %{ "vpaddq $dst,$src,$mem\t! add packed4L" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 1; + __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4S_mem_evex_special(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (AddVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddw $dst,$src,$mem\t! add packed4S" %} +instruct vadd8L_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 8); + match(Set dst (AddVL src1 src2)); + format %{ "vpaddq $dst,$src1,$src2\t! add packed8L" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8S(vecX dst, vecX src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); - match(Set dst (AddVS dst src)); - format %{ "paddw $dst,$src\t! add packed8S" %} +instruct vadd8L_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 8); + match(Set dst (AddVL src (LoadVector mem))); + format %{ "vpaddq $dst,$src,$mem\t! add packed8L" %} ins_encode %{ - __ paddw($dst$$XMMRegister, $src$$XMMRegister); + int vector_len = 2; + __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_reg_avx(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed8S" %} +// Floats vector add +instruct vadd2F(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVF dst src)); + format %{ "addps $dst,$src\t! add packed2F" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ addps($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_reg_evex(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed8S" %} +instruct vadd2F_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVF src1 src2)); + format %{ "vaddps $dst,$src1,$src2\t! add packed2F" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_reg_evex_special(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (AddVS dst src2)); - effect(TEMP src1); - format %{ "vpaddw $dst,$dst,$src2\t! add packed8S" %} +instruct vadd2F_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVF src (LoadVector mem))); + format %{ "vaddps $dst,$src,$mem\t! add packed2F" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_mem_avx(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed8S" %} +instruct vadd4F(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVF dst src)); + format %{ "addps $dst,$src\t! add packed4F" %} ins_encode %{ - int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ addps($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_mem_evex(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed8S" %} +instruct vadd4F_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVF src1 src2)); + format %{ "vaddps $dst,$src1,$src2\t! add packed4F" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8S_mem_evex_special(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (AddVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddw $dst,$src,$mem\t! add packed8S" %} +instruct vadd4F_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVF src (LoadVector mem))); + format %{ "vaddps $dst,$src,$mem\t! add packed4F" %} ins_encode %{ int vector_len = 0; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16S_reg_avx(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16S_reg_evex(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16S_reg_evex_special(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (AddVS dst src2)); - effect(TEMP src1); - format %{ "vpaddw $dst,$dst,$src2\t! add packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16S_mem_avx(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16S_mem_evex(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed16S" %} +instruct vadd8F_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVF src1 src2)); + format %{ "vaddps $dst,$src1,$src2\t! add packed8F" %} ins_encode %{ int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16S_mem_evex_special(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (AddVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpaddw $dst,$src,$mem\t! add packed16S" %} +instruct vadd8F_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (AddVF src (LoadVector mem))); + format %{ "vaddps $dst,$src,$mem\t! add packed8F" %} ins_encode %{ int vector_len = 1; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32S_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (AddVS src1 src2)); - format %{ "vpaddw $dst,$src1,$src2\t! add packed32S" %} +instruct vadd16F_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 16); + match(Set dst (AddVF src1 src2)); + format %{ "vaddps $dst,$src1,$src2\t! add packed16F" %} ins_encode %{ int vector_len = 2; - __ vpaddw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd32S_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (AddVS src (LoadVector mem))); - format %{ "vpaddw $dst,$src,$mem\t! add packed32S" %} +instruct vadd16F_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 16); + match(Set dst (AddVF src (LoadVector mem))); + format %{ "vaddps $dst,$src,$mem\t! add packed16F" %} ins_encode %{ int vector_len = 2; - __ vpaddw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -// Integers vector add -instruct vadd2I(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); - match(Set dst (AddVI dst src)); - format %{ "paddd $dst,$src\t! add packed2I" %} +// Doubles vector add +instruct vadd2D(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); + match(Set dst (AddVD dst src)); + format %{ "addpd $dst,$src\t! add packed2D" %} ins_encode %{ - __ paddd($dst$$XMMRegister, $src$$XMMRegister); + __ addpd($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd2I_reg(vecD dst, vecD src1, vecD src2) %{ +instruct vadd2D_reg(vecX dst, vecX src1, vecX src2) %{ predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVI src1 src2)); - format %{ "vpaddd $dst,$src1,$src2\t! add packed2I" %} + match(Set dst (AddVD src1 src2)); + format %{ "vaddpd $dst,$src1,$src2\t! add packed2D" %} ins_encode %{ int vector_len = 0; - __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd2I_mem(vecD dst, vecD src, memory mem) %{ +instruct vadd2D_mem(vecX dst, vecX src, memory mem) %{ predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVI src (LoadVector mem))); - format %{ "vpaddd $dst,$src,$mem\t! add packed2I" %} - ins_encode %{ - int vector_len = 0; - __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4I(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); - match(Set dst (AddVI dst src)); - format %{ "paddd $dst,$src\t! add packed4I" %} - ins_encode %{ - __ paddd($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4I_reg(vecX dst, vecX src1, vecX src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVI src1 src2)); - format %{ "vpaddd $dst,$src1,$src2\t! add packed4I" %} + match(Set dst (AddVD src (LoadVector mem))); + format %{ "vaddpd $dst,$src,$mem\t! add packed2D" %} ins_encode %{ int vector_len = 0; - __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4I_mem(vecX dst, vecX src, memory mem) %{ +instruct vadd4D_reg(vecY dst, vecY src1, vecY src2) %{ predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVI src (LoadVector mem))); - format %{ "vpaddd $dst,$src,$mem\t! add packed4I" %} - ins_encode %{ - int vector_len = 0; - __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd8I_reg(vecY dst, vecY src1, vecY src2) %{ - predicate(UseAVX > 1 && n->as_Vector()->length() == 8); - match(Set dst (AddVI src1 src2)); - format %{ "vpaddd $dst,$src1,$src2\t! add packed8I" %} + match(Set dst (AddVD src1 src2)); + format %{ "vaddpd $dst,$src1,$src2\t! add packed4D" %} ins_encode %{ int vector_len = 1; - __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8I_mem(vecY dst, vecY src, memory mem) %{ - predicate(UseAVX > 1 && n->as_Vector()->length() == 8); - match(Set dst (AddVI src (LoadVector mem))); - format %{ "vpaddd $dst,$src,$mem\t! add packed8I" %} +instruct vadd4D_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (AddVD src (LoadVector mem))); + format %{ "vaddpd $dst,$src,$mem\t! add packed4D" %} ins_encode %{ int vector_len = 1; - __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16I_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 16); - match(Set dst (AddVI src1 src2)); - format %{ "vpaddd $dst,$src1,$src2\t! add packed16I" %} +instruct vadd8D_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 8); + match(Set dst (AddVD src1 src2)); + format %{ "vaddpd $dst,$src1,$src2\t! add packed8D" %} ins_encode %{ int vector_len = 2; - __ vpaddd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd16I_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 16); - match(Set dst (AddVI src (LoadVector mem))); - format %{ "vpaddd $dst,$src,$mem\t! add packed16I" %} +instruct vadd8D_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 8); + match(Set dst (AddVD src (LoadVector mem))); + format %{ "vaddpd $dst,$src,$mem\t! add packed8D" %} ins_encode %{ int vector_len = 2; - __ vpaddd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -// Longs vector add -instruct vadd2L(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); - match(Set dst (AddVL dst src)); - format %{ "paddq $dst,$src\t! add packed2L" %} - ins_encode %{ - __ paddq($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} +// --------------------------------- SUB -------------------------------------- -instruct vadd2L_reg(vecX dst, vecX src1, vecX src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVL src1 src2)); - format %{ "vpaddq $dst,$src1,$src2\t! add packed2L" %} +// Bytes vector sub +instruct vsub4B(vecS dst, vecS src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (SubVB dst src)); + format %{ "psubb $dst,$src\t! sub packed4B" %} ins_encode %{ - int vector_len = 0; - __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ psubb($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd2L_mem(vecX dst, vecX src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVL src (LoadVector mem))); - format %{ "vpaddq $dst,$src,$mem\t! add packed2L" %} +instruct vsub4B_reg(vecS dst, vecS src1, vecS src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (SubVB src1 src2)); + format %{ "vpsubb $dst,$src1,$src2\t! sub packed4B" %} ins_encode %{ int vector_len = 0; - __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4L_reg(vecY dst, vecY src1, vecY src2) %{ - predicate(UseAVX > 1 && n->as_Vector()->length() == 4); - match(Set dst (AddVL src1 src2)); - format %{ "vpaddq $dst,$src1,$src2\t! add packed4L" %} +instruct vsub4B_mem(vecS dst, vecS src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (SubVB src (LoadVector mem))); + format %{ "vpsubb $dst,$src,$mem\t! sub packed4B" %} ins_encode %{ - int vector_len = 1; - __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 0; + __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd4L_mem(vecY dst, vecY src, memory mem) %{ - predicate(UseAVX > 1 && n->as_Vector()->length() == 4); - match(Set dst (AddVL src (LoadVector mem))); - format %{ "vpaddq $dst,$src,$mem\t! add packed4L" %} +instruct vsub8B(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (SubVB dst src)); + format %{ "psubb $dst,$src\t! sub packed8B" %} ins_encode %{ - int vector_len = 1; - __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ psubb($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd8L_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 8); - match(Set dst (AddVL src1 src2)); - format %{ "vpaddq $dst,$src1,$src2\t! add packed8L" %} +instruct vsub8B_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (SubVB src1 src2)); + format %{ "vpsubb $dst,$src1,$src2\t! sub packed8B" %} ins_encode %{ - int vector_len = 2; - __ vpaddq($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 0; + __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vadd8L_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 8); - match(Set dst (AddVL src (LoadVector mem))); - format %{ "vpaddq $dst,$src,$mem\t! add packed8L" %} +instruct vsub8B_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (SubVB src (LoadVector mem))); + format %{ "vpsubb $dst,$src,$mem\t! sub packed8B" %} ins_encode %{ - int vector_len = 2; - __ vpaddq($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 0; + __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -// Floats vector add -instruct vadd2F(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); - match(Set dst (AddVF dst src)); - format %{ "addps $dst,$src\t! add packed2F" %} +instruct vsub16B(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 16); + match(Set dst (SubVB dst src)); + format %{ "psubb $dst,$src\t! sub packed16B" %} ins_encode %{ - __ addps($dst$$XMMRegister, $src$$XMMRegister); + __ psubb($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vadd2F_reg(vecD dst, vecD src1, vecD src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVF src1 src2)); - format %{ "vaddps $dst,$src1,$src2\t! add packed2F" %} - ins_encode %{ - int vector_len = 0; - __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd2F_mem(vecD dst, vecD src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVF src (LoadVector mem))); - format %{ "vaddps $dst,$src,$mem\t! add packed2F" %} - ins_encode %{ - int vector_len = 0; - __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4F(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); - match(Set dst (AddVF dst src)); - format %{ "addps $dst,$src\t! add packed4F" %} - ins_encode %{ - __ addps($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4F_reg(vecX dst, vecX src1, vecX src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVF src1 src2)); - format %{ "vaddps $dst,$src1,$src2\t! add packed4F" %} - ins_encode %{ - int vector_len = 0; - __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4F_mem(vecX dst, vecX src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVF src (LoadVector mem))); - format %{ "vaddps $dst,$src,$mem\t! add packed4F" %} - ins_encode %{ - int vector_len = 0; - __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd8F_reg(vecY dst, vecY src1, vecY src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 8); - match(Set dst (AddVF src1 src2)); - format %{ "vaddps $dst,$src1,$src2\t! add packed8F" %} - ins_encode %{ - int vector_len = 1; - __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd8F_mem(vecY dst, vecY src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 8); - match(Set dst (AddVF src (LoadVector mem))); - format %{ "vaddps $dst,$src,$mem\t! add packed8F" %} - ins_encode %{ - int vector_len = 1; - __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16F_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 16); - match(Set dst (AddVF src1 src2)); - format %{ "vaddps $dst,$src1,$src2\t! add packed16F" %} - ins_encode %{ - int vector_len = 2; - __ vaddps($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd16F_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 16); - match(Set dst (AddVF src (LoadVector mem))); - format %{ "vaddps $dst,$src,$mem\t! add packed16F" %} - ins_encode %{ - int vector_len = 2; - __ vaddps($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -// Doubles vector add -instruct vadd2D(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); - match(Set dst (AddVD dst src)); - format %{ "addpd $dst,$src\t! add packed2D" %} - ins_encode %{ - __ addpd($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd2D_reg(vecX dst, vecX src1, vecX src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVD src1 src2)); - format %{ "vaddpd $dst,$src1,$src2\t! add packed2D" %} - ins_encode %{ - int vector_len = 0; - __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd2D_mem(vecX dst, vecX src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 2); - match(Set dst (AddVD src (LoadVector mem))); - format %{ "vaddpd $dst,$src,$mem\t! add packed2D" %} - ins_encode %{ - int vector_len = 0; - __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4D_reg(vecY dst, vecY src1, vecY src2) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVD src1 src2)); - format %{ "vaddpd $dst,$src1,$src2\t! add packed4D" %} - ins_encode %{ - int vector_len = 1; - __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd4D_mem(vecY dst, vecY src, memory mem) %{ - predicate(UseAVX > 0 && n->as_Vector()->length() == 4); - match(Set dst (AddVD src (LoadVector mem))); - format %{ "vaddpd $dst,$src,$mem\t! add packed4D" %} - ins_encode %{ - int vector_len = 1; - __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd8D_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 8); - match(Set dst (AddVD src1 src2)); - format %{ "vaddpd $dst,$src1,$src2\t! add packed8D" %} - ins_encode %{ - int vector_len = 2; - __ vaddpd($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vadd8D_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 8); - match(Set dst (AddVD src (LoadVector mem))); - format %{ "vaddpd $dst,$src,$mem\t! add packed8D" %} - ins_encode %{ - int vector_len = 2; - __ vaddpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -// --------------------------------- SUB -------------------------------------- - -// Bytes vector sub -instruct vsub4B(vecS dst, vecS src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (SubVB dst src)); - format %{ "psubb $dst,$src\t! sub packed4B" %} - ins_encode %{ - __ psubb($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_reg_avx(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_reg_evex(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_reg_exex_special(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (SubVB dst src2)); - effect(TEMP src1); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_mem_avx(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_mem_evex(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4B_mem_evex_special(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (SubVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubb $dst,$src,$mem\t! sub packed4B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B(vecD dst, vecD src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); - match(Set dst (SubVB dst src)); - format %{ "psubb $dst,$src\t! sub packed8B" %} - ins_encode %{ - __ psubb($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_reg_avx(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_reg_evex(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_reg_evex_special(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (SubVB dst src2)); - effect(TEMP src1); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_mem_avx(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_mem_evex(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub8B_mem_evex_special(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (SubVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubb $dst,$src,$mem\t! sub packed8B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B(vecX dst, vecX src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 16); - match(Set dst (SubVB dst src)); - format %{ "psubb $dst,$src\t! sub packed16B" %} - ins_encode %{ - __ psubb($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B_reg_avx(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 16); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed16B" %} +instruct vsub16B_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 16); + match(Set dst (SubVB src1 src2)); + format %{ "vpsubb $dst,$src1,$src2\t! sub packed16B" %} ins_encode %{ int vector_len = 0; __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); @@ -6779,324 +6724,76 @@ ins_pipe( pipe_slow ); %} -instruct vsub16B_reg_evex(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed16B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B_reg_evex_special(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (SubVB dst src2)); - effect(TEMP src1); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed16B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B_mem_avx(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 16); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed16B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B_mem_evex(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed16B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16B_mem_evex_special(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (SubVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubb $dst,$src,$mem\t! sub packed16B" %} - ins_encode %{ - int vector_len = 0; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_reg_avx(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 32); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_reg_evex(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_reg_evex_special(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 32); - match(Set dst (SubVB dst src2)); - effect(TEMP src1); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_mem_avx(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 32); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_mem_evex(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub32B_mem_evex_special(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 32); - match(Set dst (SubVB dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubb $dst,$src,$mem\t! sub packed32B" %} - ins_encode %{ - int vector_len = 1; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub64B_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); - match(Set dst (SubVB src1 src2)); - format %{ "vpsubb $dst,$src1,$src2\t! sub packed64B" %} - ins_encode %{ - int vector_len = 2; - __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub64B_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); - match(Set dst (SubVB src (LoadVector mem))); - format %{ "vpsubb $dst,$src,$mem\t! sub packed64B" %} - ins_encode %{ - int vector_len = 2; - __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -// Shorts/Chars vector sub -instruct vsub2S(vecS dst, vecS src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (SubVS dst src)); - format %{ "psubw $dst,$src\t! sub packed2S" %} - ins_encode %{ - __ psubw($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_reg_avx(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_reg_evex(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_reg_evex_special(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (SubVS dst src2)); - effect(TEMP src1); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_mem_avx(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_mem_evex(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub2S_mem_evex_special(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (SubVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubw $dst,$src,$mem\t! sub packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4S(vecD dst, vecD src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (SubVS dst src)); - format %{ "psubw $dst,$src\t! sub packed4S" %} - ins_encode %{ - __ psubw($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4S_reg_avx(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub4S_reg_evex(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed4S" %} +instruct vsub16B_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 16); + match(Set dst (SubVB src (LoadVector mem))); + format %{ "vpsubb $dst,$src,$mem\t! sub packed16B" %} ins_encode %{ int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub4S_reg_evex_special(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (SubVS dst src2)); - effect(TEMP src1); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed4S" %} +instruct vsub32B_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 32); + match(Set dst (SubVB src1 src2)); + format %{ "vpsubb $dst,$src1,$src2\t! sub packed32B" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 1; + __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub4S_mem_avx(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed4S" %} +instruct vsub32B_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 32); + match(Set dst (SubVB src (LoadVector mem))); + format %{ "vpsubb $dst,$src,$mem\t! sub packed32B" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 1; + __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub4S_mem_evex(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed4S" %} +instruct vsub64B_reg(vecZ dst, vecZ src1, vecZ src2) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); + match(Set dst (SubVB src1 src2)); + format %{ "vpsubb $dst,$src1,$src2\t! sub packed64B" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpsubb($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub4S_mem_evex_special(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (SubVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubw $dst,$src,$mem\t! sub packed4S" %} +instruct vsub64B_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 64); + match(Set dst (SubVB src (LoadVector mem))); + format %{ "vpsubb $dst,$src,$mem\t! sub packed64B" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vpsubb($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub8S(vecX dst, vecX src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +// Shorts/Chars vector sub +instruct vsub2S(vecS dst, vecS src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (SubVS dst src)); - format %{ "psubw $dst,$src\t! sub packed8S" %} + format %{ "psubw $dst,$src\t! sub packed2S" %} ins_encode %{ __ psubw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsub8S_reg_avx(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vsub2S_reg(vecS dst, vecS src1, vecS src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed8S" %} + format %{ "vpsubw $dst,$src1,$src2\t! sub packed2S" %} ins_encode %{ int vector_len = 0; __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); @@ -7104,44 +6801,42 @@ ins_pipe( pipe_slow ); %} -instruct vsub8S_reg_evex(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed8S" %} +instruct vsub2S_mem(vecS dst, vecS src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (SubVS src (LoadVector mem))); + format %{ "vpsubw $dst,$src,$mem\t! sub packed2S" %} ins_encode %{ int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub8S_reg_evex_special(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (SubVS dst src2)); - effect(TEMP src1); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed8S" %} +instruct vsub4S(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (SubVS dst src)); + format %{ "psubw $dst,$src\t! sub packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ psubw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsub8S_mem_avx(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed8S" %} +instruct vsub4S_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (SubVS src1 src2)); + format %{ "vpsubw $dst,$src1,$src2\t! sub packed4S" %} ins_encode %{ int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub8S_mem_evex(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsub4S_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed8S" %} + format %{ "vpsubw $dst,$src,$mem\t! sub packed4S" %} ins_encode %{ int vector_len = 0; __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); @@ -7149,44 +6844,41 @@ ins_pipe( pipe_slow ); %} -instruct vsub8S_mem_evex_special(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (SubVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubw $dst,$src,$mem\t! sub packed8S" %} +instruct vsub8S(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (SubVS dst src)); + format %{ "psubw $dst,$src\t! sub packed8S" %} ins_encode %{ - int vector_len = 0; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ psubw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsub16S_reg_avx(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); +instruct vsub8S_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed16S" %} + format %{ "vpsubw $dst,$src1,$src2\t! sub packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub16S_reg_evex(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (SubVS src1 src2)); - format %{ "vpsubw $dst,$src1,$src2\t! sub packed16S" %} +instruct vsub8S_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (SubVS src (LoadVector mem))); + format %{ "vpsubw $dst,$src,$mem\t! sub packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpsubw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 0; + __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsub16S_reg_evex_special(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (SubVS dst src2)); - effect(TEMP src1); +instruct vsub16S_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (SubVS src1 src2)); format %{ "vpsubw $dst,$src1,$src2\t! sub packed16S" %} ins_encode %{ int vector_len = 1; @@ -7195,19 +6887,8 @@ ins_pipe( pipe_slow ); %} -instruct vsub16S_mem_avx(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (SubVS src (LoadVector mem))); - format %{ "vpsubw $dst,$src,$mem\t! sub packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsub16S_mem_evex(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vsub16S_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (SubVS src (LoadVector mem))); format %{ "vpsubw $dst,$src,$mem\t! sub packed16S" %} ins_encode %{ @@ -7217,20 +6898,8 @@ ins_pipe( pipe_slow ); %} -instruct vsub16S_mem_evex_special(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (SubVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpsubw $dst,$src,$mem\t! sub packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsubw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - instruct vsub32S_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (SubVS src1 src2)); format %{ "vpsubw $dst,$src1,$src2\t! sub packed32S" %} ins_encode %{ @@ -7241,7 +6910,7 @@ %} instruct vsub32S_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (SubVS src (LoadVector mem))); format %{ "vpsubw $dst,$src,$mem\t! sub packed32S" %} ins_encode %{ @@ -7253,7 +6922,7 @@ // Integers vector sub instruct vsub2I(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (SubVI dst src)); format %{ "psubd $dst,$src\t! sub packed2I" %} ins_encode %{ @@ -7285,7 +6954,7 @@ %} instruct vsub4I(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (SubVI dst src)); format %{ "psubd $dst,$src\t! sub packed4I" %} ins_encode %{ @@ -7362,7 +7031,7 @@ // Longs vector sub instruct vsub2L(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (SubVL dst src)); format %{ "psubq $dst,$src\t! sub packed2L" %} ins_encode %{ @@ -7439,7 +7108,7 @@ // Floats vector sub instruct vsub2F(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (SubVF dst src)); format %{ "subps $dst,$src\t! sub packed2F" %} ins_encode %{ @@ -7471,7 +7140,7 @@ %} instruct vsub4F(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (SubVF dst src)); format %{ "subps $dst,$src\t! sub packed4F" %} ins_encode %{ @@ -7548,7 +7217,7 @@ // Doubles vector sub instruct vsub2D(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (SubVD dst src)); format %{ "subpd $dst,$src\t! sub packed2D" %} ins_encode %{ @@ -7612,190 +7281,34 @@ ins_pipe( pipe_slow ); %} -instruct vsub8D_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 8); - match(Set dst (SubVD src (LoadVector mem))); - format %{ "vsubpd $dst,$src,$mem\t! sub packed8D" %} - ins_encode %{ - int vector_len = 2; - __ vsubpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -// --------------------------------- MUL -------------------------------------- - -// Shorts/Chars vector mul -instruct vmul2S(vecS dst, vecS src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (MulVS dst src)); - format %{ "pmullw $dst,$src\t! mul packed2S" %} - ins_encode %{ - __ pmullw($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_reg_avx(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_reg_evex(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_evex_special(vecS dst, vecS src1, vecS src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (MulVS dst src2)); - effect(TEMP src1); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_mem_avx(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_mem_evex(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul2S_mem_evex_special(vecS dst, vecS src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (MulVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpmullw $dst,$src,$mem\t! mul packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S(vecD dst, vecD src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (MulVS dst src)); - format %{ "pmullw $dst,$src\t! mul packed4S" %} - ins_encode %{ - __ pmullw($dst$$XMMRegister, $src$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_reg_avx(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_reg_evex(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_reg_evex_special(vecD dst, vecD src1, vecD src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (MulVS dst src2)); - effect(TEMP src1); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_mem_avx(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_mem_evex(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul4S_mem_evex_special(vecD dst, vecD src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (MulVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpmullw $dst,$src,$mem\t! mul packed4S" %} +instruct vsub8D_mem(vecZ dst, vecZ src, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 8); + match(Set dst (SubVD src (LoadVector mem))); + format %{ "vsubpd $dst,$src,$mem\t! sub packed8D" %} ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + int vector_len = 2; + __ vsubpd($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vmul8S(vecX dst, vecX src) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +// --------------------------------- MUL -------------------------------------- + +// Shorts/Chars vector mul +instruct vmul2S(vecS dst, vecS src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (MulVS dst src)); - format %{ "pmullw $dst,$src\t! mul packed8S" %} + format %{ "pmullw $dst,$src\t! mul packed2S" %} ins_encode %{ __ pmullw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vmul8S_reg_avx(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vmul2S_reg(vecS dst, vecS src1, vecS src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed8S" %} + format %{ "vpmullw $dst,$src1,$src2\t! mul packed2S" %} ins_encode %{ int vector_len = 0; __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); @@ -7803,44 +7316,42 @@ ins_pipe( pipe_slow ); %} -instruct vmul8S_reg_evex(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed8S" %} +instruct vmul2S_mem(vecS dst, vecS src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); + match(Set dst (MulVS src (LoadVector mem))); + format %{ "vpmullw $dst,$src,$mem\t! mul packed2S" %} ins_encode %{ int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vmul8S_reg_evex_special(vecX dst, vecX src1, vecX src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (MulVS dst src2)); - effect(TEMP src1); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed8S" %} +instruct vmul4S(vecD dst, vecD src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (MulVS dst src)); + format %{ "pmullw $dst,$src\t! mul packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + __ pmullw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vmul8S_mem_avx(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed8S" %} +instruct vmul4S_reg(vecD dst, vecD src1, vecD src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (MulVS src1 src2)); + format %{ "vpmullw $dst,$src1,$src2\t! mul packed4S" %} ins_encode %{ int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vmul8S_mem_evex(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vmul4S_mem(vecD dst, vecD src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed8S" %} + format %{ "vpmullw $dst,$src,$mem\t! mul packed4S" %} ins_encode %{ int vector_len = 0; __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); @@ -7848,44 +7359,41 @@ ins_pipe( pipe_slow ); %} -instruct vmul8S_mem_evex_special(vecX dst, vecX src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (MulVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpmullw $dst,$src,$mem\t! mul packed8S" %} +instruct vmul8S(vecX dst, vecX src) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (MulVS dst src)); + format %{ "pmullw $dst,$src\t! mul packed8S" %} ins_encode %{ - int vector_len = 0; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); + __ pmullw($dst$$XMMRegister, $src$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vmul16S_reg_avx(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); +instruct vmul8S_reg(vecX dst, vecX src1, vecX src2) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed16S" %} + format %{ "vpmullw $dst,$src1,$src2\t! mul packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vmul16S_reg_evex(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (MulVS src1 src2)); - format %{ "vpmullw $dst,$src1,$src2\t! mul packed16S" %} +instruct vmul8S_mem(vecX dst, vecX src, memory mem) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (MulVS src (LoadVector mem))); + format %{ "vpmullw $dst,$src,$mem\t! mul packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpmullw($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, vector_len); + int vector_len = 0; + __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vmul16S_reg_evex_special(vecY dst, vecY src1, vecY src2) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (MulVS dst src2)); - effect(TEMP src1); +instruct vmul16S_reg(vecY dst, vecY src1, vecY src2) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (MulVS src1 src2)); format %{ "vpmullw $dst,$src1,$src2\t! mul packed16S" %} ins_encode %{ int vector_len = 1; @@ -7894,19 +7402,8 @@ ins_pipe( pipe_slow ); %} -instruct vmul16S_mem_avx(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (MulVS src (LoadVector mem))); - format %{ "vpmullw $dst,$src,$mem\t! mul packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vmul16S_mem_evex(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vmul16S_mem(vecY dst, vecY src, memory mem) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (MulVS src (LoadVector mem))); format %{ "vpmullw $dst,$src,$mem\t! mul packed16S" %} ins_encode %{ @@ -7916,20 +7413,8 @@ ins_pipe( pipe_slow ); %} -instruct vmul16S_mem_evex_special(vecY dst, vecY src, memory mem) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (MulVS dst (LoadVector mem))); - effect(TEMP src); - format %{ "vpmullw $dst,$src,$mem\t! mul packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpmullw($dst$$XMMRegister, $src$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - instruct vmul32S_reg(vecZ dst, vecZ src1, vecZ src2) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (MulVS src1 src2)); format %{ "vpmullw $dst,$src1,$src2\t! mul packed32S" %} ins_encode %{ @@ -7940,7 +7425,7 @@ %} instruct vmul32S_mem(vecZ dst, vecZ src, memory mem) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (MulVS src (LoadVector mem))); format %{ "vpmullw $dst,$src,$mem\t! mul packed32S" %} ins_encode %{ @@ -8127,7 +7612,7 @@ // Floats vector mul instruct vmul2F(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (MulVF dst src)); format %{ "mulps $dst,$src\t! mul packed2F" %} ins_encode %{ @@ -8159,7 +7644,7 @@ %} instruct vmul4F(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (MulVF dst src)); format %{ "mulps $dst,$src\t! mul packed4F" %} ins_encode %{ @@ -8236,7 +7721,7 @@ // Doubles vector mul instruct vmul2D(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (MulVD dst src)); format %{ "mulpd $dst,$src\t! mul packed2D" %} ins_encode %{ @@ -8311,8 +7796,8 @@ ins_pipe( pipe_slow ); %} -instruct vcmov8F_reg(vecY dst, vecY src1, vecY src2, immI8 cop, cmpOp_vcmppd copnd) %{ - predicate(UseAVX > 0 && UseAVX < 3 && n->as_Vector()->length() == 8); +instruct vcmov8F_reg(legVecY dst, legVecY src1, legVecY src2, immI8 cop, cmpOp_vcmppd copnd) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (CMoveVF (Binary copnd cop) (Binary src1 src2))); effect(TEMP dst, USE src1, USE src2); format %{ "cmpps.$copnd $dst, $src1, $src2 ! vcmovevf, cond=$cop\n\t" @@ -8327,8 +7812,8 @@ ins_pipe( pipe_slow ); %} -instruct vcmov4D_reg(vecY dst, vecY src1, vecY src2, immI8 cop, cmpOp_vcmppd copnd) %{ - predicate(UseAVX > 0 && UseAVX < 3 && n->as_Vector()->length() == 4); +instruct vcmov4D_reg(legVecY dst, legVecY src1, legVecY src2, immI8 cop, cmpOp_vcmppd copnd) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (CMoveVD (Binary copnd cop) (Binary src1 src2))); effect(TEMP dst, USE src1, USE src2); format %{ "cmppd.$copnd $dst, $src1, $src2 ! vcmovevd, cond=$cop\n\t" @@ -8347,7 +7832,7 @@ // Floats vector div instruct vdiv2F(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (DivVF dst src)); format %{ "divps $dst,$src\t! div packed2F" %} ins_encode %{ @@ -8379,7 +7864,7 @@ %} instruct vdiv4F(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (DivVF dst src)); format %{ "divps $dst,$src\t! div packed4F" %} ins_encode %{ @@ -8456,7 +7941,7 @@ // Doubles vector div instruct vdiv2D(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (DivVD dst src)); format %{ "divpd $dst,$src\t! div packed2D" %} ins_encode %{ @@ -8690,221 +8175,45 @@ %} ins_pipe( pipe_slow ); %} - -instruct vsqrt16F_mem(vecZ dst, memory mem) %{ - predicate(UseAVX > 2 && n->as_Vector()->length() == 16); - match(Set dst (SqrtVF (LoadVector mem))); - format %{ "vsqrtps $dst,$mem\t! sqrt packed16F" %} - ins_encode %{ - int vector_len = 2; - __ vsqrtps($dst$$XMMRegister, $mem$$Address, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -// ------------------------------ LeftShift ----------------------------------- - -// Shorts/Chars vector left shift -instruct vsll2S(vecS dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed2S" %} - ins_encode %{ - __ psllw($dst$$XMMRegister, $shift$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_imm(vecS dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed2S" %} - ins_encode %{ - __ psllw($dst$$XMMRegister, (int)$shift$$constant); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_avx(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_evex(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_evex_special(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_imm_avx(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_imm_evex(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll2S_reg_imm_evex_special(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S(vecD dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed4S" %} - ins_encode %{ - __ psllw($dst$$XMMRegister, $shift$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_imm(vecD dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed4S" %} - ins_encode %{ - __ psllw($dst$$XMMRegister, (int)$shift$$constant); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_avx(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_evex(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_evex_special(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_imm_avx(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_imm_evex(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsll4S_reg_imm_evex_special(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} + +instruct vsqrt16F_mem(vecZ dst, memory mem) %{ + predicate(UseAVX > 2 && n->as_Vector()->length() == 16); + match(Set dst (SqrtVF (LoadVector mem))); + format %{ "vsqrtps $dst,$mem\t! sqrt packed16F" %} ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + int vector_len = 2; + __ vsqrtps($dst$$XMMRegister, $mem$$Address, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll8S(vecX dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +// ------------------------------ LeftShift ----------------------------------- + +// Shorts/Chars vector left shift +instruct vsll2S(vecS dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed8S" %} + format %{ "psllw $dst,$shift\t! left shift packed2S" %} ins_encode %{ __ psllw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_imm(vecX dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +instruct vsll2S_imm(vecS dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVS dst shift)); - format %{ "psllw $dst,$shift\t! left shift packed8S" %} + format %{ "psllw $dst,$shift\t! left shift packed2S" %} ins_encode %{ __ psllw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_avx(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vsll2S_reg(vecS dst, vecS src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} + format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} ins_encode %{ int vector_len = 0; __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); @@ -8912,56 +8221,52 @@ ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_evex(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsll2S_reg_imm(vecS dst, vecS src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} + format %{ "vpsllw $dst,$src,$shift\t! left shift packed2S" %} ins_encode %{ int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_evex_special(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); +instruct vsll4S(vecD dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} + format %{ "psllw $dst,$shift\t! left shift packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psllw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_imm_avx(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} +instruct vsll4S_imm(vecD dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (LShiftVS dst shift)); + format %{ "psllw $dst,$shift\t! left shift packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ psllw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_imm_evex(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsll4S_reg(vecD dst, vecD src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} + format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} ins_encode %{ int vector_len = 0; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll8S_reg_imm_evex_special(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} +instruct vsll4S_reg_imm(vecD dst, vecD src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (LShiftVS src shift)); + format %{ "vpsllw $dst,$src,$shift\t! left shift packed4S" %} ins_encode %{ int vector_len = 0; __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); @@ -8969,66 +8274,62 @@ ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_avx(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} +instruct vsll8S(vecX dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (LShiftVS dst shift)); + format %{ "psllw $dst,$shift\t! left shift packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psllw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_evex(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} +instruct vsll8S_imm(vecX dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (LShiftVS dst shift)); + format %{ "psllw $dst,$shift\t! left shift packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psllw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_evex_special(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} +instruct vsll8S_reg(vecX dst, vecX src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (LShiftVS src shift)); + format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_imm_avx(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); +instruct vsll8S_reg_imm(vecX dst, vecX src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (LShiftVS src shift)); - format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} + format %{ "vpsllw $dst,$src,$shift\t! left shift packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_imm_evex(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vsll16S_reg(vecY dst, vecY src, vecS shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (LShiftVS src shift)); format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} ins_encode %{ int vector_len = 1; - __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ vpsllw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsll16S_reg_imm_evex_special(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (LShiftVS dst shift)); - effect(TEMP src); +instruct vsll16S_reg_imm(vecY dst, vecY src, immI8 shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (LShiftVS src shift)); format %{ "vpsllw $dst,$src,$shift\t! left shift packed16S" %} ins_encode %{ int vector_len = 1; @@ -9038,7 +8339,7 @@ %} instruct vsll32S_reg(vecZ dst, vecZ src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (LShiftVS src shift)); format %{ "vpsllw $dst,$src,$shift\t! left shift packed32S" %} ins_encode %{ @@ -9049,7 +8350,7 @@ %} instruct vsll32S_reg_imm(vecZ dst, vecZ src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (LShiftVS src shift)); format %{ "vpsllw $dst,$src,$shift\t! left shift packed32S" %} ins_encode %{ @@ -9061,7 +8362,7 @@ // Integers vector left shift instruct vsll2I(vecD dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVI dst shift)); format %{ "pslld $dst,$shift\t! left shift packed2I" %} ins_encode %{ @@ -9071,7 +8372,7 @@ %} instruct vsll2I_imm(vecD dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVI dst shift)); format %{ "pslld $dst,$shift\t! left shift packed2I" %} ins_encode %{ @@ -9103,7 +8404,7 @@ %} instruct vsll4I(vecX dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (LShiftVI dst shift)); format %{ "pslld $dst,$shift\t! left shift packed4I" %} ins_encode %{ @@ -9113,7 +8414,7 @@ %} instruct vsll4I_imm(vecX dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (LShiftVI dst shift)); format %{ "pslld $dst,$shift\t! left shift packed4I" %} ins_encode %{ @@ -9190,7 +8491,7 @@ // Longs vector left shift instruct vsll2L(vecX dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVL dst shift)); format %{ "psllq $dst,$shift\t! left shift packed2L" %} ins_encode %{ @@ -9200,7 +8501,7 @@ %} instruct vsll2L_imm(vecX dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (LShiftVL dst shift)); format %{ "psllq $dst,$shift\t! left shift packed2L" %} ins_encode %{ @@ -9277,211 +8578,35 @@ // ----------------------- LogicalRightShift ----------------------------------- -// Shorts vector logical right shift produces incorrect Java result -// for negative data because java code convert short value into int with -// sign extension before a shift. But char vectors are fine since chars are -// unsigned values. - -instruct vsrl2S(vecS dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %} - ins_encode %{ - __ psrlw($dst$$XMMRegister, $shift$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_imm(vecS dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %} - ins_encode %{ - __ psrlw($dst$$XMMRegister, (int)$shift$$constant); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_avx(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_evex(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_evex_special(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_imm_avx(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_imm_evex(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl2S_reg_imm_evex_special(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S(vecD dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %} - ins_encode %{ - __ psrlw($dst$$XMMRegister, $shift$$XMMRegister); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_imm(vecD dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %} - ins_encode %{ - __ psrlw($dst$$XMMRegister, (int)$shift$$constant); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_avx(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_evex(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_evex_special(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_imm_avx(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_imm_evex(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsrl4S_reg_imm_evex_special(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} +// Shorts vector logical right shift produces incorrect Java result +// for negative data because java code convert short value into int with +// sign extension before a shift. But char vectors are fine since chars are +// unsigned values. -instruct vsrl8S(vecX dst, vecS shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +instruct vsrl2S(vecS dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %} + format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %} ins_encode %{ __ psrlw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_imm(vecX dst, immI8 shift) %{ - predicate(UseAVX == 0 && n->as_Vector()->length() == 8); +instruct vsrl2S_imm(vecS dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVS dst shift)); - format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %} + format %{ "psrlw $dst,$shift\t! logical right shift packed2S" %} ins_encode %{ __ psrlw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_avx(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); +instruct vsrl2S_reg(vecS dst, vecS src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} ins_encode %{ int vector_len = 0; __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); @@ -9489,56 +8614,52 @@ ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_evex(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsrl2S_reg_imm(vecS dst, vecS src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed2S" %} ins_encode %{ int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_evex_special(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); +instruct vsrl4S(vecD dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} + format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psrlw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_imm_avx(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} +instruct vsrl4S_imm(vecD dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); + match(Set dst (URShiftVS dst shift)); + format %{ "psrlw $dst,$shift\t! logical right shift packed4S" %} ins_encode %{ - int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ psrlw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_imm_evex(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsrl4S_reg(vecD dst, vecD src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} ins_encode %{ int vector_len = 0; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsrl8S_reg_imm_evex_special(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} +instruct vsrl4S_reg_imm(vecD dst, vecD src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); + match(Set dst (URShiftVS src shift)); + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed4S" %} ins_encode %{ int vector_len = 0; __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); @@ -9546,66 +8667,62 @@ ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_avx(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} +instruct vsrl8S(vecX dst, vecS shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (URShiftVS dst shift)); + format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psrlw($dst$$XMMRegister, $shift$$XMMRegister); %} ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_evex(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); - match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} +instruct vsrl8S_imm(vecX dst, immI8 shift) %{ + predicate(UseAVX == 0 && n->as_Vector()->length() == 8); + match(Set dst (URShiftVS dst shift)); + format %{ "psrlw $dst,$shift\t! logical right shift packed8S" %} ins_encode %{ - int vector_len = 1; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); + __ psrlw($dst$$XMMRegister, (int)$shift$$constant); %} ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_evex_special(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} +instruct vsrl8S_reg(vecX dst, vecX src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); + match(Set dst (URShiftVS src shift)); + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_imm_avx(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); +instruct vsrl8S_reg_imm(vecX dst, vecX src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (URShiftVS src shift)); - format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} + format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed8S" %} ins_encode %{ - int vector_len = 1; + int vector_len = 0; __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_imm_evex(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vsrl16S_reg(vecY dst, vecY src, vecS shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (URShiftVS src shift)); format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} ins_encode %{ int vector_len = 1; - __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); + __ vpsrlw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); %} ins_pipe( pipe_slow ); %} -instruct vsrl16S_reg_imm_evex_special(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (URShiftVS dst shift)); - effect(TEMP src); +instruct vsrl16S_reg_imm(vecY dst, vecY src, immI8 shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); + match(Set dst (URShiftVS src shift)); format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed16S" %} ins_encode %{ int vector_len = 1; @@ -9615,7 +8732,7 @@ %} instruct vsrl32S_reg(vecZ dst, vecZ src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (URShiftVS src shift)); format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed32S" %} ins_encode %{ @@ -9626,7 +8743,7 @@ %} instruct vsrl32S_reg_imm(vecZ dst, vecZ src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (URShiftVS src shift)); format %{ "vpsrlw $dst,$src,$shift\t! logical right shift packed32S" %} ins_encode %{ @@ -9638,7 +8755,7 @@ // Integers vector logical right shift instruct vsrl2I(vecD dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVI dst shift)); format %{ "psrld $dst,$shift\t! logical right shift packed2I" %} ins_encode %{ @@ -9648,7 +8765,7 @@ %} instruct vsrl2I_imm(vecD dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVI dst shift)); format %{ "psrld $dst,$shift\t! logical right shift packed2I" %} ins_encode %{ @@ -9680,7 +8797,7 @@ %} instruct vsrl4I(vecX dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (URShiftVI dst shift)); format %{ "psrld $dst,$shift\t! logical right shift packed4I" %} ins_encode %{ @@ -9690,7 +8807,7 @@ %} instruct vsrl4I_imm(vecX dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (URShiftVI dst shift)); format %{ "psrld $dst,$shift\t! logical right shift packed4I" %} ins_encode %{ @@ -9767,7 +8884,7 @@ // Longs vector logical right shift instruct vsrl2L(vecX dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVL dst shift)); format %{ "psrlq $dst,$shift\t! logical right shift packed2L" %} ins_encode %{ @@ -9777,7 +8894,7 @@ %} instruct vsrl2L_imm(vecX dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (URShiftVL dst shift)); format %{ "psrlq $dst,$shift\t! logical right shift packed2L" %} ins_encode %{ @@ -9866,7 +8983,7 @@ %} instruct vsra2S_imm(vecS dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (RShiftVS dst shift)); format %{ "psraw $dst,$shift\t! arithmetic right shift packed2S" %} ins_encode %{ @@ -9875,19 +8992,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra2S_reg_avx(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra2S_reg_evex(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); +instruct vsra2S_reg(vecS dst, vecS src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} ins_encode %{ @@ -9897,31 +9003,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra2S_reg_evex_special(vecS dst, vecS src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra2S_reg_imm_avx(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 2); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra2S_reg_imm_evex(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 2); +instruct vsra2S_reg_imm(vecS dst, vecS src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 2); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} ins_encode %{ @@ -9931,18 +9014,6 @@ ins_pipe( pipe_slow ); %} -instruct vsra2S_reg_imm_evex_special(vecS dst, vecS src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 2); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed2S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - instruct vsra4S(vecD dst, vecS shift) %{ predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (RShiftVS dst shift)); @@ -9963,19 +9034,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra4S_reg_avx(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra4S_reg_evex(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); +instruct vsra4S_reg(vecD dst, vecD src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} ins_encode %{ @@ -9985,31 +9045,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra4S_reg_evex_special(vecD dst, vecD src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra4S_reg_imm_avx(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 4); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra4S_reg_imm_evex(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 4); +instruct vsra4S_reg_imm(vecD dst, vecD src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 4); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} ins_encode %{ @@ -10019,18 +9056,6 @@ ins_pipe( pipe_slow ); %} -instruct vsra4S_reg_imm_evex_special(vecD dst, vecD src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 4); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed4S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - instruct vsra8S(vecX dst, vecS shift) %{ predicate(UseAVX == 0 && n->as_Vector()->length() == 8); match(Set dst (RShiftVS dst shift)); @@ -10051,19 +9076,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra8S_reg_avx(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra8S_reg_evex(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsra8S_reg(vecX dst, vecX src, vecS shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} ins_encode %{ @@ -10073,31 +9087,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra8S_reg_evex_special(vecX dst, vecX src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra8S_reg_imm_avx(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 8); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra8S_reg_imm_evex(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 8); +instruct vsra8S_reg_imm(vecX dst, vecX src, immI8 shift) %{ + predicate(UseAVX > 0 && n->as_Vector()->length() == 8); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} ins_encode %{ @@ -10107,31 +9098,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra8S_reg_imm_evex_special(vecX dst, vecX src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 8); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed8S" %} - ins_encode %{ - int vector_len = 0; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra16S_reg_avx(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx256only() && n->as_Vector()->length() == 16); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra16S_reg_evex(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vsra16S_reg(vecY dst, vecY src, vecS shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} ins_encode %{ @@ -10141,31 +9109,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra16S_reg_evex_special(vecY dst, vecY src, vecS shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, $shift$$XMMRegister, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra16S_reg_imm_avx(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avxonly() && n->as_Vector()->length() == 16); - match(Set dst (RShiftVS src shift)); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - -instruct vsra16S_reg_imm_evex(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 16); +instruct vsra16S_reg_imm(vecY dst, vecY src, immI8 shift) %{ + predicate(UseAVX > 1 && n->as_Vector()->length() == 16); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} ins_encode %{ @@ -10175,20 +9120,8 @@ ins_pipe( pipe_slow ); %} -instruct vsra16S_reg_imm_evex_special(vecY dst, vecY src, immI8 shift) %{ - predicate(VM_Version::supports_avx512nobw() && n->as_Vector()->length() == 16); - match(Set dst (RShiftVS dst shift)); - effect(TEMP src); - format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed16S" %} - ins_encode %{ - int vector_len = 1; - __ vpsraw($dst$$XMMRegister, $src$$XMMRegister, (int)$shift$$constant, vector_len); - %} - ins_pipe( pipe_slow ); -%} - instruct vsra32S_reg(vecZ dst, vecZ src, vecS shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed32S" %} ins_encode %{ @@ -10199,7 +9132,7 @@ %} instruct vsra32S_reg_imm(vecZ dst, vecZ src, immI8 shift) %{ - predicate(VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); + predicate(UseAVX > 2 && VM_Version::supports_avx512bw() && n->as_Vector()->length() == 32); match(Set dst (RShiftVS src shift)); format %{ "vpsraw $dst,$src,$shift\t! arithmetic right shift packed32S" %} ins_encode %{ @@ -10211,7 +9144,7 @@ // Integers vector arithmetic right shift instruct vsra2I(vecD dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (RShiftVI dst shift)); format %{ "psrad $dst,$shift\t! arithmetic right shift packed2I" %} ins_encode %{ @@ -10221,7 +9154,7 @@ %} instruct vsra2I_imm(vecD dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 2); + predicate(UseAVX == 0 && n->as_Vector()->length() == 2); match(Set dst (RShiftVI dst shift)); format %{ "psrad $dst,$shift\t! arithmetic right shift packed2I" %} ins_encode %{ @@ -10253,7 +9186,7 @@ %} instruct vsra4I(vecX dst, vecS shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (RShiftVI dst shift)); format %{ "psrad $dst,$shift\t! arithmetic right shift packed4I" %} ins_encode %{ @@ -10263,7 +9196,7 @@ %} instruct vsra4I_imm(vecX dst, immI8 shift) %{ - predicate(n->as_Vector()->length() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length() == 4); match(Set dst (RShiftVI dst shift)); format %{ "psrad $dst,$shift\t! arithmetic right shift packed4I" %} ins_encode %{ @@ -10344,7 +9277,7 @@ // --------------------------------- AND -------------------------------------- instruct vand4B(vecS dst, vecS src) %{ - predicate(n->as_Vector()->length_in_bytes() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 4); match(Set dst (AndV dst src)); format %{ "pand $dst,$src\t! and vectors (4 bytes)" %} ins_encode %{ @@ -10376,7 +9309,7 @@ %} instruct vand8B(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length_in_bytes() == 8); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 8); match(Set dst (AndV dst src)); format %{ "pand $dst,$src\t! and vectors (8 bytes)" %} ins_encode %{ @@ -10408,7 +9341,7 @@ %} instruct vand16B(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length_in_bytes() == 16); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 16); match(Set dst (AndV dst src)); format %{ "pand $dst,$src\t! and vectors (16 bytes)" %} ins_encode %{ @@ -10486,7 +9419,7 @@ // --------------------------------- OR --------------------------------------- instruct vor4B(vecS dst, vecS src) %{ - predicate(n->as_Vector()->length_in_bytes() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 4); match(Set dst (OrV dst src)); format %{ "por $dst,$src\t! or vectors (4 bytes)" %} ins_encode %{ @@ -10518,7 +9451,7 @@ %} instruct vor8B(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length_in_bytes() == 8); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 8); match(Set dst (OrV dst src)); format %{ "por $dst,$src\t! or vectors (8 bytes)" %} ins_encode %{ @@ -10550,7 +9483,7 @@ %} instruct vor16B(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length_in_bytes() == 16); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 16); match(Set dst (OrV dst src)); format %{ "por $dst,$src\t! or vectors (16 bytes)" %} ins_encode %{ @@ -10628,7 +9561,7 @@ // --------------------------------- XOR -------------------------------------- instruct vxor4B(vecS dst, vecS src) %{ - predicate(n->as_Vector()->length_in_bytes() == 4); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 4); match(Set dst (XorV dst src)); format %{ "pxor $dst,$src\t! xor vectors (4 bytes)" %} ins_encode %{ @@ -10660,7 +9593,7 @@ %} instruct vxor8B(vecD dst, vecD src) %{ - predicate(n->as_Vector()->length_in_bytes() == 8); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 8); match(Set dst (XorV dst src)); format %{ "pxor $dst,$src\t! xor vectors (8 bytes)" %} ins_encode %{ @@ -10692,7 +9625,7 @@ %} instruct vxor16B(vecX dst, vecX src) %{ - predicate(n->as_Vector()->length_in_bytes() == 16); + predicate(UseAVX == 0 && n->as_Vector()->length_in_bytes() == 16); match(Set dst (XorV dst src)); format %{ "pxor $dst,$src\t! xor vectors (16 bytes)" %} ins_encode %{ diff -Nru openjdk-lts-11~28/src/hotspot/cpu/zero/vtableStubs_zero.cpp openjdk-lts-11.0.2+9/src/hotspot/cpu/zero/vtableStubs_zero.cpp --- openjdk-lts-11~28/src/hotspot/cpu/zero/vtableStubs_zero.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/cpu/zero/vtableStubs_zero.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -37,11 +37,6 @@ return NULL; } -int VtableStub::pd_code_size_limit(bool is_vtable_stub) { - ShouldNotCallThis(); - return 0; -} - int VtableStub::pd_code_alignment() { ShouldNotCallThis(); return 0; diff -Nru openjdk-lts-11~28/src/hotspot/os/aix/os_aix.cpp openjdk-lts-11.0.2+9/src/hotspot/os/aix/os_aix.cpp --- openjdk-lts-11~28/src/hotspot/os/aix/os_aix.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/aix/os_aix.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -4278,7 +4278,7 @@ // or -1 on failure (e.g. can't fork a new process). // Unlike system(), this function can be called from signal handler. It // doesn't block SIGINT et al. -int os::fork_and_exec(char* cmd) { +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { char * argv[4] = {"sh", "-c", cmd, NULL}; pid_t pid = fork(); diff -Nru openjdk-lts-11~28/src/hotspot/os/bsd/os_bsd.cpp openjdk-lts-11.0.2+9/src/hotspot/os/bsd/os_bsd.cpp --- openjdk-lts-11~28/src/hotspot/os/bsd/os_bsd.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/bsd/os_bsd.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -3814,7 +3814,7 @@ // or -1 on failure (e.g. can't fork a new process). // Unlike system(), this function can be called from signal handler. It // doesn't block SIGINT et al. -int os::fork_and_exec(char* cmd) { +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { const char * argv[4] = {"sh", "-c", cmd, NULL}; // fork() in BsdThreads/NPTL is not async-safe. It needs to run diff -Nru openjdk-lts-11~28/src/hotspot/os/linux/os_linux.cpp openjdk-lts-11.0.2+9/src/hotspot/os/linux/os_linux.cpp --- openjdk-lts-11~28/src/hotspot/os/linux/os_linux.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/linux/os_linux.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1892,12 +1892,16 @@ return (void*)::dlopen(NULL, RTLD_LAZY); } -static bool _print_ascii_file(const char* filename, outputStream* st) { +static bool _print_ascii_file(const char* filename, outputStream* st, const char* hdr = NULL) { int fd = ::open(filename, O_RDONLY); if (fd == -1) { return false; } + if (hdr != NULL) { + st->print_cr("%s", hdr); + } + char buf[33]; int bytes; buf[32] = '\0'; @@ -1990,6 +1994,8 @@ os::Linux::print_proc_sys_info(st); + os::Linux::print_ld_preload_file(st); + os::Linux::print_container_info(st); } @@ -2148,6 +2154,11 @@ st->cr(); } +void os::Linux::print_ld_preload_file(outputStream* st) { + _print_ascii_file("/etc/ld.so.preload", st, "\n/etc/ld.so.preload:"); + st->cr(); +} + void os::Linux::print_container_info(outputStream* st) { if (!OSContainer::is_containerized()) { return; @@ -5737,10 +5748,16 @@ // or -1 on failure (e.g. can't fork a new process). // Unlike system(), this function can be called from signal handler. It // doesn't block SIGINT et al. -int os::fork_and_exec(char* cmd) { +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { const char * argv[4] = {"sh", "-c", cmd, NULL}; - pid_t pid = fork(); + pid_t pid ; + + if (use_vfork_if_available) { + pid = vfork(); + } else { + pid = fork(); + } if (pid < 0) { // fork failed diff -Nru openjdk-lts-11~28/src/hotspot/os/linux/os_linux.hpp openjdk-lts-11.0.2+9/src/hotspot/os/linux/os_linux.hpp --- openjdk-lts-11~28/src/hotspot/os/linux/os_linux.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/linux/os_linux.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -114,6 +114,7 @@ static void print_distro_info(outputStream* st); static void print_libversion_info(outputStream* st); static void print_proc_sys_info(outputStream* st); + static void print_ld_preload_file(outputStream* st); public: static bool _stack_is_executable; diff -Nru openjdk-lts-11~28/src/hotspot/os/solaris/os_solaris.cpp openjdk-lts-11.0.2+9/src/hotspot/os/solaris/os_solaris.cpp --- openjdk-lts-11~28/src/hotspot/os/solaris/os_solaris.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/solaris/os_solaris.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -5279,7 +5279,7 @@ // or -1 on failure (e.g. can't fork a new process). // Unlike system(), this function can be called from signal handler. It // doesn't block SIGINT et al. -int os::fork_and_exec(char* cmd) { +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { char * argv[4]; argv[0] = (char *)"sh"; argv[1] = (char *)"-c"; diff -Nru openjdk-lts-11~28/src/hotspot/os/windows/os_windows.cpp openjdk-lts-11.0.2+9/src/hotspot/os/windows/os_windows.cpp --- openjdk-lts-11~28/src/hotspot/os/windows/os_windows.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os/windows/os_windows.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -5260,7 +5260,7 @@ // Run the specified command in a separate process. Return its exit value, // or -1 on failure (e.g. can't create a new process). -int os::fork_and_exec(char* cmd) { +int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { STARTUPINFO si; PROCESS_INFORMATION pi; DWORD exit_code; diff -Nru openjdk-lts-11~28/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp openjdk-lts-11.0.2+9/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp --- openjdk-lts-11~28/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -42,10 +42,51 @@ } bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) { - ucontext_t* uc = (ucontext_t*) ucontext; - *fr_addr = frame((intptr_t*)uc->uc_mcontext.gregs[15/*REG_SP*/], + assert(this->is_Java_thread(), "must be JavaThread"); + + // If we have a last_Java_frame, then we should use it even if + // isInJava == true. It should be more reliable than ucontext info. + if (has_last_Java_frame() && frame_anchor()->walkable()) { + *fr_addr = pd_last_frame(); + return true; + } + + if (isInJava) { + ucontext_t* uc = (ucontext_t*) ucontext; + frame ret_frame((intptr_t*)uc->uc_mcontext.gregs[15/*Z_SP*/], (address)uc->uc_mcontext.psw.addr); - return true; + + if (ret_frame.pc() == NULL) { + // ucontext wasn't useful + return false; + } + + if (ret_frame.is_interpreted_frame()) { + frame::z_ijava_state* istate = ret_frame.ijava_state_unchecked(); + if (!((Method*)(istate->method))->is_metaspace_object()) { + return false; + } + uint64_t reg_bcp = uc->uc_mcontext.gregs[13/*Z_BCP*/]; + uint64_t istate_bcp = istate->bcp; + uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base()); + uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size()); + if (istate_bcp >= code_start && istate_bcp < code_end) { + // we have a valid bcp, don't touch it, do nothing + } else if (reg_bcp >= code_start && reg_bcp < code_end) { + istate->bcp = reg_bcp; + } else { + return false; + } + } + if (!ret_frame.safe_for_sender(this)) { + // nothing else to try if the frame isn't good + return false; + } + *fr_addr = ret_frame; + return true; + } + // nothing else to try + return false; } // Forte Analyzer AsyncGetCallTrace profiling support is not implemented on Linux/S390x. diff -Nru openjdk-lts-11~28/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp openjdk-lts-11.0.2+9/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp --- openjdk-lts-11~28/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -54,6 +54,16 @@ "std %0, %1\n" : "=&f"(tmp), "=Q"(*(volatile double*)dst) : "Q"(*(volatile double*)src)); +#elif defined(__ARM_ARCH_7A__) + // Note that a ldrexd + clrex combination is only needed for + // correctness on the OS level (context-switches). In this + // case, clrex *may* be beneficial for performance. For now + // don't bother with clrex as this is Zero. + jlong tmp; + asm volatile ("ldrexd %0, [%1]\n" + : "=r"(tmp) + : "r"(src), "m"(src)); + *(jlong *) dst = tmp; #else *(jlong *) dst = *(const jlong *) src; #endif diff -Nru openjdk-lts-11~28/src/hotspot/share/c1/c1_LIRAssembler.cpp openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIRAssembler.cpp --- openjdk-lts-11~28/src/hotspot/share/c1/c1_LIRAssembler.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIRAssembler.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -551,10 +551,6 @@ pop(op->in_opr()); break; - case lir_neg: - negate(op->in_opr(), op->result_opr()); - break; - case lir_leal: leal(op->in_opr(), op->result_opr(), op->patch_code(), op->info()); break; @@ -747,6 +743,10 @@ intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op); break; + case lir_neg: + negate(op->in_opr1(), op->result_opr(), op->in_opr2()); + break; + case lir_logic_and: case lir_logic_or: case lir_logic_xor: diff -Nru openjdk-lts-11~28/src/hotspot/share/c1/c1_LIRAssembler.hpp openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIRAssembler.hpp --- openjdk-lts-11~28/src/hotspot/share/c1/c1_LIRAssembler.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIRAssembler.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -239,7 +239,7 @@ void align_backward_branch_target(); void align_call(LIR_Code code); - void negate(LIR_Opr left, LIR_Opr dest); + void negate(LIR_Opr left, LIR_Opr dest, LIR_Opr tmp = LIR_OprFact::illegalOpr); void leal(LIR_Opr src, LIR_Opr dest, LIR_PatchCode patch_code, CodeEmitInfo* info); void rt_call(LIR_Opr result, address dest, const LIR_OprList* args, LIR_Opr tmp, CodeEmitInfo* info); diff -Nru openjdk-lts-11~28/src/hotspot/share/c1/c1_LIR.cpp openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIR.cpp --- openjdk-lts-11~28/src/hotspot/share/c1/c1_LIR.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIR.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -472,7 +472,6 @@ case lir_pop: // input always valid, result and info always invalid case lir_return: // input always valid, result and info always invalid case lir_leal: // input and result always valid, info always invalid - case lir_neg: // input and result always valid, info always invalid case lir_monaddr: // input and result always valid, info always invalid case lir_null_check: // input and info always valid, result always invalid case lir_move: // input and result always valid, may have info @@ -580,6 +579,7 @@ case lir_rem: case lir_sqrt: case lir_abs: + case lir_neg: case lir_logic_and: case lir_logic_or: case lir_logic_xor: @@ -1662,7 +1662,6 @@ case lir_null_check: s = "null_check"; break; case lir_return: s = "return"; break; case lir_safepoint: s = "safepoint"; break; - case lir_neg: s = "neg"; break; case lir_leal: s = "leal"; break; case lir_branch: s = "branch"; break; case lir_cond_float_branch: s = "flt_cond_br"; break; @@ -1690,6 +1689,7 @@ case lir_div_strictfp: s = "div_strictfp"; break; case lir_rem: s = "rem"; break; case lir_abs: s = "abs"; break; + case lir_neg: s = "neg"; break; case lir_sqrt: s = "sqrt"; break; case lir_logic_and: s = "logic_and"; break; case lir_logic_or: s = "logic_or"; break; diff -Nru openjdk-lts-11~28/src/hotspot/share/c1/c1_LIR.hpp openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIR.hpp --- openjdk-lts-11~28/src/hotspot/share/c1/c1_LIR.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/c1/c1_LIR.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -911,7 +911,6 @@ , lir_null_check , lir_return , lir_leal - , lir_neg , lir_branch , lir_cond_float_branch , lir_move @@ -939,6 +938,7 @@ , lir_rem , lir_sqrt , lir_abs + , lir_neg , lir_tan , lir_log10 , lir_logic_and @@ -2073,7 +2073,6 @@ void branch_destination(Label* lbl) { append(new LIR_OpLabel(lbl)); } - void negate(LIR_Opr from, LIR_Opr to) { append(new LIR_Op1(lir_neg, from, to)); } void leal(LIR_Opr from, LIR_Opr result_reg, LIR_PatchCode patch_code = lir_patch_none, CodeEmitInfo* info = NULL) { append(new LIR_Op1(lir_leal, from, result_reg, T_ILLEGAL, patch_code, info)); } // result is a stack location for old backend and vreg for UseLinearScan @@ -2157,6 +2156,7 @@ LIR_Opr t1, LIR_Opr t2, LIR_Opr result = LIR_OprFact::illegalOpr); void abs (LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_abs , from, tmp, to)); } + void negate(LIR_Opr from, LIR_Opr to, LIR_Opr tmp = LIR_OprFact::illegalOpr) { append(new LIR_Op2(lir_neg, from, tmp, to)); } void sqrt(LIR_Opr from, LIR_Opr to, LIR_Opr tmp) { append(new LIR_Op2(lir_sqrt, from, tmp, to)); } void fmad(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmad, from, from1, from2, to)); } void fmaf(LIR_Opr from, LIR_Opr from1, LIR_Opr from2, LIR_Opr to) { append(new LIR_Op3(lir_fmaf, from, from1, from2, to)); } diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/classFileParser.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classFileParser.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/classFileParser.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classFileParser.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -4477,33 +4477,6 @@ } } -// Attach super classes and interface classes to class loader data -static void record_defined_class_dependencies(const InstanceKlass* defined_klass, - TRAPS) { - assert(defined_klass != NULL, "invariant"); - - ClassLoaderData* const defining_loader_data = defined_klass->class_loader_data(); - if (defining_loader_data->is_the_null_class_loader_data()) { - // Dependencies to null class loader data are implicit. - return; - } else { - // add super class dependency - Klass* const super = defined_klass->super(); - if (super != NULL) { - defining_loader_data->record_dependency(super); - } - - // add super interface dependencies - const Array* const local_interfaces = defined_klass->local_interfaces(); - if (local_interfaces != NULL) { - const int length = local_interfaces->length(); - for (int i = 0; i < length; i++) { - defining_loader_data->record_dependency(local_interfaces->at(i)); - } - } - } -} - // utility methods for appending an array with check for duplicates static void append_interfaces(GrowableArray* result, @@ -5704,9 +5677,6 @@ } } - // Update the loader_data graph. - record_defined_class_dependencies(ik, CHECK); - ClassLoadingService::notify_class_loaded(ik, false /* not shared class */); if (!is_internal()) { diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/classLoaderData.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classLoaderData.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/classLoaderData.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classLoaderData.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1309,6 +1309,20 @@ } #endif // PRODUCT +bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) { + if (loader_data != NULL) { + if (loader_data == ClassLoaderData::the_null_class_loader_data()) { + return true; + } + for (ClassLoaderData* data = _head; data != NULL; data = data->next()) { + if (loader_data == data) { + return true; + } + } + } + return false; +} + #if INCLUDE_JFR static Ticks class_unload_time; static void post_class_unload_event(Klass* const k) { @@ -1389,11 +1403,6 @@ if (seen_dead_loader) { data = _head; while (data != NULL) { - // Remove entries in the dictionary of live class loader that have - // initiated loading classes in a dead class loader. - if (data->dictionary() != NULL) { - data->dictionary()->do_unloading(); - } // Walk a ModuleEntry's reads, and a PackageEntry's exports // lists to determine if there are modules on those lists that are now // dead and should be removed. A module's life cycle is equivalent diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/classLoaderData.hpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classLoaderData.hpp --- openjdk-lts-11~28/src/hotspot/share/classfile/classLoaderData.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/classLoaderData.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -169,6 +169,10 @@ #ifndef PRODUCT static bool contains_loader_data(ClassLoaderData* loader_data); #endif + + // Check if ClassLoaderData is part of the ClassLoaderDataGraph (not unloaded) + // Usage without lock only allowed during error reporting. + static bool is_valid(ClassLoaderData* loader_data); }; // ClassLoaderData class diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/dictionary.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/dictionary.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/dictionary.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/dictionary.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -246,40 +246,6 @@ } } - -void Dictionary::do_unloading() { - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); - - // The NULL class loader doesn't initiate loading classes from other class loaders - if (loader_data() == ClassLoaderData::the_null_class_loader_data()) { - return; - } - - // Remove unloaded entries and classes from this dictionary - DictionaryEntry* probe = NULL; - for (int index = 0; index < table_size(); index++) { - for (DictionaryEntry** p = bucket_addr(index); *p != NULL; ) { - probe = *p; - InstanceKlass* ik = probe->instance_klass(); - ClassLoaderData* k_def_class_loader_data = ik->class_loader_data(); - - // If the klass that this loader initiated is dead, - // (determined by checking the defining class loader) - // remove this entry. - if (k_def_class_loader_data->is_unloading()) { - assert(k_def_class_loader_data != loader_data(), - "cannot have live defining loader and unreachable klass"); - *p = probe->next(); - free_entry(probe); - continue; - } - // Clean pd_set - clean_cached_protection_domains(probe); - p = probe->next_addr(); - } - } -} - void Dictionary::remove_classes_in_error_state() { assert(DumpSharedSpaces, "supported only when dumping"); DictionaryEntry* probe = NULL; diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/dictionary.hpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/dictionary.hpp --- openjdk-lts-11~28/src/hotspot/share/classfile/dictionary.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/dictionary.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -80,9 +80,6 @@ void unlink(); void remove_classes_in_error_state(); - // Unload classes whose defining loaders are unloaded - void do_unloading(); - // Protection domains InstanceKlass* find(unsigned int hash, Symbol* name, Handle protection_domain); bool is_valid_protection_domain(unsigned int hash, diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/systemDictionary.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/systemDictionary.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/systemDictionary.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/systemDictionary.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -829,8 +829,15 @@ check_constraints(d_hash, k, class_loader, false, THREAD); // Need to check for a PENDING_EXCEPTION again; check_constraints - // can throw and doesn't use the CHECK macro. + // can throw but we may have to remove entry from the placeholder table below. if (!HAS_PENDING_EXCEPTION) { + // Record dependency for non-parent delegation. + // This recording keeps the defining class loader of the klass (k) found + // from being unloaded while the initiating class loader is loaded + // even if the reference to the defining class loader is dropped + // before references to the initiating class loader. + loader_data->record_dependency(k); + { // Grabbing the Compile_lock prevents systemDictionary updates // during compilations. MutexLocker mu(Compile_lock, THREAD); @@ -2161,6 +2168,7 @@ InstanceKlass* sd_check = find_class(d_hash, name, dictionary); if (sd_check == NULL) { dictionary->add_klass(d_hash, name, k); + notice_modification(); } #ifdef ASSERT diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/verificationType.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/verificationType.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/verificationType.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/verificationType.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -50,7 +50,6 @@ Klass* this_class = SystemDictionary::resolve_or_fail( name, Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), true, CHECK_false); - klass->class_loader_data()->record_dependency(this_class); if (log_is_enabled(Debug, class, resolve)) { Verifier::trace_class_resolution(this_class, klass); } @@ -68,7 +67,6 @@ Klass* from_class = SystemDictionary::resolve_or_fail( from_name, Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), true, CHECK_false); - klass->class_loader_data()->record_dependency(from_class); if (log_is_enabled(Debug, class, resolve)) { Verifier::trace_class_resolution(from_class, klass); } diff -Nru openjdk-lts-11~28/src/hotspot/share/classfile/verifier.cpp openjdk-lts-11.0.2+9/src/hotspot/share/classfile/verifier.cpp --- openjdk-lts-11~28/src/hotspot/share/classfile/verifier.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/classfile/verifier.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -2015,7 +2015,6 @@ true, THREAD); if (kls != NULL) { - current_class()->class_loader_data()->record_dependency(kls); if (log_is_enabled(Debug, class, resolve)) { InstanceKlass* cur_class = InstanceKlass::cast(current_class()); Verifier::trace_class_resolution(kls, cur_class); diff -Nru openjdk-lts-11~28/src/hotspot/share/code/codeBlob.cpp openjdk-lts-11.0.2+9/src/hotspot/share/code/codeBlob.cpp --- openjdk-lts-11~28/src/hotspot/share/code/codeBlob.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/codeBlob.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -26,7 +26,9 @@ #include "jvm.h" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" +#include "code/icBuffer.hpp" #include "code/relocInfo.hpp" +#include "code/vtableStubs.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" #include "memory/allocation.inline.hpp" @@ -559,6 +561,67 @@ st->print_cr("[CodeBlob]"); } +void CodeBlob::dump_for_addr(address addr, outputStream* st, bool verbose) const { + if (is_buffer_blob()) { + // the interpreter is generated into a buffer blob + InterpreterCodelet* i = Interpreter::codelet_containing(addr); + if (i != NULL) { + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin())); + i->print_on(st); + return; + } + if (Interpreter::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into interpreter code" + " (not bytecode specific)", p2i(addr)); + return; + } + // + if (AdapterHandlerLibrary::contains(this)) { + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - code_begin())); + AdapterHandlerLibrary::print_handler_on(st, this); + } + // the stubroutines are generated into a buffer blob + StubCodeDesc* d = StubCodeDesc::desc_for(addr); + if (d != NULL) { + st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin())); + d->print_on(st); + st->cr(); + return; + } + if (StubRoutines::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr)); + return; + } + // the InlineCacheBuffer is using stubs generated into a buffer blob + if (InlineCacheBuffer::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr)); + return; + } + VtableStub* v = VtableStubs::stub_containing(addr); + if (v != NULL) { + st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point())); + v->print_on(st); + st->cr(); + return; + } + } + if (is_nmethod()) { + nmethod* nm = (nmethod*)this; + ResourceMark rm; + st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT, + p2i(addr), (int)(addr - nm->entry_point()), p2i(nm)); + if (verbose) { + st->print(" for "); + nm->method()->print_value_on(st); + } + st->cr(); + nm->print_nmethod(verbose); + return; + } + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - code_begin())); + print_on(st); +} + void RuntimeBlob::verify() { ShouldNotReachHere(); } diff -Nru openjdk-lts-11~28/src/hotspot/share/code/codeBlob.hpp openjdk-lts-11.0.2+9/src/hotspot/share/code/codeBlob.hpp --- openjdk-lts-11~28/src/hotspot/share/code/codeBlob.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/codeBlob.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -221,6 +221,7 @@ virtual void print() const { print_on(tty); }; virtual void print_on(outputStream* st) const; virtual void print_value_on(outputStream* st) const; + void dump_for_addr(address addr, outputStream* st, bool verbose) const; void print_code(); // Print the comment associated with offset on stream, if there is one diff -Nru openjdk-lts-11~28/src/hotspot/share/code/codeHeapState.cpp openjdk-lts-11.0.2+9/src/hotspot/share/code/codeHeapState.cpp --- openjdk-lts-11~28/src/hotspot/share/code/codeHeapState.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/codeHeapState.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -2168,9 +2168,8 @@ // this_blob->as_nmethod_or_null() is safe. Inlined, maybe invisible on stack. nmethod* nm = this_blob->as_nmethod_or_null(); - Method* method = (nm == NULL) ? NULL : nm->method(); // may be uninitialized, i.e. != NULL, but invalid - if ((nm != NULL) && (method != NULL) && (cbType != nMethod_dead) && (cbType != nMethod_inconstruction) && - os::is_readable_pointer(method) && os::is_readable_pointer(method->constants())) { + if (CompiledMethod::nmethod_access_is_safe(nm)) { + Method* method = nm->method(); ResourceMark rm; //---< collect all data to locals as quickly as possible >--- unsigned int total_size = nm->total_size(); diff -Nru openjdk-lts-11~28/src/hotspot/share/code/compiledMethod.cpp openjdk-lts-11.0.2+9/src/hotspot/share/code/compiledMethod.cpp --- openjdk-lts-11~28/src/hotspot/share/code/compiledMethod.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/compiledMethod.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -619,3 +619,18 @@ } } } + +// Iterating over all nmethods, e.g. with the help of CodeCache::nmethods_do(fun) was found +// to not be inherently safe. There is a chance that fields are seen which are not properly +// initialized. This happens despite the fact that nmethods_do() asserts the CodeCache_lock +// to be held. +// To bundle knowledge about necessary checks in one place, this function was introduced. +// It is not claimed that these checks are sufficient, but they were found to be necessary. +bool CompiledMethod::nmethod_access_is_safe(nmethod* nm) { + Method* method = (nm == NULL) ? NULL : nm->method(); // nm->method() may be uninitialized, i.e. != NULL, but invalid + return (nm != NULL) && (method != NULL) && (method->signature() != NULL) && + !nm->is_zombie() && !nm->is_not_installed() && + os::is_readable_pointer(method) && + os::is_readable_pointer(method->constants()) && + os::is_readable_pointer(method->signature()); +} diff -Nru openjdk-lts-11~28/src/hotspot/share/code/compiledMethod.hpp openjdk-lts-11.0.2+9/src/hotspot/share/code/compiledMethod.hpp --- openjdk-lts-11~28/src/hotspot/share/code/compiledMethod.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/compiledMethod.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -238,6 +238,8 @@ return _mark_for_deoptimization_status != deoptimize_noupdate; } + static bool nmethod_access_is_safe(nmethod* nm); + // tells whether frames described by this nmethod can be deoptimized // note: native wrappers cannot be deoptimized. bool can_be_deoptimized() const { return is_java_method(); } diff -Nru openjdk-lts-11~28/src/hotspot/share/code/vtableStubs.cpp openjdk-lts-11.0.2+9/src/hotspot/share/code/vtableStubs.cpp --- openjdk-lts-11~28/src/hotspot/share/code/vtableStubs.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/vtableStubs.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -26,6 +26,7 @@ #include "code/vtableStubs.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" +#include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" @@ -92,6 +93,32 @@ VtableStub* VtableStubs::_table[VtableStubs::N]; int VtableStubs::_number_of_vtable_stubs = 0; +int VtableStubs::_vtab_stub_size = 0; +int VtableStubs::_itab_stub_size = 0; + +#if defined(PRODUCT) + // These values are good for the PRODUCT case (no tracing). + static const int first_vtableStub_size = 64; + static const int first_itableStub_size = 256; +#else + // These values are good for the non-PRODUCT case (when tracing can be switched on). + // To find out, run test workload with + // -Xlog:vtablestubs=Trace -XX:+CountCompiledCalls -XX:+DebugVtables + // and use the reported "estimate" value. + // Here is a list of observed worst-case values: + // vtable itable + // aarch64: 460 324 + // arm: ? ? + // ppc (linux, BE): 404 288 + // ppc (linux, LE): 356 276 + // ppc (AIX): 416 296 + // s390x: 408 256 + // Solaris-sparc: 792 348 + // x86 (Linux): 670 309 + // x86 (MacOS): 682 321 + static const int first_vtableStub_size = 1024; + static const int first_itableStub_size = 512; +#endif void VtableStubs::initialize() { @@ -107,6 +134,77 @@ } +int VtableStubs::code_size_limit(bool is_vtable_stub) { + if (is_vtable_stub) { + return _vtab_stub_size > 0 ? _vtab_stub_size : first_vtableStub_size; + } else { // itable stub + return _itab_stub_size > 0 ? _itab_stub_size : first_itableStub_size; + } +} // code_size_limit + + +void VtableStubs::check_and_set_size_limit(bool is_vtable_stub, + int code_size, + int padding) { + const char* name = is_vtable_stub ? "vtable" : "itable"; + + guarantee(code_size <= code_size_limit(is_vtable_stub), + "buffer overflow in %s stub, code_size is %d, limit is %d", name, code_size, code_size_limit(is_vtable_stub)); + + if (is_vtable_stub) { + if (log_is_enabled(Trace, vtablestubs)) { + if ( (_vtab_stub_size > 0) && ((code_size + padding) > _vtab_stub_size) ) { + log_trace(vtablestubs)("%s size estimate needed adjustment from %d to %d bytes", + name, _vtab_stub_size, code_size + padding); + } + } + if ( (code_size + padding) > _vtab_stub_size ) { + _vtab_stub_size = code_size + padding; + } + } else { // itable stub + if (log_is_enabled(Trace, vtablestubs)) { + if ( (_itab_stub_size > 0) && ((code_size + padding) > _itab_stub_size) ) { + log_trace(vtablestubs)("%s size estimate needed adjustment from %d to %d bytes", + name, _itab_stub_size, code_size + padding); + } + } + if ( (code_size + padding) > _itab_stub_size ) { + _itab_stub_size = code_size + padding; + } + } + return; +} // check_and_set_size_limit + + +void VtableStubs::bookkeeping(MacroAssembler* masm, outputStream* out, VtableStub* s, + address npe_addr, address ame_addr, bool is_vtable_stub, + int index, int slop_bytes, int index_dependent_slop) { + const char* name = is_vtable_stub ? "vtable" : "itable"; + const int stub_length = code_size_limit(is_vtable_stub); + + if (log_is_enabled(Trace, vtablestubs)) { + log_trace(vtablestubs)("%s #%d at " PTR_FORMAT ": size: %d, estimate: %d, slop area: %d", + name, index, p2i(s->code_begin()), + (int)(masm->pc() - s->code_begin()), + stub_length, + (int)(s->code_end() - masm->pc())); + } + guarantee(masm->pc() <= s->code_end(), "%s #%d: overflowed buffer, estimated len: %d, actual len: %d, overrun: %d", + name, index, stub_length, + (int)(masm->pc() - s->code_begin()), + (int)(masm->pc() - s->code_end())); + assert((masm->pc() + index_dependent_slop) <= s->code_end(), "%s #%d: spare space for 32-bit offset: required = %d, available = %d", + name, index, index_dependent_slop, + (int)(s->code_end() - masm->pc())); + + // After the first vtable/itable stub is generated, we have a much + // better estimate for the stub size. Remember/update this + // estimate after some sanity checks. + check_and_set_size_limit(is_vtable_stub, masm->offset(), slop_bytes); + s->set_exception_points(npe_addr, ame_addr); +} + + address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { assert(vtable_index >= 0, "must be positive"); @@ -173,10 +271,7 @@ uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index()); VtableStub* s; for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {} - if (s == stub) { - return s; - } - return NULL; + return (s == stub) ? s : NULL; } bool VtableStubs::contains(address pc) { diff -Nru openjdk-lts-11~28/src/hotspot/share/code/vtableStubs.hpp openjdk-lts-11.0.2+9/src/hotspot/share/code/vtableStubs.hpp --- openjdk-lts-11~28/src/hotspot/share/code/vtableStubs.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/code/vtableStubs.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -25,12 +25,94 @@ #ifndef SHARE_VM_CODE_VTABLESTUBS_HPP #define SHARE_VM_CODE_VTABLESTUBS_HPP +#include "asm/macroAssembler.hpp" #include "code/vmreg.hpp" #include "memory/allocation.hpp" // A VtableStub holds an individual code stub for a pair (vtable index, #args) for either itables or vtables // There's a one-to-one relationship between a VtableStub and such a pair. +// A word on VtableStub sizing: +// Such a vtable/itable stub consists of the instance data +// and an immediately following CodeBuffer. +// Unfortunately, the required space for the code buffer varies, depending on +// the setting of compile time macros (PRODUCT, ASSERT, ...) and of command line +// parameters. Actual data may have an influence on the size as well. +// +// A simple approximation for the VtableStub size would be to just take a value +// "large enough" for all circumstances - a worst case estimate. +// As there can exist many stubs - and they never go away - we certainly don't +// want to waste more code cache space than absolutely necessary. +// +// We need a different approach which, as far as possible, should be independent +// from or adaptive to code size variations. These variations may be caused by +// changed compile time or run time switches as well as by changed emitter code. +// +// Here is the idea: +// For the first stub we generate, we allocate a "large enough" code buffer. +// Once all instructions are emitted, we know the actual size of the stub. +// Remembering that size allows us to allocate a tightly matching code buffer +// for all subsequent stubs. That covers all "static variance", i.e. all variance +// that is due to compile time macros, command line parameters, machine capabilities, +// and other influences which are immutable for the life span of the vm. +// +// Life isn't always that easy. Code size may depend on actual data, "load constant" +// being an example for that. All code segments with such "dynamic variance" require +// additional care. We need to know or estimate the worst case code size for each +// such segment. With that knowledge, we can maintain a "slop counter" in the +// platform-specific stub emitters. It accumulates the difference between worst-case +// and actual code size. When the stub is fully generated, the actual stub size is +// adjusted (increased) by the slop counter value. +// +// As a result, we allocate all but the first code buffers with the same, tightly matching size. +// + +// VtableStubs creates the code stubs for compiled calls through vtables. +// There is one stub per (vtable index, args_size) pair, and the stubs are +// never deallocated. They don't need to be GCed because they contain no oops. +class VtableStub; + +class VtableStubs : AllStatic { + public: // N must be public (some compilers need this for _table) + enum { + N = 256, // size of stub table; must be power of two + mask = N - 1 + }; + + private: + friend class VtableStub; + static VtableStub* _table[N]; // table of existing stubs + static int _number_of_vtable_stubs; // number of stubs created so far (for statistics) + static int _vtab_stub_size; // current size estimate for vtable stub (quasi-constant) + static int _itab_stub_size; // current size estimate for itable stub (quasi-constant) + + static VtableStub* create_vtable_stub(int vtable_index); + static VtableStub* create_itable_stub(int vtable_index); + static VtableStub* lookup (bool is_vtable_stub, int vtable_index); + static void enter (bool is_vtable_stub, int vtable_index, VtableStub* s); + static inline uint hash (bool is_vtable_stub, int vtable_index); + static address find_stub (bool is_vtable_stub, int vtable_index); + static void bookkeeping(MacroAssembler* masm, outputStream* out, VtableStub* s, + address npe_addr, address ame_addr, bool is_vtable_stub, + int index, int slop_bytes, int index_dependent_slop); + static int code_size_limit(bool is_vtable_stub); + static void check_and_set_size_limit(bool is_vtable_stub, + int code_size, + int padding); + + public: + static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); } + static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); } + + static VtableStub* entry_point(address pc); // vtable stub entry point for a pc + static bool contains(address pc); // is pc within any stub? + static VtableStub* stub_containing(address pc); // stub containing pc or NULL + static int number_of_vtable_stubs() { return _number_of_vtable_stubs; } + static void initialize(); + static void vtable_stub_do(void f(VtableStub*)); // iterates over all vtable stubs +}; + + class VtableStub { private: friend class VtableStubs; @@ -58,7 +140,7 @@ public: address code_begin() const { return (address)(this + 1); } - address code_end() const { return code_begin() + pd_code_size_limit(_is_vtable_stub); } + address code_end() const { return code_begin() + VtableStubs::code_size_limit(_is_vtable_stub); } address entry_point() const { return code_begin(); } static int entry_offset() { return sizeof(class VtableStub); } @@ -78,7 +160,6 @@ } // platform-dependent routines - static int pd_code_size_limit(bool is_vtable_stub); static int pd_code_alignment(); // CNC: Removed because vtable stubs are now made with an ideal graph // static bool pd_disregard_arg_size(); @@ -100,38 +181,4 @@ }; - -// VtableStubs creates the code stubs for compiled calls through vtables. -// There is one stub per (vtable index, args_size) pair, and the stubs are -// never deallocated. They don't need to be GCed because they contain no oops. - -class VtableStubs : AllStatic { - public: // N must be public (some compilers need this for _table) - enum { - N = 256, // size of stub table; must be power of two - mask = N - 1 - }; - - private: - static VtableStub* _table[N]; // table of existing stubs - static int _number_of_vtable_stubs; // number of stubs created so far (for statistics) - - static VtableStub* create_vtable_stub(int vtable_index); - static VtableStub* create_itable_stub(int vtable_index); - static VtableStub* lookup (bool is_vtable_stub, int vtable_index); - static void enter (bool is_vtable_stub, int vtable_index, VtableStub* s); - static inline uint hash (bool is_vtable_stub, int vtable_index); - static address find_stub (bool is_vtable_stub, int vtable_index); - - public: - static address find_vtable_stub(int vtable_index) { return find_stub(true, vtable_index); } - static address find_itable_stub(int itable_index) { return find_stub(false, itable_index); } - static VtableStub* entry_point(address pc); // vtable stub entry point for a pc - static bool contains(address pc); // is pc within any stub? - static VtableStub* stub_containing(address pc); // stub containing pc or NULL - static int number_of_vtable_stubs() { return _number_of_vtable_stubs; } - static void initialize(); - static void vtable_stub_do(void f(VtableStub*)); // iterates over all vtable stubs -}; - #endif // SHARE_VM_CODE_VTABLESTUBS_HPP diff -Nru openjdk-lts-11~28/src/hotspot/share/compiler/compileBroker.cpp openjdk-lts-11.0.2+9/src/hotspot/share/compiler/compileBroker.cpp --- openjdk-lts-11~28/src/hotspot/share/compiler/compileBroker.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/compiler/compileBroker.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1781,36 +1781,38 @@ return; // Stop this thread. } } - continue; - } + } else { - if (UseDynamicNumberOfCompilerThreads) { - possibly_add_compiler_threads(); - } + // Give compiler threads an extra quanta. They tend to be bursty and + // this helps the compiler to finish up the job. + if (CompilerThreadHintNoPreempt) { + os::hint_no_preempt(); + } - // Give compiler threads an extra quanta. They tend to be bursty and - // this helps the compiler to finish up the job. - if (CompilerThreadHintNoPreempt) { - os::hint_no_preempt(); - } + // Assign the task to the current thread. Mark this compilation + // thread as active for the profiler. + // CompileTaskWrapper also keeps the Method* from being deallocated if redefinition + // occurs after fetching the compile task off the queue. + CompileTaskWrapper ctw(task); + nmethodLocker result_handle; // (handle for the nmethod produced by this task) + task->set_code_handle(&result_handle); + methodHandle method(thread, task->method()); - // Assign the task to the current thread. Mark this compilation - // thread as active for the profiler. - CompileTaskWrapper ctw(task); - nmethodLocker result_handle; // (handle for the nmethod produced by this task) - task->set_code_handle(&result_handle); - methodHandle method(thread, task->method()); + // Never compile a method if breakpoints are present in it + if (method()->number_of_breakpoints() == 0) { + // Compile the method. + if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { + invoke_compiler_on_method(task); + thread->start_idle_timer(); + } else { + // After compilation is disabled, remove remaining methods from queue + method->clear_queued_for_compilation(); + task->set_failure_reason("compilation is disabled"); + } + } - // Never compile a method if breakpoints are present in it - if (method()->number_of_breakpoints() == 0) { - // Compile the method. - if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { - invoke_compiler_on_method(task); - thread->start_idle_timer(); - } else { - // After compilation is disabled, remove remaining methods from queue - method->clear_queued_for_compilation(); - task->set_failure_reason("compilation is disabled"); + if (UseDynamicNumberOfCompilerThreads) { + possibly_add_compiler_threads(); } } } diff -Nru openjdk-lts-11~28/src/hotspot/share/gc/epsilon/epsilon_globals.hpp openjdk-lts-11.0.2+9/src/hotspot/share/gc/epsilon/epsilon_globals.hpp --- openjdk-lts-11~28/src/hotspot/share/gc/epsilon/epsilon_globals.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/gc/epsilon/epsilon_globals.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -79,7 +79,7 @@ "improves performance at the expense of per-thread memory waste. "\ "Lower value improves memory footprint, but penalizes actively " \ "allocating threads.") \ - range(1, max_intx) \ + range(1.0, DBL_MAX) \ \ experimental(size_t, EpsilonTLABDecayTime, 1000, \ "TLAB sizing policy decays to initial size after thread had not " \ diff -Nru openjdk-lts-11~28/src/hotspot/share/gc/epsilon/epsilonHeap.cpp openjdk-lts-11.0.2+9/src/hotspot/share/gc/epsilon/epsilonHeap.cpp --- openjdk-lts-11~28/src/hotspot/share/gc/epsilon/epsilonHeap.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/gc/epsilon/epsilonHeap.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -47,7 +47,7 @@ _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true); // Precompute hot fields - _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize); + _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize)); _step_counter_update = MIN2(max_byte_size / 16, EpsilonUpdateCountersStep); _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps); _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC; @@ -118,6 +118,8 @@ } HeapWord* EpsilonHeap::allocate_work(size_t size) { + assert(is_object_aligned(size), "Allocation size should be aligned: " SIZE_FORMAT, size); + HeapWord* res = _space->par_allocate(size); while (res == NULL) { @@ -168,6 +170,7 @@ } } + assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res)); return res; } @@ -211,6 +214,19 @@ // Always honor boundaries size = MAX2(min_size, MIN2(_max_tlab_size, size)); + // Always honor alignment + size = align_up(size, MinObjAlignment); + + // Check that adjustments did not break local and global invariants + assert(is_object_aligned(size), + "Size honors object alignment: " SIZE_FORMAT, size); + assert(min_size <= size, + "Size honors min size: " SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size); + assert(size <= _max_tlab_size, + "Size honors max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size); + assert(size <= CollectedHeap::max_tlab_size(), + "Size honors global max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size()); + if (log_is_enabled(Trace, gc)) { ResourceMark rm; log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT diff -Nru openjdk-lts-11~28/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp openjdk-lts-11.0.2+9/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp --- openjdk-lts-11~28/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/gc/shared/c1/barrierSetC1.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -286,6 +286,10 @@ if (gen_pre_barrier) { // We can have generate one runtime check here. Let's start with // the offset check. + // Allocate temp register to base and load it here, otherwise + // control flow below may confuse register allocator. + LIR_Opr base_reg = gen->new_register(T_OBJECT); + __ move(base.result(), base_reg); if (gen_offset_check) { // if (offset != referent_offset) -> continue // If offset is an int then we can do the comparison with the @@ -308,14 +312,14 @@ if (gen_source_check) { // offset is a const and equals referent offset // if (source == null) -> continue - __ cmp(lir_cond_equal, base.result(), LIR_OprFact::oopConst(NULL)); + __ cmp(lir_cond_equal, base_reg, LIR_OprFact::oopConst(NULL)); __ branch(lir_cond_equal, T_OBJECT, cont->label()); } LIR_Opr src_klass = gen->new_register(T_OBJECT); if (gen_type_check) { // We have determined that offset == referent_offset && src != null. // if (src->_klass->_reference_type == REF_NONE) -> continue - __ move(new LIR_Address(base.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); + __ move(new LIR_Address(base_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); LIR_Opr reference_type = gen->new_register(T_INT); __ move(reference_type_addr, reference_type); diff -Nru openjdk-lts-11~28/src/hotspot/share/interpreter/linkResolver.cpp openjdk-lts-11.0.2+9/src/hotspot/share/interpreter/linkResolver.cpp --- openjdk-lts-11~28/src/hotspot/share/interpreter/linkResolver.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/interpreter/linkResolver.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -788,24 +788,6 @@ check_method_loader_constraints(link_info, resolved_method, "method", CHECK_NULL); } - // For private method invocation we should only find the method in the resolved class. - // If that is not the case then we have a found a supertype method that we have nestmate - // access to. - if (resolved_method->is_private() && resolved_method->method_holder() != resolved_klass) { - ResourceMark rm(THREAD); - DEBUG_ONLY(bool is_nestmate = InstanceKlass::cast(link_info.current_klass())->has_nestmate_access_to(InstanceKlass::cast(resolved_klass), THREAD);) - assert(is_nestmate, "was only expecting nestmates to get here!"); - Exceptions::fthrow( - THREAD_AND_LOCATION, - vmSymbols::java_lang_NoSuchMethodError(), - "%s: method %s%s not found", - resolved_klass->external_name(), - resolved_method->name()->as_C_string(), - resolved_method->signature()->as_C_string() - ); - return NULL; - } - return resolved_method; } @@ -987,68 +969,68 @@ THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); } - if (!link_info.check_access()) - // Access checking may be turned off when calling from within the VM. - return; - - // check access + // Access checking may be turned off when calling from within the VM. Klass* current_klass = link_info.current_klass(); - check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); - - // check for errors - if (is_static != fd.is_static()) { - ResourceMark rm(THREAD); - char msg[200]; - jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string()); - THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); - } + if (link_info.check_access()) { - // A final field can be modified only - // (1) by methods declared in the class declaring the field and - // (2) by the method (in case of a static field) - // or by the method (in case of an instance field). - if (is_put && fd.access_flags().is_final()) { - ResourceMark rm(THREAD); - stringStream ss; + // check access + check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); - if (sel_klass != current_klass) { - ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class", - is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), - current_klass->external_name()); - THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); + // check for errors + if (is_static != fd.is_static()) { + ResourceMark rm(THREAD); + char msg[200]; + jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string()); + THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); } - if (fd.constants()->pool_holder()->major_version() >= 53) { - methodHandle m = link_info.current_method(); - assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes"); - bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic && - fd.is_static() && - !m()->is_static_initializer()); - bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) && - !fd.is_static() && - !m->is_object_initializer()); + // A final field can be modified only + // (1) by methods declared in the class declaring the field and + // (2) by the method (in case of a static field) + // or by the method (in case of an instance field). + if (is_put && fd.access_flags().is_final()) { + ResourceMark rm(THREAD); + stringStream ss; - if (is_initialized_static_final_update || is_initialized_instance_final_update) { - ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ", + if (sel_klass != current_klass) { + ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), - m()->name()->as_C_string(), - is_static ? "" : ""); + current_klass->external_name()); THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); } + + if (fd.constants()->pool_holder()->major_version() >= 53) { + methodHandle m = link_info.current_method(); + assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes"); + bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic && + fd.is_static() && + !m()->is_static_initializer()); + bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) && + !fd.is_static() && + !m->is_object_initializer()); + + if (is_initialized_static_final_update || is_initialized_instance_final_update) { + ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ", + is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), + m()->name()->as_C_string(), + is_static ? "" : ""); + THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); + } + } } - } - // initialize resolved_klass if necessary - // note 1: the klass which declared the field must be initialized (i.e, sel_klass) - // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) - // - // note 2: we don't want to force initialization if we are just checking - // if the field access is legal; e.g., during compilation - if (is_static && initialize_class) { - sel_klass->initialize(CHECK); + // initialize resolved_klass if necessary + // note 1: the klass which declared the field must be initialized (i.e, sel_klass) + // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) + // + // note 2: we don't want to force initialization if we are just checking + // if the field access is legal; e.g., during compilation + if (is_static && initialize_class) { + sel_klass->initialize(CHECK); + } } - if (sel_klass != current_klass) { + if ((sel_klass != current_klass) && (current_klass != NULL)) { check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK); } diff -Nru openjdk-lts-11~28/src/hotspot/share/logging/logTag.hpp openjdk-lts-11.0.2+9/src/hotspot/share/logging/logTag.hpp --- openjdk-lts-11~28/src/hotspot/share/logging/logTag.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/logging/logTag.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -169,7 +169,8 @@ LOG_TAG(vmoperation) \ LOG_TAG(vmthread) \ LOG_TAG(vtables) \ - LOG_TAG(workgang) + LOG_TAG(vtablestubs) \ + LOG_TAG(workgang) \ LOG_TAG_LIST_EXT #define PREFIX_LOG_TAG(T) (LogTag::_##T) diff -Nru openjdk-lts-11~28/src/hotspot/share/memory/filemap.cpp openjdk-lts-11.0.2+9/src/hotspot/share/memory/filemap.cpp --- openjdk-lts-11~28/src/hotspot/share/memory/filemap.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/memory/filemap.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -994,8 +994,8 @@ } bool FileMapInfo::verify_mapped_heap_regions(int first, int num) { - for (int i = first; - i <= first + num; i++) { + assert(num > 0, "sanity"); + for (int i = first; i < first + num; i++) { if (!verify_region_checksum(i)) { return false; } @@ -1029,6 +1029,7 @@ #endif // INCLUDE_CDS_JAVA_HEAP bool FileMapInfo::verify_region_checksum(int i) { + assert(i >= 0 && i < MetaspaceShared::n_regions, "invalid region"); if (!VerifySharedSpaces) { return true; } diff -Nru openjdk-lts-11~28/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp --- openjdk-lts-11~28/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -124,17 +124,17 @@ // This function looks at the mmap regions in the metaspace without locking. // The chunks are added with store ordering and not deleted except for at // unloading time during a safepoint. -bool VirtualSpaceList::contains(const void* ptr) { +VirtualSpaceNode* VirtualSpaceList::find_enclosing_space(const void* ptr) { // List should be stable enough to use an iterator here because removing virtual // space nodes is only allowed at a safepoint. VirtualSpaceListIterator iter(virtual_space_list()); while (iter.repeat()) { VirtualSpaceNode* vsn = iter.get_next(); if (vsn->contains(ptr)) { - return true; + return vsn; } } - return false; + return NULL; } void VirtualSpaceList::retire_current_virtual_space() { diff -Nru openjdk-lts-11~28/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp --- openjdk-lts-11~28/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace/virtualSpaceList.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -116,7 +116,8 @@ void inc_virtual_space_count(); void dec_virtual_space_count(); - bool contains(const void* ptr); + VirtualSpaceNode* find_enclosing_space(const void* ptr); + bool contains(const void* ptr) { return find_enclosing_space(ptr) != NULL; } // Unlink empty VirtualSpaceNodes and free it. void purge(ChunkManager* chunk_manager); diff -Nru openjdk-lts-11~28/src/hotspot/share/memory/metaspace.cpp openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace.cpp --- openjdk-lts-11~28/src/hotspot/share/memory/metaspace.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -863,6 +863,42 @@ #endif } +// Utils to check if a pointer or range is part of a committed metaspace region. +metaspace::VirtualSpaceNode* MetaspaceUtils::find_enclosing_virtual_space(const void* p) { + VirtualSpaceNode* vsn = Metaspace::space_list()->find_enclosing_space(p); + if (Metaspace::using_class_space() && vsn == NULL) { + vsn = Metaspace::class_space_list()->find_enclosing_space(p); + } + return vsn; +} + +bool MetaspaceUtils::is_in_committed(const void* p) { +#if INCLUDE_CDS + if (UseSharedSpaces) { + for (int idx = MetaspaceShared::ro; idx <= MetaspaceShared::mc; idx++) { + if (FileMapInfo::current_info()->is_in_shared_region(p, idx)) { + return true; + } + } + } +#endif + return find_enclosing_virtual_space(p) != NULL; +} + +bool MetaspaceUtils::is_range_in_committed(const void* from, const void* to) { +#if INCLUDE_CDS + if (UseSharedSpaces) { + for (int idx = MetaspaceShared::ro; idx <= MetaspaceShared::mc; idx++) { + if (FileMapInfo::current_info()->is_in_shared_region(from, idx)) { + return FileMapInfo::current_info()->is_in_shared_region(to, idx); + } + } + } +#endif + VirtualSpaceNode* vsn = find_enclosing_virtual_space(from); + return (vsn != NULL) && vsn->contains(to); +} + // Metaspace methods diff -Nru openjdk-lts-11~28/src/hotspot/share/memory/metaspace.hpp openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace.hpp --- openjdk-lts-11~28/src/hotspot/share/memory/metaspace.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/memory/metaspace.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -71,6 +71,7 @@ class PrintCLDMetaspaceInfoClosure; class SpaceManager; class VirtualSpaceList; + class VirtualSpaceNode; } // Metaspaces each have a SpaceManager and allocations @@ -297,6 +298,10 @@ // Spacemanager updates running counters. friend class metaspace::SpaceManager; + // Special access for error reporting (checks without locks). + friend class oopDesc; + friend class Klass; + // Running counters for statistics concerning in-use chunks. // Note: capacity = used + free + waste + overhead. Note that we do not // count free and waste. Their sum can be deduces from the three other values. @@ -324,6 +329,12 @@ // Helper for print_xx_report. static void print_vs(outputStream* out, size_t scale); + // Utils to check if a pointer or range is part of a committed metaspace region + // without acquiring any locks. + static metaspace::VirtualSpaceNode* find_enclosing_virtual_space(const void* p); + static bool is_in_committed(const void* p); + static bool is_range_in_committed(const void* from, const void* to); + public: // Collect used metaspace statistics. This involves walking the CLDG. The resulting diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/constantPool.cpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/constantPool.cpp --- openjdk-lts-11~28/src/hotspot/share/oops/constantPool.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/constantPool.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -498,10 +498,6 @@ } } - // Make this class loader depend upon the class loader owning the class reference - ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data(); - this_key->record_dependency(k); - // logging for class+resolve. if (log_is_enabled(Debug, class, resolve)){ trace_class_resolution(this_cp, k); diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/cpCache.cpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/cpCache.cpp --- openjdk-lts-11~28/src/hotspot/share/oops/cpCache.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/cpCache.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -252,11 +252,21 @@ if (byte_no == 1) { assert(invoke_code != Bytecodes::_invokevirtual && invoke_code != Bytecodes::_invokeinterface, ""); + bool do_resolve = true; // Don't mark invokespecial to method as resolved if sender is an interface. The receiver // has to be checked that it is a subclass of the current class every time this bytecode // is executed. - if (invoke_code != Bytecodes::_invokespecial || !sender_is_interface || - method->name() == vmSymbols::object_initializer_name()) { + if (invoke_code == Bytecodes::_invokespecial && sender_is_interface && + method->name() != vmSymbols::object_initializer_name()) { + do_resolve = false; + } + // Don't mark invokestatic to method as resolved if the holder class has not yet completed + // initialization. An invokestatic must only proceed if the class is initialized, but if + // we resolve it before then that class initialization check is skipped. + if (invoke_code == Bytecodes::_invokestatic && !method->method_holder()->is_initialized()) { + do_resolve = false; + } + if (do_resolve) { set_bytecode_1(invoke_code); } } else if (byte_no == 2) { diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/klass.cpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/klass.cpp --- openjdk-lts-11~28/src/hotspot/share/oops/klass.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/klass.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -735,6 +735,22 @@ guarantee(obj->klass()->is_klass(), "klass field is not a klass"); } +Klass* Klass::decode_klass_raw(narrowKlass narrow_klass) { + return (Klass*)(void*)( (uintptr_t)Universe::narrow_klass_base() + + ((uintptr_t)narrow_klass << Universe::narrow_klass_shift())); +} + +bool Klass::is_valid(Klass* k) { + if (!is_aligned(k, sizeof(MetaWord))) return false; + if ((size_t)k < os::min_page_size()) return false; + + if (!os::is_readable_range(k, k + 1)) return false; + if (!MetaspaceUtils::is_range_in_committed(k, k + 1)) return false; + + if (!Symbol::is_valid(k->name())) return false; + return ClassLoaderDataGraph::is_valid(k->class_loader_data()); +} + klassVtable Klass::vtable() const { return klassVtable(const_cast(this), start_of_vtable(), vtable_length() / vtableEntry::size()); } diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/klass.hpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/klass.hpp --- openjdk-lts-11~28/src/hotspot/share/oops/klass.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/klass.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -714,6 +714,10 @@ virtual void oop_verify_on(oop obj, outputStream* st); + // for error reporting + static Klass* decode_klass_raw(narrowKlass narrow_klass); + static bool is_valid(Klass* k); + static bool is_null(narrowKlass obj); static bool is_null(Klass* obj); diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/oop.cpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/oop.cpp --- openjdk-lts-11~28/src/hotspot/share/oops/oop.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/oop.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -170,6 +170,63 @@ return UseCompressedClassPointers; } +oop oopDesc::decode_oop_raw(narrowOop narrow_oop) { + return (oop)(void*)( (uintptr_t)Universe::narrow_oop_base() + + ((uintptr_t)narrow_oop << Universe::narrow_oop_shift())); +} + +void* oopDesc::load_klass_raw(oop obj) { + if (UseCompressedClassPointers) { + narrowKlass narrow_klass = *(obj->compressed_klass_addr()); + if (narrow_klass == 0) return NULL; + return (void*)Klass::decode_klass_raw(narrow_klass); + } else { + return *(void**)(obj->klass_addr()); + } +} + +void* oopDesc::load_oop_raw(oop obj, int offset) { + uintptr_t addr = (uintptr_t)(void*)obj + (uint)offset; + if (UseCompressedOops) { + narrowOop narrow_oop = *(narrowOop*)addr; + if (narrow_oop == 0) return NULL; + return (void*)decode_oop_raw(narrow_oop); + } else { + return *(void**)addr; + } +} + +bool oopDesc::is_valid(oop obj) { + if (!is_object_aligned(obj)) return false; + if ((size_t)(oopDesc*)obj < os::min_page_size()) return false; + + // We need at least the mark and the klass word in the committed region. + if (!os::is_readable_range(obj, (oopDesc*)obj + 1)) return false; + if (!Universe::heap()->is_in(obj)) return false; + + Klass* k = (Klass*)load_klass_raw(obj); + + if (!os::is_readable_range(k, k + 1)) return false; + return MetaspaceUtils::is_range_in_committed(k, k + 1); +} + +oop oopDesc::oop_or_null(address addr) { + if (is_valid(oop(addr))) { + // We were just given an oop directly. + return oop(addr); + } + + // Try to find addr using block_start. + HeapWord* p = Universe::heap()->block_start(addr); + if (p != NULL && Universe::heap()->block_is_obj(p)) { + if (!is_valid(oop(p))) return NULL; + return oop(p); + } + + // If we can't find it it just may mean that heap wasn't parsable. + return NULL; +} + oop oopDesc::obj_field_acquire(int offset) const { return HeapAccess::oop_load_at(as_oop(), offset); } void oopDesc::obj_field_put_raw(int offset, oop value) { RawAccess<>::oop_store_at(as_oop(), offset, value); } diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/oop.hpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/oop.hpp --- openjdk-lts-11~28/src/hotspot/share/oops/oop.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/oop.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -331,6 +331,13 @@ assert(has_klass_gap(), "only applicable to compressed klass pointers"); return klass_offset_in_bytes() + sizeof(narrowKlass); } + + // for error reporting + static oop decode_oop_raw(narrowOop narrow_oop); + static void* load_klass_raw(oop obj); + static void* load_oop_raw(oop obj, int offset); + static bool is_valid(oop obj); + static oop oop_or_null(address addr); }; #endif // SHARE_VM_OOPS_OOP_HPP diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/symbol.cpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/symbol.cpp --- openjdk-lts-11~28/src/hotspot/share/oops/symbol.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/symbol.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/classLoaderData.hpp" +#include "gc/shared/collectedHeap.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" @@ -264,5 +265,21 @@ } } +bool Symbol::is_valid(Symbol* s) { + if (!is_aligned(s, sizeof(MetaWord))) return false; + if ((size_t)s < os::min_page_size()) return false; + + if (!os::is_readable_range(s, s + 1)) return false; + + // Symbols are not allocated in Java heap. + if (Universe::heap()->is_in_reserved(s)) return false; + + int len = s->utf8_length(); + if (len < 0) return false; + + jbyte* bytes = (jbyte*) s->bytes(); + return os::is_readable_range(bytes, bytes + len); +} + // SymbolTable prints this in its statistics NOT_PRODUCT(int Symbol::_total_count = 0;) diff -Nru openjdk-lts-11~28/src/hotspot/share/oops/symbol.hpp openjdk-lts-11.0.2+9/src/hotspot/share/oops/symbol.hpp --- openjdk-lts-11~28/src/hotspot/share/oops/symbol.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/oops/symbol.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -244,6 +244,8 @@ void print() { print_on(tty); } void print_value() { print_value_on(tty); } + static bool is_valid(Symbol* s); + #ifndef PRODUCT // Empty constructor to create a dummy symbol object on stack // only for getting its vtable pointer. diff -Nru openjdk-lts-11~28/src/hotspot/share/opto/coalesce.cpp openjdk-lts-11.0.2+9/src/hotspot/share/opto/coalesce.cpp --- openjdk-lts-11~28/src/hotspot/share/opto/coalesce.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/opto/coalesce.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "opto/block.hpp" +#include "opto/c2compiler.hpp" #include "opto/cfgnode.hpp" #include "opto/chaitin.hpp" #include "opto/coalesce.hpp" @@ -294,9 +295,13 @@ } else { uint ireg = m->ideal_reg(); if (ireg == 0 || ireg == Op_RegFlags) { - assert(false, "attempted to spill a non-spillable item: %d: %s, ireg = %u, spill_type: %s", - m->_idx, m->Name(), ireg, MachSpillCopyNode::spill_type(MachSpillCopyNode::PhiInput)); - C->record_method_not_compilable("attempted to spill a non-spillable item"); + if (C->subsume_loads()) { + C->record_failure(C2Compiler::retry_no_subsuming_loads()); + } else { + assert(false, "attempted to spill a non-spillable item: %d: %s, ireg = %u, spill_type: %s", + m->_idx, m->Name(), ireg, MachSpillCopyNode::spill_type(MachSpillCopyNode::PhiInput)); + C->record_method_not_compilable("attempted to spill a non-spillable item"); + } return; } const RegMask *rm = C->matcher()->idealreg2spillmask[ireg]; diff -Nru openjdk-lts-11~28/src/hotspot/share/prims/jvm.cpp openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvm.cpp --- openjdk-lts-11~28/src/hotspot/share/prims/jvm.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvm.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -847,7 +847,6 @@ if (result != NULL) { oop mirror = JNIHandles::resolve_non_null(result); Klass* to_class = java_lang_Class::as_Klass(mirror); - ClassLoaderData::class_loader_data(h_loader())->record_dependency(to_class); } if (log_is_enabled(Debug, class, resolve) && result != NULL) { diff -Nru openjdk-lts-11~28/src/hotspot/share/prims/jvmtiEnv.cpp openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvmtiEnv.cpp --- openjdk-lts-11~28/src/hotspot/share/prims/jvmtiEnv.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvmtiEnv.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -925,7 +925,7 @@ thread_objs = NEW_RESOURCE_ARRAY(Handle, nthreads); NULL_CHECK(thread_objs, JVMTI_ERROR_OUT_OF_MEMORY); - for (int i=0; i < nthreads; i++) { + for (int i = 0; i < nthreads; i++) { thread_objs[i] = Handle(tle.get_threadObj(i)); } @@ -1150,16 +1150,14 @@ Handle context_class_loader; bool is_daemon; - { MutexLocker mu(Threads_lock); + name = Handle(current_thread, java_lang_Thread::name(thread_obj())); + priority = java_lang_Thread::priority(thread_obj()); + thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); + is_daemon = java_lang_Thread::is_daemon(thread_obj()); - name = Handle(current_thread, java_lang_Thread::name(thread_obj())); - priority = java_lang_Thread::priority(thread_obj()); - thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); - is_daemon = java_lang_Thread::is_daemon(thread_obj()); + oop loader = java_lang_Thread::context_class_loader(thread_obj()); + context_class_loader = Handle(current_thread, loader); - oop loader = java_lang_Thread::context_class_loader(thread_obj()); - context_class_loader = Handle(current_thread, loader); - } { const char *n; if (name() != NULL) { @@ -1408,13 +1406,10 @@ bool is_daemon; ThreadPriority max_priority; - { MutexLocker mu(Threads_lock); - - name = java_lang_ThreadGroup::name(group_obj()); - parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj())); - is_daemon = java_lang_ThreadGroup::is_daemon(group_obj()); - max_priority = java_lang_ThreadGroup::maxPriority(group_obj()); - } + name = java_lang_ThreadGroup::name(group_obj()); + parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj())); + is_daemon = java_lang_ThreadGroup::is_daemon(group_obj()); + max_priority = java_lang_ThreadGroup::maxPriority(group_obj()); info_ptr->is_daemon = is_daemon; info_ptr->max_priority = max_priority; @@ -1454,7 +1449,7 @@ Handle group_hdl(current_thread, group_obj); { // Cannot allow thread or group counts to change. - MutexLocker mu(Threads_lock); + ObjectLocker ol(group_hdl, current_thread); nthreads = java_lang_ThreadGroup::nthreads(group_hdl()); ngroups = java_lang_ThreadGroup::ngroups(group_hdl()); @@ -1464,7 +1459,7 @@ objArrayOop threads = java_lang_ThreadGroup::threads(group_hdl()); assert(nthreads <= threads->length(), "too many threads"); thread_objs = NEW_RESOURCE_ARRAY(Handle,nthreads); - for (int i=0, j=0; iobj_at(i); assert(thread_obj != NULL, "thread_obj is NULL"); JavaThread *java_thread = NULL; @@ -1496,15 +1491,14 @@ objArrayOop groups = java_lang_ThreadGroup::groups(group_hdl()); assert(ngroups <= groups->length(), "too many groups"); group_objs = NEW_RESOURCE_ARRAY(Handle,ngroups); - for (int i=0; iobj_at(i); assert(group_obj != NULL, "group_obj != NULL"); group_objs[i] = Handle(current_thread, group_obj); } } - } + } // ThreadGroup unlocked here - // have to make global handles outside of Threads_lock *group_count_ptr = ngroups; *thread_count_ptr = nthreads; *threads_ptr = new_jthreadArray(nthreads, thread_objs); @@ -3252,7 +3246,7 @@ // objects that are locked. int r; intptr_t recursion = rmonitor->recursions(); - for (intptr_t i=0; i <= recursion; i++) { + for (intptr_t i = 0; i <= recursion; i++) { r = rmonitor->raw_exit(thread); assert(r == ObjectMonitor::OM_OK, "raw_exit should have worked"); if (r != ObjectMonitor::OM_OK) { // robustness @@ -3682,7 +3676,7 @@ strcpy(*tmp_value, key); } else { // clean up previously allocated memory. - for (int j=0; j + + @@ -365,6 +367,10 @@ JVM Tool Interface + + Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + + The JVM Tool Interface () is a programming interface used by development and monitoring tools. diff -Nru openjdk-lts-11~28/src/hotspot/share/prims/jvmti.xsl openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvmti.xsl --- openjdk-lts-11~28/src/hotspot/share/prims/jvmti.xsl 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/prims/jvmti.xsl 2019-01-18 04:23:48.000000000 +0000 @@ -202,6 +202,7 @@

+ @@ -217,6 +218,12 @@ + +

+ +

+ +

diff -Nru openjdk-lts-11~28/src/hotspot/share/runtime/arguments.cpp openjdk-lts-11.0.2+9/src/hotspot/share/runtime/arguments.cpp --- openjdk-lts-11~28/src/hotspot/share/runtime/arguments.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/runtime/arguments.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -3849,6 +3849,10 @@ UNSUPPORTED_OPTION(UseLargePages); #endif +#if defined(AIX) + UNSUPPORTED_OPTION(AllocateHeapAt); +#endif + ArgumentsExt::report_unsupported_options(); #ifndef PRODUCT diff -Nru openjdk-lts-11~28/src/hotspot/share/runtime/os.cpp openjdk-lts-11.0.2+9/src/hotspot/share/runtime/os.cpp --- openjdk-lts-11~28/src/hotspot/share/runtime/os.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/runtime/os.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1010,6 +1010,15 @@ return (SafeFetch32(aligned, cafebabe) != cafebabe) || (SafeFetch32(aligned, deadbeef) != deadbeef); } +bool os::is_readable_range(const void* from, const void* to) { + for (address p = align_down((address)from, min_page_size()); p < to; p += min_page_size()) { + if (!is_readable_pointer(p)) { + return false; + } + } + return true; +} + // moved from debug.cpp (used to be find()) but still called from there // The verbose parameter is only set by the debug code in one case @@ -1020,99 +1029,48 @@ st->print_cr("0x0 is NULL"); return; } + + // Check if addr points into a code blob. CodeBlob* b = CodeCache::find_blob_unsafe(addr); if (b != NULL) { - if (b->is_buffer_blob()) { - // the interpreter is generated into a buffer blob - InterpreterCodelet* i = Interpreter::codelet_containing(addr); - if (i != NULL) { - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin())); - i->print_on(st); - return; - } - if (Interpreter::contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing into interpreter code" - " (not bytecode specific)", p2i(addr)); - return; - } - // - if (AdapterHandlerLibrary::contains(b)) { - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - b->code_begin())); - AdapterHandlerLibrary::print_handler_on(st, b); - } - // the stubroutines are generated into a buffer blob - StubCodeDesc* d = StubCodeDesc::desc_for(addr); - if (d != NULL) { - st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin())); - d->print_on(st); - st->cr(); - return; - } - if (StubRoutines::contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr)); - return; - } - // the InlineCacheBuffer is using stubs generated into a buffer blob - if (InlineCacheBuffer::contains(addr)) { - st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr)); - return; - } - VtableStub* v = VtableStubs::stub_containing(addr); - if (v != NULL) { - st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point())); - v->print_on(st); - st->cr(); - return; - } - } - nmethod* nm = b->as_nmethod_or_null(); - if (nm != NULL) { - ResourceMark rm; - st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT, - p2i(addr), (int)(addr - nm->entry_point()), p2i(nm)); - if (verbose) { - st->print(" for "); - nm->method()->print_value_on(st); - } - st->cr(); - nm->print_nmethod(verbose); - return; - } - st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - b->code_begin())); - b->print_on(st); + b->dump_for_addr(addr, st, verbose); return; } + // Check if addr points into Java heap. if (Universe::heap()->is_in(addr)) { - HeapWord* p = Universe::heap()->block_start(addr); - bool print = false; - // If we couldn't find it it just may mean that heap wasn't parsable - // See if we were just given an oop directly - if (p != NULL && Universe::heap()->block_is_obj(p)) { - print = true; - } else if (p == NULL && oopDesc::is_oop(oop(addr))) { - p = (HeapWord*) addr; - print = true; - } - if (print) { - if (p == (HeapWord*) addr) { - st->print_cr(INTPTR_FORMAT " is an oop", p2i(addr)); + oop o = oopDesc::oop_or_null(addr); + if (o != NULL) { + if ((HeapWord*)o == (HeapWord*)addr) { + st->print(INTPTR_FORMAT " is an oop: ", p2i(addr)); } else { - st->print_cr(INTPTR_FORMAT " is pointing into object: " INTPTR_FORMAT, p2i(addr), p2i(p)); + st->print(INTPTR_FORMAT " is pointing into object: " , p2i(addr)); } - oop(p)->print_on(st); + o->print_on(st); return; } - } else { - if (Universe::heap()->is_in_reserved(addr)) { - st->print_cr(INTPTR_FORMAT " is an unallocated location " - "in the heap", p2i(addr)); + } else if (Universe::heap()->is_in_reserved(addr)) { + st->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", p2i(addr)); + return; + } + + // Compressed oop needs to be decoded first. +#ifdef _LP64 + if (UseCompressedOops && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) { + narrowOop narrow_oop = (narrowOop)(uintptr_t)addr; + oop o = oopDesc::decode_oop_raw(narrow_oop); + + if (oopDesc::is_valid(o)) { + st->print(UINT32_FORMAT " is a compressed pointer to object: ", narrow_oop); + o->print_on(st); return; } } +#endif bool accessible = is_readable_pointer(addr); + // Check if addr is a JNI handle. if (align_down((intptr_t)addr, sizeof(intptr_t)) != 0 && accessible) { if (JNIHandles::is_global_handle((jobject) addr)) { st->print_cr(INTPTR_FORMAT " is a global jni handle", p2i(addr)); @@ -1131,6 +1089,7 @@ #endif } + // Check if addr belongs to a Java thread. for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { // Check for privilege stack if (thread->privileged_stack_top() != NULL && @@ -1159,9 +1118,12 @@ } } - // Check if in metaspace and print types that have vptrs (only method now) + // Check if in metaspace and print types that have vptrs if (Metaspace::contains(addr)) { - if (Method::has_method_vptr((const void*)addr)) { + if (Klass::is_valid((Klass*)addr)) { + st->print_cr(INTPTR_FORMAT " is a pointer to class: ", p2i(addr)); + ((Klass*)addr)->print_on(st); + } else if (((const Method*)addr)->is_valid_method()) { ((Method*)addr)->print_value_on(st); st->cr(); } else { @@ -1171,13 +1133,31 @@ return; } + // Compressed klass needs to be decoded first. +#ifdef _LP64 + if (UseCompressedClassPointers && ((uintptr_t)addr &~ (uintptr_t)max_juint) == 0) { + narrowKlass narrow_klass = (narrowKlass)(uintptr_t)addr; + Klass* k = Klass::decode_klass_raw(narrow_klass); + + if (Klass::is_valid(k)) { + st->print_cr(UINT32_FORMAT " is a compressed pointer to class: " INTPTR_FORMAT, narrow_klass, p2i((HeapWord*)k)); + k->print_on(st); + return; + } + } +#endif + // Try an OS specific find if (os::find(addr, st)) { return; } if (accessible) { - st->print_cr(INTPTR_FORMAT " points into unknown readable memory", p2i(addr)); + st->print(INTPTR_FORMAT " points into unknown readable memory:", p2i(addr)); + for (address p = addr; p < align_up(addr + 1, sizeof(intptr_t)); ++p) { + st->print(" %02x", *(u1*)p); + } + st->cr(); return; } diff -Nru openjdk-lts-11~28/src/hotspot/share/runtime/os.hpp openjdk-lts-11.0.2+9/src/hotspot/share/runtime/os.hpp --- openjdk-lts-11~28/src/hotspot/share/runtime/os.hpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/runtime/os.hpp 2019-01-18 04:23:48.000000000 +0000 @@ -302,6 +302,9 @@ return _page_sizes[0]; } + // Return a lower bound for page sizes. Also works before os::init completed. + static size_t min_page_size() { return 4 * K; } + // Methods for tracing page sizes returned by the above method. // The region_{min,max}_size parameters should be the values // passed to page_size_for_region() and page_size should be the result of that @@ -414,6 +417,7 @@ // Check if pointer points to readable memory (by 4-byte read access) static bool is_readable_pointer(const void* p); + static bool is_readable_range(const void* from, const void* to); // Routines used to serialize the thread state without using membars static void serialize_thread_states(); @@ -538,7 +542,7 @@ static char* do_you_want_to_debug(const char* message); // run cmd in a separate process and return its exit code; or -1 on failures - static int fork_and_exec(char *cmd); + static int fork_and_exec(char *cmd, bool use_vfork_if_available = false); // Call ::exit() on all platforms but Windows static void exit(int num); diff -Nru openjdk-lts-11~28/src/hotspot/share/runtime/sharedRuntime.cpp openjdk-lts-11.0.2+9/src/hotspot/share/runtime/sharedRuntime.cpp --- openjdk-lts-11~28/src/hotspot/share/runtime/sharedRuntime.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/runtime/sharedRuntime.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1299,6 +1299,14 @@ } #endif + // Do not patch call site for static call when the class is not + // fully initialized. + if (invoke_code == Bytecodes::_invokestatic && + !callee_method->method_holder()->is_initialized()) { + assert(callee_method->method_holder()->is_linked(), "must be"); + return callee_method; + } + // JSR 292 key invariant: // If the resolved method is a MethodHandle invoke target, the call // site must be a MethodHandle call site, because the lambda form might tail-call @@ -2135,17 +2143,19 @@ static int _max_size; // max. arg size seen static void add_method_to_histogram(nmethod* nm) { - Method* m = nm->method(); - ArgumentCount args(m->signature()); - int arity = args.size() + (m->is_static() ? 0 : 1); - int argsize = m->size_of_parameters(); - arity = MIN2(arity, MAX_ARITY-1); - argsize = MIN2(argsize, MAX_ARITY-1); - int count = nm->method()->compiled_invocation_count(); - _arity_histogram[arity] += count; - _size_histogram[argsize] += count; - _max_arity = MAX2(_max_arity, arity); - _max_size = MAX2(_max_size, argsize); + if (CompiledMethod::nmethod_access_is_safe(nm)) { + Method* method = nm->method(); + ArgumentCount args(method->signature()); + int arity = args.size() + (method->is_static() ? 0 : 1); + int argsize = method->size_of_parameters(); + arity = MIN2(arity, MAX_ARITY-1); + argsize = MIN2(argsize, MAX_ARITY-1); + int count = method->compiled_invocation_count(); + _arity_histogram[arity] += count; + _size_histogram[argsize] += count; + _max_arity = MAX2(_max_arity, arity); + _max_size = MAX2(_max_size, argsize); + } } void print_histogram_helper(int n, int* histo, const char* name) { diff -Nru openjdk-lts-11~28/src/hotspot/share/runtime/vm_version.cpp openjdk-lts-11.0.2+9/src/hotspot/share/runtime/vm_version.cpp --- openjdk-lts-11~28/src/hotspot/share/runtime/vm_version.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/runtime/vm_version.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -218,8 +218,16 @@ #define HOTSPOT_BUILD_COMPILER "MS VC++ 12.0 (VS2013)" #elif _MSC_VER == 1900 #define HOTSPOT_BUILD_COMPILER "MS VC++ 14.0 (VS2015)" + #elif _MSC_VER == 1911 + #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.3 (VS2017)" #elif _MSC_VER == 1912 #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.5 (VS2017)" + #elif _MSC_VER == 1913 + #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.6 (VS2017)" + #elif _MSC_VER == 1914 + #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.7 (VS2017)" + #elif _MSC_VER == 1915 + #define HOTSPOT_BUILD_COMPILER "MS VC++ 15.8 (VS2017)" #else #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER) #endif diff -Nru openjdk-lts-11~28/src/hotspot/share/utilities/vmError.cpp openjdk-lts-11.0.2+9/src/hotspot/share/utilities/vmError.cpp --- openjdk-lts-11~28/src/hotspot/share/utilities/vmError.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/hotspot/share/utilities/vmError.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -754,6 +754,24 @@ st->cr(); } + STEP("inspecting top of stack") + + // decode stack contents if possible + if (_verbose && _context && Universe::is_fully_initialized()) { + frame fr = os::fetch_frame_from_context(_context); + const int slots = 8; + const intptr_t *start = fr.sp(); + const intptr_t *end = start + slots; + if (is_aligned(start, sizeof(intptr_t)) && os::is_readable_range(start, end)) { + st->print_cr("Stack slot to memory mapping:"); + for (int i = 0; i < slots; ++i) { + st->print("stack at sp + %d slots: ", i); + os::print_location(st, *(start + i)); + } + } + st->cr(); + } + STEP("printing code blob if possible") if (_verbose && _context) { @@ -1581,7 +1599,7 @@ #endif tty->print_cr("\"%s\"...", cmd); - if (os::fork_and_exec(cmd) < 0) { + if (os::fork_and_exec(cmd, true) < 0) { tty->print_cr("os::fork_and_exec failed: %s (%s=%d)", os::strerror(errno), os::errno_name(errno), errno); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/CipherCore.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -253,11 +253,10 @@ return result; } - /** * Sets the padding mechanism of this cipher. * - * @param padding the padding mechanism + * @param paddingScheme the padding mechanism * * @exception NoSuchPaddingException if the requested padding mechanism * does not exist @@ -660,10 +659,7 @@ * (e.g., has not been initialized) */ byte[] update(byte[] input, int inputOffset, int inputLen) { - if (requireReinit) { - throw new IllegalStateException - ("Must use either different key or iv for GCM encryption"); - } + checkReinit(); byte[] output = null; try { @@ -673,7 +669,12 @@ if (len == output.length) { return output; } else { - return Arrays.copyOf(output, len); + byte[] copy = Arrays.copyOf(output, len); + if (decrypting) { + // Zero out internal buffer which is no longer required + Arrays.fill(output, (byte) 0x00); + } + return copy; } } catch (ShortBufferException e) { // should never happen @@ -706,10 +707,7 @@ */ int update(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException { - if (requireReinit) { - throw new IllegalStateException - ("Must use either different key or iv for GCM encryption"); - } + checkReinit(); // figure out how much can be sent to crypto function int len = Math.addExact(buffered, inputLen); @@ -767,11 +765,14 @@ inputLen -= temp; buffered = Math.addExact(buffered, temp); } - // process 'buffer' + // process 'buffer'. When finished we can null out 'buffer' + // Only necessary to null out if buffer holds data for encryption if (decrypting) { outLen = cipher.decrypt(buffer, 0, buffered, output, outputOffset); } else { outLen = cipher.encrypt(buffer, 0, buffered, output, outputOffset); + //encrypt mode. Zero out internal (input) buffer + Arrays.fill(buffer, (byte) 0x00); } outputOffset = Math.addExact(outputOffset, outLen); buffered = 0; @@ -841,12 +842,25 @@ */ byte[] doFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException { - byte[] output = null; try { - output = new byte[getOutputSizeByOperation(inputLen, true)]; - int len = doFinal(input, inputOffset, inputLen, output, 0); - if (len < output.length) { - return Arrays.copyOf(output, len); + checkReinit(); + byte[] output = new byte[getOutputSizeByOperation(inputLen, true)]; + byte[] finalBuf = prepareInputBuffer(input, inputOffset, + inputLen, output, 0); + int finalOffset = (finalBuf == input) ? inputOffset : 0; + int finalBufLen = (finalBuf == input) ? inputLen : finalBuf.length; + + int outLen = fillOutputBuffer(finalBuf, finalOffset, output, 0, + finalBufLen, input); + + endDoFinal(); + if (outLen < output.length) { + byte[] copy = Arrays.copyOf(output, outLen); + if (decrypting) { + // Zero out internal (ouput) array + Arrays.fill(output, (byte) 0x00); + } + return copy; } else { return output; } @@ -896,26 +910,81 @@ int outputOffset) throws IllegalBlockSizeException, ShortBufferException, BadPaddingException { - if (requireReinit) { - throw new IllegalStateException - ("Must use either different key or iv for GCM encryption"); - } + checkReinit(); int estOutSize = getOutputSizeByOperation(inputLen, true); - // check output buffer capacity. - // if we are decrypting with padding applied, we can perform this - // check only after we have determined how many padding bytes there - // are. - int outputCapacity = output.length - outputOffset; - int minOutSize = (decrypting? (estOutSize - blockSize):estOutSize); - if ((output == null) || (outputCapacity < minOutSize)) { - throw new ShortBufferException("Output buffer must be " - + "(at least) " + minOutSize + " bytes long"); + int outputCapacity = checkOutputCapacity(output, outputOffset, + estOutSize); + int offset = decrypting ? 0 : outputOffset; // 0 for decrypting + byte[] finalBuf = prepareInputBuffer(input, inputOffset, + inputLen, output, outputOffset); + byte[] outWithPadding = null; // for decrypting only + + int finalOffset = (finalBuf == input) ? inputOffset : 0; + int finalBufLen = (finalBuf == input) ? inputLen : finalBuf.length; + + if (decrypting) { + // if the size of specified output buffer is less than + // the length of the cipher text, then the current + // content of cipher has to be preserved in order for + // users to retry the call with a larger buffer in the + // case of ShortBufferException. + 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]; + } + byte[] outBuffer = decrypting ? outWithPadding : output; + + int outLen = fillOutputBuffer(finalBuf, finalOffset, outBuffer, + offset, finalBufLen, input); + + if (decrypting) { + + if (outputCapacity < outLen) { + // restore so users can retry with a larger buffer + cipher.restore(); + throw new ShortBufferException("Output buffer too short: " + + (outputCapacity) + + " bytes given, " + outLen + + " 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); + } + endDoFinal(); + return outLen; + } + + private void endDoFinal() { + buffered = 0; + diffBlocksize = blockSize; + if (cipherMode != ECB_MODE) { + cipher.reset(); + } + } + + private int unpad(int outLen, byte[] outWithPadding) + throws BadPaddingException { + int padStart = padding.unpad(outWithPadding, 0, 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; + } + private byte[] prepareInputBuffer(byte[] input, int inputOffset, + int inputLen, byte[] output, int outputOffset) + throws IllegalBlockSizeException, ShortBufferException { // calculate total input length int len = Math.addExact(buffered, inputLen); - // calculate padding length int totalLen = Math.addExact(len, cipher.getBufferedLength()); int paddingLen = 0; @@ -945,82 +1014,80 @@ * - there are internally buffered bytes * - doing encryption and padding is needed */ - byte[] finalBuf = input; - int finalOffset = inputOffset; - int finalBufLen = inputLen; if ((buffered != 0) || (!decrypting && padding != null) || ((input == output) && (outputOffset - inputOffset < inputLen) && (inputOffset - outputOffset < buffer.length))) { + byte[] finalBuf; if (decrypting || padding == null) { paddingLen = 0; } finalBuf = new byte[Math.addExact(len, paddingLen)]; - finalOffset = 0; if (buffered != 0) { System.arraycopy(buffer, 0, finalBuf, 0, buffered); + if (!decrypting) { + // done with input buffer. We should zero out the + // data if we're in encrypt mode. + Arrays.fill(buffer, (byte) 0x00); + } } if (inputLen != 0) { System.arraycopy(input, inputOffset, finalBuf, - buffered, inputLen); + buffered, inputLen); } if (paddingLen != 0) { padding.padWithLen(finalBuf, Math.addExact(buffered, inputLen), paddingLen); } - finalBufLen = finalBuf.length; + return finalBuf; } - int outLen = 0; - if (decrypting) { - // if the size of specified output buffer is less than - // the length of the cipher text, then the current - // content of cipher has to be preserved in order for - // users to retry the call with a larger buffer in the - // case of ShortBufferException. - if (outputCapacity < estOutSize) { - cipher.save(); - } - // create temporary output buffer so that only "real" - // data bytes are passed to user's output buffer. - byte[] outWithPadding = new byte[estOutSize]; - outLen = finalNoPadding(finalBuf, finalOffset, outWithPadding, - 0, finalBufLen); - - if (padding != null) { - int padStart = padding.unpad(outWithPadding, 0, 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 input; + } - if (outputCapacity < outLen) { - // restore so users can retry with a larger buffer - cipher.restore(); - throw new ShortBufferException("Output buffer too short: " - + (outputCapacity) - + " bytes given, " + outLen - + " bytes needed"); - } - // copy the result into user-supplied output buffer - System.arraycopy(outWithPadding, 0, output, outputOffset, outLen); - } else { // encrypting - try { - outLen = finalNoPadding(finalBuf, finalOffset, output, - outputOffset, finalBufLen); - } finally { + private int fillOutputBuffer(byte[] finalBuf, int finalOffset, + byte[] output, int outOfs, int finalBufLen, + byte[] input) + throws ShortBufferException, BadPaddingException, + IllegalBlockSizeException { + int len; + try { + len = finalNoPadding(finalBuf, finalOffset, output, + outOfs, finalBufLen); + if (decrypting && padding != null) { + len = unpad(len, output); + } + return len; + } finally { + if (!decrypting) { // reset after doFinal() for GCM encryption requireReinit = (cipherMode == GCM_MODE); + if (finalBuf != input) { + // done with internal finalBuf array. Copied to output + Arrays.fill(finalBuf, (byte) 0x00); + } } } + } - buffered = 0; - diffBlocksize = blockSize; - if (cipherMode != ECB_MODE) { - cipher.reset(); + private int checkOutputCapacity(byte[] output, int outputOffset, + int estOutSize) throws ShortBufferException { + // check output buffer capacity. + // if we are decrypting with padding applied, we can perform this + // check only after we have determined how many padding bytes there + // are. + int outputCapacity = output.length - outputOffset; + int minOutSize = decrypting ? (estOutSize - blockSize) : estOutSize; + if ((output == null) || (outputCapacity < minOutSize)) { + throw new ShortBufferException("Output buffer must be " + + "(at least) " + minOutSize + " bytes long"); + } + return outputCapacity; + } + + private void checkReinit() { + if (requireReinit) { + throw new IllegalStateException + ("Must use either different key or iv for GCM encryption"); } - return outLen; } private int finalNoPadding(byte[] in, int inOfs, byte[] out, int outOfs, @@ -1153,10 +1220,7 @@ * @since 1.8 */ void updateAAD(byte[] src, int offset, int len) { - if (requireReinit) { - throw new IllegalStateException - ("Must use either different key or iv for GCM encryption"); - } + checkReinit(); cipher.updateAAD(src, offset, len); } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/HmacPKCS12PBESHA1.java 2019-01-18 04:23:48.000000000 +0000 @@ -73,62 +73,69 @@ salt = pbeKey.getSalt(); // maybe null if unspecified iCount = pbeKey.getIterationCount(); // maybe 0 if unspecified } else if (key instanceof SecretKey) { - byte[] passwdBytes = key.getEncoded(); - if ((passwdBytes == null) || - !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { + byte[] passwdBytes; + if (!(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3)) || + (passwdBytes = key.getEncoded()) == null) { throw new InvalidKeyException("Missing password"); } passwdChars = new char[passwdBytes.length]; for (int i=0; iprotectedKey. If the two digest values are // different, throw an exception. md.update(passwdBytes); - java.util.Arrays.fill(passwdBytes, (byte)0x00); + Arrays.fill(passwdBytes, (byte)0x00); passwdBytes = null; md.update(plainKey); digest = md.digest(); @@ -291,17 +306,21 @@ // create PBE key from password PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password); - SecretKey sKey = new PBEKey(pbeKeySpec, "PBEWithMD5AndTripleDES"); - pbeKeySpec.clearPassword(); - - // seal key + SecretKey sKey = null; Cipher cipher; + try { + sKey = new PBEKey(pbeKeySpec, "PBEWithMD5AndTripleDES", false); + pbeKeySpec.clearPassword(); - PBEWithMD5AndTripleDESCipher cipherSpi; - cipherSpi = new PBEWithMD5AndTripleDESCipher(); - cipher = new CipherForKeyProtector(cipherSpi, SunJCE.getInstance(), - "PBEWithMD5AndTripleDES"); - cipher.init(Cipher.ENCRYPT_MODE, sKey, pbeSpec); + // seal key + PBEWithMD5AndTripleDESCipher cipherSpi; + cipherSpi = new PBEWithMD5AndTripleDESCipher(); + cipher = new CipherForKeyProtector(cipherSpi, SunJCE.getInstance(), + "PBEWithMD5AndTripleDES"); + cipher.init(Cipher.ENCRYPT_MODE, sKey, pbeSpec); + } finally { + if (sKey != null) sKey.destroy(); + } return new SealedObjectForKeyProtector(key, cipher); } @@ -309,12 +328,13 @@ * Unseals the sealed key. */ Key unseal(SealedObject so) - throws NoSuchAlgorithmException, UnrecoverableKeyException - { + throws NoSuchAlgorithmException, UnrecoverableKeyException { + SecretKey sKey = null; try { // create PBE key from password PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password); - SecretKey skey = new PBEKey(pbeKeySpec, "PBEWithMD5AndTripleDES"); + sKey = new PBEKey(pbeKeySpec, + "PBEWithMD5AndTripleDES", false); pbeKeySpec.clearPassword(); SealedObjectForKeyProtector soForKeyProtector = null; @@ -342,7 +362,7 @@ Cipher cipher = new CipherForKeyProtector(cipherSpi, SunJCE.getInstance(), "PBEWithMD5AndTripleDES"); - cipher.init(Cipher.DECRYPT_MODE, skey, params); + cipher.init(Cipher.DECRYPT_MODE, sKey, params); return soForKeyProtector.getKey(cipher); } catch (NoSuchAlgorithmException ex) { // Note: this catch needed to be here because of the @@ -354,6 +374,14 @@ throw new UnrecoverableKeyException(cnfe.getMessage()); } catch (GeneralSecurityException gse) { throw new UnrecoverableKeyException(gse.getMessage()); + } finally { + if (sKey != null) { + try { + sKey.destroy(); + } catch (DestroyFailedException e) { + //shouldn't happen + } + } } } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBEKeyFactory.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBEKeyFactory.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBEKeyFactory.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBEKeyFactory.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -216,7 +216,7 @@ if (!(keySpec instanceof PBEKeySpec)) { throw new InvalidKeySpecException("Invalid key spec"); } - return new PBEKey((PBEKeySpec)keySpec, type); + return new PBEKey((PBEKeySpec)keySpec, type, true); } /** diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBEKey.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -29,6 +29,7 @@ import java.security.MessageDigest; import java.security.KeyRep; import java.security.spec.InvalidKeySpecException; +import java.util.Arrays; import java.util.Locale; import javax.crypto.SecretKey; import javax.crypto.spec.PBEKeySpec; @@ -54,7 +55,8 @@ * * @param keytype the given PBE key specification */ - PBEKey(PBEKeySpec keySpec, String keytype) throws InvalidKeySpecException { + PBEKey(PBEKeySpec keySpec, String keytype, boolean useCleaner) + throws InvalidKeySpecException { char[] passwd = keySpec.getPassword(); if (passwd == null) { // Should allow an empty password. @@ -71,13 +73,15 @@ this.key = new byte[passwd.length]; for (int i=0; i java.util.Arrays.fill(k, (byte)0x00)); + if (useCleaner) { + final byte[] k = this.key; + CleanerFactory.cleaner().register(this, + () -> Arrays.fill(k, (byte) 0x00)); + } } public byte[] getEncoded() { @@ -122,11 +126,23 @@ byte[] thatEncoded = that.getEncoded(); boolean ret = MessageDigest.isEqual(this.key, thatEncoded); - java.util.Arrays.fill(thatEncoded, (byte)0x00); + Arrays.fill(thatEncoded, (byte)0x00); return ret; } /** + * Clears the internal copy of the key. + * + */ + @Override + public void destroy() { + if (key != null) { + Arrays.fill(key, (byte) 0x00); + key = null; + } + } + + /** * readObject is called to restore the state of this key from * a stream. */ diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBES1Core.java 2019-01-18 04:23:48.000000000 +0000 @@ -27,6 +27,7 @@ import java.security.*; import java.security.spec.*; +import java.util.Arrays; import javax.crypto.*; import javax.crypto.spec.*; @@ -213,35 +214,43 @@ throw new InvalidAlgorithmParameterException("Parameters " + "missing"); } - if ((key == null) || - (key.getEncoded() == null) || - !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { - throw new InvalidKeyException("Missing password"); + if (key == null) { + throw new InvalidKeyException("Null key"); } - if (params == null) { - // create random salt and use default iteration count - salt = new byte[8]; - random.nextBytes(salt); - } else { - if (!(params instanceof PBEParameterSpec)) { - throw new InvalidAlgorithmParameterException - ("Wrong parameter type: PBE expected"); - } - salt = ((PBEParameterSpec) params).getSalt(); - // salt must be 8 bytes long (by definition) - if (salt.length != 8) { - throw new InvalidAlgorithmParameterException - ("Salt must be 8 bytes long"); + byte[] derivedKey; + byte[] passwdBytes = key.getEncoded(); + try { + if ((passwdBytes == null) || + !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { + throw new InvalidKeyException("Missing password"); } - iCount = ((PBEParameterSpec) params).getIterationCount(); - if (iCount <= 0) { - throw new InvalidAlgorithmParameterException - ("IterationCount must be a positive number"); + + if (params == null) { + // create random salt and use default iteration count + salt = new byte[8]; + random.nextBytes(salt); + } else { + if (!(params instanceof PBEParameterSpec)) { + throw new InvalidAlgorithmParameterException + ("Wrong parameter type: PBE expected"); + } + salt = ((PBEParameterSpec) params).getSalt(); + // salt must be 8 bytes long (by definition) + if (salt.length != 8) { + throw new InvalidAlgorithmParameterException + ("Salt must be 8 bytes long"); + } + iCount = ((PBEParameterSpec) params).getIterationCount(); + if (iCount <= 0) { + throw new InvalidAlgorithmParameterException + ("IterationCount must be a positive number"); + } } + derivedKey = deriveCipherKey(passwdBytes); + } finally { + if (passwdBytes != null) Arrays.fill(passwdBytes, (byte) 0x00); } - - byte[] derivedKey = deriveCipherKey(key); // use all but the last 8 bytes as the key value SecretKeySpec cipherKey = new SecretKeySpec(derivedKey, 0, derivedKey.length-8, algo); @@ -253,16 +262,14 @@ cipher.init(opmode, cipherKey, ivSpec, random); } - private byte[] deriveCipherKey(Key key) { + private byte[] deriveCipherKey(byte[] passwdBytes) { byte[] result = null; - byte[] passwdBytes = key.getEncoded(); if (algo.equals("DES")) { // P || S (password concatenated with salt) byte[] concat = new byte[Math.addExact(passwdBytes.length, salt.length)]; System.arraycopy(passwdBytes, 0, concat, 0, passwdBytes.length); - java.util.Arrays.fill(passwdBytes, (byte)0x00); System.arraycopy(salt, 0, concat, passwdBytes.length, salt.length); // digest P || S with c iterations @@ -271,7 +278,7 @@ md.update(toBeHashed); toBeHashed = md.digest(); // this resets the digest } - java.util.Arrays.fill(concat, (byte)0x00); + Arrays.fill(concat, (byte)0x00); result = toBeHashed; } else if (algo.equals("DESede")) { // if the 2 salt halves are the same, invert one of them @@ -294,8 +301,6 @@ // Concatenate the output from each digest round with the // password, and use the result as the input to the next digest // operation. - byte[] kBytes = null; - IvParameterSpec iv = null; byte[] toBeHashed = null; result = new byte[DESedeKeySpec.DES_EDE_KEY_LEN + DESConstants.DES_BLOCK_SIZE]; @@ -306,12 +311,14 @@ for (int j=0; j < iCount; j++) { md.update(toBeHashed); md.update(passwdBytes); - toBeHashed = md.digest(); // this resets the digest + toBeHashed = md.digest(); } System.arraycopy(toBeHashed, 0, result, i*16, toBeHashed.length); } } + // clear data used in message + md.reset(); return result; } @@ -478,9 +485,9 @@ byte[] wrap(Key key) throws IllegalBlockSizeException, InvalidKeyException { byte[] result = null; - + byte[] encodedKey = null; try { - byte[] encodedKey = key.getEncoded(); + encodedKey = key.getEncoded(); if ((encodedKey == null) || (encodedKey.length == 0)) { throw new InvalidKeyException("Cannot get an encoding of " + "the key to be wrapped"); @@ -489,6 +496,8 @@ result = doFinal(encodedKey, 0, encodedKey.length); } catch (BadPaddingException e) { // Should never happen + } finally { + if (encodedKey != null) Arrays.fill(encodedKey, (byte)0x00); } return result; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java 2019-01-18 04:23:48.000000000 +0000 @@ -27,6 +27,7 @@ import java.security.*; import java.security.spec.*; +import java.util.Arrays; import javax.crypto.*; import javax.crypto.spec.*; @@ -173,101 +174,105 @@ SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { - if ((key == null) || - (key.getEncoded() == null) || - !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { - throw new InvalidKeyException("Missing password"); + if (key == null) { + throw new InvalidKeyException("Null key"); } - // TBD: consolidate the salt, ic and IV parameter checks below - - // Extract salt and iteration count from the key, if present - if (key instanceof javax.crypto.interfaces.PBEKey) { - salt = ((javax.crypto.interfaces.PBEKey)key).getSalt(); - if (salt != null && salt.length < 8) { - throw new InvalidAlgorithmParameterException( - "Salt must be at least 8 bytes long"); - } - iCount = ((javax.crypto.interfaces.PBEKey)key).getIterationCount(); - if (iCount == 0) { - iCount = DEFAULT_COUNT; - } else if (iCount < 0) { - throw new InvalidAlgorithmParameterException( - "Iteration count must be a positive number"); + byte[] passwdBytes = key.getEncoded(); + char[] passwdChars = null; + PBEKeySpec pbeSpec; + try { + if ((passwdBytes == null) || + !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { + throw new InvalidKeyException("Missing password"); } - } - // Extract salt, iteration count and IV from the params, if present - if (params == null) { - if (salt == null) { - // generate random salt and use default iteration count - salt = new byte[DEFAULT_SALT_LENGTH]; - random.nextBytes(salt); - iCount = DEFAULT_COUNT; + // TBD: consolidate the salt, ic and IV parameter checks below + + // Extract salt and iteration count from the key, if present + if (key instanceof javax.crypto.interfaces.PBEKey) { + salt = ((javax.crypto.interfaces.PBEKey)key).getSalt(); + if (salt != null && salt.length < 8) { + throw new InvalidAlgorithmParameterException( + "Salt must be at least 8 bytes long"); + } + iCount = ((javax.crypto.interfaces.PBEKey)key).getIterationCount(); + if (iCount == 0) { + iCount = DEFAULT_COUNT; + } else if (iCount < 0) { + throw new InvalidAlgorithmParameterException( + "Iteration count must be a positive number"); + } } - if ((opmode == Cipher.ENCRYPT_MODE) || + + // Extract salt, iteration count and IV from the params, if present + if (params == null) { + if (salt == null) { + // generate random salt and use default iteration count + salt = new byte[DEFAULT_SALT_LENGTH]; + random.nextBytes(salt); + iCount = DEFAULT_COUNT; + } + if ((opmode == Cipher.ENCRYPT_MODE) || (opmode == Cipher.WRAP_MODE)) { - // generate random IV - byte[] ivBytes = new byte[blkSize]; - random.nextBytes(ivBytes); - ivSpec = new IvParameterSpec(ivBytes); - } - } else { - if (!(params instanceof PBEParameterSpec)) { - throw new InvalidAlgorithmParameterException - ("Wrong parameter type: PBE expected"); - } - // salt and iteration count from the params take precedence - byte[] specSalt = ((PBEParameterSpec) params).getSalt(); - if (specSalt != null && specSalt.length < 8) { - throw new InvalidAlgorithmParameterException( - "Salt must be at least 8 bytes long"); - } - salt = specSalt; - int specICount = ((PBEParameterSpec) params).getIterationCount(); - if (specICount == 0) { - specICount = DEFAULT_COUNT; - } else if (specICount < 0) { - throw new InvalidAlgorithmParameterException( - "Iteration count must be a positive number"); - } - iCount = specICount; + // generate random IV + byte[] ivBytes = new byte[blkSize]; + random.nextBytes(ivBytes); + ivSpec = new IvParameterSpec(ivBytes); + } + } else { + if (!(params instanceof PBEParameterSpec)) { + throw new InvalidAlgorithmParameterException + ("Wrong parameter type: PBE expected"); + } + // salt and iteration count from the params take precedence + byte[] specSalt = ((PBEParameterSpec) params).getSalt(); + if (specSalt != null && specSalt.length < 8) { + throw new InvalidAlgorithmParameterException( + "Salt must be at least 8 bytes long"); + } + salt = specSalt; + int specICount = ((PBEParameterSpec) params).getIterationCount(); + if (specICount == 0) { + specICount = DEFAULT_COUNT; + } else if (specICount < 0) { + throw new InvalidAlgorithmParameterException( + "Iteration count must be a positive number"); + } + iCount = specICount; - AlgorithmParameterSpec specParams = - ((PBEParameterSpec) params).getParameterSpec(); - if (specParams != null) { - if (specParams instanceof IvParameterSpec) { - ivSpec = (IvParameterSpec)specParams; + AlgorithmParameterSpec specParams = + ((PBEParameterSpec) params).getParameterSpec(); + if (specParams != null) { + if (specParams instanceof IvParameterSpec) { + ivSpec = (IvParameterSpec)specParams; + } else { + throw new InvalidAlgorithmParameterException( + "Wrong parameter type: IV expected"); + } + } else if ((opmode == Cipher.ENCRYPT_MODE) || + (opmode == Cipher.WRAP_MODE)) { + // generate random IV + byte[] ivBytes = new byte[blkSize]; + random.nextBytes(ivBytes); + ivSpec = new IvParameterSpec(ivBytes); } else { throw new InvalidAlgorithmParameterException( - "Wrong parameter type: IV expected"); + "Missing parameter type: IV expected"); } - } else if ((opmode == Cipher.ENCRYPT_MODE) || - (opmode == Cipher.WRAP_MODE)) { - // generate random IV - byte[] ivBytes = new byte[blkSize]; - random.nextBytes(ivBytes); - ivSpec = new IvParameterSpec(ivBytes); - } else { - throw new InvalidAlgorithmParameterException( - "Missing parameter type: IV expected"); } - } - SecretKeySpec cipherKey = null; - byte[] derivedKey = null; - byte[] passwdBytes = key.getEncoded(); - char[] passwdChars = new char[passwdBytes.length]; - - for (int i=0; i { - java.util.Arrays.fill(k, (byte)0x00); - java.util.Arrays.fill(p, '0'); - }); + // Use the cleaner to zero the key when no longer referenced + final byte[] k = this.key; + final char[] p = this.passwd; + CleanerFactory.cleaner().register(this, + () -> { + Arrays.fill(k, (byte) 0x00); + Arrays.fill(p, '\0'); + }); + } } private static byte[] deriveKey(final Mac prf, final byte[] password, @@ -266,8 +270,8 @@ if (!(that.getFormat().equalsIgnoreCase("RAW"))) return false; byte[] thatEncoded = that.getEncoded(); - boolean ret = MessageDigest.isEqual(key, that.getEncoded()); - java.util.Arrays.fill(thatEncoded, (byte)0x00); + boolean ret = MessageDigest.isEqual(key, thatEncoded); + Arrays.fill(thatEncoded, (byte)0x00); return ret; } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Core.java openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Core.java --- openjdk-lts-11~28/src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Core.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/com/sun/crypto/provider/PBMAC1Core.java 2019-01-18 04:23:48.000000000 +0000 @@ -108,72 +108,76 @@ salt = pbeKey.getSalt(); // maybe null if unspecified iCount = pbeKey.getIterationCount(); // maybe 0 if unspecified } else if (key instanceof SecretKey) { - byte[] passwdBytes = key.getEncoded(); - if ((passwdBytes == null) || - !(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3))) { + byte[] passwdBytes; + if (!(key.getAlgorithm().regionMatches(true, 0, "PBE", 0, 3)) || + (passwdBytes = key.getEncoded()) == null) { throw new InvalidKeyException("Missing password"); } passwdChars = new char[passwdBytes.length]; for (int i=0; i in.length || offset < 0) - throw new NumberFormatException("Bad offset or len arguments for char[] input."); + // protect against huge length, negative values, and integer overflow + try { + Objects.checkFromIndexSize(offset, len, in.length); + } catch (IndexOutOfBoundsException e) { + throw new NumberFormatException + ("Bad offset or len arguments for char[] input."); + } + // This is the primary string to BigDecimal constructor; all // incoming strings end up here; it uses explicit (inline) // parsing for speed and generates at most one intermediate diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/math/BigInteger.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/math/BigInteger.java --- openjdk-lts-11~28/src/java.base/share/classes/java/math/BigInteger.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/math/BigInteger.java 2019-01-18 04:23:48.000000000 +0000 @@ -306,10 +306,8 @@ public BigInteger(byte[] val, int off, int len) { if (val.length == 0) { throw new NumberFormatException("Zero length BigInteger"); - } else if ((off < 0) || (off >= val.length) || (len < 0) || - (len > val.length - off)) { // 0 <= off < val.length - throw new IndexOutOfBoundsException(); } + Objects.checkFromIndexSize(off, len, val.length); if (val[off] < 0) { mag = makePositive(val, off, len); @@ -394,12 +392,8 @@ public BigInteger(int signum, byte[] magnitude, int off, int len) { if (signum < -1 || signum > 1) { throw(new NumberFormatException("Invalid signum value")); - } else if ((off < 0) || (len < 0) || - (len > 0 && - ((off >= magnitude.length) || - (len > magnitude.length - off)))) { // 0 <= off < magnitude.length - throw new IndexOutOfBoundsException(); } + Objects.checkFromIndexSize(off, len, magnitude.length); // stripLeadingZeroBytes() returns a zero length array if len == 0 this.mag = stripLeadingZeroBytes(magnitude, off, len); @@ -1236,6 +1230,14 @@ private static final double LOG_TWO = Math.log(2.0); static { + assert 0 < KARATSUBA_THRESHOLD + && KARATSUBA_THRESHOLD < TOOM_COOK_THRESHOLD + && TOOM_COOK_THRESHOLD < Integer.MAX_VALUE + && 0 < KARATSUBA_SQUARE_THRESHOLD + && KARATSUBA_SQUARE_THRESHOLD < TOOM_COOK_SQUARE_THRESHOLD + && TOOM_COOK_SQUARE_THRESHOLD < Integer.MAX_VALUE : + "Algorithm thresholds are inconsistent"; + for (int i = 1; i <= MAX_CONSTANT; i++) { int[] magnitude = new int[1]; magnitude[0] = i; @@ -1559,6 +1561,18 @@ * @return {@code this * val} */ public BigInteger multiply(BigInteger val) { + return multiply(val, false); + } + + /** + * Returns a BigInteger whose value is {@code (this * val)}. If + * the invocation is recursive certain overflow checks are skipped. + * + * @param val value to be multiplied by this BigInteger. + * @param isRecursion whether this is a recursive invocation + * @return {@code this * val} + */ + private BigInteger multiply(BigInteger val, boolean isRecursion) { if (val.signum == 0 || signum == 0) return ZERO; @@ -1586,6 +1600,63 @@ if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD)) { return multiplyKaratsuba(this, val); } else { + // + // In "Hacker's Delight" section 2-13, p.33, it is explained + // that if x and y are unsigned 32-bit quantities and m and n + // are their respective numbers of leading zeros within 32 bits, + // then the number of leading zeros within their product as a + // 64-bit unsigned quantity is either m + n or m + n + 1. If + // their product is not to overflow, it cannot exceed 32 bits, + // and so the number of leading zeros of the product within 64 + // bits must be at least 32, i.e., the leftmost set bit is at + // zero-relative position 31 or less. + // + // From the above there are three cases: + // + // m + n leftmost set bit condition + // ----- ---------------- --------- + // >= 32 x <= 64 - 32 = 32 no overflow + // == 31 x >= 64 - 32 = 32 possible overflow + // <= 30 x >= 64 - 31 = 33 definite overflow + // + // The "possible overflow" condition cannot be detected by + // examning data lengths alone and requires further calculation. + // + // By analogy, if 'this' and 'val' have m and n as their + // respective numbers of leading zeros within 32*MAX_MAG_LENGTH + // bits, then: + // + // m + n >= 32*MAX_MAG_LENGTH no overflow + // m + n == 32*MAX_MAG_LENGTH - 1 possible overflow + // m + n <= 32*MAX_MAG_LENGTH - 2 definite overflow + // + // Note however that if the number of ints in the result + // were to be MAX_MAG_LENGTH and mag[0] < 0, then there would + // be overflow. As a result the leftmost bit (of mag[0]) cannot + // be used and the constraints must be adjusted by one bit to: + // + // m + n > 32*MAX_MAG_LENGTH no overflow + // m + n == 32*MAX_MAG_LENGTH possible overflow + // m + n < 32*MAX_MAG_LENGTH definite overflow + // + // The foregoing leading zero-based discussion is for clarity + // only. The actual calculations use the estimated bit length + // of the product as this is more natural to the internal + // array representation of the magnitude which has no leading + // zero elements. + // + if (!isRecursion) { + // The bitLength() instance method is not used here as we + // are only considering the magnitudes as non-negative. The + // Toom-Cook multiplication algorithm determines the sign + // at its end from the two signum values. + if (bitLength(mag, mag.length) + + bitLength(val.mag, val.mag.length) > + 32L*MAX_MAG_LENGTH) { + reportOverflow(); + } + } + return multiplyToomCook3(this, val); } } @@ -1671,7 +1742,7 @@ int ystart = ylen - 1; if (z == null || z.length < (xlen+ ylen)) - z = new int[xlen+ylen]; + z = new int[xlen+ylen]; long carry = 0; for (int j=ystart, k=ystart+1+xstart; j >= 0; j--, k--) { @@ -1805,16 +1876,16 @@ BigInteger v0, v1, v2, vm1, vinf, t1, t2, tm1, da1, db1; - v0 = a0.multiply(b0); + v0 = a0.multiply(b0, true); da1 = a2.add(a0); db1 = b2.add(b0); - vm1 = da1.subtract(a1).multiply(db1.subtract(b1)); + vm1 = da1.subtract(a1).multiply(db1.subtract(b1), true); da1 = da1.add(a1); db1 = db1.add(b1); - v1 = da1.multiply(db1); + v1 = da1.multiply(db1, true); v2 = da1.add(a2).shiftLeft(1).subtract(a0).multiply( - db1.add(b2).shiftLeft(1).subtract(b0)); - vinf = a2.multiply(b2); + db1.add(b2).shiftLeft(1).subtract(b0), true); + vinf = a2.multiply(b2, true); // The algorithm requires two divisions by 2 and one by 3. // All divisions are known to be exact, that is, they do not produce @@ -1980,6 +2051,17 @@ * @return {@code this2} */ private BigInteger square() { + return square(false); + } + + /** + * Returns a BigInteger whose value is {@code (this2)}. If + * the invocation is recursive certain overflow checks are skipped. + * + * @param isRecursion whether this is a recursive invocation + * @return {@code this2} + */ + private BigInteger square(boolean isRecursion) { if (signum == 0) { return ZERO; } @@ -1992,6 +2074,15 @@ if (len < TOOM_COOK_SQUARE_THRESHOLD) { return squareKaratsuba(); } else { + // + // For a discussion of overflow detection see multiply() + // + if (!isRecursion) { + if (bitLength(mag, mag.length) > 16L*MAX_MAG_LENGTH) { + reportOverflow(); + } + } + return squareToomCook3(); } } @@ -2143,13 +2234,13 @@ a0 = getToomSlice(k, r, 2, len); BigInteger v0, v1, v2, vm1, vinf, t1, t2, tm1, da1; - v0 = a0.square(); + v0 = a0.square(true); da1 = a2.add(a0); - vm1 = da1.subtract(a1).square(); + vm1 = da1.subtract(a1).square(true); da1 = da1.add(a1); - v1 = da1.square(); - vinf = a2.square(); - v2 = da1.add(a2).shiftLeft(1).subtract(a0).square(); + v1 = da1.square(true); + vinf = a2.square(true); + v2 = da1.add(a2).shiftLeft(1).subtract(a0).square(true); // The algorithm requires two divisions by 2 and one by 3. // All divisions are known to be exact, that is, they do not produce @@ -2320,10 +2411,11 @@ // The remaining part can then be exponentiated faster. The // powers of two will be multiplied back at the end. int powersOfTwo = partToSquare.getLowestSetBit(); - long bitsToShift = (long)powersOfTwo * exponent; - if (bitsToShift > Integer.MAX_VALUE) { + long bitsToShiftLong = (long)powersOfTwo * exponent; + if (bitsToShiftLong > Integer.MAX_VALUE) { reportOverflow(); } + int bitsToShift = (int)bitsToShiftLong; int remainingBits; @@ -2333,9 +2425,9 @@ remainingBits = partToSquare.bitLength(); if (remainingBits == 1) { // Nothing left but +/- 1? if (signum < 0 && (exponent&1) == 1) { - return NEGATIVE_ONE.shiftLeft(powersOfTwo*exponent); + return NEGATIVE_ONE.shiftLeft(bitsToShift); } else { - return ONE.shiftLeft(powersOfTwo*exponent); + return ONE.shiftLeft(bitsToShift); } } } else { @@ -2380,13 +2472,16 @@ if (bitsToShift + scaleFactor <= 62) { // Fits in long? return valueOf((result << bitsToShift) * newSign); } else { - return valueOf(result*newSign).shiftLeft((int) bitsToShift); + return valueOf(result*newSign).shiftLeft(bitsToShift); } - } - else { + } else { return valueOf(result*newSign); } } else { + if ((long)bitLength() * exponent / Integer.SIZE > MAX_MAG_LENGTH) { + reportOverflow(); + } + // Large number algorithm. This is basically identical to // the algorithm above, but calls multiply() and square() // which may use more efficient algorithms for large numbers. @@ -2406,7 +2501,7 @@ // Multiply back the (exponentiated) powers of two (quickly, // by shifting left) if (powersOfTwo > 0) { - answer = answer.shiftLeft(powersOfTwo*exponent); + answer = answer.shiftLeft(bitsToShift); } if (signum < 0 && (exponent&1) == 1) { @@ -3581,7 +3676,7 @@ for (int i=1; i< len && pow2; i++) pow2 = (mag[i] == 0); - n = (pow2 ? magBitLength -1 : magBitLength); + n = (pow2 ? magBitLength - 1 : magBitLength); } else { n = magBitLength; } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/net/InetAddress.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/InetAddress.java --- openjdk-lts-11~28/src/java.base/share/classes/java/net/InetAddress.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/InetAddress.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -35,6 +35,7 @@ import java.io.ObjectStreamException; import java.io.ObjectStreamField; import java.io.IOException; +import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.ObjectInputStream.GetField; import java.io.ObjectOutputStream; @@ -1728,8 +1729,11 @@ } GetField gf = s.readFields(); String host = (String)gf.get("hostName", null); - int address= gf.get("address", 0); - int family= gf.get("family", 0); + int address = gf.get("address", 0); + int family = gf.get("family", 0); + if (family != IPv4 && family != IPv6) { + throw new InvalidObjectException("invalid address family type: " + family); + } InetAddressHolder h = new InetAddressHolder(host, address, family); UNSAFE.putObject(this, FIELDS_OFFSET, h); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/net/NetworkInterface.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/NetworkInterface.java --- openjdk-lts-11~28/src/java.base/share/classes/java/net/NetworkInterface.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/NetworkInterface.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -321,8 +321,20 @@ if (addr == null) { throw new NullPointerException(); } - if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) { - throw new IllegalArgumentException ("invalid address type"); + if (addr instanceof Inet4Address) { + Inet4Address inet4Address = (Inet4Address) addr; + if (inet4Address.holder.family != InetAddress.IPv4) { + throw new IllegalArgumentException("invalid family type: " + + inet4Address.holder.family); + } + } else if (addr instanceof Inet6Address) { + Inet6Address inet6Address = (Inet6Address) addr; + if (inet6Address.holder.family != InetAddress.IPv6) { + throw new IllegalArgumentException("invalid family type: " + + inet6Address.holder.family); + } + } else { + throw new IllegalArgumentException("invalid address type: " + addr); } return getByInetAddress0(addr); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/net/URLClassLoader.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/URLClassLoader.java --- openjdk-lts-11~28/src/java.base/share/classes/java/net/URLClassLoader.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/URLClassLoader.java 2019-01-18 04:23:48.000000000 +0000 @@ -570,13 +570,13 @@ * @spec JPMS */ protected Package definePackage(String name, Manifest man, URL url) { - String path = name.replace('.', '/').concat("/"); String specTitle = null, specVersion = null, specVendor = null; String implTitle = null, implVersion = null, implVendor = null; String sealed = null; URL sealBase = null; - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, name.replace('.', '/').concat("/")); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); @@ -620,10 +620,12 @@ /* * Returns true if the specified package name is sealed according to the * given manifest. + * + * @throws SecurityException if the package name is untrusted in the manifest */ private boolean isSealed(String name, Manifest man) { - String path = name.replace('.', '/').concat("/"); - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, name.replace('.', '/').concat("/")); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/net/URL.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/URL.java --- openjdk-lts-11~28/src/java.base/share/classes/java/net/URL.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/net/URL.java 2019-01-18 04:23:48.000000000 +0000 @@ -1393,33 +1393,33 @@ } } + if (handler == null) { + // Try the built-in protocol handler + handler = defaultFactory.createURLStreamHandler(protocol); + } + synchronized (streamHandlerLock) { - if (handler == null) { - // Try the built-in protocol handler - handler = defaultFactory.createURLStreamHandler(protocol); - } else { - URLStreamHandler handler2 = null; - - // Check again with hashtable just in case another - // thread created a handler since we last checked - handler2 = handlers.get(protocol); - - if (handler2 != null) { - return handler2; - } - - // Check with factory if another thread set a - // factory since our last check - if (!checkedWithFactory && (fac = factory) != null) { - handler2 = fac.createURLStreamHandler(protocol); - } - - if (handler2 != null) { - // The handler from the factory must be given more - // importance. Discard the default handler that - // this thread created. - handler = handler2; - } + URLStreamHandler handler2 = null; + + // Check again with hashtable just in case another + // thread created a handler since we last checked + handler2 = handlers.get(protocol); + + if (handler2 != null) { + return handler2; + } + + // Check with factory if another thread set a + // factory since our last check + if (!checkedWithFactory && (fac = factory) != null) { + handler2 = fac.createURLStreamHandler(protocol); + } + + if (handler2 != null) { + // The handler from the factory must be given more + // importance. Discard the default handler that + // this thread created. + handler = handler2; } // Insert this handler into the hashtable @@ -1427,7 +1427,6 @@ handlers.put(protocol, handler); } } - return handler; } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JarFile.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JarFile.java --- openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JarFile.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JarFile.java 2019-01-18 04:23:48.000000000 +0000 @@ -417,10 +417,10 @@ if (manEntry != null) { if (verify) { byte[] b = getBytes(manEntry); - man = new Manifest(new ByteArrayInputStream(b)); if (!jvInitialized) { jv = new JarVerifier(b); } + man = new Manifest(jv, new ByteArrayInputStream(b)); } else { man = new Manifest(super.getInputStream(manEntry)); } @@ -1010,29 +1010,13 @@ int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC, MULTIRELEASE_OPTOSFT); if (i != -1) { - i += MULTIRELEASE_CHARS.length; - if (i < b.length) { - byte c = b[i++]; - // Check that the value is followed by a newline - // and does not have a continuation - if (c == '\n' && - (i == b.length || b[i] != ' ')) { - isMultiRelease = true; - } else if (c == '\r') { - if (i == b.length) { - isMultiRelease = true; - } else { - c = b[i++]; - if (c == '\n') { - if (i == b.length || b[i] != ' ') { - isMultiRelease = true; - } - } else if (c != ' ') { - isMultiRelease = true; - } - } - } - } + // Read the main attributes of the manifest + byte[] lbuf = new byte[512]; + Attributes attr = new Attributes(); + attr.read(new Manifest.FastInputStream( + new ByteArrayInputStream(b)), lbuf); + isMultiRelease = Boolean.parseBoolean( + attr.getValue(Attributes.Name.MULTI_RELEASE)); } } } @@ -1040,7 +1024,7 @@ } } - private synchronized void ensureInitialization() { + synchronized void ensureInitialization() { try { maybeInstantiateVerifier(); } catch (IOException e) { diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JarVerifier.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JarVerifier.java --- openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JarVerifier.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JarVerifier.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -858,4 +858,24 @@ static CodeSource getUnsignedCS(URL url) { return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null); } + + /** + * Returns whether the name is trusted. Used by + * {@link Manifest#getTrustedAttributes(String)}. + */ + boolean isTrustedManifestEntry(String name) { + // How many signers? MANIFEST.MF is always verified + CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME); + if (forMan == null) { + return true; + } + // Check sigFileSigners first, because we are mainly dealing with + // non-file entries which will stay in sigFileSigners forever. + CodeSigner[] forName = sigFileSigners.get(name); + if (forName == null) { + forName = verifiedSigners.get(name); + } + // Returns trusted if all signers sign the entry + return forName != null && forName.length == forMan.length; + } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java --- openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -60,4 +60,12 @@ public List getManifestDigests(JarFile jar) { return jar.getManifestDigests(); } + + public Attributes getTrustedAttributes(Manifest man, String name) { + return man.getTrustedAttributes(name); + } + + public void ensureInitialization(JarFile jar) { + jar.ensureInitialization(); + } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/Manifest.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/Manifest.java --- openjdk-lts-11~28/src/java.base/share/classes/java/util/jar/Manifest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/jar/Manifest.java 2019-01-18 04:23:48.000000000 +0000 @@ -32,7 +32,6 @@ import java.io.IOException; import java.util.Map; import java.util.HashMap; -import java.util.Iterator; /** * The Manifest class is used to maintain Manifest entry names and their @@ -48,15 +47,19 @@ */ public class Manifest implements Cloneable { // manifest main attributes - private Attributes attr = new Attributes(); + private final Attributes attr = new Attributes(); // manifest entries - private Map entries = new HashMap<>(); + private final Map entries = new HashMap<>(); + + // associated JarVerifier, not null when called by JarFile::getManifest. + private final JarVerifier jv; /** * Constructs a new, empty Manifest. */ public Manifest() { + jv = null; } /** @@ -66,7 +69,16 @@ * @throws IOException if an I/O error has occurred */ public Manifest(InputStream is) throws IOException { + this(null, is); + } + + /** + * Constructs a new Manifest from the specified input stream + * and associates it with a JarVerifier. + */ + Manifest(JarVerifier jv, InputStream is) throws IOException { read(is); + this.jv = jv; } /** @@ -77,6 +89,7 @@ public Manifest(Manifest man) { attr.putAll(man.getMainAttributes()); entries.putAll(man.getEntries()); + jv = man.jv; } /** @@ -127,6 +140,27 @@ } /** + * Returns the Attributes for the specified entry name, if trusted. + * + * @param name entry name + * @return returns the same result as {@link #getAttributes(String)} + * @throws SecurityException if the associated jar is signed but this entry + * has been modified after signing (i.e. the section in the manifest + * does not exist in SF files of all signers). + */ + Attributes getTrustedAttributes(String name) { + // Note: Before the verification of MANIFEST.MF/.SF/.RSA files is done, + // jv.isTrustedManifestEntry() isn't able to detect MANIFEST.MF change. + // Users of this method should call SharedSecrets.javaUtilJarAccess() + // .ensureInitialization() first. + Attributes result = getAttributes(name); + if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) { + throw new SecurityException("Untrusted manifest entry: " + name); + } + return result; + } + + /** * Clears the main Attributes as well as the entries in this Manifest. */ public void clear() { diff -Nru openjdk-lts-11~28/src/java.base/share/classes/java/util/zip/ZipOutputStream.java openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/zip/ZipOutputStream.java --- openjdk-lts-11~28/src/java.base/share/classes/java/util/zip/ZipOutputStream.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/java/util/zip/ZipOutputStream.java 2019-01-18 04:23:48.000000000 +0000 @@ -582,7 +582,9 @@ uctime > UPPER_UNIXTIME_BOUND) { elen += 36; // NTFS time total 36 bytes } else { - elen += 9; // headid(2) + sz(2) + flag(1) + mtime (4) + elen += 5; // headid(2) + sz(2) + flag(1) + if (e.mtime != null) + elen += 4; // + mtime (4) } } writeShort(elen); diff -Nru openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/CipherInputStream.java openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/CipherInputStream.java --- openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/CipherInputStream.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/CipherInputStream.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -50,6 +50,13 @@ * that are not thrown by its ancestor classes. In particular, the * skip method skips, and the available * method counts only data that have been processed by the encapsulated Cipher. + * This class may catch BadPaddingException and other exceptions thrown by + * failed integrity checks during decryption. These exceptions are not + * re-thrown, so the client may not be informed that integrity checks + * failed. Because of this behavior, this class may not be suitable + * for use with decryption in an authenticated mode of operation (e.g. GCM). + * Applications that require authenticated encryption can use the Cipher API + * directly as an alternative to using this class. * *

It is crucial for a programmer using this class not to use * methods that are not defined or overriden in this class (such as a diff -Nru openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java --- openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -120,7 +120,7 @@ // Input sanity check if ((src == null) ||(len < 0) || (offset < 0) - || ((len + offset) > src.length)) { + || (len > (src.length - offset))) { throw new IllegalArgumentException("Invalid buffer arguments"); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java --- openjdk-lts-11~28/src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -26,6 +26,7 @@ package javax.crypto.spec; import java.security.spec.KeySpec; +import java.util.Arrays; /** * A user-chosen password that can be used with password-based encryption @@ -174,9 +175,7 @@ */ public final void clearPassword() { if (password != null) { - for (int i = 0; i < password.length; i++) { - password[i] = ' '; - } + Arrays.fill(password, ' '); password = null; } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java --- openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -60,6 +60,7 @@ import java.util.jar.Manifest; import java.util.stream.Stream; +import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ModulePatcher.PatchedModuleReader; import jdk.internal.module.Resources; @@ -862,7 +863,8 @@ * Manifest are used to get the package version and sealing information. * * @throws IllegalArgumentException if the package name duplicates an - * existing package either in this class loader or one of its ancestors + * existing package either in this class loader or one of its ancestors + * @throws SecurityException if the package name is untrusted in the manifest */ private Package definePackage(String pn, Manifest man, URL url) { String specTitle = null; @@ -875,7 +877,8 @@ URL sealBase = null; if (man != null) { - Attributes attr = man.getAttributes(pn.replace('.', '/').concat("/")); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, pn.replace('.', '/').concat("/")); if (attr != null) { specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION); @@ -921,10 +924,12 @@ /** * Returns {@code true} if the specified package name is sealed according to * the given manifest. + * + * @throws SecurityException if the package name is untrusted in the manifest */ private boolean isSealed(String pn, Manifest man) { - String path = pn.replace('.', '/').concat("/"); - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, pn.replace('.', '/').concat("/")); String sealed = null; if (attr != null) sealed = attr.getValue(Attributes.Name.SEALED); diff -Nru openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java --- openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -34,6 +34,7 @@ import java.net.HttpURLConnection; import java.net.JarURLConnection; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; @@ -88,6 +89,8 @@ private static final boolean DEBUG; private static final boolean DISABLE_JAR_CHECKING; private static final boolean DISABLE_ACC_CHECKING; + private static final boolean DISABLE_CP_URL_CHECK; + private static final boolean DEBUG_CP_URL_CHECK; static { Properties props = GetPropertyAction.privilegedGetProperties(); @@ -98,6 +101,12 @@ p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions"); DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false; + + // This property will be removed in a later release + p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true"); + + DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false; + DEBUG_CP_URL_CHECK = "debug".equals(p); } /* The original search path of URLs. */ @@ -857,8 +866,10 @@ { return jar.getInputStream(entry); } public int getContentLength() { return (int)entry.getSize(); } - public Manifest getManifest() throws IOException - { return jar.getManifest(); }; + public Manifest getManifest() throws IOException { + SharedSecrets.javaUtilJarAccess().ensureInitialization(jar); + return jar.getManifest(); + } public Certificate[] getCertificates() { return entry.getCertificates(); }; public CodeSigner[] getCodeSigners() @@ -1081,11 +1092,51 @@ int i = 0; while (st.hasMoreTokens()) { String path = st.nextToken(); - urls[i] = new URL(base, path); - i++; + URL url = DISABLE_CP_URL_CHECK ? new URL(base, path) : safeResolve(base, path); + if (url != null) { + urls[i] = url; + i++; + } + } + if (i == 0) { + urls = null; + } else if (i != urls.length) { + // Truncate nulls from end of array + urls = Arrays.copyOf(urls, i); } return urls; } + + /* + * Return a URL for the given path resolved against the base URL, or + * null if the resulting URL is invalid. + */ + static URL safeResolve(URL base, String path) { + String child = path.replace(File.separatorChar, '/'); + try { + if (!URI.create(child).isAbsolute()) { + URL url = new URL(base, child); + if (base.getProtocol().equalsIgnoreCase("file")) { + return url; + } else { + String bp = base.getPath(); + String urlp = url.getPath(); + int pos = bp.lastIndexOf('/'); + if (pos == -1) { + pos = bp.length() - 1; + } + if (urlp.regionMatches(0, bp, 0, pos + 1) + && urlp.indexOf("..", pos) == -1) { + return url; + } + } + } + } catch (MalformedURLException | IllegalArgumentException e) {} + if (DEBUG_CP_URL_CHECK) { + System.err.println("Class-Path entry: \"" + path + "\" ignored in JAR file " + base); + } + return null; + } } /* diff -Nru openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java --- openjdk-lts-11~28/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -30,8 +30,10 @@ import java.security.CodeSource; import java.util.Enumeration; import java.util.List; +import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.jar.Manifest; public interface JavaUtilJarAccess { public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException; @@ -41,4 +43,6 @@ public Enumeration entries2(JarFile jar); public void setEagerValidation(JarFile jar, boolean eager); public List getManifestDigests(JarFile jar); + public Attributes getTrustedAttributes(Manifest man, String name); + public void ensureInitialization(JarFile jar); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -2725,6 +2725,8 @@ // doesn't know about proxy. useProxyResponseCode = true; } else { + final URL prevURL = url; + // maintain previous headers, just change the name // of the file we're getting url = locUrl; @@ -2753,6 +2755,14 @@ poster = null; if (!checkReuseConnection()) connect(); + + if (!sameDestination(prevURL, url)) { + // Ensures pre-redirect user-set cookie will not be reset. + // CookieHandler, if any, will be queried to determine + // cookies for redirected URL, if any. + userCookies = null; + userCookies2 = null; + } } else { if (!checkReuseConnection()) connect(); @@ -2775,11 +2785,52 @@ } requests.set("Host", host); } + + if (!sameDestination(prevURL, url)) { + // Redirecting to a different destination will drop any + // security-sensitive headers, regardless of whether + // they are user-set or not. CookieHandler, if any, will be + // queried to determine cookies for redirected URL, if any. + userCookies = null; + userCookies2 = null; + requests.remove("Cookie"); + requests.remove("Cookie2"); + requests.remove("Authorization"); + + // check for preemptive authorization + AuthenticationInfo sauth = + AuthenticationInfo.getServerAuth(url, getAuthenticatorKey()); + if (sauth != null && sauth.supportsPreemptiveAuthorization() ) { + // Sets "Authorization" + requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url,method)); + currentServerCredentials = sauth; + } + } } } return true; } + /* Returns true iff the given URLs have the same host and effective port. */ + private static boolean sameDestination(URL firstURL, URL secondURL) { + assert firstURL.getProtocol().equalsIgnoreCase(secondURL.getProtocol()): + "protocols not equal: " + firstURL + " - " + secondURL; + + if (!firstURL.getHost().equalsIgnoreCase(secondURL.getHost())) + return false; + + int firstPort = firstURL.getPort(); + if (firstPort == -1) + firstPort = firstURL.getDefaultPort(); + int secondPort = secondURL.getPort(); + if (secondPort == -1) + secondPort = secondURL.getDefaultPort(); + if (firstPort != secondPort) + return false; + + return true; + } + /* dummy byte buffer for reading off socket prior to closing */ byte[] cdata = new byte [128]; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java 2019-01-18 04:23:48.000000000 +0000 @@ -33,8 +33,7 @@ * credentials without prompting) should only be tried with trusted sites. */ public abstract class NTLMAuthenticationCallback { - private static volatile NTLMAuthenticationCallback callback = - new DefaultNTLMAuthenticationCallback(); + private static volatile NTLMAuthenticationCallback callback; public static void setNTLMAuthenticationCallback( NTLMAuthenticationCallback callback) { @@ -50,10 +49,5 @@ * transparent Authentication. */ public abstract boolean isTrustedSite(URL url); - - static class DefaultNTLMAuthenticationCallback extends NTLMAuthenticationCallback { - @Override - public boolean isTrustedSite(URL url) { return true; } - } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -624,11 +624,10 @@ { // Untrusted target: Use a newly-erased buffer int c = Math.min(icount, TRANSFER_SIZE); - ByteBuffer bb = Util.getTemporaryDirectBuffer(c); + ByteBuffer bb = ByteBuffer.allocate(c); long tw = 0; // Total bytes written long pos = position; try { - Util.erase(bb); while (tw < icount) { bb.limit(Math.min((int)(icount - tw), TRANSFER_SIZE)); int nr = read(bb, pos); @@ -649,8 +648,6 @@ if (tw > 0) return tw; throw x; - } finally { - Util.releaseTemporaryDirectBuffer(bb); } } @@ -734,11 +731,10 @@ { // Untrusted target: Use a newly-erased buffer int c = (int)Math.min(count, TRANSFER_SIZE); - ByteBuffer bb = Util.getTemporaryDirectBuffer(c); + ByteBuffer bb = ByteBuffer.allocate(c); long tw = 0; // Total bytes written long pos = position; try { - Util.erase(bb); while (tw < count) { bb.limit((int)Math.min((count - tw), (long)TRANSFER_SIZE)); // ## Bug: Will block reading src if this channel @@ -759,8 +755,6 @@ if (tw > 0) return tw; throw x; - } finally { - Util.releaseTemporaryDirectBuffer(bb); } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/DigestBase.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/DigestBase.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/DigestBase.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/DigestBase.java 2019-01-18 04:23:48.000000000 +0000 @@ -28,6 +28,7 @@ import java.security.MessageDigestSpi; import java.security.DigestException; import java.security.ProviderException; +import java.util.Arrays; import java.util.Objects; import jdk.internal.HotSpotIntrinsicCandidate; @@ -178,6 +179,7 @@ implReset(); bufOfs = 0; bytesProcessed = 0; + Arrays.fill(buffer, (byte) 0x00); } // return the digest. See JCA doc. diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -133,18 +133,20 @@ throw new UnrecoverableKeyException("Password must not be null"); } - KeyProtector keyProtector = new KeyProtector(password); + byte[] passwordBytes = convertToBytes(password); + KeyProtector keyProtector = new KeyProtector(passwordBytes); byte[] encrBytes = ((KeyEntry)entry).protectedPrivKey; EncryptedPrivateKeyInfo encrInfo; - byte[] plain; try { encrInfo = new EncryptedPrivateKeyInfo(encrBytes); + return keyProtector.recover(encrInfo); } catch (IOException ioe) { throw new UnrecoverableKeyException("Private key not stored as " + "PKCS #8 " + "EncryptedPrivateKeyInfo"); + } finally { + Arrays.fill(passwordBytes, (byte) 0x00); } - return keyProtector.recover(encrInfo); } /** @@ -253,7 +255,8 @@ Certificate[] chain) throws KeyStoreException { - KeyProtector keyProtector = null; + KeyProtector keyProtector; + byte[] passwordBytes = null; if (!(key instanceof java.security.PrivateKey)) { throw new KeyStoreException("Cannot store non-PrivateKeys"); @@ -264,7 +267,8 @@ entry.date = new Date(); // Protect the encoding of the key - keyProtector = new KeyProtector(password); + passwordBytes = convertToBytes(password); + keyProtector = new KeyProtector(passwordBytes); entry.protectedPrivKey = keyProtector.protect(key); // clone the chain @@ -280,7 +284,8 @@ } catch (NoSuchAlgorithmException nsae) { throw new KeyStoreException("Key protection algorithm not found"); } finally { - keyProtector = null; + if (passwordBytes != null) + Arrays.fill(passwordBytes, (byte) 0x00); } } @@ -793,19 +798,27 @@ private MessageDigest getPreKeyedHash(char[] password) throws NoSuchAlgorithmException, UnsupportedEncodingException { - int i, j; MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] passwdBytes = convertToBytes(password); + md.update(passwdBytes); + Arrays.fill(passwdBytes, (byte) 0x00); + md.update("Mighty Aphrodite".getBytes("UTF8")); + return md; + } + + /** + * Helper method to convert char[] to byte[] + */ + + private byte[] convertToBytes(char[] password) { + int i, j; byte[] passwdBytes = new byte[password.length * 2]; for (i=0, j=0; i> 8); passwdBytes[j++] = (byte)password[i]; } - md.update(passwdBytes); - for (i=0; iThe password is expected to be in printable ASCII. - * Normal rules for good password selection apply: at least - * seven characters, mixed case, with punctuation encouraged. - * Phrases or words which are easily guessed, for example by - * being found in dictionaries, are bad. */ - public KeyProtector(char[] password) + public KeyProtector(byte[] passwordBytes) throws NoSuchAlgorithmException { - int i, j; - - if (password == null) { + if (passwordBytes == null) { throw new IllegalArgumentException("password can't be null"); } md = MessageDigest.getInstance(DIGEST_ALG); - // Convert password to byte array, so that it can be digested - passwdBytes = new byte[password.length * 2]; - for (i=0, j=0; i> 8); - passwdBytes[j++] = (byte)password[i]; - } - // Use the cleaner to zero the password when no longer referenced - final byte[] k = this.passwdBytes; - CleanerFactory.cleaner().register(this, - () -> java.util.Arrays.fill(k, (byte)0x00)); + this.passwdBytes = passwordBytes; } /* diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/MD4.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/MD4.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/MD4.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/MD4.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,6 +26,7 @@ package sun.security.provider; import java.security.*; +import java.util.Arrays; import static sun.security.provider.ByteArrayAccess.*; import static sun.security.util.SecurityConstants.PROVIDER_VER; @@ -92,7 +93,7 @@ super("MD4", 16, 64); state = new int[4]; x = new int[16]; - implReset(); + resetHashes(); } // clone this object @@ -108,6 +109,12 @@ */ void implReset() { // Load magic initialization constants. + resetHashes(); + // clear out old data + Arrays.fill(x, 0); + } + + private void resetHashes() { state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/MD5.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/MD5.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/MD5.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/MD5.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,6 +25,8 @@ package sun.security.provider; +import java.util.Arrays; + import static sun.security.provider.ByteArrayAccess.*; /** @@ -66,7 +68,7 @@ super("MD5", 16, 64); state = new int[4]; x = new int[16]; - implReset(); + resetHashes(); } // clone this object @@ -82,6 +84,12 @@ */ void implReset() { // Load magic initialization constants. + resetHashes(); + // clear out old data + Arrays.fill(x, 0); + } + + private void resetHashes() { state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA2.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA2.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA2.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA2.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,6 +25,7 @@ package sun.security.provider; +import java.util.Arrays; import java.util.Objects; import jdk.internal.HotSpotIntrinsicCandidate; @@ -83,13 +84,18 @@ this.initialHashes = initialHashes; state = new int[8]; W = new int[64]; - implReset(); + resetHashes(); } /** * Resets the buffers and hash value to start a new hash. */ void implReset() { + resetHashes(); + Arrays.fill(W, 0); + } + + private void resetHashes() { System.arraycopy(initialHashes, 0, state, 0, state.length); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA5.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA5.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA5.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA5.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,6 +25,7 @@ package sun.security.provider; +import java.util.Arrays; import java.util.Objects; import jdk.internal.HotSpotIntrinsicCandidate; @@ -98,10 +99,15 @@ this.initialHashes = initialHashes; state = new long[8]; W = new long[80]; - implReset(); + resetHashes(); } final void implReset() { + resetHashes(); + Arrays.fill(W, 0L); + } + + private void resetHashes() { System.arraycopy(initialHashes, 0, state, 0, state.length); } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/provider/SHA.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/provider/SHA.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,6 +25,7 @@ package sun.security.provider; +import java.util.Arrays; import java.util.Objects; import static sun.security.provider.ByteArrayAccess.*; @@ -62,7 +63,7 @@ super("SHA-1", 20, 64); state = new int[5]; W = new int[80]; - implReset(); + resetHashes(); } /* @@ -79,6 +80,13 @@ * Resets the buffers and hash value to start a new hash. */ void implReset() { + // Load magic initialization constants. + resetHashes(); + // clear out old data + Arrays.fill(W, 0); + } + + private void resetHashes() { state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/CipherSuite.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/CipherSuite.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/CipherSuite.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/CipherSuite.java 2019-01-18 04:23:48.000000000 +0000 @@ -435,12 +435,12 @@ 0x0003, false, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "TLS_RSA_EXPORT_WITH_RC4_40_MD5", ProtocolVersion.PROTOCOLS_TO_10, - K_RSA_EXPORT, B_DES_40, M_MD5, H_NONE), + K_RSA_EXPORT, B_RC4_40, M_MD5, H_NONE), SSL_DH_anon_EXPORT_WITH_RC4_40_MD5( 0x0017, false, "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5", ProtocolVersion.PROTOCOLS_TO_10, - K_DH_ANON, B_DES_40, M_MD5, H_NONE), + K_DH_ANON, B_RC4_40, M_MD5, H_NONE), // no traffic encryption cipher suites TLS_RSA_WITH_NULL_SHA256( diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/ClientHello.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/ClientHello.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/ClientHello.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/ClientHello.java 2019-01-18 04:23:48.000000000 +0000 @@ -35,6 +35,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; +import java.util.Objects; import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLPeerUnverifiedException; @@ -510,6 +511,23 @@ } } + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = chc.sslConfig.identificationProtocol; + if (session != null && identityAlg != null) { + String sessionIdentityAlg = + session.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + session = null; + } + } + if (session != null) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake,verbose")) { SSLLogger.finest("Try resuming session", session); @@ -1011,6 +1029,23 @@ } } + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = shc.sslConfig.identificationProtocol; + if (resumingSession && identityAlg != null) { + String sessionIdentityAlg = + previous.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + resumingSession = false; + } + } + // So far so good. Note that the handshake extensions may reset // the resuming options later. shc.isResumption = resumingSession; diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java 2019-01-18 04:23:48.000000000 +0000 @@ -50,6 +50,9 @@ this.localSupportedSignAlgs = new ArrayList( context.conSession.getLocalSupportedSignatureSchemes()); + this.requestedServerNames = + context.conSession.getRequestedServerNames(); + handshakeConsumers = new LinkedHashMap<>(consumers); handshakeFinished = true; } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java 2019-01-18 04:23:48.000000000 +0000 @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.Locale; import java.util.Arrays; +import java.util.Objects; import java.util.Optional; import java.util.Collection; import javax.crypto.Mac; @@ -441,6 +442,23 @@ } result = false; } + } + + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = shc.sslConfig.identificationProtocol; + if (result && identityAlg != null) { + String sessionIdentityAlg = s.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + result = false; + } } // Ensure cipher suite can be negotiated diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java 2019-01-18 04:23:48.000000000 +0000 @@ -323,7 +323,7 @@ // servers MUST abort the handshake. SSLExtensionSpec spec = shc.handshakeExtensions.get(SSLExtension.CH_PRE_SHARED_KEY); - if (spec == null) { + if (spec != null) { shc.conContext.fatal(Alert.HANDSHAKE_FAILURE, "pre_shared_key key extension is offered " + "without a psk_key_exchange_modes extension"); diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java 2019-01-18 04:23:48.000000000 +0000 @@ -525,7 +525,7 @@ // signatures appearing in certificates. SignatureSchemesSpec certSpec = (SignatureSchemesSpec)chc.handshakeExtensions.get( - SSLExtension.CH_SIGNATURE_ALGORITHMS_CERT); + SSLExtension.CR_SIGNATURE_ALGORITHMS_CERT); if (certSpec == null) { chc.peerRequestedCertSignSchemes = sss; chc.handshakeSession.setPeerSupportedSignatureAlgorithms(sss); diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java 2019-01-18 04:23:48.000000000 +0000 @@ -43,7 +43,7 @@ // Extension map for debug logging private final Map logMap = - SSLLogger.isOn ? null : new LinkedHashMap<>(); + SSLLogger.isOn ? new LinkedHashMap<>() : null; SSLExtensions(HandshakeMessage handshakeMessage) { this.handshakeMessage = handshakeMessage; @@ -65,38 +65,59 @@ "): no sufficient data"); } + boolean isSupported = true; SSLHandshake handshakeType = hm.handshakeType(); if (SSLExtension.isConsumable(extId) && SSLExtension.valueOf(handshakeType, extId) == null) { - hm.handshakeContext.conContext.fatal( + if (extId == SSLExtension.CH_SUPPORTED_GROUPS.id && + handshakeType == SSLHandshake.SERVER_HELLO) { + // Note: It does not comply to the specification. However, + // there are servers that send the supported_groups + // extension in ServerHello handshake message. + // + // TLS 1.3 should not send this extension. We may want to + // limit the workaround for TLS 1.2 and prior version only. + // However, the implementation of the limit is complicated + // and inefficient, and may not worthy the maintenance. + isSupported = false; + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( + "Received buggy supported_groups extension " + + "in the ServerHello handshake message"); + } + } else { + hm.handshakeContext.conContext.fatal( Alert.UNSUPPORTED_EXTENSION, "extension (" + extId + ") should not be presented in " + handshakeType.name); + } } - boolean isSupported = false; - for (SSLExtension extension : extensions) { - if ((extension.id != extId) || - (extension.onLoadConsumer == null)) { - continue; - } + if (isSupported) { + isSupported = false; + for (SSLExtension extension : extensions) { + if ((extension.id != extId) || + (extension.onLoadConsumer == null)) { + continue; + } + + if (extension.handshakeType != handshakeType) { + hm.handshakeContext.conContext.fatal( + Alert.UNSUPPORTED_EXTENSION, + "extension (" + extId + ") should not be " + + "presented in " + handshakeType.name); + } + + byte[] extData = new byte[extLen]; + m.get(extData); + extMap.put(extension, extData); + if (logMap != null) { + logMap.put(extId, extData); + } - if (extension.handshakeType != handshakeType) { - hm.handshakeContext.conContext.fatal( - Alert.UNSUPPORTED_EXTENSION, - "extension (" + extId + ") should not be " + - "presented in " + handshakeType.name); + isSupported = true; + break; } - - byte[] extData = new byte[extLen]; - m.get(extData); - extMap.put(extension, extData); - if (logMap != null) { - logMap.put(extId, extData); - } - - isSupported = true; - break; } if (!isSupported) { diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -132,6 +132,10 @@ // Counter used to create unique nonces in NewSessionTicket private BigInteger ticketNonceCounter = BigInteger.ONE; + // The endpoint identification algorithm used to check certificates + // in this session. + private final String identificationProtocol; + /* * Create a new non-rejoinable session, using the default (null) * cipher spec. This constructor returns a session which could @@ -149,6 +153,7 @@ this.requestedServerNames = Collections.emptyList(); this.useExtendedMasterSecret = false; this.creationTime = System.currentTimeMillis(); + this.identificationProtocol = null; } /* @@ -198,6 +203,7 @@ (!hc.negotiatedProtocol.useTLS13PlusSpec()); } this.creationTime = creationTime; + this.identificationProtocol = hc.sslConfig.identificationProtocol; if (SSLLogger.isOn && SSLLogger.isOn("session")) { SSLLogger.finest("Session initialized: " + this); @@ -259,6 +265,10 @@ return ticketAgeAdd; } + String getIdentificationProtocol() { + return this.identificationProtocol; + } + /* * Get the PSK identity. Take care not to use it in multiple connections. */ diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java 2019-01-18 04:23:48.000000000 +0000 @@ -27,7 +27,6 @@ import java.io.IOException; import java.nio.ByteBuffer; -import java.security.AccessController; import java.security.AlgorithmConstraints; import java.security.AlgorithmParameters; import java.security.CryptoPrimitive; @@ -482,8 +481,8 @@ // // If the System Property is not defined or the value is empty, the // default groups and preferences will be used. - String property = AccessController.doPrivileged( - new GetPropertyAction("jdk.tls.namedGroups")); + String property = GetPropertyAction + .privilegedGetProperty("jdk.tls.namedGroups"); if (property != null && property.length() != 0) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && @@ -672,6 +671,11 @@ } AlgorithmParameters params = namedGroupParams.get(namedGroup); + if (params == null) { + throw new RuntimeException( + "Not a supported EC named group: " + namedGroup); + } + try { return params.getParameterSpec(ECGenParameterSpec.class); } catch (InvalidParameterSpecException ipse) { @@ -687,6 +691,11 @@ } AlgorithmParameters params = namedGroupParams.get(namedGroup); + if (params == null) { + throw new RuntimeException( + "Not a supported DH named group: " + namedGroup); + } + try { return params.getParameterSpec(DHParameterSpec.class); } catch (InvalidParameterSpecException ipse) { @@ -739,7 +748,7 @@ namedGroupParams.get(namedGroup)); } - // Is there any supported group permitted by the constraints? + // Is the named group supported? static boolean isSupported(NamedGroup namedGroup) { for (NamedGroup group : supportedNamedGroups) { if (namedGroup.id == group.id) { @@ -757,6 +766,7 @@ for (NamedGroup namedGroup : requestedNamedGroups) { if ((namedGroup.type == type) && namedGroup.isAvailable(negotiatedProtocol) && + isSupported(namedGroup) && constraints.permits( EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), namedGroup.algorithm, diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -281,7 +281,7 @@ .replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d")) .replaceFirst("m+", "\\%2\\$02d"); return MessageFormat.format(gmtFormat, - String.format(hourFormat, offset / 60, offset % 60)); + String.format(l, hourFormat, offset / 60, offset % 60)); } } } diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties --- openjdk-lts-11~28/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties 2019-01-18 04:23:48.000000000 +0000 @@ -252,6 +252,7 @@ UZS=UZS VEB=VEB VEF=VEF +VES=VES VND=VND VUV=VUV WST=WST @@ -421,7 +422,7 @@ pab=Panamanian Balboa pen=Peruvian Sol pgk=Papua New Guinean Kina -php=Philippine Piso +php=Philippine Peso pkr=Pakistani Rupee pln=Polish Zloty pte=Portuguese Escudo @@ -474,6 +475,7 @@ uzs=Uzbekistan Som veb=Venezuelan Bol\u00edvar (1871-2008) vef=Venezuelan Bol\u00edvar +ves=Venezuelan Bol\u00edvar Soberano vnd=Vietnamese Dong vuv=Vanuatu Vatu wst=Samoan Tala diff -Nru openjdk-lts-11~28/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java --- openjdk-lts-11~28/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/classes/sun/util/resources/TimeZoneNames.java 2019-01-18 04:23:48.000000000 +0000 @@ -674,9 +674,9 @@ "Magadan Summer Time", "MAGST", "Magadan Time", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Philippines Time", "PHT", - "Philippines Summer Time", "PHST", - "Philippines Time", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/java.base/share/conf/net.properties openjdk-lts-11.0.2+9/src/java.base/share/conf/net.properties --- openjdk-lts-11~28/src/java.base/share/conf/net.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/conf/net.properties 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ ############################################################ -# Default Networking Configuration File +# Default Networking Configuration File # # This file may contain default values for the networking system properties. # These values are only used when the system properties are not specified @@ -14,7 +14,7 @@ # Note that the system properties that do explicitly set proxies # (like http.proxyHost) do take precedence over the system settings # even if java.net.useSystemProxies is set to true. - + java.net.useSystemProxies=false #------------------------------------------------------------------------ @@ -66,8 +66,8 @@ # socksProxyPort=1080 # # HTTP Keep Alive settings. remainingData is the maximum amount of data -# in kilobytes that will be cleaned off the underlying socket so that it -# can be reused (default value is 512K), queuedConnections is the maximum +# in kilobytes that will be cleaned off the underlying socket so that it +# can be reused (default value is 512K), queuedConnections is the maximum # number of Keep Alive connections to be on the queue for clean up (default # value is 10). # http.KeepAlive.remainingData=512 @@ -99,3 +99,23 @@ #jdk.http.auth.proxying.disabledSchemes= jdk.http.auth.tunneling.disabledSchemes=Basic +# +# Transparent NTLM HTTP authentication mode on Windows. Transparent authentication +# can be used for the NTLM scheme, where the security credentials based on the +# currently logged in user's name and password can be obtained directly from the +# operating system, without prompting the user. This property has three possible +# values which regulate the behavior as shown below. Other unrecognized values +# are handled the same as 'disabled'. Note, that NTLM is not considered to be a +# strongly secure authentication scheme and care should be taken before enabling +# this mechanism. +# +# Transparent authentication never used. +#jdk.http.ntlm.transparentAuth=disabled +# +# Enabled for all hosts. +#jdk.http.ntlm.transparentAuth=allHosts +# +# Enabled for hosts that are trusted in Windows Internet settings +#jdk.http.ntlm.transparentAuth=trustedHosts +# +jdk.http.ntlm.transparentAuth=disabled diff -Nru openjdk-lts-11~28/src/java.base/share/conf/security/java.security openjdk-lts-11.0.2+9/src/java.base/share/conf/security/java.security --- openjdk-lts-11~28/src/java.base/share/conf/security/java.security 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/conf/security/java.security 2019-01-18 04:23:48.000000000 +0000 @@ -675,8 +675,8 @@ # # Example: # jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048 -jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \ - EC keySize < 224, DES40_CBC, RC4_40, 3DES_EDE_CBC +jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, \ + EC keySize < 224, 3DES_EDE_CBC, anon, NULL # # Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS) Binary files /tmp/tmpv7pKNL/Y3FYdUBU4z/openjdk-lts-11~28/src/java.base/share/lib/security/cacerts and /tmp/tmpv7pKNL/oisKN7KkM_/openjdk-lts-11.0.2+9/src/java.base/share/lib/security/cacerts differ diff -Nru openjdk-lts-11~28/src/java.base/share/native/libjava/io_util.c openjdk-lts-11.0.2+9/src/java.base/share/native/libjava/io_util.c --- openjdk-lts-11~28/src/java.base/share/native/libjava/io_util.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/native/libjava/io_util.c 2019-01-18 04:23:48.000000000 +0000 @@ -211,11 +211,7 @@ n = getLastErrorString(buf, sizeof(buf)); if (n > 0) { -#ifdef WIN32 - why = (*env)->NewStringUTF(env, buf); -#else why = JNU_NewStringPlatform(env, buf); -#endif CHECK_NULL(why); } x = JNU_NewObjectByName(env, diff -Nru openjdk-lts-11~28/src/java.base/share/native/libjli/args.c openjdk-lts-11.0.2+9/src/java.base/share/native/libjli/args.c --- openjdk-lts-11~28/src/java.base/share/native/libjli/args.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/share/native/libjli/args.c 2019-01-18 04:23:48.000000000 +0000 @@ -263,6 +263,8 @@ } JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor); pctx->state = IN_ESCAPE; + // anchor after backslash character + anchor = nextc + 1; break; case '\'': case '"': diff -Nru openjdk-lts-11~28/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java openjdk-lts-11.0.2+9/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java --- openjdk-lts-11~28/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java 2019-01-18 04:23:48.000000000 +0000 @@ -93,10 +93,13 @@ /** * Returns true if the given site is trusted, i.e. we can try - * transparent Authentication. + * transparent Authentication. Shouldn't be called since + * capability not supported on Unix */ public static boolean isTrustedSite(URL url) { - return NTLMAuthCallback.isTrustedSite(url); + if (NTLMAuthCallback != null) + return NTLMAuthCallback.isTrustedSite(url); + return false; } private void init0() { diff -Nru openjdk-lts-11~28/src/java.base/unix/native/libnet/net_util_md.c openjdk-lts-11.0.2+9/src/java.base/unix/native/libnet/net_util_md.c --- openjdk-lts-11~28/src/java.base/unix/native/libnet/net_util_md.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/unix/native/libnet/net_util_md.c 2019-01-18 04:23:48.000000000 +0000 @@ -584,6 +584,8 @@ if (loRoutesTemp == 0) { free(loRoutes); + loRoutes = NULL; + nRoutes = 0; fclose (f); return; } diff -Nru openjdk-lts-11~28/src/java.base/unix/native/libnet/NetworkInterface.c openjdk-lts-11.0.2+9/src/java.base/unix/native/libnet/NetworkInterface.c --- openjdk-lts-11~28/src/java.base/unix/native/libnet/NetworkInterface.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/unix/native/libnet/NetworkInterface.c 2019-01-18 04:23:48.000000000 +0000 @@ -331,9 +331,16 @@ netif *ifs, *curr; jobject obj = NULL; jboolean match = JNI_FALSE; - int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ? - AF_INET : AF_INET6; + int family = getInetAddress_family(env, iaObj); JNU_CHECK_EXCEPTION_RETURN(env, NULL); + + if (family == java_net_InetAddress_IPv4) { + family = AF_INET; + } else if (family == java_net_InetAddress_IPv6) { + family = AF_INET6; + } else { + return NULL; // Invalid family + } ifs = enumInterfaces(env); if (ifs == NULL) { return NULL; @@ -351,7 +358,9 @@ int address1 = htonl( ((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr); int address2 = getInetAddress_addr(env, iaObj); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + goto cleanup; + } if (address1 == address2) { match = JNI_TRUE; break; @@ -397,6 +406,7 @@ obj = createNetworkInterface(env, curr); } +cleanup: // release the interface list freeif(ifs); diff -Nru openjdk-lts-11~28/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java openjdk-lts-11.0.2+9/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java --- openjdk-lts-11~28/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java 2019-01-18 04:23:48.000000000 +0000 @@ -32,6 +32,7 @@ import java.net.URL; import java.util.Objects; import java.util.Properties; +import sun.net.NetProperties; import sun.net.www.HeaderParser; import sun.net.www.protocol.http.AuthenticationInfo; import sun.net.www.protocol.http.AuthScheme; @@ -56,11 +57,33 @@ private static final String defaultDomain; /* Whether cache is enabled for NTLM */ private static final boolean ntlmCache; + + enum TransparentAuth { + DISABLED, // disable for all hosts (default) + TRUSTED_HOSTS, // use Windows trusted hosts settings + ALL_HOSTS // attempt for all hosts + } + + private static final TransparentAuth authMode; + static { Properties props = GetPropertyAction.privilegedGetProperties(); defaultDomain = props.getProperty("http.auth.ntlm.domain", "domain"); String ntlmCacheProp = props.getProperty("jdk.ntlm.cache", "true"); ntlmCache = Boolean.parseBoolean(ntlmCacheProp); + String modeProp = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { + return NetProperties.get("jdk.http.ntlm.transparentAuth"); + } + }); + + if ("trustedHosts".equalsIgnoreCase(modeProp)) + authMode = TransparentAuth.TRUSTED_HOSTS; + else if ("allHosts".equalsIgnoreCase(modeProp)) + authMode = TransparentAuth.ALL_HOSTS; + else + authMode = TransparentAuth.DISABLED; } private void init0() { @@ -166,9 +189,21 @@ * transparent Authentication. */ public static boolean isTrustedSite(URL url) { - return NTLMAuthCallback.isTrustedSite(url); + if (NTLMAuthCallback != null) + return NTLMAuthCallback.isTrustedSite(url); + + switch (authMode) { + case TRUSTED_HOSTS: + return isTrustedSite(url.toString()); + case ALL_HOSTS: + return true; + default: + return false; + } } + static native boolean isTrustedSite(String url); + /** * Not supported. Must use the setHeaders() method */ @@ -218,5 +253,4 @@ return false; } } - } diff -Nru openjdk-lts-11~28/src/java.base/windows/native/libnet/NetworkInterface.c openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NetworkInterface.c --- openjdk-lts-11~28/src/java.base/windows/native/libnet/NetworkInterface.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NetworkInterface.c 2019-01-18 04:23:48.000000000 +0000 @@ -272,7 +272,7 @@ // But in rare case it fails, we allow 'char' to be displayed curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); } else { - curr->displayName = (wchar_t *)malloc(wlen*(sizeof(wchar_t))+1); + curr->displayName = (wchar_t *)malloc((wlen+1)*sizeof(wchar_t)); } curr->name = (char *)malloc(strlen(dev_name) + 1); @@ -280,6 +280,7 @@ if (curr->name == NULL || curr->displayName == NULL) { if (curr->name) free(curr->name); if (curr->displayName) free(curr->displayName); + free(curr); curr = NULL; } } @@ -314,7 +315,7 @@ free(curr); return -1; } else { - curr->displayName[wlen*(sizeof(wchar_t))] = '\0'; + ((wchar_t *)curr->displayName)[wlen] = L'\0'; curr->dNameIsUnicode = TRUE; } } @@ -586,7 +587,10 @@ /* default ctor will set family to AF_INET */ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrP); + return NULL; + } if (addrs->mask != -1) { ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { @@ -600,7 +604,10 @@ return NULL; } setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrP); + return NULL; + } (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); @@ -611,6 +618,7 @@ if (iaObj) { jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr)); if (ret == JNI_FALSE) { + free_netaddr(netaddrP); return NULL; } @@ -846,6 +854,7 @@ /* allocate a NetworkInterface array */ netIFArr = (*env)->NewObjectArray(env, count, cls, NULL); if (netIFArr == NULL) { + free_netif(ifList); return NULL; } @@ -860,6 +869,7 @@ netifObj = createNetworkInterface(env, curr, -1, NULL); if (netifObj == NULL) { + free_netif(ifList); return NULL; } diff -Nru openjdk-lts-11~28/src/java.base/windows/native/libnet/NetworkInterface_winXP.c openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NetworkInterface_winXP.c --- openjdk-lts-11~28/src/java.base/windows/native/libnet/NetworkInterface_winXP.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NetworkInterface_winXP.c 2019-01-18 04:23:48.000000000 +0000 @@ -521,8 +521,9 @@ jobjectArray addrArr, bindsArr, childArr; netaddr *addrs; jint addr_index; - int netaddrCount=ifs->naddrs; - netaddr *netaddrP=ifs->addrs; + int netaddrCount = ifs->naddrs; + netaddr *netaddrP = ifs->addrs; + netaddr *netaddrPToFree = NULL; jint bind_index; /* @@ -553,21 +554,23 @@ * Note that 0 is a valid number of addresses. */ if (netaddrCount < 0) { - netaddrCount = enumAddresses_win(env, ifs, &netaddrP); + netaddrCount = enumAddresses_win(env, ifs, &netaddrPToFree); if (netaddrCount == -1) { return NULL; } + netaddrP = netaddrPToFree; } addrArr = (*env)->NewObjectArray(env, netaddrCount, ia_class, NULL); if (addrArr == NULL) { + free_netaddr(netaddrPToFree); return NULL; } bindsArr = (*env)->NewObjectArray(env, netaddrCount, ni_ibcls, NULL); if (bindsArr == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } addrs = netaddrP; @@ -579,25 +582,32 @@ if (addrs->addr.sa.sa_family == AF_INET) { iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (iaObj == NULL) { + free_netaddr(netaddrPToFree); return NULL; } /* default ctor will set family to AF_INET */ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrPToFree); + return NULL; + } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (ia2Obj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrPToFree); + return NULL; + } (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); @@ -606,10 +616,12 @@ jboolean ret; iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID); if (iaObj == NULL) { + free_netaddr(netaddrPToFree); return NULL; } ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr)); if (ret == JNI_FALSE) { + free_netaddr(netaddrPToFree); return NULL; } scope = addrs->addr.sa6.sin6_scope_id; @@ -619,8 +631,8 @@ } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); @@ -633,6 +645,8 @@ (*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr); (*env)->SetObjectField(env, netifObj, ni_bindsID, bindsArr); + free_netaddr(netaddrPToFree); + /* * Windows doesn't have virtual interfaces, so child array * is always empty. @@ -672,7 +686,7 @@ } /* if found create a NetworkInterface */ - if (curr != NULL) {; + if (curr != NULL) { netifObj = createNetworkInterfaceXP(env, curr); } @@ -799,6 +813,7 @@ /* allocate a NetworkInterface array */ netIFArr = (*env)->NewObjectArray(env, count, cls, NULL); if (netIFArr == NULL) { + free_netif(ifList); return NULL; } @@ -813,6 +828,7 @@ netifObj = createNetworkInterfaceXP(env, curr); if (netifObj == NULL) { + free_netif(ifList); return NULL; } diff -Nru openjdk-lts-11~28/src/java.base/windows/native/libnet/NTLMAuthentication.c openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NTLMAuthentication.c --- openjdk-lts-11~28/src/java.base/windows/native/libnet/NTLMAuthentication.c 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/windows/native/libnet/NTLMAuthentication.c 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,106 @@ +/* + * 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. 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 "jni_util.h" +#include + +JNIEXPORT jboolean JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSite(JNIEnv *env, jclass clazz, jstring url ) +{ + + HRESULT hr; + DWORD dwZone; + DWORD pPolicy = 0; + IInternetSecurityManager *spSecurityManager; + jboolean ret; + + // Create IInternetSecurityManager + hr = CoInternetCreateSecurityManager(NULL, &spSecurityManager, (DWORD)0); + if (FAILED(hr)) { + return JNI_FALSE; + } + + const LPCWSTR bstrURL = (LPCWSTR)((*env)->GetStringChars(env, url, NULL)); + if (bstrURL == NULL) { + if (!(*env)->ExceptionCheck(env)) + JNU_ThrowOutOfMemoryError(env, NULL); + spSecurityManager->lpVtbl->Release(spSecurityManager); + return JNI_FALSE; + } + + // Determines the policy for the URLACTION_CREDENTIALS_USE action and display + // a user interface, if the policy indicates that the user should be queried + hr = spSecurityManager->lpVtbl->ProcessUrlAction( + spSecurityManager, + bstrURL, + URLACTION_CREDENTIALS_USE, + (LPBYTE)&pPolicy, + sizeof(DWORD), 0, 0, 0, 0); + + if (FAILED(hr)) { + ret = JNI_FALSE; + goto cleanupAndReturn; + } + + // If these two User Authentication Logon options is selected + // Anonymous logon + // Prompt for user name and password + if (pPolicy == URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY || + pPolicy == URLPOLICY_CREDENTIALS_MUST_PROMPT_USER) { + ret = JNI_FALSE; + goto cleanupAndReturn; + } + + // Option "Automatic logon with current user name and password" is selected + if (pPolicy == URLPOLICY_CREDENTIALS_SILENT_LOGON_OK) { + ret = JNI_TRUE; + goto cleanupAndReturn; + } + + // Option "Automatic logon only in intranet zone" is selected + if (pPolicy == URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT) { + + // Gets the zone index from the specified URL + hr = spSecurityManager->lpVtbl->MapUrlToZone( + spSecurityManager, bstrURL, &dwZone, 0); + if (FAILED(hr)) { + ret = JNI_FALSE; + goto cleanupAndReturn; + } + + // Check if the URL is in Local or Intranet zone + if (dwZone == URLZONE_INTRANET || dwZone == URLZONE_LOCAL_MACHINE) { + ret = JNI_TRUE; + goto cleanupAndReturn; + } + } + ret = JNI_FALSE; + +cleanupAndReturn: + (*env)->ReleaseStringChars(env, url, bstrURL); + spSecurityManager->lpVtbl->Release(spSecurityManager); + return ret; +} diff -Nru openjdk-lts-11~28/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c openjdk-lts-11.0.2+9/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c --- openjdk-lts-11~28/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.base/windows/native/libnio/ch/DatagramDispatcher.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -95,6 +95,10 @@ jint fd = fdval(env, fdo); struct iovec *iovp = (struct iovec *)address; WSABUF *bufs = malloc(len * sizeof(WSABUF)); + if (bufs == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); + return IOS_THROWN; + } /* copy iovec into WSABUF */ for(i=0; i WAKEUP_SOCKET_BUF_SIZE) { char* buf = (char*)malloc(bytesToRead); + if (buf == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); + return; + } recv(scinFd, buf, bytesToRead, 0); free(buf); } else { diff -Nru openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java --- openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java 2019-01-18 04:23:48.000000000 +0000 @@ -165,8 +165,6 @@ : this; } } - // ignore focus "lost" native request as it may mistakenly - // deactivate active window (see 8001161) if (globalFocusedWindow == this) { responder.handleWindowFocusEvent(parentWindowActive, null); } @@ -181,4 +179,19 @@ // another window. return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true; } + + @Override + public void synthesizeWindowActivation(boolean doActivate) { + if (isParentWindowActive() != doActivate) { + handleWindowFocusEvent(doActivate); + } + } + + public static void updateGlobalFocusedWindow(CEmbeddedFrame newGlobalFocusedWindow) { + synchronized (classLock) { + if(newGlobalFocusedWindow.isParentWindowActive()) { + globalFocusedWindow = newGlobalFocusedWindow; + } + } + } } diff -Nru openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java --- openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java 2019-01-18 04:23:48.000000000 +0000 @@ -147,6 +147,8 @@ @Override public boolean requestWindowFocus() { + CEmbeddedFrame.updateGlobalFocusedWindow(target); + target.synthesizeWindowActivation(true); return true; } diff -Nru openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java --- openjdk-lts-11~28/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2019-01-18 04:23:48.000000000 +0000 @@ -1205,17 +1205,27 @@ } private void orderAboveSiblings() { - // Recursively pop up the windows from the very bottom, (i.e. root owner) so that - // the windows are ordered above their nearest owner; ancestors of the window, - // which is going to become 'main window', are placed above their siblings. CPlatformWindow rootOwner = getRootOwner(); - if (rootOwner.isVisible() && !rootOwner.isIconified()) { - rootOwner.execute(CWrapper.NSWindow::orderFront); - } + // Do not order child windows of iconified owner. if (!rootOwner.isIconified()) { final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); - orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target)); + Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target); + + // No need to order windows if it doesn't own other windows and hence return + if (windows.length == 0) { + return; + } + + // Recursively pop up the windows from the very bottom, (i.e. root owner) so that + // the windows are ordered above their nearest owner; ancestors of the window, + // which is going to become 'main window', are placed above their siblings. + if (rootOwner.isVisible()) { + rootOwner.execute(CWrapper.NSWindow::orderFront); + } + + // Order child windows. + orderAboveSiblingsImpl(windows); } } @@ -1276,6 +1286,21 @@ } } + private Window getOwnerFrameOrDialog(Window window) { + Window owner = window.getOwner(); + while(owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { + owner = owner.getOwner(); + } + return owner; + } + + private boolean isSimpleWindowOwnedByEmbeddedFrame() { + if (peer != null && peer.isSimpleWindow()) { + return (getOwnerFrameOrDialog(target) instanceof CEmbeddedFrame); + } + return false; + } + // ---------------------------------------------------------------------- // NATIVE CALLBACKS // ---------------------------------------------------------------------- diff -Nru openjdk-lts-11~28/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m openjdk-lts-11.0.2+9/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m --- openjdk-lts-11~28/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m 2019-01-18 04:23:48.000000000 +0000 @@ -537,10 +537,14 @@ } -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint { - if (((codePoint >= 0x3000) && (codePoint <= 0x303F)) || + if ((codePoint == 0x0024) || (codePoint == 0x00A3) || + (codePoint == 0x00A5) || + ((codePoint >= 0x20A3) && (codePoint <= 0x20BF)) || + ((codePoint >= 0x3000) && (codePoint <= 0x303F)) || ((codePoint >= 0xFF00) && (codePoint <= 0xFFEF))) { // Code point is in 'CJK Symbols and Punctuation' or - // 'Halfwidth and Fullwidth Forms' Unicode block. + // 'Halfwidth and Fullwidth Forms' Unicode block or + // currency symbols unicode return YES; } return NO; diff -Nru openjdk-lts-11~28/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m openjdk-lts-11.0.2+9/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m --- openjdk-lts-11~28/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m 2019-01-18 04:23:48.000000000 +0000 @@ -477,6 +477,21 @@ return isBlocked; } +// Test whether window is simple window and owned by embedded frame +- (BOOL) isSimpleWindowOwnedByEmbeddedFrame { + BOOL isSimpleWindowOwnedByEmbeddedFrame = NO; + + JNIEnv *env = [ThreadUtilities getJNIEnv]; + jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_isBlocked, jc_CPlatformWindow, "isSimpleWindowOwnedByEmbeddedFrame", "()Z"); + isSimpleWindowOwnedByEmbeddedFrame = JNFCallBooleanMethod(env, platformWindow, jm_isBlocked) == JNI_TRUE ? YES : NO; + (*env)->DeleteLocalRef(env, platformWindow); + } + + return isSimpleWindowOwnedByEmbeddedFrame; +} + // Tests whether the corresponding Java platform window is visible or not + (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window { BOOL isVisible = NO; @@ -543,7 +558,7 @@ // NSWindow overrides - (BOOL) canBecomeKeyWindow { AWT_ASSERT_APPKIT_THREAD; - return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY); + return self.isEnabled && (IS(self.styleBits, SHOULD_BECOME_KEY) || [self isSimpleWindowOwnedByEmbeddedFrame]); } - (BOOL) canBecomeMainWindow { diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java --- openjdk-lts-11~28/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2019-01-18 04:23:48.000000000 +0000 @@ -468,7 +468,7 @@ String text; pos = stream.getStreamPosition(); int textLength = (int)(chunkStart + chunkLength - pos); - if (textLength <= 0) { + if (textLength < 0) { throw new IIOException("iTXt chunk length is not proper"); } byte[] b = new byte[textLength]; @@ -571,7 +571,7 @@ private void parse_tEXt_chunk(int chunkLength) throws IOException { String keyword = readNullTerminatedString("ISO-8859-1", 80); int textLength = chunkLength - keyword.length() - 1; - if (textLength <= 0) { + if (textLength < 0) { throw new IIOException("tEXt chunk length is not proper"); } metadata.tEXt_keyword.add(keyword); @@ -669,7 +669,7 @@ private void parse_zTXt_chunk(int chunkLength) throws IOException { String keyword = readNullTerminatedString("ISO-8859-1", 80); int textLength = chunkLength - keyword.length() - 2; - if (textLength <= 0) { + if (textLength < 0) { throw new IIOException("zTXt chunk length is not proper"); } metadata.zTXt_keyword.add(keyword); diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java --- openjdk-lts-11~28/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -547,14 +547,15 @@ getEventDispatcher().addLineMonitor(this); } - doIO = true; - - // need to set Active and Started - // note: the current API always requires that - // Started and Active are set at the same time... - if (isSource && stoppedWritten) { - setStarted(true); - setActive(true); + synchronized(lock) { + doIO = true; + // need to set Active and Started + // note: the current API always requires that + // Started and Active are set at the same time... + if (isSource && stoppedWritten) { + setStarted(true); + setActive(true); + } } if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded"); @@ -582,10 +583,10 @@ // read/write thread, that's why isStartedRunning() // cannot be used doIO = false; + setActive(false); + setStarted(false); lock.notifyAll(); } - setActive(false); - setStarted(false); stoppedWritten = false; if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded"); @@ -731,12 +732,14 @@ if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } - - if (!isActive() && doIO) { - // this is not exactly correct... would be nicer - // if the native sub system sent a callback when IO really starts - setActive(true); - setStarted(true); + synchronized(lock) { + if (!isActive() && doIO) { + // this is not exactly correct... would be nicer + // if the native sub system sent a callback when IO really + // starts + setActive(true); + setStarted(true); + } } int written = 0; while (!flushing) { @@ -957,11 +960,14 @@ if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } - if (!isActive() && doIO) { - // this is not exactly correct... would be nicer - // if the native sub system sent a callback when IO really starts - setActive(true); - setStarted(true); + synchronized(lock) { + if (!isActive() && doIO) { + // this is not exactly correct... would be nicer + // if the native sub system sent a callback when IO really + // starts + setActive(true); + setStarted(true); + } } int read = 0; while (doIO && !flushing) { diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/java/awt/Robot.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/java/awt/Robot.java --- openjdk-lts-11~28/src/java.desktop/share/classes/java/awt/Robot.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/java/awt/Robot.java 2019-01-18 04:23:48.000000000 +0000 @@ -394,6 +394,7 @@ * @return Color of the pixel */ public synchronized Color getPixelColor(int x, int y) { + checkScreenCaptureAllowed(); AffineTransform tx = GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(). getDefaultConfiguration().getDefaultTransform(); diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java --- openjdk-lts-11~28/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/javax/swing/text/html/ImageView.java 2019-01-18 04:23:48.000000000 +0000 @@ -776,32 +776,10 @@ if (newWidth > 0) { newState |= WIDTH_FLAG; - if (newHeight <= 0) { - newHeight = newWidth; - newState |= HEIGHT_FLAG; - } } if (newHeight > 0) { newState |= HEIGHT_FLAG; - if (newWidth <= 0) { - newWidth = newHeight; - newState |= WIDTH_FLAG; - } - } - - if (newWidth <= 0) { - newWidth = newImage.getWidth(imageObserver); - if (newWidth <= 0) { - newWidth = DEFAULT_WIDTH; - } - } - - if (newHeight <= 0) { - newHeight = newImage.getHeight(imageObserver); - if (newHeight <= 0) { - newHeight = DEFAULT_HEIGHT; - } } // Make sure the image starts loading: @@ -965,6 +943,35 @@ changed |= 2; } + /** + * If the image properties (height and width) have been loaded, + * then figure out if scaling is necessary based on the + * specified HTML attributes. + */ + if (((flags & ImageObserver.HEIGHT) != 0) && + ((flags & ImageObserver.WIDTH) != 0)) { + double proportion = 0.0; + final int specifiedWidth = getIntAttr(HTML.Attribute.WIDTH, -1); + final int specifiedHeight = getIntAttr(HTML.Attribute.HEIGHT, -1); + /** + * If either of the attributes are not specified, then calculate the + * proportion for the specified dimension wrt actual value, and then + * apply the same proportion to the unspecified dimension as well, + * so that the aspect ratio of the image is maintained. + */ + if (specifiedWidth != -1 ^ specifiedHeight != -1) { + if (specifiedWidth <= 0) { + proportion = specifiedHeight / ((double)newHeight); + newWidth = (int)(proportion * newWidth); + } + + if (specifiedHeight <= 0) { + proportion = specifiedWidth / ((double)newWidth); + newHeight = (int)(proportion * newHeight); + } + changed |= 3; + } + } synchronized(ImageView.this) { if ((changed & 1) == 1 && (state & HEIGHT_FLAG) == 0) { height = newHeight; diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/font/CMap.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/font/CMap.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/font/CMap.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/font/CMap.java 2019-01-18 04:23:48.000000000 +0000 @@ -566,6 +566,7 @@ char getGlyph(int charCode) { + final int origCharCode = charCode; int index = 0; char glyphCode = 0; @@ -637,8 +638,8 @@ } } } - if (glyphCode != 0) { - //System.err.println("cc="+Integer.toHexString((int)charCode) + " gc="+(int)glyphCode); + if (glyphCode == 0) { + glyphCode = getFormatCharGlyph(origCharCode); } return glyphCode; } @@ -804,6 +805,7 @@ } char getGlyph(int charCode) { + final int origCharCode = charCode; int controlGlyph = getControlCodeGlyph(charCode, true); if (controlGlyph >= 0) { return (char)controlGlyph; @@ -859,7 +861,7 @@ return glyphCode; } } - return 0; + return getFormatCharGlyph(origCharCode); } } @@ -883,6 +885,7 @@ } char getGlyph(int charCode) { + final int origCharCode = charCode; int controlGlyph = getControlCodeGlyph(charCode, true); if (controlGlyph >= 0) { return (char)controlGlyph; @@ -894,7 +897,7 @@ charCode -= firstCode; if (charCode < 0 || charCode >= entryCount) { - return 0; + return getFormatCharGlyph(origCharCode); } else { return glyphIdArray[charCode]; } @@ -1032,6 +1035,7 @@ } char getGlyph(int charCode) { + final int origCharCode = charCode; int controlGlyph = getControlCodeGlyph(charCode, false); if (controlGlyph >= 0) { return (char)controlGlyph; @@ -1057,7 +1061,7 @@ (startGlyphID[range] + (charCode - startCharCode[range])); } - return 0; + return getFormatCharGlyph(origCharCode); } } @@ -1079,16 +1083,21 @@ case 0x000a: case 0x000d: return CharToGlyphMapper.INVISIBLE_GLYPH_ID; } - } else if (charCode >= 0x200c) { + } else if (noSurrogates && charCode >= 0xFFFF) { + return 0; + } + return -1; + } + + final char getFormatCharGlyph(int charCode) { + if (charCode >= 0x200c) { if ((charCode <= 0x200f) || (charCode >= 0x2028 && charCode <= 0x202e) || (charCode >= 0x206a && charCode <= 0x206f)) { - return CharToGlyphMapper.INVISIBLE_GLYPH_ID; - } else if (noSurrogates && charCode >= 0xFFFF) { - return 0; + return (char)CharToGlyphMapper.INVISIBLE_GLYPH_ID; } } - return -1; + return 0; } static class UVS { diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java 2019-01-18 04:23:48.000000000 +0000 @@ -31,6 +31,7 @@ import java.awt.geom.Path2D; import java.awt.geom.PathIterator; import java.security.AccessController; +import java.util.Arrays; import sun.awt.geom.PathConsumer2D; import static sun.java2d.marlin.MarlinUtils.logInfo; import sun.java2d.ReentrantContextProvider; @@ -334,7 +335,6 @@ int dashLen = -1; boolean recycleDashes = false; - double scale = 1.0d; double[] dashesD = null; // Ensure converting dashes to double precision: @@ -375,7 +375,7 @@ // a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we // leave a bit of room for error. if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) { - scale = Math.sqrt(a*a + c*c); + final double scale = Math.sqrt(a*a + c*c); if (dashesD != null) { for (int i = 0; i < dashLen; i++) { @@ -427,7 +427,7 @@ pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat); // stroker will adjust the clip rectangle (width / miter limit): - pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale, + pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, (dashesD == null)); // Curve Monotizer: @@ -834,10 +834,26 @@ // Define the initial clip bounds: final double[] clipRect = rdrCtx.clipRect; - clipRect[0] = clip.getLoY(); - clipRect[1] = clip.getLoY() + clip.getHeight(); - clipRect[2] = clip.getLoX(); - clipRect[3] = clip.getLoX() + clip.getWidth(); + // Adjust the clipping rectangle with the renderer offsets + final double rdrOffX = DRenderer.RDR_OFFSET_X; + final double rdrOffY = DRenderer.RDR_OFFSET_Y; + + // add a small rounding error: + final double margin = 1e-3d; + + clipRect[0] = clip.getLoY() + - margin + rdrOffY; + clipRect[1] = clip.getLoY() + clip.getHeight() + + margin + rdrOffY; + clipRect[2] = clip.getLoX() + - margin + rdrOffX; + clipRect[3] = clip.getLoX() + clip.getWidth() + + margin + rdrOffX; + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (clip): " + + Arrays.toString(rdrCtx.clipRect)); + } // Enable clipping: rdrCtx.doClip = true; diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java 2019-01-18 04:23:48.000000000 +0000 @@ -85,6 +85,8 @@ boolean closedPath = false; // clip rectangle (ymin, ymax, xmin, xmax): final double[] clipRect = new double[4]; + // clip inverse scale (mean) to adjust length checks + double clipInvScale = 0.0d; // CurveBasicMonotonizer instance final CurveBasicMonotonizer monotonizer; // CurveClipSplitter instance @@ -105,7 +107,6 @@ final PathConsumer2DAdapter p2dAdapter = new PathConsumer2DAdapter(); - /** * Constructor * @@ -162,6 +163,7 @@ stroking = 0; doClip = false; closedPath = false; + clipInvScale = 0.0d; // if context is maked as DIRTY: if (dirty) { diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java 2019-01-18 04:23:48.000000000 +0000 @@ -139,7 +139,6 @@ * JOIN_MITER, JOIN_ROUND or * JOIN_BEVEL. * @param miterLimit the desired miter limit - * @param scale scaling factor applied to clip boundaries * @param subdivideCurves true to indicate to subdivide curves, false if dasher does * @return this instance */ @@ -148,7 +147,6 @@ final int capStyle, final int joinStyle, final double miterLimit, - final double scale, final boolean subdivideCurves) { this.out = pc2d; @@ -169,7 +167,6 @@ if (rdrCtx.doClip) { // Adjust the clipping rectangle with the stroker margin (miter limit, width) - double rdrOffX = 0.0d, rdrOffY = 0.0d; double margin = lineWidth2; if (capStyle == CAP_SQUARE) { @@ -178,23 +175,21 @@ if ((joinStyle == JOIN_MITER) && (margin < limit)) { margin = limit; } - if (scale != 1.0d) { - margin *= scale; - rdrOffX = scale * DRenderer.RDR_OFFSET_X; - rdrOffY = scale * DRenderer.RDR_OFFSET_Y; - } - // add a small rounding error: - margin += 1e-3d; // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY // adjust clip rectangle (ymin, ymax, xmin, xmax): final double[] _clipRect = rdrCtx.clipRect; - _clipRect[0] -= margin - rdrOffY; - _clipRect[1] += margin + rdrOffY; - _clipRect[2] -= margin - rdrOffX; - _clipRect[3] += margin + rdrOffX; + _clipRect[0] -= margin; + _clipRect[1] += margin; + _clipRect[2] -= margin; + _clipRect[3] += margin; this.clipRect = _clipRect; + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (stroker): " + + Arrays.toString(rdrCtx.clipRect)); + } + // initialize curve splitter here for stroker & dasher: if (DO_CLIP_SUBDIVIDER) { subdivide = subdivideCurves; @@ -304,13 +299,9 @@ // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only // need 1 curve to approximate the circle section that joins omx,omy // and mx,my. - final int numCurves = (cosext >= 0.0d) ? 1 : 2; - - switch (numCurves) { - case 1: + if (cosext >= 0.0d) { drawBezApproxForArc(cx, cy, omx, omy, mx, my, rev); - break; - case 2: + } else { // we need to split the arc into 2 arcs spanning the same angle. // The point we want will be one of the 2 intersections of the // perpendicular bisector of the chord (omx,omy)->(mx,my) and the @@ -339,8 +330,6 @@ } drawBezApproxForArc(cx, cy, omx, omy, mmx, mmy, rev); drawBezApproxForArc(cx, cy, mmx, mmy, mx, my, rev); - break; - default: } } diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java 2019-01-18 04:23:48.000000000 +0000 @@ -119,44 +119,56 @@ // Scale only if (rdrCtx.doClip) { // adjust clip rectangle (ymin, ymax, xmin, xmax): - adjustClipScale(rdrCtx.clipRect, mxx, myy); + rdrCtx.clipInvScale = adjustClipScale(rdrCtx.clipRect, + mxx, myy); } return dt_DeltaScaleFilter.init(out, mxx, myy); } } else { if (rdrCtx.doClip) { // adjust clip rectangle (ymin, ymax, xmin, xmax): - adjustClipInverseDelta(rdrCtx.clipRect, mxx, mxy, myx, myy); + rdrCtx.clipInvScale = adjustClipInverseDelta(rdrCtx.clipRect, + mxx, mxy, myx, myy); } return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy); } } - private static void adjustClipOffset(final double[] clipRect) { - clipRect[0] += Renderer.RDR_OFFSET_Y; - clipRect[1] += Renderer.RDR_OFFSET_Y; - clipRect[2] += Renderer.RDR_OFFSET_X; - clipRect[3] += Renderer.RDR_OFFSET_X; - } - - private static void adjustClipScale(final double[] clipRect, - final double mxx, final double myy) + private static double adjustClipScale(final double[] clipRect, + final double mxx, final double myy) { - adjustClipOffset(clipRect); - // Adjust the clipping rectangle (iv_DeltaScaleFilter): - clipRect[0] /= myy; - clipRect[1] /= myy; - clipRect[2] /= mxx; - clipRect[3] /= mxx; + final double scaleY = 1.0d / myy; + clipRect[0] *= scaleY; + clipRect[1] *= scaleY; + + if (clipRect[1] < clipRect[0]) { + double tmp = clipRect[0]; + clipRect[0] = clipRect[1]; + clipRect[1] = tmp; + } + + final double scaleX = 1.0d / mxx; + clipRect[2] *= scaleX; + clipRect[3] *= scaleX; + + if (clipRect[3] < clipRect[2]) { + double tmp = clipRect[2]; + clipRect[2] = clipRect[3]; + clipRect[3] = tmp; + } + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (ClipScale): " + + Arrays.toString(clipRect)); + } + return 0.5d * (Math.abs(scaleX) + Math.abs(scaleY)); } - private static void adjustClipInverseDelta(final double[] clipRect, - final double mxx, final double mxy, - final double myx, final double myy) + private static double adjustClipInverseDelta(final double[] clipRect, + final double mxx, final double mxy, + final double myx, final double myy) { - adjustClipOffset(clipRect); - // Adjust the clipping rectangle (iv_DeltaTransformFilter): final double det = mxx * myy - mxy * myx; final double imxx = myy / det; @@ -198,6 +210,16 @@ clipRect[1] = ymax; clipRect[2] = xmin; clipRect[3] = xmax; + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (ClipInverseDelta): " + + Arrays.toString(clipRect)); + } + + final double scaleX = Math.sqrt(imxx * imxx + imxy * imxy); + final double scaleY = Math.sqrt(imyx * imyx + imyy * imyy); + + return 0.5d * (scaleX + scaleY); } DPathConsumer2D inverseDeltaTransformConsumer(DPathConsumer2D out, @@ -215,7 +237,7 @@ if (mxx == 1.0d && myy == 1.0d) { return out; } else { - return iv_DeltaScaleFilter.init(out, 1.0d/mxx, 1.0d/myy); + return iv_DeltaScaleFilter.init(out, 1.0d / mxx, 1.0d / myy); } } else { final double det = mxx * myy - mxy * myx; @@ -532,19 +554,6 @@ PathClipFilter init(final DPathConsumer2D out) { this.out = out; - // Adjust the clipping rectangle with the renderer offsets - final double rdrOffX = DRenderer.RDR_OFFSET_X; - final double rdrOffY = DRenderer.RDR_OFFSET_Y; - - // add a small rounding error: - final double margin = 1e-3d; - - final double[] _clipRect = this.clipRect; - _clipRect[0] -= margin - rdrOffY; - _clipRect[1] += margin + rdrOffY; - _clipRect[2] -= margin - rdrOffX; - _clipRect[3] += margin + rdrOffX; - if (MarlinConst.DO_CLIP_SUBDIVIDER) { // adjust padded clip rectangle: curveSplitter.init(); @@ -867,6 +876,11 @@ private static final int MAX_N_CURVES = 3 * 4; + private final DRendererContext rdrCtx; + + // scaled length threshold: + private double minLength; + // clip rectangle (ymin, ymax, xmin, xmax): final double[] clipRect; @@ -884,12 +898,23 @@ private final DCurve curve; CurveClipSplitter(final DRendererContext rdrCtx) { + this.rdrCtx = rdrCtx; this.clipRect = rdrCtx.clipRect; this.curve = rdrCtx.curve; } void init() { this.init_clipRectPad = true; + + if (DO_CHECK_LENGTH) { + this.minLength = (this.rdrCtx.clipInvScale == 0.0d) ? LEN_TH + : (LEN_TH * this.rdrCtx.clipInvScale); + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("CurveClipSplitter.minLength = " + + minLength); + } + } } private void initPaddedClip() { @@ -906,7 +931,7 @@ if (TRACE) { MarlinUtils.logInfo("clip: X [" + _clipRectPad[2] + " .. " + _clipRectPad[3] +"] " - + "Y ["+ _clipRectPad[0] + " .. " + _clipRectPad[1] +"]"); + + "Y [" + _clipRectPad[0] + " .. " + _clipRectPad[1] +"]"); } } @@ -919,7 +944,7 @@ MarlinUtils.logInfo("divLine P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ")"); } - if (DO_CHECK_LENGTH && DHelpers.fastLineLen(x0, y0, x1, y1) <= LEN_TH) { + if (DO_CHECK_LENGTH && DHelpers.fastLineLen(x0, y0, x1, y1) <= minLength) { return false; } @@ -940,7 +965,7 @@ MarlinUtils.logInfo("divQuad P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ")"); } - if (DO_CHECK_LENGTH && DHelpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= LEN_TH) { + if (DO_CHECK_LENGTH && DHelpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= minLength) { return false; } @@ -963,7 +988,7 @@ MarlinUtils.logInfo("divCurve P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ") P3(" + x3 + ", " + y3 + ")"); } - if (DO_CHECK_LENGTH && DHelpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= LEN_TH) { + if (DO_CHECK_LENGTH && DHelpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= minLength) { return false; } @@ -991,8 +1016,8 @@ outCodeOR, clipRectPad); if (TRACE) { - MarlinUtils.logInfo("nSplits: "+ nSplits); - MarlinUtils.logInfo("subTs: "+Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits))); + MarlinUtils.logInfo("nSplits: " + nSplits); + MarlinUtils.logInfo("subTs: " + Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits))); } if (nSplits == 0) { // only curve support shortcut @@ -1010,7 +1035,7 @@ for (int i = 0, off = 0; i <= nSplits; i++, off += type) { if (TRACE) { - MarlinUtils.logInfo("Part Curve "+Arrays.toString(Arrays.copyOfRange(mid, off, off + type))); + MarlinUtils.logInfo("Part Curve " + Arrays.toString(Arrays.copyOfRange(mid, off, off + type))); } emitCurrent(type, mid, off, out); } diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java 2019-01-18 04:23:48.000000000 +0000 @@ -82,11 +82,11 @@ static final boolean DO_CLIP_SUBDIVIDER = MarlinProperties.isDoClipSubdivider(); - // flag to enable logs related bounds checks + // flag to enable logs related to bounds checks static final boolean DO_LOG_BOUNDS = ENABLE_LOGS && false; - // flag to enable float precision correction - static final boolean DO_FIX_FLOAT_PREC = true; + // flag to enable logs related to clip rect + static final boolean DO_LOG_CLIP = ENABLE_LOGS && false; // Initial Array sizing (initial context capacity) ~ 450K diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java 2019-01-18 04:23:48.000000000 +0000 @@ -31,6 +31,7 @@ import java.awt.geom.Path2D; import java.awt.geom.PathIterator; import java.security.AccessController; +import java.util.Arrays; import static sun.java2d.marlin.MarlinUtils.logInfo; import sun.awt.geom.PathConsumer2D; import sun.java2d.ReentrantContextProvider; @@ -333,7 +334,6 @@ int dashLen = -1; boolean recycleDashes = false; - float scale = 1.0f; if (at != null && !at.isIdentity()) { final double a = at.getScaleX(); @@ -366,7 +366,7 @@ // a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we // leave a bit of room for error. if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) { - scale = (float) Math.sqrt(a*a + c*c); + final float scale = (float) Math.sqrt(a*a + c*c); if (dashes != null) { recycleDashes = true; @@ -421,7 +421,7 @@ pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat); // stroker will adjust the clip rectangle (width / miter limit): - pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale, + pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, (dashes == null)); // Curve Monotizer: @@ -831,10 +831,26 @@ // Define the initial clip bounds: final float[] clipRect = rdrCtx.clipRect; - clipRect[0] = clip.getLoY(); - clipRect[1] = clip.getLoY() + clip.getHeight(); - clipRect[2] = clip.getLoX(); - clipRect[3] = clip.getLoX() + clip.getWidth(); + // Adjust the clipping rectangle with the renderer offsets + final float rdrOffX = Renderer.RDR_OFFSET_X; + final float rdrOffY = Renderer.RDR_OFFSET_Y; + + // add a small rounding error: + final float margin = 1e-3f; + + clipRect[0] = clip.getLoY() + - margin + rdrOffY; + clipRect[1] = clip.getLoY() + clip.getHeight() + + margin + rdrOffY; + clipRect[2] = clip.getLoX() + - margin + rdrOffX; + clipRect[3] = clip.getLoX() + clip.getWidth() + + margin + rdrOffX; + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (clip): " + + Arrays.toString(rdrCtx.clipRect)); + } // Enable clipping: rdrCtx.doClip = true; diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java 2019-01-18 04:23:48.000000000 +0000 @@ -85,6 +85,8 @@ boolean closedPath = false; // clip rectangle (ymin, ymax, xmin, xmax): final float[] clipRect = new float[4]; + // clip inverse scale (mean) to adjust length checks + float clipInvScale = 0.0f; // CurveBasicMonotonizer instance final CurveBasicMonotonizer monotonizer; // CurveClipSplitter instance @@ -159,6 +161,7 @@ stroking = 0; doClip = false; closedPath = false; + clipInvScale = 0.0f; // if context is maked as DIRTY: if (dirty) { diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java 2019-01-18 04:23:48.000000000 +0000 @@ -141,7 +141,6 @@ * JOIN_MITER, JOIN_ROUND or * JOIN_BEVEL. * @param miterLimit the desired miter limit - * @param scale scaling factor applied to clip boundaries * @param subdivideCurves true to indicate to subdivide curves, false if dasher does * @return this instance */ @@ -150,7 +149,6 @@ final int capStyle, final int joinStyle, final float miterLimit, - final float scale, final boolean subdivideCurves) { this.out = pc2d; @@ -171,7 +169,6 @@ if (rdrCtx.doClip) { // Adjust the clipping rectangle with the stroker margin (miter limit, width) - float rdrOffX = 0.0f, rdrOffY = 0.0f; float margin = lineWidth2; if (capStyle == CAP_SQUARE) { @@ -180,23 +177,21 @@ if ((joinStyle == JOIN_MITER) && (margin < limit)) { margin = limit; } - if (scale != 1.0f) { - margin *= scale; - rdrOffX = scale * Renderer.RDR_OFFSET_X; - rdrOffY = scale * Renderer.RDR_OFFSET_Y; - } - // add a small rounding error: - margin += 1e-3f; // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY // adjust clip rectangle (ymin, ymax, xmin, xmax): final float[] _clipRect = rdrCtx.clipRect; - _clipRect[0] -= margin - rdrOffY; - _clipRect[1] += margin + rdrOffY; - _clipRect[2] -= margin - rdrOffX; - _clipRect[3] += margin + rdrOffX; + _clipRect[0] -= margin; + _clipRect[1] += margin; + _clipRect[2] -= margin; + _clipRect[3] += margin; this.clipRect = _clipRect; + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (stroker): " + + Arrays.toString(rdrCtx.clipRect)); + } + // initialize curve splitter here for stroker & dasher: if (DO_CLIP_SUBDIVIDER) { subdivide = subdivideCurves; @@ -306,13 +301,9 @@ // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only // need 1 curve to approximate the circle section that joins omx,omy // and mx,my. - final int numCurves = (cosext >= 0.0f) ? 1 : 2; - - switch (numCurves) { - case 1: + if (cosext >= 0.0f) { drawBezApproxForArc(cx, cy, omx, omy, mx, my, rev); - break; - case 2: + } else { // we need to split the arc into 2 arcs spanning the same angle. // The point we want will be one of the 2 intersections of the // perpendicular bisector of the chord (omx,omy)->(mx,my) and the @@ -341,8 +332,6 @@ } drawBezApproxForArc(cx, cy, omx, omy, mmx, mmy, rev); drawBezApproxForArc(cx, cy, mmx, mmy, mx, my, rev); - break; - default: } } diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java 2019-01-18 04:23:48.000000000 +0000 @@ -120,44 +120,56 @@ // Scale only if (rdrCtx.doClip) { // adjust clip rectangle (ymin, ymax, xmin, xmax): - adjustClipScale(rdrCtx.clipRect, mxx, myy); + rdrCtx.clipInvScale = adjustClipScale(rdrCtx.clipRect, + mxx, myy); } return dt_DeltaScaleFilter.init(out, mxx, myy); } } else { if (rdrCtx.doClip) { // adjust clip rectangle (ymin, ymax, xmin, xmax): - adjustClipInverseDelta(rdrCtx.clipRect, mxx, mxy, myx, myy); + rdrCtx.clipInvScale = adjustClipInverseDelta(rdrCtx.clipRect, + mxx, mxy, myx, myy); } return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy); } } - private static void adjustClipOffset(final float[] clipRect) { - clipRect[0] += Renderer.RDR_OFFSET_Y; - clipRect[1] += Renderer.RDR_OFFSET_Y; - clipRect[2] += Renderer.RDR_OFFSET_X; - clipRect[3] += Renderer.RDR_OFFSET_X; - } - - private static void adjustClipScale(final float[] clipRect, - final float mxx, final float myy) + private static float adjustClipScale(final float[] clipRect, + final float mxx, final float myy) { - adjustClipOffset(clipRect); - // Adjust the clipping rectangle (iv_DeltaScaleFilter): - clipRect[0] /= myy; - clipRect[1] /= myy; - clipRect[2] /= mxx; - clipRect[3] /= mxx; + final float scaleY = 1.0f / myy; + clipRect[0] *= scaleY; + clipRect[1] *= scaleY; + + if (clipRect[1] < clipRect[0]) { + float tmp = clipRect[0]; + clipRect[0] = clipRect[1]; + clipRect[1] = tmp; + } + + final float scaleX = 1.0f / mxx; + clipRect[2] *= scaleX; + clipRect[3] *= scaleX; + + if (clipRect[3] < clipRect[2]) { + float tmp = clipRect[2]; + clipRect[2] = clipRect[3]; + clipRect[3] = tmp; + } + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (ClipScale): " + + Arrays.toString(clipRect)); + } + return 0.5f * (Math.abs(scaleX) + Math.abs(scaleY)); } - private static void adjustClipInverseDelta(final float[] clipRect, - final float mxx, final float mxy, - final float myx, final float myy) + private static float adjustClipInverseDelta(final float[] clipRect, + final float mxx, final float mxy, + final float myx, final float myy) { - adjustClipOffset(clipRect); - // Adjust the clipping rectangle (iv_DeltaTransformFilter): final float det = mxx * myy - mxy * myx; final float imxx = myy / det; @@ -199,6 +211,16 @@ clipRect[1] = ymax; clipRect[2] = xmin; clipRect[3] = xmax; + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("clipRect (ClipInverseDelta): " + + Arrays.toString(clipRect)); + } + + final float scaleX = (float) Math.sqrt(imxx * imxx + imxy * imxy); + final float scaleY = (float) Math.sqrt(imyx * imyx + imyy * imyy); + + return 0.5f * (scaleX + scaleY); } PathConsumer2D inverseDeltaTransformConsumer(PathConsumer2D out, @@ -216,7 +238,7 @@ if (mxx == 1.0f && myy == 1.0f) { return out; } else { - return iv_DeltaScaleFilter.init(out, 1.0f/mxx, 1.0f/myy); + return iv_DeltaScaleFilter.init(out, 1.0f / mxx, 1.0f / myy); } } else { final float det = mxx * myy - mxy * myx; @@ -533,19 +555,6 @@ PathClipFilter init(final PathConsumer2D out) { this.out = out; - // Adjust the clipping rectangle with the renderer offsets - final float rdrOffX = Renderer.RDR_OFFSET_X; - final float rdrOffY = Renderer.RDR_OFFSET_Y; - - // add a small rounding error: - final float margin = 1e-3f; - - final float[] _clipRect = this.clipRect; - _clipRect[0] -= margin - rdrOffY; - _clipRect[1] += margin + rdrOffY; - _clipRect[2] -= margin - rdrOffX; - _clipRect[3] += margin + rdrOffX; - if (MarlinConst.DO_CLIP_SUBDIVIDER) { // adjust padded clip rectangle: curveSplitter.init(); @@ -868,6 +877,11 @@ private static final int MAX_N_CURVES = 3 * 4; + private final RendererContext rdrCtx; + + // scaled length threshold: + private float minLength; + // clip rectangle (ymin, ymax, xmin, xmax): final float[] clipRect; @@ -885,12 +899,23 @@ private final Curve curve; CurveClipSplitter(final RendererContext rdrCtx) { + this.rdrCtx = rdrCtx; this.clipRect = rdrCtx.clipRect; this.curve = rdrCtx.curve; } void init() { this.init_clipRectPad = true; + + if (DO_CHECK_LENGTH) { + this.minLength = (this.rdrCtx.clipInvScale == 0.0f) ? LEN_TH + : (LEN_TH * this.rdrCtx.clipInvScale); + + if (MarlinConst.DO_LOG_CLIP) { + MarlinUtils.logInfo("CurveClipSplitter.minLength = " + + minLength); + } + } } private void initPaddedClip() { @@ -907,7 +932,7 @@ if (TRACE) { MarlinUtils.logInfo("clip: X [" + _clipRectPad[2] + " .. " + _clipRectPad[3] +"] " - + "Y ["+ _clipRectPad[0] + " .. " + _clipRectPad[1] +"]"); + + "Y [" + _clipRectPad[0] + " .. " + _clipRectPad[1] +"]"); } } @@ -920,7 +945,7 @@ MarlinUtils.logInfo("divLine P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ")"); } - if (DO_CHECK_LENGTH && Helpers.fastLineLen(x0, y0, x1, y1) <= LEN_TH) { + if (DO_CHECK_LENGTH && Helpers.fastLineLen(x0, y0, x1, y1) <= minLength) { return false; } @@ -941,7 +966,7 @@ MarlinUtils.logInfo("divQuad P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ")"); } - if (DO_CHECK_LENGTH && Helpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= LEN_TH) { + if (DO_CHECK_LENGTH && Helpers.fastQuadLen(x0, y0, x1, y1, x2, y2) <= minLength) { return false; } @@ -964,7 +989,7 @@ MarlinUtils.logInfo("divCurve P0(" + x0 + ", " + y0 + ") P1(" + x1 + ", " + y1 + ") P2(" + x2 + ", " + y2 + ") P3(" + x3 + ", " + y3 + ")"); } - if (DO_CHECK_LENGTH && Helpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= LEN_TH) { + if (DO_CHECK_LENGTH && Helpers.fastCurvelen(x0, y0, x1, y1, x2, y2, x3, y3) <= minLength) { return false; } @@ -992,8 +1017,8 @@ outCodeOR, clipRectPad); if (TRACE) { - MarlinUtils.logInfo("nSplits: "+ nSplits); - MarlinUtils.logInfo("subTs: "+Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits))); + MarlinUtils.logInfo("nSplits: " + nSplits); + MarlinUtils.logInfo("subTs: " + Arrays.toString(Arrays.copyOfRange(subTs, 0, nSplits))); } if (nSplits == 0) { // only curve support shortcut @@ -1011,7 +1036,7 @@ for (int i = 0, off = 0; i <= nSplits; i++, off += type) { if (TRACE) { - MarlinUtils.logInfo("Part Curve "+Arrays.toString(Arrays.copyOfRange(mid, off, off + type))); + MarlinUtils.logInfo("Part Curve " + Arrays.toString(Arrays.copyOfRange(mid, off, off + type))); } emitCurrent(type, mid, off, out); } diff -Nru openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/Version.java openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/Version.java --- openjdk-lts-11~28/src/java.desktop/share/classes/sun/java2d/marlin/Version.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/classes/sun/java2d/marlin/Version.java 2019-01-18 04:23:48.000000000 +0000 @@ -27,7 +27,7 @@ public final class Version { - private static final String VERSION = "marlin-0.9.1-Unsafe-OpenJDK"; + private static final String VERSION = "marlin-0.9.1.1-Unsafe-OpenJDK"; public static String getVersion() { return VERSION; diff -Nru openjdk-lts-11~28/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c openjdk-lts-11.0.2+9/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c --- openjdk-lts-11~28/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -259,18 +259,18 @@ } #ifdef _LITTLE_ENDIAN - emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8); #else - emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8); #endif /* _LITTLE_ENDIAN */ ((mlib_u32*)da)[0] = (val1 & emask) | (((mlib_u32*)da)[0] &~ emask); #else /* _NO_LONGLONG */ #ifdef _LITTLE_ENDIAN - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = (~(mlib_u64)0) >> ((8 - (size - i)) * 8); #else - mlib_u64 emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8); + mlib_u64 emask = (~(mlib_u64)0) << ((8 - (size - i)) * 8); #endif /* _LITTLE_ENDIAN */ ((mlib_u64*)da)[0] = (((mlib_u64*)dd_array)[sa[0]] & emask) | (((mlib_u64*)da)[0] &~ emask); @@ -395,9 +395,9 @@ } #ifdef _LITTLE_ENDIAN - emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8); #else - emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8); #endif /* _LITTLE_ENDIAN */ ((mlib_u32*)da)[0] = (dd1 & emask) | (((mlib_u32*)da)[0] &~ emask); @@ -413,9 +413,9 @@ } #ifdef _LITTLE_ENDIAN - emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + emask = (~(mlib_u64)0) >> ((8 - (size - i)) * 8); #else - emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8); + emask = (~(mlib_u64)0) << ((8 - (size - i)) * 8); #endif /* _LITTLE_ENDIAN */ ((mlib_u64*)da)[0] = (dd & emask) | (((mlib_u64*)da)[0] &~ emask); @@ -565,9 +565,9 @@ } #ifdef _LITTLE_ENDIAN - emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8); #else - emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8); + emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8); #endif /* _LITTLE_ENDIAN */ da[0] = (dd & emask) | (da[0] &~ emask); } diff -Nru openjdk-lts-11~28/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java openjdk-lts-11.0.2+9/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java --- openjdk-lts-11~28/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -215,6 +215,12 @@ static long awt_defaultFg; // Pixel private static XMouseInfoPeer xPeer; + /** + * Should we check "_NET_WM_STRUT/_NET_WM_STRUT_PARTIAL" during insets + * calculation. + */ + private static Boolean checkSTRUT; + static { initSecurityWarning(); if (GraphicsEnvironment.isHeadless()) { @@ -826,13 +832,26 @@ } /* - * If we're running in non-Xinerama environment and the current - * window manager supports _NET protocol then the screen insets - * are calculated using _NET_WM_WORKAREA property of the root - * window. - * Otherwise, i. e. if Xinerama is on or _NET_WM_WORKAREA is - * not set, we try to calculate the insets ourselves using - * getScreenInsetsManually method. + * If the current window manager supports _NET protocol then the screen + * insets are calculated using _NET_WORKAREA property of the root window. + *

+ * Note that _NET_WORKAREA is a rectangular area and it does not work + * well in the Xinerama mode. + *

+ * We will trust the part of this rectangular area only if it starts at the + * requested graphics configuration. Below is an example when the + * _NET_WORKAREA intersects with the requested graphics configuration but + * produces wrong result. + * + * //<-x1,y1/////// + * // // //////////////// + * // SCREEN1 // // SCREEN2 // + * // ********** // // x2,y2->// + * //////////////// // // + * //////////////// + * + * When two screens overlap and the first contains a dock(*****), then + * _NET_WORKAREA may start at point x1,y1 and end at point x2,y2. */ @Override public Insets getScreenInsets(GraphicsConfiguration gc) @@ -846,30 +865,33 @@ XToolkit.awtLock(); try { - X11GraphicsConfig x11gc = (X11GraphicsConfig)gc; - X11GraphicsDevice x11gd = x11gc.getDevice(); - long root = XlibUtil.getRootWindow(x11gd.getScreen()); - int scale = x11gc.getScale(); - Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale); - X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) - GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (!x11ge.runningXinerama()) - { - Insets screenInsets = getInsets(root, rootBounds, scale); - if (screenInsets != null) return screenInsets; - } - - Insets insets = getScreenInsetsManually(root, rootBounds, - gc.getBounds(), scale); - if ((insets.left | insets.top | insets.bottom | insets.right) == 0 - && rootBounds != null ) { - root = XlibWrapper.RootWindow(XToolkit.getDisplay(), - x11gd.getScreen()); - Insets screenInsets = getInsets(root, rootBounds, scale); - if (screenInsets != null) return screenInsets; + GraphicsEnvironment.getLocalGraphicsEnvironment(); + X11GraphicsConfig x11gc = (X11GraphicsConfig) gc; + long root = XlibUtil.getRootWindow(x11gc.getDevice().getScreen()); + int scale = x11gc.getScale(); + if (x11ge.runningXinerama() && checkSTRUT()) { + // implementation based on _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL + Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale); + Insets insets = getScreenInsetsManually(root, rootBounds, + gc.getBounds(), scale); + if ((insets.left | insets.top | insets.bottom | insets.right) != 0 + || rootBounds == null) { + return insets; + } + } + Rectangle workArea = XToolkit.getWorkArea(root, scale); + Rectangle screen = gc.getBounds(); + if (workArea != null && screen.contains(workArea.getLocation())) { + workArea = workArea.intersection(screen); + int top = workArea.y - screen.y; + int left = workArea.x - screen.x; + int bottom = screen.height - workArea.height - top; + int right = screen.width - workArea.width - left; + return new Insets(top, left, bottom, right); } - return insets; + // Note that it is better to return zeros than inadequate values + return new Insets(0, 0, 0, 0); } finally { @@ -877,14 +899,16 @@ } } - private Insets getInsets(long root, Rectangle rootBounds, int scale) { - Rectangle workArea = XToolkit.getWorkArea(root, scale); - if (workArea == null) { - return null; + /** + * Returns the value of "sun.awt.X11.checkSTRUT" property. Default value is + * {@code false}. + */ + private static boolean checkSTRUT() { + if (checkSTRUT == null) { + checkSTRUT = AccessController.doPrivileged( + new GetBooleanAction("sun.awt.X11.checkSTRUT")); } - return new Insets(workArea.y, workArea.x, - rootBounds.height - workArea.height - workArea.y, - rootBounds.width - workArea.width - workArea.x); + return checkSTRUT; } /* @@ -893,6 +917,14 @@ * hints' values to screen insets. * * This method should be called under XToolkit.awtLock() + * + * This method is unused by default because of two reasons: + * - Iteration over windows may be extremely slow, and execution of + * getScreenInsets() can be x100 slower than in one monitor config. + * - _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL are hints for the applications. + * WM should take into account these hints when "_NET_WORKAREA" is + * calculated, but the system panels do not necessarily contain these + * hints(Gnome 3 for example). */ private Insets getScreenInsetsManually(long root, Rectangle rootBounds, Rectangle screenBounds, int scale) diff -Nru openjdk-lts-11~28/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c openjdk-lts-11.0.2+9/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c --- openjdk-lts-11~28/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -161,6 +161,7 @@ int len; char *stock_id_str = NULL; char *detail_str = NULL; + jboolean result = JNI_FALSE; if (stock_id == NULL) { @@ -183,25 +184,22 @@ detail_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(char), len + 1); if (detail_str == NULL) { + free(stock_id_str); JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError"); return JNI_FALSE; } (*env)->GetStringUTFRegion(env, detail, 0, len, detail_str); } - if (!init_method(env, this) ) { - return JNI_FALSE; + if (init_method(env, this)) { + result = gtk->get_icon_data(env, widget_type, stock_id_str, + icon_size, text_direction, detail_str, + icon_upcall_method, this); } - jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str, - icon_size, text_direction, detail_str, - icon_upcall_method, this); - /* Release the strings we've allocated. */ free(stock_id_str); - if (detail_str != NULL) - { - free(detail_str); - } + free(detail_str); + return result; #else /* HEADLESS */ return JNI_FALSE; diff -Nru openjdk-lts-11~28/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c openjdk-lts-11.0.2+9/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c --- openjdk-lts-11~28/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c 2019-01-18 04:23:48.000000000 +0000 @@ -66,6 +66,9 @@ NativeScalerContext *context = (NativeScalerContext*)malloc(sizeof(NativeScalerContext)); + if (context == NULL) { + return (jlong)(uintptr_t)0L; + } context->xFont = NULL; context->minGlyph = 0; context->maxGlyph = 0; @@ -92,6 +95,10 @@ (*env)->GetByteArrayRegion(env, xlfdBytes, 0, len, (jbyte*)xlfd); xlfd[len] = '\0'; context = (NativeScalerContext*)malloc(sizeof(NativeScalerContext)); + if (context == NULL) { + free(xlfd); + return (jlong)(uintptr_t)0L; + } AWTLoadFont (xlfd, &(context->xFont)); free(xlfd); @@ -232,10 +239,15 @@ Java_sun_font_NativeFont_getGlyphAdvance (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) { - NativeScalerContext *context = (NativeScalerContext*)pScalerContext; - AWTFont xFont = (AWTFont)context->xFont; AWTChar xcs = NULL; jfloat advance = 0.0f; + AWTFont xFont; + NativeScalerContext *context = (NativeScalerContext*)pScalerContext; + if (context == NULL) { + return advance; + } else { + xFont = (AWTFont)context->xFont; + } if (xFont == NULL || context->ptSize == NO_POINTSIZE) { return advance; @@ -271,9 +283,14 @@ Java_sun_font_NativeFont_getGlyphImageNoDefault (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) { - NativeScalerContext *context = (NativeScalerContext*)pScalerContext; - AWTFont xFont = context->xFont; AWTChar2b xChar; + AWTFont xFont; + NativeScalerContext *context = (NativeScalerContext*)pScalerContext; + if (context == NULL) { + return (jlong)0; + } else { + xFont = (AWTFont)context->xFont; + } if (xFont == NULL || context->ptSize == NO_POINTSIZE) { return (jlong)0; @@ -292,9 +309,14 @@ Java_sun_font_NativeFont_getGlyphImage (JNIEnv *env, jobject font2D, jlong pScalerContext, jint glyphCode) { - NativeScalerContext *context = (NativeScalerContext*)pScalerContext; - AWTFont xFont = context->xFont; AWTChar2b xChar; + AWTFont xFont; + NativeScalerContext *context = (NativeScalerContext*)pScalerContext; + if (context == NULL) { + return (jlong)0; + } else { + xFont = (AWTFont)context->xFont; + } if (xFont == NULL || context->ptSize == NO_POINTSIZE) { return (jlong)0; @@ -313,10 +335,15 @@ Java_sun_font_NativeFont_getFontMetrics (JNIEnv *env, jobject font2D, jlong pScalerContext) { - NativeScalerContext *context = (NativeScalerContext*)pScalerContext; - AWTFont xFont = (AWTFont)context->xFont; jfloat j0=0, j1=1, ay=j0, dy=j0, mx=j0; jobject metrics; + AWTFont xFont; + NativeScalerContext *context = (NativeScalerContext*)pScalerContext; + if (context == NULL) { + return NULL; + } else { + xFont = (AWTFont)context->xFont; + } if (xFont == NULL) { return NULL; diff -Nru openjdk-lts-11~28/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java openjdk-lts-11.0.2+9/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java --- openjdk-lts-11~28/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2019-01-18 04:23:48.000000000 +0000 @@ -736,7 +736,7 @@ } try { - return invoke(new Callable() { + File[] files = invoke(new Callable() { public File[] call() throws InterruptedException { if (!isDirectory()) { return null; @@ -791,6 +791,8 @@ : list.toArray(new ShellFolder[list.size()]); } }, InterruptedException.class); + + return Win32ShellFolderManager2.checkFiles(files); } catch (InterruptedException e) { return new File[0]; } diff -Nru openjdk-lts-11~28/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java openjdk-lts-11.0.2+9/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java --- openjdk-lts-11~28/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -387,21 +387,30 @@ return null; } - private File checkFile(File file) { + private static File checkFile(File file) { SecurityManager sm = System.getSecurityManager(); return (sm == null || file == null) ? file : checkFile(file, sm); } - private File checkFile(File file, SecurityManager sm) { + private static File checkFile(File file, SecurityManager sm) { try { sm.checkRead(file.getPath()); + + if (file instanceof Win32ShellFolder2) { + Win32ShellFolder2 f = (Win32ShellFolder2)file; + if (f.isLink()) { + Win32ShellFolder2 link = (Win32ShellFolder2)f.getLinkLocation(); + if (link != null) + sm.checkRead(link.getPath()); + } + } return file; } catch (SecurityException se) { return null; } } - private File[] checkFiles(File[] files) { + static File[] checkFiles(File[] files) { SecurityManager sm = System.getSecurityManager(); if (sm == null || files == null || files.length == 0) { return files; @@ -409,7 +418,7 @@ return checkFiles(Arrays.stream(files), sm); } - private File[] checkFiles(List files) { + private static File[] checkFiles(List files) { SecurityManager sm = System.getSecurityManager(); if (sm == null || files.isEmpty()) { return files.toArray(new File[files.size()]); @@ -417,7 +426,7 @@ return checkFiles(files.stream(), sm); } - private File[] checkFiles(Stream filesStream, SecurityManager sm) { + private static File[] checkFiles(Stream filesStream, SecurityManager sm) { return filesStream.filter((file) -> checkFile(file, sm) != null) .toArray(File[]::new); } diff -Nru openjdk-lts-11~28/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp --- openjdk-lts-11~28/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -962,9 +962,10 @@ if (!present) { defIndices[0] = papers[0]; } - if (papers != NULL) { - free((char*)papers); - } + } + // If DeviceCapabilities fails, then also free paper allocation + if (papers != NULL) { + free((char*)papers); } } RESTORE_CONTROLWORD diff -Nru openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp --- openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -252,7 +252,7 @@ } INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) { - (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS)); + (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW)); return ((*err) == MMSYSERR_NOERROR); } @@ -260,6 +260,7 @@ MIDIINCAPSW midiInCaps; INT32 err; + memset(&midiInCaps, 0, sizeof(midiInCaps)); if (getMidiInCaps(deviceID, &midiInCaps, &err)) { UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength); return MIDI_SUCCESS; @@ -284,6 +285,7 @@ MIDIINCAPSW midiInCaps; INT32 err = MIDI_NOT_SUPPORTED; + memset(&midiInCaps, 0, sizeof(midiInCaps)); if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) { sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF); return MIDI_SUCCESS; diff -Nru openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c --- openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c 2019-01-18 04:23:48.000000000 +0000 @@ -70,12 +70,13 @@ INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) { + UINT_PTR id; if (deviceID == 0) { - deviceID = MIDI_MAPPER; + id = MIDI_MAPPER; } else { - deviceID--; + id = (UINT_PTR)(deviceID-1); } - (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS)); + (*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW)); return ((*err) == MMSYSERR_NOERROR); } @@ -84,6 +85,7 @@ MIDIOUTCAPSW midiOutCaps; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) { UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength); return MIDI_SUCCESS; @@ -103,6 +105,7 @@ char *desc; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) { int tech = (int)midiOutCaps.wTechnology; switch(tech) { @@ -139,6 +142,7 @@ MIDIOUTCAPSW midiOutCaps; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) { sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF); return MIDI_SUCCESS; diff -Nru openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c --- openjdk-lts-11~28/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c 2019-01-18 04:23:48.000000000 +0000 @@ -357,7 +357,7 @@ INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) { MIXERCAPSW mixerCaps; - if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) { + if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) { UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH); sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF); strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1); @@ -368,9 +368,9 @@ int getDestinationCount(HMIXER handle) { int ret = 0; - MIXERCAPS mixerCaps; + MIXERCAPSW mixerCaps; - if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) { + if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) { ret = mixerCaps.cDestinations; } return ret; diff -Nru openjdk-lts-11~28/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c openjdk-lts-11.0.2+9/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c --- openjdk-lts-11~28/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.instrument/unix/native/libinstrument/FileSystemSupport_md.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -23,6 +23,7 @@ * questions. */ +#include #include #include @@ -50,6 +51,10 @@ } else { int len = last - path; char* str = (char*)malloc(len+1); + if (str == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } if (len > 0) { memcpy(str, path, len); } @@ -80,6 +85,10 @@ if (n == 0) return strdup("/"); sb = (char*)malloc(strlen(pathname)+1); + if (sb == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } sbLen = 0; if (off > 0) { @@ -128,6 +137,10 @@ len = parentEnd + cn - childStart; if (child[0] == slash) { theChars = (char*)malloc(len+1); + if (theChars == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } if (parentEnd > 0) memcpy(theChars, parent, parentEnd); if (cn > 0) @@ -135,6 +148,10 @@ theChars[len] = '\0'; } else { theChars = (char*)malloc(len+2); + if (theChars == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } if (parentEnd > 0) memcpy(theChars, parent, parentEnd); theChars[parentEnd] = slash; @@ -150,10 +167,13 @@ if (len > 1 && path[len-1] == slash) { // "/foo/" --> "/foo", but "/" --> "/" char* str = (char*)malloc(len); - if (str != NULL) { - memcpy(str, path, len-1); - str[len-1] = '\0'; + if (str == NULL) + { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; } + memcpy(str, path, len-1); + str[len-1] = '\0'; return str; } else { return (char*)path; diff -Nru openjdk-lts-11~28/src/java.instrument/windows/native/libinstrument/FileSystemSupport_md.c openjdk-lts-11.0.2+9/src/java.instrument/windows/native/libinstrument/FileSystemSupport_md.c --- openjdk-lts-11~28/src/java.instrument/windows/native/libinstrument/FileSystemSupport_md.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.instrument/windows/native/libinstrument/FileSystemSupport_md.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -23,6 +23,7 @@ * questions. */ +#include #include #include #include @@ -66,6 +67,10 @@ } else { int len = (int)(last - path); char* str = (char*)malloc(len+1); + if (str == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } if (len > 0) { memcpy(str, path, len); } @@ -135,6 +140,10 @@ if (off < 3) off = 0; /* Avoid fencepost cases with UNC pathnames */ sb = (char*)malloc(len+1); + if (sb == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } sbLen = 0; if (off == 0) { @@ -261,11 +270,19 @@ if (child[childStart] == slash) { theChars = (char*)malloc(len+1); + if (theChars == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } memcpy(theChars, parent, parentEnd); memcpy(theChars+parentEnd, child+childStart, (cn-childStart)); theChars[len] = '\0'; } else { theChars = (char*)malloc(len+2); + if (theChars == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; + } memcpy(theChars, parent, parentEnd); theChars[parentEnd] = slash; memcpy(theChars+parentEnd+1, child+childStart, (cn-childStart)); @@ -320,10 +337,12 @@ return (char*)path; } else { char* p = (char*)malloc(len+1); - if (p != NULL) { - memcpy(p, path+start, len); - p[len] = '\0'; + if (p == NULL) { + fprintf(stderr, "OOM error in native tmp buffer allocation"); + return NULL; } + memcpy(p, path+start, len); + p[len] = '\0'; return p; } } diff -Nru openjdk-lts-11~28/src/java.management/share/classes/sun/management/LockInfoCompositeData.java openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/LockInfoCompositeData.java --- openjdk-lts-11~28/src/java.management/share/classes/sun/management/LockInfoCompositeData.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/LockInfoCompositeData.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,6 +26,7 @@ package sun.management; import java.lang.management.LockInfo; +import java.util.Map; import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeDataSupport; @@ -57,17 +58,13 @@ } protected CompositeData getCompositeData() { - // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH - // LOCK_INFO_ATTRIBUTES! - final Object[] lockInfoItemValues = { - new String(lock.getClassName()), - lock.getIdentityHashCode(), - }; + Map items = Map.of( + CLASS_NAME, lock.getClassName(), + IDENTITY_HASH_CODE, lock.getIdentityHashCode() + ); try { - return new CompositeDataSupport(LOCK_INFO_COMPOSITE_TYPE, - LOCK_INFO_ATTRIBUTES, - lockInfoItemValues); + return new CompositeDataSupport(LOCK_INFO_COMPOSITE_TYPE, items); } catch (OpenDataException e) { // Should never reach here throw Util.newException(e); @@ -91,10 +88,6 @@ private static final String CLASS_NAME = "className"; private static final String IDENTITY_HASH_CODE = "identityHashCode"; - private static final String[] LOCK_INFO_ATTRIBUTES = { - CLASS_NAME, - IDENTITY_HASH_CODE, - }; /* * Returns a LockInfo object mapped from the given CompositeData. diff -Nru openjdk-lts-11~28/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java --- openjdk-lts-11~28/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,6 +26,8 @@ package sun.management; import java.lang.management.MonitorInfo; +import java.util.HashMap; +import java.util.Map; import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeDataSupport; @@ -54,31 +56,18 @@ } protected CompositeData getCompositeData() { - // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH - // MONITOR_INFO_ATTRIBUTES! - - int len = MONITOR_INFO_ATTRIBUTES.length; - Object[] values = new Object[len]; - CompositeData li = LockInfoCompositeData.toCompositeData(lock); - - for (int i = 0; i < len; i++) { - String item = MONITOR_INFO_ATTRIBUTES[i]; - if (item.equals(LOCKED_STACK_FRAME)) { - StackTraceElement ste = lock.getLockedStackFrame(); - values[i] = (ste != null ? StackTraceElementCompositeData. - toCompositeData(ste) - : null); - } else if (item.equals(LOCKED_STACK_DEPTH)) { - values[i] = lock.getLockedStackDepth(); - } else { - values[i] = li.get(item); - } - } + StackTraceElement ste = lock.getLockedStackFrame(); + CompositeData steCData = ste != null ? StackTraceElementCompositeData.toCompositeData(ste) + : null; + // values may be null; can't use Map.of + Map items = new HashMap<>(); + items.put(CLASS_NAME, lock.getClassName()); + items.put(IDENTITY_HASH_CODE, lock.getIdentityHashCode()); + items.put(LOCKED_STACK_FRAME, steCData); + items.put(LOCKED_STACK_DEPTH, lock.getLockedStackDepth()); try { - return new CompositeDataSupport(MONITOR_INFO_COMPOSITE_TYPE, - MONITOR_INFO_ATTRIBUTES, - values); + return new CompositeDataSupport(MONITOR_INFO_COMPOSITE_TYPE, items); } catch (OpenDataException e) { // Should never reach here throw new AssertionError(e); @@ -126,10 +115,6 @@ return V6_COMPOSITE_TYPE; } - static CompositeType compositeType() { - return MONITOR_INFO_COMPOSITE_TYPE; - } - public static String getClassName(CompositeData cd) { return getString(cd, CLASS_NAME); } diff -Nru openjdk-lts-11~28/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java --- openjdk-lts-11~28/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java 2019-01-18 04:23:48.000000000 +0000 @@ -31,6 +31,8 @@ import javax.management.openmbean.OpenDataException; import javax.management.openmbean.OpenType; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import java.util.stream.Stream; /** @@ -75,22 +77,19 @@ } protected CompositeData getCompositeData() { - // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH - // STACK_TRACE_ELEMENT_ATTRIBUTES! - final Object[] stackTraceElementItemValues = { - ste.getClassLoaderName(), - ste.getModuleName(), - ste.getModuleVersion(), - ste.getClassName(), - ste.getMethodName(), - ste.getFileName(), - ste.getLineNumber(), - ste.isNativeMethod(), - }; + // values may be null; so can't use Map.of + Map items = new HashMap<>(); + items.put(CLASS_LOADER_NAME, ste.getClassLoaderName()); + items.put(MODULE_NAME, ste.getModuleName()); + items.put(MODULE_VERSION, ste.getModuleVersion()); + items.put(CLASS_NAME, ste.getClassName()); + items.put(METHOD_NAME, ste.getMethodName()); + items.put(FILE_NAME, ste.getFileName()); + items.put(LINE_NUMBER, ste.getLineNumber()); + items.put(NATIVE_METHOD, ste.isNativeMethod()); + try { - return new CompositeDataSupport(STACK_TRACE_ELEMENT_COMPOSITE_TYPE, - STACK_TRACE_ELEMENT_ATTRIBUTES, - stackTraceElementItemValues); + return new CompositeDataSupport(STACK_TRACE_ELEMENT_COMPOSITE_TYPE, items); } catch (OpenDataException e) { // Should never reach here throw new AssertionError(e); @@ -121,10 +120,6 @@ MODULE_VERSION, }; - private static final String[] STACK_TRACE_ELEMENT_ATTRIBUTES = - Stream.of(V5_ATTRIBUTES, V9_ATTRIBUTES).flatMap(Arrays::stream) - .toArray(String[]::new); - private static final CompositeType STACK_TRACE_ELEMENT_COMPOSITE_TYPE; private static final CompositeType V5_COMPOSITE_TYPE; static { @@ -151,9 +146,6 @@ static CompositeType v5CompositeType() { return V5_COMPOSITE_TYPE; } - static CompositeType compositeType() { - return STACK_TRACE_ELEMENT_COMPOSITE_TYPE; - } /** * Validate if the input CompositeData has the expected diff -Nru openjdk-lts-11~28/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java --- openjdk-lts-11~28/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java 2019-01-18 04:23:48.000000000 +0000 @@ -75,8 +75,7 @@ protected CompositeData getCompositeData() { // Convert StackTraceElement[] to CompositeData[] StackTraceElement[] stackTrace = threadInfo.getStackTrace(); - CompositeData[] stackTraceData = - new CompositeData[stackTrace.length]; + CompositeData[] stackTraceData = new CompositeData[stackTrace.length]; for (int i = 0; i < stackTrace.length; i++) { StackTraceElement ste = stackTrace[i]; stackTraceData[i] = StackTraceElementCompositeData.toCompositeData(ste); @@ -88,48 +87,42 @@ // Convert LockInfo[] and MonitorInfo[] to CompositeData[] LockInfo[] lockedSyncs = threadInfo.getLockedSynchronizers(); - CompositeData[] lockedSyncsData = - new CompositeData[lockedSyncs.length]; + CompositeData[] lockedSyncsData = new CompositeData[lockedSyncs.length]; for (int i = 0; i < lockedSyncs.length; i++) { LockInfo li = lockedSyncs[i]; lockedSyncsData[i] = LockInfoCompositeData.toCompositeData(li); } MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors(); - CompositeData[] lockedMonitorsData = - new CompositeData[lockedMonitors.length]; + CompositeData[] lockedMonitorsData = new CompositeData[lockedMonitors.length]; for (int i = 0; i < lockedMonitors.length; i++) { MonitorInfo mi = lockedMonitors[i]; lockedMonitorsData[i] = MonitorInfoCompositeData.toCompositeData(mi); } - // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH - // THREAD_INFO_ATTRIBUTES! - final Object[] threadInfoItemValues = { - threadInfo.getThreadId(), - threadInfo.getThreadName(), - threadInfo.getThreadState().name(), - threadInfo.getBlockedTime(), - threadInfo.getBlockedCount(), - threadInfo.getWaitedTime(), - threadInfo.getWaitedCount(), - lockInfoData, - threadInfo.getLockName(), - threadInfo.getLockOwnerId(), - threadInfo.getLockOwnerName(), - stackTraceData, - threadInfo.isSuspended(), - threadInfo.isInNative(), - lockedMonitorsData, - lockedSyncsData, - threadInfo.isDaemon(), - threadInfo.getPriority(), - }; + // values may be null; can't use Map.of + Map items = new HashMap<>(); + items.put(THREAD_ID, threadInfo.getThreadId()); + items.put(THREAD_NAME, threadInfo.getThreadName()); + items.put(THREAD_STATE, threadInfo.getThreadState().name()); + items.put(BLOCKED_TIME, threadInfo.getBlockedTime()); + items.put(BLOCKED_COUNT, threadInfo.getBlockedCount()); + items.put(WAITED_TIME, threadInfo.getWaitedTime()); + items.put(WAITED_COUNT, threadInfo.getWaitedCount()); + items.put(LOCK_INFO, lockInfoData); + items.put(LOCK_NAME, threadInfo.getLockName()); + items.put(LOCK_OWNER_ID, threadInfo.getLockOwnerId()); + items.put(LOCK_OWNER_NAME, threadInfo.getLockOwnerName()); + items.put(STACK_TRACE, stackTraceData); + items.put(SUSPENDED, threadInfo.isSuspended()); + items.put(IN_NATIVE, threadInfo.isInNative()); + items.put(LOCKED_MONITORS, lockedMonitorsData); + items.put(LOCKED_SYNCS, lockedSyncsData); + items.put(DAEMON, threadInfo.isDaemon()); + items.put(PRIORITY, threadInfo.getPriority()); try { - return new CompositeDataSupport(compositeType(), - THREAD_INFO_ATTRIBTUES, - threadInfoItemValues); + return new CompositeDataSupport(ThreadInfoCompositeTypes.ofVersion(RUNTIME_VERSION), items); } catch (OpenDataException e) { // Should never reach here throw new AssertionError(e); @@ -183,10 +176,6 @@ PRIORITY, }; - private static final String[] THREAD_INFO_ATTRIBTUES = - Stream.of(V5_ATTRIBUTES, V6_ATTRIBUTES, V9_ATTRIBUTES) - .flatMap(Arrays::stream).toArray(String[]::new); - public long threadId() { return getLong(cdata, THREAD_ID); } @@ -365,12 +354,8 @@ } } - public static CompositeType compositeType() { - return ThreadInfoCompositeTypes.compositeTypes.get(0); - } - + static final int RUNTIME_VERSION = Runtime.version().feature(); static class ThreadInfoCompositeTypes { - static final int CURRENT = Runtime.version().feature(); static final Map compositeTypes = initCompositeTypes(); /* * Returns CompositeType of the given runtime version @@ -382,7 +367,7 @@ static Map initCompositeTypes() { Map types = new HashMap<>(); CompositeType ctype = initCompositeType(); - types.put(CURRENT, ctype); + types.put(RUNTIME_VERSION, ctype); types.put(5, initV5CompositeType(ctype)); types.put(6, initV6CompositeType(ctype)); return types; diff -Nru openjdk-lts-11~28/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java --- openjdk-lts-11~28/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java 2019-01-18 04:23:48.000000000 +0000 @@ -337,17 +337,17 @@ // then reset the timeout. if (socket instanceof SSLSocket) { SSLSocket sslSocket = (SSLSocket) socket; - int socketTimeout = sslSocket.getSoTimeout(); if (!IS_HOSTNAME_VERIFICATION_DISABLED) { SSLParameters param = sslSocket.getSSLParameters(); param.setEndpointIdentificationAlgorithm("LDAPS"); sslSocket.setSSLParameters(param); } if (connectTimeout > 0) { + int socketTimeout = sslSocket.getSoTimeout(); sslSocket.setSoTimeout(connectTimeout); // reuse full timeout value + sslSocket.startHandshake(); + sslSocket.setSoTimeout(socketTimeout); } - sslSocket.startHandshake(); - sslSocket.setSoTimeout(socketTimeout); } return socket; } diff -Nru openjdk-lts-11~28/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java --- openjdk-lts-11~28/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -115,7 +115,7 @@ boolean isLdapv3; // Used by LdapCtx int referenceCount = 1; // Used by LdapCtx for check for sharing - Connection conn; // Connection to server; has reader thread + final Connection conn; // Connection to server; has reader thread // used by LdapCtx for StartTLS final private PoolCallback pcb; @@ -433,19 +433,16 @@ (new Throwable()).printStackTrace(); } - if (referenceCount <= 0 && conn != null) { + if (referenceCount <= 0) { if (debug > 0) System.err.println("LdapClient: closed connection " + this); if (!pooled) { // Not being pooled; continue with closing conn.cleanup(reqCtls, false); - conn = null; } else { // Pooled - // Is this a real close or a request to return conn to pool if (hardClose) { conn.cleanup(reqCtls, false); - conn = null; pcb.removePooledConnection(this); } else { pcb.releasePooledConnection(this); @@ -461,16 +458,13 @@ if (debug > 1) { System.err.println("LdapClient: forceClose() of " + this); } - - if (conn != null) { - if (debug > 0) System.err.println( - "LdapClient: forced close of connection " + this); - conn.cleanup(null, false); - conn = null; - - if (cleanPool) { - pcb.removePooledConnection(this); - } + if (debug > 0) { + System.err.println( + "LdapClient: forced close of connection " + this); + } + conn.cleanup(null, false); + if (cleanPool) { + pcb.removePooledConnection(this); } } @@ -568,7 +562,7 @@ * Abandon the search operation and remove it from the message queue. */ void clearSearchReply(LdapResult res, Control[] ctls) { - if (res != null && conn != null) { + if (res != null) { // Only send an LDAP abandon operation when clearing the search // reply from a one-level or subtree search. diff -Nru openjdk-lts-11~28/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java --- openjdk-lts-11~28/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -53,6 +53,20 @@ public final class VersionHelper { private static final VersionHelper helper = new VersionHelper(); + /** + * Determines whether classes may be loaded from an arbitrary URL code base. + */ + private static final boolean TRUST_URL_CODE_BASE; + + static { + // System property to control whether classes may be loaded from an + // arbitrary URL code base + PrivilegedAction act + = () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false"); + String trust = AccessController.doPrivileged(act); + TRUST_URL_CODE_BASE = "true".equalsIgnoreCase(trust); + } + final static String[] PROPS = new String[]{ javax.naming.Context.INITIAL_CONTEXT_FACTORY, javax.naming.Context.OBJECT_FACTORIES, @@ -88,12 +102,14 @@ */ public Class loadClass(String className, String codebase) throws ClassNotFoundException, MalformedURLException { - - ClassLoader parent = getContextClassLoader(); - ClassLoader cl = - URLClassLoader.newInstance(getUrlArray(codebase), parent); - - return loadClass(className, cl); + if (TRUST_URL_CODE_BASE) { + ClassLoader parent = getContextClassLoader(); + ClassLoader cl + = URLClassLoader.newInstance(getUrlArray(codebase), parent); + return loadClass(className, cl); + } else { + return null; + } } /** diff -Nru openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java --- openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java 2019-01-18 04:23:48.000000000 +0000 @@ -133,9 +133,7 @@ // A case insensitive TreeSet of strings. TreeSet treeSet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); treeSet.addAll(Set.of("connection", "content-length", - "date", "expect", "from", "host", "origin", - "referer", "upgrade", - "via", "warning")); + "date", "expect", "from", "host", "upgrade", "via", "warning")); DISALLOWED_HEADERS_SET = Collections.unmodifiableSet(treeSet); } diff -Nru openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java --- openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java 2019-01-18 04:23:48.000000000 +0000 @@ -236,20 +236,20 @@ * Return known fixed content length or -1 if chunked, or -2 if no content-length * information in which case, connection termination delimits the response body */ - int fixupContentLen(int clen) { + long fixupContentLen(long clen) { if (request.method().equalsIgnoreCase("HEAD") || responseCode == HTTP_NOT_MODIFIED) { - return 0; + return 0L; } - if (clen == -1) { + if (clen == -1L) { if (headers.firstValue("Transfer-encoding").orElse("") .equalsIgnoreCase("chunked")) { - return -1; + return -1L; } if (responseCode == 101) { // this is a h2c or websocket upgrade, contentlength must be zero - return 0; + return 0L; } - return -2; + return -2L; } return clen; } @@ -383,9 +383,8 @@ final CompletableFuture cf = new MinimalFuture<>(); - int clen0 = (int)headers.firstValueAsLong("Content-Length").orElse(-1); - - final int clen = fixupContentLen(clen0); + long clen0 = headers.firstValueAsLong("Content-Length").orElse(-1L); + final long clen = fixupContentLen(clen0); // expect-continue reads headers and body twice. // if we reach here, we must reset the headersReader state. diff -Nru openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java --- openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,21 +26,26 @@ package jdk.internal.net.http; import java.io.IOException; +import java.io.UncheckedIOException; import java.net.ConnectException; import java.net.http.HttpConnectTimeoutException; import java.util.Iterator; import java.util.LinkedList; import java.security.AccessControlContext; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; +import java.util.concurrent.Flow; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.net.http.HttpClient; +import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodySubscriber; import java.net.http.HttpResponse.PushPromiseHandler; import java.net.http.HttpTimeoutException; import jdk.internal.net.http.common.Log; @@ -200,11 +205,60 @@ return cf; } + // return true if the response is a type where a response body is never possible + // and therefore doesn't have to include header information which indicates no + // body is present. This is distinct from responses that also do not contain + // response bodies (possibly ever) but which are required to have content length + // info in the header (eg 205). Those cases do not have to be handled specially + + private static boolean bodyNotPermitted(Response r) { + return r.statusCode == 204; + } + + private boolean bodyIsPresent(Response r) { + HttpHeaders headers = r.headers(); + if (headers.firstValue("Content-length").isPresent()) + return true; + if (headers.firstValue("Transfer-encoding").isPresent()) + return true; + return false; + } + + // Call the user's body handler to get an empty body object + + private CompletableFuture> handleNoBody(Response r, Exchange exch) { + BodySubscriber bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(), + r.headers(), r.version())); + CompletionStage cs = bs.getBody(); + bs.onSubscribe(new NullSubscription()); + bs.onComplete(); + MinimalFuture> result = new MinimalFuture<>(); + cs.whenComplete((nullBody, exception) -> { + if (exception != null) + result.completeExceptionally(exception); + else { + this.response = + new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch); + result.complete(this.response); + } + }); + return result; + } + private CompletableFuture> responseAsync0(CompletableFuture start) { return start.thenCompose( v -> responseAsyncImpl()) .thenCompose((Response r) -> { Exchange exch = getExchange(); + if (bodyNotPermitted(r)) { + if (bodyIsPresent(r)) { + IOException ioe = new IOException( + "unexpected content length header with 204 response"); + exch.cancel(ioe); + return MinimalFuture.failedFuture(ioe); + } else + return handleNoBody(r, exch); + } return exch.readBodyAsync(responseHandler) .thenApply((T body) -> { this.response = @@ -214,6 +268,16 @@ }); } + static class NullSubscription implements Flow.Subscription { + @Override + public void request(long n) { + } + + @Override + public void cancel() { + } + } + private CompletableFuture responseAsyncImpl() { CompletableFuture cf; if (attempts.incrementAndGet() > max_attempts) { diff -Nru openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java --- openjdk-lts-11~28/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java 2019-01-18 04:23:48.000000000 +0000 @@ -46,7 +46,7 @@ class ResponseContent { final HttpResponse.BodySubscriber pusher; - final int contentLength; + final long contentLength; final HttpHeaders headers; // this needs to run before we complete the body // so that connection can be returned to pool @@ -54,7 +54,7 @@ private final String dbgTag; ResponseContent(HttpConnection connection, - int contentLength, + long contentLength, HttpHeaders h, HttpResponse.BodySubscriber userSubscriber, Runnable onFinished) @@ -474,14 +474,14 @@ } class FixedLengthBodyParser implements BodyParser { - final int contentLength; + final long contentLength; final Consumer onComplete; final Logger debug = Utils.getDebugLogger(this::dbgString, Utils.DEBUG); final String dbgTag = ResponseContent.this.dbgTag + "/FixedLengthBodyParser"; - volatile int remaining; + volatile long remaining; volatile Throwable closedExceptionally; volatile AbstractSubscription sub; - FixedLengthBodyParser(int contentLength, Consumer onComplete) { + FixedLengthBodyParser(long contentLength, Consumer onComplete) { this.contentLength = this.remaining = contentLength; this.onComplete = onComplete; } @@ -527,7 +527,7 @@ } boolean completed = false; try { - int unfulfilled = remaining; + long unfulfilled = remaining; if (debug.on()) debug.log("Parser got %d bytes (%d remaining / %d)", b.remaining(), unfulfilled, contentLength); @@ -541,7 +541,7 @@ // demand. boolean hasDemand = sub.demand().tryDecrement(); assert hasDemand; - int amount = Math.min(b.remaining(), unfulfilled); + int amount = (int)Math.min(b.remaining(), unfulfilled); // safe cast unfulfilled = remaining -= amount; ByteBuffer buffer = Utils.sliceWithLimitedCapacity(b, amount); pusher.onNext(List.of(buffer.asReadOnlyBuffer())); diff -Nru openjdk-lts-11~28/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c openjdk-lts-11.0.2+9/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c --- openjdk-lts-11~28/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c 2019-01-18 04:23:48.000000000 +0000 @@ -78,7 +78,8 @@ BOOL PackageConnectLookup(PHANDLE,PULONG); -NTSTATUS ConstructTicketRequest(UNICODE_STRING DomainName, +NTSTATUS ConstructTicketRequest(JNIEnv *env, + UNICODE_STRING DomainName, PKERB_RETRIEVE_TKT_REQUEST *outRequest, ULONG *outSize); @@ -104,6 +105,8 @@ jobject BuildTicketFlags(JNIEnv *env, PULONG flags); jobject BuildKerberosTime(JNIEnv *env, PLARGE_INTEGER kerbtime); +void ThrowOOME(JNIEnv *env, const char *szMessage); + /* * Class: sun_security_krb5_KrbCreds * Method: JNI_OnLoad @@ -497,7 +500,7 @@ } // use domain to request Ticket - Status = ConstructTicketRequest(msticket->TargetDomainName, + Status = ConstructTicketRequest(env, msticket->TargetDomainName, &pTicketRequest, &requestSize); if (!LSA_SUCCESS(Status)) { ShowNTError("ConstructTicketRequest status", Status); @@ -691,7 +694,7 @@ } static NTSTATUS -ConstructTicketRequest(UNICODE_STRING DomainName, +ConstructTicketRequest(JNIEnv *env, UNICODE_STRING DomainName, PKERB_RETRIEVE_TKT_REQUEST *outRequest, ULONG *outSize) { NTSTATUS Status; @@ -738,8 +741,10 @@ pTicketRequest = (PKERB_RETRIEVE_TKT_REQUEST) LocalAlloc(LMEM_ZEROINIT, RequestSize); - if (!pTicketRequest) + if (!pTicketRequest) { + ThrowOOME(env, "Can't allocate memory for ticket"); return GetLastError(); + } // // Concatenate the target prefix with the previous response's @@ -896,7 +901,7 @@ jbyteArray ary; ary = (*env)->NewByteArray(env,encodedTicketSize); - if ((*env)->ExceptionOccurred(env)) { + if (ary == NULL) { return (jobject) NULL; } @@ -942,6 +947,10 @@ realm = (WCHAR *) LocalAlloc(LMEM_ZEROINIT, ((domainName.Length)*sizeof(WCHAR) + sizeof(UNICODE_NULL))); + if (realm == NULL) { + ThrowOOME(env, "Can't allocate memory for realm"); + return NULL; + } wcsncpy(realm, domainName.Buffer, domainName.Length/sizeof(WCHAR)); if (native_debug) { @@ -1016,6 +1025,9 @@ } ary = (*env)->NewByteArray(env,cryptoKey->Length); + if (ary == NULL) { + return (jobject) NULL; + } (*env)->SetByteArrayRegion(env, ary, (jsize) 0, cryptoKey->Length, (jbyte *)cryptoKey->Value); if ((*env)->ExceptionOccurred(env)) { @@ -1038,6 +1050,9 @@ ULONG nlflags = htonl(*flags); ary = (*env)->NewByteArray(env, sizeof(*flags)); + if (ary == NULL) { + return (jobject) NULL; + } (*env)->SetByteArrayRegion(env, ary, (jsize) 0, sizeof(*flags), (jbyte *)&nlflags); if ((*env)->ExceptionOccurred(env)) { @@ -1090,3 +1105,10 @@ } return kerberosTime; } + +void ThrowOOME(JNIEnv *env, const char *szMessage) { + jclass exceptionClazz = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); + if (exceptionClazz != NULL) { + (*env)->ThrowNew(env, exceptionClazz, szMessage); + } +} diff -Nru openjdk-lts-11~28/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java openjdk-lts-11.0.2+9/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java --- openjdk-lts-11~28/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -190,6 +190,7 @@ * @author Sunitha Reddy * @see javax.xml.datatype.Duration * @since 1.5 + * @LastModified: June 2018 */ public class XMLGregorianCalendarImpl @@ -2755,7 +2756,7 @@ if ((fractional.compareTo(DECIMAL_ZERO) < 0) || (fractional.compareTo(DECIMAL_ONE) > 0)) { throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null, - "InvalidFractional", new Object[]{fractional})); + "InvalidFractional", new Object[]{fractional.toString()})); } } this.fractionalSecond = fractional; diff -Nru openjdk-lts-11~28/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java openjdk-lts-11.0.2+9/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java --- openjdk-lts-11~28/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -39,15 +39,19 @@ * @author Santiago PericasGeertsen */ public class ThreadLocalBufferAllocator { - private static ThreadLocal> tlba = new ThreadLocal<>(); + private static final ThreadLocal> TL = new ThreadLocal<>(); - public static BufferAllocator getBufferAllocator() { - SoftReference bAllocatorRef = tlba.get(); - if (bAllocatorRef == null || bAllocatorRef.get() == null) { - bAllocatorRef = new SoftReference<>(new BufferAllocator()); - tlba.set(bAllocatorRef); + public static BufferAllocator getBufferAllocator() { + BufferAllocator ba = null; + SoftReference sr = TL.get(); + if (sr != null) { + ba = sr.get(); } - - return bAllocatorRef.get(); - } + if (ba == null) { + ba = new BufferAllocator(); + sr = new SoftReference<>(ba); + TL.set(sr); + } + return ba; + } } diff -Nru openjdk-lts-11~28/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp openjdk-lts-11.0.2+9/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp --- openjdk-lts-11~28/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -32,6 +32,7 @@ #include "AccessBridgePackages.h" // for debugging only #include #include +#include DEBUG_CODE(extern HWND theDialogWindow); extern "C" { @@ -46,6 +47,9 @@ next = (AccessBridgeQueueElement *) 0; previous = (AccessBridgeQueueElement *) 0; buffer = (char *) malloc(bufsize); + if (buffer == NULL) { + throw std::bad_alloc(); + } memcpy(buffer, buf, bufsize); } diff -Nru openjdk-lts-11~28/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c openjdk-lts-11.0.2+9/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c --- openjdk-lts-11~28/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.crypto.cryptoki/windows/native/libj2pkcs11/p11_md.c 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -75,18 +75,20 @@ * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect - (JNIEnv *env, jobject obj, jstring jPkcs11ModulePath, jstring jGetFunctionList) + (JNIEnv *env, jobject obj, jstring jPkcs11ModulePath, + jstring jGetFunctionList) { HINSTANCE hModule; CK_C_GetFunctionList C_GetFunctionList; - CK_RV rv; + CK_RV rv = CK_ASSERT_OK; ModuleData *moduleData; jobject globalPKCS11ImplementationReference; - LPVOID lpMsgBuf; - char *exceptionMessage; + LPVOID lpMsgBuf = NULL; + char *exceptionMessage = NULL; const char *getFunctionListStr; - const char *libraryNameStr = (*env)->GetStringUTFChars(env, jPkcs11ModulePath, 0); + const char *libraryNameStr = (*env)->GetStringUTFChars(env, + jPkcs11ModulePath, 0); TRACE1("DEBUG: connect to PKCS#11 module: %s ... ", libraryNameStr); @@ -106,21 +108,24 @@ 0, NULL ); - exceptionMessage = (char *) malloc(sizeof(char) * (strlen((LPTSTR) lpMsgBuf) + strlen(libraryNameStr) + 1)); + exceptionMessage = (char *) malloc(sizeof(char) * + (strlen((LPTSTR) lpMsgBuf) + strlen(libraryNameStr) + 1)); + if (exceptionMessage == NULL) { + throwOutOfMemoryError(env, 0); + goto cleanup; + } strcpy(exceptionMessage, (LPTSTR) lpMsgBuf); strcat(exceptionMessage, libraryNameStr); throwIOException(env, (LPTSTR) exceptionMessage); - /* Free the buffer. */ - free(exceptionMessage); - LocalFree(lpMsgBuf); - return; + goto cleanup; } /* * Get function pointer to C_GetFunctionList */ getFunctionListStr = (*env)->GetStringUTFChars(env, jGetFunctionList, 0); - C_GetFunctionList = (CK_C_GetFunctionList) GetProcAddress(hModule, getFunctionListStr); + C_GetFunctionList = (CK_C_GetFunctionList) GetProcAddress(hModule, + getFunctionListStr); (*env)->ReleaseStringUTFChars(env, jGetFunctionList, getFunctionListStr); if (C_GetFunctionList == NULL) { FormatMessage( @@ -135,24 +140,37 @@ NULL ); throwIOException(env, (LPTSTR) lpMsgBuf); - /* Free the buffer. */ - LocalFree( lpMsgBuf ); - return; + goto cleanup; } /* * Get function pointers to all PKCS #11 functions */ moduleData = (ModuleData *) malloc(sizeof(ModuleData)); + if (moduleData == NULL) { + throwOutOfMemoryError(env, 0); + goto cleanup; + } moduleData->hModule = hModule; moduleData->applicationMutexHandler = NULL; rv = (C_GetFunctionList)(&(moduleData->ckFunctionListPtr)); globalPKCS11ImplementationReference = (*env)->NewGlobalRef(env, obj); putModuleEntry(env, globalPKCS11ImplementationReference, moduleData); - (*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr); TRACE0("FINISHED\n"); +cleanup: + /* Free up allocated buffers we no longer need */ + if (lpMsgBuf != NULL) { + LocalFree( lpMsgBuf ); + } + if (libraryNameStr != NULL) { + (*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr); + } + if (exceptionMessage != NULL) { + free(exceptionMessage); + } + if(ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { return; } } diff -Nru openjdk-lts-11~28/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java openjdk-lts-11.0.2+9/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java --- openjdk-lts-11~28/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/KeyStore.java 2019-01-18 04:23:48.000000000 +0000 @@ -753,6 +753,7 @@ /** * Generates a certificate chain from the collection of * certificates and stores the result into a key entry. + * This method is called by native code in libsunmscapi. */ private void generateCertificateChain(String alias, Collection certCollection) @@ -775,13 +776,15 @@ catch (Throwable e) { // Ignore the exception and skip this entry - // TODO - throw CertificateException? + // If e is thrown, remember to deal with it in + // native code. } } /** * Generates RSA key and certificate chain from the private key handle, * collection of certificates and stores the result into key entries. + * This method is called by native code in libsunmscapi. */ private void generateRSAKeyAndCertificateChain(String alias, long hCryptProv, long hCryptKey, int keyLength, @@ -807,12 +810,14 @@ catch (Throwable e) { // Ignore the exception and skip this entry - // TODO - throw CertificateException? + // If e is thrown, remember to deal with it in + // native code. } } /** * Generates certificates from byte data and stores into cert collection. + * This method is called by native code in libsunmscapi. * * @param data Byte data. * @param certCollection Collection of certificates. @@ -836,12 +841,14 @@ catch (CertificateException e) { // Ignore the exception and skip this certificate - // TODO - throw CertificateException? + // If e is thrown, remember to deal with it in + // native code. } catch (Throwable te) { // Ignore the exception and skip this certificate - // TODO - throw CertificateException? + // If e is thrown, remember to deal with it in + // native code. } } diff -Nru openjdk-lts-11~28/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp openjdk-lts-11.0.2+9/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp --- openjdk-lts-11~28/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp 2019-01-18 04:23:48.000000000 +0000 @@ -311,6 +311,9 @@ } result = env->NewByteArray(length); + if (result == NULL) { + __leave; + } env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData); } else { // length == 0 @@ -507,6 +510,15 @@ // Create ArrayList to store certs in each chain jobject jArrayList = env->NewObject(clazzArrayList, mNewArrayList); + if (jArrayList == NULL) { + __leave; + } + + // Cleanup the previous allocated name + if (pszNameString) { + delete [] pszNameString; + pszNameString = NULL; + } for (unsigned int j=0; j < rgpChain->cElement; j++) { @@ -545,6 +557,9 @@ // Allocate and populate byte array jbyteArray byteArray = env->NewByteArray(cbCertEncoded); + if (byteArray == NULL) { + __leave; + } env->SetByteArrayRegion(byteArray, 0, cbCertEncoded, (jbyte*) pbCertEncoded); @@ -553,30 +568,44 @@ env->CallVoidMethod(obj, mGenCert, byteArray, jArrayList); } - if (bHasNoPrivateKey) + // Usually pszNameString should be non-NULL. It's either + // the friendly name or an element from the subject name + // or SAN. + if (pszNameString) { - // Generate certificate chain and store into cert chain - // collection - env->CallVoidMethod(obj, mGenCertChain, - env->NewStringUTF(pszNameString), - jArrayList); - } - else - { - // Determine key type: RSA or DSA - DWORD dwData = CALG_RSA_KEYX; - DWORD dwSize = sizeof(DWORD); - ::CryptGetKeyParam(hUserKey, KP_ALGID, (BYTE*)&dwData, - &dwSize, NULL); - - if ((dwData & ALG_TYPE_RSA) == ALG_TYPE_RSA) + if (bHasNoPrivateKey) { - // Generate RSA certificate chain and store into cert - // chain collection - env->CallVoidMethod(obj, mGenRSAKeyAndCertChain, - env->NewStringUTF(pszNameString), - (jlong) hCryptProv, (jlong) hUserKey, - dwPublicKeyLength, jArrayList); + // Generate certificate chain and store into cert chain + // collection + jstring name = env->NewStringUTF(pszNameString); + if (name == NULL) { + __leave; + } + env->CallVoidMethod(obj, mGenCertChain, + name, + jArrayList); + } + else + { + // Determine key type: RSA or DSA + DWORD dwData = CALG_RSA_KEYX; + DWORD dwSize = sizeof(DWORD); + ::CryptGetKeyParam(hUserKey, KP_ALGID, (BYTE*)&dwData, + &dwSize, NULL); + + if ((dwData & ALG_TYPE_RSA) == ALG_TYPE_RSA) + { + // Generate RSA certificate chain and store into cert + // chain collection + jstring name = env->NewStringUTF(pszNameString); + if (name == NULL) { + __leave; + } + env->CallVoidMethod(obj, mGenRSAKeyAndCertChain, + name, + (jlong) hCryptProv, (jlong) hUserKey, + dwPublicKeyLength, jArrayList); + } } } } @@ -722,6 +751,9 @@ // Create new byte array jbyteArray temp = env->NewByteArray(dwBufLen); + if (temp == NULL) { + __leave; + } // Copy data from native buffer env->SetByteArrayRegion(temp, 0, dwBufLen, pSignedHashBuffer); @@ -813,6 +845,9 @@ // Create new byte array jbyteArray temp = env->NewByteArray(dwBufLen); + if (temp == NULL) { + __leave; + } // Copy data from native buffer env->SetByteArrayRegion(temp, 0, dwBufLen, pSignedHashBuffer); @@ -1212,6 +1247,9 @@ } jCertAliasChars = env->GetStringChars(jCertAliasName, NULL); + if (jCertAliasChars == NULL) { + __leave; + } memcpy(pszCertAliasName, jCertAliasChars, size * sizeof(WCHAR)); pszCertAliasName[size] = 0; // append the string terminator @@ -1642,7 +1680,9 @@ } // Create new byte array - result = env->NewByteArray(dwBufLen); + if ((result = env->NewByteArray(dwBufLen)) == NULL) { + __leave; + } // Copy data from native buffer to Java buffer env->SetByteArrayRegion(result, 0, dwBufLen, (jbyte*) pData); @@ -1693,7 +1733,9 @@ } // Create new byte array - blob = env->NewByteArray(dwBlobLen); + if ((blob = env->NewByteArray(dwBlobLen)) == NULL) { + __leave; + } // Copy data from native buffer to Java buffer env->SetByteArrayRegion(blob, 0, dwBlobLen, (jbyte*) pbKeyBlob); @@ -1722,6 +1764,13 @@ __try { jsize length = env->GetArrayLength(jKeyBlob); + jsize headerLength = sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY); + + if (length < headerLength) { + ThrowExceptionWithMessage(env, KEY_EXCEPTION, "Invalid BLOB"); + __leave; + } + if ((keyBlob = env->GetByteArrayElements(jKeyBlob, 0)) == NULL) { __leave; } @@ -1748,7 +1797,9 @@ exponentBytes[i] = ((BYTE*) &pRsaPubKey->pubexp)[j]; } - exponent = env->NewByteArray(len); + if ((exponent = env->NewByteArray(len)) == NULL) { + __leave; + } env->SetByteArrayRegion(exponent, 0, len, exponentBytes); } __finally @@ -1778,6 +1829,13 @@ __try { jsize length = env->GetArrayLength(jKeyBlob); + jsize headerLength = sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY); + + if (length < headerLength) { + ThrowExceptionWithMessage(env, KEY_EXCEPTION, "Invalid BLOB"); + __leave; + } + if ((keyBlob = env->GetByteArrayElements(jKeyBlob, 0)) == NULL) { __leave; } @@ -1794,19 +1852,25 @@ (RSAPUBKEY *) (keyBlob + sizeof(PUBLICKEYSTRUC)); int len = pRsaPubKey->bitlen / 8; + if (len < 0 || len > length - headerLength) { + ThrowExceptionWithMessage(env, KEY_EXCEPTION, "Invalid key length"); + __leave; + } + modulusBytes = new (env) jbyte[len]; if (modulusBytes == NULL) { __leave; } - BYTE * pbModulus = - (BYTE *) (keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY)); + BYTE * pbModulus = (BYTE *) (keyBlob + headerLength); // convert from little-endian while copying from blob for (int i = 0, j = len - 1; i < len; i++, j--) { modulusBytes[i] = pbModulus[j]; } - modulus = env->NewByteArray(len); + if ((modulus = env->NewByteArray(len)) == NULL) { + __leave; + } env->SetByteArrayRegion(modulus, 0, len, modulusBytes); } __finally @@ -2023,7 +2087,9 @@ } } - jBlob = env->NewByteArray(jBlobLength); + if ((jBlob = env->NewByteArray(jBlobLength)) == NULL) { + __leave; + } env->SetByteArrayRegion(jBlob, 0, jBlobLength, jBlobBytes); } diff -Nru openjdk-lts-11~28/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c --- openjdk-lts-11~28/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c 2019-01-18 04:23:48.000000000 +0000 @@ -853,7 +853,11 @@ if (exec_php->p_filesz > BUF_SIZE) { goto err; } - pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset); + if (pread(ph->core->exec_fd, interp_name, + exec_php->p_filesz, exec_php->p_offset) != exec_php->p_filesz) { + print_debug("Unable to read in the ELF interpreter\n"); + goto err; + } interp_name[exec_php->p_filesz] = '\0'; print_debug("ELF interpreter %s\n", interp_name); // read interpreter segments as well diff -Nru openjdk-lts-11~28/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java --- openjdk-lts-11~28/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java 2019-01-18 04:23:48.000000000 +0000 @@ -55,7 +55,15 @@ public CFrame sender(ThreadProxy thread) { X86ThreadContext context = (X86ThreadContext) thread.getContext(); - Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP); + /* + * Native code fills in the stack pointer register value using index + * X86ThreadContext.SP. + * See file LinuxDebuggerLocal.c macro REG_INDEX(reg). + * + * Be sure to use SP, or UESP which is aliased to SP in Java code, + * for the frame pointer validity check. + */ + Address esp = context.getRegisterAsAddress(X86ThreadContext.SP); if ( (ebp == null) || ebp.lessThan(esp) ) { return null; diff -Nru openjdk-lts-11~28/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java --- openjdk-lts-11~28/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java 2019-01-18 04:23:48.000000000 +0000 @@ -46,7 +46,15 @@ public CFrame sender(ThreadProxy thread) { X86ThreadContext context = (X86ThreadContext) thread.getContext(); - Address esp = context.getRegisterAsAddress(X86ThreadContext.ESP); + /* + * Native code fills in the stack pointer register value using index + * X86ThreadContext.SP. + * See file sawindbg.cpp macro REG_INDEX(x). + * + * Be sure to use SP, or UESP which is aliased to SP in Java code, + * for the frame pointer validity check. + */ + Address esp = context.getRegisterAsAddress(X86ThreadContext.SP); if ( (ebp == null) || ebp.lessThan(esp) ) { return null; diff -Nru openjdk-lts-11~28/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java openjdk-lts-11.0.2+9/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java --- openjdk-lts-11~28/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -210,6 +210,7 @@ PlaceholderOutputStream o = getPlaceholderResponseBody(); tmpout.write (bytes(statusLine, 0), 0, statusLine.length()); boolean noContentToSend = false; // assume there is content + boolean noContentLengthHeader = false; // must not send Content-length is set rspHdrs.set ("Date", dateFormat.get().format (new Date())); /* check for response type that is not allowed to send a body */ @@ -225,6 +226,7 @@ logger.log (Level.WARNING, msg); } contentLen = -1; + noContentLengthHeader = (rCode != 304); } if (isHeadRequest() || rCode == 304) { @@ -253,7 +255,9 @@ noContentToSend = true; contentLen = 0; } - rspHdrs.set("Content-length", Long.toString(contentLen)); + if (!noContentLengthHeader) { + rspHdrs.set("Content-length", Long.toString(contentLen)); + } o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); } } diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java 2019-01-18 04:23:48.000000000 +0000 @@ -209,12 +209,6 @@ public HtmlVersion htmlVersion = null; /** - * Flag to enable/disable use of module directories when generating docs for modules - * Default: on (module directories are enabled). - */ - public boolean useModuleDirectories = true; - - /** * Collected set of doclint options */ public Map doclintOpts = new LinkedHashMap<>(); @@ -840,13 +834,6 @@ } return true; } - }, - new XOption(resources, "--no-module-directories") { - @Override - public boolean process(String option, List args) { - useModuleDirectories = false; - return true; - } } }; Set oset = new TreeSet<>(); diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java 2019-01-18 04:23:48.000000000 +0000 @@ -609,7 +609,7 @@ return links.createLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), label); } else { - DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement)); + DocLink crossPkgLink = getCrossPackageLink(packageElement); if (crossPkgLink != null) { return links.createLink(crossPkgLink, label); } else { @@ -692,11 +692,10 @@ /************************************************************* * Return a class cross link to external class documentation. - * The name must be fully qualified to determine which package - * the class is in. The -link option does not allow users to + * The -link option does not allow users to * link to external classes in the "default" package. * - * @param qualifiedClassName the qualified name of the external class. + * @param classElement the class element * @param refMemName the name of the member being referenced. This should * be null or empty string if no member is being referenced. * @param label the label for the external link. @@ -704,19 +703,15 @@ * @param code true if the label should be code font. * @return the link */ - public Content getCrossClassLink(String qualifiedClassName, String refMemName, + public Content getCrossClassLink(TypeElement classElement, String refMemName, Content label, boolean strong, boolean code) { - String className = ""; - String packageName = qualifiedClassName == null ? "" : qualifiedClassName; - int periodIndex; - while ((periodIndex = packageName.lastIndexOf('.')) != -1) { - className = packageName.substring(periodIndex + 1, packageName.length()) + - (className.length() > 0 ? "." + className : ""); + if (classElement != null) { + String className = utils.getSimpleName(classElement); + PackageElement packageElement = utils.containingPackage(classElement); Content defaultLabel = new StringContent(className); if (code) defaultLabel = HtmlTree.CODE(defaultLabel); - packageName = packageName.substring(0, periodIndex); - if (getCrossPackageLink(packageName) != null) { + if (getCrossPackageLink(packageElement) != null) { /* The package exists in external documentation, so link to the external class (assuming that it exists). This is definitely a limitation of @@ -724,13 +719,13 @@ exists, but no way to determine if the external class exists. We just have to assume that it does. */ - DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot, + DocLink link = configuration.extern.getExternalLink(packageElement, pathToRoot, className + ".html", refMemName); return links.createLink(link, (label == null) || label.isEmpty() ? defaultLabel : label, strong, - resources.getText("doclet.Href_Class_Or_Interface_Title", packageName), - "", true); + resources.getText("doclet.Href_Class_Or_Interface_Title", + utils.getPackageName(packageElement)), "", true); } } return null; @@ -743,14 +738,14 @@ return configuration.extern.isExternal(typeElement); } - public DocLink getCrossPackageLink(String pkgName) { - return configuration.extern.getExternalLink(pkgName, pathToRoot, + public DocLink getCrossPackageLink(PackageElement element) { + return configuration.extern.getExternalLink(element, pathToRoot, DocPaths.PACKAGE_SUMMARY.getPath()); } - public DocLink getCrossModuleLink(String mdleName) { - return configuration.extern.getExternalLink(mdleName, pathToRoot, - docPaths.moduleSummary(mdleName).getPath()); + public DocLink getCrossModuleLink(ModuleElement element) { + return configuration.extern.getExternalLink(element, pathToRoot, + docPaths.moduleSummary(utils.getModuleName(element)).getPath()); } /** @@ -1020,17 +1015,13 @@ return getPackageLink(refPackage, label); } else { // @see is not referencing an included class, module or package. Check for cross links. - Content classCrossLink; DocLink elementCrossLink = (configuration.extern.isModule(refClassName)) - ? getCrossModuleLink(refClassName) : getCrossPackageLink(refClassName); + ? getCrossModuleLink(utils.elementUtils.getModuleElement(refClassName)) : + (refPackage != null) ? getCrossPackageLink(refPackage) : null; if (elementCrossLink != null) { // Element cross link found return links.createLink(elementCrossLink, (label.isEmpty() ? text : label), true); - } else if ((classCrossLink = getCrossClassLink(refClassName, - refMemName, label, false, !isLinkPlain)) != null) { - // Class cross link found (possibly to a member in the class) - return classCrossLink; } else { // No cross link found so print warning messages.warning(ch.getDocTreePath(see), diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -111,7 +111,7 @@ } } else { Content crossLink = m_writer.getCrossClassLink( - typeElement.getQualifiedName().toString(), classLinkInfo.where, + typeElement, classLinkInfo.where, label, classLinkInfo.isStrong, true); if (crossLink != null) { link.addContent(crossLink); diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java 2019-01-18 04:23:48.000000000 +0000 @@ -886,8 +886,7 @@ contents.packageLabel))); } else { DocLink crossPkgLink = configuration.extern.getExternalLink( - configuration.utils.getPackageName(packageElement), pathToRoot, - DocPaths.PACKAGE_SUMMARY.getPath()); + packageElement, pathToRoot, DocPaths.PACKAGE_SUMMARY.getPath()); if (crossPkgLink != null) { tree.addContent(HtmlTree.LI(links.createLink(crossPkgLink, contents.packageLabel))); } else { diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java 2019-01-18 04:23:48.000000000 +0000 @@ -295,6 +295,11 @@ // A list of pairs containing urls and package list private final List> linkOfflineList = new ArrayList<>(); + /** + * Flag to enable/disable use of module directories when generating docs for modules + * Default: on (module directories are enabled). + */ + public boolean useModuleDirectories = true; public boolean dumpOnError = false; @@ -740,6 +745,13 @@ return true; } }, + new XOption(resources, "--no-module-directories") { + @Override + public boolean process(String option, List args) { + useModuleDirectories = false; + return true; + } + } }; Set set = new TreeSet<>(); set.addAll(Arrays.asList(options)); diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties 2019-01-18 04:23:48.000000000 +0000 @@ -218,6 +218,8 @@ doclet.Description=\u8AAC\u660E doclet.ConstantField=\u5B9A\u6570\u30D5\u30A3\u30FC\u30EB\u30C9 doclet.Value=\u5024 +doclet.linkMismatch_PackagedLinkedtoModule=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308B\u30B3\u30FC\u30C9\u3067\u306F\u540D\u524D\u306E\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001{0}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u306F\u540D\u524D\u306E\u3042\u308B\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u3082\u306E\u3067\u3059\u3002 +doclet.linkMismatch_ModuleLinkedtoPackage=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308B\u30B3\u30FC\u30C9\u3067\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001{0}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u306F\u540D\u524D\u306E\u306A\u3044\u30E2\u30B8\u30E5\u30FC\u30EB\u306E\u3082\u306E\u3067\u3059\u3002 #Documentation for Enums doclet.enum_values_doc.fullbody=\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n

\nfor ({0} c : {0}.values())\n    System.out.println(c);\n
diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties 2019-01-18 04:23:48.000000000 +0000 @@ -227,6 +227,10 @@ doclet.Description=Description doclet.ConstantField=Constant Field doclet.Value=Value +doclet.linkMismatch_PackagedLinkedtoModule=The code being documented uses packages in the unnamed module, \ + but the packages defined in {0} are in named modules. +doclet.linkMismatch_ModuleLinkedtoPackage=The code being documented uses modules but the packages defined \ + in {0} are in the unnamed module. #Documentation for Enums doclet.enum_values_doc.fullbody=\ diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties 2019-01-18 04:23:48.000000000 +0000 @@ -218,6 +218,8 @@ doclet.Description=\u8BF4\u660E doclet.ConstantField=\u5E38\u91CF\u5B57\u6BB5 doclet.Value=\u503C +doclet.linkMismatch_PackagedLinkedtoModule=\u8FDB\u884C\u6587\u6863\u5316\u7684\u4EE3\u7801\u4F7F\u7528\u4E86\u672A\u547D\u540D\u6A21\u5757\u4E2D\u7684\u7A0B\u5E8F\u5305\uFF0C\u4F46\u5728 {0} \u4E2D\u5B9A\u4E49\u7684\u7A0B\u5E8F\u5305\u5728\u547D\u540D\u6A21\u5757\u4E2D\u3002 +doclet.linkMismatch_ModuleLinkedtoPackage=\u8FDB\u884C\u6587\u6863\u5316\u7684\u4EE3\u7801\u4F7F\u7528\u4E86\u6A21\u5757\uFF0C\u4F46\u5728 {0} \u4E2D\u5B9A\u4E49\u7684\u7A0B\u5E8F\u5305\u5728\u672A\u547D\u540D\u6A21\u5757\u4E2D\u3002 #Documentation for Enums doclet.enum_values_doc.fullbody=\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n
\nfor ({0} c : {0}.values())\n    System.out.println(c);\n
diff -Nru openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java --- openjdk-lts-11~28/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java 2019-01-18 04:23:48.000000000 +0000 @@ -29,8 +29,10 @@ import java.net.*; import java.util.HashMap; import java.util.Map; +import java.util.TreeMap; import javax.lang.model.element.Element; +import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import javax.tools.Diagnostic; import javax.tools.DocumentationTool; @@ -59,7 +61,8 @@ * Map element names onto Extern Item objects. * Lazily initialized. */ - private Map elementToItemMap; + private Map moduleItems = new HashMap<>(); + private Map> packageItems = new HashMap<>(); /** * The global configuration information for this run. @@ -85,7 +88,7 @@ * The URL or the directory path at which the element documentation will be * avaliable. */ - final String path; + final DocPath path; /** * If given path is directory path then true else if it is a URL then false. @@ -93,11 +96,6 @@ final boolean relative; /** - * If the item is a module then true else if it is a package then false. - */ - boolean isModule = false; - - /** * Constructor to build a Extern Item object and map it with the element name. * If the same element name is found in the map, then the first mapped * Item object or offline location will be retained. @@ -106,19 +104,11 @@ * @param path URL or Directory path from where the "element-list" * file is picked. * @param relative True if path is URL, false if directory path. - * @param isModule True if the item is a module. False if it is a package. */ - Item(String elementName, String path, boolean relative, boolean isModule) { + Item(String elementName, DocPath path, boolean relative) { this.elementName = elementName; this.path = path; this.relative = relative; - this.isModule = isModule; - if (elementToItemMap == null) { - elementToItemMap = new HashMap<>(); - } - if (!elementToItemMap.containsKey(elementName)) { // save the previous - elementToItemMap.put(elementName, this); // mapped location - } } /** @@ -126,7 +116,7 @@ */ @Override public String toString() { - return elementName + (relative? " -> " : " => ") + path; + return elementName + (relative? " -> " : " => ") + path.getPath(); } } @@ -141,14 +131,15 @@ * @return true if the element is externally documented */ public boolean isExternal(Element element) { - if (elementToItemMap == null) { + if (packageItems.isEmpty()) { return false; } PackageElement pe = configuration.utils.containingPackage(element); if (pe.isUnnamed()) { return false; } - return elementToItemMap.get(configuration.utils.getPackageName(pe)) != null; + + return findElementItem(pe) != null; } /** @@ -158,25 +149,25 @@ * @return true if the element is a module */ public boolean isModule(String elementName) { - Item elem = findElementItem(elementName); - return (elem == null) ? false : elem.isModule; + Item elem = moduleItems.get(elementName); + return (elem == null) ? false : true; } /** * Convert a link to be an external link if appropriate. * - * @param elemName The element name. + * @param element The element . * @param relativepath The relative path. * @param filename The link to convert. * @return if external return converted link else return null */ - public DocLink getExternalLink(String elemName, DocPath relativepath, String filename) { - return getExternalLink(elemName, relativepath, filename, null); + public DocLink getExternalLink(Element element, DocPath relativepath, String filename) { + return getExternalLink(element, relativepath, filename, null); } - public DocLink getExternalLink(String elemName, DocPath relativepath, String filename, + public DocLink getExternalLink(Element element, DocPath relativepath, String filename, String memberName) { - Item fnd = findElementItem(elemName); + Item fnd = findElementItem(element); if (fnd == null) return null; @@ -184,7 +175,7 @@ // to contain external URLs! DocPath p = fnd.relative ? relativepath.resolve(fnd.path).resolve(filename) : - DocPath.create(fnd.path).resolve(filename); + fnd.path.resolve(filename); return new DocLink(p, "is-external=true", memberName); } @@ -266,13 +257,20 @@ /** * Get the Extern Item object associated with this element name. * - * @param elemName Element name. + * @param element Element */ - private Item findElementItem(String elemName) { - if (elementToItemMap == null) { - return null; + private Item findElementItem(Element element) { + Item item = null; + if (element instanceof ModuleElement) { + item = moduleItems.get(configuration.utils.getModuleName((ModuleElement)element)); + } + else if (element instanceof PackageElement) { + PackageElement packageElement = (PackageElement)element; + ModuleElement moduleElement = configuration.utils.containingModule(packageElement); + Map pkgMap = packageItems.get(configuration.utils.getModuleName(moduleElement)); + item = (pkgMap != null) ? pkgMap.get(configuration.utils.getPackageName(packageElement)) : null; } - return elementToItemMap.get(elemName); + return item; } /** @@ -370,23 +368,34 @@ * @throws IOException if there is a problem reading or closing the stream */ private void readElementList(InputStream input, String path, boolean relative) - throws IOException { + throws Fault, IOException { try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) { - in.lines().forEach((elemname) -> { + String elemname = null; + String moduleName = null; + DocPath elempath = null; + DocPath basePath = DocPath.create(path); + while ((elemname = in.readLine()) != null) { if (elemname.length() > 0) { - boolean module; - String elempath; + elempath = basePath; if (elemname.startsWith(DocletConstants.MODULE_PREFIX)) { - elemname = elemname.replace(DocletConstants.MODULE_PREFIX, ""); - elempath = path; - module = true; + moduleName = elemname.replace(DocletConstants.MODULE_PREFIX, ""); + Item item = new Item(moduleName, elempath, relative); + moduleItems.put(moduleName, item); } else { - elempath = path + elemname.replace('.', '/') + '/'; - module = false; + DocPath pkgPath = DocPath.create(elemname.replace('.', '/')); + if (configuration.useModuleDirectories && moduleName != null) { + elempath = elempath.resolve(DocPath.create(moduleName).resolve(pkgPath)); + } else { + elempath = elempath.resolve(pkgPath); + } + checkLinkCompatibility(elemname, moduleName, path); + Item item = new Item(elemname, elempath, relative); + packageItems.computeIfAbsent(moduleName == null ? + DocletConstants.DEFAULT_ELEMENT_NAME : moduleName, k -> new TreeMap<>()) + .put(elemname, item); } - Item ignore = new Item(elemname, elempath, relative, module); } - }); + } } } @@ -400,4 +409,18 @@ return false; } } + + private void checkLinkCompatibility(String packageName, String moduleName, String path) throws Fault { + PackageElement pe = configuration.utils.elementUtils.getPackageElement(packageName); + if (pe != null) { + ModuleElement me = (ModuleElement)pe.getEnclosingElement(); + if (me == null || me.isUnnamed()) { + if (moduleName != null) + throw new Fault(configuration.getText("doclet.linkMismatch_PackagedLinkedtoModule", + path), null); + } else if (moduleName == null) + throw new Fault(configuration.getText("doclet.linkMismatch_ModuleLinkedtoPackage", + path), null); + } + } } diff -Nru openjdk-lts-11~28/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java openjdk-lts-11.0.2+9/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java --- openjdk-lts-11~28/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java 2019-01-18 04:23:48.000000000 +0000 @@ -325,9 +325,6 @@ } } else { jf = new JarFile(f, false, ZipFile.OPEN_READ, version); - if (!jf.isMultiRelease()) { - throw new MultiReleaseException("err.multirelease.option.exists", f.getName()); - } } return jf; } diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_es_VE.properties openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_es_VE.properties --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_es_VE.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_es_VE.properties 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 @@ -37,4 +37,4 @@ VEB=Bs VEF=Bs.F. - +VES=Bs.S. diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_de.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Magadanische Sommerzeit", "MAGST", "Magadanische Zeit", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Philippinische Zeit", "PHT", - "Philippinische Sommerzeit", "PHST", - "Philippinische Zeit", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_es.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Hora de verano de Magad\u00e1n", "MAGST", "Hora de Magad\u00E1n", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Hora de Filipinas", "PHT", - "Hora de verano de Filipinas", "PHST", - "Hora de Filipinas", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_fr.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Heure d'\u00e9t\u00e9 de Magadan", "MAGST", "Heure de Magadan", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Heure des Philippines", "PHT", - "Heure d'\u00e9t\u00e9 des Philippines", "PHST", - "Heure des Philippines", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_it.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Ora estiva di Magadan", "MAGST", "Ora di Magadan", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Ora delle Filippine", "PHT", - "Ora estiva delle Filippine", "PHST", - "Ora delle Filippine", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ja.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "\u30de\u30ac\u30c0\u30f3\u590f\u6642\u9593", "MAGST", "\u30DE\u30AC\u30C0\u30F3\u6642\u9593", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"\u30d5\u30a3\u30ea\u30d4\u30f3\u6642\u9593", "PHT", - "\u30d5\u30a3\u30ea\u30d4\u30f3\u590f\u6642\u9593", "PHST", - "\u30D5\u30A3\u30EA\u30D4\u30F3\u6642\u9593", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_ko.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "\ub9c8\uac00\ub2e8 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "MAGST", "\uB9C8\uAC00\uB2E8 \uD45C\uC900\uC2DC", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"\ud544\ub9ac\ud540 \uc2dc\uac04", "PHT", - "\ud544\ub9ac\ud540 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "PHST", - "\uD544\uB9AC\uD540 \uD45C\uC900\uC2DC", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_pt_BR.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST", "Hor\u00E1rio de Magadan", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT", - "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST", - "Hor\u00E1rio das Filipinas", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_sv.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Magadan, sommartid", "MAGST", "Magadan-tid", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Filippinerna, normaltid", "PHT", - "Filippinerna, sommartid", "PHST", - "Filippinsk tid", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_CN.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Magadan \u590f\u4ee4\u65f6", "MAGST", "Magadan \u65F6\u95F4", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"\u83f2\u5f8b\u5bbe\u65f6\u95f4", "PHT", - "\u83f2\u5f8b\u5bbe\u590f\u4ee4\u65f6", "PHST", - "\u83F2\u5F8B\u5BBE\u65F6\u95F4", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java --- openjdk-lts-11~28/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.localedata/share/classes/sun/util/resources/ext/TimeZoneNames_zh_TW.java 2019-01-18 04:23:48.000000000 +0000 @@ -667,9 +667,9 @@ "Magadan \u590f\u4ee4\u6642\u9593", "MAGST", "\u99AC\u52A0\u4E39\u6642\u9593", "MAGT"}}, {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"\u83f2\u5f8b\u8cd3\u6642\u9593", "PHT", - "\u83f2\u5f8b\u8cd3\u590f\u4ee4\u6642\u9593", "PHST", - "\u83F2\u5F8B\u8CD3\u6642\u9593", "PHT"}}, + {"Asia/Manila", new String[] {"Philippines Standard Time", "PST", + "Philippines Daylight Time", "PDT", + "Philippines Time", "PT"}}, {"Asia/Muscat", GST}, {"Asia/Nicosia", EET}, {"Asia/Novokuznetsk", KRAT}, diff -Nru openjdk-lts-11~28/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java openjdk-lts-11.0.2+9/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java --- openjdk-lts-11~28/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -1601,13 +1601,14 @@ } } - switch (nameStr) { - case "context": + if ("context".equals(nameStr)) { return sctxt; - case "engine": - return global.engine; - default: - break; + } else if ("engine".equals(nameStr)) { + // expose "engine" variable only when there is no security manager + // or when no class filter is set. + if (System.getSecurityManager() == null || global.getClassFilter() == null) { + return global.engine; + } } if (self == UNDEFINED) { diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/compiler/c2/SubsumingLoadsCauseFlagSpill.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/c2/SubsumingLoadsCauseFlagSpill.java --- openjdk-lts-11~28/test/hotspot/jtreg/compiler/c2/SubsumingLoadsCauseFlagSpill.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/c2/SubsumingLoadsCauseFlagSpill.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018, 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 8209639 + * @summary assert failure in coalesce.cpp: attempted to spill a non-spillable item + * + * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,SubsumingLoadsCauseFlagSpill::not_inlined -Xmx1024m SubsumingLoadsCauseFlagSpill + * + */ + +public class SubsumingLoadsCauseFlagSpill { + private static Object field; + private static boolean do_throw; + private static volatile boolean barrier; + + public static void main(String[] args) { + for (int i = 0; i < 20_000; i++) { + do_throw = true; + field = null; + test(0); + do_throw = false; + field = new Object(); + test(0); + } + } + + private static float test(float f) { + Object v = null; + try { + not_inlined(); + v = field; + } catch (MyException me) { + v = field; + barrier = true; + } + if (v == null) { + return f * f; + } + return f; + } + + private static void not_inlined() throws MyException{ + if (do_throw) { + throw new MyException(); + } + } + + private static class MyException extends Throwable { + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/compiler/codegen/aes/TestAESMain.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/codegen/aes/TestAESMain.java --- openjdk-lts-11~28/test/hotspot/jtreg/compiler/codegen/aes/TestAESMain.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/codegen/aes/TestAESMain.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -29,65 +29,95 @@ * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset= + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=GCM -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CTR -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.codegen.aes.TestAESMain * * @author Tom Deneau @@ -95,9 +125,28 @@ package compiler.codegen.aes; +import compiler.whitebox.CompilerWhiteBoxTest; +import sun.hotspot.code.Compiler; + public class TestAESMain { public static void main(String[] args) { - int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); + String mode = System.getProperty("mode", "CBC"); + if ((mode.equals("CBC") || mode.equals("ECB")) && + !Compiler.isIntrinsicAvailable(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION, "com.sun.crypto.provider.AESCrypt", "implEncryptBlock", byte[].class, int.class, byte[].class, int.class)) { + System.out.println("AES intrinsic is not available"); + return; + } + if (mode.equals("GCM") && + !Compiler.isIntrinsicAvailable(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION, "com.sun.crypto.provider.GHASH", "processBlocks", byte[].class, int.class, int.class, long[].class, long[].class)) { + System.out.println("GHASH intrinsic is not available"); + return; + } + if (mode.equals("CTR") && + !Compiler.isIntrinsicAvailable(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION, "com.sun.crypto.provider.CounterMode", "implCrypt", byte[].class, int.class, int.class, byte[].class, int.class)) { + System.out.println("AES-CTR intrinsic is not available"); + return; + } + int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 100000); int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000); System.out.println(iters + " iterations"); TestAESEncode etest = new TestAESEncode(); diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/compiler/intrinsics/base64/TestBase64.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/intrinsics/base64/TestBase64.java --- openjdk-lts-11~28/test/hotspot/jtreg/compiler/intrinsics/base64/TestBase64.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/compiler/intrinsics/base64/TestBase64.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,8 +25,12 @@ * @test * @author Eric Wang * @summary tests java.util.Base64 + * @library /test/lib / + * @build sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. * compiler.intrinsics.base64.TestBase64 */ @@ -45,12 +49,18 @@ import java.util.Objects; import java.util.Random; +import compiler.whitebox.CompilerWhiteBoxTest; +import sun.hotspot.code.Compiler; public class TestBase64 { static boolean checkOutput = Boolean.getBoolean("checkOutput"); public static void main(String[] args) throws Exception { - int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000); + if (!Compiler.isIntrinsicAvailable(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION, "java.util.Base64$Encoder", "encodeBlock", byte[].class, int.class, int.class, byte[].class, int.class, boolean.class)) { + System.out.println("Base64 intrinsic is not available"); + return; + } + int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 100000); System.out.println(iters + " iterations"); test0(Base64Type.BASIC, Base64.getEncoder(), Base64.getDecoder(),"plain.txt", "baseEncode.txt", iters); diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/epsilon/TestAlignment.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/epsilon/TestAlignment.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/epsilon/TestAlignment.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/epsilon/TestAlignment.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018, 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 TestAlignment + * @key gc + * @requires vm.gc.Epsilon & !vm.graal.enabled + * @summary Check Epsilon runs fine with (un)usual alignments + * @bug 8212005 + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:+UseTLAB TestAlignment + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:-UseTLAB TestAlignment + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:+UseTLAB -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestAlignment + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:-UseTLAB -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestAlignment + */ + +public class TestAlignment { + static Object sink; + + public static void main(String[] args) throws Exception { + for (int c = 0; c < 1000; c++) { + sink = new byte[c]; + } + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018, 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 TestMaxTLAB + * @key gc + * @requires vm.gc.Epsilon & !vm.graal.enabled + * @summary Check EpsilonMaxTLAB options + * @bug 8212177 + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 TestMaxTLAB + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + */ + +public class TestMaxTLAB { + static Object sink; + + public static void main(String[] args) throws Exception { + for (int c = 0; c < 1000; c++) { + sink = new byte[c]; + } + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithAllocateHeapAt.java 2019-01-18 04:23:48.000000000 +0000 @@ -28,7 +28,7 @@ * @test TestGCBasherWithAllocateHeapAt * @key gc stress * @requires vm.gc.G1 - * @requires vm.flavor == "server" & !vm.emulatedClient + * @requires vm.flavor == "server" & !vm.emulatedClient & os.family != "aix" * @summary Stress Java heap allocation with AllocateHeapAt flag using GC basher. * @run main/othervm/timeout=500 -Xlog:gc*=info -Xmx256m -server -XX:+UseG1GC -XX:AllocateHeapAt=. TestGCBasherWithAllocateHeapAt 120000 */ diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java 2019-01-18 04:23:48.000000000 +0000 @@ -24,7 +24,7 @@ /* @test TestAllocateHeapAtError.java * @key gc * @summary Test to check correct handling of non-existent directory passed to AllocateHeapAt option - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & os.family != "aix" * @library /test/lib * @modules java.base/jdk.internal.misc */ diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAt.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAt.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAt.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAt.java 2019-01-18 04:23:48.000000000 +0000 @@ -24,7 +24,7 @@ /* @test TestAllocateHeapAt.java * @key gc * @summary Test to check allocation of Java Heap with AllocateHeapAt option - * @requires vm.gc != "Z" + * @requires vm.gc != "Z" & os.family != "aix" * @library /test/lib * @modules java.base/jdk.internal.misc */ diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java --- openjdk-lts-11~28/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,7 +26,7 @@ * @summary Test to check allocation of Java Heap with AllocateHeapAt option. Has multiple sub-tests to cover different code paths. * @library /test/lib * @modules java.base/jdk.internal.misc - * @requires vm.bits == "64" & vm.gc != "Z" + * @requires vm.bits == "64" & vm.gc != "Z" & os.family != "aix" */ import jdk.test.lib.JDKToolFinder; diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/ProblemList.txt openjdk-lts-11.0.2+9/test/hotspot/jtreg/ProblemList.txt --- openjdk-lts-11~28/test/hotspot/jtreg/ProblemList.txt 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/ProblemList.txt 2019-01-18 04:23:48.000000000 +0000 @@ -59,6 +59,8 @@ compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all +compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x + ############################################################################# # :hotspot_gc @@ -85,43 +87,44 @@ serviceability/sa/ClhsdbAttach.java 8193639 solaris-all serviceability/sa/ClhsdbCDSCore.java 8207832 linux-x64 -serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all +serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbField.java 8193639 solaris-all -serviceability/sa/ClhsdbFindPC.java 8193639 solaris-all +serviceability/sa/ClhsdbFindPC.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbFlags.java 8193639 solaris-all -serviceability/sa/ClhsdbInspect.java 8193639 solaris-all -serviceability/sa/ClhsdbJdis.java 8193639 solaris-all -serviceability/sa/ClhsdbJhisto.java 8193639 solaris-all -serviceability/sa/ClhsdbJstack.java 8193639 solaris-all +serviceability/sa/ClhsdbInspect.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/ClhsdbJdis.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/ClhsdbJhisto.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/ClhsdbJstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbLongConstant.java 8193639 solaris-all -serviceability/sa/ClhsdbPmap.java 8193639 solaris-all +serviceability/sa/ClhsdbPmap.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbPrintAll.java 8193639 solaris-all -serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all +serviceability/sa/ClhsdbPrintAs.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all -serviceability/sa/ClhsdbPstack.java 8193639 solaris-all +serviceability/sa/ClhsdbPstack.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all -serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all -serviceability/sa/ClhsdbSource.java 8193639 solaris-all +serviceability/sa/ClhsdbScanOops.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/ClhsdbSource.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbSymbol.java 8193639 solaris-all serviceability/sa/ClhsdbSymbolTable.java 8193639 solaris-all -serviceability/sa/ClhsdbThread.java 8193639 solaris-all +serviceability/sa/ClhsdbThread.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all -serviceability/sa/ClhsdbWhere.java 8193639 solaris-all -serviceability/sa/DeadlockDetectionTest.java 8193639 solaris-all -serviceability/sa/JhsdbThreadInfoTest.java 8193639 solaris-all +serviceability/sa/ClhsdbWhere.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/DeadlockDetectionTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/JhsdbThreadInfoTest.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all serviceability/sa/TestClassDump.java 8193639 solaris-all -serviceability/sa/TestCpoolForInvokeDynamic.java 8193639 solaris-all +serviceability/sa/TestClhsdbJstackLock.java 8211767 linux-ppc64le,linux-ppc64 +serviceability/sa/TestCpoolForInvokeDynamic.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/TestDefaultMethods.java 8193639 solaris-all serviceability/sa/TestG1HeapRegion.java 8193639 solaris-all serviceability/sa/TestHeapDumpForInvokeDynamic.java 8193639 solaris-all serviceability/sa/TestHeapDumpForLargeArray.java 8193639 solaris-all serviceability/sa/TestInstanceKlassSizeForInterface.java 8193639 solaris-all -serviceability/sa/TestIntConstant.java 8193639 solaris-all -serviceability/sa/TestJhsdbJstackLock.java 8193639 solaris-all +serviceability/sa/TestIntConstant.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 +serviceability/sa/TestJhsdbJstackLock.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all serviceability/sa/TestType.java 8193639 solaris-all -serviceability/sa/TestUniverse.java#id0 8193639 solaris-all +serviceability/sa/TestUniverse.java#id0 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64 ############################################################################# diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java 2019-01-18 04:23:48.000000000 +0000 @@ -43,6 +43,7 @@ import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.code.Compiler; +import sun.hotspot.gc.GC; public class IncompatibleOptions { static final String COOPS_DUMP_WARNING = @@ -63,7 +64,7 @@ // Uncompressed OOPs testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", COOPS_DUMP_WARNING, true); - if (Platform.isLinux() && Platform.isX64()) { + if (GC.Z.isSupported()) { // ZGC is included in build. testDump(1, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC", COOPS_DUMP_WARNING, true); } diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * 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. + */ + +/* + * @test ConstantPoolDependsTest + * @bug 8210094 + * @summary Create ClassLoader dependency from initiating loader to class loader through constant pool reference + * @requires vm.opt.final.ClassUnloading + * @modules java.base/jdk.internal.misc + * java.compiler + * @library /runtime/testlibrary /test/lib + * @build sun.hotspot.WhiteBox + * @compile p2/c2.java MyDiffClassLoader.java + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ConstantPoolDependsTest + */ + +import sun.hotspot.WhiteBox; + + +public class ConstantPoolDependsTest { + public static WhiteBox wb = WhiteBox.getWhiteBox(); + public static final String MY_TEST = "ConstantPoolDependsTest$c1c"; + + public static class c1c { + private void test() throws Exception { + // ConstantPool.klass_at_impl loads through constant pool and creates dependency + p2.c2 c2_obj = new p2.c2(); + c2_obj.method2(); + } + + public c1c () throws Exception { + test(); + ClassUnloadCommon.triggerUnloading(); // should not unload anything + test(); + ClassUnloadCommon.triggerUnloading(); // should not unload anything + } + } + + static void test() throws Throwable { + + // now use the same loader to load class MyTest + Class MyTest_class = new MyDiffClassLoader(MY_TEST).loadClass(MY_TEST); + + try { + // Call MyTest to load p2.c2 twice and call p2.c2.method2 + MyTest_class.newInstance(); + } catch (Exception e) { + throw new RuntimeException("Test FAILED if NoSuchMethodException is thrown"); + } + ClassUnloadCommon.triggerUnloading(); // should not unload anything + ClassUnloadCommon.failIf(!wb.isClassAlive(MY_TEST), "should not be unloaded"); + ClassUnloadCommon.failIf(!wb.isClassAlive("p2.c2"), "should not be unloaded"); + // Unless MyTest_class is referenced here, the compiler can unload it. + System.out.println("Should not unload anything before here because " + MyTest_class + " is still alive."); + } + + public static void main(String args[]) throws Throwable { + test(); + ClassUnloadCommon.triggerUnloading(); // should unload + System.gc(); + System.out.println("Should unload p2.c2 just now"); + ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded"); + ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded"); + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/DictionaryDependsTest.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/DictionaryDependsTest.java --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/DictionaryDependsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/DictionaryDependsTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * 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. + */ + +/* + * @test DictionaryDependsTest + * @bug 8210094 + * @summary Create ClassLoader dependency from initiating loader to class loader through reflection + * @requires vm.opt.final.ClassUnloading + * @modules java.base/jdk.internal.misc + * java.compiler + * @library /runtime/testlibrary /test/lib + * @build sun.hotspot.WhiteBox + * @compile p2/c2.java MyDiffClassLoader.java + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DictionaryDependsTest + */ +import sun.hotspot.WhiteBox; +import java.lang.reflect.Method; + +public class DictionaryDependsTest { + public static WhiteBox wb = WhiteBox.getWhiteBox(); + public static final String MY_TEST = "DictionaryDependsTest$c1r"; + + static public class c1r { + + private void test() throws Exception { + // forName loads through reflection and doesn't create dependency + Class x = Class.forName("p2.c2", true, c1r.class.getClassLoader()); + Method m = x.getMethod("method2"); + java.lang.Object t = x.newInstance(); + m.invoke(t); + } + + public c1r () throws Exception { + test(); + ClassUnloadCommon.triggerUnloading(); // should unload p2.c2 + test(); + ClassUnloadCommon.triggerUnloading(); // should unload p2.c2 + } + } + + public void test() throws Throwable { + + // now use the same loader to load class MyTest + Class MyTest_class = new MyDiffClassLoader(MY_TEST).loadClass(MY_TEST); + + try { + // Call MyTest to load p2.c2 twice and call p2.c2.method2 + MyTest_class.newInstance(); + } catch (Exception e) { + System.out.println("Not expected NSME"); + throw new RuntimeException("Not expecting NSME"); + } + ClassUnloadCommon.triggerUnloading(); // should not unload anything + ClassUnloadCommon.failIf(!wb.isClassAlive(MY_TEST), "should not be unloaded"); + ClassUnloadCommon.failIf(!wb.isClassAlive("p2.c2"), "should not be unloaded"); + // Unless MyTest_class is referenced here, the compiler can unload it. + System.out.println("Should not unload anything before here because " + MyTest_class + " is still alive."); + } + + public static void main(String args[]) throws Throwable { + DictionaryDependsTest d = new DictionaryDependsTest(); + d.test(); + ClassUnloadCommon.triggerUnloading(); // should not unload anything + System.out.println("Should unload MyTest and p2.c2 just now"); + ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded"); + ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded"); + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/MyDiffClassLoader.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/MyDiffClassLoader.java --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/ClassUnload/MyDiffClassLoader.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/ClassUnload/MyDiffClassLoader.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * 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. + */ + +import java.io.*; +import jdk.test.lib.compiler.InMemoryJavaCompiler; + +public class MyDiffClassLoader extends ClassLoader { + + public String loaderName; + public static boolean switchClassData = false; + + MyDiffClassLoader(String name) { + this.loaderName = name; + } + + public Class loadClass(String name) throws ClassNotFoundException { + if (!name.contains("c1r") && + !name.contains("c1c") && + !name.contains("c1s") && + !name.equals("p2.c2")) { + return super.loadClass(name); + } + + // new loader loads p2.c2 + if (name.equals("p2.c2") && !loaderName.equals("C2Loader")) { + Class c = new MyDiffClassLoader("C2Loader").loadClass(name); + switchClassData = true; + return c; + } + + byte[] data = switchClassData ? getNewClassData(name) : getClassData(name); + System.out.println("name is " + name); + return defineClass(name, data, 0, data.length); + } + byte[] getClassData(String name) { + try { + String TempName = name.replaceAll("\\.", "/"); + String currentDir = System.getProperty("test.classes"); + String filename = currentDir + File.separator + TempName + ".class"; + FileInputStream fis = new FileInputStream(filename); + byte[] b = new byte[5000]; + int cnt = fis.read(b, 0, 5000); + byte[] c = new byte[cnt]; + for (int i=0; i"; // #12 + Utf8 "()V"; // #13 + Utf8 "Code"; // #14 + Utf8 "LineNumberTable"; // #15 + Utf8 "m"; // #16 + Utf8 "()I"; // #17 + Utf8 "test"; // #18 + Utf8 "SourceFile"; // #19 + Utf8 "TestDeletedMethod.java"; // #20 + NameAndType #12 #13; // #21 + class #30; // #22 + NameAndType #31 #32; // #23 + Utf8 "Sub.m"; // #24 + class #33; // #25 + NameAndType #34 #35; // #26 + Utf8 "TestDeletedMethod_Sub"; // #27 + NameAndType #16 #17; // #28 + Utf8 "TestDeletedMethod_Super"; // #29 + Utf8 "java/lang/System"; // #30 + Utf8 "out"; // #31 + Utf8 "Ljava/io/PrintStream;"; // #32 + Utf8 "java/io/PrintStream"; // #33 + Utf8 "println"; // #34 + Utf8 "(Ljava/lang/String;)V"; // #35 + Utf8 "m_renamed"; // #36 added + } // Constant Pool + + 0x0020; // access + #5;// this_cpx + #7;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x0019; // access + #8; // name_cpx + #9; // sig_cpx + [] { // Attributes + Attr(#10) { // ConstantValue + #11; + } // end ConstantValue + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0000; // access + #12; // name_cpx + #13; // sig_cpx + [] { // Attributes + Attr(#14) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#15) { // LineNumberTable + [] { // LineNumberTable + 0 43; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x000A; // access + #36; // name_cpx UPDATED to rename method + #17; // sig_cpx + [] { // Attributes + Attr(#14) { // Code + 2; // max_stack + 0; // max_locals + Bytes[]{ + 0xB200021203B60004; + 0x04AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#15) { // LineNumberTable + [] { // LineNumberTable + 0 47; + 8 48; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #18; // name_cpx + #17; // sig_cpx + [] { // Attributes + Attr(#14) { // Code + 1; // max_stack + 0; // max_locals + Bytes[]{ + 0xB80006AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#15) { // LineNumberTable + [] { // LineNumberTable + 0 51; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#19) { // SourceFile + #20; + } // end SourceFile + } // Attributes +} // end class TestDeletedMethod_Sub diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Super.jcod openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Super.jcod --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Super.jcod 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/linkResolver/TestDeletedMethod_Super.jcod 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,143 @@ +/* + * 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. + */ + +// We have set the class file version to 49 to allow relaxed access checks + +class TestDeletedMethod_Super { + 0xCAFEBABE; + 0; // minor version + 49; // version + [] { // Constant Pool + ; // first element is empty + Method #6 #19; // #1 + Field #20 #21; // #2 + String #22; // #3 + Method #23 #24; // #4 + class #25; // #5 + class #26; // #6 + Utf8 "ID"; // #7 + Utf8 "I"; // #8 + Utf8 "ConstantValue"; // #9 + int 0x00000002; // #10 + Utf8 ""; // #11 + Utf8 "()V"; // #12 + Utf8 "Code"; // #13 + Utf8 "LineNumberTable"; // #14 + Utf8 "m"; // #15 + Utf8 "()I"; // #16 + Utf8 "SourceFile"; // #17 + Utf8 "TestDeletedMethod.java"; // #18 + NameAndType #11 #12; // #19 + class #27; // #20 + NameAndType #28 #29; // #21 + Utf8 "Super.m"; // #22 + class #30; // #23 + NameAndType #31 #32; // #24 + Utf8 "TestDeletedMethod_Super"; // #25 + Utf8 "java/lang/Object"; // #26 + Utf8 "java/lang/System"; // #27 + Utf8 "out"; // #28 + Utf8 "Ljava/io/PrintStream;"; // #29 + Utf8 "java/io/PrintStream"; // #30 + Utf8 "println"; // #31 + Utf8 "(Ljava/lang/String;)V"; // #32 + } // Constant Pool + + 0x0020; // access + #5;// this_cpx + #6;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x0019; // access + #7; // name_cpx + #8; // sig_cpx + [] { // Attributes + Attr(#9) { // ConstantValue + #10; + } // end ConstantValue + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0000; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 35; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x000A; // access + #15; // name_cpx + #16; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 2; // max_stack + 0; // max_locals + Bytes[]{ + 0xB200021203B60004; + 0x05AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + Attr(#14) { // LineNumberTable + [] { // LineNumberTable + 0 38; + 8 39; + } + } // end LineNumberTable + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#17) { // SourceFile + #18; + } // end SourceFile + } // Attributes +} // end class TestDeletedMethod_Super diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java --- openjdk-lts-11~28/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8046171 + * @bug 8046171 8211065 * @summary Setup nestmate calls to private methods then use * modified jcod classes to introduce errors. Test with * and without verification enabled @@ -96,14 +96,10 @@ System.out.println("Got expected exception:" + nsme); } - try { - MissingMethodWithSuper m = new MissingMethodWithSuper(); - m.priv_invoke(); - throw new Error("Unexpected success invoking MissingMethodWithSuper.priv_invoke"); - } - catch (NoSuchMethodError nsme) { - System.out.println("Got expected exception:" + nsme); - } + // This test was revised to expect successful invocation of the + // super class method - see JDK-8211065 + MissingMethodWithSuper m = new MissingMethodWithSuper(); + m.priv_invoke(); // Verification of Helper will trigger the nestmate access check failure try { diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java 2019-01-18 04:23:48.000000000 +0000 @@ -78,6 +78,7 @@ CDSTestUtils.createArchiveAndCheck(opts); String[] jArgs = { + "-Xmx512m", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + SHARED_ARCHIVE_NAME, "-XX:+CreateCoredumpOnCrash", diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/libNoFramePointer.c openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/libNoFramePointer.c --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/libNoFramePointer.c 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/libNoFramePointer.c 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#include + +static jlong fib(jint num) { + if (num == 0) { + return 0; + } + if (num <= 2) { + return 1; + } + return fib(num - 2) + fib(num -1); +} + +static void callCallback(JNIEnv *env, jclass cls, jobject target, jlong result) { + jmethodID mid = (*env)->GetMethodID(env, cls, "callback", "(J)V"); + if (mid == NULL) { + jclass nsme = (jclass) (*env)->NewGlobalRef(env, (*env)->FindClass(env, "java/lang/NoSuchMethodException")); + if (nsme != NULL) { + (*env)->ThrowNew(env, nsme, "Can't find method callback()"); + } + return; + } + (*env)->CallVoidMethod(env, target, mid, result); +} + +static void calculateAndCallCallback(JNIEnv *env, jclass cls, jobject target, jint num) { + jlong result = -1; + result = fib(num); + callCallback(env, cls, target, result); +} + +JNIEXPORT void JNICALL +Java_LingeredAppWithNativeMethod_callJNI(JNIEnv *env, jclass cls, jobject target, jint num) { + calculateAndCallCallback(env, cls, target, num); +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/LingeredAppWithNativeMethod.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/LingeredAppWithNativeMethod.java --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/LingeredAppWithNativeMethod.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/LingeredAppWithNativeMethod.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,74 @@ + +/* + * 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. + */ + +import jdk.test.lib.apps.LingeredApp; + +public class LingeredAppWithNativeMethod extends LingeredApp { + + public static final String THREAD_NAME = "NoFramePointerJNIFib"; + private static final int UPPER_BOUND = 55; + private static final int LOWER_BOUND = 40; + + static { + // JNI library compiled with no frame pointer info + System.loadLibrary("NoFramePointer"); + } + + public void callNative() { + // Call JNI code which does something compute + // intensive: fibonacci + // That is to ensure that the native bits run when + // jstack --mixed info is to be gathered. + // Results of fibonacci calculation from JNI are + // reported via callback(). That's where the process + // of calculating fibonacci restarts. + int num = (int) (Math.random() * UPPER_BOUND); + while (num < LOWER_BOUND) { + num = (int) (Math.random() * UPPER_BOUND); + } + System.out.print("fib(" + num + ") = "); + callJNI(this, num); + } + + // Called from JNI library libNoFramePointer + private void callback(long val) { + System.out.println(val); + // Call native again so as to increase chances of + // being currently in JNI code when jstack --mixed + // runs. + callNative(); + } + + public static native void callJNI(Object target, int num); + + public static void main(String[] args) { + LingeredAppWithNativeMethod app = new LingeredAppWithNativeMethod(); + Thread fibonacci = new Thread(() -> { + app.callNative(); + }); + fibonacci.setName(THREAD_NAME); + fibonacci.start(); + LingeredApp.main(args); + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java 2019-01-18 04:23:48.000000000 +0000 @@ -123,6 +123,7 @@ try { List vmArgs = new ArrayList(); vmArgs.add("-XX:+UsePerfData"); + vmArgs.add("-Xmx512m"); vmArgs.addAll(Utils.getVmOptions()); theApp = new LingeredAppWithInvokeDynamic(); diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,187 @@ +/* + * 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. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Utils; +import jdk.test.lib.apps.LingeredApp; +import jdk.test.lib.process.OutputAnalyzer; + +/** + * @test + * @bug 8208091 + * @requires (os.family == "linux") & (vm.hasSAandCanAttach) + * @library /test/lib + * @run main/othervm TestJhsdbJstackMixed + */ +public class TestJhsdbJstackMixed { + + private static final int MAX_ITERATIONS = 20; + private static final String NATIVE_FUNCTION_NAME = "fib"; + private static final String LINE_MATCHER_STR = ".*" + NATIVE_FUNCTION_NAME + + ".*"; + private static final Pattern LINE_PATTERN = Pattern + .compile(LINE_MATCHER_STR); + private static final String HEX_STR_PATTERN = "0x([a-fA-F0-9]+)"; + private static final String FIB_SPLIT_PATTERN = NATIVE_FUNCTION_NAME + + "\\s+\\+"; + private static final Pattern HEX_PATTERN = Pattern.compile(HEX_STR_PATTERN); + private static final int ADDRESS_ALIGNMENT_X86 = 4; + + /* + * UnmappedAddressException will be thrown iff: + * - The JNI code is being compiled with -fomit-frame-pointer AND + * - The JNI code is currently executing at address A = pc() + offset + * where A % ADDRESS_SIZE == 0. + * + * In the below example we have: pc() == f6401546, offset == 56, + * ADDRESS_SIZE == 4. Thus, A == F640159C which satisfies this condition. + * + * "NoFramePointerJNIFib" #11 prio=5 tid=0xa357bc00 nid=0x6de9 runnable [0xa365b000] + * java.lang.Thread.State: RUNNABLE + * JavaThread state: _thread_in_native + * 0xf6401546 fib + 0x56 + */ + private static boolean isFibAndAlignedAddress(List lines) { + List fibLines = findFibLines(lines); + System.out.println("DEBUG: " + fibLines); + // we're only interested in the first matched line. + if (fibLines.size() >= 1) { + String line = fibLines.get(0); + return isMatchLine(line); + } + return false; + } + + private static boolean isMatchLine(String line) { + String[] tokens = line.split(FIB_SPLIT_PATTERN); + if (tokens.length != 2) { + return false; // NOT exactly two tokens, ignore. + } + String pcRaw = tokens[0].trim(); + String offsetRaw = tokens[1].trim(); + Matcher matcher = HEX_PATTERN.matcher(pcRaw); + long pcVal = 3; + boolean pcMatched = matcher.matches(); + if (pcMatched) { + String pc = matcher.group(1); + pcVal = Long.parseUnsignedLong(pc, 16); + } + matcher = HEX_PATTERN.matcher(offsetRaw); + long offsetVal = 0; + boolean offsetMatched = matcher.matches(); + if (offsetMatched) { + String offset = matcher.group(1); + offsetVal = Long.parseUnsignedLong(offset, 16); + } + if (offsetMatched && pcMatched + && (pcVal + offsetVal) % ADDRESS_ALIGNMENT_X86 == 0) { + return true; + } + return false; + } + + private static List findFibLines(List lines) { + boolean startReached = false; + boolean endReached = false; + List interestingLines = new ArrayList<>(); + for (String line : lines) { + if (line.contains(LingeredAppWithNativeMethod.THREAD_NAME)) { + startReached = true; + } + if (startReached && line.contains("-------")) { + endReached = true; + } + if (startReached && !endReached) { + Matcher matcher = LINE_PATTERN.matcher(line); + if (matcher.matches()) { + interestingLines.add(line); + } + } + } + return interestingLines; + } + + private static void runJstackMixedInLoop(LingeredApp app) throws Exception { + for (int i = 0; i < MAX_ITERATIONS; i++) { + JDKToolLauncher launcher = JDKToolLauncher + .createUsingTestJDK("jhsdb"); + launcher.addToolArg("jstack"); + launcher.addToolArg("--mixed"); + launcher.addToolArg("--pid"); + launcher.addToolArg(Long.toString(app.getPid())); + + ProcessBuilder pb = new ProcessBuilder(); + pb.command(launcher.getCommand()); + Process jhsdb = pb.start(); + OutputAnalyzer out = new OutputAnalyzer(jhsdb); + + jhsdb.waitFor(); + + System.out.println(out.getStdout()); + System.err.println(out.getStderr()); + + out.shouldContain(LingeredAppWithNativeMethod.THREAD_NAME); + if (isFibAndAlignedAddress(out.asLines())) { + System.out.println("DEBUG: Test triggered interesting condition."); + out.shouldNotContain("sun.jvm.hotspot.debugger.UnmappedAddressException:"); + System.out.println("DEBUG: Test PASSED."); + return; // If we've reached here, all is well. + } + System.out.println("DEBUG: Iteration: " + (i + 1) + + " - Test didn't trigger interesting condition."); + out.shouldNotContain("sun.jvm.hotspot.debugger.UnmappedAddressException:"); + } + System.out.println("DEBUG: Test didn't trigger interesting condition " + + "but no UnmappedAddressException was thrown. PASS!"); + } + + public static void main(String... args) throws Exception { + + LingeredApp app = null; + + try { + List vmArgs = new ArrayList(Utils.getVmOptions()); + // Needed for LingeredApp to be able to resolve native library. + String libPath = System.getProperty("java.library.path"); + if (libPath != null) { + vmArgs.add("-Djava.library.path=" + libPath); + } + + app = new LingeredAppWithNativeMethod(); + LingeredApp.startApp(vmArgs, app); + System.out.println("Started LingeredApp with pid " + app.getPid()); + runJstackMixedInLoop(app); + System.out.println("Test Completed"); + } catch (Throwable e) { + e.printStackTrace(); + throw e; + } finally { + LingeredApp.stopApp(app); + } + } +} diff -Nru openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java --- openjdk-lts-11~28/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java 2019-01-18 04:23:48.000000000 +0000 @@ -86,7 +86,7 @@ static void test(String type) throws Throwable { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-XX:+CreateCoredumpOnCrash", - "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError", "-XX:-TransmitErrorReport", + "-Xmx512m", "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError", "-XX:-TransmitErrorReport", TestJmapCore.class.getName(), type); boolean useDefaultUlimit = useDefaultUlimit(); diff -Nru openjdk-lts-11~28/test/jdk/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java openjdk-lts-11.0.2+9/test/jdk/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java --- openjdk-lts-11~28/test/jdk/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/com/sun/crypto/provider/Cipher/PBE/PKCS12Cipher.java 2019-01-18 04:23:48.000000000 +0000 @@ -106,7 +106,7 @@ this.salt = salt; this.iCount = iCount; } - public char[] getPassword() { return passwd; } + public char[] getPassword() { return passwd.clone(); } public byte[] getSalt() { return salt; } public int getIterationCount() { return iCount; } public String getAlgorithm() { return "PBE"; } diff -Nru openjdk-lts-11~28/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java openjdk-lts-11.0.2+9/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java --- openjdk-lts-11~28/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,193 @@ +/* + * 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. + */ + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.Hashtable; + +/* + * @test + * @bug 8205330 + * @summary Test that If a connection has already been established and then + * the LDAP directory server sends an (unsolicited) + * "Notice of Disconnection", make sure client handle it correctly, + * no NPE been thrown. + * @run main/othervm DisconnectNPETest + */ + +public class DisconnectNPETest { + // Normally the NPE bug should be hit less than 100 times run, but just in + // case, we set repeat count to 1000 here. + private static final int REPEAT_COUNT = 1000; + + public static void main(String[] args) throws IOException { + new DisconnectNPETest().run(); + } + + private ServerSocket serverSocket; + private Hashtable env; + private TestLDAPServer server; + + private void initRes() throws IOException { + serverSocket = new ServerSocket(0, 0, InetAddress.getLoopbackAddress()); + server = new TestLDAPServer(); + server.start(); + } + + private void initTest() { + env = new Hashtable<>(); + env.put(Context.INITIAL_CONTEXT_FACTORY, + "com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.PROVIDER_URL, String.format("ldap://%s:%d/", + InetAddress.getLoopbackAddress().getHostName(), + serverSocket.getLocalPort())); + env.put(Context.SECURITY_AUTHENTICATION, "simple"); + env.put(Context.SECURITY_PRINCIPAL, + "cn=8205330,ou=Client6,ou=Vendor1,o=IMC,c=US"); + env.put(Context.SECURITY_CREDENTIALS, "secret123"); + } + + private void run() throws IOException { + initRes(); + initTest(); + int count = 0; + try { + while (count < REPEAT_COUNT) { + count++; + InitialDirContext context = null; + try { + context = new InitialDirContext(env); + } catch (NamingException ne) { + System.out.println("(" + count + "/" + REPEAT_COUNT + + ") It's ok to get NamingException: " + ne); + // for debug + ne.printStackTrace(System.out); + } finally { + cleanupContext(context); + } + } + } finally { + System.out.println("Test count: " + count + "/" + REPEAT_COUNT); + cleanupTest(); + } + } + + private void cleanupTest() { + if (server != null) { + server.stopServer(); + } + cleanupClosableRes(serverSocket); + } + + private void cleanupContext(DirContext context) { + if (context != null) { + try { + context.close(); + } catch (NamingException e) { + // ignore + } + } + } + + private static void cleanupClosableRes(Closeable res) { + if (res != null) { + try { + res.close(); + } catch (Exception e) { + // ignore + } + } + } + + class TestLDAPServer extends Thread { + private volatile boolean isRunning; + + TestLDAPServer() { + isRunning = true; + } + + private void stopServer() { + isRunning = false; + } + + @Override + public void run() { + try { + while (isRunning) { + Socket clientSocket = serverSocket.accept(); + Thread handler = new Thread( + new LDAPServerHandler(clientSocket)); + handler.start(); + } + } catch (IOException e) { + if (isRunning) { + throw new RuntimeException(e); + } + } + } + } + + static class LDAPServerHandler implements Runnable { + // "Notice of Disconnection" message + private static final byte[] DISCONNECT_MSG = { 0x30, 0x4C, 0x02, 0x01, + 0x00, 0x78, 0x47, 0x0A, 0x01, 0x34, 0x04, 0x00, 0x04, 0x28, + 0x55, 0x4E, 0x41, 0x56, 0x41, 0x49, 0x4C, 0x41, 0x42, 0x4C, + 0x45, 0x3A, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x64, + 0x69, 0x73, 0x63, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x21, + (byte) 0x8A, 0x16, 0x31, 0x2E, 0x33, 0x2E, 0x36, 0x2E, 0x31, + 0x2E, 0x34, 0x2E, 0x31, 0x2E, 0x31, 0x34, 0x36, 0x36, 0x2E, + 0x32, 0x30, 0x30, 0x33, 0x36 }; + private static final byte[] BIND_RESPONSE = { 0x30, 0x0C, 0x02, 0x01, + 0x01, 0x61, 0x07, 0x0A, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00 }; + private final Socket clientSocket; + + private LDAPServerHandler(final Socket clientSocket) { + this.clientSocket = clientSocket; + } + + @Override + public void run() { + try (clientSocket; + OutputStream out = clientSocket.getOutputStream(); + InputStream in = clientSocket.getInputStream()) { + if (in.read() > 0) { + in.skip(in.available()); + out.write(BIND_RESPONSE); + out.write(DISCONNECT_MSG); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff -Nru openjdk-lts-11~28/test/jdk/com/sun/net/httpserver/bugs/B8211420.java openjdk-lts-11.0.2+9/test/jdk/com/sun/net/httpserver/bugs/B8211420.java --- openjdk-lts-11~28/test/jdk/com/sun/net/httpserver/bugs/B8211420.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/com/sun/net/httpserver/bugs/B8211420.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,108 @@ +/* + * 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. + */ + +/** + * @test + * @bug 8211420 + * @run main/othervm B8211420 + * @summary + */ + +import com.sun.net.httpserver.*; + +import java.util.*; +import java.util.concurrent.*; +import java.util.logging.*; +import java.io.*; +import java.net.*; + +public class B8211420 { + + public static void main (String[] args) throws Exception { + Logger logger = Logger.getLogger ("com.sun.net.httpserver"); + ConsoleHandler c = new ConsoleHandler(); + c.setLevel (Level.WARNING); + logger.addHandler (c); + logger.setLevel (Level.WARNING); + Handler handler = new Handler(); + InetSocketAddress addr = new InetSocketAddress (0); + HttpServer server = HttpServer.create (addr, 0); + HttpContext ctx = server.createContext ("/test", handler); + ExecutorService executor = Executors.newCachedThreadPool(); + server.setExecutor (executor); + server.start (); + + URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + HttpURLConnection urlc = (HttpURLConnection)url.openConnection (); + try { + InputStream is = urlc.getInputStream(); + while (is.read()!= -1) ; + is.close (); + String prop = urlc.getHeaderField("Content-length"); + System.out.println ("Content-length = " + prop + " should be null"); + if (prop != null) + throw new RuntimeException("Content-length was present"); + + urlc = (HttpURLConnection)url.openConnection(); + is = urlc.getInputStream(); + while (is.read()!= -1) ; + is.close (); + if (urlc.getResponseCode() != 304) // expected for 2nd test + throw new RuntimeException("wrong response code"); + String clen = urlc.getHeaderField("Content-length"); + System.out.println ("Content-length = " + clen + " should be 99"); + System.out.println ("len = " + clen.length()); + if (clen == null || !clen.equals("99")) + throw new RuntimeException("Content-length not present or has wrong value"); + System.out.println ("OK"); + } finally { + server.stop(2); + executor.shutdown(); + } + } + + public static boolean error = false; + + static class Handler implements HttpHandler { + volatile int invocation = 1; + public void handle (HttpExchange t) + throws IOException + { + InputStream is = t.getRequestBody(); + Headers map = t.getRequestHeaders(); + Headers rmap = t.getResponseHeaders(); + while (is.read () != -1) ; + is.close(); + if (invocation++ == 1) { + // send a 204 response with no body + t.sendResponseHeaders(204, -1); + t.close(); + } else { + // send a 304 response with no body but with content - length + rmap.add("Content-length", "99"); + t.sendResponseHeaders(304, -1); + t.close(); + } + } + } +} diff -Nru openjdk-lts-11~28/test/jdk/java/awt/font/GlyphVector/ZWJLigatureTest.java openjdk-lts-11.0.2+9/test/jdk/java/awt/font/GlyphVector/ZWJLigatureTest.java --- openjdk-lts-11~28/test/jdk/java/awt/font/GlyphVector/ZWJLigatureTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/awt/font/GlyphVector/ZWJLigatureTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,128 @@ +/* + * 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. + */ + + +/* @test + @bug 7017058 8191130 8195836 + @summary Test handling of ZWJ by layout. + */ + +/* + * A forced mapping of ZWJ (u+200D) to a special invisible glyph ID + * was breaking many uses of ZWJ to form ligatures in fonts supporting + * Indic scripts (Malayalam, Bengali, Sinhala at least) and also Emoji. + * Without knowing the exact properties of a font under test, and also + * how a layout engine maps chars to glyphs, it is difficult to write + * a complete robust automated test. + * So whilst it tries to show rendering for any fonts that claims to + * support the target alphabet, it will fail only when specific known + * fonts fail. + * The test automatically passes or fails only if these fonts do + * not ligature away the ZWJ. + * Besides this the test renders the specific text from these fonts + * and any others that claim to fully support the text, so it can be + * manually examined if so desired. + */ + +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Point2D; +import java.awt.image.BufferedImage; +import java.util.Locale; + +public class ZWJLigatureTest { + + // These are fonts and scripts on Windows that should support + // the behaviours enough to make reliable tests"; + + static final String malayalamName = "Malayalam"; + static final String malayalamFont = "Kartika"; + static final String malayalamText = "\u0D2C\u0D3E\u0D32\u0D28\u0D4D\u200D"; + + static final String bengaliName = "Bengali"; + static final String bengaliFont = "Vrinda"; + static final String bengaliText = + "\u09CE \u09A4\u09CD\u200D " + + "\u09A4\u09BE\u09CE \u09A4\u09BE\u09A4\u09CD\u200D"; + + static final String sinhalaName = "Sinhala"; + static final String sinhalaFont = "Iskoola Pota"; + static final String sinhalaText = + "\u0DC1\u0DCA\u200D\u0DBB\u0DD3" + + "\u0D9A\u0DCA\u200D\u0DBB\u0DD2" + + "\u0D9A\u0DCA\u200D\u0DBB\u0DD3" + + "\u0DA7\u0DCA\u200D\u0DBB\u0DDA" + + "\u0DB6\u0DCA\u200D\u0DBB\u0DD0" + + "\u0D9B\u0DCA\u200D\u0DBA\u0DCF"; + + + static String[] scripts = { malayalamName, bengaliName, sinhalaName }; + static String[] fontNames = { malayalamFont, bengaliFont, sinhalaFont }; + static String[] text = { malayalamText, bengaliText, sinhalaText }; + + + static void doTest() { + boolean testFailed = false; + + BufferedImage bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = (Graphics2D)bi.getGraphics(); + FontRenderContext frc = g2d.getFontRenderContext(); + for (int f=0; f < fontNames.length; f++) { + Font font = new Font(fontNames[f], Font.PLAIN, 30); + String family = font.getFamily(Locale.ENGLISH).toLowerCase(); + if (!fontNames[f].toLowerCase().equals(family)) { + System.out.println(fontNames[f] + " not found, skipping."); + continue; + } else { + System.out.println("Testing " + fontNames[f] + + " for " + scripts[f]); + } + char[] chs = text[f].toCharArray(); + GlyphVector gv = font.layoutGlyphVector(frc, chs, 0, chs.length, 0); + for (int g=0; g Keyboard -> Shortcuts -> Keyboard\n" + + " 3) Enable 'Move focus to next window' if disabled\n" + + " 4) Enable 'Move focus to next window drawer' if disabled\n" + + " 5) Close System Preferences\n" + + " 5) Press COMMAND + ` keys to cycle through frames in forward order\n" + + " 6) Press FAIL if focus doesn't move to next frame\n" + + " 7) Press COMMAND + SHIFT + ` to cycle through frames in reverse order\n" + + " 8) Press FAIL if focus doesn't move to next frame in reverse order\n" + + " 9) Press PASS otherwise"; + + private static final String FAIL_MESSAGE = "Focus doesn't move to next frame"; + + public void showJFrame(int frameNumber) { + + String title = "Frame " + frameNumber; + frame[frameNumber] = new JFrame(title); + frame[frameNumber].setSize(300, 200); + frame[frameNumber].setLocation(50+(frameNumber*20), 50+(frameNumber*20)); + frame[frameNumber].setVisible(true); + } + + private void createAndShowFrame() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame[maxFrames]; + for (int i = 0; i < maxFrames; i++) { + showJFrame(i); + } + } + }); + } + + public void createAndShowInstructionFrame() { + Button passButton = new Button("Pass"); + passButton.setEnabled(true); + + Button failButton = new Button("Fail"); + failButton.setEnabled(true); + + TextArea instructions = new TextArea(12, 70); + instructions.setText(TEST_INSTRUCTIONS); + + instructionFrame = new Frame("Test Instructions"); + instructionFrame.add(passButton); + instructionFrame.add(failButton); + instructionFrame.add(instructions); + instructionFrame.setSize(200,200); + instructionFrame.setLayout(new FlowLayout()); + instructionFrame.pack(); + instructionFrame.setVisible(true); + + passButton.addActionListener(ae -> { + dispose(); + testContinueFlag = false; + }); + + failButton.addActionListener(ae -> { + dispose(); + testContinueFlag = false; + throw new RuntimeException(FAIL_MESSAGE); + }); + } + + private static void dispose() { + for (int i = 0; i < maxFrames; i++) { + frame[i].dispose(); + } + instructionFrame.dispose(); + } + + public static void main(String[] args) throws Exception { + + CycleThroughFrameTest testObj = new CycleThroughFrameTest(); + testObj.createAndShowFrame(); + testObj.createAndShowInstructionFrame(); + + final int sleepTime = 300000; + final int sleepLoopTime = 1000; + int remainingSleepTime = sleepTime; + while(remainingSleepTime > 0 && testContinueFlag) { + Thread.sleep(sleepLoopTime); + remainingSleepTime -= sleepLoopTime; + } + + if (testContinueFlag) { + dispose(); + throw new RuntimeException("Timed out after " + + (sleepTime - remainingSleepTime) / 1000 + " seconds"); + } + } +} + diff -Nru openjdk-lts-11~28/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java openjdk-lts-11.0.2+9/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java --- openjdk-lts-11~28/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -20,15 +20,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; import java.awt.Point; import java.awt.Robot; -import java.awt.event.MouseEvent; import java.awt.event.MouseAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowAdapter; +import java.awt.event.MouseEvent; public class FrameBorderCounter { @@ -59,6 +58,7 @@ background.setVisible(true); } }); + robot.waitForIdle(); EventQueue.invokeAndWait(new Runnable() { public void run() { frame = new Frame("Frame"); diff -Nru openjdk-lts-11~28/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java openjdk-lts-11.0.2+9/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java --- openjdk-lts-11~28/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -32,8 +32,13 @@ @run main ScreenInsetsTest */ -import java.awt.*; -import java.awt.event.*; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.Toolkit; import test.java.awt.regtesthelpers.Util; @@ -41,21 +46,33 @@ { public static void main(String[] args) { - if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) - { - // this state is used in the test - sorry - return; - } - boolean passed = true; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); - for (GraphicsDevice gd : gds) - { + for (GraphicsDevice gd : gds) { + GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle gcBounds = gc.getBounds(); Insets gcInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + int left = gcInsets.left; + int right = gcInsets.right; + int bottom = gcInsets.bottom; + int top = gcInsets.top; + if (left < 0 || right < 0 || bottom < 0 || top < 0) { + throw new RuntimeException("Negative value: " + gcInsets); + } + int maxW = gcBounds.width / 3; + int maxH = gcBounds.height / 3; + if (left > maxW || right > maxW || bottom > maxH || top > maxH) { + throw new RuntimeException("Big value: " + gcInsets); + } + + if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) + { + // this state is used in the test - sorry + continue; + } Frame f = new Frame("Test", gc); f.setUndecorated(true); diff -Nru openjdk-lts-11~28/test/jdk/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java openjdk-lts-11.0.2+9/test/jdk/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java --- openjdk-lts-11~28/test/jdk/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,106 @@ +/* + * 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. + */ + +/* @test + * @key headful + * @bug 8130655 + * @summary Tests that window owned by EmbeddedFrame can receive keyboard input + * @requires (os.family == "mac") + * @modules java.desktop/sun.awt + * @library ../../regtesthelpers + * @build Util + * @run main WindowOwnedByEmbeddedFrameTest + */ + +import sun.awt.EmbeddedFrame; + +import java.awt.Robot; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.KeyEvent; + +import test.java.awt.regtesthelpers.Util; + +public class WindowOwnedByEmbeddedFrameTest { + private static TextField textField; + private static EmbeddedFrame embeddedFrame; + private static Window window; + + public static void main(String[] args) { + try { + Robot robot = Util.createRobot(); + robot.setAutoDelay(50); + + embeddedFrame = createEmbeddedFrame(); + + textField = new TextField(""); + + window = new Window(embeddedFrame); + window.setSize(200, 200); + window.setLocationRelativeTo(null); + window.add(textField); + window.setVisible(true); + + Util.waitForIdle(robot); + + Util.clickOnComp(textField, robot); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_E); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_S); + robot.keyRelease(KeyEvent.VK_S); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + Util.waitForIdle(robot); + + if ("".equals(textField.getText())) { + throw new RuntimeException("Keyboard input in text field isn't possible"); + } + } finally { + if (embeddedFrame != null) { + embeddedFrame.dispose(); + } + if (window != null) { + window.dispose(); + } + } + } + + private static EmbeddedFrame createEmbeddedFrame() { + try { + return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); + } catch (Exception e) { + throw new RuntimeException("Cannot create EmbeddedFrame", e); + } + } +} + diff -Nru openjdk-lts-11~28/test/jdk/java/lang/management/CompositeData/ThreadInfoCompositeData.java openjdk-lts-11.0.2+9/test/jdk/java/lang/management/CompositeData/ThreadInfoCompositeData.java --- openjdk-lts-11~28/test/jdk/java/lang/management/CompositeData/ThreadInfoCompositeData.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/lang/management/CompositeData/ThreadInfoCompositeData.java 2019-01-18 04:23:48.000000000 +0000 @@ -29,8 +29,9 @@ * the input CompositeData is invalid. * @author Mandy Chung * + * @modules java.management/sun.management * @build ThreadInfoCompositeData OpenTypeConverter - * @run main ThreadInfoCompositeData + * @run testng/othervm ThreadInfoCompositeData */ @@ -42,6 +43,9 @@ import java.util.Objects; import java.util.stream.Stream; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + public class ThreadInfoCompositeData { private static String lockClassName = "myClass"; private static int lockIdentityHashCode = 123456; @@ -50,24 +54,7 @@ private static LockInfo lockInfo = new LockInfo(lockClassName, lockIdentityHashCode); - public static void main(String[] argv) throws Exception { - // A valid CompositeData is passed to ThreadInfo - createGoodCompositeData(); - // A valid CompositeData for JDK 5 ThreadInfo - // is passed to ThreadInfo - createV5ThreadInfo(); - // ThreadInfo of version N can accept lockedMonitors of version >= N - withNewMonitorInfoCompositeData(); - - // An invalid CompositeData is passed to ThreadInfo.from() - badNameCompositeData(); - badTypeCompositeData(); - badMissingCompositeData(); - withV5StackTraceCompositeData(); - withInvalidMonitorInfoCompositeData(); - System.out.println("Test passed"); - } - + @Test public static void createGoodCompositeData() throws Exception { CompositeData cd = Factory.makeThreadInfoCompositeData(); ThreadInfo info = ThreadInfo.from(cd); @@ -77,6 +64,7 @@ /* * An invalid CompositeData with JDK 9 attributes but missing JDK 6 attributes */ + @Test public static void badMissingCompositeData() throws Exception { CompositeData cd = Factory.makeCompositeDataMissingV6(); try { @@ -92,6 +80,7 @@ /* * Current version of ThreadInfo but an older version of StackTraceElement */ + @Test public static void withV5StackTraceCompositeData() throws Exception { CompositeData cd = Factory.makeThreadInfoWithV5StackTrace(); try { @@ -104,6 +93,7 @@ * Current version of ThreadInfo but an older version of MonitorInfo * and the value of "lockedStackFrame" attribute is null. */ + @Test public static void withInvalidMonitorInfoCompositeData() throws Exception { CompositeData cd = Factory.makeThreadInfoWithIncompatibleMonitorInfo(); @@ -128,6 +118,7 @@ /* * ThreadInfo of version N can accept lockedMonitors of version >= N */ + @Test public static void withNewMonitorInfoCompositeData() throws Exception { CompositeData cd = Factory.makeThreadInfoWithNewMonitorInfo(); ThreadInfo info = ThreadInfo.from(cd); @@ -137,11 +128,24 @@ /* * Test CompositeData representing JDK 5 ThreadInfo */ + @Test public static void createV5ThreadInfo() throws Exception { CompositeData cd = Factory.makeThreadInfoV5CompositeData(); ThreadInfo info = ThreadInfo.from(cd); checkThreadInfoV5(info); - } + } + + /* + * Test ThreadInfoCompositeData.toCompositeData + */ + @Test + public static void internalToCompositeData() throws Exception { + CompositeData cd = Factory.makeThreadInfoCompositeData(); + ThreadInfo info = ThreadInfo.from(cd); + cd = sun.management.ThreadInfoCompositeData.toCompositeData(info); + info = ThreadInfo.from(cd); + checkThreadInfo(info); + } static void checkThreadInfoV5(ThreadInfo info) { Object[] values = Factory.VALUES; @@ -262,6 +266,7 @@ } } + @Test public static void badNameCompositeData() throws Exception { CompositeData cd = Factory.makeCompositeDataWithBadNames(); try { @@ -270,6 +275,7 @@ } catch (IllegalArgumentException e) { } } + @Test public static void badTypeCompositeData() throws Exception { CompositeData cd = Factory.makeCompositeDataWithBadTypes(); @@ -300,7 +306,7 @@ private static final int DAEMON = 16; private static final int PRIORITY = 17; - static class Factory { + private static class Factory { static final CompositeType STE_COMPOSITE_TYPE; static final CompositeType LOCK_INFO_COMPOSITE_TYPE; diff -Nru openjdk-lts-11~28/test/jdk/java/math/BigDecimal/AddTests.java openjdk-lts-11.0.2+9/test/jdk/java/math/BigDecimal/AddTests.java --- openjdk-lts-11~28/test/jdk/java/math/BigDecimal/AddTests.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/math/BigDecimal/AddTests.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 6362557 + * @bug 6362557 8200698 * @summary Some tests of add(BigDecimal, mc) * @author Joseph D. Darcy */ @@ -290,12 +290,35 @@ return failures; } + private static int arithmeticExceptionTest() { + int failures = 0; + BigDecimal x; + try { + // + // The string representation "1e2147483647", which is equivalent + // to 10^Integer.MAX_VALUE, is used to create an augend with an + // unscaled value of 1 and a scale of -Integer.MAX_VALUE. The + // addend "1" has an unscaled value of 1 with a scale of 0. The + // addition is performed exactly and is specified to have a + // preferred scale of max(-Integer.MAX_VALUE, 0). As the scale + // of the result is 0, a value with Integer.MAX_VALUE + 1 digits + // would need to be created. Therefore the next statement is + // expected to overflow with an ArithmeticException. + // + x = new BigDecimal("1e2147483647").add(new BigDecimal(1)); + failures++; + } catch (ArithmeticException ae) { + } + return failures; + } + public static void main(String argv[]) { int failures = 0; failures += extremaTests(); failures += roundingGradationTests(); failures += precisionConsistencyTest(); + failures += arithmeticExceptionTest(); if (failures > 0) { throw new RuntimeException("Incurred " + failures + diff -Nru openjdk-lts-11~28/test/jdk/java/math/BigDecimal/Constructor.java openjdk-lts-11.0.2+9/test/jdk/java/math/BigDecimal/Constructor.java --- openjdk-lts-11~28/test/jdk/java/math/BigDecimal/Constructor.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/math/BigDecimal/Constructor.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -23,20 +23,48 @@ /* * @test - * @bug 4259453 - * @summary Test string constructor of BigDecimal + * @bug 4259453 8200698 + * @summary Test constructors of BigDecimal + * @library .. + * @run testng Constructor */ + import java.math.BigDecimal; +import org.testng.annotations.Test; public class Constructor { - public static void main(String[] args) throws Exception { - boolean nfe = false; + @Test(expectedExceptions=NumberFormatException.class) + public void stringConstructor() { + BigDecimal bd = new BigDecimal("1.2e"); + } + + @Test(expectedExceptions=NumberFormatException.class) + public void charArrayConstructorNegativeOffset() { + BigDecimal bd = new BigDecimal(new char[5], -1, 4, null); + } + + @Test(expectedExceptions=NumberFormatException.class) + public void charArrayConstructorNegativeLength() { + BigDecimal bd = new BigDecimal(new char[5], 0, -1, null); + } + + @Test(expectedExceptions=NumberFormatException.class) + public void charArrayConstructorIntegerOverflow() { try { - BigDecimal bd = new BigDecimal("1.2e"); - } catch (NumberFormatException e) { - nfe = true; + BigDecimal bd = new BigDecimal(new char[5], Integer.MAX_VALUE - 5, + 6, null); + } catch (NumberFormatException nfe) { + if (nfe.getCause() instanceof IndexOutOfBoundsException) { + throw new RuntimeException + ("NumberFormatException should not have a cause"); + } else { + throw nfe; + } } - if (!nfe) - throw new Exception("Didn't throw NumberFormatException"); + } + + @Test(expectedExceptions=NumberFormatException.class) + public void charArrayConstructorIndexOutOfBounds() { + BigDecimal bd = new BigDecimal(new char[5], 1, 5, null); } } diff -Nru openjdk-lts-11~28/test/jdk/java/math/BigInteger/LargeValueExceptions.java openjdk-lts-11.0.2+9/test/jdk/java/math/BigInteger/LargeValueExceptions.java --- openjdk-lts-11~28/test/jdk/java/math/BigInteger/LargeValueExceptions.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/math/BigInteger/LargeValueExceptions.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,192 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8200698 + * @summary Tests that exceptions are thrown for ops which would overflow + * @requires os.maxMemory >= 4g + * @run testng/othervm -Xmx4g LargeValueExceptions + */ +import java.math.BigInteger; +import static java.math.BigInteger.ONE; +import org.testng.annotations.Test; + +// +// The intent of this test is to probe the boundaries between overflow and +// non-overflow, principally for multiplication and squaring, specifically +// the largest values which should not overflow and the smallest values which +// should. The transition values used are not necessarily at the exact +// boundaries but should be "close." Quite a few different values were used +// experimentally before settling on the ones in this test. For multiplication +// and squaring all cases are exercised: definite overflow and non-overflow +// which can be detected "up front," and "indefinite" overflow, i.e., overflow +// which cannot be detected up front so further calculations are required. +// +// Testing negative values is unnecessary. For both multiplication and squaring +// the paths lead to the Toom-Cook algorithm where the signum is used only to +// determine the sign of the result and not in the intermediate calculations. +// This is also true for exponentiation. +// +// @Test annotations with optional element "enabled" set to "false" should +// succeed when "enabled" is set to "true" but they take too to run in the +// course of the typical regression test execution scenario. +// +public class LargeValueExceptions { + // BigInteger.MAX_MAG_LENGTH + private static final int MAX_INTS = 1 << 26; + + // Number of bits corresponding to MAX_INTS + private static final long MAX_BITS = (0xffffffffL & MAX_INTS) << 5L; + + // Half BigInteger.MAX_MAG_LENGTH + private static final int MAX_INTS_HALF = MAX_INTS / 2; + + // --- squaring --- + + // Largest no overflow determined by examining data lengths alone. + @Test(enabled=false) + public void squareNoOverflow() { + BigInteger x = ONE.shiftLeft(16*MAX_INTS - 1).subtract(ONE); + BigInteger y = x.multiply(x); + } + + // Smallest no overflow determined by extra calculations. + @Test(enabled=false) + public void squareIndefiniteOverflowSuccess() { + BigInteger x = ONE.shiftLeft(16*MAX_INTS - 1); + BigInteger y = x.multiply(x); + } + + // Largest overflow detected by extra calculations. + @Test(expectedExceptions=ArithmeticException.class,enabled=false) + public void squareIndefiniteOverflowFailure() { + BigInteger x = ONE.shiftLeft(16*MAX_INTS).subtract(ONE); + BigInteger y = x.multiply(x); + } + + // Smallest overflow detected by examining data lengths alone. + @Test(expectedExceptions=ArithmeticException.class) + public void squareDefiniteOverflow() { + BigInteger x = ONE.shiftLeft(16*MAX_INTS); + BigInteger y = x.multiply(x); + } + + // --- multiplication --- + + // Largest no overflow determined by examining data lengths alone. + @Test(enabled=false) + public void multiplyNoOverflow() { + final int halfMaxBits = MAX_INTS_HALF << 5; + + BigInteger x = ONE.shiftLeft(halfMaxBits).subtract(ONE); + BigInteger y = ONE.shiftLeft(halfMaxBits - 1).subtract(ONE); + BigInteger z = x.multiply(y); + } + + // Smallest no overflow determined by extra calculations. + @Test(enabled=false) + public void multiplyIndefiniteOverflowSuccess() { + BigInteger x = ONE.shiftLeft((int)(MAX_BITS/2) - 1); + long m = MAX_BITS - x.bitLength(); + + BigInteger y = ONE.shiftLeft((int)(MAX_BITS/2) - 1); + long n = MAX_BITS - y.bitLength(); + + if (m + n != MAX_BITS) { + throw new RuntimeException("Unexpected leading zero sum"); + } + + BigInteger z = x.multiply(y); + } + + // Largest overflow detected by extra calculations. + @Test(expectedExceptions=ArithmeticException.class,enabled=false) + public void multiplyIndefiniteOverflowFailure() { + BigInteger x = ONE.shiftLeft((int)(MAX_BITS/2)).subtract(ONE); + long m = MAX_BITS - x.bitLength(); + + BigInteger y = ONE.shiftLeft((int)(MAX_BITS/2)).subtract(ONE); + long n = MAX_BITS - y.bitLength(); + + if (m + n != MAX_BITS) { + throw new RuntimeException("Unexpected leading zero sum"); + } + + BigInteger z = x.multiply(y); + } + + // Smallest overflow detected by examining data lengths alone. + @Test(expectedExceptions=ArithmeticException.class) + public void multiplyDefiniteOverflow() { + // multiply by 4 as MAX_INTS_HALF refers to ints + byte[] xmag = new byte[4*MAX_INTS_HALF]; + xmag[0] = (byte)0xff; + BigInteger x = new BigInteger(1, xmag); + + byte[] ymag = new byte[4*MAX_INTS_HALF + 1]; + ymag[0] = (byte)0xff; + BigInteger y = new BigInteger(1, ymag); + + BigInteger z = x.multiply(y); + } + + // --- exponentiation --- + + @Test(expectedExceptions=ArithmeticException.class) + public void powOverflow() { + BigInteger.TEN.pow(Integer.MAX_VALUE); + } + + @Test(expectedExceptions=ArithmeticException.class) + public void powOverflow1() { + int shift = 20; + int exponent = 1 << shift; + BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent)); + BigInteger y = x.pow(exponent); + } + + @Test(expectedExceptions=ArithmeticException.class) + public void powOverflow2() { + int shift = 20; + int exponent = 1 << shift; + BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent)).add(ONE); + BigInteger y = x.pow(exponent); + } + + @Test(expectedExceptions=ArithmeticException.class,enabled=false) + public void powOverflow3() { + int shift = 20; + int exponent = 1 << shift; + BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent)).subtract(ONE); + BigInteger y = x.pow(exponent); + } + + @Test(enabled=false) + public void powOverflow4() { + int shift = 20; + int exponent = 1 << shift; + BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent - 1)).add(ONE); + BigInteger y = x.pow(exponent); + } +} diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/http2/NoBodyTest.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/http2/NoBodyTest.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/http2/NoBodyTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/http2/NoBodyTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2015, 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. + */ + +/* + * @test + * @bug 8087112 + * @library /lib/testlibrary/ server + * @build jdk.testlibrary.SimpleSSLContext + * @modules java.base/sun.net.www.http + * java.net.http/jdk.internal.net.http.common + * java.net.http/jdk.internal.net.http.frame + * java.net.http/jdk.internal.net.http.hpack + * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors NoBodyTest + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.*; +import javax.net.ssl.*; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.concurrent.*; +import jdk.testlibrary.SimpleSSLContext; +import org.testng.annotations.Test; +import static java.net.http.HttpClient.Version.HTTP_2; + +@Test +public class NoBodyTest { + static int httpPort, httpsPort; + static Http2TestServer httpServer, httpsServer; + static HttpClient client = null; + static ExecutorService clientExec; + static ExecutorService serverExec; + static SSLContext sslContext; + static String TEST_STRING = "The quick brown fox jumps over the lazy dog "; + + static String httpURIString, httpsURIString; + + static void initialize() throws Exception { + try { + SimpleSSLContext sslct = new SimpleSSLContext(); + sslContext = sslct.get(); + client = getClient(); + httpServer = new Http2TestServer(false, 0, serverExec, sslContext); + httpServer.addHandler(new Handler(), "/"); + httpPort = httpServer.getAddress().getPort(); + + httpsServer = new Http2TestServer(true, 0, serverExec, sslContext); + httpsServer.addHandler(new Handler(), "/"); + + httpsPort = httpsServer.getAddress().getPort(); + httpURIString = "http://localhost:" + httpPort + "/foo/"; + httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + + httpServer.start(); + httpsServer.start(); + } catch (Throwable e) { + System.err.println("Throwing now"); + e.printStackTrace(System.err); + throw e; + } + } + + @Test + public static void runtest() throws Exception { + try { + initialize(); + warmup(false); + warmup(true); + test(false); + test(true); + } catch (Throwable tt) { + System.err.println("tt caught"); + tt.printStackTrace(System.err); + throw tt; + } finally { + httpServer.stop(); + httpsServer.stop(); + } + } + + static HttpClient getClient() { + if (client == null) { + serverExec = Executors.newCachedThreadPool(); + clientExec = Executors.newCachedThreadPool(); + client = HttpClient.newBuilder() + .executor(clientExec) + .sslContext(sslContext) + .version(HTTP_2) + .build(); + } + return client; + } + + static URI getURI(boolean secure) { + if (secure) + return URI.create(httpsURIString); + else + return URI.create(httpURIString); + } + + static void checkStatus(int expected, int found) throws Exception { + if (expected != found) { + System.err.printf ("Test failed: wrong status code %d/%d\n", + expected, found); + throw new RuntimeException("Test failed"); + } + } + + static void checkStrings(String expected, String found) throws Exception { + if (!expected.equals(found)) { + System.err.printf ("Test failed: wrong string %s/%s\n", + expected, found); + throw new RuntimeException("Test failed"); + } + } + + static final int LOOPS = 13; + + static void warmup(boolean secure) throws Exception { + URI uri = getURI(secure); + String type = secure ? "https" : "http"; + System.err.println("Request to " + uri); + + // Do a simple warmup request + + HttpClient client = getClient(); + HttpRequest req = HttpRequest.newBuilder(uri) + .POST(BodyPublishers.ofString("Random text")) + .build(); + HttpResponse response = client.send(req, BodyHandlers.ofString()); + checkStatus(200, response.statusCode()); + String responseBody = response.body(); + HttpHeaders h = response.headers(); + checkStrings(TEST_STRING + type, responseBody); + } + + static void test(boolean secure) throws Exception { + URI uri = getURI(secure); + String type = secure ? "https" : "http"; + System.err.println("Request to " + uri); + + HttpRequest request = HttpRequest.newBuilder(uri) + .POST(BodyPublishers.ofString(TEST_STRING)) + .build(); + for (int i = 0; i < LOOPS; i++) { + System.out.println("Loop " + i); + HttpResponse response = client.send(request, BodyHandlers.ofString()); + int expectedResponse = (i % 2) == 0 ? 204 : 200; + if (response.statusCode() != expectedResponse) + throw new RuntimeException("wrong response code " + Integer.toString(response.statusCode())); + if (expectedResponse == 200 && !response.body().equals(TEST_STRING + type)) { + System.err.printf("response received/expected %s/%s\n", response.body(), TEST_STRING + type); + throw new RuntimeException("wrong response body"); + } + } + System.err.println("test: DONE"); + } + + static class Handler implements Http2Handler { + + public Handler() {} + + volatile int invocation = 0; + + @Override + public void handle(Http2TestExchange t) + throws IOException { + try { + URI uri = t.getRequestURI(); + System.err.printf("Handler received request to %s from %s\n", + uri, t.getRemoteAddress()); + String type = uri.getScheme().toLowerCase(); + InputStream is = t.getRequestBody(); + while (is.read() != -1); + is.close(); + + // every second response is 204. + + if ((invocation++ % 2) == 1) { + System.err.println("Server sending 204"); + t.sendResponseHeaders(204, -1); + } else { + String body = TEST_STRING + type; + t.sendResponseHeaders(200, body.length()); + OutputStream os = t.getResponseBody(); + os.write(body.getBytes()); + os.close(); + } + } catch (Throwable e) { + e.printStackTrace(System.err); + throw new IOException(e); + } + } + } +} diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java 2019-01-18 04:23:48.000000000 +0000 @@ -129,7 +129,7 @@ @Override public void sendResponseHeaders(int rCode, long responseLength) throws IOException { this.responseLength = responseLength; - if (responseLength > 0 || responseLength < 0) { + if (responseLength !=0 && rCode != 204) { long clen = responseLength > 0 ? responseLength : 0; rspheadersBuilder.setHeader("Content-length", Long.toString(clen)); } diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/LargeResponseContent.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/LargeResponseContent.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/LargeResponseContent.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/LargeResponseContent.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,177 @@ +/* + * 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. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Flow; + +/** + * @test + * @bug 8212926 + * @summary Basic tests for response timeouts + * @run main/othervm LargeResponseContent + */ + +public class LargeResponseContent { + final ServerSocket server; + final int port; + + public LargeResponseContent() throws Exception { + server = new ServerSocket(0, 10, InetAddress.getLoopbackAddress()); + Thread serverThread = new Thread(this::handleConnection); + serverThread.setDaemon(false); + port = server.getLocalPort(); + serverThread.start(); + } + + void runClient() throws IOException, InterruptedException { + URI uri = URI.create("http://127.0.0.1:" + Integer.toString(port) + "/foo"); + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder(uri) + .GET() + .build(); + HttpResponse response = client.send(request, new ClientHandler()); + System.out.println("Response code = " + response.statusCode()); + long blen = response.body(); + if (blen != CONTENT_LEN) + throw new RuntimeException("wrong content length"); + } + + public static void main(String[] args) throws Exception { + System.out.println ("CONTENT_LEN = " + CONTENT_LEN); + System.out.println ("CLEN_STR = " + CLEN_STR); + LargeResponseContent test = new LargeResponseContent(); + test.runClient(); + } + + static class ClientHandler implements HttpResponse.BodyHandler { + + @Override + public HttpResponse.BodySubscriber apply(HttpResponse.ResponseInfo responseInfo) { + HttpHeaders headers = responseInfo.headers(); + headers.firstValue("content-length"); + long clen = headers.firstValueAsLong("content-length").orElse(-1); + if (clen != CONTENT_LEN) + return new Subscriber(new RuntimeException("Wrong content length received")); + return new Subscriber(null); + } + } + + static class Subscriber implements HttpResponse.BodySubscriber { + final CompletableFuture cf = new CompletableFuture<>(); + volatile Flow.Subscription subscription; + volatile long counter = 0; + + Subscriber(Throwable t) { + if (t != null) + cf.completeExceptionally(t); + } + + @Override + public CompletionStage getBody() { + return cf; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(Long.MAX_VALUE); + } + + @Override + public void onNext(List item) { + long v = 0; + for (ByteBuffer b : item) + v+= b.remaining(); + counter += v; + } + + @Override + public void onError(Throwable throwable) { + throwable.printStackTrace(); + } + + @Override + public void onComplete() { + cf.complete(counter); + } + } + + static final long CONTENT_LEN = Integer.MAX_VALUE + 1000L; + static final String CLEN_STR = Long.valueOf(CONTENT_LEN).toString(); + + static String RESPONSE = "HTTP/1.1 200 OK\r\n" + + "Content-length: " + CLEN_STR + "\r\n" + + "\r\n"; + + + void readHeaders(InputStream is) throws IOException { + String s = ""; + byte[] buf = new byte[128]; + while (!s.endsWith("\r\n\r\n")) { + int c = is.read(buf); + String f = new String(buf, 0, c, StandardCharsets.ISO_8859_1); + s = s + f; + } + } + + public void handleConnection() { + long remaining = CONTENT_LEN; + try { + Socket socket = server.accept(); + InputStream is = socket.getInputStream(); + readHeaders(is); // read first byte + OutputStream os = socket.getOutputStream(); + os.write(RESPONSE.getBytes()); + byte[] buf = new byte[64 * 1024]; + while (remaining > 0) { + int amount = (int)Math.min(remaining, buf.length); + os.write(buf, 0, amount); + remaining -= amount; + } + System.out.println("Server: finished writing"); + os.close(); + + } catch (IOException e) { + long sent = CONTENT_LEN - remaining; + System.out.println("Sent " + sent); + e.printStackTrace(); + } + } +} + diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/RequestBuilderTest.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/RequestBuilderTest.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/RequestBuilderTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/RequestBuilderTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -337,15 +337,31 @@ } } + // headers that are allowed now, but weren't before + private static final Set FORMERLY_RESTRICTED = Set.of("referer", "origin", + "OriGin", "Referer"); + + @Test + public void testFormerlyRestricted() throws URISyntaxException { + URI uri = new URI("http://localhost:80/test/"); + URI otherURI = new URI("http://www.foo.com/test/"); + for (String header : FORMERLY_RESTRICTED) { + HttpRequest req = HttpRequest.newBuilder(uri) + .header(header, otherURI.toString()) + .GET() + .build(); + } + } + private static final Set RESTRICTED = Set.of("connection", "content-length", - "date", "expect", "from", "host", "origin", - "referer", "upgrade", "via", "warning", + "date", "expect", "from", "host", + "upgrade", "via", "warning", "Connection", "Content-Length", - "DATE", "eXpect", "frOm", "hosT", "origIN", - "ReFerer", "upgradE", "vIa", "Warning", + "DATE", "eXpect", "frOm", "hosT", + "upgradE", "vIa", "Warning", "CONNection", "CONTENT-LENGTH", - "Date", "EXPECT", "From", "Host", "Origin", - "Referer", "Upgrade", "Via", "WARNING"); + "Date", "EXPECT", "From", "Host", + "Upgrade", "Via", "WARNING"); interface WithHeader { HttpRequest.Builder withHeader(HttpRequest.Builder builder, String name, String value); diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/Response204.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/Response204.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/Response204.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/Response204.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,109 @@ +/* + * 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. + */ + +/** + * @test + * @bug 8211437 + * @run main/othervm -Djdk.httpclient.HttpClient.log=headers,requests Response204 + * @summary + */ + +import com.sun.net.httpserver.*; + +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.*; +import java.util.concurrent.*; +import java.util.logging.*; +import java.io.*; +import java.net.*; + +/** + * Verify that a 204 response code with no content-length is handled correctly + */ +public class Response204 { + + public static void main (String[] args) throws Exception { + Logger logger = Logger.getLogger ("com.sun.net.httpserver"); + ConsoleHandler c = new ConsoleHandler(); + c.setLevel (Level.WARNING); + logger.addHandler (c); + logger.setLevel (Level.WARNING); + Handler handler = new Handler(); + InetSocketAddress addr = new InetSocketAddress (0); + HttpServer server = HttpServer.create (addr, 0); + HttpContext ctx = server.createContext ("/test", handler); + ExecutorService executor = Executors.newCachedThreadPool(); + server.setExecutor (executor); + server.start (); + + URI uri = new URI("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + + try { + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder(uri) + .GET() + .build(); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() != 204) + throw new RuntimeException("wrong response code"); + if (response.body() != null && !response.body().equals("")) + throw new RuntimeException("should have received empty response"); + System.out.println(response.headers().firstValue("content-length").orElse("nichts")); + System.out.println ("OK 1"); + // Send a second time. This time we should get exception because the server + // is going to send an invalid 204 with a Content-length + try { + response = client.send(request, HttpResponse.BodyHandlers.ofString()); + throw new RuntimeException("send should have thrown exception"); + } catch (IOException ioe) { + System.out.println("OK 2"); + } + } finally { + server.stop(2); + executor.shutdown(); + } + } + + public static boolean error = false; + + static class Handler implements HttpHandler { + volatile int counter = 0; + + public void handle(HttpExchange t) + throws IOException { + InputStream is = t.getRequestBody(); + Headers map = t.getRequestHeaders(); + Headers rmap = t.getResponseHeaders(); + while (is.read() != -1) ; + is.close(); + if (counter++ == 1) { + // pretend there is a body + rmap.set("Content-length", "10"); + } + t.sendResponseHeaders(204, -1); + t.close(); + } + } +} diff -Nru openjdk-lts-11~28/test/jdk/java/net/httpclient/SpecialHeadersTest.java openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/SpecialHeadersTest.java --- openjdk-lts-11~28/test/jdk/java/net/httpclient/SpecialHeadersTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/httpclient/SpecialHeadersTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -57,21 +57,25 @@ import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; +import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.security.AccessController; import java.security.PrivilegedAction; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import static java.lang.System.err; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; import static java.nio.charset.StandardCharsets.US_ASCII; +import org.testng.Assert; import static org.testng.Assert.assertEquals; public class SpecialHeadersTest implements HttpServerAdapters { @@ -91,6 +95,13 @@ {"User-Agent: camel-cased"}, {"user-agent: all-lower-case"}, {"user-Agent: mixed"}, + // headers which were restricted before and are now allowable + {"referer: lower"}, + {"Referer: normal"}, + {"REFERER: upper"}, + {"origin: lower"}, + {"Origin: normal"}, + {"ORIGIN: upper"}, }; @DataProvider(name = "variants") @@ -169,6 +180,50 @@ } @Test(dataProvider = "variants") + void testHomeMadeIllegalHeader(String uriString, String headerNameAndValue, boolean sameClient) throws Exception { + out.println("\n--- Starting "); + final URI uri = URI.create(uriString); + + HttpClient client = HttpClient.newBuilder() + .proxy(NO_PROXY) + .sslContext(sslContext) + .build(); + + // Test a request which contains an illegal header created + HttpRequest req = new HttpRequest() { + @Override public Optional bodyPublisher() { + return Optional.of(BodyPublishers.noBody()); + } + @Override public String method() { + return "GET"; + } + @Override public Optional timeout() { + return Optional.empty(); + } + @Override public boolean expectContinue() { + return false; + } + @Override public URI uri() { + return uri; + } + @Override public Optional version() { + return Optional.empty(); + } + @Override public HttpHeaders headers() { + Map> map = Map.of("via", List.of("http://foo.com")); + return HttpHeaders.of(map, (x, y) -> true); + } + }; + + try { + HttpResponse response = client.send(req, BodyHandlers.ofString()); + Assert.fail("Unexpected reply: " + response); + } catch (IllegalArgumentException ee) { + out.println("Got IAE as expected"); + } + } + + @Test(dataProvider = "variants") void testAsync(String uriString, String headerNameAndValue, boolean sameClient) { out.println("\n--- Starting "); int index = headerNameAndValue.indexOf(":"); @@ -259,7 +314,10 @@ https2TestServer.stop(); } - /** A handler that returns, as its body, the exact received request URI. */ + /** A handler that returns, as its body, the exact received request URI. + * The header whose name is in the URI query and is set in the request is + * returned in the response with its name prefixed by X- + */ static class HttpUriStringHandler implements HttpTestHandler { @Override public void handle(HttpTestExchange t) throws IOException { diff -Nru openjdk-lts-11~28/test/jdk/java/net/URL/RacyHandler.java openjdk-lts-11.0.2+9/test/jdk/java/net/URL/RacyHandler.java --- openjdk-lts-11~28/test/jdk/java/net/URL/RacyHandler.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/net/URL/RacyHandler.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,113 @@ +/* + * 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. + */ + +import java.io.IOException; +import java.lang.reflect.*; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.concurrent.CountDownLatch; + +/* + * @test + * @bug 8213942 + * @summary URLStreamHandler initialization race + * @run main/othervm RacyHandler + * @run main/othervm RacyHandler + * @run main/othervm RacyHandler + */ + +/* + * This test makes reasonable effort to reproduce the race. + * Run repeatedly to ensure correctness. + */ +public class RacyHandler { + static volatile boolean factorySet = false; + static int NUM_THREADS = 2; + static CountDownLatch cdl = new CountDownLatch(NUM_THREADS + 1); + + public static void main(String[] args) { + RacyHandler tester = new RacyHandler(); + tester.runTest(); + } + + public void runTest() { + new Thread(() -> { + try { + cdl.await(); + URL.setURLStreamHandlerFactory(proto -> new CustomHttpHandler()); + factorySet = true; + } catch (Exception ignore) { } + }).start(); + cdl.countDown(); + + for (int i = 0; i < NUM_THREADS; i++) { + new Thread(() -> { + try { + cdl.await(); + while (!factorySet) { + // trigger URL class load + getURLStreamHandler(); + } + } catch (Exception ignore) { } + }).start(); + cdl.countDown(); + } + + // wait for the factory to be set + while (!factorySet) { } + // The sleep seems to help trigger the failure + try { + Thread.sleep(500); + } catch (InterruptedException ie) { + } + + URLStreamHandler httpHandler = getURLStreamHandler(); + System.out.println("After setting factory URL handlers: http " + httpHandler); + if (!(httpHandler instanceof CustomHttpHandler)) + throw new RuntimeException("FAILED: Incorrect handler type"); + } + + /* + * This is just so we can see what we get for the URLStreamHandler back + * from the factory to verify whether it really is using our Handler + * or something else... + */ + public URLStreamHandler getURLStreamHandler() { + try { + Method method = URL.class.getDeclaredMethod("getURLStreamHandler", + String.class); + method.setAccessible(true); + return (URLStreamHandler) method.invoke(null, "http"); + } catch (Exception e) { + return null; + } + } + + class CustomHttpHandler extends URLStreamHandler { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return null; + } + } +} \ No newline at end of file diff -Nru openjdk-lts-11~28/test/jdk/java/nio/file/Files/ReadWriteString.java openjdk-lts-11.0.2+9/test/jdk/java/nio/file/Files/ReadWriteString.java --- openjdk-lts-11~28/test/jdk/java/nio/file/Files/ReadWriteString.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/nio/file/Files/ReadWriteString.java 2019-01-18 04:23:48.000000000 +0000 @@ -35,6 +35,7 @@ import java.nio.file.Paths; import static java.nio.file.StandardOpenOption.APPEND; import static java.nio.file.StandardOpenOption.CREATE; +import java.util.Arrays; import java.util.Random; import java.util.concurrent.Callable; import static org.testng.Assert.assertTrue; @@ -45,7 +46,7 @@ import org.testng.annotations.Test; /* @test - * @bug 8201276 8205058 + * @bug 8201276 8205058 8209576 * @build ReadWriteString PassThroughFileSystem * @run testng ReadWriteString * @summary Unit test for methods for Files readString and write methods. @@ -55,8 +56,10 @@ public class ReadWriteString { // data for text files - private static final String EN_STRING = "The quick brown fox jumps over the lazy dog"; + final String TEXT_UNICODE = "\u201CHello\u201D"; + final String TEXT_ASCII = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n abcdefghijklmnopqrstuvwxyz\n 1234567890\n"; private static final String JA_STRING = "\u65e5\u672c\u8a9e\u6587\u5b57\u5217"; + // malformed input: a high surrogate without the low surrogate static char[] illChars = { '\u00fa', '\ud800' @@ -80,9 +83,8 @@ } } - // file used by most tests - private Path tmpfile; - + // file used by testReadWrite, testReadString and testWriteString + private Path[] testFiles = new Path[3]; /* * DataProvider for malformed write test. Provides the following fields: @@ -112,14 +114,48 @@ }; } + /* + * DataProvider for writeString test + * Writes the data using both the existing and new method and compares the results. + */ + @DataProvider(name = "testWriteString") + public Object[][] getWriteString() throws IOException { + + return new Object[][]{ + {testFiles[1], testFiles[2], TEXT_ASCII, US_ASCII, null}, + {testFiles[1], testFiles[2], TEXT_ASCII, US_ASCII, US_ASCII}, + {testFiles[1], testFiles[2], TEXT_UNICODE, UTF_8, null}, + {testFiles[1], testFiles[2], TEXT_UNICODE, UTF_8, UTF_8} + }; + } + + /* + * DataProvider for readString test + * Reads the file using both the existing and new method and compares the results. + */ + @DataProvider(name = "testReadString") + public Object[][] getReadString() throws IOException { + Path path = Files.createTempFile("readString_file1", null); + return new Object[][]{ + {testFiles[1], TEXT_ASCII, US_ASCII, US_ASCII}, + {testFiles[1], TEXT_ASCII, US_ASCII, UTF_8}, + {testFiles[1], TEXT_UNICODE, UTF_8, null}, + {testFiles[1], TEXT_UNICODE, UTF_8, UTF_8} + }; + } + @BeforeClass void setup() throws IOException { - tmpfile = Files.createTempFile("readWriteString", null); + testFiles[0] = Files.createTempFile("readWriteString", null); + testFiles[1] = Files.createTempFile("writeString_file1", null); + testFiles[2] = Files.createTempFile("writeString_file2", null); } @AfterClass void cleanup() throws IOException { - Files.deleteIfExists(tmpfile); + for (Path path : testFiles) { + Files.deleteIfExists(path); + } } /** @@ -162,6 +198,42 @@ } /** + * Verifies fix for @bug 8209576 that the writeString method converts the + * bytes properly. + * This method compares the results written by the existing write method and + * the writeString method added since 11. + */ + @Test(dataProvider = "testWriteString") + public void testWriteString(Path path, Path path2, String text, Charset cs, Charset cs2) throws IOException { + Files.write(path, text.getBytes(cs)); + + // writeString @since 11 + if (cs2 == null) { + Files.writeString(path2, text); + } else { + Files.writeString(path2, text, cs2); + } + byte[] bytes = Files.readAllBytes(path); + byte[] bytes2 = Files.readAllBytes(path2); + assertTrue((Arrays.compare(bytes, bytes2) == 0), "The bytes should be the same"); + } + + /** + * Verifies that the readString method added since 11 behaves the same as + * constructing a string from the existing readAllBytes method. + */ + @Test(dataProvider = "testReadString") + public void testReadString(Path path, String text, Charset cs, Charset cs2) throws IOException { + Files.write(path, text.getBytes(cs)); + String str = new String(Files.readAllBytes(path), cs); + + // readString @since 11 + String str2 = (cs2 == null) ? Files.readString(path) : + Files.readString(path, cs2); + assertTrue((str.equals(str2)), "The strings should be the same"); + } + + /** * Verifies that IOException is thrown (as specified) when giving a malformed * string input. * @@ -218,20 +290,20 @@ String str = generateString(size); Path result; if (cs == null) { - result = Files.writeString(tmpfile, str); + result = Files.writeString(testFiles[0], str); } else { - result = Files.writeString(tmpfile, str, cs); + result = Files.writeString(testFiles[0], str, cs); } //System.out.println(result.toUri().toASCIIString()); - assertTrue(result == tmpfile); + assertTrue(result == testFiles[0]); if (append) { if (cs == null) { - Files.writeString(tmpfile, str, APPEND); + Files.writeString(testFiles[0], str, APPEND); } else { - Files.writeString(tmpfile, str, cs, APPEND); + Files.writeString(testFiles[0], str, cs, APPEND); } - assertTrue(Files.size(tmpfile) == size * 2); + assertTrue(Files.size(testFiles[0]) == size * 2); } diff -Nru openjdk-lts-11~28/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java openjdk-lts-11.0.2+9/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java --- openjdk-lts-11~28/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/text/Format/NumberFormat/CurrencyFormat.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4290801 4942982 5102005 8008577 8021121 + * @bug 4290801 4942982 5102005 8008577 8021121 8210153 * @summary Basic tests for currency formatting. * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyFormat diff -Nru openjdk-lts-11~28/test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties openjdk-lts-11.0.2+9/test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties --- openjdk-lts-11~28/test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/text/Format/NumberFormat/CurrencySymbols.properties 2019-01-18 04:23:48.000000000 +0000 @@ -66,7 +66,7 @@ es_PY=G es_SV=C es_UY=NU$ -es_VE=Bs.F. +es_VE=Bs.S. et=\u00A4 et_EE=\u20AC fi=\u00A4 diff -Nru openjdk-lts-11~28/test/jdk/java/util/Currency/tablea1.txt openjdk-lts-11.0.2+9/test/jdk/java/util/Currency/tablea1.txt --- openjdk-lts-11~28/test/jdk/java/util/Currency/tablea1.txt 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/util/Currency/tablea1.txt 2019-01-18 04:23:48.000000000 +0000 @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 167 -# (As of 4 June 2018) +# Amendments up until ISO 4217 AMENDMENT NUMBER 169 +# (As of 27 Aug 2018) # # Version FILEVERSION=3 -DATAVERSION=167 +DATAVERSION=169 # ISO 4217 currency data AF AFN 971 2 @@ -268,7 +268,7 @@ #UY UYI 940 0 UZ UZS 860 2 VU VUV 548 0 -VE VEF 937 2 +VE VES 928 2 VN VND 704 0 VG USD 840 2 VI USD 840 2 diff -Nru openjdk-lts-11~28/test/jdk/java/util/Currency/ValidateISO4217.java openjdk-lts-11.0.2+9/test/jdk/java/util/Currency/ValidateISO4217.java --- openjdk-lts-11~28/test/jdk/java/util/Currency/ValidateISO4217.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/util/Currency/ValidateISO4217.java 2019-01-18 04:23:48.000000000 +0000 @@ -24,6 +24,7 @@ * @test * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269 + * 8208746 8209775 * @summary Validate ISO 4217 data for Currency class. * @modules java.base/java.util:open * jdk.localedata diff -Nru openjdk-lts-11~28/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java openjdk-lts-11.0.2+9/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java --- openjdk-lts-11~28/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 8144062 8165723 + * @bug 8132734 8144062 8165723 8199172 * @summary Test the extended API and the aliasing additions in JarFile that * support multi-release jar files * @library /lib/testlibrary/java/util/jar /test/lib @@ -100,16 +100,30 @@ testCustomMultiReleaseValue("true", true); testCustomMultiReleaseValue("true\r\nOther: value", true); testCustomMultiReleaseValue("true\nOther: value", true); - testCustomMultiReleaseValue("true\rOther: value", true); + // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately + // testCustomMultiReleaseValue("true\rOther: value", true); testCustomMultiReleaseValue("false", false); testCustomMultiReleaseValue(" true", false); testCustomMultiReleaseValue("true ", false); - testCustomMultiReleaseValue("true\n ", false); - testCustomMultiReleaseValue("true\r ", false); testCustomMultiReleaseValue("true\n true", false); + + // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately + testCustomMultiReleaseValue("true\r true", false); testCustomMultiReleaseValue("true\r\n true", false); + // "Multi-Release: true/false" not in main attributes + testCustomMultiReleaseValue("\r\n\r\nName: test\r\nMulti-Release: true\r\n", + false); + testCustomMultiReleaseValue("\n\nName: entryname\nMulti-Release: true\n", + false); + testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" + + "\r\nName: entryname\r\nMulti-Release: true\r\n", + false); + testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" + + "\nName: entryname\nMulti-Release: true\n", + false); + // generate "random" Strings to use as extra attributes, and // verify that Multi-Release: true is always properly matched for (int i = 0; i < 100; i++) { diff -Nru openjdk-lts-11~28/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java openjdk-lts-11.0.2+9/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java --- openjdk-lts-11~28/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -21,9 +21,9 @@ * questions. */ -/* + /* * @test - * @bug 8005471 8008577 8129881 8130845 8136518 8181157 + * @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490 * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest * @summary Make sure that localized time zone names of CLDR are used @@ -51,7 +51,7 @@ "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", "GMT-07:00", //"\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6642\u9593", - //"PT" + //"PT" }, { "zh-CN", @@ -60,7 +60,7 @@ "\u5317\u7f8e\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "GMT-07:00", //"\u5317\u7f8e\u592a\u5e73\u6d0b\u65f6\u95f4", - //"PT", + //"PT", }, { "de-DE", @@ -69,7 +69,7 @@ "Nordamerikanische Westk\u00fcsten-Sommerzeit", "GMT-07:00", //"Nordamerikanische Westk\u00fcstenzeit", - //"PT", + //"PT", }, }; @@ -86,7 +86,7 @@ String name = tz.getDisplayName(daylight, style, locale); if (!data[i].equals(name)) { System.err.printf("error: got '%s' expected '%s' (style=%d, daylight=%s, locale=%s)%n", - name, data[i], style, daylight, locale); + name, data[i], style, daylight, locale); errors++; } } @@ -117,6 +117,17 @@ Locale.setDefault(originalLocale); } + // for 8210490 + // Check that TimeZone.getDisplayName should honor passed locale parameter, + // even if default locale is set to some other locale. + Locale.setDefault(Locale.forLanguageTag("ar-PK")); + TimeZone zi = TimeZone.getTimeZone("Etc/GMT-5"); + String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US); + Locale.setDefault(originalLocale); + if (!displayName.equals("GMT+05:00")) { + System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00, Actual " + displayName); + errors++; + } if (errors > 0) { throw new RuntimeException("test failed"); } diff -Nru openjdk-lts-11~28/test/jdk/java/util/zip/TestExtraTime.java openjdk-lts-11.0.2+9/test/jdk/java/util/zip/TestExtraTime.java --- openjdk-lts-11~28/test/jdk/java/util/zip/TestExtraTime.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/java/util/zip/TestExtraTime.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,8 @@ /** * @test - * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526 8130914 8161942 + * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 8075526 8130914 + * 8161942 8206389 * @summary Test ZOS and ZIS timestamp in extra field correctly */ @@ -96,6 +97,7 @@ testNullHandling(); testTagOnlyHandling(); testTimeConversions(); + testNullMtime(); } static void test(FileTime mtime, FileTime atime, FileTime ctime, @@ -192,9 +194,11 @@ ze.getTime(), ze.getLastModifiedTime().to(TimeUnit.MILLISECONDS)); */ - if (mtime.to(TimeUnit.SECONDS) != - ze.getLastModifiedTime().to(TimeUnit.SECONDS)) + if (mtime != null && + mtime.to(TimeUnit.SECONDS) != + ze.getLastModifiedTime().to(TimeUnit.SECONDS)) { throw new RuntimeException("Timestamp: storing mtime failed!"); + } if (atime != null && atime.to(TimeUnit.SECONDS) != ze.getLastAccessTime().to(TimeUnit.SECONDS)) @@ -304,5 +308,53 @@ } finally { Files.delete(zpath); } + } + + static void checkLastModifiedTimeDOS(FileTime mtime, ZipEntry ze) { + FileTime lmt = ze.getLastModifiedTime(); + if ((lmt.to(TimeUnit.SECONDS) >>> 1) != (mtime.to(TimeUnit.SECONDS) >>> 1) || + lmt.to(TimeUnit.MILLISECONDS) != ze.getTime() || + lmt.to(TimeUnit.MILLISECONDS) % 1000 != 0) { + throw new RuntimeException("Timestamp: storing mtime in dos format failed!"); + } + } + + static void testNullMtime() throws Throwable { + Instant now = Instant.now(); + FileTime ctime = FileTime.from(now); + FileTime atime = FileTime.from(now.plusSeconds(7)); + FileTime mtime = FileTime.from(now.plusSeconds(13)); + System.out.printf("--------------------%nTesting: [%s]/[%s]/[%s]%n", + mtime, atime, ctime); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (ZipOutputStream zos = new ZipOutputStream(baos)) { + ZipEntry ze = new ZipEntry("TestExtraTime.java"); + ze.setCreationTime(ctime); + ze.setLastAccessTime(atime); + // ze.setLastModifiedTime(now); + ze.setTime(mtime.toMillis()); + zos.putNextEntry(ze); + zos.write(new byte[] { 1,2 ,3, 4}); + } + + try (ZipInputStream zis = new ZipInputStream( + new ByteArrayInputStream(baos.toByteArray()))) { + ZipEntry ze = zis.getNextEntry(); + // check LOC + check(null, atime, ctime, ze, null); + checkLastModifiedTimeDOS(mtime, ze); + } + + Path zpath = Paths.get(System.getProperty("test.dir", "."), + "TestExtraTime.zip"); + Files.copy(new ByteArrayInputStream(baos.toByteArray()), zpath); + try (ZipFile zf = new ZipFile(zpath.toFile())) { + ZipEntry ze = zf.getEntry("TestExtraTime.java"); + // check CEN + checkLastModifiedTimeDOS(mtime, ze); + } finally { + Files.delete(zpath); + } } } diff -Nru openjdk-lts-11~28/test/jdk/javax/imageio/plugins/png/ReadPNGWithNoTextInTEXTChunk.java openjdk-lts-11.0.2+9/test/jdk/javax/imageio/plugins/png/ReadPNGWithNoTextInTEXTChunk.java --- openjdk-lts-11~28/test/jdk/javax/imageio/plugins/png/ReadPNGWithNoTextInTEXTChunk.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/imageio/plugins/png/ReadPNGWithNoTextInTEXTChunk.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,126 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8212116 + * @summary Test verifies that PNGImageReader doesn't throw IIOException + * when reading a tEXt chunk having no text. + * @run main ReadPNGWithNoTextInTEXTChunk + */ + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.Color; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Iterator; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.ImageWriter; +import javax.imageio.ImageIO; +import javax.imageio.ImageReader; +import javax.imageio.ImageWriteParam; +import javax.imageio.metadata.IIOInvalidTreeException; +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.metadata.IIOMetadataNode; +import javax.imageio.stream.ImageOutputStream; +import javax.imageio.stream.ImageInputStream; +import javax.imageio.IIOImage; + +public class ReadPNGWithNoTextInTEXTChunk { + + private static BufferedImage img; + private static ImageWriter writer; + private static ImageWriteParam param; + private static IIOMetadata metadata; + private static byte[] imageByteArray; + + private static void initialize(int type) { + int width = 1; + int height = 1; + img = new BufferedImage(width, height, type); + Graphics2D g2D = img.createGraphics(); + g2D.setColor(new Color(255, 255, 255)); + g2D.fillRect(0, 0, width, width); + g2D.dispose(); + + Iterator iterWriter = + ImageIO.getImageWritersBySuffix("png"); + writer = iterWriter.next(); + + param = writer.getDefaultWriteParam(); + ImageTypeSpecifier specifier = + ImageTypeSpecifier. + createFromBufferedImageType(type); + metadata = writer.getDefaultImageMetadata(specifier, param); + } + + private static void createTEXTNode() + throws IIOInvalidTreeException { + IIOMetadataNode tEXt_Entry = new IIOMetadataNode("tEXtEntry"); + tEXt_Entry.setAttribute("keyword", "Author"); + tEXt_Entry.setAttribute("value", ""); + + IIOMetadataNode tEXt = new IIOMetadataNode("tEXt"); + tEXt.appendChild(tEXt_Entry); + IIOMetadataNode root = new IIOMetadataNode("javax_imageio_png_1.0"); + root.appendChild(tEXt); + metadata.mergeTree("javax_imageio_png_1.0", root); + } + + private static void writeImage() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageOutputStream ios = ImageIO.createImageOutputStream(baos); + writer.setOutput(ios); + writer.write(metadata, new IIOImage(img, null, metadata), param); + writer.dispose(); + + baos.flush(); + imageByteArray = baos.toByteArray(); + baos.close(); + } + + private static void readPNGTEXTChunk() throws IOException { + initialize(BufferedImage.TYPE_BYTE_GRAY); + // Create tEXt node with text length 0 + createTEXTNode(); + + writeImage(); + + ByteArrayInputStream bais = new ByteArrayInputStream( imageByteArray ); + ImageInputStream input= ImageIO.createImageInputStream(bais); + Iterator iter = ImageIO.getImageReaders(input); + ImageReader reader = (ImageReader) iter.next(); + reader.setInput(input, false, false); + BufferedImage image = reader.read(0, reader.getDefaultReadParam()); + input.close(); + bais.close(); + } + + public static void main(String[] args) throws IOException { + + // read PNG image where tEXt chunk's text length is 0 + readPNGTEXTChunk(); + } +} diff -Nru openjdk-lts-11~28/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java --- openjdk-lts-11~28/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8076221 + * @bug 8076221 8211883 * @summary Check if weak cipher suites are disabled * @modules jdk.crypto.ec * @run main/othervm DisabledAlgorithms default @@ -60,9 +60,9 @@ System.getProperty("test.src", "./") + "/" + pathToStores + "/" + trustStoreFile; - // supported RC4 cipher suites + // supported RC4, NULL, and anon cipher suites // it does not contain KRB5 cipher suites because they need a KDC - private static final String[] rc4_ciphersuites = new String[] { + private static final String[] rc4_null_anon_ciphersuites = new String[] { "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", "TLS_ECDHE_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_SHA", @@ -70,7 +70,31 @@ "TLS_ECDH_RSA_WITH_RC4_128_SHA", "SSL_RSA_WITH_RC4_128_MD5", "TLS_ECDH_anon_WITH_RC4_128_SHA", - "SSL_DH_anon_WITH_RC4_128_MD5" + "SSL_DH_anon_WITH_RC4_128_MD5", + "SSL_RSA_WITH_NULL_MD5", + "SSL_RSA_WITH_NULL_SHA", + "TLS_RSA_WITH_NULL_SHA256", + "TLS_ECDH_ECDSA_WITH_NULL_SHA", + "TLS_ECDHE_ECDSA_WITH_NULL_SHA", + "TLS_ECDH_RSA_WITH_NULL_SHA", + "TLS_ECDHE_RSA_WITH_NULL_SHA", + "TLS_ECDH_anon_WITH_NULL_SHA", + "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", + "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", + "SSL_DH_anon_WITH_DES_CBC_SHA", + "SSL_DH_anon_WITH_RC4_128_MD5", + "TLS_DH_anon_WITH_AES_128_CBC_SHA", + "TLS_DH_anon_WITH_AES_128_CBC_SHA256", + "TLS_DH_anon_WITH_AES_128_GCM_SHA256", + "TLS_DH_anon_WITH_AES_256_CBC_SHA", + "TLS_DH_anon_WITH_AES_256_CBC_SHA256", + "TLS_DH_anon_WITH_AES_256_GCM_SHA384", + "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_256_CBC_SHA", + "TLS_ECDH_anon_WITH_NULL_SHA", + "TLS_ECDH_anon_WITH_RC4_128_SHA" }; public static void main(String[] args) throws Exception { @@ -89,8 +113,9 @@ System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - // check if RC4 cipher suites can't be used by default - checkFailure(rc4_ciphersuites); + // check if RC4, NULL, and anon cipher suites + // can't be used by default + checkFailure(rc4_null_anon_ciphersuites); break; case "empty": // reset jdk.tls.disabledAlgorithms @@ -98,9 +123,9 @@ System.out.println("jdk.tls.disabledAlgorithms = " + Security.getProperty("jdk.tls.disabledAlgorithms")); - // check if RC4 cipher suites can be used + // check if RC4, NULL, and anon cipher suites can be used // if jdk.tls.disabledAlgorithms is empty - checkSuccess(rc4_ciphersuites); + checkSuccess(rc4_null_anon_ciphersuites); break; default: throw new RuntimeException("Wrong parameter: " + args[0]); diff -Nru openjdk-lts-11~28/test/jdk/javax/net/ssl/compatibility/ClientHelloProcessing.java openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/compatibility/ClientHelloProcessing.java --- openjdk-lts-11~28/test/jdk/javax/net/ssl/compatibility/ClientHelloProcessing.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/compatibility/ClientHelloProcessing.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,781 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8210918 8210334 8209916 + * @summary Add test to exercise server-side client hello processing + * @run main/othervm ClientHelloProcessing noPskNoKexModes + * @run main/othervm ClientHelloProcessing noPskYesKexModes + * @run main/othervm ClientHelloProcessing yesPskNoKexModes + * @run main/othervm ClientHelloProcessing yesPskYesKexModes + * @run main/othervm ClientHelloProcessing supGroupsSect163k1 + */ + +/* + * SunJSSE does not support dynamic system properties, no way to re-use + * system properties in samevm/agentvm mode. + */ + +import java.io.FileInputStream; +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.util.Map; +import java.util.HashMap; +import java.util.Objects; + +/* + * If you wish to add test cases, the following must be done: + * 1. Add a @run line with the parameter being a name for the test case + * 2. Create the ClientHello as a byte[]. It should be a complete TLS + * record, but does not need upper layer headers like TCP, IP, Ethernet, etc. + * 3. Create a new TestCase instance, see "noPskNoKexModes" as an example + * 4. Create a mapping between the test case name in your @run line and the + * TestCase object you created in step #3. Add this to TESTMAP. + */ + +public class ClientHelloProcessing { + + private static final ByteBuffer SERVOUTBUF = + ByteBuffer.wrap("Server Side".getBytes()); + + private static final String pathToStores = "../etc"; + private static final String keyStoreFile = "keystore"; + private static final String trustStoreFile = "truststore"; + private static final String passwd = "passphrase"; + + private static final String keyFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + keyStoreFile; + private static final String trustFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + trustStoreFile; + + private static TrustManagerFactory trustMgrFac = null; + private static KeyManagerFactory keyMgrFac = null; + + // Canned client hello messages + // These were created from packet captures using openssl 1.1.1's + // s_client utility. The captured TLS record containing the client + // hello was then manually edited to remove or add fields if the s_client + // utility could not be used to generate a message with the desired + // extensions. When manually altering the hello messages, care must + // be taken to change the lengths of the extensions themselves, the + // extensions vector length, the handshake message length, and the TLS + // record length. + + // Client Hello with the pre_shared_key and psk_key_exchange_modes + // both absent. Required manual removal of the psk_key_exchange_modes + // extension. Similarly formed Client Hello messages may be generated + // by clients that don't support pre-shared keys. + // + // TLSv1.3 Record Layer: Handshake Protocol: Client Hello + // Content Type: Handshake (22) + // Version: TLS 1.0 (0x0301) + // Length: 256 + // Handshake Protocol: Client Hello + // Handshake Type: Client Hello (1) + // Length: 252 + // Version: TLS 1.2 (0x0303) + // Random: 9b796ad0cbd559fb48fc4ba32da5bb8c1ef9a7da85231860... + // Session ID Length: 32 + // Session ID: fe8411205bc99a506952f5c28569facb96ff0f37621be072... + // Cipher Suites Length: 8 + // Cipher Suites (4 suites) + // Compression Methods Length: 1 + // Compression Methods (1 method) + // Extensions Length: 171 + // Extension: server_name (len=14) + // Extension: ec_point_formats (len=4) + // Extension: supported_groups (len=4) + // Extension: SessionTicket TLS (len=0) + // Extension: status_request (len=5) + // Extension: encrypt_then_mac (len=0) + // Extension: extended_master_secret (len=0) + // Extension: signature_algorithms (len=30) + // Extension: supported_versions (len=3) + // Extension: key_share (len=71) + private static final byte[] CLIHELLO_NOPSK_NOPSKEXMODE = { + 22, 3, 1, 1, 0, 1, 0, 0, + -4, 3, 3, -101, 121, 106, -48, -53, + -43, 89, -5, 72, -4, 75, -93, 45, + -91, -69, -116, 30, -7, -89, -38, -123, + 35, 24, 96, 29, -93, -22, 10, -97, + -15, -11, 3, 32, -2, -124, 17, 32, + 91, -55, -102, 80, 105, 82, -11, -62, + -123, 105, -6, -53, -106, -1, 15, 55, + 98, 27, -32, 114, -126, -13, 42, -104, + -102, 37, -65, 52, 0, 8, 19, 2, + 19, 3, 19, 1, 0, -1, 1, 0, + 0, -85, 0, 0, 0, 14, 0, 12, + 0, 0, 9, 108, 111, 99, 97, 108, + 104, 111, 115, 116, 0, 11, 0, 4, + 3, 0, 1, 2, 0, 10, 0, 4, + 0, 2, 0, 23, 0, 35, 0, 0, + 0, 5, 0, 5, 1, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 23, 0, + 0, 0, 13, 0, 30, 0, 28, 4, + 3, 5, 3, 6, 3, 8, 7, 8, + 8, 8, 9, 8, 10, 8, 11, 8, + 4, 8, 5, 8, 6, 4, 1, 5, + 1, 6, 1, 0, 43, 0, 3, 2, + 3, 4, 0, 51, 0, 71, 0, 69, + 0, 23, 0, 65, 4, 125, -92, -50, + -91, -39, -55, -114, 0, 22, 2, -50, + 123, -126, 0, -94, 100, -119, -106, 125, + -81, -24, 51, -84, 25, 25, -115, 13, + -17, -20, 93, 68, -97, -79, -98, 91, + 86, 91, -114, 123, 119, -87, -12, 32, + 63, -41, 50, 126, -70, 96, 33, -6, + 94, -7, -68, 54, -47, 53, 0, 88, + 40, -48, -102, -50, 88 + }; + + // Client Hello with the pre_shared_key extension absent but + // containing the psk_key_exchange_modes extension asserted. No + // manual modification was necessary. + // + // TLSv1.3 Record Layer: Handshake Protocol: Client Hello + // Content Type: Handshake (22) + // Version: TLS 1.0 (0x0301) + // Length: 262 + // Handshake Protocol: Client Hello + // Handshake Type: Client Hello (1) + // Length: 258 + // Version: TLS 1.2 (0x0303) + // Random: 9b796ad0cbd559fb48fc4ba32da5bb8c1ef9a7da85231860... + // Session ID Length: 32 + // Session ID: fe8411205bc99a506952f5c28569facb96ff0f37621be072... + // Cipher Suites Length: 8 + // Cipher Suites (4 suites) + // Compression Methods Length: 1 + // Compression Methods (1 method) + // Extensions Length: 177 + // Extension: server_name (len=14) + // Extension: ec_point_formats (len=4) + // Extension: supported_groups (len=4) + // Extension: SessionTicket TLS (len=0) + // Extension: status_request (len=5) + // Extension: encrypt_then_mac (len=0) + // Extension: extended_master_secret (len=0) + // Extension: signature_algorithms (len=30) + // Extension: supported_versions (len=3) + // Extension: psk_key_exchange_modes (len=2) + // Type: psk_key_exchange_modes (45) + // Length: 2 + // PSK Key Exchange Modes Length: 1 + // PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1) + // Extension: key_share (len=71) + private static final byte[] CLIHELLO_NOPSK_YESPSKEXMODE = { + 22, 3, 1, 1, 6, 1, 0, 1, + 2, 3, 3, -101, 121, 106, -48, -53, + -43, 89, -5, 72, -4, 75, -93, 45, + -91, -69, -116, 30, -7, -89, -38, -123, + 35, 24, 96, 29, -93, -22, 10, -97, + -15, -11, 3, 32, -2, -124, 17, 32, + 91, -55, -102, 80, 105, 82, -11, -62, + -123, 105, -6, -53, -106, -1, 15, 55, + 98, 27, -32, 114, -126, -13, 42, -104, + -102, 37, -65, 52, 0, 8, 19, 2, + 19, 3, 19, 1, 0, -1, 1, 0, + 0, -79, 0, 0, 0, 14, 0, 12, + 0, 0, 9, 108, 111, 99, 97, 108, + 104, 111, 115, 116, 0, 11, 0, 4, + 3, 0, 1, 2, 0, 10, 0, 4, + 0, 2, 0, 23, 0, 35, 0, 0, + 0, 5, 0, 5, 1, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 23, 0, + 0, 0, 13, 0, 30, 0, 28, 4, + 3, 5, 3, 6, 3, 8, 7, 8, + 8, 8, 9, 8, 10, 8, 11, 8, + 4, 8, 5, 8, 6, 4, 1, 5, + 1, 6, 1, 0, 43, 0, 3, 2, + 3, 4, 0, 45, 0, 2, 1, 1, + 0, 51, 0, 71, 0, 69, 0, 23, + 0, 65, 4, 125, -92, -50, -91, -39, + -55, -114, 0, 22, 2, -50, 123, -126, + 0, -94, 100, -119, -106, 125, -81, -24, + 51, -84, 25, 25, -115, 13, -17, -20, + 93, 68, -97, -79, -98, 91, 86, 91, + -114, 123, 119, -87, -12, 32, 63, -41, + 50, 126, -70, 96, 33, -6, 94, -7, + -68, 54, -47, 53, 0, 88, 40, -48, + -102, -50, 88 + }; + + // Client Hello with pre_shared_key asserted and psk_key_exchange_modes + // absent. This is a violation of RFC 8446. This required manual + // removal of the psk_key_exchange_modes extension. + // + // TLSv1.3 Record Layer: Handshake Protocol: Client Hello + // Content Type: Handshake (22) + // Version: TLS 1.0 (0x0301) + // Length: 318 + // Handshake Protocol: Client Hello + // Handshake Type: Client Hello (1) + // Length: 314 + // Version: TLS 1.2 (0x0303) + // Random: e730e42336a19ed9fdb42919c65769132e9e779a797f188c... + // Session ID Length: 32 + // Session ID: 6c6ed31408042fabd0c47fdeee6d19de2d6795e37590f00e... + // Cipher Suites Length: 8 + // Cipher Suites (4 suites) + // Compression Methods Length: 1 + // Compression Methods (1 method) + // Extensions Length: 233 + // Extension: server_name (len=14) + // Extension: ec_point_formats (len=4) + // Extension: supported_groups (len=4) + // Extension: SessionTicket TLS (len=0) + // Extension: status_request (len=5) + // Extension: encrypt_then_mac (len=0) + // Extension: extended_master_secret (len=0) + // Extension: signature_algorithms (len=30) + // Extension: supported_versions (len=3) + // Extension: key_share (len=71) + // Extension: pre_shared_key (len=58) + // Type: pre_shared_key (41) + // Length: 58 + // Pre-Shared Key extension + // Identities Length: 21 + // PSK Identity (length: 15) + // Identity Length: 15 + // Identity: 436c69656e745f6964656e74697479 + // Obfuscated Ticket Age: 0 + // PSK Binders length: 33 + // PSK Binders + private static final byte[] CLIHELLO_YESPSK_NOPSKEXMODE = { + 22, 3, 1, 1, 62, 1, 0, 1, + 58, 3, 3, -25, 48, -28, 35, 54, + -95, -98, -39, -3, -76, 41, 25, -58, + 87, 105, 19, 46, -98, 119, -102, 121, + 127, 24, -116, -9, -99, 22, 116, -97, + 90, 73, -18, 32, 108, 110, -45, 20, + 8, 4, 47, -85, -48, -60, 127, -34, + -18, 109, 25, -34, 45, 103, -107, -29, + 117, -112, -16, 14, -5, -24, 24, 61, + -9, 28, -119, -73, 0, 8, 19, 2, + 19, 3, 19, 1, 0, -1, 1, 0, + 0, -23, 0, 0, 0, 14, 0, 12, + 0, 0, 9, 108, 111, 99, 97, 108, + 104, 111, 115, 116, 0, 11, 0, 4, + 3, 0, 1, 2, 0, 10, 0, 4, + 0, 2, 0, 23, 0, 35, 0, 0, + 0, 5, 0, 5, 1, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 23, 0, + 0, 0, 13, 0, 30, 0, 28, 4, + 3, 5, 3, 6, 3, 8, 7, 8, + 8, 8, 9, 8, 10, 8, 11, 8, + 4, 8, 5, 8, 6, 4, 1, 5, + 1, 6, 1, 0, 43, 0, 3, 2, + 3, 4, 0, 51, 0, 71, 0, 69, + 0, 23, 0, 65, 4, -6, 101, 105, + -2, -6, 85, -99, -37, 112, 90, 44, + -123, -107, 4, -12, -64, 92, 40, 100, + 22, -53, -124, 54, 56, 102, 25, 76, + -86, -1, 6, 110, 95, 92, -86, -35, + -101, 115, 85, 99, 19, 6, -43, 105, + -37, -92, 53, -97, 84, -1, -53, 87, + -53, -107, -13, -14, 32, 101, -35, 39, + 102, -17, -119, -25, -51, 0, 41, 0, + 58, 0, 21, 0, 15, 67, 108, 105, + 101, 110, 116, 95, 105, 100, 101, 110, + 116, 105, 116, 121, 0, 0, 0, 0, + 0, 33, 32, -113, -27, -44, -71, -68, + -26, -47, 57, -82, -29, -13, -61, 77, + 52, -60, 27, 74, -120, -104, 102, 21, + 121, 0, 48, 43, -40, -19, -67, 57, + -20, 97, 23 + }; + + // Client Hello containing both pre_shared_key and psk_key_exchange_modes + // extensions. Generation of this hello was done by adding + // "-psk a1b2c3d4" to the s_client command. + // + // TLSv1.3 Record Layer: Handshake Protocol: Client Hello + // Content Type: Handshake (22) + // Version: TLS 1.0 (0x0301) + // Length: 324 + // Handshake Protocol: Client Hello + // Handshake Type: Client Hello (1) + // Length: 320 + // Version: TLS 1.2 (0x0303) + // Random: e730e42336a19ed9fdb42919c65769132e9e779a797f188c... + // Session ID Length: 32 + // Session ID: 6c6ed31408042fabd0c47fdeee6d19de2d6795e37590f00e... + // Cipher Suites Length: 8 + // Cipher Suites (4 suites) + // Compression Methods Length: 1 + // Compression Methods (1 method) + // Extensions Length: 239 + // Extension: server_name (len=14) + // Extension: ec_point_formats (len=4) + // Extension: supported_groups (len=4) + // Extension: SessionTicket TLS (len=0) + // Extension: status_request (len=5) + // Extension: encrypt_then_mac (len=0) + // Extension: extended_master_secret (len=0) + // Extension: signature_algorithms (len=30) + // Extension: supported_versions (len=3) + // Extension: psk_key_exchange_modes (len=2) + // Type: psk_key_exchange_modes (45) + // Length: 2 + // PSK Key Exchange Modes Length: 1 + // PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1) + // Extension: key_share (len=71) + // Extension: pre_shared_key (len=58) + // Type: pre_shared_key (41) + // Length: 58 + // Pre-Shared Key extension + // Identities Length: 21 + // PSK Identity (length: 15) + // Identity Length: 15 + // Identity: 436c69656e745f6964656e74697479 + // Obfuscated Ticket Age: 0 + // PSK Binders length: 33 + // PSK Binders + private static final byte[] CLIHELLO_YESPSK_YESPSKEXMODE = { + 22, 3, 1, 1, 68, 1, 0, 1, + 64, 3, 3, -25, 48, -28, 35, 54, + -95, -98, -39, -3, -76, 41, 25, -58, + 87, 105, 19, 46, -98, 119, -102, 121, + 127, 24, -116, -9, -99, 22, 116, -97, + 90, 73, -18, 32, 108, 110, -45, 20, + 8, 4, 47, -85, -48, -60, 127, -34, + -18, 109, 25, -34, 45, 103, -107, -29, + 117, -112, -16, 14, -5, -24, 24, 61, + -9, 28, -119, -73, 0, 8, 19, 2, + 19, 3, 19, 1, 0, -1, 1, 0, + 0, -17, 0, 0, 0, 14, 0, 12, + 0, 0, 9, 108, 111, 99, 97, 108, + 104, 111, 115, 116, 0, 11, 0, 4, + 3, 0, 1, 2, 0, 10, 0, 4, + 0, 2, 0, 23, 0, 35, 0, 0, + 0, 5, 0, 5, 1, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 23, 0, + 0, 0, 13, 0, 30, 0, 28, 4, + 3, 5, 3, 6, 3, 8, 7, 8, + 8, 8, 9, 8, 10, 8, 11, 8, + 4, 8, 5, 8, 6, 4, 1, 5, + 1, 6, 1, 0, 43, 0, 3, 2, + 3, 4, 0, 45, 0, 2, 1, 1, + 0, 51, 0, 71, 0, 69, 0, 23, + 0, 65, 4, -6, 101, 105, -2, -6, + 85, -99, -37, 112, 90, 44, -123, -107, + 4, -12, -64, 92, 40, 100, 22, -53, + -124, 54, 56, 102, 25, 76, -86, -1, + 6, 110, 95, 92, -86, -35, -101, 115, + 85, 99, 19, 6, -43, 105, -37, -92, + 53, -97, 84, -1, -53, 87, -53, -107, + -13, -14, 32, 101, -35, 39, 102, -17, + -119, -25, -51, 0, 41, 0, 58, 0, + 21, 0, 15, 67, 108, 105, 101, 110, + 116, 95, 105, 100, 101, 110, 116, 105, + 116, 121, 0, 0, 0, 0, 0, 33, + 32, -113, -27, -44, -71, -68, -26, -47, + 57, -82, -29, -13, -61, 77, 52, -60, + 27, 74, -120, -104, 102, 21, 121, 0, + 48, 43, -40, -19, -67, 57, -20, 97, + 23 + }; + + // Client Hello with sect163k1 and secp256r1 as supported groups. This + // test covers an error condition where a known, supported curve that is + // not in the default enabled set of curves would cause failures. + // Generation of this hello was done using "-curves sect163k1:prime256v1" + // as an option to s_client. + // + // TLSv1.2 Record Layer: Handshake Protocol: Client Hello + // Content Type: Handshake (22) + // Version: TLS 1.0 (0x0301) + // Length: 210 + // Handshake Protocol: Client Hello + // Handshake Type: Client Hello (1) + // Length: 206 + // Version: TLS 1.2 (0x0303) + // Random: 05cbae9b834851d856355b72601cb67b7cd4eb51f29ed50b... + // Session ID Length: 0 + // Cipher Suites Length: 56 + // Cipher Suites (28 suites) + // Compression Methods Length: 1 + // Compression Methods (1 method) + // Extensions Length: 109 + // Extension: server_name (len=14) + // Extension: ec_point_formats (len=4) + // Extension: supported_groups (len=6) + // Type: supported_groups (10) + // Length: 6 + // Supported Groups List Length: 4 + // Supported Groups (2 groups) + // Supported Group: sect163k1 (0x0001) + // Supported Group: secp256r1 (0x0017) + // Extension: SessionTicket TLS (len=0) + // Extension: status_request (len=5) + // Extension: encrypt_then_mac (len=0) + // Extension: extended_master_secret (len=0) + // Extension: signature_algorithms (len=48) + private static final byte[] CLIHELLO_SUPGRP_SECT163K1 = { + 22, 3, 1, 0, -46, 1, 0, 0, + -50, 3, 3, 5, -53, -82, -101, -125, + 72, 81, -40, 86, 53, 91, 114, 96, + 28, -74, 123, 124, -44, -21, 81, -14, + -98, -43, 11, 90, -87, -106, 13, 63, + -62, 100, 111, 0, 0, 56, -64, 44, + -64, 48, 0, -97, -52, -87, -52, -88, + -52, -86, -64, 43, -64, 47, 0, -98, + -64, 36, -64, 40, 0, 107, -64, 35, + -64, 39, 0, 103, -64, 10, -64, 20, + 0, 57, -64, 9, -64, 19, 0, 51, + 0, -99, 0, -100, 0, 61, 0, 60, + 0, 53, 0, 47, 0, -1, 1, 0, + 0, 109, 0, 0, 0, 14, 0, 12, + 0, 0, 9, 108, 111, 99, 97, 108, + 104, 111, 115, 116, 0, 11, 0, 4, + 3, 0, 1, 2, 0, 10, 0, 6, + 0, 4, 0, 1, 0, 23, 0, 35, + 0, 0, 0, 5, 0, 5, 1, 0, + 0, 0, 0, 0, 22, 0, 0, 0, + 23, 0, 0, 0, 13, 0, 48, 0, + 46, 4, 3, 5, 3, 6, 3, 8, + 7, 8, 8, 8, 9, 8, 10, 8, + 11, 8, 4, 8, 5, 8, 6, 4, + 1, 5, 1, 6, 1, 3, 3, 2, + 3, 3, 1, 2, 1, 3, 2, 2, + 2, 4, 2, 5, 2, 6, 2 + }; + + public static interface TestCase { + void execTest() throws Exception; + } + + private static final Map TESTMAP = new HashMap<>(); + + public static void main(String[] args) throws Exception { + boolean allGood = true; + System.setProperty("javax.net.debug", "ssl:handshake"); + trustMgrFac = makeTrustManagerFactory(trustFilename, passwd); + keyMgrFac = makeKeyManagerFactory(keyFilename, passwd); + + // Populate the test map + TESTMAP.put("noPskNoKexModes", noPskNoKexModes); + TESTMAP.put("noPskYesKexModes", noPskYesKexModes); + TESTMAP.put("yesPskNoKexModes", yesPskNoKexModes); + TESTMAP.put("yesPskYesKexModes", yesPskYesKexModes); + TESTMAP.put("supGroupsSect163k1", supGroupsSect163k1); + + if (args == null || args.length < 1) { + throw new Exception("FAIL: Test @run line is missing a test label"); + } + + // Pull the test to run from the test map. + TestCase test = Objects.requireNonNull(TESTMAP.get(args[0]), + "No TestCase found for test label " + args[0]); + test.execTest(); + } + + /** + * Test case to cover hellos with no pre_shared_key nor + * psk_key_exchange_modes extensions. Clients not supporting PSK at all + * may send hellos like this. + */ + private static final TestCase noPskNoKexModes = new TestCase() { + @Override + public void execTest() throws Exception { + System.out.println("\nTest: PSK = No, PSKEX = No"); + processClientHello("TLS", CLIHELLO_NOPSK_NOPSKEXMODE); + System.out.println("PASS"); + } + }; + + /** + * Test case to cover hellos with no pre_shared_key but have the + * psk_key_exchange_modes extension. This kind of hello is seen from + * some popular browsers and test clients. + */ + private static final TestCase noPskYesKexModes = new TestCase() { + @Override + public void execTest() throws Exception { + System.out.println("\nTest: PSK = No, PSKEX = Yes"); + processClientHello("TLS", CLIHELLO_NOPSK_YESPSKEXMODE); + System.out.println("PASS"); + } + }; + + /** + * Test case using a client hello with the pre_shared_key extension but + * no psk_key_exchange_modes extension present. This is a violation of + * 8446 and should cause an exception when unwrapped and processed by + * SSLEngine. + */ + private static final TestCase yesPskNoKexModes = new TestCase() { + @Override + public void execTest() throws Exception { + try { + System.out.println("\nTest: PSK = Yes, PSKEX = No"); + processClientHello("TLS", CLIHELLO_YESPSK_NOPSKEXMODE); + throw new Exception( + "FAIL: Client Hello processed without expected error"); + } catch (SSLHandshakeException sslhe) { + System.out.println("PASS: Caught expected exception: " + sslhe); + } + } + }; + + /** + * Test case using a client hello asserting the pre_shared_key and + * psk_key_exchange_modes extensions. + */ + private static final TestCase yesPskYesKexModes = new TestCase() { + @Override + public void execTest() throws Exception { + System.out.println("\nTest: PSK = Yes, PSKEX = Yes"); + processClientHello("TLS", CLIHELLO_YESPSK_YESPSKEXMODE); + System.out.println("PASS"); + } + }; + + /** + * Test case with a client hello asserting two named curves in the + * supported_groups extension: sect163k1 and secp256r1. + */ + private static final TestCase supGroupsSect163k1 = new TestCase() { + @Override + public void execTest() throws Exception { + System.out.println("\nTest: Use of non-default-enabled " + + "Supported Group (sect163k1)"); + processClientHello("TLS", CLIHELLO_SUPGRP_SECT163K1); + System.out.println("PASS"); + } + }; + + /** + * Send a ClientHello message to an SSLEngine instance configured as a + * server. + * + * @param proto the protocol used to create the SSLContext. This will + * default to "TLS" if null is passed in. + * @param message the ClientHello as a complete TLS record. + * + * @throws Exception if any processing errors occur. The caller (TestCase) + * is expected to deal with the exception in whatever way appropriate + * for the test. + */ + private static void processClientHello(String proto, byte[] message) + throws Exception { + SSLEngine serverEng = makeServerEngine(proto, keyMgrFac, trustMgrFac); + ByteBuffer sTOc = makePacketBuf(serverEng); + SSLEngineResult serverResult; + + ByteBuffer cTOs = ByteBuffer.wrap(message); + System.out.println("CLIENT-TO-SERVER\n" + + dumpHexBytes(cTOs, 16, "\n", " ")); + serverResult = serverEng.unwrap(cTOs, SERVOUTBUF); + printResult("server unwrap: ", serverResult); + runDelegatedTasks(serverResult, serverEng); + serverEng.wrap(SERVOUTBUF, sTOc); + } + + /** + * Create a TrustManagerFactory from a given keystore. + * + * @param tsPath the path to the trust store file. + * @param pass the password for the trust store. + * + * @return a new TrustManagerFactory built from the trust store provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or TrustManagerFactory creation. + * @throws IOException if any loading error with the trust store occurs. + */ + private static TrustManagerFactory makeTrustManagerFactory(String tsPath, + String pass) throws GeneralSecurityException, IOException { + KeyStore ts = KeyStore.getInstance("JKS"); + char[] passphrase = pass.toCharArray(); + + ts.load(new FileInputStream(tsPath), passphrase); + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(ts); + return tmf; + } + + /** + * Create a KeyManagerFactory from a given keystore. + * + * @param ksPath the path to the keystore file. + * @param pass the password for the keystore. + * + * @return a new TrustManagerFactory built from the keystore provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or KeyManagerFactory creation. + * @throws IOException if any loading error with the keystore occurs + */ + private static KeyManagerFactory makeKeyManagerFactory(String ksPath, + String pass) throws GeneralSecurityException, IOException { + KeyStore ks = KeyStore.getInstance("JKS"); + char[] passphrase = pass.toCharArray(); + + ks.load(new FileInputStream(ksPath), passphrase); + KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, passphrase); + return kmf; + } + + /** + * Create an SSLEngine instance from a given protocol specifier, + * KeyManagerFactory and TrustManagerFactory. + * + * @param proto the protocol specifier for the SSLContext. This will + * default to "TLS" if null is provided. + * @param kmf an initialized KeyManagerFactory. May be null. + * @param tmf an initialized TrustManagerFactory. May be null. + * + * @return an SSLEngine instance configured as a server and with client + * authentication disabled. + * + * @throws GeneralSecurityException if any errors occur during the + * creation of the SSLEngine. + */ + private static SSLEngine makeServerEngine(String proto, + KeyManagerFactory kmf, TrustManagerFactory tmf) + throws GeneralSecurityException { + SSLContext ctx = SSLContext.getInstance(proto != null ? proto : "TLS"); + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + SSLEngine ssle = ctx.createSSLEngine(); + ssle.setUseClientMode(false); + ssle.setNeedClientAuth(false); + return ssle; + } + + /** + * Make a ByteBuffer sized for TLS records that can be used by an SSLEngine. + * + * @param engine the SSLEngine used to determine the packet buffer size. + * + * @return a ByteBuffer sized for TLS packets. + */ + private static ByteBuffer makePacketBuf(SSLEngine engine) { + SSLSession sess = engine.getSession(); + ByteBuffer packetBuf = ByteBuffer.allocate(sess.getPacketBufferSize()); + return packetBuf; + } + + /** + * Runs any delegated tasks after unwrapping TLS records. + * + * @param result the most recent result from an unwrap operation on + * an SSLEngine. + * @param engine the SSLEngine used to unwrap the data. + * + * @throws Exception if any errors occur while running the delegated + * tasks. + */ + private static void runDelegatedTasks(SSLEngineResult result, + SSLEngine engine) throws Exception { + HandshakeStatus hsStatus = result.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + System.out.println("\trunning delegated task..."); + runnable.run(); + } + hsStatus = engine.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + throw new Exception( + "handshake shouldn't need additional tasks"); + } + System.out.println("\tnew HandshakeStatus: " + hsStatus); + } + } + + /** + * Display the results of a wrap or unwrap operation from an SSLEngine. + * + * @param str a label to be prefixed to the result display. + * @param result the result returned from the wrap/unwrap operation. + */ + private static void printResult(String str, SSLEngineResult result) { + System.out.println("The format of the SSLEngineResult is: \n" + + "\t\"getStatus() / getHandshakeStatus()\" +\n" + + "\t\"bytesConsumed() / bytesProduced()\"\n"); + HandshakeStatus hsStatus = result.getHandshakeStatus(); + System.out.println(str + result.getStatus() + "/" + hsStatus + ", " + + result.bytesConsumed() + "/" + result.bytesProduced() + " bytes"); + if (hsStatus == HandshakeStatus.FINISHED) { + System.out.println("\t...ready for application data"); + } + } + + /** + * Dump the hex bytes of a buffer into string form. + * + * @param data The array of bytes to dump to stdout. + * @param itemsPerLine The number of bytes to display per line + * if the {@code lineDelim} character is blank then all bytes + * will be printed on a single line. + * @param lineDelim The delimiter between lines + * @param itemDelim The delimiter between bytes + * + * @return The hexdump of the byte array + */ + private static String dumpHexBytes(byte[] data, int itemsPerLine, + String lineDelim, String itemDelim) { + return dumpHexBytes(ByteBuffer.wrap(data), itemsPerLine, lineDelim, + itemDelim); + } + + /** + * Dump the hex bytes of a buffer into string form. + * + * @param data The ByteBuffer to dump to stdout. + * @param itemsPerLine The number of bytes to display per line + * if the {@code lineDelim} character is blank then all bytes + * will be printed on a single line. + * @param lineDelim The delimiter between lines + * @param itemDelim The delimiter between bytes + * + * @return The hexdump of the byte array + */ + private static String dumpHexBytes(ByteBuffer data, int itemsPerLine, + String lineDelim, String itemDelim) { + StringBuilder sb = new StringBuilder(); + if (data != null) { + data.mark(); + int i = 0; + while (data.remaining() > 0) { + if (i % itemsPerLine == 0 && i != 0) { + sb.append(lineDelim); + } + sb.append(String.format("%02X", data.get())).append(itemDelim); + i++; + } + data.reset(); + } + + return sb.toString(); + } +} diff -Nru openjdk-lts-11~28/test/jdk/javax/net/ssl/SSLSession/JSSERenegotiate.java openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/SSLSession/JSSERenegotiate.java --- openjdk-lts-11~28/test/jdk/javax/net/ssl/SSLSession/JSSERenegotiate.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/SSLSession/JSSERenegotiate.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -37,6 +37,7 @@ import java.io.*; import java.net.*; +import java.security.Security; import javax.net.ssl.*; public class JSSERenegotiate { @@ -190,6 +191,10 @@ volatile Exception clientException = null; public static void main(String[] args) throws Exception { + // reset the security property to make sure that the cipher suites + // used in this test are not disabled + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + String keyFilename = System.getProperty("test.src", "./") + "/" + pathToStores + "/" + keyStoreFile; diff -Nru openjdk-lts-11~28/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java --- openjdk-lts-11~28/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,586 @@ +/* + * 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. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 8211806 + * @summary TLS 1.3 handshake server name indication is missing on a session resume + * @run main/othervm ResumeTLS13withSNI + */ + +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.*; +import java.io.*; +import java.security.*; +import java.nio.*; +import java.util.List; + +public class ResumeTLS13withSNI { + + /* + * Enables logging of the SSLEngine operations. + */ + private static final boolean logging = false; + + /* + * Enables the JSSE system debugging system property: + * + * -Djavax.net.debug=ssl:handshake + * + * This gives a lot of low-level information about operations underway, + * including specific handshake messages, and might be best examined + * after gaining some familiarity with this application. + */ + private static final boolean debug = true; + + private static final ByteBuffer clientOut = + ByteBuffer.wrap("Hi Server, I'm Client".getBytes()); + private static final ByteBuffer serverOut = + ByteBuffer.wrap("Hello Client, I'm Server".getBytes()); + + /* + * The following is to set up the keystores. + */ + private static final String pathToStores = "../etc"; + private static final String keyStoreFile = "keystore"; + private static final String trustStoreFile = "truststore"; + private static final char[] passphrase = "passphrase".toCharArray(); + + private static final String keyFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + keyStoreFile; + private static final String trustFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + trustStoreFile; + + private static final String HOST_NAME = "arf.yak.foo"; + private static final SNIHostName SNI_NAME = new SNIHostName(HOST_NAME); + private static final SNIMatcher SNI_MATCHER = + SNIHostName.createSNIMatcher("arf\\.yak\\.foo"); + + /* + * Main entry point for this test. + */ + public static void main(String args[]) throws Exception { + if (debug) { + System.setProperty("javax.net.debug", "ssl:handshake"); + } + + KeyManagerFactory kmf = makeKeyManagerFactory(keyFilename, + passphrase); + TrustManagerFactory tmf = makeTrustManagerFactory(trustFilename, + passphrase); + + SSLContext sslCtx = SSLContext.getInstance("TLS"); + sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + + // Make client and server engines, then customize as needed + SSLEngine clientEngine = makeEngine(sslCtx, kmf, tmf, true); + SSLParameters cliSSLParams = clientEngine.getSSLParameters(); + cliSSLParams.setServerNames(List.of(SNI_NAME)); + clientEngine.setSSLParameters(cliSSLParams); + clientEngine.setEnabledProtocols(new String[] { "TLSv1.3" }); + + SSLEngine serverEngine = makeEngine(sslCtx, kmf, tmf, false); + SSLParameters servSSLParams = serverEngine.getSSLParameters(); + servSSLParams.setSNIMatchers(List.of(SNI_MATCHER)); + serverEngine.setSSLParameters(servSSLParams); + + initialHandshake(clientEngine, serverEngine); + + // Create a new client-side engine which can initiate TLS session + // resumption + SSLEngine newCliEngine = makeEngine(sslCtx, kmf, tmf, true); + newCliEngine.setEnabledProtocols(new String[] { "TLSv1.3" }); + ByteBuffer resCliHello = getResumptionClientHello(newCliEngine); + + dumpBuffer("Resumed ClientHello Data", resCliHello); + + // Parse the client hello message and make sure it is a resumption + // hello and has SNI in it. + checkResumedClientHelloSNI(resCliHello); + } + + /* + * Run the test. + * + * Sit in a tight loop, both engines calling wrap/unwrap regardless + * of whether data is available or not. We do this until both engines + * report back they are closed. + * + * The main loop handles all of the I/O phases of the SSLEngine's + * lifetime: + * + * initial handshaking + * application data transfer + * engine closing + * + * One could easily separate these phases into separate + * sections of code. + */ + private static void initialHandshake(SSLEngine clientEngine, + SSLEngine serverEngine) throws Exception { + boolean dataDone = false; + + // Create all the buffers + SSLSession session = clientEngine.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + ByteBuffer clientIn = ByteBuffer.allocate(appBufferMax + 50); + ByteBuffer serverIn = ByteBuffer.allocate(appBufferMax + 50); + ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax); + ByteBuffer sTOc = ByteBuffer.allocateDirect(netBufferMax); + + // results from client's last operation + SSLEngineResult clientResult; + + // results from server's last operation + SSLEngineResult serverResult; + + /* + * Examining the SSLEngineResults could be much more involved, + * and may alter the overall flow of the application. + * + * For example, if we received a BUFFER_OVERFLOW when trying + * to write to the output pipe, we could reallocate a larger + * pipe, but instead we wait for the peer to drain it. + */ + Exception clientException = null; + Exception serverException = null; + + while (!dataDone) { + log("================"); + + try { + clientResult = clientEngine.wrap(clientOut, cTOs); + log("client wrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client wrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + try { + serverResult = serverEngine.wrap(serverOut, sTOc); + log("server wrap: ", serverResult); + } catch (Exception e) { + serverException = e; + System.err.println("Server wrap() threw: " + e.getMessage()); + } + logEngineStatus(serverEngine); + runDelegatedTasks(serverEngine); + + cTOs.flip(); + sTOc.flip(); + + log("--------"); + + try { + clientResult = clientEngine.unwrap(sTOc, clientIn); + log("client unwrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client unwrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + try { + serverResult = serverEngine.unwrap(cTOs, serverIn); + log("server unwrap: ", serverResult); + } catch (Exception e) { + serverException = e; + System.err.println("Server unwrap() threw: " + e.getMessage()); + } + logEngineStatus(serverEngine); + runDelegatedTasks(serverEngine); + + cTOs.compact(); + sTOc.compact(); + + /* + * After we've transfered 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())) { + + /* + * A sanity check to ensure we got what was sent. + */ + checkTransfer(serverOut, clientIn); + checkTransfer(clientOut, serverIn); + + dataDone = true; + } + } + } + + /** + * The goal of this function is to start a simple TLS session resumption + * and get the client hello message data back so it can be inspected. + * + * @param clientEngine + * + * @return a ByteBuffer consisting of the ClientHello TLS record. + * + * @throws Exception if any processing goes wrong. + */ + private static ByteBuffer getResumptionClientHello(SSLEngine clientEngine) + throws Exception { + // Create all the buffers + SSLSession session = clientEngine.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax); + Exception clientException = null; + + // results from client's last operation + SSLEngineResult clientResult; + + // results from server's last operation + SSLEngineResult serverResult; + + log("================"); + + // Start by having the client create a new ClientHello. It should + // contain PSK info that allows it to attempt session resumption. + try { + clientResult = clientEngine.wrap(clientOut, cTOs); + log("client wrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client wrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + cTOs.flip(); + return cTOs; + } + + /** + * This method walks a ClientHello TLS record, looking for a matching + * server_name hostname value from the original handshake and a PSK + * extension, which indicates (in the context of this test) that this + * is a resumed handshake. + * + * @param resCliHello a ByteBuffer consisting of a complete TLS handshake + * record that is a ClientHello message. The position of the buffer + * must be at the beginning of the TLS record header. + * + * @throws Exception if any of the consistency checks for the TLS record, + * or handshake message fails. It will also throw an exception if + * either the server_name extension doesn't have a matching hostname + * field or the pre_shared_key extension is not present. + */ + private static void checkResumedClientHelloSNI(ByteBuffer resCliHello) + throws Exception { + boolean foundMatchingSNI = false; + boolean foundPSK = false; + + // Advance past the following fields: + // TLS Record header (5 bytes) + resCliHello.position(resCliHello.position() + 5); + + // Get the next byte and make sure it is a Client Hello + byte hsMsgType = resCliHello.get(); + if (hsMsgType != 0x01) { + throw new Exception("Message is not a ClientHello, MsgType = " + + hsMsgType); + } + + // Skip past the length (3 bytes) + resCliHello.position(resCliHello.position() + 3); + + // Protocol version should be TLSv1.2 (0x03, 0x03) + short chProto = resCliHello.getShort(); + if (chProto != 0x0303) { + throw new Exception( + "Client Hello protocol version is not TLSv1.2: Got " + + String.format("0x%04X", chProto)); + } + + // Skip 32-bytes of random data + resCliHello.position(resCliHello.position() + 32); + + // Get the legacy session length and skip that many bytes + int sessIdLen = Byte.toUnsignedInt(resCliHello.get()); + resCliHello.position(resCliHello.position() + sessIdLen); + + // Skip over all the cipher suites + int csLen = Short.toUnsignedInt(resCliHello.getShort()); + resCliHello.position(resCliHello.position() + csLen); + + // Skip compression methods + int compLen = Byte.toUnsignedInt(resCliHello.get()); + resCliHello.position(resCliHello.position() + compLen); + + // Parse the extensions. Get length first, then walk the extensions + // List and look for the presence of the PSK extension and server_name. + // For server_name, make sure it is the same as what was provided + // in the original handshake. + System.err.println("ClientHello Extensions Check"); + int extListLen = Short.toUnsignedInt(resCliHello.getShort()); + while (extListLen > 0) { + // Get the Extension type and length + int extType = Short.toUnsignedInt(resCliHello.getShort()); + int extLen = Short.toUnsignedInt(resCliHello.getShort()); + switch (extType) { + case 0: // server_name + System.err.println("* Found server_name Extension"); + int snListLen = Short.toUnsignedInt(resCliHello.getShort()); + while (snListLen > 0) { + int nameType = Byte.toUnsignedInt(resCliHello.get()); + if (nameType == 0) { // host_name + int hostNameLen = + Short.toUnsignedInt(resCliHello.getShort()); + byte[] hostNameData = new byte[hostNameLen]; + resCliHello.get(hostNameData); + String hostNameStr = new String(hostNameData); + System.err.println("\tHostname: " + hostNameStr); + if (hostNameStr.equals(HOST_NAME)) { + foundMatchingSNI = true; + } + snListLen -= 3 + hostNameLen; // type, len, data + } else { // something else + // We don't support anything else and cannot + // know how to advance. Throw an exception + throw new Exception("Unknown server name type: " + + nameType); + } + } + break; + case 41: // pre_shared_key + // We're not going to bother checking the value. The + // presence of the extension in the context of this test + // is good enough to tell us this is a resumed ClientHello. + foundPSK = true; + System.err.println("* Found pre_shared_key Extension"); + resCliHello.position(resCliHello.position() + extLen); + break; + default: + System.err.format("* Found extension %d (%d bytes)\n", + extType, extLen); + resCliHello.position(resCliHello.position() + extLen); + break; + } + extListLen -= extLen + 4; // Ext type(2), length(2), data(var.) + } + + // At the end of all the extension processing, either we've found + // both extensions and the server_name matches our expected value + // or we throw an exception. + if (!foundMatchingSNI) { + throw new Exception("Could not find a matching server_name"); + } else if (!foundPSK) { + throw new Exception("Missing PSK extension, not a resumption?"); + } + } + + /** + * Create a TrustManagerFactory from a given keystore. + * + * @param tsPath the path to the trust store file. + * @param pass the password for the trust store. + * + * @return a new TrustManagerFactory built from the trust store provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or TrustManagerFactory creation. + * @throws IOException if any loading error with the trust store occurs. + */ + private static TrustManagerFactory makeTrustManagerFactory(String tsPath, + char[] pass) throws GeneralSecurityException, IOException { + TrustManagerFactory tmf; + KeyStore ts = KeyStore.getInstance("JKS"); + + try (FileInputStream fsIn = new FileInputStream(tsPath)) { + ts.load(fsIn, pass); + tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(ts); + } + return tmf; + } + + /** + * Create a KeyManagerFactory from a given keystore. + * + * @param ksPath the path to the keystore file. + * @param pass the password for the keystore. + * + * @return a new TrustManagerFactory built from the keystore provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or KeyManagerFactory creation. + * @throws IOException if any loading error with the keystore occurs + */ + private static KeyManagerFactory makeKeyManagerFactory(String ksPath, + char[] pass) throws GeneralSecurityException, IOException { + KeyManagerFactory kmf; + KeyStore ks = KeyStore.getInstance("JKS"); + + try (FileInputStream fsIn = new FileInputStream(ksPath)) { + ks.load(fsIn, pass); + kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, pass); + } + return kmf; + } + + /** + * Create an SSLEngine instance from a given protocol specifier, + * KeyManagerFactory and TrustManagerFactory. + * + * @param ctx the SSLContext used to create the SSLEngine + * @param kmf an initialized KeyManagerFactory. May be null. + * @param tmf an initialized TrustManagerFactory. May be null. + * @param isClient true if it intended to create a client engine, false + * for a server engine. + * + * @return an SSLEngine instance configured as a server and with client + * authentication disabled. + * + * @throws GeneralSecurityException if any errors occur during the + * creation of the SSLEngine. + */ + private static SSLEngine makeEngine(SSLContext ctx, + KeyManagerFactory kmf, TrustManagerFactory tmf, boolean isClient) + throws GeneralSecurityException { + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + SSLEngine ssle = ctx.createSSLEngine("localhost", 8443); + ssle.setUseClientMode(isClient); + ssle.setNeedClientAuth(false); + return ssle; + } + + private static void logEngineStatus(SSLEngine engine) { + log("\tCurrent HS State " + engine.getHandshakeStatus().toString()); + log("\tisInboundDone(): " + engine.isInboundDone()); + log("\tisOutboundDone(): " + engine.isOutboundDone()); + } + + /* + * 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); + } + } + + private static boolean isEngineClosed(SSLEngine engine) { + return (engine.isOutboundDone() && engine.isInboundDone()); + } + + /* + * 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()); + } + + /* + * Logging code + */ + private static boolean resultOnce = true; + + private static void log(String str, SSLEngineResult result) { + if (!logging) { + return; + } + if (resultOnce) { + resultOnce = false; + System.err.println("The format of the SSLEngineResult is: \n" + + "\t\"getStatus() / getHandshakeStatus()\" +\n" + + "\t\"bytesConsumed() / bytesProduced()\"\n"); + } + HandshakeStatus hsStatus = result.getHandshakeStatus(); + log(str + + result.getStatus() + "/" + hsStatus + ", " + + result.bytesConsumed() + "/" + result.bytesProduced() + + " bytes"); + if (hsStatus == HandshakeStatus.FINISHED) { + log("\t...ready for application data"); + } + } + + private static void log(String str) { + if (logging) { + System.err.println(str); + } + } + + private static void dumpBuffer(String header, ByteBuffer data) { + data.mark(); + System.err.format("========== %s ==========\n", header); + int i = 0; + while (data.remaining() > 0) { + if (i != 0 && i % 16 == 0) { + System.err.print("\n"); + } + System.err.format("%02X ", data.get()); + i++; + } + System.err.println(); + data.reset(); + } + +} diff -Nru openjdk-lts-11~28/test/jdk/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java openjdk-lts-11.0.2+9/test/jdk/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java --- openjdk-lts-11~28/test/jdk/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,96 @@ +/* + * 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. + */ + +import java.util.concurrent.TimeUnit; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.sound.sampled.DataLine; +import javax.sound.sampled.LineUnavailableException; + +import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED; + +/** + * @test + * @bug 8207150 + * @summary Clip.isRunning() may return true after Clip.stop() was called + */ +public final class ClipIsRunningAfterStop { + + private static volatile Exception failed; + + public static void main(final String[] args) throws Exception { + final Runnable r = () -> { + try { + test(); + } catch (LineUnavailableException | IllegalArgumentException ignored) { + // the test is not applicable + } catch (Exception ex) { + failed = ex; + } + }; + Thread t1 = new Thread(r); + Thread t2 = new Thread(r); + Thread t3 = new Thread(r); + t1.start(); + t2.start(); + t3.start(); + t1.join(); + t2.join(); + t3.join(); + if (failed != null) { + throw new RuntimeException(failed); + } + } + + private static void test() throws Exception { + // Will run the test no more than 15 seconds + long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); + while (failed == null && endtime - System.nanoTime() > 0) { + Clip clip = createClip(); + clip.loop(Clip.LOOP_CONTINUOUSLY); + clip.stop(); + if (clip.isRunning()) { + if (clip.isRunning()) { + throw new RuntimeException("Clip is running"); + } + } + if (clip.isActive()) { + if (clip.isActive()) { + throw new RuntimeException("Clip is active"); + } + } + clip.close(); + } + } + + private static Clip createClip() throws LineUnavailableException { + AudioFormat format = + new AudioFormat(PCM_SIGNED, 44100, 8, 1, 1, 44100, false); + DataLine.Info info = new DataLine.Info(Clip.class, format); + Clip clip = (Clip) AudioSystem.getLine(info); + clip.open(format, new byte[2], 0, 2); + return clip; + } +} diff -Nru openjdk-lts-11~28/test/jdk/javax/swing/JEditorPane/8195095/ImageViewTest.java openjdk-lts-11.0.2+9/test/jdk/javax/swing/JEditorPane/8195095/ImageViewTest.java --- openjdk-lts-11~28/test/jdk/javax/swing/JEditorPane/8195095/ImageViewTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/swing/JEditorPane/8195095/ImageViewTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -24,7 +24,7 @@ /** * @test * @key headful - * @bug 8195095 8206238 + * @bug 8195095 8206238 8208638 * @summary Tests if Images are scaled correctly in JEditorPane. * @run main ImageViewTest */ @@ -51,8 +51,11 @@ f.add(editorPane); f.setSize(WIDTH + 20, HEIGHT + 40); f.setLocationRelativeTo(null); - f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + //This line will trigger the imageupdate, and consequently, the view + //will be populated with the appropriate color when the pixel color + //is queried by robot. + editorPane.getUI().getPreferredSize(editorPane); f.setVisible(true); }); diff -Nru openjdk-lts-11~28/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java openjdk-lts-11.0.2+9/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java --- openjdk-lts-11~28/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java 2019-01-18 04:23:48.000000000 +0000 @@ -41,7 +41,7 @@ /** * @test - * @bug 8132119 8168992 8169897 + * @bug 8132119 8168992 8169897 8207941 * @author Alexandr Scherbatiy * @summary Provide public API for text related methods in SwingBasicGraphicsUtils2 */ @@ -277,16 +277,35 @@ return comp; } - private static Font getFont() { - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] fontNames = ge.getAvailableFontFamilyNames(); - String fontName = fontNames[0]; + private static String getFontName(String fn, String[] fontNames) { + String fontName = null; for (String name : fontNames) { - if ("Arial".equals(name)) { + if (fn.equals(name)) { fontName = name; break; } } + return fontName; + } + + private static Font getFont() { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + String[] fontNames = ge.getAvailableFontFamilyNames(); + + // We do not have Arial on all systems so provide some reasonable fallbacks. + // In case the fallbacks are not available as well, choose as last fallback + // the first font - however this might be a problematic choice. + String fontName = getFontName("Arial", fontNames); + if (fontName == null) { + fontName = getFontName("Bitstream Charter", fontNames); + if (fontName == null) { + fontName = getFontName("Dialog", fontNames); + if (fontName == null) { + fontName = fontNames[0]; + System.out.println("warning - preferred fonts not on the system, fall back to first font " + fontName); + } + } + } return new Font(fontName, Font.PLAIN, 30); } diff -Nru openjdk-lts-11~28/test/jdk/javax/xml/crypto/dsig/GenerationTests.java openjdk-lts-11.0.2+9/test/jdk/javax/xml/crypto/dsig/GenerationTests.java --- openjdk-lts-11~28/test/jdk/javax/xml/crypto/dsig/GenerationTests.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/javax/xml/crypto/dsig/GenerationTests.java 2019-01-18 04:23:48.000000000 +0000 @@ -24,7 +24,7 @@ /** * @test * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949 - * 8046724 8079693 8177334 + * 8046724 8079693 8177334 8210736 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @modules java.base/sun.security.util * java.base/sun.security.x509 @@ -32,7 +32,7 @@ * jdk.httpserver/com.sun.net.httpserver * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java - * @run main/othervm/timeout=300 GenerationTests + * @run main/othervm/timeout=300 -Dsun.net.httpserver.nodelay=true GenerationTests * @author Sean Mullan */ diff -Nru openjdk-lts-11~28/test/jdk/lib/security/cacerts/VerifyCACerts.java openjdk-lts-11.0.2+9/test/jdk/lib/security/cacerts/VerifyCACerts.java --- openjdk-lts-11~28/test/jdk/lib/security/cacerts/VerifyCACerts.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/lib/security/cacerts/VerifyCACerts.java 2019-01-18 04:23:48.000000000 +0000 @@ -25,7 +25,7 @@ /** * @test * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452 - * 8209506 + * 8209506 8210432 * @summary Check root CA entries in cacerts file */ import java.io.File; @@ -42,7 +42,7 @@ + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 92; + private static final int COUNT = 93; // map of cert alias to SHA-256 fingerprint private static final Map FINGERPRINT_MAP @@ -232,6 +232,8 @@ "BE:C9:49:11:C2:95:56:76:DB:6C:0A:55:09:86:D7:6E:3B:A0:05:66:7C:44:2C:97:62:B4:FB:B7:73:DE:22:8C"); put("globalsignr2ca [jdk]", "CA:42:DD:41:74:5F:D0:B8:1E:B9:02:36:2C:F9:D8:BF:71:9D:A1:BD:1B:1E:FC:94:6F:5B:4C:99:F4:2C:1B:9E"); + put("teliasonerarootcav1 [jdk]", + "DD:69:36:FE:21:F8:F0:77:C1:23:A1:A5:21:C1:22:24:F7:22:55:B7:3E:03:A7:26:06:93:E8:A2:4B:0F:A3:89"); } }; diff -Nru openjdk-lts-11~28/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java openjdk-lts-11.0.2+9/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java --- openjdk-lts-11~28/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java 2019-01-18 04:23:48.000000000 +0000 @@ -142,6 +142,12 @@ } public void buildSignedMultiReleaseJar() throws Exception { + buildSignedMultiReleaseJar("multi-release.jar", "signed-multi-release.jar"); + } + + public void buildSignedMultiReleaseJar(String multiReleaseJar, + String signedMultiReleaseJar) throws Exception + { String testsrc = System.getProperty("test.src","."); String testdir = findTestDir(testsrc); String keystore = testdir + "/sun/security/tools/jarsigner/JarSigning.keystore"; @@ -155,8 +161,8 @@ CertPath cp = CertificateFactory.getInstance("X.509") .generateCertPath(Arrays.asList(ks.getCertificateChain("b"))); JarSigner js = new JarSigner.Builder(pkb, cp).build(); - try (ZipFile in = new ZipFile("multi-release.jar"); - FileOutputStream os = new FileOutputStream("signed-multi-release.jar")) + try (ZipFile in = new ZipFile(multiReleaseJar); + FileOutputStream os = new FileOutputStream(signedMultiReleaseJar)) { js.sign(in, os); } diff -Nru openjdk-lts-11~28/test/jdk/ProblemList.txt openjdk-lts-11.0.2+9/test/jdk/ProblemList.txt --- openjdk-lts-11~28/test/jdk/ProblemList.txt 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/ProblemList.txt 2019-01-18 04:23:48.000000000 +0000 @@ -509,6 +509,8 @@ # jdk_lang java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all +java/lang/ProcessBuilder/PipelineTest.java 8211844 aix-ppc64 +java/lang/ProcessHandle/InfoTest.java 8211847 aix-ppc64 ############################################################################ @@ -562,6 +564,8 @@ java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all +java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64 + ############################################################################ # jdk_nio @@ -570,6 +574,8 @@ java/nio/channels/DatagramChannel/ChangingAddress.java 7141822 macosx-all +java/nio/channels/AsynchronousSocketChannel/StressLoopback.java 8211851 aix-ppc64 + java/nio/channels/Selector/Wakeup.java 6963118 windows-all java/nio/channels/Selector/RacyDeregister.java 8201765 windows-all @@ -578,6 +584,8 @@ java/nio/file/WatchService/LotsOfCancels.java 8188039 solaris-all Solaris 11 java/nio/file/WatchService/LotsOfEvents.java 7158947 solaris-all Solaris 11 +sun/nio/cs/OLD/TestIBMDB.java 8211841 aix-ppc64 + ############################################################################ # jdk_rmi @@ -689,7 +697,6 @@ javax/sound/sampled/DirectAudio/bug6372428.java 8055097 generic-all javax/sound/sampled/Clip/bug5070081.java 8055097 generic-all javax/sound/sampled/DataLine/LongFramePosition.java 8055097 generic-all -javax/sound/sampled/Clip/AutoCloseTimeCheck.java 8207150 generic-all javax/sound/sampled/Clip/Drain/ClipDrain.java 7062792 generic-all @@ -867,6 +874,7 @@ # svc_tools sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all +sun/tools/jhsdb/BasicLauncherTest.java 8211767 linux-ppc64,linux-ppc64le ############################################################################ diff -Nru openjdk-lts-11~28/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java openjdk-lts-11.0.2+9/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java --- openjdk-lts-11~28/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/QuoVadisCA.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -21,29 +21,20 @@ * questions. */ - /* +/* * @test - * @bug 8189131 + * @bug 8189131 8207059 * @summary Interoperability tests with QuoVadis Root CA1, CA2, and CA3 CAs * @build ValidatePathWithParams * @run main/othervm -Djava.security.debug=certpath QuoVadisCA OCSP * @run main/othervm -Djava.security.debug=certpath QuoVadisCA CRL */ - /* +/* * Obtain TLS test artifacts for QuoVadis CAs from: * - * Valid TLS Certificates: - * CA1: https://qvica1g3-v.quovadisglobal.com - * CA2: https://qvsslicag3-v.quovadisglobal.com - * CA2 EV: https://evsslicag3-v.quovadisglobal.com - * CA3: https://qvica3g3-v.quovadisglobal.com + * https://www.quovadisglobal.com/QVRepository/TestCertificates.aspx * - * Revoked TLS Certificates: - * CA1: https://qvica1g3-r.quovadisglobal.com - * CA2: https://qvsslicag3-r.quovadisglobal.com - * CA2 EV: https://evsslicag3-r.quovadisglobal.com - * CA3: https://qvica3g3-r.quovadisglobal.com */ public class QuoVadisCA { @@ -51,423 +42,430 @@ ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); - boolean ocspEnabled = true; - if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { pathValidator.enableCRLCheck(); - ocspEnabled = false; } else { // OCSP check by default pathValidator.enableOCSPCheck(); } - new RootCA1().runTest(pathValidator, ocspEnabled); - new RootCA2().runTest(pathValidator, ocspEnabled); - new RootCA3().runTest(pathValidator, ocspEnabled); + new RootCA1G3().runTest(pathValidator); + new RootCA2G3().runTest(pathValidator); + new RootCA3G3().runTest(pathValidator); } } -class RootCA1 { +class RootCA1G3 { - // Owner: CN=QuoVadis Issuing CA 1 G3, O=QuoVadis Limited, C=BM - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIGFTCCA/2gAwIBAgIUPybG62jqpxKYOV5MlXAGPJYDy9MwDQYJKoZIhvcNAQEL\n" - + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" - + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjExMDYxNjA5NTJaFw0y\n" - + "MjExMDYxNjA5NTJaMEsxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM\n" - + "aW1pdGVkMSEwHwYDVQQDExhRdW9WYWRpcyBJc3N1aW5nIENBIDEgRzMwggIiMA0G\n" - + "CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2Ud42yCfjYm4WlQ+nhTpZ9aPp0r8a\n" - + "yz+kKpPxc8ZWvEi7HDPhr7f5nWnEruHE0HbH8WyFGE+sICF788VpZLbFhL4wbIWV\n" - + "tHIrYan7+yL2yoNbHUBgeWxa48P96WxrW34K/OyQkJoSvY4iNk4BGI0wOYD9wsl9\n" - + "6wIaQFNu25Wsv0CcDSsyNjw8O8Ib6dmS6iib+KnZlKJnYqSTrzbnzf/2CU+Wb9V0\n" - + "yExk7shcfDpqxo9yyyEBPP1GUEb5SSr9qXYP2d4UsrRIgzKpD5feqdjk6ZGA4xeM\n" - + "JHo6GLjddNvVvopaKaLrDzlOXgqgbMIPQu+xkzpKW3IJOylxN55oVuH25MwbS9IL\n" - + "kDMv//kdiTUl1wXERZiUmcBdpWt9D9liyVxe5+HeI5VlhDuHsxDoPFmoOGTa6brX\n" - + "PXlNc0xji+grBQjIRNs43T5+GyYzCyjzG3dSb0BTYGLnfUAEQ1+MCC3K33DKL/me\n" - + "iUrWNclh85BQQigJr5HNLym3+J6Jf0OCnq4VmD1OFrhZrui02Xmz/hOECK2Mciga\n" - + "DxRgXBKjLebV0RW3j6libuPiKbxSinfqNqf2Q9eCfKrzgWQkuCHZvkt0Cqgzjbm1\n" - + "n5xu9zXR8YG5/680Nyb3tywUb6FhA8l1L/KLoK79RGjKgPotCog6Ykvy/667jlyo\n" - + "ZII0YUf6S3uyeQIDAQABo4HzMIHwMBIGA1UdEwEB/wQIMAYBAf8CAQEwEQYDVR0g\n" - + "BAowCDAGBgRVHSAAMDoGCCsGAQUFBwEBBC4wLDAqBggrBgEFBQcwAYYeaHR0cDov\n" - + "L29jc3AucXVvdmFkaXNnbG9iYWwuY29tMA4GA1UdDwEB/wQEAwIBBjAfBgNVHSME\n" - + "GDAWgBSjl9bzXqIQ4atFnzwXZDzuAXCczDA7BgNVHR8ENDAyMDCgLqAshipodHRw\n" - + "Oi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdnJjYTFnMy5jcmwwHQYDVR0OBBYE\n" - + "FF0EGBL7w+p4fbRXCaH+bf6Cn2TNMA0GCSqGSIb3DQEBCwUAA4ICAQAF6qNCo3LP\n" - + "Qk8jthU1aiuo5WW9jQC+PqWeyVe4JjHK+5PRM+BtoErOItfZyPqoIBMedC/Ya9L1\n" - + "Sv0gncvifjtTD3jIBz0FVCbIMJLRp63b4qtmAGuB00XTXgCFcYoiIq5kyNedJnLe\n" - + "IxMqb0xx8IAqvP9kfEVNdGfvYraSswiGXADftZ3yM24zIc3Ysewi3JeTbzDhEGfb\n" - + "yv9eBplkfKfcoKyOds4sLcxj1QpUxcXgjX1mKTbfOSD5ac/Cjrz6Kqnl2+PNrc5N\n" - + "kXBVKhcCAjpqX5OyI86IUg9XY8i7Lz+tXzAQhllh+rPyTyAmieGf2iV9wrl//OZB\n" - + "l2nXwbgfA7QwQ2VdsmGJfW3a7Zc13GCNx0M2RUGJKLMJOavY72d41wAYPQ46AXls\n" - + "Ic7RJi6EWmwLi6lvw4kKFfWZ0c6vIJur1hLUUmLOt0UBZ226eIREVpmFbDGOLzfl\n" - + "gU0xKhqmU0aIOORzBGDfOrnctvaXORNNhCZ78zS96Egzu2w2OC47Zry7k+EOatzA\n" - + "5zrdJJM3UP7aMSNPvEygbcFUw2I04vpxUuPYTwCtogqNMHqFbCjLM9YxhzsGMdh/\n" - + "9aD1krboaSXUjrS9cOr5P2A9kFHCMsXBaDoaijQXNeyhu+oCeYsdv4S3djFwDW3+\n" - + "iPLo51aqZGsTZ1S22vYdkp+QFByLtArVMQ==\n" - + "-----END CERTIFICATE-----"; + // Owner: CN=QuoVadis QVRCA1G3 SSL ICA, O=QuoVadis Limited, C=BM + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIGszCCBJugAwIBAgIUdJ4w/GwP08WekbUIXvYTsQrO+a8wDQYJKoZIhvcNAQEL\n" + + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" + + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xNzA0MTkxNTAzMzZaFw0y\n" + + "NzA0MTkxNTAzMzZaMEwxCzAJBgNVBAYTAkJNMRkwFwYDVQQKDBBRdW9WYWRpcyBM\n" + + "aW1pdGVkMSIwIAYDVQQDDBlRdW9WYWRpcyBRVlJDQTFHMyBTU0wgSUNBMIICIjAN\n" + + "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqVn6XxE+YKKifggi6EPcx7mOOrhA\n" + + "HVxHFsFV/OR/dtQlx2oOTAGPpa8o3ZPVubtNH5QiiMBBiPDW1KqBaU+rmgUeGCj0\n" + + "hWKbdNGRQ5h3rV+4Vhs45BYxQcUzGTZ+oobao8gNo1LuhPIhOQComGOjZtUP0+qQ\n" + + "nXsWJn5004TvCzu7mmt3aTlMeyjSbpoXa3ojwU2BvUzJwcLg0BD49kNXZsM0JLbY\n" + + "QgfEfluWFkb5QzjnE45sBni4LJNfSodhNB+mL/VmETO+0m/A1H6in1rG1n4Ao2G6\n" + + "KYgtk9rXWfF3g7JqwuZUULfI0467h14oG1PzqVcLgZ1B+wrdyiBJJSpRmhf00xSB\n" + + "WM/p93s2xkyQZ2Uh0b0tP90S6spwwpL8PSW3J8x46LaZDEVON/Gm9H891ZgwHLaf\n" + + "3idGX93XHFafve8CrJFMhK2AZElwYaz2H6iJuPftyhR3oQIgLst8l+/2LoqDRyaI\n" + + "6c+tVnk8LcvUgDEPuA70aNthQQ6PWA7iuI2Oies6GEPm7gKVNxIrg6rp2T9RghLm\n" + + "vLnf6Gyn1ONLI7Ib3EyzjE8CJIAtor5KZcs8xm8iPNsDQza+1ugx8D8Zsla64vVw\n" + + "w2W2qNH4orutsAQKRImtbDkEnMb3nGDe0ZPohVyw3Fy+b9g6MX7wQzFjIx3UkzZG\n" + + "QQqGdIh940Qq3wUCAwEAAaOCAY8wggGLMBIGA1UdEwEB/wQIMAYBAf8CAQAwSQYD\n" + + "VR0gBEIwQDA+BgRVHSAAMDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFk\n" + + "aXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUF\n" + + "BzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKG\n" + + "LGh0dHA6Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2ExZzMuY3J0MA4G\n" + + "A1UdDwEB/wQEAwIBBjAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsG\n" + + "AQUFBwMJMB8GA1UdIwQYMBaAFKOX1vNeohDhq0WfPBdkPO4BcJzMMDsGA1UdHwQ0\n" + + "MDIwMKAuoCyGKmh0dHA6Ly9jcmwucXVvdmFkaXNnbG9iYWwuY29tL3F2cmNhMWcz\n" + + "LmNybDAdBgNVHQ4EFgQUIAYNQkuk2dMocCdjvExpRiGBHTwwDQYJKoZIhvcNAQEL\n" + + "BQADggIBAEu/Bea66BZPfGNE4Np+PCRrTag/U7EBK/Yhjmf3mHtFMZzZ94QLH1km\n" + + "4iJ5dPKTR/+1iYYNHfO7fY2Lj/Tg/E+q2SEfA0n6Y/lYHAlbmnaYGGdtfTOjaQgL\n" + + "0Bf0TmLPyc/gf9uKHe230vIaN4QcodBnCmCJOAk/lvIl7b7gRNPN/HuJNQlBohNx\n" + + "ih9VAtLXJ6xO6Xfs5o8ZkZkHb2nG/M1yxySEyU3mqQ5PTgy8kg59szWr2ufT8PvL\n" + + "JuyGNQmT/PHcLp2zaCC0+5Ra65umjhG8IW2haXu8g8aRAgr9ZRPrcgg2npLBA0Qf\n" + + "MTEJPPptGx2GQgE+lMdn5Gff82d3Y35pDmxNTA7hy+4CnWKfmoey7ll8kwGxC+W1\n" + + "OUVgzfdXcpsm+HP2z4E/zw6uB0cAFgMJbxgnm6ZW9+R2yEbD6EOpqR8HqCvhVkkv\n" + + "CdQBNkk432pKD3+L7o6vkwONFOFWVpbXHIxDf9ys8Jr4B8qYWDUnR6jz/HG9aWPV\n" + + "k4vBYYWuahANZCfCKH2B9SqCdK6DjwKihYmallClwsUQnSwW8H7xqmLtAHX0ek7z\n" + + "1Ipj/BNS6c52cPxeAoFbUcVt6+M8xURIJ5qrobTYVaJ8AtfW+3Ml2oqT/EiItXOk\n" + + "W1319hZuAGD5qaG3dg9aLYUqpD948xJVhYVxwIIwvL4G9ZEVyYmE\n" + + "-----END CERTIFICATE-----"; - // Owner: CN=qvica1g3-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // Owner: CN=qvsslrca1g3-ssl-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, // ST=Pembroke, C=BM - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" - + "MIIF9DCCA9ygAwIBAgIUGug3BoLw4/auIdDQ0mHS6QnPHB8wDQYJKoZIhvcNAQEL\n" - + "BQAwSzELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxITAf\n" - + "BgNVBAMTGFF1b1ZhZGlzIElzc3VpbmcgQ0EgMSBHMzAeFw0xNDExMTQxNDA1MDda\n" - + "Fw0xNzExMTQxNDA0NTFaMHYxCzAJBgNVBAYTAkJNMREwDwYDVQQIEwhQZW1icm9r\n" - + "ZTERMA8GA1UEBxMISGFtaWx0b24xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQx\n" - + "JjAkBgNVBAMTHXF2aWNhMWczLXYucXVvdmFkaXNnbG9iYWwuY29tMIIBIjANBgkq\n" - + "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwHoNPHE0C/tEwI5jeYvKJdo5SXSccB/c\n" - + "nCHJVs/4i9F8oRmPqNiFMD99UVylk4nn8iqi8MoxrFAhqtmplPslgRDLwyLMmnGO\n" - + "1cNoPKGMKxQq9EerBgSk4wqeSsSH+7qnZhCamIlvEm0PUaEH8rcjXokTs0fyjadF\n" - + "UmVwcmSZdmnNjseOMgm+G6C8tEPHRQl/Oezy6DzS9PQVLUFCBSyOaAgDnr4EvwGE\n" - + "u2fd3m+ys80XXGq4eLy1MmuC7U+bIQuupuydk/S7kVh7Rl+5nT1eTv0LEOj5gYFc\n" - + "C5SBnhiLibuRTOr+LsC9HpvN4vnoCaOogWxDQj/f1KRn45PNJncsbwIDAQABo4IB\n" - + "ozCCAZ8wdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5x\n" - + "dW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKGLGh0dHA6Ly90cnVzdC5xdW92\n" - + "YWRpc2dsb2JhbC5jb20vcXZpY2ExZzMuY3J0MCgGA1UdEQQhMB+CHXF2aWNhMWcz\n" - + "LXYucXVvdmFkaXNnbG9iYWwuY29tMFEGA1UdIARKMEgwRgYMKwYBBAG+WAACZAEB\n" - + "MDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3Jl\n" - + "cG9zaXRvcnkwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr\n" - + "BgEFBQcDAjAfBgNVHSMEGDAWgBRdBBgS+8PqeH20Vwmh/m3+gp9kzTA7BgNVHR8E\n" - + "NDAyMDCgLqAshipodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmljYTFn\n" - + "My5jcmwwHQYDVR0OBBYEFJO98+S7NZMTz2JRogpUwLuxjTa0MA0GCSqGSIb3DQEB\n" - + "CwUAA4ICAQCq1O/BnzpQjbTbmEob/bWH/p92ZYRV0Lr01CdYkRXl4XKL2ZLusel6\n" - + "126AIvAK51o65wiGVaLGs49AKXOjcaAnTfwoFembqFRlBiGFSOdglTIsZUGdmhtP\n" - + "x1meetkOY8bY79viGkVCufAVq0hAF+AYh4nYM+/n7IijIcM5uhzIDb2Vw8+wKPTB\n" - + "7k2K/e1GGwbqrIAkjrZ6kpRg632RkbR18anaDVOgXuKzmZMRbIAii/N+lo7u3DhC\n" - + "5mJEIjP4cQXd569AfKQzvBO+syGDAJyX5PbTrd59IXZ+EjiisIq/DNQi6QalWMfS\n" - + "BnK97nUzH/BjAofMaUufbB8dxg+RT0QC/Yl1lmlA3CYmr6YWn06DiAuWL14ZFFwh\n" - + "2HQ7juU9oQ1I/HTfhVBoTzuKGCW1ZNXA64IdKlBsYp8NO9xKjBWIxwU/+S/IgoQP\n" - + "aTNkY4Mc353bdLi9082JwaiQ9B5eH0V9pZ17OSRU44o2TeDDT85sjF+krqCnnolR\n" - + "3lk7iqYDRHsvgqJqtkhhX/boF3wJAnKqaZ6j97PVqV75kwAak7XaH7C50RsPQGk2\n" - + "j5OFa6ioobW7tN5PfWAZPMZn98yX2Wh8Z95aGhdsHSJHsrlcUiWa+X2D1kF/dOKd\n" - + "R8rPqdPIPjUglrXS4yP+cJHx6fCJxW7me1R60lpuL6JNvHp54u7GGA==\n" - + "-----END CERTIFICATE-----"; + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIGJzCCBA+gAwIBAgIUGCzNOZhcLiPYbOjRFAp5n04dPNowDQYJKoZIhvcNAQEL\n" + + "BQAwTDELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxIjAg\n" + + "BgNVBAMMGVF1b1ZhZGlzIFFWUkNBMUczIFNTTCBJQ0EwHhcNMTcwNTAyMTcwMDA4\n" + + "WhcNMjAwNTAyMTcxMDAwWjB9MQswCQYDVQQGEwJCTTERMA8GA1UECAwIUGVtYnJv\n" + + "a2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQKDBBRdW9WYWRpcyBMaW1pdGVk\n" + + "MS0wKwYDVQQDDCRxdnNzbHJjYTFnMy1zc2wtdi5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCLgSX0nduUm87/qmfTdofL\n" + + "5P/Xtrly8Z9GaiLPLu1syNqT/Sri4ngYQGXXwF8h6gnHgEb6gDI2p3Q3gb75NthO\n" + + "WfWMD6FqafV47pUeNml6JvNbsYAPc8qGxMPtgQ8HhQuU+Trykx3onq/Se5HRYlve\n" + + "7MMJixiYQKYwwThHh9G1uGYPMQJT2TQfueIAu0MT6Ljc2YB6noXpzTzU63dvmC1Q\n" + + "8TMmFoJYL276lQ3p3vRKEW1nVmjeVoqvK/3Vpg440KbQL5D7Gj/pQPL4d7ljyS/I\n" + + "UN3q7QPS7BojsvF90u0YpvYEuBXsxdFnqivj5owSuSENG4nqcZUO8/nY+4b+NbJd\n" + + "AgMBAAGjggHOMIIByjB6BggrBgEFBQcBAQRuMGwwPgYIKwYBBQUHMAKGMmh0dHA6\n" + + "Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2ExZzNzc2xpY2EuY3J0MCoG\n" + + "CCsGAQUFBzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wHQYDVR0O\n" + + "BBYEFIDk6mMLdh49CFbFiUDnjZhWatYzMB8GA1UdIwQYMBaAFCAGDUJLpNnTKHAn\n" + + "Y7xMaUYhgR08MGkGA1UdIARiMGAwRgYMKwYBBAG+WAABZAEBMDYwNAYIKwYBBQUH\n" + + "AgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwCAYG\n" + + "Z4EMAQICMAwGCisGAQQBvlgBhFgwQQYDVR0fBDowODA2oDSgMoYwaHR0cDovL2Ny\n" + + "bC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2ExZzNzc2xpY2EuY3JsMA4GA1UdDwEB\n" + + "/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwLwYDVR0RBCgw\n" + + "JoIkcXZzc2xyY2ExZzMtc3NsLXYucXVvdmFkaXNnbG9iYWwuY29tMA0GCSqGSIb3\n" + + "DQEBCwUAA4ICAQB2XiV2msE7M8Qp0YIcihD86T8U91PJH7Pb3F/3+8fyX08/oKDo\n" + + "s80sE50tiI5lw+tSFQZuvpOFefejEh1uAwu1slZOlvICHOAJNG1EXPa8pEmDU2i5\n" + + "nd5r7rM757/+cgsPLvwegVuIL4vIYhnoKzPiXpkl8FkNrhRjqeUIAXf2sLjbbbng\n" + + "oYRCypkSovpijPf7Cid19wKh/ipp8DxCNnGMit55mnx7eFNAWpb9cFljd+WaABCA\n" + + "IcvcZhZrLKYrbUErdQzzu0sa3IlEC5QBgz+IvT62RHT+vWRiv0LYhkHVLsDQUHpJ\n" + + "uTa1xi0qvBVGIP1jxIQv5W3hGPLYt7B/8A8v+xOn4m1VWfGIa4V3RGpbBMw19DH+\n" + + "JvLjg8coDWKhqZ150V31Ve8wczSjT+KZHFRWTb4TZt8GSXa56kJV5xadPW8A3EKV\n" + + "kulcspO1njb73ImrwTPIOLnDAsMDrAO41FEob87bdZacpg+kHjiAP9BzpgSSX1x5\n" + + "b/qy2uRtsf3ZlOb1J6fCqb8lRwSU7uGUStUx4tVMpjR5LQfNVroiDEthN5BE6sye\n" + + "zVRq8vyGvG40jSMBZF1KyW4GW6JlgM1THr1egNFhNkHBs7pSTHJp1Ea+QJjB1uVe\n" + + "A8kBL0iUlI5PPOqe5KdEXcFy3L+gRh34gyckC4vrLzfNLjKHQvdRHYnQBA==\n" + + "-----END CERTIFICATE-----"; - // Owner: CN=qvica1g3-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // Owner: CN=qvsslrca1g3-ssl-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, // ST=Pembroke, C=BM - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" - + "MIIF9DCCA9ygAwIBAgIUBAG4l0ZPYhEdLJSMWYCr7LHngvswDQYJKoZIhvcNAQEL\n" - + "BQAwSzELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxITAf\n" - + "BgNVBAMTGFF1b1ZhZGlzIElzc3VpbmcgQ0EgMSBHMzAeFw0xMjExMTQxMzQ4MDda\n" - + "Fw0xNDExMTQxMzQ4MDdaMHYxCzAJBgNVBAYTAkJNMREwDwYDVQQIEwhQZW1icm9r\n" - + "ZTERMA8GA1UEBxMISGFtaWx0b24xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQx\n" - + "JjAkBgNVBAMTHXF2aWNhMWczLXIucXVvdmFkaXNnbG9iYWwuY29tMIIBIjANBgkq\n" - + "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqlof1qJLTiqI7bf0IU7zOxy0HqjIn0pW\n" - + "lNIEVAjQRR1jnfpsMapicIGZfnnNaYpwdsIjGPwpvWXGA+30ezJNGfWMjhb/tiis\n" - + "qjrHdwXAob5MyXOXP5ZS8K34GwKeL45oJZZG0cf2FSta9/CSsRC9wnDUp/kA+VkH\n" - + "n5vlg7VpUExYO0CBXe4C4ehnvCZHjW5nqpVpm993f9i8E0W3vHPxjGuyuqVEEfma\n" - + "WfOV78+HF4hxALnr+73mp0i6Do2oa/v85mZzyKeBm2YHhwdQ6CC7UZtABlHyWuz9\n" - + "h/ocTGbX92rbUaW6icu9bKQkQ9jsomnQkU5b8CWseo2O0NXBevvCowIDAQABo4IB\n" - + "ozCCAZ8wdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5x\n" - + "dW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKGLGh0dHA6Ly90cnVzdC5xdW92\n" - + "YWRpc2dsb2JhbC5jb20vcXZpY2ExZzMuY3J0MCgGA1UdEQQhMB+CHXF2aWNhMWcz\n" - + "LXIucXVvdmFkaXNnbG9iYWwuY29tMFEGA1UdIARKMEgwRgYMKwYBBAG+WAACZAEB\n" - + "MDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3Jl\n" - + "cG9zaXRvcnkwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr\n" - + "BgEFBQcDAjAfBgNVHSMEGDAWgBRdBBgS+8PqeH20Vwmh/m3+gp9kzTA7BgNVHR8E\n" - + "NDAyMDCgLqAshipodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmljYTFn\n" - + "My5jcmwwHQYDVR0OBBYEFNrefqnat67/DMlw0Z/xdQ478leyMA0GCSqGSIb3DQEB\n" - + "CwUAA4ICAQBG1TxJNbWzG4ShZefK4wEdScBzxSB7StYO3mmIP2D3LTlEk+zWjDVP\n" - + "ERPL41Si92asMHvMai7GcFT82XyHxsQGZIPcgIm+rC2NiSPDx2Vd6lkMaO8J9mrU\n" - + "3Z4Ks3G5HmszQ/gXRT3DCoNng+k+JqdZjrvMcsGTH+AzRdoinwOi+QnpphAcZRhS\n" - + "Io8C7w9osUPYFdDaE3Io+oYr2mWJg4n+FGsjxunQgIhLiiNaVF8zHxER7gW0YsCW\n" - + "vw1jX0dmfQZSdo2ybVeHuznUxtUWRHJ/nv6v2B2anUsVEbPyrpQ3i9+BzWaYolPU\n" - + "ZYxfMHBQ7HvncRP6rgrHF4x+iOnIxWsErYdEj5nQJkptYbVl41VzO6xMP7WvXFPa\n" - + "dqxwihqILRmAZrI9p/6k/HqV9xMPKprUhnWDGQ/bYnPKyXoTx6uwamaonX4DpW83\n" - + "b3CJTvBHwKh5eJQoBykAkakPdrmbOhe4/XWnDqQVUgJNmEvkg33AexviJo4mW3HG\n" - + "K2MdM60GRIC3Lcnd+Q8SnSCCxp+YtuE/C3Fu8VI/8vz9MC159GGtDzyC7OeKPCpU\n" - + "7H1X0X/OhBkiv7anK/oIhtSw+4DrM2eaVjdWkEa+di2jvI/2us8TXxO1LL+eeSxT\n" - + "E+LbdNO0jSp8azw2Aw4zL+Q41Fzt7OlH7mTkw1mxLF3aWsUNUz/p4w==\n" - + "-----END CERTIFICATE-----"; + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIGJzCCBA+gAwIBAgIUGeTgdhQ6UoMWie3kBh4IGxDH4AQwDQYJKoZIhvcNAQEL\n" + + "BQAwTDELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxIjAg\n" + + "BgNVBAMMGVF1b1ZhZGlzIFFWUkNBMUczIFNTTCBJQ0EwHhcNMTcwNTAyMTY1OTQ4\n" + + "WhcNMjAwNTAyMTcwOTAwWjB9MQswCQYDVQQGEwJCTTERMA8GA1UECAwIUGVtYnJv\n" + + "a2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQKDBBRdW9WYWRpcyBMaW1pdGVk\n" + + "MS0wKwYDVQQDDCRxdnNzbHJjYTFnMy1zc2wtci5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDR/0pcsSc4mmqVkzCO5h1m\n" + + "BlZ0uxmakNTNnWqeOXmMgl2KBni6MzIdxBkPmII5TI3nc+DXrWrtBCJKRtww3mbF\n" + + "ZoBhrscODv3OjfVqsVfhUPjqLwUEE9X/8IlxFpcsKRH1mC7weLg56kfnHuK2WHPQ\n" + + "dbnVgzzjk8mSi8HL3szIiojGC0ZwilrV/LCXBqETC3aMe8PtGnMW96TcvqQEdYFa\n" + + "4MEXuYnUwXB0WoKAJkHw/MMc0RytrICtlpaMQ7ZnloW8LvoQ1wIM7nWwCr+dieh6\n" + + "lZCWRN/Au+h6qdyDUDUPQFoGpp7AfE2OJmeCY30gp4GdAKtGpTG++gfJrtkc8FnZ\n" + + "AgMBAAGjggHOMIIByjB6BggrBgEFBQcBAQRuMGwwPgYIKwYBBQUHMAKGMmh0dHA6\n" + + "Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2ExZzNzc2xpY2EuY3J0MCoG\n" + + "CCsGAQUFBzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wHQYDVR0O\n" + + "BBYEFGffDkPGAcip01jKnnvEt1jpKNRnMB8GA1UdIwQYMBaAFCAGDUJLpNnTKHAn\n" + + "Y7xMaUYhgR08MGkGA1UdIARiMGAwRgYMKwYBBAG+WAABZAEBMDYwNAYIKwYBBQUH\n" + + "AgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwCAYG\n" + + "Z4EMAQICMAwGCisGAQQBvlgBhFgwQQYDVR0fBDowODA2oDSgMoYwaHR0cDovL2Ny\n" + + "bC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2ExZzNzc2xpY2EuY3JsMA4GA1UdDwEB\n" + + "/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwLwYDVR0RBCgw\n" + + "JoIkcXZzc2xyY2ExZzMtc3NsLXIucXVvdmFkaXNnbG9iYWwuY29tMA0GCSqGSIb3\n" + + "DQEBCwUAA4ICAQBI/zlzisJLwBNaVZkQDMh1gYY8uRUad6Jn7yBFQbJ796VVlD1A\n" + + "yxJD+y9cpwzXvwKau8jIMi96OXo6xtsTDxKY9PzW8DkrlrxqdzLI7s5M30tGu8Sk\n" + + "WitIWPC3FU0oZqa9jBPkfujllR5FNuYikMOFIi2+/3haEK/6kviLpe5WyK4yJ3a9\n" + + "7dLq0If4vhNbKsuW1ROnq5CpPy+iIuZy3CWtq8WJSHDyZzhzrW48QHmTkoAU5lAb\n" + + "3KLMBo/gtUTjABVauADeVZVN6GgLflSIdz1P/aMJQ88q/88w+6KYJlBtg3mWSRHc\n" + + "Vh+BkIiKmfTG+N9SJ5jv7VKt8PjcKgqCzOHUslLHgUDFhJ5gdYIixD24ikRHYriH\n" + + "UCO3ltEppIUm/xgins75F6V9YBxHA1Ks/S5MfMnI6N+fFurIwIsas5w6gTPNwbBC\n" + + "z6G1fu6schk73uvfK4W6PiuMTURsQ1M746K2BlV+FIclTk8jYHe+EyLFgIsgVigo\n" + + "JJs0DsIp0RoGvw+bxxyA9CHeFFi+MlAVEj2+qJnwrD3ZqNFFw87/HDIWW+Ue8ERs\n" + + "HfPDZvEQZ1BHGzD/H04F0+HwwfItxvgiQVC2L/yjmh7St311OLiK8RM3Ur0X15bZ\n" + + "3g4c1gsHx9Gmlk3l8YIOk0yxvLaF03YsNbrfykXHuJM9Phy8Ya3nTpsqtw==\n" + + "-----END CERTIFICATE-----"; - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) + public void runTest(ValidatePathWithParams pathValidator) throws Exception { // Validate valid pathValidator.validate(new String[]{VALID, INT}, ValidatePathWithParams.Status.GOOD, null, System.out); // Validate Revoked - if (ocspEnabled) { - // Revoked certificates are expired in Nov 2014 - // and backdated revocation check is only possible with OCSP - pathValidator.setValidationDate("Jan 01, 2014"); - } - pathValidator.validate(new String[]{REVOKED, INT}, ValidatePathWithParams.Status.REVOKED, - "Thu Jan 03 23:47:34 PST 2013", System.out); - - // reset validation date back to current date - pathValidator.resetValidationDate(); + "Tue May 02 10:15:37 PDT 2017", System.out); } } -class RootCA2 { - - // Owner: CN=QuoVadis Global SSL ICA G3, O=QuoVadis Limited, C=BM - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIGFzCCA/+gAwIBAgIUftbnnMmtgcTIGT75XUQodw40ExcwDQYJKoZIhvcNAQEL\n" - + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" - + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjExMDYxNDUwMThaFw0y\n" - + "MjExMDYxNDUwMThaME0xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM\n" - + "aW1pdGVkMSMwIQYDVQQDExpRdW9WYWRpcyBHbG9iYWwgU1NMIElDQSBHMzCCAiIw\n" - + "DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANf8Od17be6c6lTGJDhEXpmkTs4y\n" - + "Q39Rr5VJyBeWCg06nSS71s6xF3sZvKcV0MbXlXCYM2ZX7cNTbJ81gs7uDsKFp+vK\n" - + "EymiKyEiI2SImOtECNnSg+RVR4np/xz/UlC0yFUisH75cZsJ8T1pkGMfiEouR0EM\n" - + "7O0uFgoboRfUP582TTWy0F7ynSA6YfGKnKj0OFwZJmGHVkLs1VevWjhj3R1fsPan\n" - + "H05P5moePFnpQdj1FofoSxUHZ0c7VB+sUimboHm/uHNY1LOsk77qiSuVC5/yrdg3\n" - + "2EEfP/mxJYT4r/5UiD7VahySzeZHzZ2OibQm2AfgfMN3l57lCM3/WPQBhMAPS1jz\n" - + "kE+7MjajM2f0aZctimW4Hasrj8AQnfAdHqZehbhtXaAlffNEzCdpNK584oCTVR7N\n" - + "UR9iZFx83ruTqpo+GcLP/iSYqhM4g7fy45sNhU+IS+ca03zbxTl3TTlkofXunI5B\n" - + "xxE30eGSQpDZ5+iUJcEOAuVKrlYocFbB3KF45hwcbzPWQ1DcO2jFAapOtQzeS+MZ\n" - + "yZzT2YseJ8hQHKu8YrXZWwKaNfyl8kFkHUBDICowNEoZvBwRCQp8sgqL6YRZy0uD\n" - + "JGxmnC2e0BVKSjcIvmq/CRWH7yiTk9eWm73xrsg9iIyD/kwJEnLyIk8tR5V8p/hc\n" - + "1H2AjDrZH12PsZ45AgMBAAGjgfMwgfAwEgYDVR0TAQH/BAgwBgEB/wIBATARBgNV\n" - + "HSAECjAIMAYGBFUdIAAwOgYIKwYBBQUHAQEELjAsMCoGCCsGAQUFBzABhh5odHRw\n" - + "Oi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wDgYDVR0PAQH/BAQDAgEGMB8GA1Ud\n" - + "IwQYMBaAFO3nb3Zav2DsSVvGpXe7chZxm8Q9MDsGA1UdHwQ0MDIwMKAuoCyGKmh0\n" - + "dHA6Ly9jcmwucXVvdmFkaXNnbG9iYWwuY29tL3F2cmNhMmczLmNybDAdBgNVHQ4E\n" - + "FgQUsxKJtalLNbwVAPCA6dh4h/ETfHYwDQYJKoZIhvcNAQELBQADggIBAFGm1Fqp\n" - + "RMiKr7a6h707M+km36PVXZnX1NZocCn36MrfRvphotbOCDm+GmRkar9ZMGhc8c/A\n" - + "Vn7JSCjwF9jNOFIOUyNLq0w4luk+Pt2YFDbgF8IDdx53xIo8Gv05e9xpTvQYaIto\n" - + "qeHbQjGXfSGc91olfX6JUwZlxxbhdJH+rxTFAg0jcbqToJoScWTfXSr1QRcNbSTs\n" - + "Y4CPG6oULsnhVvrzgldGSK+DxFi2OKcDsOKkV7W4IGg8Do2L/M588AfBnV8ERzpl\n" - + "qgMBBQxC2+0N6RdFHbmZt0HQE/NIg1s0xcjGx1XW3YTOfje31rmAXKHOehm4Bu48\n" - + "gr8gePq5cdQ2W9tA0Dnytb9wzH2SyPPIXRI7yNxaX9H8wYeDeeiKSSmQtfh1v5cV\n" - + "7RXvm8F6hLJkkco/HOW3dAUwZFcKsUH+1eUJKLN18eDGwB8yGawjHvOKqcfg5Lf/\n" - + "TvC7hgcx7pDYaCCaqHaekgUwXbB2Enzqr1fdwoU1c01W5YuQAtAx5wk1bf34Yq/J\n" - + "ph7wNXGvo88N0/EfP9AdVGmJzy7VuRXeVAOyjKAIeADMlwpjBRhcbs9m3dkqvoMb\n" - + "SXKJxv/hFmNgEOvOlaFsXX1dbKg1v+C1AzKAFdiuAIa62JzASiEhigqNSdqdTsOh\n" - + "8W8hdONuKKpe9zKedhBFAvuxhDgKmnySglYc\n" - + "-----END CERTIFICATE-----"; - - // Owner: CN=qvsslicag3-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, - // ST=Pembroke, C=BM - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" - + "MIIF+DCCA+CgAwIBAgIUE3XHqPhbZc2CY3aRtVHRlQwm3tcwDQYJKoZIhvcNAQEL\n" - + "BQAwTTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxIzAh\n" - + "BgNVBAMTGlF1b1ZhZGlzIEdsb2JhbCBTU0wgSUNBIEczMB4XDTE0MTExNDE0MDUz\n" - + "MVoXDTE3MTExNDE0MDUxM1oweDELMAkGA1UEBhMCQk0xETAPBgNVBAgTCFBlbWJy\n" - + "b2tlMREwDwYDVQQHEwhIYW1pbHRvbjEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRl\n" - + "ZDEoMCYGA1UEAxMfcXZzc2xpY2FnMy12LnF1b3ZhZGlzZ2xvYmFsLmNvbTCCASIw\n" - + "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK621GAU2/hywjuxi2Q9rCMncWIY\n" - + "FbDngS69N6+qe9NUktfs/Rlh+jKUDHyf27G79xYGmDGZ0NTYI7tUyOvRanaq8ngd\n" - + "NkZI4DS/Au2vpwuXucrtm3V/XRcsWHAsyevVzfiqfZzu+vU7/2KT/k7sByRzED4x\n" - + "B4tMGaodvzIAzhFAmnmVXSUw7zvU07G/6/mfwYy9gwegJwVby/ZPWXefzHbLGDUz\n" - + "xtO/6Ow9e5T2hedpo3IgfKptkzy0kA501DNaTMulW1gJwB+1duJ9OxZOAVgGCANX\n" - + "IzWvgbONLEdkYGK+K8EAuMaa57WlG0wBZ9Y62iuvgw4XRd90/PS2RAFf/DsCAwEA\n" - + "AaOCAaMwggGfMHMGCCsGAQUFBwEBBGcwZTAqBggrBgEFBQcwAYYeaHR0cDovL29j\n" - + "c3AucXVvdmFkaXNnbG9iYWwuY29tMDcGCCsGAQUFBzAChitodHRwOi8vdHJ1c3Qu\n" - + "cXVvdmFkaXNnbG9iYWwuY29tL3F2c3NsZzMuY3J0MCoGA1UdEQQjMCGCH3F2c3Ns\n" - + "aWNhZzMtdi5xdW92YWRpc2dsb2JhbC5jb20wUQYDVR0gBEowSDBGBgwrBgEEAb5Y\n" - + "AAJkAQEwNjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5xdW92YWRpc2dsb2JhbC5j\n" - + "b20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUH\n" - + "AwEGCCsGAQUFBwMCMB8GA1UdIwQYMBaAFLMSibWpSzW8FQDwgOnYeIfxE3x2MDoG\n" - + "A1UdHwQzMDEwL6AtoCuGKWh0dHA6Ly9jcmwucXVvdmFkaXNnbG9iYWwuY29tL3F2\n" - + "c3NsZzMuY3JsMB0GA1UdDgQWBBSSYP84MQGz6cU/fyXfebv/8zn93TANBgkqhkiG\n" - + "9w0BAQsFAAOCAgEAbqX71QIeoOJ36Aoiwg+oEwdDSRzXkR05kZU2y9qOCArrkgSj\n" - + "ycdIRQFjHYNAWJrPP17PErk6+6NDWiwxLXbeHaY7pFIDCsgcCTWpixVlpVPKKxAE\n" - + "uaomHo5K2AWWkJYNNPSLF411CmyN4eJjYQVrkCfJwFSUrQml8pFDedNDNuTaDsZo\n" - + "klvUDYWM18gFrAbNF4Wi+dvj3qPOpTVyrTk2oBXtVUesNu4JF/O6li10YJ+kdox+\n" - + "DUeq4Gk4B8zoWRTKa9Pp/RALI8TeNcfjBKbPtuXyfly1Cm8AXoQA5sus2SMMPQXE\n" - + "S1+IsdnnKb60pT1EOX571SIBKV16xpRpbC3mDU6IG/+Sjm0TJxwSGbBO5bX69+bq\n" - + "F8Im1QAKqVSYCtoypvieG3iGqHmj4SAaSqdmDDzmOPEtgX63ZmYVs+ey6tN+VThi\n" - + "eaLRs+pHeBLMhh7Npt85c+xqRlIFBp0e84EzST0oE7pjuZcFFWstFXD2Pt1JQfXo\n" - + "9szkw6EMhYbrgNqsh8lxkg8cZKHnP8KGLefyHajp3EIfC2MX7nUOeNmNoCxdsfBW\n" - + "lmzRbv7H7eeAmQYHmxUaRnDMGR6QVX8/NrF1w0hqLkIpDj+29Mvv/Gp2azJrvqrL\n" - + "w2bJ2mPD8rzBDmEFY317RWc8VBd8ZUxO/dYPWqsXNwBTdPMRQpYcN55po3g=\n" - + "-----END CERTIFICATE-----"; +class RootCA2G3 { - // Owner: CN=qvsslicag3-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, - // ST=Pembroke, C=BM - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" - + "MIIF+DCCA+CgAwIBAgIUMJWFWsVjz9o3zQoG9bZ/IsdRWDkwDQYJKoZIhvcNAQEL\n" - + "BQAwTTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxIzAh\n" - + "BgNVBAMTGlF1b1ZhZGlzIEdsb2JhbCBTU0wgSUNBIEczMB4XDTEyMTExNDEzMTI1\n" - + "NFoXDTE0MTExNDEzMTI1NFoweDELMAkGA1UEBhMCQk0xETAPBgNVBAgTCFBlbWJy\n" - + "b2tlMREwDwYDVQQHEwhIYW1pbHRvbjEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRl\n" - + "ZDEoMCYGA1UEAxMfcXZzc2xpY2FnMy1yLnF1b3ZhZGlzZ2xvYmFsLmNvbTCCASIw\n" - + "DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALlwpCyabhrQYeRzEn0O7S505Fv4\n" - + "ScJlJRHskcyZHBt0vt2tsDJNh2xJKJpnXzW14oGh+xrccEGeUw77qeFgfy+LTIHD\n" - + "YDkYVHVhfs4NJD5wdyWL9Fn3A7pMFpapPBPJdsAAwByfzYFjRJsPHMSlGcroyGNm\n" - + "+LquU5r965afaRkWQzZy+lY+OHO19Jis8EfUusYj2fQ3SXB8tBwFylDTnbCoM1HZ\n" - + "BlbksbtLjFYKtyaNeQuoA7NnB3Q9XEONNK9KZ0S87KIqEKjIWK7ThO6lvhMQy2Zk\n" - + "k+UVXVLpop7+Nkz3Fn08pE4OMfLjn1KVnk5l40WGabinfE6hz4vk0XREaKcCAwEA\n" - + "AaOCAaMwggGfMHMGCCsGAQUFBwEBBGcwZTAqBggrBgEFBQcwAYYeaHR0cDovL29j\n" - + "c3AucXVvdmFkaXNnbG9iYWwuY29tMDcGCCsGAQUFBzAChitodHRwOi8vdHJ1c3Qu\n" - + "cXVvdmFkaXNnbG9iYWwuY29tL3F2c3NsZzMuY3J0MCoGA1UdEQQjMCGCH3F2c3Ns\n" - + "aWNhZzMtci5xdW92YWRpc2dsb2JhbC5jb20wUQYDVR0gBEowSDBGBgwrBgEEAb5Y\n" - + "AAJkAQEwNjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5xdW92YWRpc2dsb2JhbC5j\n" - + "b20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUH\n" - + "AwEGCCsGAQUFBwMCMB8GA1UdIwQYMBaAFLMSibWpSzW8FQDwgOnYeIfxE3x2MDoG\n" - + "A1UdHwQzMDEwL6AtoCuGKWh0dHA6Ly9jcmwucXVvdmFkaXNnbG9iYWwuY29tL3F2\n" - + "c3NsZzMuY3JsMB0GA1UdDgQWBBSS2t3Itp/XsAppEeGyH+Ew8vEQ0zANBgkqhkiG\n" - + "9w0BAQsFAAOCAgEAo8MJ2ek95Cs3chn1ecEMdGkUANnCBmgdvQjFt6XVLzYWs37n\n" - + "j6Ac/nGj+Tzb30nTVdE2laRuTeLuGfYmd1AdBLHuRhWYG6A6jnlzqhmDRL3fvRYk\n" - + "wjeWQn6Kx/lOoWC1xOa2EJYOWDr/rUY2PKo9rSVdGKmU6NFI/+FOFLaUD8tU77Qq\n" - + "p9rfOYJwekckA2I2891lTRbnJfQhPD8mQjttd+nS46RwZxxAI5Pr6Jcr+BG3ARP5\n" - + "oM/ifTCLXCc4L/0nozUDSweU17TCuFXWGEpIXbOVmE3kpmHaVe1FRQ0PUr2XHCbJ\n" - + "H1vumQcJmOaUxiB4EzP+M+HnKg6rwhWlfgQEAnCcKkMF5ei1NAaHCwhRMC7ijJFA\n" - + "Wt7s0/PpP2tChU7uXctMk2d36Dpibyn6Rc5a/QJX444ZRFEGrSe4nO/MXt3iEcat\n" - + "fgYHOWoBunLIm7x/fd611xvyhifjqKVCPpqodpwFrXOlCQhXehhRvJSPDXWgDJeR\n" - + "cDLLIcit4Sn1uyebQcZafaxgYPWpaYHFd7dzkO+kTVqOVAm7LukC5QQ9qFY1z7a5\n" - + "IDUAFtEYg/c4XxX+pReOxydnnHeYZBrfRTTxOfMrg6dxsb1QcOeElXHgXRpHyiMh\n" - + "XYsZWE2WHT7of4wMfNzCUrVSN0tCGDRW0MI48RM4BYbRnz3YNKafjnszeXI=\n" - + "-----END CERTIFICATE-----"; + // Owner: CN=QuoVadis EV SSL ICA G3, O=QuoVadis Limited, C=BM + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIGuDCCBKCgAwIBAgIUUk/B8W400XArhKE/sEK7zHw8kDIwDQYJKoZIhvcNAQEL\n" + + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" + + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xNjExMzAxNjIxMDFaFw0y\n" + + "NjExMzAxNjIxMDFaMEkxCzAJBgNVBAYTAkJNMRkwFwYDVQQKDBBRdW9WYWRpcyBM\n" + + "aW1pdGVkMR8wHQYDVQQDDBZRdW9WYWRpcyBFViBTU0wgSUNBIEczMIICIjANBgkq\n" + + "hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAonyczmwRSnw5BhWIrfcD19EbE7bYu5dF\n" + + "tD8o/5NtQCW+XdoLX+X9uNTuvnPw9Hv2RdhYrJgeLgF2wZ52XMGknRdB8tQYrknA\n" + + "l/j0N5f8DD82xP2eBkCpIB0UED4zNVwwWcdWvBUgNEdNobz9vQKb7B5LlbXm9kaO\n" + + "uxYgcv8WsNMivSP3mkJShEOh4RZ3ZdBM/vtJyuvUyEPjyiSzfN94tZHx/H194S4D\n" + + "VAPgE7ny3ISzN+Aa3kjyLebP/sPzI1AY0DWx8Yg4STG1j0PJeuTb6Ago2kmx4Kqn\n" + + "4q4kSPL8CgITYHiKaJx6Dt8Q90ieJ7ywG4Mb/YADOIlmoXZ6kXhzGAxyWXFgolLb\n" + + "4UToIh6U66v3Iyq+gXyCeMXGT4nUgs3+PduzOei9668jeKQaoU5d7LjJUL+ZH2+Y\n" + + "1bPmMAypHFLZryziOzC5kRo4TamgAf3LHHr2C7yIUuo+avlv3cic3NUodcfMi7Ax\n" + + "OQFLb32CtDoDeVb5v3x88R0tIEJTizk6M1B/0pGtZiFfXtrNVfHmEYvY2rOLbgWK\n" + + "M831ykqZSYHUpiqgnaNJb4Qs8WcxqUw1xki64WwiPclUSn5XgGMIwxSDGjUIJHKR\n" + + "rzgQ9lneHOHVb8pXHNFkdBDHTb1KNmDOyLsg3q0LJP6P3nzT/aWDAj3glpJvGQ5d\n" + + "kjAbjx+NFk8CAwEAAaOCAZcwggGTMBIGA1UdEwEB/wQIMAYBAf8CAQAwUQYDVR0g\n" + + "BEowSDBGBgwrBgEEAb5YAAJkAQIwNjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5x\n" + + "dW92YWRpc2dsb2JhbC5jb20vcmVwb3NpdG9yeTB0BggrBgEFBQcBAQRoMGYwKgYI\n" + + "KwYBBQUHMAGGHmh0dHA6Ly9vY3NwLnF1b3ZhZGlzZ2xvYmFsLmNvbTA4BggrBgEF\n" + + "BQcwAoYsaHR0cDovL3RydXN0LnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdnJjYTJnMy5j\n" + + "cnQwDgYDVR0PAQH/BAQDAgEGMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggrBgEFBQcD\n" + + "AgYIKwYBBQUHAwkwHwYDVR0jBBgwFoAU7edvdlq/YOxJW8ald7tyFnGbxD0wOwYD\n" + + "VR0fBDQwMjAwoC6gLIYqaHR0cDovL2NybC5xdW92YWRpc2dsb2JhbC5jb20vcXZy\n" + + "Y2EyZzMuY3JsMB0GA1UdDgQWBBTlhFTQkEmfOLryyeEqCMVOn6BIPzANBgkqhkiG\n" + + "9w0BAQsFAAOCAgEAY/EHWbpNwCgGVQ1B7cIn530n6Rnht8ryN6E4Sis2GG09801s\n" + + "eCVMoGUB1uBCWm7uqQqydjTbjLhuub7hTjSJ1J30SOK1CZbk+c1VP9DcjY46hycy\n" + + "tUKQ2WbgkaY+l/tZNDKu0djc2hA5apljQCmiIzckbcHr6yRnFK7ZPjSPCAUKm20D\n" + + "vORQ7hsIaomsIlqXm5BPssMcxjI48Ezgv/s8ynASI8S5P2vOnBo08sJBM/a0Kbuw\n" + + "351SubTzjxG+o1SHe6lAzvIQMuSwxUca8YkiB19w5YZt+Ss2JXNc6F2jZwpr0hto\n" + + "IXe+N9/x0CohYRRa+IivRGgdDQc3w2P+pffNQP/qdPuUYyMkYWiuHH/YvwXyuDxv\n" + + "yGQfvKmHr1uq/qiqbK1bDSUoEq4Su8yX8YoF9TuxYraIpp9iErO5rarDO6GTNVHh\n" + + "1OXAJ/ePhOWzqo3flLTlAdTcs3Mq97kKW8XWCnu/cjJJglf2zVfLAlv95p56B9If\n" + + "0pXbN74qDkYEC8TdLOwryhcv8yyimh90/AvW9LpB7swkWnUUYNTep/XMX/RLpHLn\n" + + "JOVtnRpn3coVfSR/0rz0XKVXeZGnKztGdIMQhWMTxvZ1UpmRAH2Ab2QnVo1fkPVy\n" + + "qNSJces5Y/VKpIvLBk5Jj55fvK8ME/9ASa+LtLrIms8iYHl75cupuYZZlg8=\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=qvsslrca2g3-ev-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // ST=Pembroke, C=BM, SERIALNUMBER=28474, OID.2.5.4.15=Private Organization, + // OID.1.3.6.1.4.1.311.60.2.1.3=BM + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIH4DCCBcigAwIBAgIUUZsNAKy8C5AlCfpCZWUQY2R6VawwDQYJKoZIhvcNAQEL\n" + + "BQAwSTELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxHzAd\n" + + "BgNVBAMMFlF1b1ZhZGlzIEVWIFNTTCBJQ0EgRzMwHhcNMTcwNDE4MTg1NjEyWhcN\n" + + "MTkwNDE4MTkwNjAwWjCBwDETMBEGCysGAQQBgjc8AgEDEwJCTTEdMBsGA1UEDwwU\n" + + "UHJpdmF0ZSBPcmdhbml6YXRpb24xDjAMBgNVBAUTBTI4NDc0MQswCQYDVQQGEwJC\n" + + "TTERMA8GA1UECAwIUGVtYnJva2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQK\n" + + "DBBRdW9WYWRpcyBMaW1pdGVkMSwwKgYDVQQDDCNxdnNzbHJjYTJnMy1ldi12LnF1\n" + + "b3ZhZGlzZ2xvYmFsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n" + + "ALo9QJVNVNVfG//nZiOPX/j2O8GTVlSAfIMliEj78G0xmPZiQD3n/70KcYlsI7No\n" + + "ilytC8e/m4Mic9PpYfmhAwiUSmb3ba8qjekUgmBFXuQqj3fH6Na+8f5WC9cYpwlc\n" + + "Ew3NuL2WBs86mjM/3GIa61IXrGpRxN6UQJwSxhqlb1QqEGtuwBiy9FJQd0xekCTC\n" + + "GBe2zFT1WhyVSMWlxwkcy1p2LeUmlvnV6FHQYcM9te8UPhgY53O6+u0tnnnsED37\n" + + "UOU3MLev8T++WL7VPOrjgjXydMC9ndXKRttQFIeJ1r+W7rdMLCWkrTzvJ6GtBZZr\n" + + "8jjHNabWPkBslML7oGwvUHMCAwEAAaOCA0YwggNCMHgGCCsGAQUFBwEBBGwwajA5\n" + + "BggrBgEFBQcwAoYtaHR0cDovL3RydXN0LnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmV2\n" + + "c3NsZzMuY3J0MC0GCCsGAQUFBzABhiFodHRwOi8vZXYub2NzcC5xdW92YWRpc2ds\n" + + "b2JhbC5jb20wHQYDVR0OBBYEFLVK7rSs4x+DZrwYaWl2mjhhAtV/MAwGA1UdEwEB\n" + + "/wQCMAAwHwYDVR0jBBgwFoAU5YRU0JBJnzi68snhKgjFTp+gSD8wWgYDVR0gBFMw\n" + + "UTBGBgwrBgEEAb5YAAJkAQIwNjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5xdW92\n" + + "YWRpc2dsb2JhbC5jb20vcmVwb3NpdG9yeTAHBgVngQwBATA8BgNVHR8ENTAzMDGg\n" + + "L6AthitodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmV2c3NsZzMuY3Js\n" + + "MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEw\n" + + "LgYDVR0RBCcwJYIjcXZzc2xyY2EyZzMtZXYtdi5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggF9BgorBgEEAdZ5AgQCBIIBbQSCAWkBZwB2ALvZ37wfinG1k5Qjl6qSe0c4V5UK\n" + + "q1LoGpCWZDaOHtGFAAABW4J1OtsAAAQDAEcwRQIhANABKS1i5uxEm/HMivDJFyNJ\n" + + "gOKRrApqmx3KV0/pWMzqAiAui21HV9lVJ1OT6dEA9mlZAH4NmzklmY9WI978GMYG\n" + + "mgB2AFYUBpov18Ls0/XhvUSyPsdGdrm8mRFcwO+UmFXWidDdAAABW4J1Os0AAAQD\n" + + "AEcwRQIgTWLHrhex17UyIlr0HC9LXNUv0kyOudo7MpxoWFy1xGICIQCHFSoQGwvv\n" + + "zzpQ3JmHSLHy0AQQfWlbV9rFv37F4A7AaAB1AKS5CZC0GFgUh7sTosxncAo8NZgE\n" + + "+RvfuON3zQ7IDdwQAAABW4J1OvYAAAQDAEYwRAIgWLm8u/bcMZt5oXAPIqP9/Qqj\n" + + "Q61VYX+II6RFK+EJCnwCIBrXxQgngqO7X/aaeWnEjfQeSu7WCK9Md3tcqXsn+gMd\n" + + "MA0GCSqGSIb3DQEBCwUAA4ICAQAu0Y29voXdwt/68hwbdj8L50yecl2Z0OkOA31v\n" + + "UhAHgRVhQ+WiAgoeGEgjdntQ5pL7Wtr314gHpG6iR849Zr56WOliA6pfBYDk3qkH\n" + + "UiRgqQBUEV8oRzgp0E+Ebev+p9leM4RPYmUNsP3K4Z/BY24HNOtNKMC3clqKO35K\n" + + "D7B9ObYUb0+IjreKgUyQB7wMgFi7393gXDraVDhDoLrcktAkvkv3Mbt+A3IO5VrO\n" + + "4mQwjrLHzj8nFCmsP4RbCIKFO2QZE8sJYwplKUWOk1ngjpOvObPYpMt5M1kiRvau\n" + + "agkQ+WvnvuMEgAgafHtI4uu0ZNDW1ib0H+xq5X/x2w1RjEElbXCKMbnf3Pdvh9FG\n" + + "mLpkVITXIKzT0Jm+oIs+Vk4ktNEe8hQIzcqimmtlVl2hgMWkmIfRio1+41EY4Din\n" + + "QXBVsbRqftamzSpLbW54ryGJB8dSiGe4P53DOcNKiyie7une95ouZY/1DfQIlVG/\n" + + "9XexhqdGMKp6qUjgd9hOfHrD+mZHeBdIIONOHOhy6ESIUgpSzaAAM7QXZFqlzLzY\n" + + "okRp6cJKDfUmXrk80MopQMhRHJwdxfeZ/A/xAkrWlVPshG+qltSGIZWrNjhQIwk3\n" + + "49zFQCuDS+FrkubRueV+MB8Abp+V1nv5PNbhwfPzGSqwn9XX3vUnsp9uLv+3WlrL\n" + + "Kl1DeA==\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=qvsslrca2g3-ev-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // ST=Pembroke, C=BM, SERIALNUMBER=28474, OID.2.5.4.15=Private Organization, + // OID.1.3.6.1.4.1.311.60.2.1.3=BM + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIH4TCCBcmgAwIBAgIUZTuy16qm4LnioIRmiaQZuThb38gwDQYJKoZIhvcNAQEL\n" + + "BQAwSTELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxHzAd\n" + + "BgNVBAMMFlF1b1ZhZGlzIEVWIFNTTCBJQ0EgRzMwHhcNMTcwNDE4MTg1NjQ0WhcN\n" + + "MTkwNDE4MTkwNjAwWjCBwDETMBEGCysGAQQBgjc8AgEDEwJCTTEdMBsGA1UEDwwU\n" + + "UHJpdmF0ZSBPcmdhbml6YXRpb24xDjAMBgNVBAUTBTI4NDc0MQswCQYDVQQGEwJC\n" + + "TTERMA8GA1UECAwIUGVtYnJva2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQK\n" + + "DBBRdW9WYWRpcyBMaW1pdGVkMSwwKgYDVQQDDCNxdnNzbHJjYTJnMy1ldi1yLnF1\n" + + "b3ZhZGlzZ2xvYmFsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n" + + "ALXMNTuogjC2wpziEXbKztdgzBflORLxoAo5Y8HNAZVo8MgJJucshZ5S6cmRjreY\n" + + "fOlwo85Vu9s39EMRR+I0AZLbxw2PZxNSHUxTCzWlmJ4yValRPRZjz2LXJ+mjpkc3\n" + + "hsVHtCawvPqh2uNwM2qUD6zKfRGdKC27NeICjYe7RtfhLRdrZ8MNtVWMrrFt3Dzd\n" + + "SRJXFcLkN4rPzRFCxldU2yH6V4cZwnVz4XxV/nbljVtGyMJWGVzU0Bhy1fedAJ9x\n" + + "KGJbM6wackOlpUm0XMQdFxHF2tW4Sus6Mcf+2N8FgXk4PnwXarIc/Sj5Tx+Bvf5y\n" + + "TwBOGS02Hzs07ILV3w4dp00CAwEAAaOCA0cwggNDMHgGCCsGAQUFBwEBBGwwajA5\n" + + "BggrBgEFBQcwAoYtaHR0cDovL3RydXN0LnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmV2\n" + + "c3NsZzMuY3J0MC0GCCsGAQUFBzABhiFodHRwOi8vZXYub2NzcC5xdW92YWRpc2ds\n" + + "b2JhbC5jb20wHQYDVR0OBBYEFALFAuUwkAiTXc+DIW861Mu1o/7RMAwGA1UdEwEB\n" + + "/wQCMAAwHwYDVR0jBBgwFoAU5YRU0JBJnzi68snhKgjFTp+gSD8wWgYDVR0gBFMw\n" + + "UTBGBgwrBgEEAb5YAAJkAQIwNjA0BggrBgEFBQcCARYoaHR0cDovL3d3dy5xdW92\n" + + "YWRpc2dsb2JhbC5jb20vcmVwb3NpdG9yeTAHBgVngQwBATA8BgNVHR8ENTAzMDGg\n" + + "L6AthitodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmV2c3NsZzMuY3Js\n" + + "MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEw\n" + + "LgYDVR0RBCcwJYIjcXZzc2xyY2EyZzMtZXYtci5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggF+BgorBgEEAdZ5AgQCBIIBbgSCAWoBaAB2AFYUBpov18Ls0/XhvUSyPsdGdrm8\n" + + "mRFcwO+UmFXWidDdAAABW4J1uUEAAAQDAEcwRQIhAK2LD7cJrN7YYjyBqFDoZva+\n" + + "fae1CiuYyxpREVes1c8OAiBLVt/dGKnvwY2CW2TN3/WyRM7al2sLnM+XwNUGZDrJ\n" + + "pgB2ALvZ37wfinG1k5Qjl6qSe0c4V5UKq1LoGpCWZDaOHtGFAAABW4J1uVQAAAQD\n" + + "AEcwRQIhAIA9IjxIT69JGX+sl1okMiGsXfCOPq5crSX+m04Q7LcgAiBJWUsLDtm9\n" + + "5TKsGZvlJRKOn1CcA94sApQ4v+1D+uz+JQB2AKS5CZC0GFgUh7sTosxncAo8NZgE\n" + + "+RvfuON3zQ7IDdwQAAABW4J1uWwAAAQDAEcwRQIhAIWbEqGnZSIwrI5eWCIzfMRY\n" + + "A+onO3IjQrVAE6ZuGu2bAiAlyoRSfH4s8+lVL225AYD45OkJJfG41T6k+wVLM5Hg\n" + + "ezANBgkqhkiG9w0BAQsFAAOCAgEAPwvRI5GmzR72cDoh+7VPj7PihQDG4HBYq5Ta\n" + + "bF7NK2v9DoaU99vv01K3WBNIydjQX4j+IK8MoGp9dXV+LDUTsebnsY+nr3O4R0pK\n" + + "I2TAazN7zcy3SYc/MtaW7JI+/ckjHaJw+AT+qUz+l20p9shBFlg4QvH2cx2OOCat\n" + + "/CRnG2Nqc5nN1xVcS3aVDrGl36XIcjV+ab+3zicm3OhWqn/hlfBBWimuhix68i/L\n" + + "k+qUyN6A8Bz7NwsouzG7keS17VZbLFkOuczq9KxJLHtlI1OYFNzrLEx6aXeM5VoH\n" + + "mlwETxagSL6fjRvcCaM6As9WVRS08p/RldUrEw+O6r3ob7FaOywwIzSMFV1GbVFG\n" + + "eIrSMuSVwbQRa5Duakoe5vz1vOddrZPm3kqpvyT7j51nuedrjc8YgisuyMbxkf5s\n" + + "8tesqxdltXjFNwpwveYlgHAi3sZvO2dm6bEZcioxLEWEpwmYXrkBJWLhcILdfY99\n" + + "SWFAmwGtmCqh8Sxla77o+gaZkNKf3zBn/34Q91Z96qKgqjXDAGefsZiy4tQeEUJc\n" + + "2qIqjb2rWi5Vo7hn2eolNXzp6ZdanicpecpqwpmW9/v6YRxKLGTsdVz82TGWPnpt\n" + + "q3rCll0NIAfcjekFmRzmBWF1jOn4fCcF/WOxKW1T4JcMIcNoa5iI9M1WcVKQvJKA\n" + + "Zd5LLu4=\n" + + "-----END CERTIFICATE-----"; - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) + public void runTest(ValidatePathWithParams pathValidator) throws Exception { // Validate valid pathValidator.validate(new String[]{VALID, INT}, ValidatePathWithParams.Status.GOOD, null, System.out); // Validate Revoked - if (ocspEnabled) { - // Revoked certificates are expired in Nov 2014 - // and backdated revocation check is only possible with OCSP - pathValidator.setValidationDate("Jan 01, 2014"); - } - pathValidator.validate(new String[]{REVOKED, INT}, ValidatePathWithParams.Status.REVOKED, - "Fri Jan 04 03:49:46 PST 2013", System.out); - - // reset validation date back to current date - pathValidator.resetValidationDate(); + "Tue Apr 18 12:23:14 PDT 2017", System.out); } } -class RootCA3 { +class RootCA3G3 { - // wner: CN=QuoVadis Issuing CA 3 G3, O=QuoVadis Limited, C=BM - private static final String INT = "-----BEGIN CERTIFICATE-----\n" - + "MIIGFTCCA/2gAwIBAgIUHZxbikClihb+1PM2ck0SDEZ8/dIwDQYJKoZIhvcNAQEL\n" - + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" - + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjExMDYxODM5MDVaFw0y\n" - + "MjExMDYxODM5MDVaMEsxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM\n" - + "aW1pdGVkMSEwHwYDVQQDExhRdW9WYWRpcyBJc3N1aW5nIENBIDMgRzMwggIiMA0G\n" - + "CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCs6x3rpBdA1tTXgPYNjL1MKHuoDyb9\n" - + "d4mxxk41t5Cvo3BnS0/cBlRIl91oqu3Iv9goVCMStla+GW9iRdX/53jYM1rXePDa\n" - + "OnE/MJNLcVjmABZmEUtpzxUYLftwGEg1w/Wgi6z68vqZn7vbHJtFV8inlMIsdBVY\n" - + "o3VmU9h+pGZU8JrF8x8U3voX4vm56OBCAM/1osUGXsVL2AY3z2Gjyb1Hv6fqHma7\n" - + "PWrWV1hYS/EAnRUPO8iQqJwrbT/j7Mlo3khULV+T02M+oqs1ckIihl38n1eGvYcp\n" - + "z40cceA2Ej5aglyF9i+ypA4XnxKF3f+6vvEYRPCMQB8Hiwuyy6naj6lPoLZ+nolT\n" - + "t++xSkZ5imAoTXewA9JxyGCdiO9G4sZFIy4jjW7HBmKx6pZy3wWf48eawXPIpjop\n" - + "EC+Kayf3foeyq40CAOjysVkblhUBawvVjAqKJ5aoKD4Ghnv02jdVvI4W7ME/fYYb\n" - + "gm+XD7KJv4gHks+SIV93eXiUhYHvofJ3AG/1kp1p4tvIKCUtm2LCihmp53n9uLGA\n" - + "NvizEnkuQmwlXtqOquKDluwSpHVFPxePMdRICUOnoZBdHv6f3LQCOU7AczRJYh8+\n" - + "WYSKQy675/Itucgd+ABfY1H07F4FisCP75j8YknBdv4nfQsb0RcTg2P89dJNwAhL\n" - + "rpk452WD4LuvsQIDAQABo4HzMIHwMBIGA1UdEwEB/wQIMAYBAf8CAQEwEQYDVR0g\n" - + "BAowCDAGBgRVHSAAMDoGCCsGAQUFBwEBBC4wLDAqBggrBgEFBQcwAYYeaHR0cDov\n" - + "L29jc3AucXVvdmFkaXNnbG9iYWwuY29tMA4GA1UdDwEB/wQEAwIBBjAfBgNVHSME\n" - + "GDAWgBTGF9C8qOoCQ/IbBpldK5Agudec5DA7BgNVHR8ENDAyMDCgLqAshipodHRw\n" - + "Oi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdnJjYTNnMy5jcmwwHQYDVR0OBBYE\n" - + "FBPyQfSNOURHBZ37q8ZaNQwelu9eMA0GCSqGSIb3DQEBCwUAA4ICAQAsbJU89ZB9\n" - + "1XVlOLmw8MaoWwOgI3DwM/g30YyIV1SERtDMKDOUnLVGTORTGv7Y8X789nGkMbKq\n" - + "OEEa9Hty4jwyTnt2OISpCAb4GwBtH+FxNcLkJwZU2qtpTX8zDndofE/JLGo0rte5\n" - + "bKchF2JTg+oby/Wpu2IO0CMd1phou3LLi8sWQGcY/f5vk+MUDnskH6NRXte4m8HW\n" - + "FtYb7nOgLzY5FOJDtQuUFFioNoQzUHuj3SpUjIBxXf4VRFXz+FKIQ4jqzD/SnHG6\n" - + "/7g/28x66LNpYjvaQ0T45EqxqPDCztfJO67GsNLXeSKq+BteqXcnKI77ZkqmwnWl\n" - + "cYt5qek0GBYRYVOM8dUIvDryWHZIEqbeI0DAu06dyPuvIJNQ6WweqxJ+hH++BqGh\n" - + "P4bViNNuP/Lqarb1RP7JiJW3wlyIUDD34JLzkusBgU++ptdYg1o0VnEB8KWDG8Of\n" - + "cABL+TMoUldUp9DFFgFJIfnPX5XjXyG9mw2wwiUvClo93qFvC8+rhEGeZFd29rKi\n" - + "dmmCc8FaCfBV9XdHHx/0ORTQp3HxnRDDiz+MN7p1Y4SXbHE3XXyQAUVTISGpPe3X\n" - + "TUhmoARNmBBPALDm3EAvEBikTUMBFGR63wtu0pjA2cF5nvOyY8mBSsNk0R6+ZJSl\n" - + "Cok3lH5oBM2H+KBk+sNZIBQ8BHcgbwlghg==\n" - + "-----END CERTIFICATE-----"; + // Owner: CN=QuoVadis QVRCA3G3 SSL ICA, O=QuoVadis Limited, C=BM + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIGszCCBJugAwIBAgIURUME8OY/YBHyokbgxoTKpPcoiHYwDQYJKoZIhvcNAQEL\n" + + "BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc\n" + + "BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xNzA0MTkxNDQ4NDBaFw0y\n" + + "NzA0MTkxNDQ4NDBaMEwxCzAJBgNVBAYTAkJNMRkwFwYDVQQKDBBRdW9WYWRpcyBM\n" + + "aW1pdGVkMSIwIAYDVQQDDBlRdW9WYWRpcyBRVlJDQTNHMyBTU0wgSUNBMIICIjAN\n" + + "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt8UIgFvcneWgv29aR2/UV810uW9N\n" + + "VpvdEgQDPHao5+i3IwCH1GrV8KeC25vfJAuW2TJ5gHeN5fmWAtWU8NDaNwGxJq/w\n" + + "jlOe/UW0KSosuuOBltLY9fl+7lDYqBjEwmCGvZMQOzpsbm8QUYTuZmtw96sT5beZ\n" + + "Kwqub/NBDE59IZ+b82obreNFFOgwcHv9E00bfRW7kizNfaC8AiwgV9WfIFgvtb4+\n" + + "YflcgGbdWnmNvwL8aZGWpGYjw/H/0kpwfMgrVF3Q7h8Y0yTg/jj8ZdXLdaE/PQzx\n" + + "8RUU4xJGxply/RrNUEvm9xeXZG3ssLW56WDEhRLkORX/zF4/mVyO2DpGJs06IUSP\n" + + "VWe+JuJGT1UxWqIsDIIHqJNa2BYl6O/XOjE2oGxiCb9w0/kQ8tKWWynFx4XOtrjA\n" + + "pGktsjw66tqE08XWOuoKwAXH2Llwz+VGSMzrCDH98VHtAu/XpEjuW3iP+I7EHksm\n" + + "W2eLdQdvTJ5DBdLsspIG4HC9Ke+c/gCEJHvOURPXoY7j9JPcQLc+5O7kBqiIjEBU\n" + + "NpPX37x7z3msac/IiG/SOYl+kiBESV44QFIOl8sHYmj9HGNlkQz4B/inuGwifIux\n" + + "rfdvm6nrpC7jhd/5Ptk4PO1kcAtgwcB99BnRCw47Xl7hrERTpoRISReNG0JMK7Op\n" + + "wVFqyi7bV1U/l4MCAwEAAaOCAY8wggGLMBIGA1UdEwEB/wQIMAYBAf8CAQAwSQYD\n" + + "VR0gBEIwQDA+BgRVHSAAMDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFk\n" + + "aXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUF\n" + + "BzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKG\n" + + "LGh0dHA6Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2EzZzMuY3J0MA4G\n" + + "A1UdDwEB/wQEAwIBBjAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsG\n" + + "AQUFBwMJMB8GA1UdIwQYMBaAFMYX0Lyo6gJD8hsGmV0rkCC515zkMDsGA1UdHwQ0\n" + + "MDIwMKAuoCyGKmh0dHA6Ly9jcmwucXVvdmFkaXNnbG9iYWwuY29tL3F2cmNhM2cz\n" + + "LmNybDAdBgNVHQ4EFgQUTknx5HQLmDQSOuWxVX3EknK1r6QwDQYJKoZIhvcNAQEL\n" + + "BQADggIBAHfmIJkd+URmnVm0X1/43QXu08RTzUr1zjf4ZBVtzUFoEkfZm+zKlhb7\n" + + "QeYJ5lprX1tdRfHLI+JC7oyI5+7/0q1j2FN2g0oKYN63dIgtppoCNpBu58f69YxL\n" + + "Y3GPSCfgs+ld+HegNSTjQVzelr16aFo9sj1fzUwY4Xj+xEYDjYxFmNGSXY37+DdN\n" + + "3WPm1iahBNNCZGfXq5T4qr6+R6RWwxsaBdQfZh3efGB1WG4DVSQBoiCKjS7Eg+Mf\n" + + "LT+KEZgawLUVrt/sT5lNfw23XA1gxIOcNRBHjsTWbtTBHJeb8hYvXB38UGK4GfIo\n" + + "NxtvRyXgG/U8+OuCQPS2SpJ1VH+yZ4Tn3G4k2+WillxfpqCVgHDVuT8wigw1xUNb\n" + + "0Ft9F3OWftWCVILaYEcyuJrnL3jjcZXc/zG01wIGDFvlPshRifVs/69Xq9UQmMfB\n" + + "GUh6MteDIsN9NdiArcumSC1dNoA/9eESp1pb186lDx9KxRQ/3NJRDMOIsMYN8Lyu\n" + + "cDNzsnymtQyIm3YG7VmZi/6k99n9vT8Ff9PvQ49cdfPl8GIONMdYmhTtLtuC00AU\n" + + "550HVLnpFW8d1NX3+XKxQ5FG04nsTxUD2FtT+trEQouktPq9iFqZN+PLPi8UdrBW\n" + + "AGUDCnO/TNo7IPW6arQrFpYbRLStiOJw7204Mjuqco/1KcqnEiIC\n" + + "-----END CERTIFICATE-----"; - // Owner: CN=qvica3g3-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // Owner: CN=qvsslrca3g3-ssl-v.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, // ST=Pembroke, C=BM - private static final String VALID = "-----BEGIN CERTIFICATE-----\n" - + "MIIF9DCCA9ygAwIBAgIUTkK7g7zoijtiLY/YV9ASX+pEsx0wDQYJKoZIhvcNAQEL\n" - + "BQAwSzELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxITAf\n" - + "BgNVBAMTGFF1b1ZhZGlzIElzc3VpbmcgQ0EgMyBHMzAeFw0xNDExMTQxNDA1NTJa\n" - + "Fw0xNzExMTQxNDA1MzhaMHYxCzAJBgNVBAYTAkJNMREwDwYDVQQIEwhQZW1icm9r\n" - + "ZTERMA8GA1UEBxMISGFtaWx0b24xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQx\n" - + "JjAkBgNVBAMTHXF2aWNhM2czLXYucXVvdmFkaXNnbG9iYWwuY29tMIIBIjANBgkq\n" - + "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAosZjGbZtvAM45zdlTtT+uL12F5nebQrE\n" - + "F9Fb8z1uhRJKgXAfjlfsMIjv7Xc7F80Li39yO0CmWHTMJS41auktW8IGVEkVV2og\n" - + "EL7SKLjtgDJ1I3HAX02hfuOW0b/jkfPEcqTeZVE5Xew/HTAuTJMTqCEHM5hFieWL\n" - + "tADPm7kANu5q6HaFXndKN/k1ozZXQn9YNTpDvvH6oD0Kqn/Peezi+C+6asTMSCk0\n" - + "Xoi2TBHNi9dl2tfb6hu+T5VFwFsC9dGqYt07V8TbvKRAVV0MC8DnXnS89quFVmPS\n" - + "I3ZSKeU4dlp8FzmTrd5nk3y9GL8GTkCsSN3RZbeAbLCpzcG5weS3GQIDAQABo4IB\n" - + "ozCCAZ8wdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5x\n" - + "dW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKGLGh0dHA6Ly90cnVzdC5xdW92\n" - + "YWRpc2dsb2JhbC5jb20vcXZpY2EzZzMuY3J0MCgGA1UdEQQhMB+CHXF2aWNhM2cz\n" - + "LXYucXVvdmFkaXNnbG9iYWwuY29tMFEGA1UdIARKMEgwRgYMKwYBBAG+WAACZAEB\n" - + "MDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3Jl\n" - + "cG9zaXRvcnkwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr\n" - + "BgEFBQcDAjAfBgNVHSMEGDAWgBQT8kH0jTlERwWd+6vGWjUMHpbvXjA7BgNVHR8E\n" - + "NDAyMDCgLqAshipodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmljYTNn\n" - + "My5jcmwwHQYDVR0OBBYEFINCE86z3wESNeL4rz3eiaYA5LIWMA0GCSqGSIb3DQEB\n" - + "CwUAA4ICAQBPe+Y5xDGZLYaVNOxxiyqFZrntGJGGQW1w4GtEfkH9oD8WGs5kBhMM\n" - + "/XPGqw2FzzrvA5GfSdh+EMuXUfJY933AxwPcNfwGHzYGAHIDFsW17y5ZdKfBMN4Y\n" - + "82e13iSfHQrbI0P6l8IIExfCw4HC8PxuEalg6H9fj9/1Q7mzdpwT3uG/HP6Dr2z+\n" - + "PGYFMaH77MsOjfANT8UIdo5SAyXiJI5Y0cyKjuXhR6eJEKwNfri27UaV5cJJuV7I\n" - + "fRcjb0h0Grr6gpKFb7JnhDZVGR3fDHTzuybuCqZk9TYKQ2sn1YfBFDqDpWODpykt\n" - + "vyFO7eugpvSUgdTKRMPCtyppYgo2RwIsMmLrU4wPzdnPi8oo+cM0f5zXrmrkOLY0\n" - + "PZo+K8QT/SrNT+9yZnHupLy01aYGJ4RJ047Wthr7a9S6i6DxbQ+ps4Ajh0X1bvOK\n" - + "KCEKq5aoivYQMLn8pjudiMjbnKU4mgpmZK15D6lLmAprW3L6F8AEBJsK1BunPWhJ\n" - + "nkQUyBnFgq2epmDfZ4f6SztNoLfDbatYNRb2KJfW1lks7UHDjuZ4PM20KkmmFJEE\n" - + "LKR76WJzKi/+aks/csdFD7+/TMXrkY+JWlT4mCoHR1ol0m3DiqApKvRFZkMARfJq\n" - + "npjt2cXyzDnguyQuLrHhdkKW+/LYeNckmVX+cPIxShLbuVhqMgdnWg==\n" - + "-----END CERTIFICATE-----"; + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIGJzCCBA+gAwIBAgIUatc95M2rfpt/opXnck37WXW2RpAwDQYJKoZIhvcNAQEL\n" + + "BQAwTDELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxIjAg\n" + + "BgNVBAMMGVF1b1ZhZGlzIFFWUkNBM0czIFNTTCBJQ0EwHhcNMTcwNTAyMTY1OTAy\n" + + "WhcNMjAwNTAyMTcwOTAwWjB9MQswCQYDVQQGEwJCTTERMA8GA1UECAwIUGVtYnJv\n" + + "a2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQKDBBRdW9WYWRpcyBMaW1pdGVk\n" + + "MS0wKwYDVQQDDCRxdnNzbHJjYTNnMy1zc2wtdi5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+S725uLLelMIYHWuh6fbT\n" + + "lGdi7wf1BlsfQY/ZnLvsFbT1KHodE407RXP0NB6AeEBOlO8xQxaZ5b38aF+HROJw\n" + + "TcvUAgQHmNE+ER0JCMi42jSFC2dc93PhdcUEeesxIfu1iIKXxFmlbJtJxG3l27yJ\n" + + "L4ufum9iQYeZeoGXAr54x6JMY29kl5t9QM018d9sA9bHY+0iVJevM3xgxVe7xApw\n" + + "MSKoZH/OmkX8FaEW9b7TqrWfWcAdD8fkXK8lHCDqmUzSiDGJP16YeQA/4dmFO2vr\n" + + "ItXY8rTPjXoaolebHxf5WG5Qosxv0mPyklUb+SVSJagv66zl/H2Uk0bLyFFmuNAd\n" + + "AgMBAAGjggHOMIIByjB6BggrBgEFBQcBAQRuMGwwPgYIKwYBBQUHMAKGMmh0dHA6\n" + + "Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2EzZzNzc2xpY2EuY3J0MCoG\n" + + "CCsGAQUFBzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wHQYDVR0O\n" + + "BBYEFFhZXE0P1SMuntLc7JYoHTcD8JKfMB8GA1UdIwQYMBaAFE5J8eR0C5g0Ejrl\n" + + "sVV9xJJyta+kMGkGA1UdIARiMGAwRgYMKwYBBAG+WAADZAEBMDYwNAYIKwYBBQUH\n" + + "AgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwCAYG\n" + + "Z4EMAQICMAwGCisGAQQBvlgBhFgwQQYDVR0fBDowODA2oDSgMoYwaHR0cDovL2Ny\n" + + "bC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2EzZzNzc2xpY2EuY3JsMA4GA1UdDwEB\n" + + "/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwLwYDVR0RBCgw\n" + + "JoIkcXZzc2xyY2EzZzMtc3NsLXYucXVvdmFkaXNnbG9iYWwuY29tMA0GCSqGSIb3\n" + + "DQEBCwUAA4ICAQB6QV56jPZzFbFNnKq4xRglTkZSLDMnyrmquWJr4xUWkWIqhQqC\n" + + "s+wAchy39Uuu+Nv99N1AxJhorpdbyIOd7B2NAnUXPeOa1Rm34mh2a/df0gTVrrWJ\n" + + "YSUd3Tv7tcGrMXa7kNaP0N3lTITC0F0fu0rLyCH5I28t4zkCXadcWTqHUKIDNS1h\n" + + "fwx1Y6Dq4fBhKQGpqBq4ThEpBgJdj5aGCNiYfKO/MTDrLxD1BpIjV88O+54cdtYp\n" + + "3K+UDN2lP03PNH4Z/0jF4K43DHpwDM0r6qP4yLqFf3K1NlzGkYgNlMrKUPSlu+M8\n" + + "F6R45TWkcHndk3SUxbtGsxhiLG4xJKY7Zm/0vSxNqia+UJ5wL5s+IoiXhj22RrPe\n" + + "kcx7u3MxB+KWSrtQd8y624J6tqbE7R+aaAX95KTQZoawjypX99P8Kir/NynFHYri\n" + + "RAX9qFU8nYQEAe47oxl0bIr7URiQrlz+FJ/bzJZQwROWY723JPXgv7wUMifCYvJz\n" + + "4pLkuc4KE+LIEqk5LUuoYGEhKhKVu8YnmDifPPrBBADNvAnnGfDZF9FRvIcD6h8H\n" + + "icZBXJHOgu70Rh8Zc77x+v29tKlAJVtswLlV0mVClDUk7U36XL+mAvYntnG9kH5x\n" + + "qQ2Fl7AkUewOd4tLeiN4fl+S+ceW9sOZPSWx5aLui9p2mmxuyxhC5egCzg==\n" + + "-----END CERTIFICATE-----"; - // Owner: CN=qvica3g3-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, + // Owner: CN=qvsslrca3g3-ssl-r.quovadisglobal.com, O=QuoVadis Limited, L=Hamilton, // ST=Pembroke, C=BM - private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" - + "MIIF9DCCA9ygAwIBAgIUSTXTLsMPxg4n9YY6GASBcJsgcaEwDQYJKoZIhvcNAQEL\n" - + "BQAwSzELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxITAf\n" - + "BgNVBAMTGFF1b1ZhZGlzIElzc3VpbmcgQ0EgMyBHMzAeFw0xMjExMTQxMzQ4MTda\n" - + "Fw0xNDExMTQxMzQ4MTdaMHYxCzAJBgNVBAYTAkJNMREwDwYDVQQIEwhQZW1icm9r\n" - + "ZTERMA8GA1UEBxMISGFtaWx0b24xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQx\n" - + "JjAkBgNVBAMTHXF2aWNhM2czLXIucXVvdmFkaXNnbG9iYWwuY29tMIIBIjANBgkq\n" - + "hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtaZUVAvasDtoFhZqL2fH+rI/IKeY0zj7\n" - + "hGuYpLlT32JZX8cmkWUywZt6VxA8A5o82Ay0xT9vHy4MPnmmZExEvmkaECBmOh6+\n" - + "WzWydYGKeeheUERJ1hLj2T7MKz/CCFY6NxD9XzvYOyhDpCUQKCOx4LMn0nMFrXrS\n" - + "6IVirDUmH26dpl3IfsdVXyn6N3wLSNf+UX7in/PXsfD/A6RVtqYsfx4fxFJIPIhv\n" - + "XG/cDOVIyfq6Oo1hthzGm8cnOSjvK/UfQV5iVBK68rqoGG+r9uBG9BfZtd7o0wrf\n" - + "SSJkJAPJVpWTLvnD8RYpJIBz01vNgEOCEgF54bvjhBOjx15mrH7roQIDAQABo4IB\n" - + "ozCCAZ8wdAYIKwYBBQUHAQEEaDBmMCoGCCsGAQUFBzABhh5odHRwOi8vb2NzcC5x\n" - + "dW92YWRpc2dsb2JhbC5jb20wOAYIKwYBBQUHMAKGLGh0dHA6Ly90cnVzdC5xdW92\n" - + "YWRpc2dsb2JhbC5jb20vcXZpY2EzZzMuY3J0MCgGA1UdEQQhMB+CHXF2aWNhM2cz\n" - + "LXIucXVvdmFkaXNnbG9iYWwuY29tMFEGA1UdIARKMEgwRgYMKwYBBAG+WAACZAEB\n" - + "MDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3Jl\n" - + "cG9zaXRvcnkwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggr\n" - + "BgEFBQcDAjAfBgNVHSMEGDAWgBQT8kH0jTlERwWd+6vGWjUMHpbvXjA7BgNVHR8E\n" - + "NDAyMDCgLqAshipodHRwOi8vY3JsLnF1b3ZhZGlzZ2xvYmFsLmNvbS9xdmljYTNn\n" - + "My5jcmwwHQYDVR0OBBYEFLnaKDrPemoRtOZaUReSV5rWp3OoMA0GCSqGSIb3DQEB\n" - + "CwUAA4ICAQA+B+R1TDmE4jC6itHBMPgqRoETJxtTdKyp6/egk5My4MATXRCSrStA\n" - + "gp1c86hljmlN2gq05HKlAz9cC4W80pypJGfEbhYIi9B4Jxdo6zJNJqcFz3zj/otx\n" - + "hvZ2nOO5qqEupAP8aHju0LhUlkcFQlbqaA+IiuQUh0VFQxk8LwkKEA8oIib7wLie\n" - + "P1zBMXeRyDM5CnFWQmIFKXR4+9f51Dfv40Gy2RKQT7I8oXuADhrG9iXFJPXz4yYK\n" - + "LazlDjnn0wv4vB9BmlcVdM2HPYqIPdvWBtPxT9vpNYHnB9Dq/zGqKJNUh8I4jB9k\n" - + "8iQYJgoj62mQW2o1fObkVwrGgglAyzUzUzJfJyy9OEECjLY5o/9TJAKBAnewJ5B9\n" - + "PagYo+klH937s2MOLqzl/uvbjXUBBvql1UU/lb8tSK9xCaXMEDhgiVricr13k32y\n" - + "XmUcA/im96CI5cF5i4xHMnqprzPehFB/Mmi6g2tpiE0bmLkYj7MMJcmtUowa3FqA\n" - + "QHtqKrK8wOfHep6qPx6VMD6Ypaf6yq66/kkSg05i6VO7V371UTibHeVLTr7LPRQJ\n" - + "Emp8k/6qCXOtf5OdXwHBIDqvszf8ry85Rl3q813TntF0pPRvqLEYadC4Bwq7Snf+\n" - + "PR0MPNhuwZBCmxZcyZqhVG2PyvvEmhPxhEdbO5DWUFwUP17WHNlgeQ==\n" - + "-----END CERTIFICATE-----"; + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIGJzCCBA+gAwIBAgIUTgJvLquqZ+Padg/W5Y0bTu9jimswDQYJKoZIhvcNAQEL\n" + + "BQAwTDELMAkGA1UEBhMCQk0xGTAXBgNVBAoMEFF1b1ZhZGlzIExpbWl0ZWQxIjAg\n" + + "BgNVBAMMGVF1b1ZhZGlzIFFWUkNBM0czIFNTTCBJQ0EwHhcNMTcwNTAyMTY1ODQy\n" + + "WhcNMjAwNTAyMTcwODAwWjB9MQswCQYDVQQGEwJCTTERMA8GA1UECAwIUGVtYnJv\n" + + "a2UxETAPBgNVBAcMCEhhbWlsdG9uMRkwFwYDVQQKDBBRdW9WYWRpcyBMaW1pdGVk\n" + + "MS0wKwYDVQQDDCRxdnNzbHJjYTNnMy1zc2wtci5xdW92YWRpc2dsb2JhbC5jb20w\n" + + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCOdbnnY8GsO002xJ6Snu2W\n" + + "snpPmW9ZJ4cEKzdBA4fYKP2V/8ibbOZVH5gI4tSSW+mcMrepS9Jw49sZaKOOGf/7\n" + + "YsjFOp4DQ0+w/7FOj4WrKWBhymDGKI8SsDqoCkxjCYkAc7cutm5Ge67Yto2mvkzW\n" + + "vThV7o9pJ4z2kMg+Q527908zvP1eqT2g+72X1L3o3RSdGM5V35R+lGiBDum8ojZm\n" + + "+QGCGuc6zROgumfYrh11iTNhXJw6KVAS9KJ5GSHzmua/Cu1dwC2SPxp/hRRHlvPp\n" + + "07EjY2oGhfe6Hvsu9YuoQCm95H4HPTmTDUCKURRIGcC8jdrjXBowEuH15vUocSIJ\n" + + "AgMBAAGjggHOMIIByjB6BggrBgEFBQcBAQRuMGwwPgYIKwYBBQUHMAKGMmh0dHA6\n" + + "Ly90cnVzdC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2EzZzNzc2xpY2EuY3J0MCoG\n" + + "CCsGAQUFBzABhh5odHRwOi8vb2NzcC5xdW92YWRpc2dsb2JhbC5jb20wHQYDVR0O\n" + + "BBYEFLzYzgqJRXrnLc5OYHF/koTdbIzeMB8GA1UdIwQYMBaAFE5J8eR0C5g0Ejrl\n" + + "sVV9xJJyta+kMGkGA1UdIARiMGAwRgYMKwYBBAG+WAADZAEBMDYwNAYIKwYBBQUH\n" + + "AgEWKGh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL3JlcG9zaXRvcnkwCAYG\n" + + "Z4EMAQICMAwGCisGAQQBvlgBhFgwQQYDVR0fBDowODA2oDSgMoYwaHR0cDovL2Ny\n" + + "bC5xdW92YWRpc2dsb2JhbC5jb20vcXZyY2EzZzNzc2xpY2EuY3JsMA4GA1UdDwEB\n" + + "/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwLwYDVR0RBCgw\n" + + "JoIkcXZzc2xyY2EzZzMtc3NsLXIucXVvdmFkaXNnbG9iYWwuY29tMA0GCSqGSIb3\n" + + "DQEBCwUAA4ICAQAge+6VZgaEFxN38q0MYKs/QbdGowLd5n2CfQfpdOTRnpOtKQw6\n" + + "Bc/o1O8O/y0XUl1Be7TCgfXKWgw+rKX+ZrI6wCm7MxYlWXV2guWU/AeEl2uv14s/\n" + + "KnKhzZHfb0eQyItfk23flubc7pbh99LaVqozsLCTL78lOB7N7ZQwsNCrEghHWMxl\n" + + "w1/IX/h9XOJoBzu4ulebJoQ3hdIYJY7+lkw64uH1FNrCu7P/jjU9ZlPaobZOUy64\n" + + "sYIt4GsZbMFaUiamNzBUvULw+ZkZq0hTK0cuyA85MXd+3rm5z2AMemC/29XTUYRU\n" + + "L9LkxMF71w8BJzgpVx3s0a6dfi6XtgacP407IhMc3EW1McsSWdT6jL0zidbjXisU\n" + + "vfvuzA50b3HwYz8PsRN0Zfi2R1BubaZQ9fQW2fe1EWgq80CqOdO7eNZeaBxbW/qB\n" + + "smGA1wiHIVEtyHbwZslcKNy8VPKurfKClwZQxf17/oK6QrhOgxiKJGYBUDTa7Ln7\n" + + "Qslp/y3G721NOXzborchs8XB+BYEETtWWkKoWFDiV7vkfyn3x2cYNiv5JCWDszhZ\n" + + "RyVrW26YOQ3MqBAiYqgbU2jMdqeRRfMIFqUvvXwoTvYXuN4Yc2ZAOmCBPpUxo66V\n" + + "zHDu+QK/2/pI1SMLvU3KG526gUtDd67t8JUHqxyo3NsXUCD8tUYpaJy/vg==\n" + + "-----END CERTIFICATE-----"; - public void runTest(ValidatePathWithParams pathValidator, boolean ocspEnabled) + public void runTest(ValidatePathWithParams pathValidator) throws Exception { // Validate valid pathValidator.validate(new String[]{VALID, INT}, ValidatePathWithParams.Status.GOOD, null, System.out); // Validate Revoked - if (ocspEnabled) { - // Revoked certificates are expired in Nov 2014 - // and backdated revocation check is only possible with OCSP - pathValidator.setValidationDate("Jan 01, 2014"); - } - pathValidator.validate(new String[]{REVOKED, INT}, ValidatePathWithParams.Status.REVOKED, - "Thu Jan 03 23:47:02 PST 2013", System.out); - - // reset validation date back to current date - pathValidator.resetValidationDate(); + "Tue May 02 10:15:53 PDT 2017", System.out); } } diff -Nru openjdk-lts-11~28/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java openjdk-lts-11.0.2+9/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java --- openjdk-lts-11~28/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TeliaSoneraCA.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,195 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8210432 + * @summary Interoperability tests with TeliaSonera Root CA v1 + * @build ValidatePathWithParams + * @run main/othervm -Djava.security.debug=certpath TeliaSoneraCA OCSP + * @run main/othervm -Djava.security.debug=certpath TeliaSoneraCA CRL + */ + +/* + * Obtain TLS test artifacts for TeliaSonera Root CA v1 from: + * + * Valid TLS Certificates: + * https://juolukka.cover.sonera.net:10443/ + * + * Revoked TLS Certificates: + * https://juolukka.cover.sonera.net:10444/ + */ +public class TeliaSoneraCA { + + // Owner: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI + // Issuer: CN=TeliaSonera Root CA v1, O=TeliaSonera + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIHHjCCBQagAwIBAgIQTEYq9tv794BPhMF8/qlytjANBgkqhkiG9w0BAQsFADA3\n" + + "MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9v\n" + + "dCBDQSB2MTAeFw0xNDEwMTYwODA5NTdaFw0zMjEwMTYwNTA0MDBaMEYxCzAJBgNV\n" + + "BAYTAkZJMRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEhMB8GA1UEAwwYVGVsaWFTb25l\n" + + "cmEgU2VydmVyIENBIHYyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA\n" + + "rwQN5rfRLbVAiYWLJF9SI4YLm8oqrtf8OjGybgoLyiMIo8nhY/atuGRFWCQNOnUK\n" + + "caZn29C360PlC5yYrsrSHuouROisqHSJcgA7HvV+37Rcry7daeDj6rfyx4yI5dmj\n" + + "LwHkK0j1NzhX1JxFDgPeLNuebgzv/j8OfRhYK/BttpystC4Zgm3gZheKDjYsDS5D\n" + + "gjffuOysP3vewrcuw0EIZFx+HawuwNBLq4tMf4VSitYDHJSLIM2TeXZGGY5slTbT\n" + + "yLnrU5mIzG9WKqxyy7qHuFw1JtlAXkCLmUEVaF9M+dRPiGIjlDrpBgbDD9mT2CSk\n" + + "V/XG1696/voY5xB8KNIC1cOSmSO7kdJyR5tWiDIJiwMXrTwG+kZiqlbcKDsZeJ9p\n" + + "5bZxXO0pEpde3wgEYRvFr5Cx4vcz4h5pom9coJOCW9tqXU43KcueTrt4Ks9f92q1\n" + + "ehjyEnCh0BCdrjUOXsUtFosm9qxJnDwVlThYhS9EHuCTNBgj1Yxj6A+8fwwJP9DN\n" + + "CbWQx5afT+h+9FNDNRC/nEcesP1Yh9s15Se270pQW0CejUNziYG7Dft7T+PVH/fU\n" + + "zaWU8g0tJjtuQgiCWVqw4WkUmYY2S0R89zAotcpz2mvNO8ma2iJbubHi3c0ULfHH\n" + + "nkWKsdpzZmK4N0Wi6/V5yWdmL5RFkFecL8r7+9OtCB0CAwEAAaOCAhUwggIRMIGK\n" + + "BggrBgEFBQcBAQR+MHwwLQYIKwYBBQUHMAGGIWh0dHA6Ly9vY3NwLnRydXN0LnRl\n" + + "bGlhc29uZXJhLmNvbTBLBggrBgEFBQcwAoY/aHR0cDovL3JlcG9zaXRvcnkudHJ1\n" + + "c3QudGVsaWFzb25lcmEuY29tL3RlbGlhc29uZXJhcm9vdGNhdjEuY2VyMBIGA1Ud\n" + + "EwEB/wQIMAYBAf8CAQAwVQYDVR0gBE4wTDBKBgwrBgEEAYIPAgMBAQIwOjA4Bggr\n" + + "BgEFBQcCARYsaHR0cHM6Ly9yZXBvc2l0b3J5LnRydXN0LnRlbGlhc29uZXJhLmNv\n" + + "bS9DUFMwDgYDVR0PAQH/BAQDAgEGMIHGBgNVHR8Egb4wgbswQKA+oDyGOmh0dHA6\n" + + "Ly9jcmwtMy50cnVzdC50ZWxpYXNvbmVyYS5jb20vdGVsaWFzb25lcmFyb290Y2F2\n" + + "MS5jcmwwd6B1oHOGcWxkYXA6Ly9jcmwtMS50cnVzdC50ZWxpYXNvbmVyYS5jb20v\n" + + "Y249VGVsaWFTb25lcmElMjBSb290JTIwQ0ElMjB2MSxvPVRlbGlhU29uZXJhP2Nl\n" + + "cnRpZmljYXRlcmV2b2NhdGlvbmxpc3Q7YmluYXJ5MB0GA1UdDgQWBBQvSTwpT9cH\n" + + "JfnGjNVk9WY9EoMilTAfBgNVHSMEGDAWgBTwj1k4ALP1j5qWDNXr+nuqF+gTEjAN\n" + + "BgkqhkiG9w0BAQsFAAOCAgEAg9EVFW6ioZ2ctrX8KqvW9XPYZR01yNgqlO7pwBWf\n" + + "HzuBCbUdyVzumfQnU24Sce92oMtEfyuxIOmhvoXU7LpnYlH3Q29UGP5dL0D3edGz\n" + + "HeU6Tf8bkcOEHtnTrkd+y+rfFSDWYl9r1y993NAcrBHhroQCE53mlrO7TjXa3zDq\n" + + "6LGR8T8VgvGw0IBz6mzAks0wMYB0b4uREPmWXi+m+RqG3lnpl+eBzz6YVLkxIYMq\n" + + "QIXJIBsu4/ybmadsfdql6E8Lo3dKVD4UG10mtd+iPbJiBiW/a9VbEe3NVKIv4H2y\n" + + "HqYcxDXAeUI66E3K2cjCmKoQaa0Ywt02ikZFd0v1OWNPS7YWbEJWkVR1PcPMESK9\n" + + "6HKI4xhG2tJesmXjQ8q8aSx2u79Zts3ewjKqTmurf6FXW3u9TpSCUe6Drr/3X7Ve\n" + + "nBy4M0sLwCecD/L9gjTa+EItQTYzCkpxiMO49tQdX/BpwgWju4Kg3qkaBNTzvSlk\n" + + "gdnRJqCUkVuzwK4yBqUoyRz3prlhvvRGdZJKf6IXRDhncpey5pm0PQYQ4cArx7Go\n" + + "AaAKz0ZTHOKjnM2KIdUhBJQybL7oPklSfkeMWoUoYED6R4YMTt/JXX4ixEb5DgDJ\n" + + "0F+bNcF7qGrJTkTx0Ccy4BuuY05hJckd72E7WdmjN7DDeosghgWZNV/6D7N5tfxo\n" + + "nlU=\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=juolukka.cover.sonera.net, OU=security, O=Telia Finland Oyj, L=helsinki, C=FI + // Issuer: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIHiDCCBXCgAwIBAgIPAWOq14hk136UDQY3WSjLMA0GCSqGSIb3DQEBCwUAMEYx\n" + + "CzAJBgNVBAYTAkZJMRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEhMB8GA1UEAwwYVGVs\n" + + "aWFTb25lcmEgU2VydmVyIENBIHYyMB4XDTE4MDUyOTA3NDA0MVoXDTE5MDUyOTA3\n" + + "NDA0MVowczELMAkGA1UEBhMCRkkxETAPBgNVBAcMCGhlbHNpbmtpMRowGAYDVQQK\n" + + "DBFUZWxpYSBGaW5sYW5kIE95ajERMA8GA1UECwwIc2VjdXJpdHkxIjAgBgNVBAMM\n" + + "GWp1b2x1a2thLmNvdmVyLnNvbmVyYS5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" + + "DwAwggEKAoIBAQDLks9F8ZUqV9G4jn3fY234OX09Dmqqtuk0qAmjWpF0JAn2o64t\n" + + "whVxFLx9e2IwUPTQgyo6FwRsiT19m99BhgxYnJOxVRwURxSL3mqlV9gX4oFMmT4O\n" + + "EOYEjaJXi8ne1pJX80y2hVQ48XqgODnKdKZVwa5YoeWZQJiaq+C5JkMDN8qzpiyQ\n" + + "X3EfJspLkKy2E+UVxWmfnyf0v70ES9TQ8qgxwvsf7LRZ8Jixq7TTO5VbqWsdBvJC\n" + + "9Zm2aBOYJ7ptSZQ5YDfeUJG2c9S/zFmngoPnTrvAZwUeU3YTrbdZQy899ZOatWac\n" + + "6lHUYU2EagEmbj/jtIvJ6wMbzhleIXRQFWibAgMBAAGjggNEMIIDQDAfBgNVHSME\n" + + "GDAWgBQvSTwpT9cHJfnGjNVk9WY9EoMilTAdBgNVHQ4EFgQUbMozh4osL4gFJvb5\n" + + "baELpQSKEhIwDgYDVR0PAQH/BAQDAgSwME4GA1UdIARHMEUwQwYGZ4EMAQICMDkw\n" + + "NwYIKwYBBQUHAgEWK2h0dHA6Ly9yZXBvc2l0b3J5LnRydXN0LnRlbGlhc29uZXJh\n" + + "LmNvbS9DUFMwJAYDVR0RBB0wG4IZanVvbHVra2EuY292ZXIuc29uZXJhLm5ldDBN\n" + + "BgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLTMudHJ1c3QudGVsaWFzb25lcmEu\n" + + "Y29tL3RlbGlhc29uZXJhc2VydmVyY2F2Mi5jcmwwHQYDVR0lBBYwFAYIKwYBBQUH\n" + + "AwIGCCsGAQUFBwMBMIGGBggrBgEFBQcBAQR6MHgwJwYIKwYBBQUHMAGGG2h0dHA6\n" + + "Ly9vY3NwLnRydXN0LnRlbGlhLmNvbTBNBggrBgEFBQcwAoZBaHR0cDovL3JlcG9z\n" + + "aXRvcnkudHJ1c3QudGVsaWFzb25lcmEuY29tL3RlbGlhc29uZXJhc2VydmVyY2F2\n" + + "Mi5jZXIwggF/BgorBgEEAdZ5AgQCBIIBbwSCAWsBaQB2AG9Tdqwx8DEZ2JkApFEV\n" + + "/3cVHBHZAsEAKQaNsgiaN9kTAAABY6rXpS0AAAQDAEcwRQIgfMLEFYxQcncL3am/\n" + + "W2x7DMZ1+Vh1tDLw/0qIQB40VBQCIQC1eyF8Q6CcQs+gIgzpy7OiZSosSlykyOgW\n" + + "qHkj/0UPygB3AO5Lvbd1zmC64UJpH6vhnmajD35fsHLYgwDEe4l6qP3LAAABY6rX\n" + + "pLEAAAQDAEgwRgIhAJxveFVsFrfttSJIxHsMPAvvevptaV2CxsGwubAi8wDDAiEA\n" + + "jNbbYfUiYtmQ5v4yc6T+GcixztNIlMzQ7OTK+u9zqSoAdgBVgdTCFpA2AUrqC5tX\n" + + "PFPwwOQ4eHAlCBcvo6odBxPTDAAAAWOq16YXAAAEAwBHMEUCIQCCkCL2zn/AoMVI\n" + + "BdsoJelUBLsAnQ+GlIafiyZYcCwhBAIgdsFM05eNmL5hfn3+WtfgmipwcK1qp7kO\n" + + "ONzO69aqrnEwDQYJKoZIhvcNAQELBQADggIBAIl5UWSwCXF85+2lU6t89K7I4TvZ\n" + + "Ggof0NLngea9qxBq00opfnl9i2LPRnsjh9s3iA29i2daTEuJn3qt3Ygcm27Jd7WM\n" + + "5StcxQ483GAaL5s5m2QqkZB8eLfez3tIyCMGCAyixBDNRNPVI4xZr6sSOenWtipo\n" + + "gMt+/gvRIMdMT79IXPFz4W9RWCwnfJNOlfH2OkS3KZYaPSaEvs6sfMW1DDZosrBy\n" + + "6F+DITPLllOVSE4+PTxvXLKVy+srFwF1VocQXKkWMHQ7AfWNnOGzb7B1qg7gsw0n\n" + + "axqinyCjkhMpHpcVtmD9Pi15HLFDIy9yI2S+FHJQfhUSmM/LdCWzQpnee6/Wo+uw\n" + + "p0Jg2v6v9GGaqfpuiVJPFN9dOv3OjMU7DL5lgMRWFRo2T8+wBHXDyBhT0W0y5kRJ\n" + + "eWA7t6CnkziHuaOihZAHUH3nn5exjqUFVS0ThbF6hxN7HAlq/xIbTKlZjkLlc14W\n" + + "fB8vkxJyy/tgBZ4dCj9Y1Y32d4eFT5JZJgqgkN59SmX56BswNXncGrk/vWZFFx+g\n" + + "9dgb8QSe8KseD1iSLc7SsqVDv8NPYdaI3eZ90W8Wv0/CDls321O6UbAmURzQwFGB\n" + + "w8WnteoVBi6Wf6M1TxIfJsXBYeIN0BB6AYc8cmZIOtx2C8aH4JJT45MyFnBv3ac5\n" + + "Ahs9pGn/+K+5yb2e\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=juolukka.cover.sonera.net, OU=Security, O=TeliaSonera Finland, L=Helsinki, C=FI + // Issuer: CN=TeliaSonera Server CA v2, O=TeliaSonera, C=FI + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIGEDCCA/igAwIBAgIRAKWJTjs6v04ZTyb2wJxfnJswDQYJKoZIhvcNAQELBQAw\n" + + "RjELMAkGA1UEBhMCRkkxFDASBgNVBAoMC1RlbGlhU29uZXJhMSEwHwYDVQQDDBhU\n" + + "ZWxpYVNvbmVyYSBTZXJ2ZXIgQ0EgdjIwHhcNMTYxMjIzMDcwMTQ2WhcNMTkxMjIz\n" + + "MDcwMTQ2WjB1MQswCQYDVQQGEwJGSTERMA8GA1UEBwwISGVsc2lua2kxHDAaBgNV\n" + + "BAoME1RlbGlhU29uZXJhIEZpbmxhbmQxETAPBgNVBAsMCFNlY3VyaXR5MSIwIAYD\n" + + "VQQDDBlqdW9sdWtrYS5jb3Zlci5zb25lcmEubmV0MIIBIjANBgkqhkiG9w0BAQEF\n" + + "AAOCAQ8AMIIBCgKCAQEAt2u92TgTFdm1OEfmWFPe+ESBi+2ox4y1EDoin8RydMyO\n" + + "DI6+0HHnKfDZa1YViI5b6MLJKWIAyUszAg5hc0S3upElfSsBvUW6zuQTxMi2vTYE\n" + + "4tcqwIEyCUaiv4wC+DuO5CyGR32yR6HB/W5Ny200dPs2SO03ESEJ+LH4Tw5AI8JJ\n" + + "UZHW+lA+yUHnlc3q47svpbspjt0C/THyukd1hbXTBB0mPXqPux+ClvtZBWUJb7ti\n" + + "1cPfcCNd79KRObzcgxqcOIaUFz4LjjKezhzVSL7tJOANOHZ09qDeOAkk/X9POx4h\n" + + "a5XyWfH1zaQ0QlZ2mKBeHebCIJkgTZZVipagRVOgcwIDAQABo4IByDCCAcQwgY0G\n" + + "CCsGAQUFBwEBBIGAMH4wLQYIKwYBBQUHMAGGIWh0dHA6Ly9vY3NwLnRydXN0LnRl\n" + + "bGlhc29uZXJhLmNvbTBNBggrBgEFBQcwAoZBaHR0cDovL3JlcG9zaXRvcnkudHJ1\n" + + "c3QudGVsaWFzb25lcmEuY29tL3RlbGlhc29uZXJhc2VydmVyY2F2Mi5jZXIwHwYD\n" + + "VR0jBBgwFoAUL0k8KU/XByX5xozVZPVmPRKDIpUwTgYDVR0gBEcwRTBDBgZngQwB\n" + + "AgIwOTA3BggrBgEFBQcCARYraHR0cDovL3JlcG9zaXRvcnkudHJ1c3QudGVsaWFz\n" + + "b25lcmEuY29tL0NQUzBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLTMudHJ1\n" + + "c3QudGVsaWFzb25lcmEuY29tL3RlbGlhc29uZXJhc2VydmVyY2F2Mi5jcmwwHQYD\n" + + "VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMA4GA1UdDwEB/wQEAwIEsDAkBgNV\n" + + "HREEHTAbghlqdW9sdWtrYS5jb3Zlci5zb25lcmEubmV0MB0GA1UdDgQWBBSa+vJH\n" + + "I6Lt9Aqw5ondhoZu4/IJezANBgkqhkiG9w0BAQsFAAOCAgEASRK1l1MZb/IRlyi+\n" + + "XjfZcxJdFuNzW2kpZstW6Ni2XiD3p7aROBfDFtu7GajzZHb6p76auDb4NwJgeE/3\n" + + "6gnXoIK00HwpF2RAhxDpkF8r3q0jSqGhSv/xz9Nx7JBzgqfSw3Ha4ohioIed3uc+\n" + + "nMDyvVenio4GYgtxIIubSybCxMv/lBA/S4daIVCYK3VOoBbM2F36ecAKvRU5vIWM\n" + + "urXsfANL3u4qgJpaM0DclzFsOkVsRPffzToko/Nr6pGXYjt47IzTRlwLMnLehoZW\n" + + "ZZMGMVVOlR7XGf81UjWB6OsKeoQ4FWgcb/rIJcZusm+LqvnsCHuC3gtuC2nGA7lr\n" + + "fseUlG7QZN9/QfUIyvL69wAzeVj1cUcd7GHcAH9DyZJfI8orv4PyUvitDdgISkFu\n" + + "GZ562O7cGmCv00/6I4t0z9wZal8a5lRDoKXAYy+u/adrO1JjLwi11y/DTw9LQ7sJ\n" + + "gVP/v2GsI0ajF9A6z33UHN9uxXZVmQNvOiMkcJiGLovFgu5zxoAg2W3pHjbBbeL8\n" + + "v5MPqgsKafgzaSRtXBBvaISHi9hhRR8v/qSwO3NyLm8uAhQD4x+OPHrmQ/s16j45\n" + + "Ib53UHj1k6byXGUqDgzFBsmEPV6Shf2C4/HcRHpAX8wQx3xVwDtRzDpNUR6vnNfi\n" + + "PwzRU1xsQKd8llmgl4l+fYV0tBA=\n" + + "-----END CERTIFICATE-----"; + + public static void main(String[] args) throws Exception { + + ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); + + if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { + pathValidator.enableCRLCheck(); + } else { + // OCSP check by default + pathValidator.enableOCSPCheck(); + } + + // Validate valid + pathValidator.validate(new String[]{VALID, INT}, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(new String[]{REVOKED, INT}, + ValidatePathWithParams.Status.REVOKED, + "Thu Dec 22 23:14:55 PST 2016", System.out); + + // reset validation date back to current date + pathValidator.resetValidationDate(); + } +} diff -Nru openjdk-lts-11~28/test/jdk/sun/java2d/marlin/ScaleClipTest.java openjdk-lts-11.0.2+9/test/jdk/sun/java2d/marlin/ScaleClipTest.java --- openjdk-lts-11~28/test/jdk/sun/java2d/marlin/ScaleClipTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/java2d/marlin/ScaleClipTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,232 @@ +/* + * 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. + */ + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.geom.Path2D; +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +/** + * Scaled Line Clipping rendering test + * + * @test + * @summary verify that scaled line is properly rendered + * @bug 8210335 + */ +public class ScaleClipTest { + + static final boolean SAVE_IMAGE = false; + static final int SIZE = 50; + + enum SCALE_MODE { + ORTHO, + NON_ORTHO, + COMPLEX + }; + + public static void main(String[] args) { + + // First display which renderer is tested: + // JDK9 only: + System.setProperty("sun.java2d.renderer.verbose", "true"); + + System.out.println("ScaleClipTest: size = " + SIZE); + + final BufferedImage image = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB); + + boolean fail = false; + + // testNegativeScale: + for (SCALE_MODE mode : SCALE_MODE.values()) { + try { + testNegativeScale(image, mode); + } catch (IllegalStateException ise) { + System.err.println("testNegativeScale[" + mode + "] failed:"); + ise.printStackTrace(); + fail = true; + } + } + + // testMarginScale: + for (SCALE_MODE mode : SCALE_MODE.values()) { + try { + testMarginScale(image, mode); + } catch (IllegalStateException ise) { + System.err.println("testMarginScale[" + mode + "] failed:"); + ise.printStackTrace(); + fail = true; + } + } + + // Fail at the end: + if (fail) { + throw new RuntimeException("ScaleClipTest has failures."); + } + } + + private static void testNegativeScale(final BufferedImage image, final SCALE_MODE mode) { + + final Graphics2D g2d = (Graphics2D) image.getGraphics(); + try { + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); + + g2d.setBackground(Color.WHITE); + g2d.clearRect(0, 0, SIZE, SIZE); + + g2d.setColor(Color.BLACK); + + // Bug in TransformingPathConsumer2D.adjustClipScale() + // non ortho scale only + final double scale = -1.0; + + final AffineTransform at; + switch (mode) { + default: + case ORTHO: + at = AffineTransform.getScaleInstance(scale, scale); + break; + case NON_ORTHO: + at = AffineTransform.getScaleInstance(scale, scale + 1e-5); + break; + case COMPLEX: + at = AffineTransform.getScaleInstance(scale, scale); + at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); + break; + } + g2d.setTransform(at); + + // Set cap/join to reduce clip margin: + g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); + + final Path2D p = new Path2D.Double(); + p.moveTo(scale * 10, scale * 10); + p.lineTo(scale * (SIZE - 10), scale * (SIZE - 10)); + + g2d.draw(p); + + if (SAVE_IMAGE) { + try { + final File file = new File("ScaleClipTest-testNegativeScale-" + mode + ".png"); + + System.out.println("Writing file: " + file.getAbsolutePath()); + ImageIO.write(image, "PNG", file); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + + // Check image: + // 25, 25 = black + checkPixel(image.getData(), 25, 25, Color.BLACK.getRGB()); + + } finally { + g2d.dispose(); + } + } + + private static void testMarginScale(final BufferedImage image, final SCALE_MODE mode) { + + final Graphics2D g2d = (Graphics2D) image.getGraphics(); + try { + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); + + g2d.setBackground(Color.WHITE); + g2d.clearRect(0, 0, SIZE, SIZE); + + g2d.setColor(Color.BLACK); + + // Bug in Stroker.init() + // ortho scale only: scale used twice ! + final double scale = 1e-2; + + final AffineTransform at; + switch (mode) { + default: + case ORTHO: + at = AffineTransform.getScaleInstance(scale, scale); + break; + case NON_ORTHO: + at = AffineTransform.getScaleInstance(scale, scale + 1e-5); + break; + case COMPLEX: + at = AffineTransform.getScaleInstance(scale, scale); + at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); + break; + } + g2d.setTransform(at); + + final double invScale = 1.0 / scale; + + // Set cap/join to reduce clip margin: + final float w = (float) (3.0 * invScale); + g2d.setStroke(new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); + + final Path2D p = new Path2D.Double(); + p.moveTo(invScale * -0.5, invScale * 10); + p.lineTo(invScale * -0.5, invScale * (SIZE - 10)); + + g2d.draw(p); + + if (SAVE_IMAGE) { + try { + final File file = new File("ScaleClipTest-testMarginScale-" + mode + ".png"); + + System.out.println("Writing file: " + file.getAbsolutePath()); + ImageIO.write(image, "PNG", file); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + + // Check image: + // 0, 25 = black + checkPixel(image.getData(), 0, 25, Color.BLACK.getRGB()); + } finally { + g2d.dispose(); + } + } + + private static void checkPixel(final Raster raster, + final int x, final int y, + final int expected) { + + final int[] rgb = (int[]) raster.getDataElements(x, y, null); + + if (rgb[0] != expected) { + throw new IllegalStateException("bad pixel at (" + x + ", " + y + + ") = " + rgb[0] + " expected: " + expected); + } + } + +} diff -Nru openjdk-lts-11~28/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java openjdk-lts-11.0.2+9/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java --- openjdk-lts-11~28/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -36,7 +36,7 @@ /* * @test - * @bug 8139587 + * @bug 8139587 8212197 * @modules java.management/sun.management * @summary Check backward compatibility of StackTraceElementCompositeData * @author Jaroslav Bachorik @@ -154,5 +154,16 @@ assertEquals(ste.isNativeMethod(), false); assertEquals(ste.getLineNumber(), 123); } + + @Test + public void testCompositeData() throws Exception { + StackTraceElement ste = new StackTraceElement("app", + "m", "1.0", + "p.MyClass", "myMethod", + "MyClass.java", 123); + CompositeData cd = StackTraceElementCompositeData.toCompositeData(ste); + StackTraceElement ste1 = StackTraceElementCompositeData.from(cd); + assertEquals(ste, ste1); + } } diff -Nru openjdk-lts-11~28/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java openjdk-lts-11.0.2+9/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java --- openjdk-lts-11~28/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/security/ssl/CipherSuite/NoDesRC4CiphSuite.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,346 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8208350 + * @summary Disable all DES cipher suites + * @run main/othervm NoDesRC4CiphSuite + */ + +/* + * SunJSSE does not support dynamic system properties, no way to re-use + * system properties in samevm/agentvm mode. + */ + +import java.security.Security; +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.HandshakeStatus; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.security.GeneralSecurityException; +import java.util.List; +import java.util.ArrayList; +import java.util.Arrays; + +public class NoDesRC4CiphSuite { + + private static final boolean DEBUG = false; + + private static final byte RECTYPE_HS = 0x16; + private static final byte HSMSG_CLIHELLO = 0x01; + + // These are some groups of Cipher Suites by names and IDs + private static final List DES_CS_LIST = Arrays.asList( + 0x0009, 0x0015, 0x0012, 0x001A, 0x0008, 0x0014, 0x0011, 0x0019 + ); + private static final String[] DES_CS_LIST_NAMES = new String[] { + "SSL_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_RSA_WITH_DES_CBC_SHA", + "SSL_DHE_DSS_WITH_DES_CBC_SHA", + "SSL_DH_anon_WITH_DES_CBC_SHA", + "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA" + }; + private static final List RC4_CS_LIST = Arrays.asList( + 0xC007, 0xC011, 0x0005, 0xC002, 0xC00C, 0x0004, 0xC016, 0x0018, + 0x0003, 0x0017 + ); + private static final String[] RC4_CS_LIST_NAMES = new String[] { + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "SSL_RSA_WITH_RC4_128_SHA", + "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDH_RSA_WITH_RC4_128_SHA", + "SSL_RSA_WITH_RC4_128_MD5", + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "SSL_DH_anon_WITH_RC4_128_MD5", + "SSL_RSA_EXPORT_WITH_RC4_40_MD5", + "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5" + }; + + private static final ByteBuffer CLIOUTBUF = + ByteBuffer.wrap("Client Side".getBytes()); + + public static void main(String[] args) throws Exception { + boolean allGood = true; + String disAlg = Security.getProperty("jdk.tls.disabledAlgorithms"); + System.err.println("Disabled Algs: " + disAlg); + + // Disabled DES tests + allGood &= testDefaultCase(DES_CS_LIST); + allGood &= testEngAddDisabled(DES_CS_LIST_NAMES, DES_CS_LIST); + allGood &= testEngOnlyDisabled(DES_CS_LIST_NAMES); + + // Disabled RC4 tests + allGood &= testDefaultCase(RC4_CS_LIST); + allGood &= testEngAddDisabled(RC4_CS_LIST_NAMES, RC4_CS_LIST); + allGood &= testEngOnlyDisabled(RC4_CS_LIST_NAMES); + + if (allGood) { + System.err.println("All tests passed"); + } else { + throw new RuntimeException("One or more tests failed"); + } + } + + /** + * Create an engine with the default set of cipher suites enabled and make + * sure none of the disabled suites are present in the client hello. + * + * @param disabledSuiteIds the {@code List} of disabled cipher suite IDs + * to be checked for. + * + * @return true if the test passed (No disabled suites), false otherwise + */ + private static boolean testDefaultCase(List disabledSuiteIds) + throws Exception { + System.err.println("\nTest: Default SSLEngine suite set"); + SSLEngine ssle = makeEngine(); + if (DEBUG) { + listCiphers("Suite set upon creation", ssle); + } + SSLEngineResult clientResult; + ByteBuffer cTOs = makeClientBuf(ssle); + clientResult = ssle.wrap(CLIOUTBUF, cTOs); + if (DEBUG) { + dumpResult("ClientHello: ", clientResult); + } + cTOs.flip(); + boolean foundSuite = areSuitesPresentCH(cTOs, disabledSuiteIds); + if (foundSuite) { + System.err.println("FAIL: Found disabled suites!"); + return false; + } else { + System.err.println("PASS: No disabled suites found."); + return true; + } + } + + /** + * Create an engine and set only disabled cipher suites. + * The engine should not create the client hello message since the only + * available suites to assert in the client hello are disabled ones. + * + * @param disabledSuiteNames an array of cipher suite names that + * should be disabled cipher suites. + * + * @return true if the engine throws SSLHandshakeException during client + * hello creation, false otherwise. + */ + private static boolean testEngOnlyDisabled(String[] disabledSuiteNames) + throws Exception { + System.err.println( + "\nTest: SSLEngine configured with only disabled suites"); + try { + SSLEngine ssle = makeEngine(); + ssle.setEnabledCipherSuites(disabledSuiteNames); + if (DEBUG) { + listCiphers("Suite set upon creation", ssle); + } + SSLEngineResult clientResult; + ByteBuffer cTOs = makeClientBuf(ssle); + clientResult = ssle.wrap(CLIOUTBUF, cTOs); + if (DEBUG) { + dumpResult("ClientHello: ", clientResult); + } + cTOs.flip(); + } catch (SSLHandshakeException shse) { + System.err.println("PASS: Caught expected exception: " + shse); + return true; + } + System.err.println("FAIL: Expected SSLHandshakeException not thrown"); + return false; + } + + /** + * Create an engine and add some disabled suites to the default + * set of cipher suites. Make sure none of the disabled suites show up + * in the client hello even though they were explicitly added. + * + * @param disabledSuiteNames an array of cipher suite names that + * should be disabled cipher suites. + * @param disabledIds the {@code List} of disabled cipher suite IDs + * to be checked for. + * + * @return true if the test passed (No disabled suites), false otherwise + */ + private static boolean testEngAddDisabled(String[] disabledNames, + List disabledIds) throws Exception { + System.err.println("\nTest: SSLEngine with disabled suites added"); + SSLEngine ssle = makeEngine(); + + // Add disabled suites to the existing engine's set of enabled suites + String[] initialSuites = ssle.getEnabledCipherSuites(); + String[] plusDisSuites = Arrays.copyOf(initialSuites, + initialSuites.length + disabledNames.length); + System.arraycopy(disabledNames, 0, plusDisSuites, + initialSuites.length, disabledNames.length); + ssle.setEnabledCipherSuites(plusDisSuites); + + if (DEBUG) { + listCiphers("Suite set upon creation", ssle); + } + SSLEngineResult clientResult; + ByteBuffer cTOs = makeClientBuf(ssle); + clientResult = ssle.wrap(CLIOUTBUF, cTOs); + if (DEBUG) { + dumpResult("ClientHello: ", clientResult); + } + cTOs.flip(); + boolean foundDisabled = areSuitesPresentCH(cTOs, disabledIds); + if (foundDisabled) { + System.err.println("FAIL: Found disabled suites!"); + return false; + } else { + System.err.println("PASS: No disabled suites found."); + return true; + } + } + + private static SSLEngine makeEngine() throws GeneralSecurityException { + SSLContext ctx = SSLContext.getInstance("TLSv1.2"); + ctx.init(null, null, null); + return ctx.createSSLEngine(); + } + + private static ByteBuffer makeClientBuf(SSLEngine ssle) { + ssle.setUseClientMode(true); + ssle.setNeedClientAuth(false); + SSLSession sess = ssle.getSession(); + ByteBuffer cTOs = ByteBuffer.allocateDirect(sess.getPacketBufferSize()); + return cTOs; + } + + private static void listCiphers(String prefix, SSLEngine ssle) { + System.err.println(prefix + "\n---------------"); + String[] suites = ssle.getEnabledCipherSuites(); + for (String suite : suites) { + System.err.println(suite); + } + System.err.println("---------------"); + } + + /** + * Walk a TLS 1.2 or earlier ClientHello looking for any of the suites + * in the suiteIdList. + * + * @param clientHello a ByteBuffer containing the ClientHello message as + * a complete TLS record. The position of the buffer should be + * at the first byte of the TLS record header. + * @param suiteIdList a List of integer values corresponding to + * TLS cipher suite identifiers. + * + * @return true if at least one of the suites in {@code suiteIdList} + * is found in the ClientHello's cipher suite list + * + * @throws IOException if the data in the {@code clientHello} + * buffer is not a TLS handshake message or is not a client hello. + */ + private static boolean areSuitesPresentCH(ByteBuffer clientHello, + List suiteIdList) throws IOException { + byte val; + + // Process the TLS Record + val = clientHello.get(); + if (val != RECTYPE_HS) { + throw new IOException( + "Not a handshake record, type = " + val); + } + + // Just skip over the version and length + clientHello.position(clientHello.position() + 4); + + // Check the handshake message type + val = clientHello.get(); + if (val != HSMSG_CLIHELLO) { + throw new IOException( + "Not a ClientHello handshake message, type = " + val); + } + + // Skip over the length + clientHello.position(clientHello.position() + 3); + + // Skip over the protocol version (2) and random (32); + clientHello.position(clientHello.position() + 34); + + // Skip past the session ID (variable length <= 32) + int len = Byte.toUnsignedInt(clientHello.get()); + if (len > 32) { + throw new IOException("Session ID is too large, len = " + len); + } + clientHello.position(clientHello.position() + len); + + // Finally, we are at the cipher suites. Walk the list and place them + // into a List. + int csLen = Short.toUnsignedInt(clientHello.getShort()); + if (csLen % 2 != 0) { + throw new IOException("CipherSuite length is invalid, len = " + + csLen); + } + int csCount = csLen / 2; + List csSuiteList = new ArrayList<>(csCount); + log("Found following suite IDs in hello:"); + for (int i = 0; i < csCount; i++) { + int curSuite = Short.toUnsignedInt(clientHello.getShort()); + log(String.format("Suite ID: 0x%04x", curSuite)); + csSuiteList.add(curSuite); + } + + // Now check to see if any of the suites passed in match what is in + // the suite list. + boolean foundMatch = false; + for (Integer cs : suiteIdList) { + if (csSuiteList.contains(cs)) { + System.err.format("Found match for suite ID 0x%04x\n", cs); + foundMatch = true; + break; + } + } + + // We don't care about the rest of the ClientHello message. + // Rewind and return whether we found a match or not. + clientHello.rewind(); + return foundMatch; + } + + private static void dumpResult(String str, SSLEngineResult result) { + System.err.println("The format of the SSLEngineResult is: \n" + + "\t\"getStatus() / getHandshakeStatus()\" +\n" + + "\t\"bytesConsumed() / bytesProduced()\"\n"); + HandshakeStatus hsStatus = result.getHandshakeStatus(); + System.err.println(str + result.getStatus() + "/" + hsStatus + ", " + + result.bytesConsumed() + "/" + result.bytesProduced() + " bytes"); + if (hsStatus == HandshakeStatus.FINISHED) { + System.err.println("\t...ready for application data"); + } + } + + private static void log(String str) { + if (DEBUG) { + System.err.println(str); + } + } +} diff -Nru openjdk-lts-11~28/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedCipherSuites.java openjdk-lts-11.0.2+9/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedCipherSuites.java --- openjdk-lts-11~28/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedCipherSuites.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedCipherSuites.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -31,55 +31,56 @@ * @run main/othervm * CustomizedCipherSuites Default true * TLS_RSA_WITH_AES_128_CBC_SHA - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * @run main/othervm * -Djdk.tls.client.cipherSuites="unknown" * CustomizedCipherSuites Default true * TLS_RSA_WITH_AES_128_CBC_SHA - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * @run main/othervm * -Djdk.tls.client.cipherSuites="" * CustomizedCipherSuites Default true * TLS_RSA_WITH_AES_128_CBC_SHA - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * @run main/othervm - * -Djdk.tls.client.cipherSuites="SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.client.cipherSuites="TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default true - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * TLS_RSA_WITH_AES_128_CBC_SHA * @run main/othervm - * -Djdk.tls.server.cipherSuites="SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.server.cipherSuites="TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default false - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * TLS_RSA_WITH_AES_128_CBC_SHA * @run main/othervm - * -Djdk.tls.client.cipherSuites="TLS_RSA_WITH_AES_128_CBC_SHA,unknown,SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.client.cipherSuites="TLS_RSA_WITH_AES_128_CBC_SHA,unknown,TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default true - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * "" * @run main/othervm - * -Djdk.tls.server.cipherSuites="TLS_RSA_WITH_AES_128_CBC_SHA,unknown,SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.server.cipherSuites="TLS_RSA_WITH_AES_128_CBC_SHA,unknown,TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default false * TLS_RSA_WITH_AES_128_CBC_SHA * "" * @run main/othervm - * -Djdk.tls.server.cipherSuites="SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.server.cipherSuites="TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default true * TLS_RSA_WITH_AES_128_CBC_SHA - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA * @run main/othervm - * -Djdk.tls.client.cipherSuites="SSL_RSA_WITH_DES_CBC_SHA" + * -Djdk.tls.client.cipherSuites="TLS_ECDH_anon_WITH_AES_128_CBC_SHA" * CustomizedCipherSuites Default false * TLS_RSA_WITH_AES_128_CBC_SHA - * SSL_RSA_WITH_DES_CBC_SHA + * TLS_ECDH_anon_WITH_AES_128_CBC_SHA */ +import java.security.Security; import javax.net.ssl.*; /** * Test the customized default cipher suites. * - * This test is based on the behavior that SSL_RSA_WITH_DES_CBC_SHA is + * This test is based on the behavior that TLS_ECDH_anon_WITH_AES_128_CBC_SHA is * disabled by default, and TLS_RSA_WITH_AES_128_CBC_SHA is enabled by * default in JDK. If the behavior is changed in the future, please * update the test cases above accordingly. @@ -90,14 +91,18 @@ private static boolean isClientMode; private static String enabledCipherSuite; - private static String disabledCipherSuite; + private static String notEnabledCipherSuite; public static void main(String[] args) throws Exception { + // reset the security property to make sure the cipher suites + // used in this test are not disabled + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + contextProtocol = trimQuotes(args[0]); isClientMode = Boolean.parseBoolean(args[1]); enabledCipherSuite = trimQuotes(args[2]); - disabledCipherSuite = trimQuotes(args[3]); + notEnabledCipherSuite = trimQuotes(args[3]); // // Create instance of SSLContext with the specified protocol. @@ -206,8 +211,8 @@ isMatch = true; } - if (!disabledCipherSuite.isEmpty() && - cipher.equals(disabledCipherSuite)) { + if (!notEnabledCipherSuite.isEmpty() && + cipher.equals(notEnabledCipherSuite)) { isBroken = true; } } @@ -219,7 +224,7 @@ if (isBroken) { throw new Exception( - "Cipher suite " + disabledCipherSuite + " should be disabled"); + "Cipher suite " + notEnabledCipherSuite + " should not be enabled"); } } @@ -231,7 +236,7 @@ } boolean hasEnabledCipherSuite = enabledCipherSuite.isEmpty(); - boolean hasDisabledCipherSuite = disabledCipherSuite.isEmpty(); + boolean hasNotEnabledCipherSuite = notEnabledCipherSuite.isEmpty(); for (String cipher : ciphers) { System.out.println("\tsupported cipher suite " + cipher); if (!enabledCipherSuite.isEmpty() && @@ -239,9 +244,9 @@ hasEnabledCipherSuite = true; } - if (!disabledCipherSuite.isEmpty() && - cipher.equals(disabledCipherSuite)) { - hasDisabledCipherSuite = true; + if (!notEnabledCipherSuite.isEmpty() && + cipher.equals(notEnabledCipherSuite)) { + hasNotEnabledCipherSuite = true; } } @@ -250,9 +255,9 @@ "Cipher suite " + enabledCipherSuite + " should be supported"); } - if (!hasDisabledCipherSuite) { + if (!hasNotEnabledCipherSuite) { throw new Exception( - "Cipher suite " + disabledCipherSuite + " should be supported"); + "Cipher suite " + notEnabledCipherSuite + " should not be enabled"); } } diff -Nru openjdk-lts-11~28/test/jdk/sun/text/resources/LocaleData openjdk-lts-11.0.2+9/test/jdk/sun/text/resources/LocaleData --- openjdk-lts-11~28/test/jdk/sun/text/resources/LocaleData 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/text/resources/LocaleData 2019-01-18 04:23:48.000000000 +0000 @@ -8315,8 +8315,11 @@ # bug #8187946 CurrencyNames//stn=S\u00e3o Tom\u00e9 and Pr\u00edncipe Dobra CurrencyNames//lak=Lao Kip -CurrencyNames//php=Philippine Piso +CurrencyNames//php=Philippine Peso CurrencyNames//azn=Azerbaijan Manat -# bug $8193552 +# bug #8193552 CurrencyNames//mru=Mauritanian Ouguiya + +# bug #8208746 +CurrencyNames//ves=Venezuelan Bol\u00edvar Soberano diff -Nru openjdk-lts-11~28/test/jdk/sun/text/resources/LocaleDataTest.java openjdk-lts-11.0.2+9/test/jdk/sun/text/resources/LocaleDataTest.java --- openjdk-lts-11~28/test/jdk/sun/text/resources/LocaleDataTest.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/text/resources/LocaleDataTest.java 2019-01-18 04:23:48.000000000 +0000 @@ -38,7 +38,8 @@ * 7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695 * 8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916 * 8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841 8190918 - * 8187946 8195478 8181157 8179071 8193552 8202026 8204269 8202537 + * 8187946 8195478 8181157 8179071 8193552 8202026 8204269 8202537 8208746 + * 8209775 * @summary Verify locale data * @modules java.base/sun.util.resources * @modules jdk.localedata diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/africa openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/africa --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/africa 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/africa 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Africa and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -29,7 +31,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2017-04-09): +# From Paul Eggert (2018-05-27): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -74,13 +76,15 @@ # I vaguely recall 'WAT' also being used for -01 in the past but # cannot now come up with solid citations. # -# I invented the following abbreviations; corrections are welcome! -# +02 WAST West Africa Summer Time (no longer used) -# +03 CAST Central Africa Summer Time (no longer used) -# +03 SAST South Africa Summer Time (no longer used) +# I invented the following abbreviations in the 1990s: +# +02 WAST West Africa Summer Time +# +03 CAST Central Africa Summer Time +# +03 SAST South Africa Summer Time # +03 EAT East Africa Time -# 'EAT' also seems to have caught on; the others are rare but are paired -# with better-attested non-DST abbreviations. +# 'EAT' seems to have caught on and is in current timestamps, and though +# the other abbreviations are rarer and are only in past timestamps, +# they are paired with better-attested non-DST abbreviations. +# Corrections are welcome. # Algeria # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -385,6 +389,13 @@ # Eritrea # Ethiopia # See Africa/Nairobi. +# +# Unfortunately tzdb records only Western clock time in use in Ethiopia, +# as the tzdb format is not up to properly recording a common Ethiopian +# timekeeping practice that is based on solar time. See: +# Mortada D. If you have a meeting in Ethiopia, you'd better double +# check the time. PRI's The World. 2015-01-30 15:15 -05. +# https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time # Gabon # See Africa/Lagos. @@ -856,94 +867,61 @@ # agrees # with the patch. -# From Paul Eggert (2015-06-08): -# For now, guess that later spring and fall transitions will use 2015's rules, -# and guess that Morocco will switch to standard time at 03:00 the last -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after -# Ramadan. To implement this, transition dates for 2016 through 2037 were -# determined by running the following program under GNU Emacs 24.3, with the -# results integrated by hand into the table below. -# (let ((islamic-year 1437)) -# (require 'cal-islam) -# (while (< islamic-year 1460) -# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year))) -# (b (calendar-islamic-to-absolute (list 10 1 islamic-year))) -# (sunday 0)) -# (while (/= sunday (mod (setq a (1- a)) 7))) -# (while (/= sunday (mod b 7)) -# (setq b (1+ b))) -# (setq a (calendar-gregorian-from-absolute a)) -# (setq b (calendar-gregorian-from-absolute b)) -# (insert -# (format -# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n" -# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n") -# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a)) -# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b))))) -# (setq islamic-year (+ 1 islamic-year)))) +# From Mohamed Essedik Najd (2018-10-26): +# Today, a Moroccan government council approved the perpetual addition +# of 60 minutes to the regular Moroccan timezone. +# From Brian Inglis (2018-10-26): +# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S - -Rule Morocco 1939 only - Sep 12 0:00 1:00 S +Rule Morocco 1939 only - Sep 12 0:00 1:00 - Rule Morocco 1939 only - Nov 19 0:00 0 - -Rule Morocco 1940 only - Feb 25 0:00 1:00 S +Rule Morocco 1940 only - Feb 25 0:00 1:00 - Rule Morocco 1945 only - Nov 18 0:00 0 - -Rule Morocco 1950 only - Jun 11 0:00 1:00 S +Rule Morocco 1950 only - Jun 11 0:00 1:00 - Rule Morocco 1950 only - Oct 29 0:00 0 - -Rule Morocco 1967 only - Jun 3 12:00 1:00 S +Rule Morocco 1967 only - Jun 3 12:00 1:00 - Rule Morocco 1967 only - Oct 1 0:00 0 - -Rule Morocco 1974 only - Jun 24 0:00 1:00 S +Rule Morocco 1974 only - Jun 24 0:00 1:00 - Rule Morocco 1974 only - Sep 1 0:00 0 - -Rule Morocco 1976 1977 - May 1 0:00 1:00 S +Rule Morocco 1976 1977 - May 1 0:00 1:00 - Rule Morocco 1976 only - Aug 1 0:00 0 - Rule Morocco 1977 only - Sep 28 0:00 0 - -Rule Morocco 1978 only - Jun 1 0:00 1:00 S +Rule Morocco 1978 only - Jun 1 0:00 1:00 - Rule Morocco 1978 only - Aug 4 0:00 0 - -Rule Morocco 2008 only - Jun 1 0:00 1:00 S +Rule Morocco 2008 only - Jun 1 0:00 1:00 - Rule Morocco 2008 only - Sep 1 0:00 0 - -Rule Morocco 2009 only - Jun 1 0:00 1:00 S +Rule Morocco 2009 only - Jun 1 0:00 1:00 - Rule Morocco 2009 only - Aug 21 0:00 0 - -Rule Morocco 2010 only - May 2 0:00 1:00 S +Rule Morocco 2010 only - May 2 0:00 1:00 - Rule Morocco 2010 only - Aug 8 0:00 0 - -Rule Morocco 2011 only - Apr 3 0:00 1:00 S +Rule Morocco 2011 only - Apr 3 0:00 1:00 - Rule Morocco 2011 only - Jul 31 0:00 0 - -Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S +Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 - Rule Morocco 2012 only - Jul 20 3:00 0 - -Rule Morocco 2012 only - Aug 20 2:00 1:00 S +Rule Morocco 2012 only - Aug 20 2:00 1:00 - Rule Morocco 2012 only - Sep 30 3:00 0 - Rule Morocco 2013 only - Jul 7 3:00 0 - -Rule Morocco 2013 only - Aug 10 2:00 1:00 S -Rule Morocco 2013 max - Oct lastSun 3:00 0 - -Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S +Rule Morocco 2013 only - Aug 10 2:00 1:00 - +Rule Morocco 2013 2018 - Oct lastSun 3:00 0 - +Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 - Rule Morocco 2014 only - Jun 28 3:00 0 - -Rule Morocco 2014 only - Aug 2 2:00 1:00 S +Rule Morocco 2014 only - Aug 2 2:00 1:00 - Rule Morocco 2015 only - Jun 14 3:00 0 - -Rule Morocco 2015 only - Jul 19 2:00 1:00 S +Rule Morocco 2015 only - Jul 19 2:00 1:00 - Rule Morocco 2016 only - Jun 5 3:00 0 - -Rule Morocco 2016 only - Jul 10 2:00 1:00 S +Rule Morocco 2016 only - Jul 10 2:00 1:00 - Rule Morocco 2017 only - May 21 3:00 0 - -Rule Morocco 2017 only - Jul 2 2:00 1:00 S +Rule Morocco 2017 only - Jul 2 2:00 1:00 - Rule Morocco 2018 only - May 13 3:00 0 - -Rule Morocco 2018 only - Jun 17 2:00 1:00 S -Rule Morocco 2019 only - May 5 3:00 0 - -Rule Morocco 2019 only - Jun 9 2:00 1:00 S -Rule Morocco 2020 only - Apr 19 3:00 0 - -Rule Morocco 2020 only - May 24 2:00 1:00 S -Rule Morocco 2021 only - Apr 11 3:00 0 - -Rule Morocco 2021 only - May 16 2:00 1:00 S -Rule Morocco 2022 only - May 8 2:00 1:00 S -Rule Morocco 2023 only - Apr 23 2:00 1:00 S -Rule Morocco 2024 only - Apr 14 2:00 1:00 S -Rule Morocco 2025 only - Apr 6 2:00 1:00 S -Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S -Rule Morocco 2036 only - Oct 19 3:00 0 - -Rule Morocco 2037 only - Oct 4 3:00 0 - +Rule Morocco 2018 only - Jun 17 2:00 1:00 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco WE%sT 1984 Mar 16 - 1:00 - CET 1986 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 1984 Mar 16 + 1:00 - +01 1986 + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Western Sahara # @@ -958,7 +936,8 @@ Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún -1:00 - -01 1976 Apr 14 - 0:00 Morocco WE%sT + 0:00 Morocco +00/+01 2018 Oct 27 + 1:00 - +01 # Mozambique # diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/antarctica openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/antarctica --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/antarctica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/antarctica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Antarctica and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/asia openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/asia --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/asia 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/asia 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Asia and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -29,7 +31,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2017-01-13): +# From Paul Eggert (2018-06-19): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -58,7 +60,8 @@ # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). # -# The following alphabetic abbreviations appear in these tables: +# The following alphabetic abbreviations appear in these tables +# (corrections are welcome): # std dst # LMT Local Mean Time # 2:00 EET EEST Eastern European Time @@ -67,11 +70,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China +# 8:00 PST PDT* Philippine Standard Time # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 # 9:30 ACST Australian Central Standard Time +# *I invented the abbreviation PDT; see "Philippines" below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -304,6 +309,29 @@ # China +# From Paul Eggert (2018-10-02): +# The following comes from Table 1 of: +# Li Yu. Research on the daylight saving movement in 1940s Shanghai. +# Nanjing Journal of Social Sciences. 2014;(2):144-50. +# http://oversea.cnki.net/kns55/detail.aspx?dbname=CJFD2014&filename=NJSH201402020 +# The table lists dates only; I am guessing 00:00 and 24:00 transition times. +# Also, the table lists the planned end of DST in 1949, but the corresponding +# zone line cuts this off on May 28, when the Communists took power. +# +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Shang 1940 only - Jun 1 0:00 1:00 D +Rule Shang 1940 only - Oct 12 24:00 0 S +Rule Shang 1941 only - Mar 15 0:00 1:00 D +Rule Shang 1941 only - Nov 1 24:00 0 S +Rule Shang 1942 only - Jan 31 0:00 1:00 D +Rule Shang 1945 only - Sep 1 24:00 0 S +Rule Shang 1946 only - May 15 0:00 1:00 D +Rule Shang 1946 only - Sep 30 24:00 0 S +Rule Shang 1947 only - Apr 15 0:00 1:00 D +Rule Shang 1947 only - Oct 31 24:00 0 S +Rule Shang 1948 1949 - May 1 0:00 1:00 D +Rule Shang 1948 1949 - Sep 30 24:00 0 S #plan + # From Guy Harris: # People's Republic of China. Yes, they really have only one time zone. @@ -330,18 +358,33 @@ # time - sort of", Los Angeles Times, 1986-05-05 ... [says] that China began # observing daylight saving time in 1986. -# From Paul Eggert (2014-06-30): -# Shanks & Pottenger have China switching to a single time zone in 1980, but -# this doesn't seem to be correct. They also write that China observed summer -# DST from 1986 through 1991, which seems to match the above commentary, so -# go with them for DST rules as follows: -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Shang 1940 only - Jun 3 0:00 1:00 D -Rule Shang 1940 1941 - Oct 1 0:00 0 S -Rule Shang 1941 only - Mar 16 0:00 1:00 D -Rule PRC 1986 only - May 4 0:00 1:00 D -Rule PRC 1986 1991 - Sep Sun>=11 0:00 0 S -Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D +# From P Chan (2018-05-07): +# The start and end time of DST in China [from 1986 on] should be 2:00 +# (i.e. 2:00 to 3:00 at the start and 2:00 to 1:00 at the end).... +# Government notices about summer time: +# +# 1986-04-12 http://www.zj.gov.cn/attach/zfgb/198608.pdf p.21-22 +# (To establish summer time from 1986. On 4 May, set the clocks ahead one hour +# at 2 am. On 14 September, set the clocks backward one hour at 2 am.) +# +# 1987-02-15 http://www.gov.cn/gongbao/shuju/1987/gwyb198703.pdf p.114 +# (Summer time in 1987 to start from 12 April until 13 September) +# +# 1987-09-09 http://www.gov.cn/gongbao/shuju/1987/gwyb198721.pdf p.709 +# (From 1988, summer time to start from 2 am of the first Sunday of mid-April +# until 2 am of the first Sunday of mid-September) +# +# 1992-03-03 http://www.gov.cn/gongbao/shuju/1992/gwyb199205.pdf p.152 +# (To suspend summer time from 1992) +# +# The first page of People's Daily on 12 April 1988 stating that summer time +# to begin on 17 April. +# http://data.people.com.cn/pic/101p/1988/04/1988041201.jpg + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule PRC 1986 only - May 4 2:00 1:00 D +Rule PRC 1986 1991 - Sep Sun>=11 2:00 0 S +Rule PRC 1987 1991 - Apr Sun>=11 2:00 1:00 D # From Anthony Fok (2001-12-20): # BTW, I did some research on-line and found some info regarding these five @@ -363,10 +406,11 @@ # Alois Treindl kindly sent me translations of the following two sources: # # (1) -# Guo Qingsheng (National Time-Service Center, CAS, Xi'an 710600, China) +# Guo Qing-sheng (National Time-Service Center, CAS, Xi'an 710600, China) # Beijing Time at the Beginning of the PRC # China Historical Materials of Science and Technology -# (Zhongguo ke ji shi liao, 中国科技史料), Vol. 24, No. 1 (2003) +# (Zhongguo ke ji shi liao, 中国科技史料). 2003;24(1):5-9. +# http://oversea.cnki.net/kcms/detail/detail.aspx?filename=ZGKS200301000&dbname=CJFD2003 # It gives evidence that at the beginning of the PRC, Beijing time was # officially apparent solar time! However, Guo also says that the # evidence is dubious, as the relevant institute of astronomy had not @@ -543,7 +587,7 @@ # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Beijing time, used throughout China; represented by Shanghai. Zone Asia/Shanghai 8:05:43 - LMT 1901 - 8:00 Shang C%sT 1949 + 8:00 Shang C%sT 1949 May 28 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) @@ -772,24 +816,140 @@ 8:00 Taiwan C%sT # Macau (Macao, Aomen) -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 D -Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 S -Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 D -Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 D -Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 D -Rule Macau 1965 only - Oct 31 0:00 0 S -Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 D -Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 S -Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 D -Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 S -Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S -Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D -Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D -Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S -# See Europe/Lisbon for info about the 1912 transition. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u +# +# From P Chan (2018-05-10): +# * LegisMac +# http://legismac.safp.gov.mo/legismac/descqry/Descqry.jsf?lang=pt +# A database for searching titles of legal documents of Macau in +# Chinese and Portuguese. The term "HORÁRIO DE VERÃO" can be used for +# searching decrees about summer time. +# * Archives of Macao +# http://www.archives.gov.mo/en/bo/ +# It contains images of old official gazettes. +# * The Macao Meteorological and Geophysical Bureau have a page listing the +# summer time history. But it is not complete and has some mistakes. +# http://www.smg.gov.mo/smg/geophysics/e_t_Summer%20Time.htm +# Macau adopted GMT+8 on 30 Oct 1904 to follow Hong Kong. Clocks were +# advanced by 25 minutes and 50 seconds. Which means the LMT used was +# +7:34:10. As stated in the "Portaria No. 204" dated 21 October 1904 +# and published in the Official Gazette on 29 October 1904. +# http://igallery.icm.gov.mo/Images/Archives/BO/MO_AH_PUB_BO_1904_10/MO_AH_PUB_BO_1904_10_00025_Grey.JPG +# +# Therefore the 1911 decree of Portugal did not change time in Macau. +# +# From LegisMac, here is a list of decrees that changed the time ... +# [Decree Gazette-no. date; titles omitted in this quotation] +# DIL 732 BOCM 51 1941.12.20 +# DIL 764 BOCM 9S 1942.04.30 +# DIL 781 BOCM 21 1942.10.10 +# PT 3434 BOCM 8S 1943.04.17 +# PT 3504 BOCM 20 1943.09.25 +# PT 3843 BOCM 39 1945.09.29 +# PT 3961 BOCM 17 1946.04.27 +# PT 4026 BOCM 39 1946.09.28 +# PT 4153 BOCM 16 1947.04.10 +# PT 4271 BOCM 48 1947.11.29 +# PT 4374 BOCM 18 1948.05.01 +# PT 4465 BOCM 44 1948.10.30 +# PT 4590 BOCM 14 1949.04.02 +# PT 4666 BOCM 44 1949.10.29 +# PT 4771 BOCM 12 1950.03.25 +# PT 4838 BOCM 43 1950.10.28 +# PT 4946 BOCM 12 1951.03.24 +# PT 5025 BO 43 1951.10.27 +# PT 5149 BO 14 1952.04.05 +# PT 5251 BO 43 1952.10.25 +# PT 5366 BO 13 1953.03.28 +# PT 5444 BO 44 1953.10.31 +# PT 5540 BO 12 1954.03.20 +# PT 5589 BO 44 1954.10.30 +# PT 5676 BO 12 1955.03.19 +# PT 5739 BO 45 1955.11.05 +# PT 5823 BO 11 1956.03.17 +# PT 5891 BO 44 1956.11.03 +# PT 5981 BO 12 1957.03.23 +# PT 6064 BO 43 1957.10.26 +# PT 6172 BO 12 1958.03.22 +# PT 6243 BO 43 1958.10.25 +# PT 6341 BO 12 1959.03.21 +# PT 6411 BO 43 1959.10.24 +# PT 6514 BO 11 1960.03.12 +# PT 6584 BO 44 1960.10.29 +# PT 6721 BO 10 1961.03.11 +# PT 6815 BO 43 1961.10.28 +# PT 6947 BO 10 1962.03.10 +# PT 7080 BO 43 1962.10.27 +# PT 7218 BO 12 1963.03.23 +# PT 7340 BO 43 1963.10.26 +# PT 7491 BO 11 1964.03.14 +# PT 7664 BO 43 1964.10.24 +# PT 7846 BO 15 1965.04.10 +# PT 7979 BO 42 1965.10.16 +# PT 8146 BO 15 1966.04.09 +# PT 8252 BO 41 1966.10.08 +# PT 8429 BO 15 1967.04.15 +# PT 8540 BO 41 1967.10.14 +# PT 8735 BO 15 1968.04.13 +# PT 8860 BO 41 1968.10.12 +# PT 9035 BO 16 1969.04.19 +# PT 9156 BO 42 1969.10.18 +# PT 9328 BO 15 1970.04.11 +# PT 9418 BO 41 1970.10.10 +# PT 9587 BO 14 1971.04.03 +# PT 9702 BO 41 1971.10.09 +# PT 38-A/72 BO 14 1972.04.01 +# PT 126-A/72 BO 41 1972.10.07 +# PT 61/73 BO 14 1973.04.07 +# PT 182/73 BO 40 1973.10.06 +# PT 282/73 BO 51 1973.12.22 +# PT 177/74 BO 41 1974.10.12 +# PT 51/75 BO 15 1975.04.12 +# PT 173/75 BO 41 1975.10.11 +# PT 67/76/M BO 14 1976.04.03 +# PT 169/76/M BO 41 1976.10.09 +# PT 78/79/M BO 19 1979.05.12 +# PT 166/79/M BO 42 1979.10.20 +# Note that DIL 732 does not belong to "HORÁRIO DE VERÃO" according to +# LegisMac.... Note that between 1942 and 1945, the time switched +# between GMT+9 and GMT+10. Also in 1965 and 1965 the DST ended at 2:30am. + +# From Paul Eggert (2018-05-10): +# The 1904 decree says that Macau changed from the meridian of +# Fortaleza do Monte, presumably the basis for the 7:34:10 for LMT. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Macau 1942 1943 - Apr 30 23:00 1:00 - +Rule Macau 1942 only - Nov 17 23:00 0 - +Rule Macau 1943 only - Sep 30 23:00 0 S +Rule Macau 1946 only - Apr 30 23:00s 1:00 D +Rule Macau 1946 only - Sep 30 23:00s 0 S +Rule Macau 1947 only - Apr 19 23:00s 1:00 D +Rule Macau 1947 only - Nov 30 23:00s 0 S +Rule Macau 1948 only - May 2 23:00s 1:00 D +Rule Macau 1948 only - Oct 31 23:00s 0 S +Rule Macau 1949 1950 - Apr Sat>=1 23:00s 1:00 D +Rule Macau 1949 1950 - Oct lastSat 23:00s 0 S +Rule Macau 1951 only - Mar 31 23:00s 1:00 D +Rule Macau 1951 only - Oct 28 23:00s 0 S +Rule Macau 1952 1953 - Apr Sat>=1 23:00s 1:00 D +Rule Macau 1952 only - Nov 1 23:00s 0 S +Rule Macau 1953 1954 - Oct lastSat 23:00s 0 S +Rule Macau 1954 1956 - Mar Sat>=17 23:00s 1:00 D +Rule Macau 1955 only - Nov 5 23:00s 0 S +Rule Macau 1956 1964 - Nov Sun>=1 03:30 0 S +Rule Macau 1957 1964 - Mar Sun>=18 03:30 1:00 D +Rule Macau 1965 1973 - Apr Sun>=16 03:30 1:00 D +Rule Macau 1965 1966 - Oct Sun>=16 02:30 0 S +Rule Macau 1967 1976 - Oct Sun>=16 03:30 0 S +Rule Macau 1973 only - Dec 30 03:30 1:00 D +Rule Macau 1975 1976 - Apr Sun>=16 03:30 1:00 D +Rule Macau 1979 only - May 13 03:30 1:00 D +Rule Macau 1979 only - Oct Sun>=16 03:30 0 S + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Asia/Macau 7:34:10 - LMT 1904 Oct 30 + 8:00 - CST 1941 Dec 21 23:00 + 9:00 Macau +09/+10 1945 Sep 30 24:00 8:00 Macau C%sT @@ -1494,9 +1654,29 @@ # http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm # ... In summary, it is written as follows. From 24:00 on the first Saturday # in May, until 0:00 on the day after the second Saturday in September. + +# From Phake Nick (2018-09-27): +# [T]he webpage authored by National Astronomical Observatory of Japan +# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EF.html +# ... mentioned that using Showa 23 (year 1948) as example, 13pm of September +# 11 in summer time will equal to 0am of September 12 in standard time. +# It cited a document issued by the Liaison Office which briefly existed +# during the postwar period of Japan, where the detail on implementation +# of the summer time is described in the document. +# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EFB2C6BBFEB9EFA4CEBCC2BBDCA4CBA4C4A4A4A4C6.pdf +# The text in the document do instruct a fall back to occur at +# September 11, 13pm in summer time, while ordinary citizens can +# change the clock before they sleep. +# +# From Paul Eggert (2018-09-27): +# This instruction is equivalent to "Sat>=8 25:00", so use that. zic treats +# it like "Sun>=9 01:00", which is not quite the same but is the best we can +# do in any POSIX or C platform. The "25:00" assumes zic from 2007 or later, +# which should be safe now. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Japan 1948 only - May Sat>=1 24:00 1:00 D -Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S +Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D @@ -1878,7 +2058,7 @@ 5:00 - +05 # Mangghystaū (KZ-MAN) # Aqtau was not founded until 1963, but it represents an inhabited region, -# so include time stamps before 1963. +# so include timestamps before 1963. Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2 4:00 - +04 1930 Jun 21 5:00 - +05 1981 Oct 1 @@ -2018,6 +2198,10 @@ # Assembly, as published in Rodong Sinmun. # From Tim Parenti (2018-04-29): # It appears to be the front page story at the top in the right-most column. +# +# From Paul Eggert (2018-05-04): +# The BBC reported that the transition was from 23:30 to 24:00 today. +# https://www.bbc.com/news/world-asia-44010705 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 @@ -2030,7 +2214,7 @@ 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Aug 24 9:00 - KST 2015 Aug 15 00:00 - 8:30 - KST 2018 May 5 + 8:30 - KST 2018 May 4 23:30 9:00 - KST ############################################################################### @@ -2780,19 +2964,35 @@ # Philippine Star 2014-08-05 # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time -# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Phil 1936 only - Nov 1 0:00 1:00 - -Rule Phil 1937 only - Feb 1 0:00 0 - -Rule Phil 1954 only - Apr 12 0:00 1:00 - -Rule Phil 1954 only - Jul 1 0:00 0 - -Rule Phil 1978 only - Mar 22 0:00 1:00 - -Rule Phil 1978 only - Sep 21 0:00 0 - +# From Paul Goyette (2018-06-15): +# In the Philippines, there is a national law, Republic Act No. 10535 +# which declares the official time here as "Philippine Standard Time". +# The act [1] even specifies use of PST as the abbreviation, although +# the FAQ provided by PAGASA [2] uses the "acronym PhST to distinguish +# it from the Pacific Standard Time (PST)." +# [1] http://www.officialgazette.gov.ph/2013/05/15/republic-act-no-10535/ +# [2] https://www1.pagasa.dost.gov.ph/index.php/astronomy/philippine-standard-time#republic-act-10535 +# +# From Paul Eggert (2018-06-19): +# I surveyed recent news reports, and my impression is that "PST" is +# more popular among reliable English-language news sources. This is +# not just a measure of Google hit counts: it's also the sizes and +# influence of the sources. There is no current abbreviation for DST, +# so use "PDT", the usual American style. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Phil 1936 only - Nov 1 0:00 1:00 D +Rule Phil 1937 only - Feb 1 0:00 0 S +Rule Phil 1954 only - Apr 12 0:00 1:00 D +Rule Phil 1954 only - Jul 1 0:00 0 S +Rule Phil 1978 only - Mar 22 0:00 1:00 D +Rule Phil 1978 only - Sep 21 0:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 8:04:00 - LMT 1899 May 11 - 8:00 Phil +08/+09 1942 May - 9:00 - +09 1944 Nov - 8:00 Phil +08/+09 + 8:00 Phil P%sT 1942 May + 9:00 - JST 1944 Nov + 8:00 Phil P%sT # Qatar # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -2803,15 +3003,34 @@ # Saudi Arabia # -# From Paul Eggert (2014-07-15): +# From Paul Eggert (2018-08-29): # Time in Saudi Arabia and other countries in the Arabian peninsula was not -# standardized until relatively recently; we don't know when, and possibly it +# standardized until 1968 or so; we don't know exactly when, and possibly it # has never been made official. Richard P Hunt, in "Islam city yielding to # modern times", New York Times (1961-04-09), p 20, wrote that only airlines # observed standard time, and that people in Jeddah mostly observed quasi-solar # time, doing so by setting their watches at sunrise to 6 o'clock (or to 12 # o'clock for "Arab" time). # +# Timekeeping differed depending on who you were and which part of Saudi +# Arabia you were in. In 1969, Elias Antar wrote that although a common +# practice had been to set one's watch to 12:00 (i.e., midnight) at sunset - +# which meant that the time on one side of a mountain could differ greatly from +# the time on the other side - many foreigners set their watches to 6pm +# instead, while airlines instead used UTC +03 (except in Dhahran, where they +# used UTC +04), Aramco used UTC +03 with DST, and the Trans-Arabian Pipe Line +# Company used Aramco time in eastern Saudi Arabia and airline time in western. +# (The American Military Aid Advisory Group used plain UTC.) Antar writes, +# "A man named Higgins, so the story goes, used to run a local power +# station. One day, the whole thing became too much for Higgins and he +# assembled his staff and laid down the law. 'I've had enough of this,' he +# shrieked. 'It is now 12 o'clock Higgins Time, and from now on this station is +# going to run on Higgins Time.' And so, until last year, it did." See: +# Antar E. Dinner at When? Saudi Aramco World, 1969 March/April. 2-3. +# http://archive.aramcoworld.com/issue/196902/dinner.at.when.htm +# newspapers.com says a similar story about Higgins was published in the Port +# Angeles (WA) Evening News, 1965-03-10, page 5, but I lack access to the text. +# # The TZ database cannot represent quasi-solar time; airline time is the best # we can do. The 1946 foreign air news digest of the U.S. Civil Aeronautics # Board (OCLC 42299995) reported that the "... Arabian Government, inaugurated @@ -2821,7 +3040,8 @@ # # Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two # time zones; the other zone, at UT +04, was in the far eastern part of -# the country. Ignore this, as it's before our 1970 cutoff. +# the country. Presumably this is documenting airline time. Ignore this, +# as it's before our 1970 cutoff. # # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/australasia openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/australasia --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/australasia 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/australasia 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Australasia and environs, and for much of the Pacific + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -384,8 +386,15 @@ # Dominic Fok writes (2017-08-20) that DST ends 2018-01-14, citing # Extraordinary Government of Fiji Gazette Supplement No. 21 (2017-08-27), # [Legal Notice No. 41] of an order of the previous day by J Usamate. + +# From Raymond Kumar (2018-07-13): +# http://www.fijitimes.com/government-approves-2018-daylight-saving/ +# ... The daylight saving period will end at 3am on Sunday January 13, 2019. +# +# From Paul Eggert (2018-07-15): # For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 14. Although ad hoc, it matches +# the first Sunday on or after January 13. January transitions reportedly +# depend on when school terms start. Although the guess is ad hoc, it matches # transitions since late 2014 and seems more likely to match future # practice than guessing no DST. @@ -399,7 +408,7 @@ Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=14 3:00 0 - +Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/backward openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/backward --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/backward 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/backward 2019-01-18 04:23:48.000000000 +0000 @@ -21,10 +21,12 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb links for backward compatibility + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# This file provides links between current names for time zones +# This file provides links between current names for timezones # and their old names. Many names changed in late 1993. # Link TARGET LINK-NAME diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/etcetera openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/etcetera --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/etcetera 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/etcetera 2019-01-18 04:23:48.000000000 +0000 @@ -21,12 +21,14 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for ships at sea and other miscellany + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # These entries are mostly present for historical reasons, so that # people in areas not otherwise covered by the tz files could "zic -l" -# to a time zone that was right for their area. These days, the +# to a timezone that was right for their area. These days, the # tz files cover almost all the inhabited world, and the only practical # need now for the entries that are not on UTC are for ships at sea # that cannot use POSIX TZ settings. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/europe openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/europe --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/europe 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/europe 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for Europe and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -540,7 +542,7 @@ # # To work around this problem, the build procedure can translate the # following data into two forms, one with negative SAVE values and the -# other form with a traditional approximation for Irish time stamps +# other form with a traditional approximation for Irish timestamps # after 1971-10-31 02:00 UTC; although this approximation has tm_isdst # flags that are reversed, its UTC offsets are correct and this often # suffices. This source file currently uses only nonnegative SAVE @@ -2450,6 +2452,33 @@ # administratively part of Sakhalin oblast', they appear to have # remained on UTC+11 along with Magadan. +# From Marat Nigametzianov (2018-07-16): +# this is link to order from 1956 about timezone in USSR +# http://astro.uni-altai.ru/~orion/blog/2011/11/novyie-granitsyi-chasovyih-poyasov-v-sssr/ +# +# From Paul Eggert (2018-07-16): +# Perhaps someone could translate the above-mentioned link and use it +# to correct our data for the ex-Soviet Union. It cites the following: +# «Поясное время и новые границы часовых поясов» / сост. П.Н. Долгов, +# отв. ред. Г.Д. Бурдун - М: Комитет стандартов, мер и измерительных +# приборов при Совете Министров СССР, Междуведомственная комиссия +# единой службы времени, 1956 г. +# This book looks like it would be a helpful resource for the Soviet +# Union through 1956. Although a copy was in the Scientific Library +# of Tomsk State University, I have not been able to track down a copy nearby. +# +# From Stepan Golosunov (2018-07-21): +# http://astro.uni-altai.ru/~orion/blog/2015/05/center-reforma-ischisleniya-vremeni-br-na-territorii-sssr-v-1957-godu-center/ +# says that the 1956 decision to change time belts' borders was not +# implemented as planned in 1956 and the change happened in 1957. +# There is also the problem that actual time zones were different from +# the official time belts (and from many time belts' maps) as there were +# numerous exceptions to application of time belt rules. For example, +# https://ru.wikipedia.org/wiki/Московское_время#Перемещение_границы_применения_московского_времени_на_восток +# says that by 1962 there were many regions in the 3rd time belt that +# were on Moscow time, referring to a 1962 map. By 1989 number of such +# exceptions grew considerably. + # From Tim Parenti (2014-07-06): # The comments detailing the coverage of each Russian zone are meant to assist # with maintenance only and represent our best guesses as to which regions @@ -2460,9 +2489,6 @@ # future stability. ISO 3166-2:RU codes are also listed for first-level # divisions where available. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] - - # From Tim Parenti (2014-07-03): # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast @@ -2730,6 +2756,15 @@ # 34 RU-VGG Volgograd Oblast # The 1988 transition is from USSR act No. 5 (1988-01-04). +# From Alexander Fetisov (2018-09-20): +# Volgograd region in southern Russia (Europe/Volgograd) change +# timezone from UTC+3 to UTC+4 from 28oct2018. +# http://sozd.parliament.gov.ru/bill/452878-7 +# +# From Stepan Golosunov (2018-10-11): +# The law has been published today on +# http://publication.pravo.gov.ru/Document/View/0001201810110037 + Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 3:00 - +03 1930 Jun 21 4:00 - +04 1961 Nov 11 @@ -2738,7 +2773,8 @@ 4:00 - +04 1992 Mar 29 2:00s 3:00 Russia +03/+04 2011 Mar 27 2:00s 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 + 3:00 - +03 2018 Oct 28 2:00s + 4:00 - +04 # From Paul Eggert (2016-11-11): # Europe/Saratov covers: @@ -3427,7 +3463,8 @@ #Rule NatSpain 1937 only - May 22 23:00 1:00 S #Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 - #Rule NatSpain 1938 only - Mar 26 23:00 1:00 S -# The following rules are copied from Morocco from 1967 through 1978. +# The following rules are copied from Morocco from 1967 through 1978, +# except with "S" letters. Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S Rule SpainAfrica 1967 only - Oct 1 0:00 0 - Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S @@ -3447,6 +3484,7 @@ 0:00 1:00 WEST 1918 Oct 7 23:00 0:00 - WET 1924 0:00 Spain WE%sT 1929 + 0:00 - WET 1967 # Help zishrink.awk. 0:00 SpainAfrica WE%sT 1984 Mar 16 1:00 - CET 1986 1:00 EU CE%sT @@ -3632,7 +3670,7 @@ # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): -# Prefer the above sources to Shanks & Pottenger for time stamps after 1985. +# Prefer the above sources to Shanks & Pottenger for timestamps after 1985. # From Steffen Thorsen (2007-03-09): # Starting 2007 though, it seems that they are adopting EU's 1:00 UTC @@ -3842,10 +3880,29 @@ # * Ukrainian Government's Resolution of 20.03.1992, No. 139. # http://www.uazakon.com/documents/date_8u/pg_grcasa.htm +# From Paul Eggert (2018-10-03): +# As is usual in tzdb, Ukrainian zones use the most common English spellings. +# For example, tzdb uses Europe/Kiev, as "Kiev" is the most common spelling in +# English for Ukraine's capital, even though it is certainly wrong as a +# transliteration of the Ukrainian "Київ". This is similar to tzdb's use of +# Europe/Prague, which is certainly wrong as a transliteration of the Czech +# "Praha". ("Kiev" came from old Slavic via Russian to English, and "Prague" +# came from old Slavic via French to English, so the two cases have something +# in common.) Admittedly English-language spelling of Ukrainian names is +# controversial, and some day "Kyiv" may become substantially more popular in +# English; in the meantime, stick with the traditional English "Kiev" as that +# means less disruption for our users. +# +# Anyway, none of the common English-language spellings (Kiev, Kyiv, Kieff, +# Kijeff, Kijev, Kiyef, Kiyeff) do justice to the common pronunciation in +# Ukrainian, namely [ˈkɪjiu̯] (IPA). This pronunciation has nothing like an +# English "v" or "f", and instead trails off with what an English-speaker +# would call a demure "oo" sound, and it would would be better anglicized as +# "Kuiyu". Here's a sound file, if you would like to do as the Kuiyuvians do: +# https://commons.wikimedia.org/wiki/File:Uk-Київ.ogg + # Zone NAME GMTOFF RULES FORMAT [UNTIL] -# Most of Ukraine since 1970 has been like Kiev. -# "Kyiv" is the transliteration of the Ukrainian name, but -# "Kiev" is more common in English. +# This represents most of Ukraine. See above for the spelling of "Kiev". Zone Europe/Kiev 2:02:04 - LMT 1880 2:02:04 - KMT 1924 May 2 # Kiev Mean Time 2:00 - EET 1930 Jun 21 diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/factory openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/factory --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/factory 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/factory 2019-01-18 04:23:48.000000000 +0000 @@ -21,11 +21,13 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for noncommittal factory settings + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# For distributors who don't want to put time zone specification in -# their installation procedures. Users that run 'date' will get the +# For distributors who don't want to specify a timezone in their +# installation procedures. Users who run 'date' will get the # time zone abbreviation "-00", indicating that the actual time zone # is unknown. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/leapseconds openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/leapseconds --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/leapseconds 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/leapseconds 2019-01-18 04:23:48.000000000 +0000 @@ -26,21 +26,25 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which is copied from: -# ftp://ftp.nist.gov/pub/time/leap-seconds.list +# leap-seconds.list file, which can be copied from +# +# or +# or . # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds -# https://www.eecis.udel.edu/~mills/leap.html +# . # The International Earth Rotation and Reference Systems Service # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space); see -# Levine J. Coordinated Universal Time and the leap second. +# (which measures the true angular orientation of the earth in space) +# and publishes leap second data in a copyrighted file +# . +# See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 -# http://ieeexplore.ieee.org/document/7909995/ +# . # There were no leap seconds before 1972, because the official mechanism # accounting for the discrepancy between atomic time and the earth's rotation -# did not exist until the early 1970s. +# did not exist. # The correction (+ or -) is made at the given time, so lines # will typically look like: @@ -48,10 +52,7 @@ # or # Leap YEAR MON DAY 23:59:59 - R/S -# If the leapsecond is Rolling (R) the given time is local time. -# If the leapsecond is Stationary (S) the given time is UTC. - -# Leap YEAR MONTH DAY HH:MM:SS CORR R/S +# If the leap second is Rolling (R) the given time is local time (unused here). Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -80,5 +81,9 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S -# Updated through IERS Bulletin C55 -# File expires on: 28 December 2018 +# POSIX timestamps for the data in this file: +#updated 1467936000 +#expires 1561680000 + +# Updated through IERS Bulletin C56 +# File expires on: 28 June 2019 diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/northamerica openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/northamerica --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/northamerica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/northamerica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for North and Central America and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -71,7 +73,7 @@ # # Most of the US soon followed suit. See: # Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56. -# http://dx.doi.org/10.2307/3105430 +# https://dx.doi.org/10.2307/3105430 # From Paul Eggert (2005-04-16): # That 1883 transition occurred at 12:00 new time, not at 12:00 old time. @@ -460,6 +462,19 @@ # western South Dakota, far western Texas (El Paso County, Hudspeth County, # and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming # +# From Paul Eggert (2018-10-25): +# On 1921-03-04 federal law placed all of Texas into the central time zone. +# However, El Paso ignored the law for decades and continued to observe +# mountain time, on the grounds that that's what they had always done +# and they weren't about to let the federal government tell them what to do. +# Eventually the federal government gave in and changed the law on +# 1970-04-10 to match what El Paso was actually doing. Although +# that's slightly after our 1970 cutoff, there is no need to create a +# separate zone for El Paso since they were ignoring the law anyway. See: +# Long T. El Pasoans were time rebels, fought to stay in Mountain zone. +# El Paso Times. 2018-10-24 06:40 -06. +# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/ +# # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D Rule Denver 1920 only - Oct lastSun 2:00 0 S @@ -729,9 +744,7 @@ Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00 -10:30 - HST 1933 Apr 30 2:00 -10:30 1:00 HDT 1933 May 21 12:00 - -10:30 - HST 1942 Feb 9 2:00 - -10:30 1:00 HDT 1945 Sep 30 2:00 - -10:30 - HST 1947 Jun 8 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 -10:00 - HST # Now we turn to US areas that have diverged from the consensus since 1970. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/pacificnew openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/pacificnew --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/pacificnew 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/pacificnew 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for proposed US election time (this file is obsolete) + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/southamerica openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/southamerica --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/southamerica 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/southamerica 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for South America and environs + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -415,7 +417,7 @@ # standard time, so let's do that here too. This does not change UTC # offsets, only tm_isdst and the time zone abbreviations. One minor # plus is that this silences a zic complaint that there's no POSIX TZ -# setting for time stamps past 2038. +# setting for timestamps past 2038. # Zone NAME GMTOFF RULES FORMAT [UNTIL] # @@ -948,6 +950,14 @@ # ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html # From Steffen Thorsen (2017-12-20): # http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm +# +# From Fábio Gomes (2018-10-04): +# The Brazilian president just announced a new change on this year DST. +# It was scheduled to start on November 4th and it was changed to November 18th. +# From Rodrigo Brüning Wessler (2018-10-15): +# The Brazilian government just announced that the change in DST was +# canceled.... Maybe the president Michel Temer also woke up one hour +# earlier today. :) Rule Brazil 2018 max - Nov Sun>=1 0:00 1:00 - Rule Brazil 2023 only - Feb Sun>=22 0:00 0 - Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 - @@ -1254,6 +1264,24 @@ # they will switch from -03 to -04 one hour after Santiago does that day. # For now, assume that they will not revert. +# From Juan Correa (2018-08-13): +# As of moments ago, the Ministry of Energy in Chile has announced the new +# schema for DST. ... Announcement in video (in Spanish): +# https://twitter.com/MinEnergia/status/1029000399129374720 +# From Yonathan Dossow (2018-08-13): +# The video says "first Saturday of September", we all know it means Sunday at +# midnight. +# From Tim Parenti (2018-08-13): +# Translating the captions on the video at 0:44-0:55, "We want to announce as +# Government that from 2019, Winter Time will be increased to 5 months, between +# the first Saturday of April and the first Saturday of September." +# At 2:08-2:20, "The Magallanes region will maintain its current time, as +# decided by the citizens during 2017, but our Government will promote a +# regional dialogue table to gather their opinion on this matter." +# https://twitter.com/MinEnergia/status/1029009354001973248 +# "We will keep the new time policy unchanged for at least the next 4 years." +# So we extend the new rules on Saturdays at 24:00 mainland time indefinitely. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Chile 1927 1931 - Sep 1 0:00 1:00 - Rule Chile 1928 1932 - Apr 1 0:00 0 - @@ -1287,8 +1315,10 @@ Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 - Rule Chile 2012 2014 - Apr Sun>=23 3:00u 0 - Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 - -Rule Chile 2016 max - May Sun>=9 3:00u 0 - -Rule Chile 2016 max - Aug Sun>=9 4:00u 1:00 - +Rule Chile 2016 2018 - May Sun>=9 3:00u 0 - +Rule Chile 2016 2018 - Aug Sun>=9 4:00u 1:00 - +Rule Chile 2019 max - Apr Sun>=2 3:00u 0 - +Rule Chile 2019 max - Sep Sun>=2 4:00u 1:00 - # IATA SSIM anomalies: (1992-02) says 1992-03-14; # (1996-09) says 1998-03-08. Ignore these. # Zone NAME GMTOFF RULES FORMAT [UNTIL] diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/systemv openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/systemv --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/systemv 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/systemv 2019-01-18 04:23:48.000000000 +0000 @@ -21,6 +21,8 @@ # or visit www.oracle.com if you need additional information or have any # questions. # +# tzdb data for System V rules (this file is obsolete) + # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/VERSION openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/VERSION --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/VERSION 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/VERSION 2019-01-18 04:23:48.000000000 +0000 @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2018e +tzdata2018g diff -Nru openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/zone.tab openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/zone.tab --- openjdk-lts-11~28/test/jdk/sun/util/calendar/zi/tzdata/zone.tab 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/sun/util/calendar/zi/tzdata/zone.tab 2019-01-18 04:23:48.000000000 +0000 @@ -21,12 +21,12 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# tz zone descriptions (deprecated version) +# tzdb timezone descriptions (deprecated version) # # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # -# From Paul Eggert (2014-07-31): +# From Paul Eggert (2018-06-27): # This file is intended as a backward-compatibility aid for older programs. # New programs should use zone1970.tab. This file is like zone1970.tab (see # zone1970.tab's comments), but with the following additional restrictions: @@ -35,13 +35,13 @@ # 2. The first data column contains exactly one country code. # # Because of (2), each row stands for an area that is the intersection -# of a region identified by a country code and of a zone where civil +# of a region identified by a country code and of a timezone where civil # clocks have agreed since 1970; this is a narrower definition than # that of zone1970.tab. # -# This table is intended as an aid for users, to help them select time -# zone data entries appropriate for their practical needs. It is not -# intended to take or endorse any position on legal or territorial claims. +# This table is intended as an aid for users, to help them select timezones +# appropriate for their practical needs. It is not intended to take or +# endorse any position on legal or territorial claims. # #country- #code coordinates TZ comments @@ -291,7 +291,7 @@ MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas) MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar -MO +2214+11335 Asia/Macau +MO +221150+1133230 Asia/Macau MP +1512+14545 Pacific/Saipan MQ +1436-06105 America/Martinique MR +1806-01557 Africa/Nouakchott diff -Nru openjdk-lts-11~28/test/jdk/tools/launcher/ArgFileSyntax.java openjdk-lts-11.0.2+9/test/jdk/tools/launcher/ArgFileSyntax.java --- openjdk-lts-11~28/test/jdk/tools/launcher/ArgFileSyntax.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/jdk/tools/launcher/ArgFileSyntax.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /** * @test - * @bug 8027634 + * @bug 8027634 8210810 * @summary Verify syntax of argument file * @build TestHelper * @run main ArgFileSyntax @@ -40,6 +40,9 @@ import java.util.regex.Pattern; public class ArgFileSyntax extends TestHelper { + // Buffer size in args.c readArgFile() method + private static final int ARG_FILE_PARSER_BUF_SIZE = 4096; + private File createArgFile(List lines) throws IOException { File argFile = new File("argfile"); argFile.delete(); @@ -186,7 +189,7 @@ String bag = "-Dgarbage="; String ver = "-version"; // a token 8192 long - char[] data = new char[8192 - bag.length()]; + char[] data = new char[2*ARG_FILE_PARSER_BUF_SIZE - bag.length()]; Arrays.fill(data, 'O'); List scratch = new ArrayList<>(); scratch.add("-Xmx32m"); @@ -194,13 +197,23 @@ scratch.add(ver); rv.add(Collections.nCopies(2, scratch)); - data = new char[8192 + 1024]; + data = new char[2*ARG_FILE_PARSER_BUF_SIZE + 1024]; Arrays.fill(data, 'O'); scratch = new ArrayList<>(); scratch.add(bag + String.valueOf(data)); scratch.add(ver); rv.add(Collections.nCopies(2, scratch)); + // 8210810: position escaping character at boundary + // reserve space for quote and backslash + data = new char[ARG_FILE_PARSER_BUF_SIZE - bag.length() - 2]; + Arrays.fill(data, 'O'); + scratch = new ArrayList<>(); + String filling = String.valueOf(data); + scratch.add(bag + "'" + filling + "\\\\aaa\\\\'"); + scratch.add(ver); + rv.add(List.of(scratch, List.of(bag + filling + "\\aaa\\", ver))); + return rv; } diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/JavascriptWinTitle/JavascriptWinTitle.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/JavascriptWinTitle/JavascriptWinTitle.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/JavascriptWinTitle/JavascriptWinTitle.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/JavascriptWinTitle/JavascriptWinTitle.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4645058 4747738 4855054 8024756 8141492 8196202 + * @bug 4645058 4747738 4855054 8024756 8141492 8196202 8205593 * @summary Javascript IE load error when linked by -linkoffline * Window title shouldn't change when loading left frames (javascript) * @author dkramer @@ -43,6 +43,7 @@ @Test void test() { javadoc("-d", "out", + "-source", "8", "--frames", "-doctitle", "Document Title", "-windowtitle", "Window Title", diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/C.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/C.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/C.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/C.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,7 +26,7 @@ * Cross link to inner class: {@link javax.swing.text.AbstractDocument.AttributeContext Link to AttributeContext innerclass}
* Cross link to class: {@link java.math.BigDecimal Link to external class BigDecimal}
* Cross link to member: {@link java.math.BigInteger#gcd(java.math.BigInteger) Link to external member gcd}
- * Cross link to package: {@link javax.tools.SimpleJavaFileObject#URI Link to external member URI}
+ * Cross link to package: {@link javax.tools.SimpleJavaFileObject#uri Link to external member URI}
*/ public class C { diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4652655 4857717 8025633 8026567 8071982 8164407 8182765 + * @bug 4652655 4857717 8025633 8026567 8071982 8164407 8182765 8205593 * @summary This test verifies that class cross references work properly. * @author jamieh * @library ../lib @@ -45,6 +45,7 @@ @Test void test() { javadoc("-d", "out", + "-source", "8", "-Xdoclint:none", "-sourcepath", testSrc, "-linkoffline", uri, testSrc, @@ -60,7 +61,7 @@ + "title=\"class or interface in java.math\" class=\"externalLink\">Link to external class BigDecimal", "Link to external member gcd", - "Link to external member URI", "
\n" + "
Overrides:
\n" @@ -69,8 +70,22 @@ } @Test + void test_error() { + javadoc("-d", "out-error", + "-Xdoclint:none", + "-sourcepath", testSrc, + "-linkoffline", uri, testSrc, + testSrc("C.java")); + checkExit(Exit.ERROR); + checkOutput(Output.OUT, true, + "The code being documented uses modules but the packages defined" + + " in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module"); + } + + @Test void test_html4() { javadoc("-d", "out-html4", + "-source", "8", "-html4", "-Xdoclint:none", "-sourcepath", testSrc, diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4369014 4851991 8164407 + * @bug 4369014 4851991 8164407 8205593 * @summary Determine if the docRoot inline tag works properly. * If docRoot performs as documented, the test passes. * Make sure that the docRoot tag works with the -bottom option. @@ -47,6 +47,7 @@ javadoc("-bottom", "The value of @docRoot is \"{@docRoot}\"", "-d", "out", + "-source", "8", "-sourcepath", testSrc, "-linkoffline", uri, testSrc, testSrc("TestDocRootTag.java"), "pkg"); diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testExternalOverridenMethod/TestExternalOverridenMethod.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4857717 8025633 8026567 8164407 8182765 + * @bug 4857717 8025633 8026567 8164407 8182765 8205593 * @summary Test to make sure that externally overriden and implemented methods * are documented properly. The method should still include "implements" or * "overrides" documentation even though the method is external. @@ -45,6 +45,7 @@ @Test void test() { javadoc("-d", "out", + "-source","8", "-sourcepath", testSrc, "-linkoffline", uri, testSrc, "pkg"); @@ -67,6 +68,7 @@ @Test void test_html4() { javadoc("-d", "out-html4", + "-source", "8", "-html4", "-sourcepath", testSrc, "-linkoffline", uri, testSrc, diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4663254 8016328 8025633 8026567 8081854 8182765 + * @bug 4663254 8016328 8025633 8026567 8081854 8182765 8205593 * @summary Verify that spaces do not appear in hrefs and anchors. * @author jamieh * @library ../lib @@ -43,6 +43,7 @@ void test() { javadoc("-Xdoclint:none", "-d", "out", + "-source", "8", "-sourcepath", testSrc, "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc, "pkg"); @@ -85,6 +86,7 @@ void test_html4() { javadoc("-Xdoclint:none", "-d", "out-html4", + "-source", "8", "-html4", "-sourcepath", testSrc, "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc, diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4720957 5020118 8026567 8038976 8184969 8164407 8182765 + * @bug 4720957 5020118 8026567 8038976 8184969 8164407 8182765 8205593 * @summary Test to make sure that -link and -linkoffline link to * right files, and URLs with and without trailing slash are accepted. * @author jamieh @@ -61,6 +61,7 @@ String out1 = "out1"; String url = "http://acme.com/jdk/"; javadoc("-d", out1, + "-source", "8", "-classpath", mylib, "-sourcepath", testSrc, "-linkoffline", url, testSrc + "/jdk", @@ -113,6 +114,7 @@ String out1_html4 = "out1-html4"; javadoc("-d", out1_html4, + "-source", "8", "-html4", "-classpath", mylib, "-sourcepath", testSrc, diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithModule.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithModule.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithModule.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithModule.java 2019-01-18 04:23:48.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8205593 + * @summary Javadoc -link makes broken links if module name matches package name + * @library /tools/lib ../lib + * @modules + * jdk.javadoc/jdk.javadoc.internal.tool + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build JavadocTester + * @run main TestLinkOptionWithModule + */ + +import java.nio.file.Path; +import java.nio.file.Paths; + +import builder.ClassBuilder; +import builder.ClassBuilder.*; +import toolbox.ModuleBuilder; +import toolbox.ToolBox; + + +public class TestLinkOptionWithModule extends JavadocTester { + + final ToolBox tb; + private final Path src; + + public static void main(String... args) throws Exception { + TestLinkOptionWithModule tester = new TestLinkOptionWithModule(); + tester.runTests(m -> new Object[]{Paths.get(m.getName())}); + } + + TestLinkOptionWithModule() throws Exception { + tb = new ToolBox(); + src = Paths.get("src"); + initModulesAndPackages(); + } + + @Test + void testModuleLinkedToModule(Path base) throws Exception { + Path out1 = base.resolve("out1a"), out2 = base.resolve("out1b"); + + javadoc("-d", out1.toString(), + "--module-source-path", src.toString(), + "--module", "com.ex1"); + + javadoc("-d", out2.toString(), + "--module-source-path", src.toString(), + "--module", "com.ex2", + "-link", "../" + out1.getFileName()); + + checkExit(Exit.OK); + checkOutput("com.ex2/com/ex2/B.html", true, + "A"); + } + + @Test + void testPackageLinkedToPackage(Path base) throws Exception { + Path out1 = base.resolve("out2a"), out2 = base.resolve("out2b"); + + javadoc("-d", out1.toString(), + "-sourcepath", src.toString(), + "-subpackages", "com.ex1"); + + javadoc("-d", out2.toString(), + "-sourcepath", src.toString(), + "-subpackages", "com.ex2", + "-link", "../" + out1.getFileName()); + + checkExit(Exit.OK); + checkOutput("com/ex2/B.html", true, + "A"); + } + + @Test + void testModuleLinkedToPackage(Path base) throws Exception { + Path out1 = base.resolve("out3a"), out2 = base.resolve("out3b"); + + javadoc("-d", out1.toString(), + "-sourcepath", src.toString(), + "-subpackages", "com.ex1"); + + javadoc("-d", out2.toString(), + "--module-source-path", src.toString(), + "--module", "com.ex2", + "-link", "../" + out1.getFileName()); + + checkExit(Exit.ERROR); + checkOutput(Output.OUT, true, + "The code being documented uses modules but the packages defined " + + "in ../out3a/ are in the unnamed module"); + } + + @Test + void testPackageLinkedToModule(Path base) throws Exception { + Path out1 = base.resolve("out4a"), out2 = base.resolve("out4b"); + + javadoc("-d", out1.toString(), + "--module-source-path", src.toString(), + "--module", "com.ex1"); + + javadoc("-d", out2.toString(), + "-sourcepath", src.toString(), + "-subpackages", "com.ex2", + "-link", "../" + out1.getFileName()); + + checkExit(Exit.ERROR); + checkOutput(Output.OUT, true, + "The code being documented uses packages in the unnamed module, but the packages defined " + + "in ../out4a/ are in named modules"); + } + + + void initModulesAndPackages() throws Exception{ + new ModuleBuilder(tb, "com.ex1") + .exports("com.ex1") + .classes("package com.ex1; public class A{}") + .write(src); + + new ModuleBuilder(tb, "com.ex2") + .requires("com.ex1") + .exports("com.ex2") + .classes("package com.ex2; \n" + + "import com.ex1.A;\n" + + "public class B{\n" + + "public B(A obj){}\n" + + "}\n") + .write(src); + + new ClassBuilder(tb, "com.ex1.A") + .setModifiers("public","class") + .write(src); + + new ClassBuilder(tb, "com.ex2.B") + .addImports("com.ex1.A") + .setModifiers("public","class") + .addMembers(MethodBuilder.parse("public void foo(A a)")) + .write(src); + } + +} diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestNewLineInLink.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestNewLineInLink.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testLinkOption/TestNewLineInLink.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testLinkOption/TestNewLineInLink.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,7 +23,7 @@ /* * @test - * @bug 4739870 + * @bug 4739870 8205593 * @summary Make sure that a new line may act as a separator between * link and label. * @author jamieh @@ -43,6 +43,7 @@ @Test void test() { javadoc("-d", "out", + "-source", "8", "-sourcepath", testSrc, "-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api", testSrc("jdk"), "testNewLineInLink"); diff -Nru openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java --- openjdk-lts-11~28/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java 2019-01-18 04:23:48.000000000 +0000 @@ -26,7 +26,7 @@ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 * 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464 - 8164407 8192007 8182765 8196200 8196201 8196202 8196202 + 8164407 8192007 8182765 8196200 8196201 8196202 8196202 8205593 * @summary Test modules support in javadoc. * @author bpatel * @library ../lib @@ -1616,10 +1616,10 @@ void checkLinkOffline() { checkOutput("moduleB/testpkg3mdlB/package-summary.html", true, - "Link to String Class"); checkOutput("moduleB/testpkg3mdlB/package-summary.html", true, - "Link to java.lang package"); checkOutput("moduleB/testpkg3mdlB/package-summary.html", true, " e.endsWith("mrjar")) - .findAny() - .orElseThrow(() -> new InternalError("mrjar not found")); + .map(Paths::get) + .filter(e -> e.endsWith("mrjar")) + .findAny() + .orElseThrow(() -> new InternalError("mrjar not found")); testJdk = System.getProperty("test.jdk"); fileSep = System.getProperty("file.separator"); cmdPath = Paths.get(testJdk, "bin"); @@ -65,10 +63,16 @@ @Test public void basic() throws Exception { - // build the jar file + // build Version.jar, Version_9.jar and main.jar Result r = run("jar -cf Version.jar -C base test --release 9 -C 9 test --release 10 -C 10 test"); checkResult(r); + r = run("jar -cf Version_9.jar -C base test --release 9 -C 9 test"); + checkResult(r); + + r = run("jar -cf Main.jar test/Main.class"); + checkResult(r); + // try out a bunch of things r = run("jdeps --multi-release 9 -v missing.jar"); checkResult(r, false, "Warning: Path does not exist: missing.jar"); @@ -78,31 +82,31 @@ r = run("jdeps --multi-release base -v Version.jar"); checkResult(r, true, - "Version.jar ->", - "test.Version", - "test.Version" + "Version.jar ->", + "test.Version", + "test.Version" ); r = run("jdeps --multi-release 9 -v Version.jar"); checkResult(r, true, - "Version.jar ->", - "9/test.NonPublic", - "9/test.NonPublic", - "9/test.Version", - "9/test.Version", - "9/test.Version", - "9/test.Version" + "Version.jar ->", + "9/test.NonPublic", + "9/test.NonPublic", + "9/test.Version", + "9/test.Version", + "9/test.Version", + "9/test.Version" ); r = run("jdeps --multi-release 10 -v Version.jar"); checkResult(r, true, - "Version.jar ->", - "10/test.Version", - "10/test.Version", - "10/test.Version", - "10/test.Version", - "9/test.NonPublic", - "9/test.NonPublic" + "Version.jar ->", + "10/test.Version", + "10/test.Version", + "10/test.Version", + "10/test.Version", + "9/test.NonPublic", + "9/test.NonPublic" ); r = run("jdeps --multi-release 8 -v Version.jar"); @@ -111,82 +115,90 @@ r = run("jdeps --multi-release 9.1 -v Version.jar"); checkResult(r, false, "Error: invalid argument for option: 9.1"); - r = run("jdeps -v -R -cp Version.jar test/Main.class"); + runJdeps("test/Main.class"); + runJdeps("Main.jar"); + } + + + private void runJdeps(String path) throws Exception { + Result r = run("jdeps -v -R -cp Version.jar " + path); checkResult(r, false, "--multi-release option is not set"); - r = run("jdeps -v -R -cp Version.jar -multi-release 9 test/Main.class"); + r = run("jdeps -v -R -cp Version.jar -multi-release 9 " + path); checkResult(r, false, - "Error: unknown option: -multi-release", - "Usage: jdeps ", - "Main.class ->", - "test.Main", - "test.Main", - "test.Main", - "Version.jar ->", - "9/test.NonPublic", - "9/test.NonPublic", - "9/test.Version", - "9/test.Version", - "9/test.Version", - "9/test.Version" - ); - - r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class"); - checkResult(r, true, - "Main.class ->", - "Main.class ->", - "test.Main", - "test.Main", - "test.Main", - "Version.jar ->", - "10/test.Version", - "10/test.Version", - "10/test.Version", - "10/test.Version", - "9/test.NonPublic", - "9/test.NonPublic" - ); - - r = run("jdeps -v -R -cp Version.jar --multi-release base test/Main.class"); - checkResult(r, true, - "Main.class ->", - "Main.class ->", - "test.Main", - "test.Main", - "test.Main", - "Version.jar ->", - "test.Version", - "test.Version" + "Error: unknown option: -multi-release", + "Usage: jdeps = 0) { + name = path.substring(index + 1, path.length()); + } + checkResult(r, true, + name + " ->", + name + " ->", + "test.Main", + "test.Main", + "test.Main", + "Version.jar ->", + "9/test.NonPublic", + "9/test.NonPublic", + "9/test.Version", + "9/test.Version", + "9/test.Version", + "9/test.Version" + ); + + r = run("jdeps -v -R -cp Version.jar --multi-release 10 " + path); + checkResult(r, true, + name + " ->", + name + " ->", + "test.Main", + "test.Main", + "test.Main", + "Version.jar ->", + "10/test.Version", + "10/test.Version", + "10/test.Version", + "10/test.Version", + "9/test.NonPublic", + "9/test.NonPublic" + ); + + r = run("jdeps -v -R -cp Version.jar --multi-release base " + path); + checkResult(r, true, + name + " ->", + name + " ->", + "test.Main", + "test.Main", + "test.Main", + "Version.jar ->", + "test.Version", + "test.Version" ); - r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 test/Main.class"); + r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 " + path); checkResult(r, false, "Error: invalid argument for option: 9.1"); - // Rebuild jar without version 10 - r = run("jar -cf Version.jar -C base test --release 9 -C 9 test"); - checkResult(r); - - // but ask for version 10 - r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class"); + // Version_9.jar does not have any version 10 entry + r = run("jdeps -v -R -cp Version_9.jar --multi-release 10 " + path); checkResult(r, true, - "Main.class ->", - "Main.class ->", - "test.Main", - "test.Main", - "test.Main", - "Version.jar ->", - "9/test.NonPublic", - "9/test.NonPublic", - "9/test.Version", - "9/test.Version", - "9/test.Version", - "9/test.Version" + name + " ->", + name + " ->", + "test.Main", + "test.Main", + "test.Main", + "Version_9.jar ->", + "9/test.NonPublic", + "9/test.NonPublic", + "9/test.Version", + "9/test.Version", + "9/test.Version", + "9/test.Version" ); } @@ -198,27 +210,72 @@ r = run("jdeps -v -R -cp PQ.jar --multi-release base PQ.jar"); checkResult(r, true, - "PQ.jar -> java.base", - "p.Foo" + "PQ.jar -> java.base", + "p.Foo" ); r = run("jdeps -v -R -cp PQ.jar --multi-release 9 PQ.jar"); checkResult(r, true, - "PQ.jar -> java.base", - "9/p.Foo", - "9/p.Foo", - "9/q.Bar" + "PQ.jar -> java.base", + "9/p.Foo", + "9/p.Foo", + "9/q.Bar" ); r = run("jdeps -v -R -cp PQ.jar --multi-release 10 PQ.jar"); checkResult(r, true, - "PQ.jar -> java.base", - "10/q.Bar", - "10/q.Bar", - "10/q.Gee", - "9/p.Foo", - "9/p.Foo" + "PQ.jar -> java.base", + "10/q.Bar", + "10/q.Bar", + "10/q.Gee", + "9/p.Foo", + "9/p.Foo" + ); + } + + @Test + public void modularJar() throws Exception { + Result r = run("jar -cf foo.jar -C base p"); + checkResult(r); + + Path foo = Paths.get(System.getProperty("test.classes")).resolve("modules").resolve("foo"); + r = run("jar -uf foo.jar --release 9 -C " + foo.toString() + " module-info.class --release 10 -C v10 q"); + checkResult(r); + + r = run("jdeps -v --multi-release 10 --module-path foo.jar -m foo"); + checkResult(r, true, + "foo", // module name + "foo.jar", // the path to foo.jar + "requires mandated java.base", // module dependences + "foo -> java.base", + "10/q.Bar", + "10/q.Bar", + "10/q.Gee", + "p.Foo" + ); + + r = run("jdeps --multi-release 9 --module-path foo.jar Main.jar"); + checkResult(r, true, + "Main.jar ->", + "test", + "foo", // module name + "foo.jar", // the path to foo.jar + "requires mandated java.base", // module dependences + "foo -> java.base", + "p" + ); + + r = run("jdeps --multi-release 10 --module-path foo.jar Main.jar"); + checkResult(r, true, + "Main.jar ->", + "test", + "foo", // module name + "foo.jar", // the path to foo.jar + "requires mandated java.base", // module dependences + "foo -> java.base", + "p", + "q" ); } diff -Nru openjdk-lts-11~28/test/lib/jdk/test/lib/util/JarUtils.java openjdk-lts-11.0.2+9/test/lib/jdk/test/lib/util/JarUtils.java --- openjdk-lts-11~28/test/lib/jdk/test/lib/util/JarUtils.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/lib/jdk/test/lib/util/JarUtils.java 2019-01-18 04:23:48.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,6 +23,7 @@ package jdk.test.lib.util; +import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -126,6 +127,11 @@ changes = new HashMap<>(changes); System.out.printf("Creating %s from %s...\n", dest, src); + + if (dest.equals(src)) { + throw new IOException("src and dest cannot be the same"); + } + try (JarOutputStream jos = new JarOutputStream( new FileOutputStream(dest))) { @@ -153,6 +159,22 @@ System.out.println(); } + /** + * Update the Manifest inside a jar. + * + * @param src the original jar file name + * @param dest the new jar file name + * @param man the Manifest + * + * @throws IOException + */ + public static void updateManifest(String src, String dest, Manifest man) + throws IOException { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + man.write(bout); + updateJar(src, dest, Map.of(JarFile.MANIFEST_NAME, bout.toByteArray())); + } + private static void updateEntry(JarOutputStream jos, String name, Object content) throws IOException { if (content instanceof Boolean) { diff -Nru openjdk-lts-11~28/test/lib/sun/hotspot/code/Compiler.java openjdk-lts-11.0.2+9/test/lib/sun/hotspot/code/Compiler.java --- openjdk-lts-11~28/test/lib/sun/hotspot/code/Compiler.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/lib/sun/hotspot/code/Compiler.java 2019-01-18 04:23:48.000000000 +0000 @@ -23,6 +23,7 @@ package sun.hotspot.code; +import java.lang.reflect.Executable; import sun.hotspot.WhiteBox; /** @@ -133,4 +134,20 @@ } return true; } + + /* + * Determine if the compiler corresponding to the compilation level 'compLevel' + * provides an intrinsic for 'class'.'method'. + */ + public static boolean isIntrinsicAvailable(int compLevel, String klass, String method, Class... parameterTypes) { + Executable intrinsicMethod; + try { + intrinsicMethod = Class.forName(klass).getDeclaredMethod(method, parameterTypes); + } catch (NoSuchMethodException e) { + throw new RuntimeException("Test bug, '" + method + "' method unavailable. " + e); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Test bug, '" + klass + "' class unavailable. " + e); + } + return WB.isIntrinsicAvailable(intrinsicMethod, compLevel); + } } diff -Nru openjdk-lts-11~28/test/lib/sun/hotspot/gc/GC.java openjdk-lts-11.0.2+9/test/lib/sun/hotspot/gc/GC.java --- openjdk-lts-11~28/test/lib/sun/hotspot/gc/GC.java 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/lib/sun/hotspot/gc/GC.java 2019-01-18 04:23:48.000000000 +0000 @@ -31,7 +31,7 @@ */ public enum GC { /* - * Enum values much match CollectedHeap::Name + * Enum values must match CollectedHeap::Name */ Serial(1), Parallel(2), @@ -49,7 +49,7 @@ } /** - * @return true if this GC is supported by the VM + * @return true if this GC is supported by the VM, i.e., it is built into the VM. */ public boolean isSupported() { return WB.isGCSupported(name); diff -Nru openjdk-lts-11~28/test/nashorn/script/nosecurity/treeapi/diagnostic.js.EXPECTED openjdk-lts-11.0.2+9/test/nashorn/script/nosecurity/treeapi/diagnostic.js.EXPECTED --- openjdk-lts-11~28/test/nashorn/script/nosecurity/treeapi/diagnostic.js.EXPECTED 2018-08-21 19:48:10.000000000 +0000 +++ openjdk-lts-11.0.2+9/test/nashorn/script/nosecurity/treeapi/diagnostic.js.EXPECTED 2019-01-18 04:23:48.000000000 +0000 @@ -80,7 +80,7 @@ "columnNumber": "15", "kind": "ERROR", "position": "15", - "message": "test.js:1:15 Unclosed group near index 9\n([a-z])+(\n ^\n /([a-z])+(/;\n ^", + "message": "test.js:1:15 Unclosed group near index 9\n([a-z])+(\n /([a-z])+(/;\n ^", "lineNumber": "1" }, {