Add SIMD Support for Java 21 (#1499)

This commit is contained in:
rockfordroeNG
2024-03-31 03:02:44 -05:00
committed by GitHub
parent 2ebde54897
commit 48939f2d6d
3 changed files with 35 additions and 4 deletions

View File

@@ -18,9 +18,27 @@ index 7e82d2c6a6085a5ea335ba9ef2a5ec3f5a37e787..32366253c04c493135f2b22d1940f836
+ jvmArgs("-DPaper.isRunDev=true")
}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index f6a3364175476c57a7763a087ff55e1689474800..5e01bfdad663656168604fc878a993dd910bf45b 100644
index f6a3364175476c57a7763a087ff55e1689474800..8b8fe02b9db5192a3adb8d4a3bb3c2105f90544d 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -86,7 +86,7 @@ public class PufferfishConfig {
// Attempt to detect vectorization
try {
SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER);
- SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19;
+ SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21;
} catch (NoClassDefFoundError | Exception ignored) {
ignored.printStackTrace();
}
@@ -94,7 +94,7 @@ public class PufferfishConfig {
if (SIMDDetection.isEnabled) {
PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions.");
} else if (SIMDDetection.versionLimited) {
- PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17, Java 18, and Java 19.");
+ PufferfishLogger.LOGGER.warning("Will not enable SIMD! These optimizations are only safely supported on Java 17 through Java 21.");
} else {
PufferfishLogger.LOGGER.warning("SIMD operations are available for your server, but are not configured!");
PufferfishLogger.LOGGER.warning("To enable additional optimizations, add \"--add-modules=jdk.incubator.vector\" to your startup flags, BEFORE the \"-jar\".");
@@ -232,7 +232,7 @@ public class PufferfishConfig {
public static int activationDistanceMod;
@@ -62,7 +80,7 @@ index 62ad086b5b07303d920fdb3534a556673ef51f71..15aaa270e51b9194596e7ed5061c85c9
private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Pufferfish
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d18296739a833dbe6c3bf45e00d5d5c2e80099ac..d25dd9018eff5f3817c1b56f49632cc0a9388b8e 100644
index 5c5c8fbd562b46f8699be97353447eaab36c007a..385253bddf50c290317b6d0f283331edf515badd 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -825,7 +825,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S