Skip to content

Bump minimum JDK distribution version needed for builds to 24 #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ java {
// It seems that specifying the minimum supported Java version while allowing the use of newer
// ones isn't possible in Gradle. To test the library against multiple Java versions, the
// workaround proposed in https://github.com/gradle/gradle/issues/16256 has been applied:
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_18)) {
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_24)) {
toolchain {
languageVersion = JavaLanguageVersion.of(18)
languageVersion = JavaLanguageVersion.of(24)
}
}
withJavadocJar()
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
Expand Down
4 changes: 2 additions & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/simdjson/StructuralIndexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import static jdk.incubator.vector.ByteVector.SPECIES_256;
import static jdk.incubator.vector.ByteVector.SPECIES_512;
import static jdk.incubator.vector.VectorOperators.UNSIGNED_LE;
import static jdk.incubator.vector.VectorOperators.ULE;

class StructuralIndexer {

Expand Down Expand Up @@ -88,8 +88,8 @@ private void index256(byte[] buffer, int length) {
escaped = (EVEN_BITS_MASK ^ invertMask) & followsEscape;
}

long unescaped0 = chunk0.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped1 = chunk1.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped0 = chunk0.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long unescaped1 = chunk1.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long unescaped = unescaped0 | (unescaped1 << 32);

long quote0 = chunk0.eq(QUOTE).toLong();
Expand Down Expand Up @@ -148,8 +148,8 @@ private void index256(byte[] buffer, int length) {
escaped = (EVEN_BITS_MASK ^ invertMask) & followsEscape;
}

long unescaped0 = chunk0.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped1 = chunk1.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped0 = chunk0.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long unescaped1 = chunk1.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long unescaped = unescaped0 | (unescaped1 << 32);

long quote0 = chunk0.eq(QUOTE).toLong();
Expand Down Expand Up @@ -228,7 +228,7 @@ private void index512(byte[] buffer, int length) {
escaped = (EVEN_BITS_MASK ^ invertMask) & followsEscape;
}

long unescaped = chunk.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped = chunk.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long quote = chunk.eq(QUOTE).toLong() & ~escaped;
long inString = prefixXor(quote) ^ prevInString;
prevInString = inString >> 63;
Expand Down Expand Up @@ -271,7 +271,7 @@ private void index512(byte[] buffer, int length) {
escaped = (EVEN_BITS_MASK ^ invertMask) & followsEscape;
}

long unescaped = chunk.compare(UNSIGNED_LE, LAST_CONTROL_CHARACTER).toLong();
long unescaped = chunk.compare(ULE, LAST_CONTROL_CHARACTER).toLong();
long quote = chunk.eq(QUOTE).toLong() & ~escaped;
long inString = prefixXor(quote) ^ prevInString;
prevInString = inString >> 63;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/simdjson/Utf8Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import static jdk.incubator.vector.VectorOperators.LSHL;
import static jdk.incubator.vector.VectorOperators.LSHR;
import static jdk.incubator.vector.VectorOperators.NE;
import static jdk.incubator.vector.VectorOperators.UNSIGNED_GE;
import static jdk.incubator.vector.VectorOperators.UNSIGNED_GT;
import static jdk.incubator.vector.VectorOperators.UGE;
import static jdk.incubator.vector.VectorOperators.UGT;
import static jdk.incubator.vector.VectorShuffle.iota;
import static org.simdjson.VectorUtils.BYTE_SPECIES;
import static org.simdjson.VectorUtils.INT_SPECIES;
Expand Down Expand Up @@ -65,7 +65,7 @@ static void validate(byte[] buffer, int length) {
if (chunk.and(ALL_ASCII_MASK).compare(EQ, 0).allTrue()) {
errors |= previousIncomplete;
} else {
previousIncomplete = chunk.compare(UNSIGNED_GE, INCOMPLETE_CHECK).toLong();
previousIncomplete = chunk.compare(UGE, INCOMPLETE_CHECK).toLong();
// Shift the input forward by four bytes to make space for the previous four bytes.
// The previous three bytes are required for validation, pulling in the last integer
// will give the previous four bytes. The switch to integer vectors is to allow for
Expand Down Expand Up @@ -97,13 +97,13 @@ static void validate(byte[] buffer, int length) {
.or(chunkWithPreviousFourBytes.lanewise(LSHR, TWO_BYTES_SIZE))
.reinterpretAsBytes();
// The minimum leading byte of 3-byte sequences is always greater than the maximum leading byte of 2-byte sequences.
VectorMask<Byte> is3ByteLead = previousTwoBytes.compare(UNSIGNED_GT, MAX_2_LEADING_BYTE);
VectorMask<Byte> is3ByteLead = previousTwoBytes.compare(UGT, MAX_2_LEADING_BYTE);
ByteVector previousThreeBytes = chunkAsInts
.lanewise(LSHL, THREE_BYTES_SIZE)
.or(chunkWithPreviousFourBytes.lanewise(LSHR, Byte.SIZE))
.reinterpretAsBytes();
// The minimum leading byte of 4-byte sequences is always greater than the maximum leading byte of 3-byte sequences.
VectorMask<Byte> is4ByteLead = previousThreeBytes.compare(UNSIGNED_GT, MAX_3_LEADING_BYTE);
VectorMask<Byte> is4ByteLead = previousThreeBytes.compare(UGT, MAX_3_LEADING_BYTE);
// The firstCheck vector contains 0x80 values on continuation byte indexes.
// The leading bytes of 3 and 4-byte sequences should match up with these indexes and zero them out.
ByteVector secondCheck = firstCheck.add((byte) 0x80, is3ByteLead.or(is4ByteLead));
Expand All @@ -117,7 +117,7 @@ static void validate(byte[] buffer, int length) {
ByteVector chunk = ByteVector.fromArray(BYTE_SPECIES, buffer, offset, remainingBytes);
if (!chunk.and(ALL_ASCII_MASK).compare(EQ, 0).allTrue()) {
IntVector chunkAsInts = chunk.reinterpretAsInts();
previousIncomplete = chunk.compare(UNSIGNED_GE, INCOMPLETE_CHECK).toLong();
previousIncomplete = chunk.compare(UGE, INCOMPLETE_CHECK).toLong();
// Shift the input forward by four bytes to make space for the previous four bytes.
// The previous three bytes are required for validation, pulling in the last integer
// will give the previous four bytes. The switch to integer vectors is to allow for
Expand Down Expand Up @@ -149,13 +149,13 @@ static void validate(byte[] buffer, int length) {
.or(chunkWithPreviousFourBytes.lanewise(LSHR, TWO_BYTES_SIZE))
.reinterpretAsBytes();
// The minimum leading byte of 3-byte sequences is always greater than the maximum leading byte of 2-byte sequences.
VectorMask<Byte> is3ByteLead = previousTwoBytes.compare(UNSIGNED_GT, MAX_2_LEADING_BYTE);
VectorMask<Byte> is3ByteLead = previousTwoBytes.compare(UGT, MAX_2_LEADING_BYTE);
ByteVector previousThreeBytes = chunkAsInts
.lanewise(LSHL, THREE_BYTES_SIZE)
.or(chunkWithPreviousFourBytes.lanewise(LSHR, Byte.SIZE))
.reinterpretAsBytes();
// The minimum leading byte of 4-byte sequences is always greater than the maximum leading byte of 3-byte sequences.
VectorMask<Byte> is4ByteLead = previousThreeBytes.compare(UNSIGNED_GT, MAX_3_LEADING_BYTE);
VectorMask<Byte> is4ByteLead = previousThreeBytes.compare(UGT, MAX_3_LEADING_BYTE);
// The firstCheck vector contains 0x80 values on continuation byte indexes.
// The leading bytes of 3 and 4-byte sequences should match up with these indexes and zero them out.
ByteVector secondCheck = firstCheck.add((byte) 0x80, is3ByteLead.or(is4ByteLead));
Expand Down