a0b8b886c8
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
CraftBukkit Changes:
d5a72960
SPIGOT-6063: ConsoleSender sending extra lines in Java 13+
Spigot Changes:
2740d5ae Rebuild patches
76 Zeilen
3.6 KiB
Diff
76 Zeilen
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Techcable <Techcable@outlook.com>
|
|
Date: Wed, 30 Nov 2016 20:56:58 -0600
|
|
Subject: [PATCH] Improve BlockPosition inlining
|
|
|
|
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
|
|
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
|
|
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.
|
|
|
|
This scenario also occurs with BlockPos and MutableBlockPos.
|
|
The variables in BlockPos are final, so MutableBlockPos can't modify them.
|
|
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.
|
|
|
|
This approach with utility methods that operate on MutableBlockPos and BlockPos.
|
|
Specific examples are BlockPosition.up(), and World.isValidLocation().
|
|
It makes these simple methods much slower than they need to be.
|
|
|
|
This should result in an across the board speedup in anything that accesses blocks or does logic with positions.
|
|
|
|
This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
|
|
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
|
index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bcd92f4d58 100644
|
|
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
|
@@ -39,7 +39,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
|
this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
|
|
}
|
|
|
|
- public boolean equals(Object object) {
|
|
+ public final boolean equals(Object object) { // Paper
|
|
if (this == object) {
|
|
return true;
|
|
} else if (!(object instanceof BaseBlockPosition)) {
|
|
@@ -51,7 +51,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
|
}
|
|
}
|
|
|
|
- public int hashCode() {
|
|
+ public final int hashCode() { // Paper
|
|
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
|
}
|
|
|
|
@@ -59,15 +59,15 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
|
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
|
}
|
|
|
|
- public int getX() {
|
|
+ public final int getX() { // Paper
|
|
return this.a;
|
|
}
|
|
|
|
- public int getY() {
|
|
+ public final int getY() { // Paper
|
|
return this.b;
|
|
}
|
|
|
|
- public int getZ() {
|
|
+ public final int getZ() { // Paper
|
|
return this.e;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
|
index 64e8088d394ddcda59d0209883b778ab74638c02..f112fe95cb89f6196a41252193e9eb44008cfc5f 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
|
@@ -82,6 +82,7 @@ public class BlockPosition extends BaseBlockPosition {
|
|
return a(this.getX(), this.getY(), this.getZ());
|
|
}
|
|
|
|
+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER
|
|
public static long a(int i, int j, int k) {
|
|
long l = 0L;
|
|
|