diff --git a/.github/actions/config/action.yml b/.github/actions/config/action.yml index 931988accc3..bf86a946415 100644 --- a/.github/actions/config/action.yml +++ b/.github/actions/config/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/do-build/action.yml b/.github/actions/do-build/action.yml index 79eddf8c70f..252105f29fd 100644 --- a/.github/actions/do-build/action.yml +++ b/.github/actions/do-build/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/get-bootjdk/action.yml b/.github/actions/get-bootjdk/action.yml index 25ee1d8dfa0..312fb642c82 100644 --- a/.github/actions/get-bootjdk/action.yml +++ b/.github/actions/get-bootjdk/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/get-bundles/action.yml b/.github/actions/get-bundles/action.yml index 0e52320a350..aaec9a6d19f 100644 --- a/.github/actions/get-bundles/action.yml +++ b/.github/actions/get-bundles/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/get-msys2/action.yml b/.github/actions/get-msys2/action.yml index 82022a6e233..4ca5d2ab847 100644 --- a/.github/actions/get-msys2/action.yml +++ b/.github/actions/get-msys2/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/scripts/gen-build-failure-report.sh b/.github/scripts/gen-build-failure-report.sh index 2dda69a3f33..65849d2e26e 100644 --- a/.github/scripts/gen-build-failure-report.sh +++ b/.github/scripts/gen-build-failure-report.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/scripts/gen-test-summary.sh b/.github/scripts/gen-test-summary.sh index a612bed5527..3d54be8c5db 100644 --- a/.github/scripts/gen-test-summary.sh +++ b/.github/scripts/gen-test-summary.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index 8e97ff4439f..3f4ba67f996 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3517fa53941..99aaf9650a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,6 @@ jobs: - 'hs/tier1 compiler part 1' - 'hs/tier1 compiler part 2' - 'hs/tier1 compiler part 3' - - 'hs/tier1 compiler not-xcomp' - 'hs/tier1 gc' - 'hs/tier1 runtime' - 'hs/tier1 serviceability' @@ -101,10 +100,6 @@ jobs: test-suite: 'test/hotspot/jtreg/:tier1_compiler_3' debug-suffix: -debug - - test-name: 'hs/tier1 compiler not-xcomp' - test-suite: 'test/hotspot/jtreg/:tier1_compiler_not_xcomp' - debug-suffix: -debug - - test-name: 'hs/tier1 gc' test-suite: 'test/hotspot/jtreg/:tier1_gc' debug-suffix: -debug diff --git a/doc/building.html b/doc/building.html index cd73863f879..7157848f561 100644 --- a/doc/building.html +++ b/doc/building.html @@ -863,12 +863,12 @@

GNU Bash

are supported.

At least version 3.2 of GNU Bash must be used.

Graphviz and Pandoc

-

