diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fefbc82e95..002c2b9ddf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ bstats = "3.2.1" sparsebitset = "1.3" parallelgzip = "1.0.5" adventure = "5.2.0" -checkerqual = "4.3.1" +checkerqual = "4.4.0" truezip = "6.8.4" auto-value = "1.11.1" jsr305 = "3.0.2" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b1b8ef56b4..51cbd2a6f8 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 988da1ab6c..6f77dd3908 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.9.1-all.zip networkTimeout=10000 retries=0 retryBackOffMs=500 diff --git a/gradlew.bat b/gradlew.bat index 8508ef684d..03754c4c3d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,33 @@ @rem Set local scope for the variables, and ensure extensions are enabled setlocal EnableExtensions +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet + set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. "%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,13 +87,14 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. "%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line @@ -75,8 +104,9 @@ echo location of your Java installation. 1>&2 @rem Execute gradlew @rem endlocal doesn't take effect until after the line is parsed and variables are expanded @rem which allows us to clear the local environment before executing the java command -endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel +@rem This label must not be changed. We rely on old scripts being able to jump to this point. :exitWithErrorLevel @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts "%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index d428715768..77cd8c1bd2 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -67,6 +67,7 @@ dependencies { tasks.test { maxHeapSize = "1G" + jvmArgs("--add-modules=jdk.incubator.vector") } tasks.compileJava { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/simd/SimdSupport.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/simd/SimdSupport.java index ba12f47e9e..65e385b959 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/simd/SimdSupport.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/simd/SimdSupport.java @@ -16,6 +16,7 @@ import jdk.incubator.vector.ShortVector; import jdk.incubator.vector.VectorMask; import jdk.incubator.vector.VectorOperators; +import jdk.incubator.vector.VectorSpecies; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; @@ -109,6 +110,18 @@ private static VectorizedMask vectorizedTargetMaskInverse(char ordinal) { }; } + /** + * {@return a vector with all lanes set to the given unsigned value} + * + * @param species the species to use + * @param value the value, e.g. a block state ordinal + */ + static ShortVector broadcast(VectorSpecies species, char value) { + // There is no broadcast(char): a char widens to long, and broadcast(long) rejects values above Short.MAX_VALUE. + // The short cast keeps the bit pattern, so reading the lanes back as chars yields the original value. + return ShortVector.broadcast(species, (short) value); + } + private static final class VectorizedPattern extends DelegateFilter implements VectorizedFilter { private final char ordinal; @@ -127,7 +140,7 @@ public Filter newInstance(final Filter other) { public void applyVector(final VectorFacade get, final VectorFacade set, final VectorMask mask) { ShortVector s = set.getOrZero(mask.vectorSpecies()); // only change the lanes the mask dictates us to change, keep the rest - s = s.blend(ShortVector.broadcast(ShortVector.SPECIES_PREFERRED, ordinal), mask); + s = s.blend(broadcast(mask.vectorSpecies(), ordinal), mask); set.setOrIgnore(s); } diff --git a/worldedit-core/src/test/java/com/fastasyncworldedit/core/internal/simd/SimdSupportTest.java b/worldedit-core/src/test/java/com/fastasyncworldedit/core/internal/simd/SimdSupportTest.java new file mode 100644 index 0000000000..3161e60331 --- /dev/null +++ b/worldedit-core/src/test/java/com/fastasyncworldedit/core/internal/simd/SimdSupportTest.java @@ -0,0 +1,27 @@ +package com.fastasyncworldedit.core.internal.simd; + +import jdk.incubator.vector.ShortVector; +import jdk.incubator.vector.VectorSpecies; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class SimdSupportTest { + + private static final VectorSpecies SPECIES = ShortVector.SPECIES_PREFERRED; + + @ParameterizedTest + @ValueSource(ints = {0, 1, Short.MAX_VALUE, Short.MAX_VALUE + 1, 34825, Character.MAX_VALUE}) + void broadcastChar(int value) { + char[] data = new char[SPECIES.length()]; + SimdSupport.broadcast(SPECIES, (char) value).intoCharArray(data, 0); + + char[] expected = new char[SPECIES.length()]; + Arrays.fill(expected, (char) value); + assertEquals(new String(expected), new String(data)); + } + +}