In order to build the full docs (see the +

In order to build man pages and the full docs (see the --enable-full-docs configure option) Graphviz and Pandoc are required. Any recent versions -should work. For reference, and subject to change, Oracle builds use -Graphviz 9.0.0 and Pandoc 2.19.2.

+href="https://pandoc.org">Pandoc is required. For full docs also Graphviz is required. Any recent +versions should work. For reference, and subject to change, Oracle +builds use Graphviz 9.0.0 and Pandoc 2.19.2.

Running Configure

To build the JDK, you need a "configuration", which consists of a directory where to store the build output, coupled with information diff --git a/doc/building.md b/doc/building.md index 99bc509dc70..04db6e94d1c 100644 --- a/doc/building.md +++ b/doc/building.md @@ -680,9 +680,9 @@ At least version 3.2 of GNU Bash must be used. ### Graphviz and Pandoc -In order to build the full docs (see the `--enable-full-docs` -configure option) [Graphviz](https://www.graphviz.org) and -[Pandoc](https://pandoc.org) are required. Any recent versions should +In order to build man pages and the full docs (see the `--enable-full-docs` +configure option) [Pandoc](https://pandoc.org) is required. For full docs also +[Graphviz](https://www.graphviz.org) is required. Any recent versions should work. For reference, and subject to change, Oracle builds use Graphviz 9.0.0 and Pandoc 2.19.2. diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 62c91ee5f78..7c86b77dd31 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/CompileModuleTools.gmk b/make/CompileModuleTools.gmk index 0a3039b34d2..888b8418eea 100644 --- a/make/CompileModuleTools.gmk +++ b/make/CompileModuleTools.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/CopyImportModules.gmk b/make/CopyImportModules.gmk index 52515ebd314..69a42f166ba 100644 --- a/make/CopyImportModules.gmk +++ b/make/CopyImportModules.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/CopyInterimTZDB.gmk b/make/CopyInterimTZDB.gmk index e2704b32975..1e54cd8af11 100644 --- a/make/CopyInterimTZDB.gmk +++ b/make/CopyInterimTZDB.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/Global.gmk b/make/Global.gmk index 3e6721f994c..86487c1c2fc 100644 --- a/make/Global.gmk +++ b/make/Global.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/Images.gmk b/make/Images.gmk index 5f987a2f71a..c5d0ef11b5d 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -29,6 +29,7 @@ include $(SPEC) include MakeBase.gmk include CopyFiles.gmk +include DebugInfoUtils.gmk include Execute.gmk include Modules.gmk include Utils.gmk diff --git a/make/Init.gmk b/make/Init.gmk index 8918de7d16e..f2cfe3625a5 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/JrtfsJar.gmk b/make/JrtfsJar.gmk index 55e0c150b3b..e1b3965ba04 100644 --- a/make/JrtfsJar.gmk +++ b/make/JrtfsJar.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk index 8ed6476c506..13b80b8e56e 100644 --- a/make/MacBundles.gmk +++ b/make/MacBundles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index ca284e21dd0..5a5e40d025a 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/RunTestsPrebuilt.gmk b/make/RunTestsPrebuilt.gmk index ce5d254ccc4..95ad239e846 100644 --- a/make/RunTestsPrebuilt.gmk +++ b/make/RunTestsPrebuilt.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/RunTestsPrebuiltSpec.gmk b/make/RunTestsPrebuiltSpec.gmk index 6447da8cb6b..03c877a4277 100644 --- a/make/RunTestsPrebuiltSpec.gmk +++ b/make/RunTestsPrebuiltSpec.gmk @@ -63,7 +63,7 @@ TEST_JOBS ?= 0 # Use hard-coded values for java flags (one size, fits all!) JAVA_FLAGS := -Duser.language=en -Duser.country=US -JAVA_FLAGS_BIG := -Xms64M -Xmx1600M +JAVA_FLAGS_BIG := -Xms64M -Xmx2048M JAVA_FLAGS_SMALL := -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1 BUILDJDK_JAVA_FLAGS_SMALL := -Xms32M -Xmx512M -XX:TieredStopAtLevel=1 BUILD_JAVA_FLAGS := $(JAVA_FLAGS_BIG) diff --git a/make/StaticLibs.gmk b/make/StaticLibs.gmk index 78918c456ee..d54c67b50b3 100644 --- a/make/StaticLibs.gmk +++ b/make/StaticLibs.gmk @@ -29,6 +29,7 @@ include $(SPEC) include MakeBase.gmk include CopyFiles.gmk +include DebugInfoUtils.gmk include Modules.gmk include modules/LauncherCommon.gmk @@ -97,10 +98,8 @@ EXTERNAL_LIBS := $(strip $(shell $(CAT) $(LIB_FLAGS_FILES) | \ ifeq ($(call isTargetOs, macosx), true) STATIC_LIBS := $(addprefix -force_load$(SPACE), $(STATIC_LIB_FILES)) - STANDARD_LIBS += -lstdc++ else ifeq ($(call isTargetOs, linux), true) STATIC_LIBS := -Wl,--export-dynamic -Wl,--whole-archive $(STATIC_LIB_FILES) -Wl,--no-whole-archive - STANDARD_LIBS := -l:libstdc++.a else ifeq ($(call isTargetOs, windows), true) STATIC_LIBS := $(addprefix -wholearchive:, $(STATIC_LIB_FILES)) else @@ -114,7 +113,8 @@ $(eval $(call SetupBuildLauncher, java, \ OPTIMIZATION := HIGH, \ STATIC_LAUNCHER := true, \ LDFLAGS := $(LDFLAGS_STATIC_JDK), \ - LIBS := $(STATIC_LIBS) $(EXTERNAL_LIBS) $(STANDARD_LIBS), \ + LIBS := $(STATIC_LIBS) $(EXTERNAL_LIBS), \ + LINK_TYPE := C++, \ OUTPUT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \ OBJECT_DIR := $(STATIC_LAUNCHER_OUTPUT_DIR), \ )) diff --git a/make/StaticLibsImage.gmk b/make/StaticLibsImage.gmk index 6a85701a788..6a181ff262f 100644 --- a/make/StaticLibsImage.gmk +++ b/make/StaticLibsImage.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/TestImage.gmk b/make/TestImage.gmk index e503f1cea2c..5c788a8d0a6 100644 --- a/make/TestImage.gmk +++ b/make/TestImage.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ToolsHotspot.gmk b/make/ToolsHotspot.gmk index df779d961fd..f53d851c0b7 100644 --- a/make/ToolsHotspot.gmk +++ b/make/ToolsHotspot.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ToolsJdk.gmk b/make/ToolsJdk.gmk index 402c6841191..98287473f3e 100644 --- a/make/ToolsJdk.gmk +++ b/make/ToolsJdk.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/Makefile.template b/make/autoconf/Makefile.template index ee33d0dfb9e..63ced4c75d8 100644 --- a/make/autoconf/Makefile.template +++ b/make/autoconf/Makefile.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/bootcycle-spec.gmk.template b/make/autoconf/bootcycle-spec.gmk.template index a476fe8a27e..8b6035606a5 100644 --- a/make/autoconf/bootcycle-spec.gmk.template +++ b/make/autoconf/bootcycle-spec.gmk.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/build-aux/pkg.m4 b/make/autoconf/build-aux/pkg.m4 index ddb685e9bc3..fb36ad358da 100644 --- a/make/autoconf/build-aux/pkg.m4 +++ b/make/autoconf/build-aux/pkg.m4 @@ -1,7 +1,7 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 57654514eb6..259315bb23c 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -302,7 +302,7 @@ AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS], AC_DEFUN([FLAGS_SETUP_OPTIMIZATION], [ - if test "x$TOOLCHAIN_TYPE" = xgcc; then + if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then C_O_FLAG_HIGHEST_JVM="-O3" C_O_FLAG_HIGHEST="-O3" C_O_FLAG_HI="-O3" @@ -311,6 +311,13 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION], C_O_FLAG_DEBUG="-O0" C_O_FLAG_DEBUG_JVM="-O0" C_O_FLAG_NONE="-O0" + + if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then + C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} -finline-functions" + C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} -finline-functions" + C_O_FLAG_HI="${C_O_FLAG_HI} -finline-functions" + fi + # -D_FORTIFY_SOURCE=2 hardening option needs optimization (at least -O1) enabled # set for lower O-levels -U_FORTIFY_SOURCE to overwrite previous settings if test "x$OPENJDK_TARGET_OS" = xlinux -a "x$DEBUG_LEVEL" = "xfastdebug"; then @@ -331,21 +338,6 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION], C_O_FLAG_DEBUG_JVM="${C_O_FLAG_DEBUG_JVM} ${DISABLE_FORTIFY_CFLAGS}" C_O_FLAG_NONE="${C_O_FLAG_NONE} ${DISABLE_FORTIFY_CFLAGS}" fi - elif test "x$TOOLCHAIN_TYPE" = xclang; then - if test "x$OPENJDK_TARGET_OS" = xaix; then - C_O_FLAG_HIGHEST_JVM="-O3 -finline-functions" - C_O_FLAG_HIGHEST="-O3 -finline-functions" - C_O_FLAG_HI="-O3 -finline-functions" - else - C_O_FLAG_HIGHEST_JVM="-O3" - C_O_FLAG_HIGHEST="-O3" - C_O_FLAG_HI="-O3" - fi - C_O_FLAG_NORM="-O2" - C_O_FLAG_DEBUG_JVM="-O0" - C_O_FLAG_SIZE="-Os" - C_O_FLAG_DEBUG="-O0" - C_O_FLAG_NONE="-O0" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then C_O_FLAG_HIGHEST_JVM="-O2 -Oy-" C_O_FLAG_HIGHEST="-O2" @@ -648,23 +640,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], # Linking is different on macOS JVM_PICFLAG="" fi - - # Extra flags needed when building optional static versions of certain - # JDK libraries. - STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1" - if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then - STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \ - -DJNIEXPORT='__attribute__((visibility(\"default\")))'" - else - STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -DJNIEXPORT=" - fi - if test "x$TOOLCHAIN_TYPE" = xgcc; then - # Disable relax-relocation to enable compatibility with older linkers - RELAX_RELOCATIONS_FLAG="-Xassembler -mrelax-relocations=no" - FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${RELAX_RELOCATIONS_FLAG}], - IF_TRUE: [STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS ${RELAX_RELOCATIONS_FLAG}"]) - fi - AC_SUBST(STATIC_LIBS_CFLAGS) ]) ################################################################################ diff --git a/make/autoconf/hotspot.m4 b/make/autoconf/hotspot.m4 index a95ed1fbacd..6dc46d17aa3 100644 --- a/make/autoconf/hotspot.m4 +++ b/make/autoconf/hotspot.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 61638ce5a2c..c09f581688c 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -121,7 +121,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], if test "x$DOT" != "x"; then AC_MSG_RESULT([yes]) else - AC_MSG_RESULT([no, cannot generate full docs]) + AC_MSG_RESULT([no, cannot generate full docs or man pages]) FULL_DOCS_AVAILABLE=false fi @@ -129,7 +129,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], if test "x$ENABLE_PANDOC" = "xtrue"; then AC_MSG_RESULT([yes]) else - AC_MSG_RESULT([no, cannot generate full docs]) + AC_MSG_RESULT([no, cannot generate full docs or man pages]) FULL_DOCS_AVAILABLE=false fi diff --git a/make/autoconf/jdk-version.m4 b/make/autoconf/jdk-version.m4 index 297a6e83b5c..52e00440795 100644 --- a/make/autoconf/jdk-version.m4 +++ b/make/autoconf/jdk-version.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/lib-alsa.m4 b/make/autoconf/lib-alsa.m4 index 8d0fb324cd0..3fd493c4d8e 100644 --- a/make/autoconf/lib-alsa.m4 +++ b/make/autoconf/lib-alsa.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/lib-bundled.m4 b/make/autoconf/lib-bundled.m4 index 6987250e906..091f01cadb5 100644 --- a/make/autoconf/lib-bundled.m4 +++ b/make/autoconf/lib-bundled.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/lib-freetype.m4 b/make/autoconf/lib-freetype.m4 index 9171b7bfc2a..8d524c8c8b9 100644 --- a/make/autoconf/lib-freetype.m4 +++ b/make/autoconf/lib-freetype.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/lib-x11.m4 b/make/autoconf/lib-x11.m4 index 6849b4a26c7..f1326b7ab85 100644 --- a/make/autoconf/lib-x11.m4 +++ b/make/autoconf/lib-x11.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index 18770c6d360..2637285334b 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -429,8 +429,6 @@ LIBFFI_LIB_FILE := @LIBFFI_LIB_FILE@ FILE_MACRO_CFLAGS := @FILE_MACRO_CFLAGS@ REPRODUCIBLE_CFLAGS := @REPRODUCIBLE_CFLAGS@ -STATIC_LIBS_CFLAGS := @STATIC_LIBS_CFLAGS@ - JMH_CORE_JAR := @JMH_CORE_JAR@ JMH_GENERATOR_JAR := @JMH_GENERATOR_JAR@ JMH_JOPT_SIMPLE_JAR := @JMH_JOPT_SIMPLE_JAR@ diff --git a/make/autoconf/util_paths.m4 b/make/autoconf/util_paths.m4 index d9277b7eb9c..7717150dfd9 100644 --- a/make/autoconf/util_paths.m4 +++ b/make/autoconf/util_paths.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/CopyFiles.gmk b/make/common/CopyFiles.gmk index 4ed6c5906c7..8ba21677245 100644 --- a/make/common/CopyFiles.gmk +++ b/make/common/CopyFiles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/DebugInfoUtils.gmk b/make/common/DebugInfoUtils.gmk new file mode 100644 index 00000000000..69d6c24b5e0 --- /dev/null +++ b/make/common/DebugInfoUtils.gmk @@ -0,0 +1,58 @@ +# +# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute 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. +# + +ifeq ($(_MAKEBASE_GMK), ) + $(error You must include MakeBase.gmk prior to including DebugInfoUtils.gmk) +endif + +################################################################################ +# +# Common debuginfo utility functions +# +################################################################################ + +################################################################################ +# Find native debuginfo files in a directory +# +# Param 1 - dir to find debuginfo files in +FindDebuginfoFiles = \ + $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \ + $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \ + $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES))) + +# Pick the correct debug info files to copy, either zipped or not. +ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) + DEBUGINFO_SUFFIXES += .diz +else + DEBUGINFO_SUFFIXES := .debuginfo .pdb .map + # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM + # dirs. + ifeq ($(call isTargetOs, macosx), true) + $(call FillFindCache, \ + $(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds) + FindDebuginfoFiles = \ + $(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1))) + endif +endif diff --git a/make/common/Execute.gmk b/make/common/Execute.gmk index abafe77a3c4..aa3c2e58813 100644 --- a/make/common/Execute.gmk +++ b/make/common/Execute.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/FileUtils.gmk b/make/common/FileUtils.gmk index d546ab94a58..d3cc4872ebb 100644 --- a/make/common/FileUtils.gmk +++ b/make/common/FileUtils.gmk @@ -307,26 +307,3 @@ ifeq ($(DISABLE_CACHE_FIND), true) else FindFiles = $(CacheFindFiles) endif - -# Find native debuginfo files in a directory -# -# Param 1 - dir to find debuginfo files in -FindDebuginfoFiles = \ - $(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \ - $(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \ - $(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES))) - -# Pick the correct debug info files to copy, either zipped or not. -ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) - DEBUGINFO_SUFFIXES += .diz -else - DEBUGINFO_SUFFIXES := .debuginfo .pdb .map - # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM - # dirs. - ifeq ($(call isTargetOs, macosx), true) - $(call FillFindCache, \ - $(SUPPORT_OUTPUTDIR)/modules_libs $(SUPPORT_OUTPUTDIR)/modules_cmds) - FindDebuginfoFiles = \ - $(if $(wildcard $1), $(call containing, .dSYM/, $(call FindFiles, $1))) - endif -endif diff --git a/make/common/MakeIO.gmk b/make/common/MakeIO.gmk index b7843817b5e..e1806e9259a 100644 --- a/make/common/MakeIO.gmk +++ b/make/common/MakeIO.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index fd6b9b4ec10..8ae33b3641e 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk index 960c4d66c30..d14c3ce4f76 100644 --- a/make/common/ProcessMarkdown.gmk +++ b/make/common/ProcessMarkdown.gmk @@ -1,4 +1,4 @@ -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/TextFileProcessing.gmk b/make/common/TextFileProcessing.gmk index 6746296df24..94aa259bebc 100644 --- a/make/common/TextFileProcessing.gmk +++ b/make/common/TextFileProcessing.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk index 928bff9bd84..22fd6722fa2 100644 --- a/make/common/ZipArchive.gmk +++ b/make/common/ZipArchive.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/modules/CopyCommon.gmk b/make/common/modules/CopyCommon.gmk index 75bfb0d62b1..f4df1ce3a30 100644 --- a/make/common/modules/CopyCommon.gmk +++ b/make/common/modules/CopyCommon.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk index 77f39457b4c..38485283dcb 100644 --- a/make/common/modules/LauncherCommon.gmk +++ b/make/common/modules/LauncherCommon.gmk @@ -160,6 +160,7 @@ define SetupBuildLauncherBody -framework ApplicationServices \ -framework Cocoa \ -framework Security, \ + LINK_TYPE := $$($1_LINK_TYPE), \ OUTPUT_DIR := $$($1_OUTPUT_DIR), \ OBJECT_DIR := $$($1_OBJECT_DIR), \ VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ @@ -192,9 +193,7 @@ ifeq ($(call isTargetOsType, unix)+$(MAKEFILE_PREFIX), true+Launcher) MAN_FILES_MD := $(wildcard $(addsuffix /*.md, $(call FindModuleManDirs, $(MODULE)))) ifneq ($(MAN_FILES_MD), ) - ifeq ($(ENABLE_PANDOC), false) - $(info Warning: pandoc not found. Not generating man pages) - else + ifeq ($(ENABLE_PANDOC), true) # Create dynamic man pages from markdown using pandoc. We need # PANDOC_TROFF_MANPAGE_FILTER, a wrapper around # PANDOC_TROFF_MANPAGE_FILTER_JAVASCRIPT. This is created by buildtools-jdk. diff --git a/make/common/native/Flags.gmk b/make/common/native/Flags.gmk index 213312047a4..daa9a83d62b 100644 --- a/make/common/native/Flags.gmk +++ b/make/common/native/Flags.gmk @@ -99,7 +99,7 @@ define SetupCompilerFlags $1_EXTRA_CFLAGS += $$($1_CFLAGS_$(OPENJDK_TARGET_OS)_$(OPENJDK_TARGET_CPU)_release) endif ifeq ($(STATIC_LIBS), true) - $1_EXTRA_CFLAGS += $$(STATIC_LIBS_CFLAGS) + $1_EXTRA_CFLAGS += -DSTATIC_BUILD=1 endif # Pickup extra OPENJDK_TARGET_OS_TYPE, OPENJDK_TARGET_OS and/or TOOLCHAIN_TYPE diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 708ea8186ca..96cc1473eec 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1214,9 +1214,11 @@ var getJibProfilesDependencies = function (input, common) { }, jcov: { - organization: common.organization, - revision: "3.0-17-jdk-asm+1.0", - ext: "zip", + server: "jpg", + product: "jcov", + version: "3.0", + build_number: "1", + file: "bundles/jcov-3.0+1.zip", environment_name: "JCOV_HOME", }, diff --git a/make/devkit/Makefile b/make/devkit/Makefile index 9c498807a54..5ffa5265aa3 100644 --- a/make/devkit/Makefile +++ b/make/devkit/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/hotspot/CopyToExplodedJdk.gmk b/make/hotspot/CopyToExplodedJdk.gmk index 280224de19e..21d68c7b06f 100644 --- a/make/hotspot/CopyToExplodedJdk.gmk +++ b/make/hotspot/CopyToExplodedJdk.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/hotspot/gensrc/GensrcJvmti.gmk b/make/hotspot/gensrc/GensrcJvmti.gmk index 718766cacae..b9c2e38b820 100644 --- a/make/hotspot/gensrc/GensrcJvmti.gmk +++ b/make/hotspot/gensrc/GensrcJvmti.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/eclipse/CreateWorkspace.gmk b/make/ide/eclipse/CreateWorkspace.gmk index 793377ec51e..50d04ad87af 100644 --- a/make/ide/eclipse/CreateWorkspace.gmk +++ b/make/ide/eclipse/CreateWorkspace.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/idea/jdk/idea.gmk b/make/ide/idea/jdk/idea.gmk index cc4d0a174cd..b27de609c49 100644 --- a/make/ide/idea/jdk/idea.gmk +++ b/make/ide/idea/jdk/idea.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/BuildConfig.java b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/BuildConfig.java index 4dd3c898b61..80a2df5bd55 100644 --- a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/BuildConfig.java +++ b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/BuildConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/ProjectCreator.java b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/ProjectCreator.java index a61afa8461a..36dc782c8e2 100644 --- a/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/ProjectCreator.java +++ b/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/ProjectCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk index 5ceef111086..54c98a3eeb6 100644 --- a/make/ide/vscode/hotspot/CreateVSCodeProject.gmk +++ b/make/ide/vscode/hotspot/CreateVSCodeProject.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/ide/xcode/hotspot/CreateXcodeProject.gmk b/make/ide/xcode/hotspot/CreateXcodeProject.gmk index db8f7f401ef..1f92ba0716f 100644 --- a/make/ide/xcode/hotspot/CreateXcodeProject.gmk +++ b/make/ide/xcode/hotspot/CreateXcodeProject.gmk @@ -42,7 +42,7 @@ ifeq ($(call isTargetOs, macosx), true) PROJECT_FILE_NAME := hotspot.xcodeproj COMPILE_COMMAND_FILE := $(OUTPUTDIR)/compile_commands.json - LINKER_FLAGS_FILE := $(MAKESUPPORT_OUTPUTDIR)/compile-commands/jvm-ldflags.txt + LINKER_FLAGS_FILE := $(MAKESUPPORT_OUTPUTDIR)/compile-commands/LIBRARY_hotspot_variant-server_libjvm_libjvm-ldflags.txt $(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \ TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \ @@ -60,7 +60,7 @@ ifeq ($(call isTargetOs, macosx), true) XCODE_PROJ_DEBUG_OPTION := -d endif - XCODE_PROJ_VARDEPS := $(WORKSPACE_ROOT) $(IDE_OUTPUTDIR) \ + XCODE_PROJ_VARDEPS := $(TOPDIR) $(IDE_OUTPUTDIR) \ $(PROJECT_MAKER_DIR)/data $(COMPILE_COMMAND_FILE) $(LINKER_FLAGS_FILE) XCODE_PROJ_VARDEPS_FILE := $(call DependOnVariable, XCODE_PROJ_VARDEPS, \ $(TOOLS_OUTPUTDIR)/xcodeproj.vardeps) @@ -70,7 +70,7 @@ ifeq ($(call isTargetOs, macosx), true) DEPS := $(BUILD_PROJECT_CREATOR) $(COMPILE_COMMAND_FILE) \ $(LINKER_FLAGS_FILE) $(XCODE_PROJ_VARDEPS_FILE), \ OUTPUT_DIR := $(TOOLS_OUTPUTDIR), \ - COMMAND := $(PROJECT_CREATOR_TOOL) $(WORKSPACE_ROOT) $(IDE_OUTPUTDIR) \ + COMMAND := $(PROJECT_CREATOR_TOOL) $(TOPDIR) $(IDE_OUTPUTDIR) \ $(PROJECT_MAKER_DIR)/data $(COMPILE_COMMAND_FILE) \ $(LINKER_FLAGS_FILE) $(XCODE_PROJ_DEBUG_OPTION), \ )) diff --git a/make/langtools/tools/javacserver/server/CompilerThreadPool.java b/make/langtools/tools/javacserver/server/CompilerThreadPool.java index 0a40a27ad87..1f9e3a195b6 100644 --- a/make/langtools/tools/javacserver/server/CompilerThreadPool.java +++ b/make/langtools/tools/javacserver/server/CompilerThreadPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/make/langtools/tools/javacserver/server/Server.java b/make/langtools/tools/javacserver/server/Server.java index 8d8bac76ad7..ac0b740a58b 100644 --- a/make/langtools/tools/javacserver/server/Server.java +++ b/make/langtools/tools/javacserver/server/Server.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/make/langtools/tools/propertiesparser/parser/MessageType.java b/make/langtools/tools/propertiesparser/parser/MessageType.java index cba9263567d..ea518dc536b 100644 --- a/make/langtools/tools/propertiesparser/parser/MessageType.java +++ b/make/langtools/tools/propertiesparser/parser/MessageType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/java.base/gensrc/GensrcBuffer.gmk b/make/modules/java.base/gensrc/GensrcBuffer.gmk index 8255cc62eec..fe417e9c423 100644 --- a/make/modules/java.base/gensrc/GensrcBuffer.gmk +++ b/make/modules/java.base/gensrc/GensrcBuffer.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/java.base/gensrc/GensrcExceptions.gmk b/make/modules/java.base/gensrc/GensrcExceptions.gmk index f3509710a37..9fa5d48009b 100644 --- a/make/modules/java.base/gensrc/GensrcExceptions.gmk +++ b/make/modules/java.base/gensrc/GensrcExceptions.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/java.base/gensrc/GensrcMisc.gmk b/make/modules/java.base/gensrc/GensrcMisc.gmk index 19d7c6dee9d..a5bbd37321c 100644 --- a/make/modules/java.base/gensrc/GensrcMisc.gmk +++ b/make/modules/java.base/gensrc/GensrcMisc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/java.desktop/gensrc/GensrcIcons.gmk b/make/modules/java.desktop/gensrc/GensrcIcons.gmk index dc1c1794e63..4e572211334 100644 --- a/make/modules/java.desktop/gensrc/GensrcIcons.gmk +++ b/make/modules/java.desktop/gensrc/GensrcIcons.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.charsets/Java.gmk b/make/modules/jdk.charsets/Java.gmk index 3adf141e8e1..2eb5bd45456 100644 --- a/make/modules/jdk.charsets/Java.gmk +++ b/make/modules/jdk.charsets/Java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.compiler/Gendata.gmk b/make/modules/jdk.compiler/Gendata.gmk index 78847074c88..57487c7c842 100644 --- a/make/modules/jdk.compiler/Gendata.gmk +++ b/make/modules/jdk.compiler/Gendata.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.javadoc/Gendata.gmk b/make/modules/jdk.javadoc/Gendata.gmk index 95719c7b452..d733af65f1e 100644 --- a/make/modules/jdk.javadoc/Gendata.gmk +++ b/make/modules/jdk.javadoc/Gendata.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.javadoc/Gensrc.gmk b/make/modules/jdk.javadoc/Gensrc.gmk index 0d25ff61e92..0346e3832df 100644 --- a/make/modules/jdk.javadoc/Gensrc.gmk +++ b/make/modules/jdk.javadoc/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.jcmd/Java.gmk b/make/modules/jdk.jcmd/Java.gmk index 2cae8b0fdd5..d19d9beb4d8 100644 --- a/make/modules/jdk.jcmd/Java.gmk +++ b/make/modules/jdk.jcmd/Java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.jconsole/Java.gmk b/make/modules/jdk.jconsole/Java.gmk index b60b84cdc3c..2de9321392d 100644 --- a/make/modules/jdk.jconsole/Java.gmk +++ b/make/modules/jdk.jconsole/Java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.jdeps/Gensrc.gmk b/make/modules/jdk.jdeps/Gensrc.gmk index cb9a27908ce..b5f1e702a75 100644 --- a/make/modules/jdk.jdeps/Gensrc.gmk +++ b/make/modules/jdk.jdeps/Gensrc.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.localedata/Java.gmk b/make/modules/jdk.localedata/Java.gmk index cb12bc560b2..41696a641a7 100644 --- a/make/modules/jdk.localedata/Java.gmk +++ b/make/modules/jdk.localedata/Java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/modules/jdk.sctp/Java.gmk b/make/modules/jdk.sctp/Java.gmk index b1fbdcda9f4..cac0f770816 100644 --- a/make/modules/jdk.sctp/Java.gmk +++ b/make/modules/jdk.sctp/Java.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/test/BuildJtregTestThreadFactory.gmk b/make/test/BuildJtregTestThreadFactory.gmk index aa9808dd584..4f0ead24ece 100644 --- a/make/test/BuildJtregTestThreadFactory.gmk +++ b/make/test/BuildJtregTestThreadFactory.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/test/BuildTestLib.gmk b/make/test/BuildTestLib.gmk index dceae073ff3..56594238261 100644 --- a/make/test/BuildTestLib.gmk +++ b/make/test/BuildTestLib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/make/test/JtregNativeLibTest.gmk b/make/test/JtregNativeLibTest.gmk index 838d37f8145..1a0177e63b0 100644 --- a/make/test/JtregNativeLibTest.gmk +++ b/make/test/JtregNativeLibTest.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/demo/share/java2d/J2DBench/Makefile b/src/demo/share/java2d/J2DBench/Makefile index edc4494e131..d9dd6258329 100644 --- a/src/demo/share/java2d/J2DBench/Makefile +++ b/src/demo/share/java2d/J2DBench/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2024, 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 diff --git a/src/demo/share/java2d/J2DBench/build.xml b/src/demo/share/java2d/J2DBench/build.xml index 415c315899e..2942e5fa260 100644 --- a/src/demo/share/java2d/J2DBench/build.xml +++ b/src/demo/share/java2d/J2DBench/build.xml @@ -1,5 +1,5 @@ * @see #lanewise(VectorOperators.Ternary,byte,byte,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,byte,VectorMask) @@ -2308,9 +2308,10 @@ ByteVector sliceTemplate(int origin, Vector v1) { ByteVector that = (ByteVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + ByteVector iotaVector = (ByteVector) iotaShuffle().toBitsVector(); + ByteVector filter = broadcast((byte)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2338,9 +2339,10 @@ ByteVector slice(int origin, @ForceInline ByteVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((byte)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + ByteVector iotaVector = (ByteVector) iotaShuffle().toBitsVector(); + ByteVector filter = broadcast((byte)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2359,10 +2361,10 @@ ByteVector sliceTemplate(int origin) { ByteVector that = (ByteVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((byte)(origin)))); - iota = iotaShuffle(-origin, 1, true); + ByteVector iotaVector = (ByteVector) iotaShuffle().toBitsVector(); + ByteVector filter = broadcast((byte)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2399,10 +2401,10 @@ ByteVector sliceTemplate(int origin) { ByteVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((byte)(origin)))); - iota = iotaShuffle(-origin, 1, true); + ByteVector iotaVector = (ByteVector) iotaShuffle().toBitsVector(); + ByteVector filter = broadcast((byte)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2425,13 +2427,11 @@ ByteVector sliceTemplate(int origin) { final > ByteVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, byte.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2454,13 +2454,11 @@ ByteVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, byte.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2481,30 +2479,29 @@ ByteVector rearrangeTemplate(Class shuffletype, S shuffle, ByteVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); ByteVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, byte.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); ByteVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, byte.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(ByteSpecies dsp) { + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + assert(dsp.length() == vspecies().length()); byte[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { @@ -2513,16 +2510,18 @@ VectorShuffle toShuffle0(ByteSpecies dsp) { return VectorShuffle.fromArray(dsp, sa, 0); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - ByteSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), byte.class, length(), - shuffleType, byte.class, length(), - this, vsp, - ByteVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + ByteVector idx = this; + ByteVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + ByteVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -4216,9 +4215,10 @@ static final class ByteSpecies extends AbstractSpecies { private ByteSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(byte.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Byte.SIZE); } @@ -4504,6 +4504,7 @@ static ByteSpecies species(VectorShape s) { = new ByteSpecies(VectorShape.S_64_BIT, Byte64Vector.class, Byte64Vector.Byte64Mask.class, + Byte64Vector.Byte64Shuffle.class, Byte64Vector::new); /** Species representing {@link ByteVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -4511,6 +4512,7 @@ static ByteSpecies species(VectorShape s) { = new ByteSpecies(VectorShape.S_128_BIT, Byte128Vector.class, Byte128Vector.Byte128Mask.class, + Byte128Vector.Byte128Shuffle.class, Byte128Vector::new); /** Species representing {@link ByteVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -4518,6 +4520,7 @@ static ByteSpecies species(VectorShape s) { = new ByteSpecies(VectorShape.S_256_BIT, Byte256Vector.class, Byte256Vector.Byte256Mask.class, + Byte256Vector.Byte256Shuffle.class, Byte256Vector::new); /** Species representing {@link ByteVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -4525,6 +4528,7 @@ static ByteSpecies species(VectorShape s) { = new ByteSpecies(VectorShape.S_512_BIT, Byte512Vector.class, Byte512Vector.Byte512Mask.class, + Byte512Vector.Byte512Shuffle.class, Byte512Vector::new); /** Species representing {@link ByteVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -4532,6 +4536,7 @@ static ByteSpecies species(VectorShape s) { = new ByteSpecies(VectorShape.S_Max_BIT, ByteMaxVector.class, ByteMaxVector.ByteMaxMask.class, + ByteMaxVector.ByteMaxShuffle.class, ByteMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java index 37607492645..7d343d4e244 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java @@ -141,24 +141,15 @@ Double128Mask maskFromArray(boolean[] bits) { @ForceInline Double128Shuffle iotaShuffle() { return Double128Shuffle.IOTA; } + @Override @ForceInline Double128Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Double128Shuffle)VectorSupport.shuffleIota(ETYPE, Double128Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Double128Shuffle)VectorSupport.shuffleIota(ETYPE, Double128Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Double128Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Double128Shuffle shuffleFromBytes(byte[] reorder) { return new Double128Shuffle(reorder); } - - @Override - @ForceInline - Double128Shuffle shuffleFromArray(int[] indexes, int i) { return new Double128Shuffle(indexes, i); } + Double128Shuffle shuffleFromArray(int[] indices, int i) { return new Double128Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Double128Mask.class, (Double128Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Double128Shuffle.class); // specialize + public final Double128Shuffle toShuffle() { + return (Double128Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -780,25 +778,28 @@ static Double128Mask maskAll(boolean bit) { static final class Double128Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = double.class; // used by the JVM + static final Class ETYPE = long.class; // used by the JVM - Double128Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Double128Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Double128Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Double128Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Double128Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Double128Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Double128Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public DoubleSpecies vspecies() { return VSPECIES; } @@ -806,47 +807,122 @@ public DoubleSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Double128Shuffle IOTA = new Double128Shuffle(IDENTITY); @Override @ForceInline public Double128Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Double128Shuffle.class, this, VLENGTH, - (s) -> ((Double128Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Double128Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long128Vector toBitsVector() { + return (Long128Vector) super.toBitsVectorTemplate(); + } + + @Override + Long128Vector toBitsVector0() { + return ((Long128Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Double128Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Double128Shuffle.class, this, VLENGTH, - (s) -> ((Double128Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + @Override - public Double128Shuffle rearrange(VectorShuffle shuffle) { - Double128Shuffle s = (Double128Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Double128Mask laneIsValid() { + return (Double128Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Double128Shuffle rearrange(VectorShuffle shuffle) { + Double128Shuffle concreteShuffle = (Double128Shuffle) shuffle; + return (Double128Shuffle) toBitsVector().rearrange(concreteShuffle.cast(LongVector.SPECIES_128)) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Double128Shuffle wrapIndexes() { + Long128Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long128Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long128Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Double128Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Double128Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java index 2e31a802550..a8645badc27 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java @@ -141,24 +141,15 @@ Double256Mask maskFromArray(boolean[] bits) { @ForceInline Double256Shuffle iotaShuffle() { return Double256Shuffle.IOTA; } + @Override @ForceInline Double256Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Double256Shuffle)VectorSupport.shuffleIota(ETYPE, Double256Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Double256Shuffle)VectorSupport.shuffleIota(ETYPE, Double256Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Double256Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Double256Shuffle shuffleFromBytes(byte[] reorder) { return new Double256Shuffle(reorder); } - - @Override - @ForceInline - Double256Shuffle shuffleFromArray(int[] indexes, int i) { return new Double256Shuffle(indexes, i); } + Double256Shuffle shuffleFromArray(int[] indices, int i) { return new Double256Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Double256Mask.class, (Double256Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Double256Shuffle.class); // specialize + public final Double256Shuffle toShuffle() { + return (Double256Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -784,25 +782,28 @@ static Double256Mask maskAll(boolean bit) { static final class Double256Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = double.class; // used by the JVM + static final Class ETYPE = long.class; // used by the JVM - Double256Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Double256Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Double256Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Double256Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Double256Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Double256Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Double256Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public DoubleSpecies vspecies() { return VSPECIES; } @@ -810,47 +811,122 @@ public DoubleSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Double256Shuffle IOTA = new Double256Shuffle(IDENTITY); @Override @ForceInline public Double256Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Double256Shuffle.class, this, VLENGTH, - (s) -> ((Double256Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Double256Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long256Vector toBitsVector() { + return (Long256Vector) super.toBitsVectorTemplate(); + } + + @Override + Long256Vector toBitsVector0() { + return ((Long256Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Double256Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Double256Shuffle.class, this, VLENGTH, - (s) -> ((Double256Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + @Override - public Double256Shuffle rearrange(VectorShuffle shuffle) { - Double256Shuffle s = (Double256Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Double256Mask laneIsValid() { + return (Double256Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Double256Shuffle rearrange(VectorShuffle shuffle) { + Double256Shuffle concreteShuffle = (Double256Shuffle) shuffle; + return (Double256Shuffle) toBitsVector().rearrange(concreteShuffle.cast(LongVector.SPECIES_256)) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Double256Shuffle wrapIndexes() { + Long256Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long256Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long256Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Double256Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Double256Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java index 6ed3dd7325c..64535c67b19 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java @@ -141,24 +141,15 @@ Double512Mask maskFromArray(boolean[] bits) { @ForceInline Double512Shuffle iotaShuffle() { return Double512Shuffle.IOTA; } + @Override @ForceInline Double512Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Double512Shuffle)VectorSupport.shuffleIota(ETYPE, Double512Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Double512Shuffle)VectorSupport.shuffleIota(ETYPE, Double512Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Double512Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Double512Shuffle shuffleFromBytes(byte[] reorder) { return new Double512Shuffle(reorder); } - - @Override - @ForceInline - Double512Shuffle shuffleFromArray(int[] indexes, int i) { return new Double512Shuffle(indexes, i); } + Double512Shuffle shuffleFromArray(int[] indices, int i) { return new Double512Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Double512Mask.class, (Double512Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Double512Shuffle.class); // specialize + public final Double512Shuffle toShuffle() { + return (Double512Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -792,25 +790,28 @@ static Double512Mask maskAll(boolean bit) { static final class Double512Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = double.class; // used by the JVM + static final Class ETYPE = long.class; // used by the JVM - Double512Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Double512Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Double512Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Double512Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Double512Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Double512Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Double512Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public DoubleSpecies vspecies() { return VSPECIES; } @@ -818,47 +819,122 @@ public DoubleSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Double512Shuffle IOTA = new Double512Shuffle(IDENTITY); @Override @ForceInline public Double512Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Double512Shuffle.class, this, VLENGTH, - (s) -> ((Double512Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Double512Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long512Vector toBitsVector() { + return (Long512Vector) super.toBitsVectorTemplate(); + } + + @Override + Long512Vector toBitsVector0() { + return ((Long512Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Double512Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Double512Shuffle.class, this, VLENGTH, - (s) -> ((Double512Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + @Override - public Double512Shuffle rearrange(VectorShuffle shuffle) { - Double512Shuffle s = (Double512Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Double512Mask laneIsValid() { + return (Double512Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Double512Shuffle rearrange(VectorShuffle shuffle) { + Double512Shuffle concreteShuffle = (Double512Shuffle) shuffle; + return (Double512Shuffle) toBitsVector().rearrange(concreteShuffle.cast(LongVector.SPECIES_512)) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Double512Shuffle wrapIndexes() { + Long512Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long512Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long512Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Double512Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Double512Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java index 2e1b2135001..45b91ee88bf 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java @@ -141,24 +141,15 @@ Double64Mask maskFromArray(boolean[] bits) { @ForceInline Double64Shuffle iotaShuffle() { return Double64Shuffle.IOTA; } + @Override @ForceInline Double64Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Double64Shuffle)VectorSupport.shuffleIota(ETYPE, Double64Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Double64Shuffle)VectorSupport.shuffleIota(ETYPE, Double64Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Double64Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Double64Shuffle shuffleFromBytes(byte[] reorder) { return new Double64Shuffle(reorder); } - - @Override - @ForceInline - Double64Shuffle shuffleFromArray(int[] indexes, int i) { return new Double64Shuffle(indexes, i); } + Double64Shuffle shuffleFromArray(int[] indices, int i) { return new Double64Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Double64Mask.class, (Double64Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Double64Shuffle.class); // specialize + public final Double64Shuffle toShuffle() { + return (Double64Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -778,25 +776,28 @@ static Double64Mask maskAll(boolean bit) { static final class Double64Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = double.class; // used by the JVM + static final Class ETYPE = long.class; // used by the JVM - Double64Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Double64Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Double64Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Double64Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Double64Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Double64Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Double64Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public DoubleSpecies vspecies() { return VSPECIES; } @@ -804,47 +805,122 @@ public DoubleSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Double64Shuffle IOTA = new Double64Shuffle(IDENTITY); @Override @ForceInline public Double64Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Double64Shuffle.class, this, VLENGTH, - (s) -> ((Double64Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Double64Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long64Vector toBitsVector() { + return (Long64Vector) super.toBitsVectorTemplate(); + } + + @Override + Long64Vector toBitsVector0() { + return ((Long64Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Double64Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Double64Shuffle.class, this, VLENGTH, - (s) -> ((Double64Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + @Override - public Double64Shuffle rearrange(VectorShuffle shuffle) { - Double64Shuffle s = (Double64Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Double64Mask laneIsValid() { + return (Double64Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Double64Shuffle rearrange(VectorShuffle shuffle) { + Double64Shuffle concreteShuffle = (Double64Shuffle) shuffle; + return (Double64Shuffle) toBitsVector().rearrange(concreteShuffle.cast(LongVector.SPECIES_64)) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Double64Shuffle wrapIndexes() { + Long64Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long64Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long64Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Double64Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Double64Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java index 8d69b6fcbc7..03f9448f1ab 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java @@ -141,24 +141,15 @@ DoubleMaxMask maskFromArray(boolean[] bits) { @ForceInline DoubleMaxShuffle iotaShuffle() { return DoubleMaxShuffle.IOTA; } + @Override @ForceInline DoubleMaxShuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (DoubleMaxShuffle)VectorSupport.shuffleIota(ETYPE, DoubleMaxShuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (DoubleMaxShuffle)VectorSupport.shuffleIota(ETYPE, DoubleMaxShuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (DoubleMaxShuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - DoubleMaxShuffle shuffleFromBytes(byte[] reorder) { return new DoubleMaxShuffle(reorder); } - - @Override - @ForceInline - DoubleMaxShuffle shuffleFromArray(int[] indexes, int i) { return new DoubleMaxShuffle(indexes, i); } + DoubleMaxShuffle shuffleFromArray(int[] indices, int i) { return new DoubleMaxShuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, DoubleMaxMask.class, (DoubleMaxMask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(DoubleMaxShuffle.class); // specialize + public final DoubleMaxShuffle toShuffle() { + return (DoubleMaxShuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -777,25 +775,28 @@ static DoubleMaxMask maskAll(boolean bit) { static final class DoubleMaxShuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = double.class; // used by the JVM + static final Class ETYPE = long.class; // used by the JVM - DoubleMaxShuffle(byte[] reorder) { - super(VLENGTH, reorder); + DoubleMaxShuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public DoubleMaxShuffle(int[] reorder) { - super(VLENGTH, reorder); + DoubleMaxShuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public DoubleMaxShuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + DoubleMaxShuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public DoubleMaxShuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public DoubleSpecies vspecies() { return VSPECIES; } @@ -803,47 +804,122 @@ public DoubleSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final DoubleMaxShuffle IOTA = new DoubleMaxShuffle(IDENTITY); @Override @ForceInline public DoubleMaxVector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, DoubleMaxShuffle.class, this, VLENGTH, - (s) -> ((DoubleMaxVector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (DoubleMaxVector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + LongMaxVector toBitsVector() { + return (LongMaxVector) super.toBitsVectorTemplate(); + } + + @Override + LongMaxVector toBitsVector0() { + return ((LongMaxVector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public DoubleMaxShuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, DoubleMaxShuffle.class, this, VLENGTH, - (s) -> ((DoubleMaxShuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + @Override - public DoubleMaxShuffle rearrange(VectorShuffle shuffle) { - DoubleMaxShuffle s = (DoubleMaxShuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final DoubleMaxMask laneIsValid() { + return (DoubleMaxMask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final DoubleMaxShuffle rearrange(VectorShuffle shuffle) { + DoubleMaxShuffle concreteShuffle = (DoubleMaxShuffle) shuffle; + return (DoubleMaxShuffle) toBitsVector().rearrange(concreteShuffle.cast(LongVector.SPECIES_MAX)) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final DoubleMaxShuffle wrapIndexes() { + LongMaxVector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (LongMaxVector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (LongMaxVector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (DoubleMaxShuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new DoubleMaxShuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index 5b3a25baa58..8065bf915a5 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java @@ -966,7 +966,7 @@ DoubleVector lanewise(VectorOperators.Binary op, // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,double,double,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,double,VectorMask) @@ -2138,9 +2138,10 @@ DoubleVector sliceTemplate(int origin, Vector v1) { DoubleVector that = (DoubleVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((double)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = LongVector.broadcast((LongVector.LongSpecies) vspecies().asIntegral(), (long)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2168,9 +2169,10 @@ DoubleVector slice(int origin, @ForceInline DoubleVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((double)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = LongVector.broadcast((LongVector.LongSpecies) vspecies().asIntegral(), (long)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2189,10 +2191,10 @@ DoubleVector sliceTemplate(int origin) { DoubleVector that = (DoubleVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((double)(origin)))); - iota = iotaShuffle(-origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = LongVector.broadcast((LongVector.LongSpecies) vspecies().asIntegral(), (long)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2229,10 +2231,10 @@ DoubleVector sliceTemplate(int origin) { DoubleVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((double)(origin)))); - iota = iotaShuffle(-origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = LongVector.broadcast((LongVector.LongSpecies) vspecies().asIntegral(), (long)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2255,13 +2257,11 @@ DoubleVector sliceTemplate(int origin) { final > DoubleVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, double.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2284,13 +2284,11 @@ DoubleVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, double.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2311,48 +2309,43 @@ DoubleVector rearrangeTemplate(Class shuffletype, S shuffle, DoubleVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); DoubleVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, double.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); DoubleVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, double.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(DoubleSpecies dsp) { - double[] a = toArray(); - int[] sa = new int[a.length]; - for (int i = 0; i < a.length; i++) { - sa[i] = (int) a[i]; - } - return VectorShuffle.fromArray(dsp, sa, 0); + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + throw new AssertionError(); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - DoubleSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), double.class, length(), - shuffleType, byte.class, length(), - this, vsp, - DoubleVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + LongVector idx = convert(VectorOperators.D2L, 0).reinterpretAsLongs(); + LongVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + LongVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -3731,9 +3724,10 @@ static final class DoubleSpecies extends AbstractSpecies { private DoubleSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(double.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Double.SIZE); } @@ -4019,6 +4013,7 @@ static DoubleSpecies species(VectorShape s) { = new DoubleSpecies(VectorShape.S_64_BIT, Double64Vector.class, Double64Vector.Double64Mask.class, + Double64Vector.Double64Shuffle.class, Double64Vector::new); /** Species representing {@link DoubleVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -4026,6 +4021,7 @@ static DoubleSpecies species(VectorShape s) { = new DoubleSpecies(VectorShape.S_128_BIT, Double128Vector.class, Double128Vector.Double128Mask.class, + Double128Vector.Double128Shuffle.class, Double128Vector::new); /** Species representing {@link DoubleVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -4033,6 +4029,7 @@ static DoubleSpecies species(VectorShape s) { = new DoubleSpecies(VectorShape.S_256_BIT, Double256Vector.class, Double256Vector.Double256Mask.class, + Double256Vector.Double256Shuffle.class, Double256Vector::new); /** Species representing {@link DoubleVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -4040,6 +4037,7 @@ static DoubleSpecies species(VectorShape s) { = new DoubleSpecies(VectorShape.S_512_BIT, Double512Vector.class, Double512Vector.Double512Mask.class, + Double512Vector.Double512Shuffle.class, Double512Vector::new); /** Species representing {@link DoubleVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -4047,6 +4045,7 @@ static DoubleSpecies species(VectorShape s) { = new DoubleSpecies(VectorShape.S_Max_BIT, DoubleMaxVector.class, DoubleMaxVector.DoubleMaxMask.class, + DoubleMaxVector.DoubleMaxShuffle.class, DoubleMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java index 79239532cc6..77301e4c773 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java @@ -141,24 +141,15 @@ Float128Mask maskFromArray(boolean[] bits) { @ForceInline Float128Shuffle iotaShuffle() { return Float128Shuffle.IOTA; } + @Override @ForceInline Float128Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Float128Shuffle)VectorSupport.shuffleIota(ETYPE, Float128Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Float128Shuffle)VectorSupport.shuffleIota(ETYPE, Float128Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Float128Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Float128Shuffle shuffleFromBytes(byte[] reorder) { return new Float128Shuffle(reorder); } - - @Override - @ForceInline - Float128Shuffle shuffleFromArray(int[] indexes, int i) { return new Float128Shuffle(indexes, i); } + Float128Shuffle shuffleFromArray(int[] indices, int i) { return new Float128Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Float128Mask.class, (Float128Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Float128Shuffle.class); // specialize + public final Float128Shuffle toShuffle() { + return (Float128Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -784,25 +782,28 @@ static Float128Mask maskAll(boolean bit) { static final class Float128Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = float.class; // used by the JVM + static final Class ETYPE = int.class; // used by the JVM - Float128Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Float128Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Float128Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Float128Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Float128Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Float128Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Float128Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public FloatSpecies vspecies() { return VSPECIES; } @@ -810,47 +811,98 @@ public FloatSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Float128Shuffle IOTA = new Float128Shuffle(IDENTITY); @Override @ForceInline public Float128Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Float128Shuffle.class, this, VLENGTH, - (s) -> ((Float128Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Float128Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int128Vector toBitsVector() { + return (Int128Vector) super.toBitsVectorTemplate(); + } + + @Override + Int128Vector toBitsVector0() { + return ((Int128Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); } @Override @ForceInline - public Float128Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Float128Shuffle.class, this, VLENGTH, - (s) -> ((Float128Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public final Float128Mask laneIsValid() { + return (Float128Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Float128Shuffle rearrange(VectorShuffle shuffle) { + Float128Shuffle concreteShuffle = (Float128Shuffle) shuffle; + return (Float128Shuffle) toBitsVector().rearrange(concreteShuffle.cast(IntVector.SPECIES_128)) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Float128Shuffle rearrange(VectorShuffle shuffle) { - Float128Shuffle s = (Float128Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Float128Shuffle wrapIndexes() { + Int128Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int128Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int128Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Float128Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Float128Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java index 5f5a26fd316..f81a9adda42 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java @@ -141,24 +141,15 @@ Float256Mask maskFromArray(boolean[] bits) { @ForceInline Float256Shuffle iotaShuffle() { return Float256Shuffle.IOTA; } + @Override @ForceInline Float256Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Float256Shuffle)VectorSupport.shuffleIota(ETYPE, Float256Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Float256Shuffle)VectorSupport.shuffleIota(ETYPE, Float256Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Float256Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Float256Shuffle shuffleFromBytes(byte[] reorder) { return new Float256Shuffle(reorder); } - - @Override - @ForceInline - Float256Shuffle shuffleFromArray(int[] indexes, int i) { return new Float256Shuffle(indexes, i); } + Float256Shuffle shuffleFromArray(int[] indices, int i) { return new Float256Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Float256Mask.class, (Float256Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Float256Shuffle.class); // specialize + public final Float256Shuffle toShuffle() { + return (Float256Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -792,25 +790,28 @@ static Float256Mask maskAll(boolean bit) { static final class Float256Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = float.class; // used by the JVM + static final Class ETYPE = int.class; // used by the JVM - Float256Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Float256Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Float256Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Float256Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Float256Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Float256Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Float256Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public FloatSpecies vspecies() { return VSPECIES; } @@ -818,47 +819,98 @@ public FloatSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Float256Shuffle IOTA = new Float256Shuffle(IDENTITY); @Override @ForceInline public Float256Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Float256Shuffle.class, this, VLENGTH, - (s) -> ((Float256Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Float256Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int256Vector toBitsVector() { + return (Int256Vector) super.toBitsVectorTemplate(); + } + + @Override + Int256Vector toBitsVector0() { + return ((Int256Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); } @Override @ForceInline - public Float256Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Float256Shuffle.class, this, VLENGTH, - (s) -> ((Float256Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public final Float256Mask laneIsValid() { + return (Float256Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Float256Shuffle rearrange(VectorShuffle shuffle) { + Float256Shuffle concreteShuffle = (Float256Shuffle) shuffle; + return (Float256Shuffle) toBitsVector().rearrange(concreteShuffle.cast(IntVector.SPECIES_256)) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Float256Shuffle rearrange(VectorShuffle shuffle) { - Float256Shuffle s = (Float256Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Float256Shuffle wrapIndexes() { + Int256Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int256Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int256Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Float256Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Float256Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java index f8c191ea016..1cf6afca4b4 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java @@ -141,24 +141,15 @@ Float512Mask maskFromArray(boolean[] bits) { @ForceInline Float512Shuffle iotaShuffle() { return Float512Shuffle.IOTA; } + @Override @ForceInline Float512Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Float512Shuffle)VectorSupport.shuffleIota(ETYPE, Float512Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Float512Shuffle)VectorSupport.shuffleIota(ETYPE, Float512Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Float512Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Float512Shuffle shuffleFromBytes(byte[] reorder) { return new Float512Shuffle(reorder); } - - @Override - @ForceInline - Float512Shuffle shuffleFromArray(int[] indexes, int i) { return new Float512Shuffle(indexes, i); } + Float512Shuffle shuffleFromArray(int[] indices, int i) { return new Float512Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Float512Mask.class, (Float512Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Float512Shuffle.class); // specialize + public final Float512Shuffle toShuffle() { + return (Float512Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -808,25 +806,28 @@ static Float512Mask maskAll(boolean bit) { static final class Float512Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = float.class; // used by the JVM + static final Class ETYPE = int.class; // used by the JVM - Float512Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Float512Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Float512Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Float512Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Float512Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Float512Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Float512Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public FloatSpecies vspecies() { return VSPECIES; } @@ -834,47 +835,98 @@ public FloatSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Float512Shuffle IOTA = new Float512Shuffle(IDENTITY); @Override @ForceInline public Float512Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Float512Shuffle.class, this, VLENGTH, - (s) -> ((Float512Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Float512Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int512Vector toBitsVector() { + return (Int512Vector) super.toBitsVectorTemplate(); + } + + @Override + Int512Vector toBitsVector0() { + return ((Int512Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); } @Override @ForceInline - public Float512Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Float512Shuffle.class, this, VLENGTH, - (s) -> ((Float512Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public final Float512Mask laneIsValid() { + return (Float512Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Float512Shuffle rearrange(VectorShuffle shuffle) { + Float512Shuffle concreteShuffle = (Float512Shuffle) shuffle; + return (Float512Shuffle) toBitsVector().rearrange(concreteShuffle.cast(IntVector.SPECIES_512)) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Float512Shuffle rearrange(VectorShuffle shuffle) { - Float512Shuffle s = (Float512Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Float512Shuffle wrapIndexes() { + Int512Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int512Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int512Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Float512Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Float512Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java index 9496e598868..1974b93d0ae 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java @@ -141,24 +141,15 @@ Float64Mask maskFromArray(boolean[] bits) { @ForceInline Float64Shuffle iotaShuffle() { return Float64Shuffle.IOTA; } + @Override @ForceInline Float64Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Float64Shuffle)VectorSupport.shuffleIota(ETYPE, Float64Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Float64Shuffle)VectorSupport.shuffleIota(ETYPE, Float64Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Float64Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Float64Shuffle shuffleFromBytes(byte[] reorder) { return new Float64Shuffle(reorder); } - - @Override - @ForceInline - Float64Shuffle shuffleFromArray(int[] indexes, int i) { return new Float64Shuffle(indexes, i); } + Float64Shuffle shuffleFromArray(int[] indices, int i) { return new Float64Shuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Float64Mask.class, (Float64Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Float64Shuffle.class); // specialize + public final Float64Shuffle toShuffle() { + return (Float64Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -780,25 +778,28 @@ static Float64Mask maskAll(boolean bit) { static final class Float64Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = float.class; // used by the JVM + static final Class ETYPE = int.class; // used by the JVM - Float64Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Float64Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Float64Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Float64Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Float64Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Float64Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Float64Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public FloatSpecies vspecies() { return VSPECIES; } @@ -806,47 +807,98 @@ public FloatSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Float64Shuffle IOTA = new Float64Shuffle(IDENTITY); @Override @ForceInline public Float64Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Float64Shuffle.class, this, VLENGTH, - (s) -> ((Float64Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (Float64Vector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int64Vector toBitsVector() { + return (Int64Vector) super.toBitsVectorTemplate(); + } + + @Override + Int64Vector toBitsVector0() { + return ((Int64Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); } @Override @ForceInline - public Float64Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Float64Shuffle.class, this, VLENGTH, - (s) -> ((Float64Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public final Float64Mask laneIsValid() { + return (Float64Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Float64Shuffle rearrange(VectorShuffle shuffle) { + Float64Shuffle concreteShuffle = (Float64Shuffle) shuffle; + return (Float64Shuffle) toBitsVector().rearrange(concreteShuffle.cast(IntVector.SPECIES_64)) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Float64Shuffle rearrange(VectorShuffle shuffle) { - Float64Shuffle s = (Float64Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Float64Shuffle wrapIndexes() { + Int64Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int64Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int64Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Float64Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Float64Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java index 6f093957262..14981d02151 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java @@ -141,24 +141,15 @@ FloatMaxMask maskFromArray(boolean[] bits) { @ForceInline FloatMaxShuffle iotaShuffle() { return FloatMaxShuffle.IOTA; } + @Override @ForceInline FloatMaxShuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (FloatMaxShuffle)VectorSupport.shuffleIota(ETYPE, FloatMaxShuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (FloatMaxShuffle)VectorSupport.shuffleIota(ETYPE, FloatMaxShuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (FloatMaxShuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - FloatMaxShuffle shuffleFromBytes(byte[] reorder) { return new FloatMaxShuffle(reorder); } - - @Override - @ForceInline - FloatMaxShuffle shuffleFromArray(int[] indexes, int i) { return new FloatMaxShuffle(indexes, i); } + FloatMaxShuffle shuffleFromArray(int[] indices, int i) { return new FloatMaxShuffle(indices, i); } @Override @ForceInline @@ -344,9 +335,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, FloatMaxMask.class, (FloatMaxMask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + throw new AssertionError(); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(FloatMaxShuffle.class); // specialize + public final FloatMaxShuffle toShuffle() { + return (FloatMaxShuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -777,25 +775,28 @@ static FloatMaxMask maskAll(boolean bit) { static final class FloatMaxShuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class ETYPE = float.class; // used by the JVM + static final Class ETYPE = int.class; // used by the JVM - FloatMaxShuffle(byte[] reorder) { - super(VLENGTH, reorder); + FloatMaxShuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public FloatMaxShuffle(int[] reorder) { - super(VLENGTH, reorder); + FloatMaxShuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public FloatMaxShuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + FloatMaxShuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public FloatMaxShuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public FloatSpecies vspecies() { return VSPECIES; } @@ -803,47 +804,98 @@ public FloatSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final FloatMaxShuffle IOTA = new FloatMaxShuffle(IDENTITY); @Override @ForceInline public FloatMaxVector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, FloatMaxShuffle.class, this, VLENGTH, - (s) -> ((FloatMaxVector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return (FloatMaxVector) toBitsVector().castShape(vspecies(), 0); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + IntMaxVector toBitsVector() { + return (IntMaxVector) super.toBitsVectorTemplate(); + } + + @Override + IntMaxVector toBitsVector0() { + return ((IntMaxVector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); } @Override @ForceInline - public FloatMaxShuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, FloatMaxShuffle.class, this, VLENGTH, - (s) -> ((FloatMaxShuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public final FloatMaxMask laneIsValid() { + return (FloatMaxMask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final FloatMaxShuffle rearrange(VectorShuffle shuffle) { + FloatMaxShuffle concreteShuffle = (FloatMaxShuffle) shuffle; + return (FloatMaxShuffle) toBitsVector().rearrange(concreteShuffle.cast(IntVector.SPECIES_MAX)) + .toShuffle(vspecies(), false); } @ForceInline @Override - public FloatMaxShuffle rearrange(VectorShuffle shuffle) { - FloatMaxShuffle s = (FloatMaxShuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final FloatMaxShuffle wrapIndexes() { + IntMaxVector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (IntMaxVector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (IntMaxVector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (FloatMaxShuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new FloatMaxShuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index a3686d467a7..ab056d1c397 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java @@ -966,7 +966,7 @@ FloatVector lanewise(VectorOperators.Binary op, // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,float,float,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,float,VectorMask) @@ -2150,9 +2150,10 @@ FloatVector sliceTemplate(int origin, Vector v1) { FloatVector that = (FloatVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((float)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = IntVector.broadcast((IntVector.IntSpecies) vspecies().asIntegral(), (int)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2180,9 +2181,10 @@ FloatVector slice(int origin, @ForceInline FloatVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((float)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = IntVector.broadcast((IntVector.IntSpecies) vspecies().asIntegral(), (int)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2201,10 +2203,10 @@ FloatVector sliceTemplate(int origin) { FloatVector that = (FloatVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((float)(origin)))); - iota = iotaShuffle(-origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = IntVector.broadcast((IntVector.IntSpecies) vspecies().asIntegral(), (int)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2241,10 +2243,10 @@ FloatVector sliceTemplate(int origin) { FloatVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((float)(origin)))); - iota = iotaShuffle(-origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = IntVector.broadcast((IntVector.IntSpecies) vspecies().asIntegral(), (int)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter).cast(vspecies()); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2267,13 +2269,11 @@ FloatVector sliceTemplate(int origin) { final > FloatVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, float.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2296,13 +2296,11 @@ FloatVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, float.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2323,48 +2321,43 @@ FloatVector rearrangeTemplate(Class shuffletype, S shuffle, FloatVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); FloatVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, float.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); FloatVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, float.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(FloatSpecies dsp) { - float[] a = toArray(); - int[] sa = new int[a.length]; - for (int i = 0; i < a.length; i++) { - sa[i] = (int) a[i]; - } - return VectorShuffle.fromArray(dsp, sa, 0); + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + throw new AssertionError(); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - FloatSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), float.class, length(), - shuffleType, byte.class, length(), - this, vsp, - FloatVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + IntVector idx = convert(VectorOperators.F2I, 0).reinterpretAsInts(); + IntVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + IntVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -3681,9 +3674,10 @@ static final class FloatSpecies extends AbstractSpecies { private FloatSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(float.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Float.SIZE); } @@ -3969,6 +3963,7 @@ static FloatSpecies species(VectorShape s) { = new FloatSpecies(VectorShape.S_64_BIT, Float64Vector.class, Float64Vector.Float64Mask.class, + Float64Vector.Float64Shuffle.class, Float64Vector::new); /** Species representing {@link FloatVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -3976,6 +3971,7 @@ static FloatSpecies species(VectorShape s) { = new FloatSpecies(VectorShape.S_128_BIT, Float128Vector.class, Float128Vector.Float128Mask.class, + Float128Vector.Float128Shuffle.class, Float128Vector::new); /** Species representing {@link FloatVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -3983,6 +3979,7 @@ static FloatSpecies species(VectorShape s) { = new FloatSpecies(VectorShape.S_256_BIT, Float256Vector.class, Float256Vector.Float256Mask.class, + Float256Vector.Float256Shuffle.class, Float256Vector::new); /** Species representing {@link FloatVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -3990,6 +3987,7 @@ static FloatSpecies species(VectorShape s) { = new FloatSpecies(VectorShape.S_512_BIT, Float512Vector.class, Float512Vector.Float512Mask.class, + Float512Vector.Float512Shuffle.class, Float512Vector::new); /** Species representing {@link FloatVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -3997,6 +3995,7 @@ static FloatSpecies species(VectorShape s) { = new FloatSpecies(VectorShape.S_Max_BIT, FloatMaxVector.class, FloatMaxVector.FloatMaxMask.class, + FloatMaxVector.FloatMaxShuffle.class, FloatMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java index 4aa1e8044b0..a4660dd94c6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java @@ -141,24 +141,15 @@ Int128Mask maskFromArray(boolean[] bits) { @ForceInline Int128Shuffle iotaShuffle() { return Int128Shuffle.IOTA; } + @Override @ForceInline Int128Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Int128Shuffle)VectorSupport.shuffleIota(ETYPE, Int128Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Int128Shuffle)VectorSupport.shuffleIota(ETYPE, Int128Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Int128Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Int128Shuffle shuffleFromBytes(byte[] reorder) { return new Int128Shuffle(reorder); } - - @Override - @ForceInline - Int128Shuffle shuffleFromArray(int[] indexes, int i) { return new Int128Shuffle(indexes, i); } + Int128Shuffle shuffleFromArray(int[] indices, int i) { return new Int128Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Int128Mask.class, (Int128Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Int128Shuffle.class); // specialize + public final Int128Shuffle toShuffle() { + return (Int128Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -797,23 +795,26 @@ static final class Int128Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = int.class; // used by the JVM - Int128Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Int128Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Int128Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Int128Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Int128Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Int128Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Int128Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public IntSpecies vspecies() { return VSPECIES; } @@ -821,47 +822,98 @@ public IntSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Int128Shuffle IOTA = new Int128Shuffle(IDENTITY); @Override @ForceInline public Int128Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Int128Shuffle.class, this, VLENGTH, - (s) -> ((Int128Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int128Vector toBitsVector() { + return (Int128Vector) super.toBitsVectorTemplate(); + } + + @Override + Int128Vector toBitsVector0() { + return ((Int128Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Int128Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Int128Shuffle.class, this, VLENGTH, - (s) -> ((Int128Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); + } + @Override - public Int128Shuffle rearrange(VectorShuffle shuffle) { - Int128Shuffle s = (Int128Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Int128Mask laneIsValid() { + return (Int128Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Int128Shuffle rearrange(VectorShuffle shuffle) { + Int128Shuffle concreteShuffle = (Int128Shuffle) shuffle; + return (Int128Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Int128Shuffle wrapIndexes() { + Int128Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int128Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int128Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Int128Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Int128Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java index 753f96f216f..284ee1cebca 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java @@ -141,24 +141,15 @@ Int256Mask maskFromArray(boolean[] bits) { @ForceInline Int256Shuffle iotaShuffle() { return Int256Shuffle.IOTA; } + @Override @ForceInline Int256Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Int256Shuffle)VectorSupport.shuffleIota(ETYPE, Int256Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Int256Shuffle)VectorSupport.shuffleIota(ETYPE, Int256Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Int256Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Int256Shuffle shuffleFromBytes(byte[] reorder) { return new Int256Shuffle(reorder); } - - @Override - @ForceInline - Int256Shuffle shuffleFromArray(int[] indexes, int i) { return new Int256Shuffle(indexes, i); } + Int256Shuffle shuffleFromArray(int[] indices, int i) { return new Int256Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Int256Mask.class, (Int256Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Int256Shuffle.class); // specialize + public final Int256Shuffle toShuffle() { + return (Int256Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -805,23 +803,26 @@ static final class Int256Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = int.class; // used by the JVM - Int256Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Int256Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Int256Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Int256Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Int256Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Int256Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Int256Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public IntSpecies vspecies() { return VSPECIES; } @@ -829,47 +830,98 @@ public IntSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Int256Shuffle IOTA = new Int256Shuffle(IDENTITY); @Override @ForceInline public Int256Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Int256Shuffle.class, this, VLENGTH, - (s) -> ((Int256Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int256Vector toBitsVector() { + return (Int256Vector) super.toBitsVectorTemplate(); + } + + @Override + Int256Vector toBitsVector0() { + return ((Int256Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Int256Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Int256Shuffle.class, this, VLENGTH, - (s) -> ((Int256Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); + } + @Override - public Int256Shuffle rearrange(VectorShuffle shuffle) { - Int256Shuffle s = (Int256Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Int256Mask laneIsValid() { + return (Int256Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Int256Shuffle rearrange(VectorShuffle shuffle) { + Int256Shuffle concreteShuffle = (Int256Shuffle) shuffle; + return (Int256Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Int256Shuffle wrapIndexes() { + Int256Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int256Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int256Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Int256Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Int256Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java index 8e6ed6fc882..f0c8ddabfae 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java @@ -141,24 +141,15 @@ Int512Mask maskFromArray(boolean[] bits) { @ForceInline Int512Shuffle iotaShuffle() { return Int512Shuffle.IOTA; } + @Override @ForceInline Int512Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Int512Shuffle)VectorSupport.shuffleIota(ETYPE, Int512Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Int512Shuffle)VectorSupport.shuffleIota(ETYPE, Int512Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Int512Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Int512Shuffle shuffleFromBytes(byte[] reorder) { return new Int512Shuffle(reorder); } - - @Override - @ForceInline - Int512Shuffle shuffleFromArray(int[] indexes, int i) { return new Int512Shuffle(indexes, i); } + Int512Shuffle shuffleFromArray(int[] indices, int i) { return new Int512Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Int512Mask.class, (Int512Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Int512Shuffle.class); // specialize + public final Int512Shuffle toShuffle() { + return (Int512Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -821,23 +819,26 @@ static final class Int512Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = int.class; // used by the JVM - Int512Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Int512Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Int512Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Int512Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Int512Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Int512Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Int512Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public IntSpecies vspecies() { return VSPECIES; } @@ -845,47 +846,98 @@ public IntSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Int512Shuffle IOTA = new Int512Shuffle(IDENTITY); @Override @ForceInline public Int512Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Int512Shuffle.class, this, VLENGTH, - (s) -> ((Int512Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int512Vector toBitsVector() { + return (Int512Vector) super.toBitsVectorTemplate(); + } + + @Override + Int512Vector toBitsVector0() { + return ((Int512Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Int512Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Int512Shuffle.class, this, VLENGTH, - (s) -> ((Int512Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); + } + @Override - public Int512Shuffle rearrange(VectorShuffle shuffle) { - Int512Shuffle s = (Int512Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Int512Mask laneIsValid() { + return (Int512Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Int512Shuffle rearrange(VectorShuffle shuffle) { + Int512Shuffle concreteShuffle = (Int512Shuffle) shuffle; + return (Int512Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Int512Shuffle wrapIndexes() { + Int512Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int512Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int512Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Int512Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Int512Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java index 98cd39d9beb..27963859a09 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java @@ -141,24 +141,15 @@ Int64Mask maskFromArray(boolean[] bits) { @ForceInline Int64Shuffle iotaShuffle() { return Int64Shuffle.IOTA; } + @Override @ForceInline Int64Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Int64Shuffle)VectorSupport.shuffleIota(ETYPE, Int64Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Int64Shuffle)VectorSupport.shuffleIota(ETYPE, Int64Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Int64Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Int64Shuffle shuffleFromBytes(byte[] reorder) { return new Int64Shuffle(reorder); } - - @Override - @ForceInline - Int64Shuffle shuffleFromArray(int[] indexes, int i) { return new Int64Shuffle(indexes, i); } + Int64Shuffle shuffleFromArray(int[] indices, int i) { return new Int64Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Int64Mask.class, (Int64Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Int64Shuffle.class); // specialize + public final Int64Shuffle toShuffle() { + return (Int64Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -793,23 +791,26 @@ static final class Int64Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = int.class; // used by the JVM - Int64Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Int64Shuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Int64Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Int64Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Int64Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Int64Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Int64Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public IntSpecies vspecies() { return VSPECIES; } @@ -817,47 +818,98 @@ public IntSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final Int64Shuffle IOTA = new Int64Shuffle(IDENTITY); @Override @ForceInline public Int64Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Int64Shuffle.class, this, VLENGTH, - (s) -> ((Int64Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Int64Vector toBitsVector() { + return (Int64Vector) super.toBitsVectorTemplate(); + } + + @Override + Int64Vector toBitsVector0() { + return ((Int64Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Int64Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Int64Shuffle.class, this, VLENGTH, - (s) -> ((Int64Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); + } + @Override - public Int64Shuffle rearrange(VectorShuffle shuffle) { - Int64Shuffle s = (Int64Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Int64Mask laneIsValid() { + return (Int64Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Int64Shuffle rearrange(VectorShuffle shuffle) { + Int64Shuffle concreteShuffle = (Int64Shuffle) shuffle; + return (Int64Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Int64Shuffle wrapIndexes() { + Int64Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Int64Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Int64Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Int64Shuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Int64Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java index f301161b980..d5140567ca0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java @@ -141,24 +141,15 @@ IntMaxMask maskFromArray(boolean[] bits) { @ForceInline IntMaxShuffle iotaShuffle() { return IntMaxShuffle.IOTA; } + @Override @ForceInline IntMaxShuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (IntMaxShuffle)VectorSupport.shuffleIota(ETYPE, IntMaxShuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (IntMaxShuffle)VectorSupport.shuffleIota(ETYPE, IntMaxShuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (IntMaxShuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - IntMaxShuffle shuffleFromBytes(byte[] reorder) { return new IntMaxShuffle(reorder); } - - @Override - @ForceInline - IntMaxShuffle shuffleFromArray(int[] indexes, int i) { return new IntMaxShuffle(indexes, i); } + IntMaxShuffle shuffleFromArray(int[] indices, int i) { return new IntMaxShuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, IntMaxMask.class, (IntMaxMask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(IntMaxShuffle.class); // specialize + public final IntMaxShuffle toShuffle() { + return (IntMaxShuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -802,23 +800,26 @@ static final class IntMaxShuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = int.class; // used by the JVM - IntMaxShuffle(byte[] reorder) { - super(VLENGTH, reorder); + IntMaxShuffle(int[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public IntMaxShuffle(int[] reorder) { - super(VLENGTH, reorder); + IntMaxShuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public IntMaxShuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + IntMaxShuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public IntMaxShuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + int[] indices() { + return (int[])getPayload(); } @Override + @ForceInline public IntSpecies vspecies() { return VSPECIES; } @@ -826,47 +827,98 @@ public IntSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Integer.MAX_VALUE); + assert(Integer.MIN_VALUE <= -VLENGTH); } static final IntMaxShuffle IOTA = new IntMaxShuffle(IDENTITY); @Override @ForceInline public IntMaxVector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, IntMaxShuffle.class, this, VLENGTH, - (s) -> ((IntMaxVector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + IntMaxVector toBitsVector() { + return (IntMaxVector) super.toBitsVectorTemplate(); + } + + @Override + IntMaxVector toBitsVector0() { + return ((IntMaxVector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public IntMaxShuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, IntMaxShuffle.class, this, VLENGTH, - (s) -> ((IntMaxShuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + toBitsVector().intoArray(a, offset); + } + @Override - public IntMaxShuffle rearrange(VectorShuffle shuffle) { - IntMaxShuffle s = (IntMaxShuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final IntMaxMask laneIsValid() { + return (IntMaxMask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final IntMaxShuffle rearrange(VectorShuffle shuffle) { + IntMaxShuffle concreteShuffle = (IntMaxShuffle) shuffle; + return (IntMaxShuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final IntMaxShuffle wrapIndexes() { + IntMaxVector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (IntMaxVector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (IntMaxVector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (IntMaxShuffle) v.toShuffle(vspecies(), false); + } + + private static int[] prepare(int[] indices, int offset) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static int[] prepare(IntUnaryOperator f) { + int[] a = new int[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (int)si; + } + return a; + } + + private static boolean indicesInRange(int[] indices) { + int length = indices.length; + for (int si : indices) { + if (si >= (int)length || si < (int)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new IntMaxShuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index 390c8026083..063b0c0d8e8 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java @@ -1099,7 +1099,7 @@ private static VectorBroadcastIntOp> broadcastInt // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,int,int,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,int,VectorMask) @@ -2293,9 +2293,10 @@ IntVector sliceTemplate(int origin, Vector v1) { IntVector that = (IntVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((int)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = broadcast((int)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2323,9 +2324,10 @@ IntVector slice(int origin, @ForceInline IntVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((int)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = broadcast((int)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2344,10 +2346,10 @@ IntVector sliceTemplate(int origin) { IntVector that = (IntVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((int)(origin)))); - iota = iotaShuffle(-origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = broadcast((int)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2384,10 +2386,10 @@ IntVector sliceTemplate(int origin) { IntVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((int)(origin)))); - iota = iotaShuffle(-origin, 1, true); + IntVector iotaVector = (IntVector) iotaShuffle().toBitsVector(); + IntVector filter = broadcast((int)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2410,13 +2412,11 @@ IntVector sliceTemplate(int origin) { final > IntVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, int.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2439,13 +2439,11 @@ IntVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, int.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2466,30 +2464,29 @@ IntVector rearrangeTemplate(Class shuffletype, S shuffle, IntVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); IntVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, int.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); IntVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, int.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(IntSpecies dsp) { + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + assert(dsp.length() == vspecies().length()); int[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { @@ -2498,16 +2495,18 @@ VectorShuffle toShuffle0(IntSpecies dsp) { return VectorShuffle.fromArray(dsp, sa, 0); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - IntSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), int.class, length(), - shuffleType, byte.class, length(), - this, vsp, - IntVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + IntVector idx = this; + IntVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + IntVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -3849,9 +3848,10 @@ static final class IntSpecies extends AbstractSpecies { private IntSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(int.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Integer.SIZE); } @@ -4137,6 +4137,7 @@ static IntSpecies species(VectorShape s) { = new IntSpecies(VectorShape.S_64_BIT, Int64Vector.class, Int64Vector.Int64Mask.class, + Int64Vector.Int64Shuffle.class, Int64Vector::new); /** Species representing {@link IntVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -4144,6 +4145,7 @@ static IntSpecies species(VectorShape s) { = new IntSpecies(VectorShape.S_128_BIT, Int128Vector.class, Int128Vector.Int128Mask.class, + Int128Vector.Int128Shuffle.class, Int128Vector::new); /** Species representing {@link IntVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -4151,6 +4153,7 @@ static IntSpecies species(VectorShape s) { = new IntSpecies(VectorShape.S_256_BIT, Int256Vector.class, Int256Vector.Int256Mask.class, + Int256Vector.Int256Shuffle.class, Int256Vector::new); /** Species representing {@link IntVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -4158,6 +4161,7 @@ static IntSpecies species(VectorShape s) { = new IntSpecies(VectorShape.S_512_BIT, Int512Vector.class, Int512Vector.Int512Mask.class, + Int512Vector.Int512Shuffle.class, Int512Vector::new); /** Species representing {@link IntVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -4165,6 +4169,7 @@ static IntSpecies species(VectorShape s) { = new IntSpecies(VectorShape.S_Max_BIT, IntMaxVector.class, IntMaxVector.IntMaxMask.class, + IntMaxVector.IntMaxShuffle.class, IntMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java index c65816a4d6c..8b57f1c498c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java @@ -136,24 +136,15 @@ Long128Mask maskFromArray(boolean[] bits) { @ForceInline Long128Shuffle iotaShuffle() { return Long128Shuffle.IOTA; } + @Override @ForceInline Long128Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Long128Shuffle)VectorSupport.shuffleIota(ETYPE, Long128Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Long128Shuffle)VectorSupport.shuffleIota(ETYPE, Long128Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Long128Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Long128Shuffle shuffleFromBytes(byte[] reorder) { return new Long128Shuffle(reorder); } - - @Override - @ForceInline - Long128Shuffle shuffleFromArray(int[] indexes, int i) { return new Long128Shuffle(indexes, i); } + Long128Shuffle shuffleFromArray(int[] indices, int i) { return new Long128Shuffle(indices, i); } @Override @ForceInline @@ -352,9 +343,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Long128Mask.class, (Long128Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Long128Shuffle.class); // specialize + public final Long128Shuffle toShuffle() { + return (Long128Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -783,23 +781,26 @@ static final class Long128Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = long.class; // used by the JVM - Long128Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Long128Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Long128Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Long128Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Long128Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Long128Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Long128Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public LongSpecies vspecies() { return VSPECIES; } @@ -807,47 +808,122 @@ public LongSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Long128Shuffle IOTA = new Long128Shuffle(IDENTITY); @Override @ForceInline public Long128Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Long128Shuffle.class, this, VLENGTH, - (s) -> ((Long128Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long128Vector toBitsVector() { + return (Long128Vector) super.toBitsVectorTemplate(); + } + + @Override + Long128Vector toBitsVector0() { + return ((Long128Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } @Override @ForceInline - public Long128Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Long128Shuffle.class, this, VLENGTH, - (s) -> ((Long128Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + + @Override + @ForceInline + public final Long128Mask laneIsValid() { + return (Long128Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Long128Shuffle rearrange(VectorShuffle shuffle) { + Long128Shuffle concreteShuffle = (Long128Shuffle) shuffle; + return (Long128Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Long128Shuffle rearrange(VectorShuffle shuffle) { - Long128Shuffle s = (Long128Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Long128Shuffle wrapIndexes() { + Long128Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long128Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long128Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Long128Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Long128Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java index 7ca3e43e92b..3f808fe1a2f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java @@ -136,24 +136,15 @@ Long256Mask maskFromArray(boolean[] bits) { @ForceInline Long256Shuffle iotaShuffle() { return Long256Shuffle.IOTA; } + @Override @ForceInline Long256Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Long256Shuffle)VectorSupport.shuffleIota(ETYPE, Long256Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Long256Shuffle)VectorSupport.shuffleIota(ETYPE, Long256Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Long256Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Long256Shuffle shuffleFromBytes(byte[] reorder) { return new Long256Shuffle(reorder); } - - @Override - @ForceInline - Long256Shuffle shuffleFromArray(int[] indexes, int i) { return new Long256Shuffle(indexes, i); } + Long256Shuffle shuffleFromArray(int[] indices, int i) { return new Long256Shuffle(indices, i); } @Override @ForceInline @@ -352,9 +343,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Long256Mask.class, (Long256Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Long256Shuffle.class); // specialize + public final Long256Shuffle toShuffle() { + return (Long256Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -787,23 +785,26 @@ static final class Long256Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = long.class; // used by the JVM - Long256Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Long256Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Long256Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Long256Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Long256Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Long256Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Long256Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public LongSpecies vspecies() { return VSPECIES; } @@ -811,47 +812,122 @@ public LongSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Long256Shuffle IOTA = new Long256Shuffle(IDENTITY); @Override @ForceInline public Long256Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Long256Shuffle.class, this, VLENGTH, - (s) -> ((Long256Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long256Vector toBitsVector() { + return (Long256Vector) super.toBitsVectorTemplate(); + } + + @Override + Long256Vector toBitsVector0() { + return ((Long256Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } @Override @ForceInline - public Long256Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Long256Shuffle.class, this, VLENGTH, - (s) -> ((Long256Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + + @Override + @ForceInline + public final Long256Mask laneIsValid() { + return (Long256Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Long256Shuffle rearrange(VectorShuffle shuffle) { + Long256Shuffle concreteShuffle = (Long256Shuffle) shuffle; + return (Long256Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Long256Shuffle rearrange(VectorShuffle shuffle) { - Long256Shuffle s = (Long256Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Long256Shuffle wrapIndexes() { + Long256Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long256Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long256Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Long256Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Long256Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java index 317cac1f110..3d5e00b09c6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java @@ -136,24 +136,15 @@ Long512Mask maskFromArray(boolean[] bits) { @ForceInline Long512Shuffle iotaShuffle() { return Long512Shuffle.IOTA; } + @Override @ForceInline Long512Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Long512Shuffle)VectorSupport.shuffleIota(ETYPE, Long512Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Long512Shuffle)VectorSupport.shuffleIota(ETYPE, Long512Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Long512Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Long512Shuffle shuffleFromBytes(byte[] reorder) { return new Long512Shuffle(reorder); } - - @Override - @ForceInline - Long512Shuffle shuffleFromArray(int[] indexes, int i) { return new Long512Shuffle(indexes, i); } + Long512Shuffle shuffleFromArray(int[] indices, int i) { return new Long512Shuffle(indices, i); } @Override @ForceInline @@ -352,9 +343,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Long512Mask.class, (Long512Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Long512Shuffle.class); // specialize + public final Long512Shuffle toShuffle() { + return (Long512Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -795,23 +793,26 @@ static final class Long512Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = long.class; // used by the JVM - Long512Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Long512Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Long512Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Long512Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Long512Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Long512Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Long512Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public LongSpecies vspecies() { return VSPECIES; } @@ -819,47 +820,122 @@ public LongSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Long512Shuffle IOTA = new Long512Shuffle(IDENTITY); @Override @ForceInline public Long512Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Long512Shuffle.class, this, VLENGTH, - (s) -> ((Long512Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long512Vector toBitsVector() { + return (Long512Vector) super.toBitsVectorTemplate(); + } + + @Override + Long512Vector toBitsVector0() { + return ((Long512Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } @Override @ForceInline - public Long512Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Long512Shuffle.class, this, VLENGTH, - (s) -> ((Long512Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + + @Override + @ForceInline + public final Long512Mask laneIsValid() { + return (Long512Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Long512Shuffle rearrange(VectorShuffle shuffle) { + Long512Shuffle concreteShuffle = (Long512Shuffle) shuffle; + return (Long512Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Long512Shuffle rearrange(VectorShuffle shuffle) { - Long512Shuffle s = (Long512Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Long512Shuffle wrapIndexes() { + Long512Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long512Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long512Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Long512Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Long512Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java index b13712595db..d34905dbce0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java @@ -136,24 +136,15 @@ Long64Mask maskFromArray(boolean[] bits) { @ForceInline Long64Shuffle iotaShuffle() { return Long64Shuffle.IOTA; } + @Override @ForceInline Long64Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Long64Shuffle)VectorSupport.shuffleIota(ETYPE, Long64Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Long64Shuffle)VectorSupport.shuffleIota(ETYPE, Long64Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Long64Shuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - Long64Shuffle shuffleFromBytes(byte[] reorder) { return new Long64Shuffle(reorder); } - - @Override - @ForceInline - Long64Shuffle shuffleFromArray(int[] indexes, int i) { return new Long64Shuffle(indexes, i); } + Long64Shuffle shuffleFromArray(int[] indices, int i) { return new Long64Shuffle(indices, i); } @Override @ForceInline @@ -352,9 +343,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Long64Mask.class, (Long64Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Long64Shuffle.class); // specialize + public final Long64Shuffle toShuffle() { + return (Long64Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -781,23 +779,26 @@ static final class Long64Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = long.class; // used by the JVM - Long64Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Long64Shuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Long64Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Long64Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Long64Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Long64Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Long64Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public LongSpecies vspecies() { return VSPECIES; } @@ -805,47 +806,122 @@ public LongSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final Long64Shuffle IOTA = new Long64Shuffle(IDENTITY); @Override @ForceInline public Long64Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Long64Shuffle.class, this, VLENGTH, - (s) -> ((Long64Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Long64Vector toBitsVector() { + return (Long64Vector) super.toBitsVectorTemplate(); + } + + @Override + Long64Vector toBitsVector0() { + return ((Long64Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } @Override @ForceInline - public Long64Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Long64Shuffle.class, this, VLENGTH, - (s) -> ((Long64Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + + @Override + @ForceInline + public final Long64Mask laneIsValid() { + return (Long64Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Long64Shuffle rearrange(VectorShuffle shuffle) { + Long64Shuffle concreteShuffle = (Long64Shuffle) shuffle; + return (Long64Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); } @ForceInline @Override - public Long64Shuffle rearrange(VectorShuffle shuffle) { - Long64Shuffle s = (Long64Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final Long64Shuffle wrapIndexes() { + Long64Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Long64Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Long64Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Long64Shuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Long64Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java index 9edc442be88..84ff9d17444 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java @@ -136,24 +136,15 @@ LongMaxMask maskFromArray(boolean[] bits) { @ForceInline LongMaxShuffle iotaShuffle() { return LongMaxShuffle.IOTA; } + @Override @ForceInline LongMaxShuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (LongMaxShuffle)VectorSupport.shuffleIota(ETYPE, LongMaxShuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (LongMaxShuffle)VectorSupport.shuffleIota(ETYPE, LongMaxShuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (LongMaxShuffle) iotaShuffleTemplate(start, step, wrap); } @Override @ForceInline - LongMaxShuffle shuffleFromBytes(byte[] reorder) { return new LongMaxShuffle(reorder); } - - @Override - @ForceInline - LongMaxShuffle shuffleFromArray(int[] indexes, int i) { return new LongMaxShuffle(indexes, i); } + LongMaxShuffle shuffleFromArray(int[] indices, int i) { return new LongMaxShuffle(indices, i); } @Override @ForceInline @@ -352,9 +343,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, LongMaxMask.class, (LongMaxMask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(LongMaxShuffle.class); // specialize + public final LongMaxShuffle toShuffle() { + return (LongMaxShuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -781,23 +779,26 @@ static final class LongMaxShuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = long.class; // used by the JVM - LongMaxShuffle(byte[] reorder) { - super(VLENGTH, reorder); + LongMaxShuffle(long[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public LongMaxShuffle(int[] reorder) { - super(VLENGTH, reorder); + LongMaxShuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public LongMaxShuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + LongMaxShuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public LongMaxShuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + long[] indices() { + return (long[])getPayload(); } @Override + @ForceInline public LongSpecies vspecies() { return VSPECIES; } @@ -805,47 +806,122 @@ public LongSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Long.MAX_VALUE); + assert(Long.MIN_VALUE <= -VLENGTH); } static final LongMaxShuffle IOTA = new LongMaxShuffle(IDENTITY); @Override @ForceInline public LongMaxVector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, LongMaxShuffle.class, this, VLENGTH, - (s) -> ((LongMaxVector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + LongMaxVector toBitsVector() { + return (LongMaxVector) super.toBitsVectorTemplate(); + } + + @Override + LongMaxVector toBitsVector0() { + return ((LongMaxVector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); + } + + @Override + @ForceInline + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } @Override @ForceInline - public LongMaxShuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, LongMaxShuffle.class, this, VLENGTH, - (s) -> ((LongMaxShuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public void intoArray(int[] a, int offset) { + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } + } + + @Override + @ForceInline + public final LongMaxMask laneIsValid() { + return (LongMaxMask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final LongMaxShuffle rearrange(VectorShuffle shuffle) { + LongMaxShuffle concreteShuffle = (LongMaxShuffle) shuffle; + return (LongMaxShuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); } @ForceInline @Override - public LongMaxShuffle rearrange(VectorShuffle shuffle) { - LongMaxShuffle s = (LongMaxShuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final LongMaxShuffle wrapIndexes() { + LongMaxVector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (LongMaxVector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (LongMaxVector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (LongMaxShuffle) v.toShuffle(vspecies(), false); + } + + private static long[] prepare(int[] indices, int offset) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static long[] prepare(IntUnaryOperator f) { + long[] a = new long[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (long)si; + } + return a; + } + + private static boolean indicesInRange(long[] indices) { + int length = indices.length; + for (long si : indices) { + if (si >= (long)length || si < (long)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new LongMaxShuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index 43fedc2693b..cde68c8fb38 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java @@ -1012,7 +1012,7 @@ private static VectorBroadcastIntOp> broadcastIntOp // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,long,long,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,long,VectorMask) @@ -2159,9 +2159,10 @@ LongVector sliceTemplate(int origin, Vector v1) { LongVector that = (LongVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((long)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = broadcast((long)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2189,9 +2190,10 @@ LongVector slice(int origin, @ForceInline LongVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((long)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = broadcast((long)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2210,10 +2212,10 @@ LongVector sliceTemplate(int origin) { LongVector that = (LongVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((long)(origin)))); - iota = iotaShuffle(-origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = broadcast((long)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2250,10 +2252,10 @@ LongVector sliceTemplate(int origin) { LongVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((long)(origin)))); - iota = iotaShuffle(-origin, 1, true); + LongVector iotaVector = (LongVector) iotaShuffle().toBitsVector(); + LongVector filter = broadcast((long)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2276,13 +2278,11 @@ LongVector sliceTemplate(int origin) { final > LongVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, long.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2305,13 +2305,11 @@ LongVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, long.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2332,30 +2330,29 @@ LongVector rearrangeTemplate(Class shuffletype, S shuffle, LongVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); LongVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, long.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); LongVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, long.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(LongSpecies dsp) { + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + assert(dsp.length() == vspecies().length()); long[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { @@ -2364,16 +2361,18 @@ VectorShuffle toShuffle0(LongSpecies dsp) { return VectorShuffle.fromArray(dsp, sa, 0); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - LongSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), long.class, length(), - shuffleType, byte.class, length(), - this, vsp, - LongVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + LongVector idx = this; + LongVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + LongVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -3784,9 +3783,10 @@ static final class LongSpecies extends AbstractSpecies { private LongSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(long.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Long.SIZE); } @@ -4063,6 +4063,7 @@ static LongSpecies species(VectorShape s) { = new LongSpecies(VectorShape.S_64_BIT, Long64Vector.class, Long64Vector.Long64Mask.class, + Long64Vector.Long64Shuffle.class, Long64Vector::new); /** Species representing {@link LongVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -4070,6 +4071,7 @@ static LongSpecies species(VectorShape s) { = new LongSpecies(VectorShape.S_128_BIT, Long128Vector.class, Long128Vector.Long128Mask.class, + Long128Vector.Long128Shuffle.class, Long128Vector::new); /** Species representing {@link LongVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -4077,6 +4079,7 @@ static LongSpecies species(VectorShape s) { = new LongSpecies(VectorShape.S_256_BIT, Long256Vector.class, Long256Vector.Long256Mask.class, + Long256Vector.Long256Shuffle.class, Long256Vector::new); /** Species representing {@link LongVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -4084,6 +4087,7 @@ static LongSpecies species(VectorShape s) { = new LongSpecies(VectorShape.S_512_BIT, Long512Vector.class, Long512Vector.Long512Mask.class, + Long512Vector.Long512Shuffle.class, Long512Vector::new); /** Species representing {@link LongVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -4091,6 +4095,7 @@ static LongSpecies species(VectorShape s) { = new LongSpecies(VectorShape.S_Max_BIT, LongMaxVector.class, LongMaxVector.LongMaxMask.class, + LongMaxVector.LongMaxShuffle.class, LongMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java index b013e4b2825..17ec4f72d2e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java @@ -141,24 +141,15 @@ Short128Mask maskFromArray(boolean[] bits) { @ForceInline Short128Shuffle iotaShuffle() { return Short128Shuffle.IOTA; } + @Override @ForceInline Short128Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Short128Shuffle)VectorSupport.shuffleIota(ETYPE, Short128Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Short128Shuffle)VectorSupport.shuffleIota(ETYPE, Short128Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Short128Shuffle) iotaShuffleTemplate((short) start, (short) step, wrap); } @Override @ForceInline - Short128Shuffle shuffleFromBytes(byte[] reorder) { return new Short128Shuffle(reorder); } - - @Override - @ForceInline - Short128Shuffle shuffleFromArray(int[] indexes, int i) { return new Short128Shuffle(indexes, i); } + Short128Shuffle shuffleFromArray(int[] indices, int i) { return new Short128Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Short128Mask.class, (Short128Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Short128Shuffle.class); // specialize + public final Short128Shuffle toShuffle() { + return (Short128Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -805,23 +803,26 @@ static final class Short128Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = short.class; // used by the JVM - Short128Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Short128Shuffle(short[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Short128Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Short128Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Short128Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Short128Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Short128Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + short[] indices() { + return (short[])getPayload(); } @Override + @ForceInline public ShortSpecies vspecies() { return VSPECIES; } @@ -829,47 +830,105 @@ public ShortSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Short.MAX_VALUE); + assert(Short.MIN_VALUE <= -VLENGTH); } static final Short128Shuffle IOTA = new Short128Shuffle(IDENTITY); @Override @ForceInline public Short128Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Short128Shuffle.class, this, VLENGTH, - (s) -> ((Short128Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Short128Vector toBitsVector() { + return (Short128Vector) super.toBitsVectorTemplate(); + } + + @Override + Short128Vector toBitsVector0() { + return ((Short128Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Short128Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Short128Shuffle.class, this, VLENGTH, - (s) -> ((Short128Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + VectorSpecies species = IntVector.SPECIES_128; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + } + @Override - public Short128Shuffle rearrange(VectorShuffle shuffle) { - Short128Shuffle s = (Short128Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Short128Mask laneIsValid() { + return (Short128Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Short128Shuffle rearrange(VectorShuffle shuffle) { + Short128Shuffle concreteShuffle = (Short128Shuffle) shuffle; + return (Short128Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Short128Shuffle wrapIndexes() { + Short128Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Short128Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Short128Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Short128Shuffle) v.toShuffle(vspecies(), false); + } + + private static short[] prepare(int[] indices, int offset) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static short[] prepare(IntUnaryOperator f) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static boolean indicesInRange(short[] indices) { + int length = indices.length; + for (short si : indices) { + if (si >= (short)length || si < (short)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Short128Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java index af4c862eaf3..e7505779f18 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java @@ -141,24 +141,15 @@ Short256Mask maskFromArray(boolean[] bits) { @ForceInline Short256Shuffle iotaShuffle() { return Short256Shuffle.IOTA; } + @Override @ForceInline Short256Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Short256Shuffle)VectorSupport.shuffleIota(ETYPE, Short256Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Short256Shuffle)VectorSupport.shuffleIota(ETYPE, Short256Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Short256Shuffle) iotaShuffleTemplate((short) start, (short) step, wrap); } @Override @ForceInline - Short256Shuffle shuffleFromBytes(byte[] reorder) { return new Short256Shuffle(reorder); } - - @Override - @ForceInline - Short256Shuffle shuffleFromArray(int[] indexes, int i) { return new Short256Shuffle(indexes, i); } + Short256Shuffle shuffleFromArray(int[] indices, int i) { return new Short256Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Short256Mask.class, (Short256Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Short256Shuffle.class); // specialize + public final Short256Shuffle toShuffle() { + return (Short256Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -821,23 +819,26 @@ static final class Short256Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = short.class; // used by the JVM - Short256Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Short256Shuffle(short[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Short256Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Short256Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Short256Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Short256Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Short256Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + short[] indices() { + return (short[])getPayload(); } @Override + @ForceInline public ShortSpecies vspecies() { return VSPECIES; } @@ -845,47 +846,105 @@ public ShortSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Short.MAX_VALUE); + assert(Short.MIN_VALUE <= -VLENGTH); } static final Short256Shuffle IOTA = new Short256Shuffle(IDENTITY); @Override @ForceInline public Short256Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Short256Shuffle.class, this, VLENGTH, - (s) -> ((Short256Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Short256Vector toBitsVector() { + return (Short256Vector) super.toBitsVectorTemplate(); + } + + @Override + Short256Vector toBitsVector0() { + return ((Short256Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Short256Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Short256Shuffle.class, this, VLENGTH, - (s) -> ((Short256Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + VectorSpecies species = IntVector.SPECIES_256; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + } + @Override - public Short256Shuffle rearrange(VectorShuffle shuffle) { - Short256Shuffle s = (Short256Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Short256Mask laneIsValid() { + return (Short256Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Short256Shuffle rearrange(VectorShuffle shuffle) { + Short256Shuffle concreteShuffle = (Short256Shuffle) shuffle; + return (Short256Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Short256Shuffle wrapIndexes() { + Short256Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Short256Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Short256Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Short256Shuffle) v.toShuffle(vspecies(), false); + } + + private static short[] prepare(int[] indices, int offset) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static short[] prepare(IntUnaryOperator f) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static boolean indicesInRange(short[] indices) { + int length = indices.length; + for (short si : indices) { + if (si >= (short)length || si < (short)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Short256Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java index 3bb019f3b7c..7ca0d00b37a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java @@ -141,24 +141,15 @@ Short512Mask maskFromArray(boolean[] bits) { @ForceInline Short512Shuffle iotaShuffle() { return Short512Shuffle.IOTA; } + @Override @ForceInline Short512Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Short512Shuffle)VectorSupport.shuffleIota(ETYPE, Short512Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Short512Shuffle)VectorSupport.shuffleIota(ETYPE, Short512Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Short512Shuffle) iotaShuffleTemplate((short) start, (short) step, wrap); } @Override @ForceInline - Short512Shuffle shuffleFromBytes(byte[] reorder) { return new Short512Shuffle(reorder); } - - @Override - @ForceInline - Short512Shuffle shuffleFromArray(int[] indexes, int i) { return new Short512Shuffle(indexes, i); } + Short512Shuffle shuffleFromArray(int[] indices, int i) { return new Short512Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Short512Mask.class, (Short512Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Short512Shuffle.class); // specialize + public final Short512Shuffle toShuffle() { + return (Short512Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -853,23 +851,26 @@ static final class Short512Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = short.class; // used by the JVM - Short512Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Short512Shuffle(short[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Short512Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Short512Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Short512Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Short512Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Short512Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + short[] indices() { + return (short[])getPayload(); } @Override + @ForceInline public ShortSpecies vspecies() { return VSPECIES; } @@ -877,47 +878,105 @@ public ShortSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Short.MAX_VALUE); + assert(Short.MIN_VALUE <= -VLENGTH); } static final Short512Shuffle IOTA = new Short512Shuffle(IDENTITY); @Override @ForceInline public Short512Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Short512Shuffle.class, this, VLENGTH, - (s) -> ((Short512Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Short512Vector toBitsVector() { + return (Short512Vector) super.toBitsVectorTemplate(); + } + + @Override + Short512Vector toBitsVector0() { + return ((Short512Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Short512Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Short512Shuffle.class, this, VLENGTH, - (s) -> ((Short512Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + VectorSpecies species = IntVector.SPECIES_512; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + } + @Override - public Short512Shuffle rearrange(VectorShuffle shuffle) { - Short512Shuffle s = (Short512Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Short512Mask laneIsValid() { + return (Short512Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Short512Shuffle rearrange(VectorShuffle shuffle) { + Short512Shuffle concreteShuffle = (Short512Shuffle) shuffle; + return (Short512Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Short512Shuffle wrapIndexes() { + Short512Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Short512Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Short512Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Short512Shuffle) v.toShuffle(vspecies(), false); + } + + private static short[] prepare(int[] indices, int offset) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static short[] prepare(IntUnaryOperator f) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static boolean indicesInRange(short[] indices) { + int length = indices.length; + for (short si : indices) { + if (si >= (short)length || si < (short)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Short512Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java index 905e313e95c..4837bd3d687 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java @@ -141,24 +141,15 @@ Short64Mask maskFromArray(boolean[] bits) { @ForceInline Short64Shuffle iotaShuffle() { return Short64Shuffle.IOTA; } + @Override @ForceInline Short64Shuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (Short64Shuffle)VectorSupport.shuffleIota(ETYPE, Short64Shuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (Short64Shuffle)VectorSupport.shuffleIota(ETYPE, Short64Shuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (Short64Shuffle) iotaShuffleTemplate((short) start, (short) step, wrap); } @Override @ForceInline - Short64Shuffle shuffleFromBytes(byte[] reorder) { return new Short64Shuffle(reorder); } - - @Override - @ForceInline - Short64Shuffle shuffleFromArray(int[] indexes, int i) { return new Short64Shuffle(indexes, i); } + Short64Shuffle shuffleFromArray(int[] indices, int i) { return new Short64Shuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, Short64Mask.class, (Short64Mask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(Short64Shuffle.class); // specialize + public final Short64Shuffle toShuffle() { + return (Short64Shuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -797,23 +795,26 @@ static final class Short64Shuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = short.class; // used by the JVM - Short64Shuffle(byte[] reorder) { - super(VLENGTH, reorder); + Short64Shuffle(short[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public Short64Shuffle(int[] reorder) { - super(VLENGTH, reorder); + Short64Shuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public Short64Shuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + Short64Shuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public Short64Shuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + short[] indices() { + return (short[])getPayload(); } @Override + @ForceInline public ShortSpecies vspecies() { return VSPECIES; } @@ -821,47 +822,105 @@ public ShortSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Short.MAX_VALUE); + assert(Short.MIN_VALUE <= -VLENGTH); } static final Short64Shuffle IOTA = new Short64Shuffle(IDENTITY); @Override @ForceInline public Short64Vector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, Short64Shuffle.class, this, VLENGTH, - (s) -> ((Short64Vector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + Short64Vector toBitsVector() { + return (Short64Vector) super.toBitsVectorTemplate(); + } + + @Override + Short64Vector toBitsVector0() { + return ((Short64Vector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public Short64Shuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, Short64Shuffle.class, this, VLENGTH, - (s) -> ((Short64Shuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + VectorSpecies species = IntVector.SPECIES_64; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + } + @Override - public Short64Shuffle rearrange(VectorShuffle shuffle) { - Short64Shuffle s = (Short64Shuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final Short64Mask laneIsValid() { + return (Short64Mask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final Short64Shuffle rearrange(VectorShuffle shuffle) { + Short64Shuffle concreteShuffle = (Short64Shuffle) shuffle; + return (Short64Shuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final Short64Shuffle wrapIndexes() { + Short64Vector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (Short64Vector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (Short64Vector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (Short64Shuffle) v.toShuffle(vspecies(), false); + } + + private static short[] prepare(int[] indices, int offset) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static short[] prepare(IntUnaryOperator f) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static boolean indicesInRange(short[] indices) { + int length = indices.length; + for (short si : indices) { + if (si >= (short)length || si < (short)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new Short64Shuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java index 5bb1beee6ed..9b90756c826 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java @@ -141,24 +141,15 @@ ShortMaxMask maskFromArray(boolean[] bits) { @ForceInline ShortMaxShuffle iotaShuffle() { return ShortMaxShuffle.IOTA; } + @Override @ForceInline ShortMaxShuffle iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return (ShortMaxShuffle)VectorSupport.shuffleIota(ETYPE, ShortMaxShuffle.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return (ShortMaxShuffle)VectorSupport.shuffleIota(ETYPE, ShortMaxShuffle.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } + return (ShortMaxShuffle) iotaShuffleTemplate((short) start, (short) step, wrap); } @Override @ForceInline - ShortMaxShuffle shuffleFromBytes(byte[] reorder) { return new ShortMaxShuffle(reorder); } - - @Override - @ForceInline - ShortMaxShuffle shuffleFromArray(int[] indexes, int i) { return new ShortMaxShuffle(indexes, i); } + ShortMaxShuffle shuffleFromArray(int[] indices, int i) { return new ShortMaxShuffle(indices, i); } @Override @ForceInline @@ -357,9 +348,16 @@ public final long reduceLanesToLong(VectorOperators.Associative op, return (long) super.reduceLanesTemplate(op, ShortMaxMask.class, (ShortMaxMask) m); // specialized } + @Override + @ForceInline + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { + return bitsToShuffleTemplate(dsp); + } + + @Override @ForceInline - public VectorShuffle toShuffle() { - return super.toShuffleTemplate(ShortMaxShuffle.class); // specialize + public final ShortMaxShuffle toShuffle() { + return (ShortMaxShuffle) toShuffle(vspecies(), false); } // Specialized unary testing @@ -791,23 +789,26 @@ static final class ShortMaxShuffle extends AbstractShuffle { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM static final Class ETYPE = short.class; // used by the JVM - ShortMaxShuffle(byte[] reorder) { - super(VLENGTH, reorder); + ShortMaxShuffle(short[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public ShortMaxShuffle(int[] reorder) { - super(VLENGTH, reorder); + ShortMaxShuffle(int[] indices, int i) { + this(prepare(indices, i)); } - public ShortMaxShuffle(int[] reorder, int i) { - super(VLENGTH, reorder, i); + ShortMaxShuffle(IntUnaryOperator fn) { + this(prepare(fn)); } - public ShortMaxShuffle(IntUnaryOperator fn) { - super(VLENGTH, fn); + short[] indices() { + return (short[])getPayload(); } @Override + @ForceInline public ShortSpecies vspecies() { return VSPECIES; } @@ -815,47 +816,105 @@ public ShortSpecies vspecies() { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < Short.MAX_VALUE); + assert(Short.MIN_VALUE <= -VLENGTH); } static final ShortMaxShuffle IOTA = new ShortMaxShuffle(IDENTITY); @Override @ForceInline public ShortMaxVector toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, ShortMaxShuffle.class, this, VLENGTH, - (s) -> ((ShortMaxVector)(((AbstractShuffle)(s)).toVectorTemplate()))); + return toBitsVector(); } @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + ShortMaxVector toBitsVector() { + return (ShortMaxVector) super.toBitsVectorTemplate(); + } + + @Override + ShortMaxVector toBitsVector0() { + return ((ShortMaxVector) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public ShortMaxShuffle wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, ShortMaxShuffle.class, this, VLENGTH, - (s) -> ((ShortMaxShuffle)(((AbstractShuffle)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); } + @Override @ForceInline + public void intoArray(int[] a, int offset) { + VectorSpecies species = IntVector.SPECIES_MAX; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + } + @Override - public ShortMaxShuffle rearrange(VectorShuffle shuffle) { - ShortMaxShuffle s = (ShortMaxShuffle) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + @ForceInline + public final ShortMaxMask laneIsValid() { + return (ShortMaxMask) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); + } + + @ForceInline + @Override + public final ShortMaxShuffle rearrange(VectorShuffle shuffle) { + ShortMaxShuffle concreteShuffle = (ShortMaxShuffle) shuffle; + return (ShortMaxShuffle) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); + } + + @ForceInline + @Override + public final ShortMaxShuffle wrapIndexes() { + ShortMaxVector v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = (ShortMaxVector) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = (ShortMaxVector) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return (ShortMaxShuffle) v.toShuffle(vspecies(), false); + } + + private static short[] prepare(int[] indices, int offset) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static short[] prepare(IntUnaryOperator f) { + short[] a = new short[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = (short)si; + } + return a; + } + + private static boolean indicesInRange(short[] indices) { + int length = indices.length; + for (short si : indices) { + if (si >= (short)length || si < (short)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new ShortMaxShuffle(r); + return true; } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index 552967d82e7..3cf848f31d0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java @@ -1096,7 +1096,7 @@ private static VectorBroadcastIntOp> broadcastInt // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,short,short,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,short,VectorMask) @@ -2309,9 +2309,10 @@ ShortVector sliceTemplate(int origin, Vector v1) { ShortVector that = (ShortVector) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((short)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + ShortVector iotaVector = (ShortVector) iotaShuffle().toBitsVector(); + ShortVector filter = broadcast((short)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2339,9 +2340,10 @@ ShortVector slice(int origin, @ForceInline ShortVector sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast((short)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + ShortVector iotaVector = (ShortVector) iotaShuffle().toBitsVector(); + ShortVector filter = broadcast((short)(length() - origin)); + VectorMask blendMask = iotaVector.compare(VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2360,10 +2362,10 @@ ShortVector sliceTemplate(int origin) { ShortVector that = (ShortVector) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast((short)(origin)))); - iota = iotaShuffle(-origin, 1, true); + ShortVector iotaVector = (ShortVector) iotaShuffle().toBitsVector(); + ShortVector filter = broadcast((short)origin); + VectorMask blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2400,10 +2402,10 @@ ShortVector sliceTemplate(int origin) { ShortVector unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle iota = iotaShuffle(); - VectorMask blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast((short)(origin)))); - iota = iotaShuffle(-origin, 1, true); + ShortVector iotaVector = (ShortVector) iotaShuffle().toBitsVector(); + ShortVector filter = broadcast((short)origin); + VectorMask blendMask = iotaVector.compare(VectorOperators.GE, filter); + AbstractShuffle iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2426,13 +2428,11 @@ ShortVector sliceTemplate(int origin) { final > ShortVector rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, short.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2455,13 +2455,11 @@ ShortVector rearrangeTemplate(Class shuffletype, M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, short.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2482,30 +2480,29 @@ ShortVector rearrangeTemplate(Class shuffletype, S shuffle, ShortVector v) { VectorMask valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); ShortVector r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, short.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); ShortVector r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, short.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle toShuffle0(ShortSpecies dsp) { + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { + assert(dsp.length() == vspecies().length()); short[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { @@ -2514,16 +2511,18 @@ VectorShuffle toShuffle0(ShortSpecies dsp) { return VectorShuffle.fromArray(dsp, sa, 0); } - /*package-private*/ @ForceInline - final - VectorShuffle toShuffleTemplate(Class shuffleType) { - ShortSpecies vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), short.class, length(), - shuffleType, byte.class, length(), - this, vsp, - ShortVector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); + ShortVector idx = this; + ShortVector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + ShortVector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -4210,9 +4209,10 @@ static final class ShortSpecies extends AbstractSpecies { private ShortSpecies(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of(short.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == Short.SIZE); } @@ -4498,6 +4498,7 @@ static ShortSpecies species(VectorShape s) { = new ShortSpecies(VectorShape.S_64_BIT, Short64Vector.class, Short64Vector.Short64Mask.class, + Short64Vector.Short64Shuffle.class, Short64Vector::new); /** Species representing {@link ShortVector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -4505,6 +4506,7 @@ static ShortSpecies species(VectorShape s) { = new ShortSpecies(VectorShape.S_128_BIT, Short128Vector.class, Short128Vector.Short128Mask.class, + Short128Vector.Short128Shuffle.class, Short128Vector::new); /** Species representing {@link ShortVector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -4512,6 +4514,7 @@ static ShortSpecies species(VectorShape s) { = new ShortSpecies(VectorShape.S_256_BIT, Short256Vector.class, Short256Vector.Short256Mask.class, + Short256Vector.Short256Shuffle.class, Short256Vector::new); /** Species representing {@link ShortVector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -4519,6 +4522,7 @@ static ShortSpecies species(VectorShape s) { = new ShortSpecies(VectorShape.S_512_BIT, Short512Vector.class, Short512Vector.Short512Mask.class, + Short512Vector.Short512Shuffle.class, Short512Vector::new); /** Species representing {@link ShortVector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -4526,6 +4530,7 @@ static ShortSpecies species(VectorShape s) { = new ShortSpecies(VectorShape.S_Max_BIT, ShortMaxVector.class, ShortMaxVector.ShortMaxMask.class, + ShortMaxVector.ShortMaxShuffle.class, ShortMaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java index 5b6dd3d09ac..76d6392e48a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java index 1ffbcef821a..89e0d38bcb0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,6 +124,7 @@ VectorSpecies withLanes(Class elementType) { * @throws IllegalArgumentException if no such vector shape exists * @see #vectorBitSize() */ + @ForceInline public static VectorShape forBitSize(int bitSize) { switch (bitSize) { case 64: diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShuffle.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShuffle.java index b046874c390..bc1780a81ac 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShuffle.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShuffle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * 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,8 +133,8 @@ */ @SuppressWarnings("exports") public abstract class VectorShuffle extends jdk.internal.vm.vector.VectorSupport.VectorShuffle { - VectorShuffle(byte[] reorder) { - super(reorder); + VectorShuffle(Object indices) { + super(indices); } /** @@ -556,7 +556,7 @@ private static int unzipIndex(int i, int vlen, int part) { * @param i the lane index * @return the {@code int} lane element at lane index {@code i} */ - public int laneSource(int i) { return toArray()[i]; } + public abstract int laneSource(int i); /** * Rearranges the lane elements of this shuffle selecting lane indexes diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java index 6cfe5f6d9d9..03cb0ae559e 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ */ package jdk.incubator.vector; +import jdk.internal.vm.annotation.ForceInline; + import java.lang.foreign.MemorySegment; import java.nio.ByteOrder; @@ -342,6 +344,7 @@ public interface VectorSpecies { * @see #withLanes(Class) * @see #withShape(VectorShape) */ + @ForceInline static VectorSpecies of(Class elementType, VectorShape shape) { LaneType laneType = LaneType.of(elementType); return AbstractSpecies.findSpecies(elementType, laneType, shape); @@ -367,6 +370,7 @@ static VectorSpecies of(Class elementType, VectorShape shape) { * or if the given type is not a valid {@code ETYPE} * @see VectorSpecies#ofPreferred(Class) */ + @ForceInline static VectorSpecies ofLargestShape(Class etype) { return VectorSpecies.of(etype, VectorShape.largestShapeFor(etype)); } @@ -410,6 +414,7 @@ static VectorSpecies ofLargestShape(Class etype) { * @see VectorShape#preferredShape() * @see VectorSpecies#ofLargestShape(Class) */ + @ForceInline public static VectorSpecies ofPreferred(Class etype) { return of(etype, VectorShape.preferredShape()); } @@ -432,6 +437,7 @@ public static VectorSpecies ofPreferred(Class etype) { * if the given {@code elementType} argument is not * a valid vector {@code ETYPE} */ + @ForceInline static int elementSize(Class elementType) { return LaneType.of(elementType).elementSize; } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 7eb1d9810b1..835868e61cd 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -1229,7 +1229,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { // and broadcast, but it would be more surprising not to continue // the obvious pattern started by unary and binary. - /** + /** * {@inheritDoc} * @see #lanewise(VectorOperators.Ternary,$type$,$type$,VectorMask) * @see #lanewise(VectorOperators.Ternary,Vector,$type$,VectorMask) @@ -2685,9 +2685,15 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ that = ($abstractvectortype$) v1; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle<$Boxtype$> iota = iotaShuffle(); - VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast(($type$)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + $Bitstype$Vector iotaVector = ($Bitstype$Vector) iotaShuffle().toBitsVector(); +#if[FP] + $Bitstype$Vector filter = $Bitstype$Vector.broadcast(($Bitstype$Vector.$Bitstype$Species) vspecies().asIntegral(), ($bitstype$)(length() - origin)); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); +#else[FP] + $abstractvectortype$ filter = broadcast(($type$)(length() - origin)); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.LT, filter); +#end[FP] + AbstractShuffle<$Boxtype$> iota = iotaShuffle(origin, 1, true); return that.rearrange(iota).blend(this.rearrange(iota), blendMask); } @@ -2715,9 +2721,15 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { @ForceInline $abstractvectortype$ sliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle<$Boxtype$> iota = iotaShuffle(); - VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.LT, (broadcast(($type$)(length() - origin)))); - iota = iotaShuffle(origin, 1, true); + $Bitstype$Vector iotaVector = ($Bitstype$Vector) iotaShuffle().toBitsVector(); +#if[FP] + $Bitstype$Vector filter = $Bitstype$Vector.broadcast(($Bitstype$Vector.$Bitstype$Species) vspecies().asIntegral(), ($bitstype$)(length() - origin)); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.LT, filter).cast(vspecies()); +#else[FP] + $abstractvectortype$ filter = broadcast(($type$)(length() - origin)); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.LT, filter); +#end[FP] + AbstractShuffle<$Boxtype$> iota = iotaShuffle(origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2736,10 +2748,15 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ that = ($abstractvectortype$) w; that.check(this); Objects.checkIndex(origin, length() + 1); - VectorShuffle<$Boxtype$> iota = iotaShuffle(); - VectorMask<$Boxtype$> blendMask = iota.toVector().compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, - (broadcast(($type$)(origin)))); - iota = iotaShuffle(-origin, 1, true); + $Bitstype$Vector iotaVector = ($Bitstype$Vector) iotaShuffle().toBitsVector(); +#if[FP] + $Bitstype$Vector filter = $Bitstype$Vector.broadcast(($Bitstype$Vector.$Bitstype$Species) vspecies().asIntegral(), ($bitstype$)origin); + VectorMask<$Boxtype$> blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter).cast(vspecies()); +#else[FP] + $abstractvectortype$ filter = broadcast(($type$)origin); + VectorMask<$Boxtype$> blendMask = iotaVector.compare((part == 0) ? VectorOperators.GE : VectorOperators.LT, filter); +#end[FP] + AbstractShuffle<$Boxtype$> iota = iotaShuffle(-origin, 1, true); return that.blend(this.rearrange(iota), blendMask); } @@ -2776,10 +2793,15 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ unsliceTemplate(int origin) { Objects.checkIndex(origin, length() + 1); - VectorShuffle<$Boxtype$> iota = iotaShuffle(); - VectorMask<$Boxtype$> blendMask = iota.toVector().compare(VectorOperators.GE, - (broadcast(($type$)(origin)))); - iota = iotaShuffle(-origin, 1, true); + $Bitstype$Vector iotaVector = ($Bitstype$Vector) iotaShuffle().toBitsVector(); +#if[FP] + $Bitstype$Vector filter = $Bitstype$Vector.broadcast(($Bitstype$Vector.$Bitstype$Species) vspecies().asIntegral(), ($bitstype$)origin); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.GE, filter).cast(vspecies()); +#else[FP] + $abstractvectortype$ filter = broadcast(($type$)origin); + VectorMask<$Boxtype$> blendMask = iotaVector.compare(VectorOperators.GE, filter); +#end[FP] + AbstractShuffle<$Boxtype$> iota = iotaShuffle(-origin, 1, true); return vspecies().zero().blend(this.rearrange(iota), blendMask); } @@ -2802,13 +2824,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { final > $abstractvectortype$ rearrangeTemplate(Class shuffletype, S shuffle) { - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, $type$.class, length(), - this, ws, null, + this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); } @@ -2831,13 +2851,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { M m) { m.check(masktype, this); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, $type$.class, length(), - this, ws, m, + this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return !m_.laneIsSet(i) ? 0 : v1.lane(ei); })); } @@ -2858,48 +2876,61 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { S shuffle, $abstractvectortype$ v) { VectorMask<$Boxtype$> valid = shuffle.laneIsValid(); - @SuppressWarnings("unchecked") - S ws = (S) shuffle.wrapIndexes(); $abstractvectortype$ r0 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, $type$.class, length(), - this, ws, null, + this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); return v0.lane(ei); })); $abstractvectortype$ r1 = VectorSupport.rearrangeOp( getClass(), shuffletype, null, $type$.class, length(), - v, ws, null, + v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { - int ei = s_.laneSource(i); + int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); return v1.lane(ei); })); return r1.blend(r0, valid); } + @Override @ForceInline - private final - VectorShuffle<$Boxtype$> toShuffle0($Type$Species dsp) { + final VectorShuffle bitsToShuffle0(AbstractSpecies dsp) { +#if[FP] + throw new AssertionError(); +#else[FP] + assert(dsp.length() == vspecies().length()); $type$[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } return VectorShuffle.fromArray(dsp, sa, 0); +#end[FP] } - /*package-private*/ @ForceInline - final - VectorShuffle<$Boxtype$> toShuffleTemplate(Class shuffleType) { - $Type$Species vsp = vspecies(); - return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - getClass(), $type$.class, length(), - shuffleType, byte.class, length(), - this, vsp, - $Type$Vector::toShuffle0); + final + VectorShuffle toShuffle(AbstractSpecies dsp, boolean wrap) { + assert(dsp.elementSize() == vspecies().elementSize()); +#if[float] + IntVector idx = convert(VectorOperators.F2I, 0).reinterpretAsInts(); +#end[float] +#if[double] + LongVector idx = convert(VectorOperators.D2L, 0).reinterpretAsLongs(); +#end[double] +#if[!FP] + $Type$Vector idx = this; +#end[!FP] + $Bitstype$Vector wrapped = idx.lanewise(VectorOperators.AND, length() - 1); + if (!wrap) { + $Bitstype$Vector wrappedEx = wrapped.lanewise(VectorOperators.SUB, length()); + VectorMask<$Boxbitstype$> inBound = wrapped.compare(VectorOperators.EQ, idx); + wrapped = wrappedEx.blend(wrapped, inBound); + } + return wrapped.bitsToShuffle(dsp); } /** @@ -5447,9 +5478,10 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { private $Type$Species(VectorShape shape, Class vectorType, Class> maskType, + Class> shuffleType, Function vectorFactory) { super(shape, LaneType.of($type$.class), - vectorType, maskType, + vectorType, maskType, shuffleType, vectorFactory); assert(this.elementSize() == $Boxtype$.SIZE); } @@ -5742,6 +5774,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = new $Type$Species(VectorShape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class, + $Type$64Vector.$Type$64Shuffle.class, $Type$64Vector::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ @@ -5749,6 +5782,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = new $Type$Species(VectorShape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class, + $Type$128Vector.$Type$128Shuffle.class, $Type$128Vector::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ @@ -5756,6 +5790,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = new $Type$Species(VectorShape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class, + $Type$256Vector.$Type$256Shuffle.class, $Type$256Vector::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ @@ -5763,6 +5798,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = new $Type$Species(VectorShape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class, + $Type$512Vector.$Type$512Shuffle.class, $Type$512Vector::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ @@ -5770,6 +5806,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { = new $Type$Species(VectorShape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class, + $Type$MaxVector.$Type$MaxShuffle.class, $Type$MaxVector::new); /** diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template index 9752a795ea7..216f28fde87 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template @@ -143,24 +143,23 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline $shuffletype$ iotaShuffle() { return $shuffletype$.IOTA; } + @Override @ForceInline $shuffletype$ iotaShuffle(int start, int step, boolean wrap) { - if (wrap) { - return ($shuffletype$)VectorSupport.shuffleIota(ETYPE, $shuffletype$.class, VSPECIES, VLENGTH, start, step, 1, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (VectorIntrinsics.wrapToRange(i*lstep + lstart, l)))); - } else { - return ($shuffletype$)VectorSupport.shuffleIota(ETYPE, $shuffletype$.class, VSPECIES, VLENGTH, start, step, 0, - (l, lstart, lstep, s) -> s.shuffleFromOp(i -> (i*lstep + lstart))); - } +#if[byte] + return ($shuffletype$) iotaShuffleTemplate((byte) start, (byte) step, wrap); +#end[byte] +#if[short] + return ($shuffletype$) iotaShuffleTemplate((short) start, (short) step, wrap); +#end[short] +#if[!byteOrShort] + return ($shuffletype$) iotaShuffleTemplate(start, step, wrap); +#end[!byteOrShort] } @Override @ForceInline - $shuffletype$ shuffleFromBytes(byte[] reorder) { return new $shuffletype$(reorder); } - - @Override - @ForceInline - $shuffletype$ shuffleFromArray(int[] indexes, int i) { return new $shuffletype$(indexes, i); } + $shuffletype$ shuffleFromArray(int[] indices, int i) { return new $shuffletype$(indices, i); } @Override @ForceInline @@ -361,9 +360,20 @@ final class $vectortype$ extends $abstractvectortype$ { return (long) super.reduceLanesTemplate(op, $masktype$.class, ($masktype$) m); // specialized } + @Override @ForceInline - public VectorShuffle<$Boxtype$> toShuffle() { - return super.toShuffleTemplate($shuffletype$.class); // specialize + final VectorShuffle bitsToShuffle(AbstractSpecies dsp) { +#if[FP] + throw new AssertionError(); +#else[FP] + return bitsToShuffleTemplate(dsp); +#end[FP] + } + + @Override + @ForceInline + public final $shuffletype$ toShuffle() { + return ($shuffletype$) toShuffle(vspecies(), false); } // Specialized unary testing @@ -1077,25 +1087,28 @@ final class $vectortype$ extends $abstractvectortype$ { static final class $shuffletype$ extends AbstractShuffle<$Boxtype$> { static final int VLENGTH = VSPECIES.laneCount(); // used by the JVM - static final Class<$Boxtype$> ETYPE = $type$.class; // used by the JVM + static final Class<$Boxbitstype$> ETYPE = $bitstype$.class; // used by the JVM - $shuffletype$(byte[] reorder) { - super(VLENGTH, reorder); + $shuffletype$($bitstype$[] indices) { + super(indices); + assert(VLENGTH == indices.length); + assert(indicesInRange(indices)); } - public $shuffletype$(int[] reorder) { - super(VLENGTH, reorder); + $shuffletype$(int[] indices, int i) { + this(prepare(indices, i)); } - public $shuffletype$(int[] reorder, int i) { - super(VLENGTH, reorder, i); + $shuffletype$(IntUnaryOperator fn) { + this(prepare(fn)); } - public $shuffletype$(IntUnaryOperator fn) { - super(VLENGTH, fn); + $bitstype$[] indices() { + return ($bitstype$[])getPayload(); } @Override + @ForceInline public $Type$Species vspecies() { return VSPECIES; } @@ -1103,47 +1116,166 @@ final class $vectortype$ extends $abstractvectortype$ { static { // There must be enough bits in the shuffle lanes to encode // VLENGTH valid indexes and VLENGTH exceptional ones. - assert(VLENGTH < Byte.MAX_VALUE); - assert(Byte.MIN_VALUE <= -VLENGTH); + assert(VLENGTH < $Boxbitstype$.MAX_VALUE); + assert($Boxbitstype$.MIN_VALUE <= -VLENGTH); } static final $shuffletype$ IOTA = new $shuffletype$(IDENTITY); +#if[FP] @Override @ForceInline public $vectortype$ toVector() { - return VectorSupport.shuffleToVector(VCLASS, ETYPE, $shuffletype$.class, this, VLENGTH, - (s) -> (($vectortype$)(((AbstractShuffle<$Boxtype$>)(s)).toVectorTemplate()))); + return ($vectortype$) toBitsVector().castShape(vspecies(), 0); } +#else[FP] + @Override + @ForceInline + public $vectortype$ toVector() { + return toBitsVector(); + } +#end[FP] @Override @ForceInline - public VectorShuffle cast(VectorSpecies s) { - AbstractSpecies species = (AbstractSpecies) s; - if (length() != species.laneCount()) - throw new IllegalArgumentException("VectorShuffle length and species length differ"); - int[] shuffleArray = toArray(); - return s.shuffleFromArray(shuffleArray, 0).check(s); + $bitsvectortype$ toBitsVector() { + return ($bitsvectortype$) super.toBitsVectorTemplate(); + } + + @Override + $bitsvectortype$ toBitsVector0() { + return (($bitsvectortype$) vspecies().asIntegral().dummyVector()).vectorFactory(indices()); } @Override @ForceInline - public $shuffletype$ wrapIndexes() { - return VectorSupport.wrapShuffleIndexes(ETYPE, $shuffletype$.class, this, VLENGTH, - (s) -> (($shuffletype$)(((AbstractShuffle<$Boxtype$>)(s)).wrapIndexesTemplate()))); + public int laneSource(int i) { + return (int)toBitsVector().lane(i); + } + + @Override + @ForceInline + public void intoArray(int[] a, int offset) { +#if[byte] + VectorSpecies species = IntVector.SPECIES_$BITS$; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.B2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.B2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); + v.convertShape(VectorOperators.B2I, species, 2) + .reinterpretAsInts() + .intoArray(a, offset + species.length() * 2); + v.convertShape(VectorOperators.B2I, species, 3) + .reinterpretAsInts() + .intoArray(a, offset + species.length() * 3); +#end[byte] +#if[short] + VectorSpecies species = IntVector.SPECIES_$BITS$; + Vector v = toBitsVector(); + v.convertShape(VectorOperators.S2I, species, 0) + .reinterpretAsInts() + .intoArray(a, offset); + v.convertShape(VectorOperators.S2I, species, 1) + .reinterpretAsInts() + .intoArray(a, offset + species.length()); +#end[short] +#if[intOrFloat] + toBitsVector().intoArray(a, offset); +#end[intOrFloat] +#if[longOrDouble] + switch (length()) { + case 1 -> a[offset] = laneSource(0); + case 2 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 4 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 8 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0) + .reinterpretAsInts() + .intoArray(a, offset); + case 16 -> toBitsVector() + .convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0) + .reinterpretAsInts() + .intoArray(a, offset); + default -> { + VectorIntrinsics.checkFromIndexSize(offset, length(), a.length); + for (int i = 0; i < length(); i++) { + a[offset + i] = laneSource(i); + } + } + } +#end[longOrDouble] + } + + @Override + @ForceInline + public final $masktype$ laneIsValid() { + return ($masktype$) toBitsVector().compare(VectorOperators.GE, 0) + .cast(vspecies()); } @ForceInline @Override - public $shuffletype$ rearrange(VectorShuffle<$Boxtype$> shuffle) { - $shuffletype$ s = ($shuffletype$) shuffle; - byte[] reorder1 = reorder(); - byte[] reorder2 = s.reorder(); - byte[] r = new byte[reorder1.length]; - for (int i = 0; i < reorder1.length; i++) { - int ssi = reorder2[i]; - r[i] = reorder1[ssi]; // throws on exceptional index + public final $shuffletype$ rearrange(VectorShuffle<$Boxtype$> shuffle) { + $shuffletype$ concreteShuffle = ($shuffletype$) shuffle; +#if[FP] + return ($shuffletype$) toBitsVector().rearrange(concreteShuffle.cast($Bitstype$Vector.SPECIES_$BITS$)) + .toShuffle(vspecies(), false); +#else[FP] + return ($shuffletype$) toBitsVector().rearrange(concreteShuffle) + .toShuffle(vspecies(), false); +#end[FP] + } + + @ForceInline + @Override + public final $shuffletype$ wrapIndexes() { + $bitsvectortype$ v = toBitsVector(); + if ((length() & (length() - 1)) == 0) { + v = ($bitsvectortype$) v.lanewise(VectorOperators.AND, length() - 1); + } else { + v = ($bitsvectortype$) v.blend(v.lanewise(VectorOperators.ADD, length()), + v.compare(VectorOperators.LT, 0)); + } + return ($shuffletype$) v.toShuffle(vspecies(), false); + } + + private static $bitstype$[] prepare(int[] indices, int offset) { + $bitstype$[] a = new $bitstype$[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = indices[offset + i]; + si = partiallyWrapIndex(si, VLENGTH); + a[i] = ($bitstype$)si; + } + return a; + } + + private static $bitstype$[] prepare(IntUnaryOperator f) { + $bitstype$[] a = new $bitstype$[VLENGTH]; + for (int i = 0; i < VLENGTH; i++) { + int si = f.applyAsInt(i); + si = partiallyWrapIndex(si, VLENGTH); + a[i] = ($bitstype$)si; + } + return a; + } + + private static boolean indicesInRange($bitstype$[] indices) { + int length = indices.length; + for ($bitstype$ si : indices) { + if (si >= ($bitstype$)length || si < ($bitstype$)(-length)) { + String msg = ("index "+si+"out of range ["+length+"] in "+ + java.util.Arrays.toString(indices)); + throw new AssertionError(msg); + } } - return new $shuffletype$(r); + return true; } } diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap index 001ce5b5cac..ecc752e8014 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap @@ -1,6 +1,6 @@ /* * -* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java index c0d6c4cdb84..2a8959e5d7f 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/aarch64/AArch64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/amd64/AMD64.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/amd64/AMD64.java index eda1eada737..622102a3a67 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/amd64/AMD64.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/amd64/AMD64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/Architecture.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/Architecture.java index 64b0600674f..f8cb10cf29b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/Architecture.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/Architecture.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java index 894fca94a77..9c64126c62d 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/DirectHotSpotObjectConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/DirectHotSpotObjectConstantImpl.java index 8385aaa6560..c241af0348a 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/DirectHotSpotObjectConstantImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/DirectHotSpotObjectConstantImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java index ab7a57f2759..49dfdcea5a2 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java index 0becdf29976..370eaee7b3f 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstant.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstant.java index e0ae6b4c881..81b25e6c51d 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstant.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java index f4f8736a2fe..6a9167e687b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java index d25a7c974a5..6bff3ce58cf 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java index 358441d0b22..55d5492c2f8 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java index 3d3d140b1ca..4685ff4d1b4 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java index e4a77daf0d4..cf3ac0f994a 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java index 57cec3ef194..fd46e281c3b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java index ab8b3d335cb..d7e8fd37ab2 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotJVMCIBackendFactory.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotJVMCIBackendFactory.java index 9e7d7679cab..6e0eac91d61 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotJVMCIBackendFactory.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotJVMCIBackendFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotVMConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotVMConfig.java index 7f19efc4566..1d52556522e 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotVMConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/riscv64/RISCV64HotSpotVMConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/MethodHandleAccessProvider.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/MethodHandleAccessProvider.java index eb8b9721d49..f4aa7b28bed 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/MethodHandleAccessProvider.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/MethodHandleAccessProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java index fa42dc26ac8..8758dbb3bb6 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/riscv64/RISCV64.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/riscv64/RISCV64.java index 2da9d51cca2..976c09cb75b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/riscv64/RISCV64.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/riscv64/RISCV64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java index 72c07b3ac98..d4171002247 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java index c171e10132a..69cabd5427d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java @@ -271,7 +271,7 @@ Content linkSeeReferenceOutput(Element holder, } if (utils.isExecutableElement(refMem)) { if (refMemName.indexOf('(') < 0) { - refMemName += utils.makeSignature((ExecutableElement) refMem, null, true); + refMemName += utils.makeSignature((ExecutableElement) refMem, null, false, true); } if (overriddenMethod != null) { // The method to actually link. diff --git a/src/jdk.jcmd/share/man/jinfo.md b/src/jdk.jcmd/share/man/jinfo.md index 5e8603e0e08..b70bc4c45ee 100644 --- a/src/jdk.jcmd/share/man/jinfo.md +++ b/src/jdk.jcmd/share/man/jinfo.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jcmd/share/man/jmap.md b/src/jdk.jcmd/share/man/jmap.md index 1f986f97fab..b0352ad9194 100644 --- a/src/jdk.jcmd/share/man/jmap.md +++ b/src/jdk.jcmd/share/man/jmap.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jcmd/share/man/jps.md b/src/jdk.jcmd/share/man/jps.md index be3994c411e..2db93878801 100644 --- a/src/jdk.jcmd/share/man/jps.md +++ b/src/jdk.jcmd/share/man/jps.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jcmd/share/man/jstack.md b/src/jdk.jcmd/share/man/jstack.md index 84df235a70e..15849502d8c 100644 --- a/src/jdk.jcmd/share/man/jstack.md +++ b/src/jdk.jcmd/share/man/jstack.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jcmd/share/man/jstat.md b/src/jdk.jcmd/share/man/jstat.md index 795fc9caa40..324d0a48cb2 100644 --- a/src/jdk.jcmd/share/man/jstat.md +++ b/src/jdk.jcmd/share/man/jstat.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties b/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties index e6859fd8d74..947fb1c8d66 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/messages_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jconsole/share/man/jconsole.md b/src/jdk.jconsole/share/man/jconsole.md index 59c84a0431a..6412937830b 100644 --- a/src/jdk.jconsole/share/man/jconsole.md +++ b/src/jdk.jconsole/share/man/jconsole.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java index b3c6b5b6c64..c267d9748fd 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java index 138a76b6f2e..0d02d664de2 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java index f19d8fce4bb..7fcd213cd0b 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java index 04e7b3fd0e0..c472ea48b6f 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/Options.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/Options.java index e93dd2daf85..503989f4900 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/Options.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/Options.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/SourceWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/SourceWriter.java index 884c0fa9f80..94c10f5a5f9 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/SourceWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/SourceWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/StackMapWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/StackMapWriter.java index d899569724e..5b7de2a4565 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/StackMapWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/StackMapWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java index d5e19bc4241..a1ad8854161 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties index 02e277e2235..29bff0ffe54 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties index 1c98b4cac6a..3575f134dfc 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties index 4cc9e83070d..a759117f727 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties index 77c2fdd6b63..bc6137f7f13 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties index 35f59cac926..000425923c4 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/man/javap.md b/src/jdk.jdeps/share/man/javap.md index 814db56b3ba..d09ac57f196 100644 --- a/src/jdk.jdeps/share/man/javap.md +++ b/src/jdk.jdeps/share/man/javap.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/man/jdeprscan.md b/src/jdk.jdeps/share/man/jdeprscan.md index 8f76b29aee3..788d82e09db 100644 --- a/src/jdk.jdeps/share/man/jdeprscan.md +++ b/src/jdk.jdeps/share/man/jdeprscan.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdeps/share/man/jdeps.md b/src/jdk.jdeps/share/man/jdeps.md index cb936bf3e01..52c2d4bffe4 100644 --- a/src/jdk.jdeps/share/man/jdeps.md +++ b/src/jdk.jdeps/share/man/jdeps.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java b/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java index fd1b97161c7..bccdf4cc8bf 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java index 04ec27a624d..f3aadd3677c 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java b/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java index 41a1972a937..8ab3d97ea58 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/share/man/jdb.md b/src/jdk.jdi/share/man/jdb.md index e163cbf5e23..75d2d9a150c 100644 --- a/src/jdk.jdi/share/man/jdb.md +++ b/src/jdk.jdi/share/man/jdb.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/windows/classes/com/sun/tools/jdi/SharedMemoryTransportService.java b/src/jdk.jdi/windows/classes/com/sun/tools/jdi/SharedMemoryTransportService.java index ae3ccf7f149..fdbc4c8807f 100644 --- a/src/jdk.jdi/windows/classes/com/sun/tools/jdi/SharedMemoryTransportService.java +++ b/src/jdk.jdi/windows/classes/com/sun/tools/jdi/SharedMemoryTransportService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java index 1373c3ca496..ed9e1e43625 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventClassBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventWriterKey.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventWriterKey.java index 7f9c22f0234..8301de748da 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/EventWriterKey.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/EventWriterKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java index 3f0611f9981..2cf56c67cb5 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/RepositoryFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/periodic/BatchManager.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/periodic/BatchManager.java index 8d51cb1de6f..ff4898bc926 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/periodic/BatchManager.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/periodic/BatchManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java index 781661a427f..4d947eea9a5 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedMethods.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedMethods.java index 7e425b3bdb5..646150629f8 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedMethods.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedThing.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedThing.java index 6d607557caf..42445d79e78 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedThing.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/test/DeprecatedThing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Bytecode.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Bytecode.java index c51c3afe331..1241993e762 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Bytecode.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Bytecode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/classes/jdk/jfr/snippet-files/Snippets.java b/src/jdk.jfr/share/classes/jdk/jfr/snippet-files/Snippets.java index 37487d7195a..b2f3f62fbe7 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/snippet-files/Snippets.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/snippet-files/Snippets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jfr/share/man/jfr.md b/src/jdk.jfr/share/man/jfr.md index 185d7cfc3b3..b516c590084 100644 --- a/src/jdk.jfr/share/man/jfr.md +++ b/src/jdk.jfr/share/man/jfr.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java index bbf2bfacd00..fff585bb2dd 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/VersionPropsPlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/VersionPropsPlugin.java index f9a5463609a..86f68098453 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/VersionPropsPlugin.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/VersionPropsPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java index 5e540be7ced..3ef42fb9aa0 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/JimageDiffGenerator.java @@ -4,7 +4,9 @@ * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. + * 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 diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java index 12e8708477c..910fe57b75a 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/runtimelink/ResourcePoolReader.java @@ -4,7 +4,9 @@ * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. + * 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 diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties index 833b56ee5f3..31ed02a693c 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties index e54e62bafed..2beac29ca54 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties index 9c44e826b93..9bd20e1d843 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/man/jlink.md b/src/jdk.jlink/share/man/jlink.md index 8c344a692cb..74f2d119c69 100644 --- a/src/jdk.jlink/share/man/jlink.md +++ b/src/jdk.jlink/share/man/jlink.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jlink/share/man/jmod.md b/src/jdk.jlink/share/man/jmod.md index 273001b6a9a..6fd2aa54cf9 100644 --- a/src/jdk.jlink/share/man/jmod.md +++ b/src/jdk.jlink/share/man/jmod.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java index 1f86ce6fd23..433ea0fbe04 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java index 5f016c3f4bf..51f97ad2cd6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackageFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackageFile.java index e8bc0cb6655..bec8fb86bef 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackageFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackageFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/share/native/common/ErrorHandling.cpp b/src/jdk.jpackage/share/native/common/ErrorHandling.cpp index a3a4c2a9dfe..6d4daaaba05 100644 --- a/src/jdk.jpackage/share/native/common/ErrorHandling.cpp +++ b/src/jdk.jpackage/share/native/common/ErrorHandling.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/share/native/common/Log.cpp b/src/jdk.jpackage/share/native/common/Log.cpp index 8227bb1cce4..ecdeeb325a7 100644 --- a/src/jdk.jpackage/share/native/common/Log.cpp +++ b/src/jdk.jpackage/share/native/common/Log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/ShellScriptResource.java b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/ShellScriptResource.java index c6303636c66..268c6d173aa 100644 --- a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/ShellScriptResource.java +++ b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/ShellScriptResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java index 3d8982584e1..cbe772a3ae4 100644 --- a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java +++ b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java index 7c4b6092901..7eb7b922667 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp b/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp index 66fa92e3563..3e922bceb2c 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp +++ b/src/jdk.jpackage/windows/native/libjpackage/jpackage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent.properties index 5ee066fe825..323c4a1e1a4 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_de.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_de.properties index ec8882be5da..0641e98a135 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_de.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_es.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_es.properties index 9d408730cd0..ad2665e2ff4 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_es.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_es.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_fr.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_fr.properties index 011ae2fce6c..28e21825220 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_fr.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_fr.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_it.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_it.properties index 91cf39bdb3f..005dec54ea8 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_it.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_it.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties index 0f19b3060d2..ecaf1024d60 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ko.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ko.properties index 9fabc5c0b36..f4ff84db84e 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ko.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_ko.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_pt_BR.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_pt_BR.properties index 5343c8e16e7..773042234e9 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_pt_BR.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_pt_BR.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_sv.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_sv.properties index a3c695df0eb..7c4f2559ce1 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_sv.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_sv.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_CN.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_CN.properties index 5d33a024cce..64fdd2634e3 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_CN.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_TW.properties b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_TW.properties index 51cf0186825..55e9da252f2 100644 --- a/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_TW.properties +++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/resources/agent_zh_TW.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/FileDump.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/FileDump.java index 37ba2967326..75bf37e0b26 100644 --- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/FileDump.java +++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/FileDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java b/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java index d20d1ead35f..04b25081642 100644 --- a/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java +++ b/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java b/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java index 74ed636c9d6..ba11f16f81d 100644 --- a/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java +++ b/src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java @@ -274,8 +274,13 @@ public double getProcessCpuLoad() { } private boolean isCpuSetSameAsHostCpuSet() { - if (containerMetrics != null && containerMetrics.getCpuSetCpus() != null) { - return containerMetrics.getCpuSetCpus().length == getHostOnlineCpuCount0(); + if (containerMetrics != null) { + // The return value may change (including from non-null to null) and + // the call may involve I/O, so keep the result in a local variable. + int[] cpuSetCpus = containerMetrics.getCpuSetCpus(); + if (cpuSetCpus != null) { + return cpuSetCpus.length == getHostOnlineCpuCount0(); + } } return false; } diff --git a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java index fe35a4979cc..cb0f15fbd6b 100644 --- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java +++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.naming.rmi/share/classes/module-info.java b/src/jdk.naming.rmi/share/classes/module-info.java index f2ba8f7775f..4b91cd2bec9 100644 --- a/src/jdk.naming.rmi/share/classes/module-info.java +++ b/src/jdk.naming.rmi/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java index b7010b2e740..404299ef752 100644 --- a/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java +++ b/src/jdk.security.jgss/share/classes/com/sun/security/jgss/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml index 1ac64b16a4a..78e1b328501 100644 --- a/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml +++ b/src/utils/IdealGraphVisualizer/Bytecodes/pom.xml @@ -1,6 +1,6 @@