diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3449828a294..1c3006176117 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -119,25 +119,25 @@ jobs: MX_RUNS_STYLE: ${{ contains(matrix.env.GATE_TAGS, 'style') || matrix.env.GATE_TAGS == '' }} steps: - name: Checkout oracle/graal - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.ref }} # Lock ref to current branch to avoid fetching others fetch-depth: "${{ env.MX_RUNS_STYLE && '0' || '1' }}" # The style gate needs the full commit history for checking copyright years - name: Determine mx version run: echo "MX_VERSION=$(jq -r '.mx_version' common.json)" >> ${GITHUB_ENV} - name: Checkout graalvm/mx - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: graalvm/mx.git ref: ${{ env.MX_VERSION }} fetch-depth: 1 path: ${{ env.MX_PATH }} - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.8' - name: Update mx cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.mx key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index 02a00565ff87..7fb0632652c6 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -4,7 +4,7 @@ "sourceinprojectwhitelist" : [], "groupId" : "org.graalvm.compiler", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "url" : "http://www.graalvm.org/", "developer" : { diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/lir/aarch64/AArch64AtomicMove.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/lir/aarch64/AArch64AtomicMove.java index af073574594c..ed8196c63223 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/lir/aarch64/AArch64AtomicMove.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/lir/aarch64/AArch64AtomicMove.java @@ -112,7 +112,7 @@ public CompareAndSwapOp(AArch64Kind accessKind, MemoryOrderMode memoryOrder, boo } /** - * Both cas and ld(a)xr produce a zero-extended value. Since comparisons must be at minimum + * Both cas and ldxr produce a zero-extended value. Since comparisons must be at minimum * 32-bits, the expected value must also be zero-extended to produce an accurate comparison. */ private static void emitCompare(AArch64MacroAssembler masm, int memAccessSize, Register result, Register expected) { @@ -169,8 +169,9 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { throw GraalError.shouldNotReachHereUnexpectedValue(memoryOrder); // ExcludeFromJacocoGeneratedReport } + int moveSize = Math.max(memAccessSize, 32); if (AArch64LIRFlags.useLSE(masm)) { - masm.mov(Math.max(memAccessSize, 32), result, expected); + masm.mov(moveSize, result, expected); moveSPAndEmitCode(masm, asRegister(newValue), newVal -> { masm.cas(memAccessSize, result, newVal, address, acquire, release); }); @@ -178,44 +179,54 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { emitCompare(masm, memAccessSize, result, expected); } } else { + + try (ScratchRegister scratchRegister1 = masm.getScratchRegister(); ScratchRegister scratchRegister2 = masm.getScratchRegister()) { + Label retry = new Label(); + masm.bind(retry); + Register scratch2 = scratchRegister2.getRegister(); + Register newValueReg = asRegister(newValue); + if (newValueReg.equals(sp)) { + /* + * SP cannot be used in csel or stl(x)r. + * + * Since csel overwrites scratch2, newValue must be newly loaded each loop + * iteration. However, unless under heavy contention, the storeExclusive + * should rarely fail. + */ + masm.mov(moveSize, scratch2, newValueReg); + newValueReg = scratch2; + } + masm.loadExclusive(memAccessSize, result, address, false); + + emitCompare(masm, memAccessSize, result, expected); + masm.csel(moveSize, scratch2, newValueReg, result, AArch64Assembler.ConditionFlag.EQ); + + /* + * STLXR must be used also if acquire is set to ensure prior ldaxr/stlxr + * instructions are not reordered after it. + */ + Register scratch1 = scratchRegister1.getRegister(); + masm.storeExclusive(memAccessSize, scratch1, scratch2, address, acquire || release); + // if scratch1 == 0 then write successful, else retry. + masm.cbnz(32, scratch1, retry); + } + /* - * Because the store is only conditionally emitted, a dmb is needed for performing a - * release. - * - * Furthermore, even if the stlxr is emitted, if both acquire and release semantics - * are required, then a dmb is anyways needed to ensure that the instruction - * sequence: + * From the Java perspective, the (ldxr, cmp, csel, stl(x)r) is a single atomic + * operation which must abide by all requested semantics. Therefore, when acquire + * semantics are needed, we use a full barrier after the store to guarantee that + * instructions following the store cannot execute before it and violate acquire + * semantics. * - * A -> ldaxr -> stlxr -> B - * - * cannot be executed as: - * - * ldaxr -> B -> A -> stlxr + * Note we could instead perform a conditional branch and when the comparison fails + * skip the store, but this introduces an opportunity for branch mispredictions, and + * also, when release semantics are needed, requires a barrier to be inserted before + * the operation. */ - if (release) { + + if (acquire) { masm.dmb(AArch64Assembler.BarrierKind.ANY_ANY); } - - moveSPAndEmitCode(masm, asRegister(newValue), newVal -> { - try (ScratchRegister scratchRegister = masm.getScratchRegister()) { - Register scratch = scratchRegister.getRegister(); - Label retry = new Label(); - Label fail = new Label(); - masm.bind(retry); - masm.loadExclusive(memAccessSize, result, address, acquire); - emitCompare(masm, memAccessSize, result, expected); - masm.branchConditionally(AArch64Assembler.ConditionFlag.NE, fail); - /* - * Even with the prior dmb, for releases it is still necessary to use stlxr - * instead of stxr to guarantee subsequent lda(x)r/stl(x)r cannot be hoisted - * above this instruction and thereby violate volatile semantics. - */ - masm.storeExclusive(memAccessSize, scratch, newVal, address, release); - // if scratch == 0 then write successful, else retry. - masm.cbnz(32, scratch, retry); - masm.bind(fail); - } - }); } } } @@ -291,14 +302,10 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { } } /* - * Use a full barrier for the acquire semantics instead of ldaxr to guarantee that the - * instruction sequence: - * - * A -> ldaxr -> stlxr -> B - * - * cannot be executed as: - * - * ldaxr -> B -> A -> stlxr + * From the Java perspective, the (ldxr, add, stlxr) is a single atomic operation which + * must abide by both acquire and release semantics. Therefore, we use a full barrier + * after the store to guarantee that instructions following the store cannot execute + * before it and violate acquire semantics. */ masm.dmb(AArch64Assembler.BarrierKind.ANY_ANY); } @@ -406,14 +413,10 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) { // if scratch == 0 then write successful, else retry masm.cbnz(32, scratch, retry); /* - * Use a full barrier for the acquire semantics instead of ldaxr to - * guarantee that the instruction sequence: - * - * A -> ldaxr -> stlxr -> B - * - * cannot be executed as: - * - * ldaxr -> B -> A -> stlxr + * From the Java perspective, the (ldxr, stlxr) is a single atomic operation + * which must abide by both acquire and release semantics. Therefore, we use + * a full barrier after the store to guarantee that instructions following + * the store cannot execute before it and violate acquire semantics. */ masm.dmb(AArch64Assembler.BarrierKind.ANY_ANY); } diff --git a/espresso/mx.espresso/suite.py b/espresso/mx.espresso/suite.py index 98f3f4b2cf0b..e58af602678d 100644 --- a/espresso/mx.espresso/suite.py +++ b/espresso/mx.espresso/suite.py @@ -23,7 +23,7 @@ suite = { "mxversion": "6.44.0", "name": "espresso", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "groupId" : "org.graalvm.espresso", "url" : "https://www.graalvm.org/reference-manual/java-on-truffle/", diff --git a/regex/mx.regex/suite.py b/regex/mx.regex/suite.py index c9e2bb2eeec6..661486dd7989 100644 --- a/regex/mx.regex/suite.py +++ b/regex/mx.regex/suite.py @@ -43,7 +43,7 @@ "name" : "regex", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "groupId" : "org.graalvm.regex", "url" : "http://www.graalvm.org/", diff --git a/sdk/mx.sdk/suite.py b/sdk/mx.sdk/suite.py index f26d001c47ef..ac3f731e4c2c 100644 --- a/sdk/mx.sdk/suite.py +++ b/sdk/mx.sdk/suite.py @@ -41,7 +41,7 @@ suite = { "mxversion": "6.39.0", "name" : "sdk", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "sourceinprojectwhitelist" : [], "url" : "https://github.com/oracle/graal", diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index c7a471abd7c9..ccd338194bf4 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -2,7 +2,7 @@ suite = { "mxversion": "6.27.1", "name": "substratevm", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "url" : "https://github.com/oracle/graal/tree/master/substratevm", diff --git a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/JfrGCHeapSummaryEvent.java b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/JfrGCHeapSummaryEvent.java index 232456a9fc29..76194023be8d 100644 --- a/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/JfrGCHeapSummaryEvent.java +++ b/substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/JfrGCHeapSummaryEvent.java @@ -55,11 +55,12 @@ private static void emit0(UnsignedWord gcEpoch, long start, UnsignedWord committ JfrNativeEventWriter.putLong(data, gcWhen.getId()); // VirtualSpace - JfrNativeEventWriter.putLong(data, 0L); // start - JfrNativeEventWriter.putLong(data, 0L); // committedEnd + JfrNativeEventWriter.putLong(data, -1); // start + JfrNativeEventWriter.putLong(data, -1); // committedEnd JfrNativeEventWriter.putLong(data, committedSize.rawValue()); - JfrNativeEventWriter.putLong(data, 0L); // reservedEnd - JfrNativeEventWriter.putLong(data, 0L); // reservedSize + JfrNativeEventWriter.putLong(data, -1); // reservedEnd + // Reserved heap size matches committed size + JfrNativeEventWriter.putLong(data, committedSize.rawValue()); // reservedSize JfrNativeEventWriter.putLong(data, heapUsed.rawValue()); JfrNativeEventWriter.endSmallEvent(data); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateExitHandlerFeature.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateExitHandlerFeature.java index d1ff3cac988b..173c7e5436f1 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateExitHandlerFeature.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateExitHandlerFeature.java @@ -34,7 +34,7 @@ public class SubstrateExitHandlerFeature implements InternalFeature { @Override public void beforeAnalysis(BeforeAnalysisAccess access) { - if (SubstrateOptions.InstallExitHandlers.getValue()) { + if (SubstrateOptions.InstallExitHandlers.getValue() || VMInspectionOptions.hasJfrSupport()) { RuntimeSupport.getRuntimeSupport().addStartupHook(new SubstrateExitHandlerStartupHook()); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Resources.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Resources.java index 28bfec77f7e2..15963c1437ef 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Resources.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Resources.java @@ -280,10 +280,28 @@ public void registerIncludePattern(String module, String pattern) { assert MissingRegistrationUtils.throwMissingRegistrationErrors(); synchronized (includePatterns) { updateTimeStamp(); - includePatterns.add(new ModuleResourcePair(module, pattern)); + includePatterns.add(new ModuleResourcePair(module, handleEscapedCharacters(pattern))); } } + @Platforms(Platform.HOSTED_ONLY.class)// + private static final String BEGIN_ESCAPED_SEQUENCE = "\\Q"; + + @Platforms(Platform.HOSTED_ONLY.class)// + private static final String END_ESCAPED_SEQUENCE = "\\E"; + + /* + * This handles generated include patterns which start and end with \Q and \E. The actual + * resource name is located inbetween those tags. + */ + @Platforms(Platform.HOSTED_ONLY.class) + private static String handleEscapedCharacters(String pattern) { + if (pattern.startsWith(BEGIN_ESCAPED_SEQUENCE) && pattern.endsWith(END_ESCAPED_SEQUENCE)) { + return pattern.substring(BEGIN_ESCAPED_SEQUENCE.length(), pattern.length() - END_ESCAPED_SEQUENCE.length()); + } + return pattern; + } + /** * Avoid pulling native file system by using {@link NativeImageResourcePath} implementation to * convert resourceName to canonical variant. diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/MissingSerializationRegistrationUtils.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/MissingSerializationRegistrationUtils.java index 049df6208a9d..9d0bc4926866 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/MissingSerializationRegistrationUtils.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/MissingSerializationRegistrationUtils.java @@ -39,7 +39,9 @@ public final class MissingSerializationRegistrationUtils { public static void missingSerializationRegistration(Class cl, String... msg) { - report(new MissingSerializationRegistrationError(errorMessage(msg), cl)); + MissingSerializationRegistrationError exception = new MissingSerializationRegistrationError(errorMessage(msg), cl); + StackTraceElement responsibleClass = getResponsibleClass(exception); + MissingRegistrationUtils.report(exception, responsibleClass); } private static String errorMessage(String... type) { @@ -55,11 +57,6 @@ private static String errorMessage(String... type) { .formatted(typeStr); } - private static void report(MissingSerializationRegistrationError exception) { - StackTraceElement responsibleClass = getResponsibleClass(exception); - MissingRegistrationUtils.report(exception, responsibleClass); - } - /* * This is a list of all public JDK methods that end up potentially throwing missing * registration errors. This should be implemented using wrapping substitutions once they are diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java index ae07d0cd589b..d338b2461bbe 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java @@ -158,7 +158,7 @@ public Object getSerializationConstructorAccessor(Class rawDeclaringClass, Cl String targetConstructorClassName = targetConstructorClass.getName(); if (ThrowMissingRegistrationErrors.hasBeenSet()) { MissingSerializationRegistrationUtils.missingSerializationRegistration(declaringClass, - "type " + declaringClass.getName() + " with target constructor class: " + targetConstructorClassName); + "type " + declaringClass.getTypeName() + " with target constructor class: " + targetConstructorClassName); } else { throw VMError.unsupportedFeature("SerializationConstructorAccessor class not found for declaringClass: " + declaringClass.getName() + " (targetConstructorClass: " + targetConstructorClassName + "). Usually adding " + declaringClass.getName() + diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/serialize/SerializationFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/serialize/SerializationFeature.java index c665eeff3124..32a4813ca802 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/serialize/SerializationFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/serialize/SerializationFeature.java @@ -669,9 +669,6 @@ private static Constructor getExternalizableConstructor(Class serializatio Class addConstructorAccessor(Class serializationTargetClass, Class customTargetConstructorClass) { serializationSupport.registerSerializationTargetClass(serializationTargetClass); - if (serializationTargetClass.isArray() || Enum.class.isAssignableFrom(serializationTargetClass)) { - return null; - } // Don't generate SerializationConstructorAccessor class for Externalizable case if (Externalizable.class.isAssignableFrom(serializationTargetClass)) { diff --git a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/AbstractJfrTest.java b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/AbstractJfrTest.java index ffde76ad560e..73b95ece753e 100644 --- a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/AbstractJfrTest.java +++ b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/AbstractJfrTest.java @@ -41,6 +41,7 @@ import org.graalvm.nativeimage.ImageInfo; import org.graalvm.nativeimage.hosted.Feature; +import org.graalvm.nativeimage.hosted.RuntimeProxyCreation; import org.junit.After; import org.junit.Assert; import org.junit.BeforeClass; @@ -54,6 +55,7 @@ import jdk.jfr.Configuration; import jdk.jfr.consumer.RecordedEvent; import jdk.jfr.consumer.RecordingFile; +import jdk.jfr.Unsigned; /** Base class for JFR unit tests. */ public abstract class AbstractJfrTest { @@ -196,4 +198,16 @@ public void afterRegistration(AfterRegistrationAccess access) { */ ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, JfrTestFeature.class, false, "jdk.internal.vm.compiler", "org.graalvm.compiler.serviceprovider"); } + + @Override + public void beforeAnalysis(BeforeAnalysisAccess access) { + /* + * Register proxies for event data assertion + * + * Unsigned added to be able to query RecordedObject.getLong() method, and this method + * checks if the value returned has the jdk.jfr.Unsigned. The jfr layer in HotSpot creates a + * proxy to query this information. + */ + RuntimeProxyCreation.register(Unsigned.class); + } } diff --git a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/TestGCHeapSummaryEvent.java b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/TestGCHeapSummaryEvent.java index b0f457a73446..627cb16d4083 100644 --- a/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/TestGCHeapSummaryEvent.java +++ b/substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/TestGCHeapSummaryEvent.java @@ -25,6 +25,7 @@ package com.oracle.svm.test.jfr; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.List; @@ -35,6 +36,7 @@ import jdk.jfr.Recording; import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordedObject; public class TestGCHeapSummaryEvent extends JfrRecordingTest { @Test @@ -49,5 +51,18 @@ public void test() throws Throwable { private static void validateEvents(List events) { assertTrue(events.size() > 0); + for (RecordedEvent event : events) { + RecordedObject heapSpace = event.getValue("heapSpace"); + assertEquals(-1, heapSpace.getLong("start")); + assertEquals(-1, heapSpace.getLong("committedEnd")); + assertEquals(-1, heapSpace.getLong("reservedEnd")); + + long committedSize = heapSpace.getLong("committedSize"); + assertTrue(committedSize > 0); + assertTrue(heapSpace.getLong("reservedSize") >= committedSize); + assertTrue(event.getLong("gcId") >= 0); + assertTrue(event.getString("when").equals("Before GC") || event.getString("when").equals("After GC")); + assertTrue(event.getLong("heapUsed") > 0); + } } } diff --git a/tools/mx.tools/suite.py b/tools/mx.tools/suite.py index d46dbeaca635..211c143b5fc7 100644 --- a/tools/mx.tools/suite.py +++ b/tools/mx.tools/suite.py @@ -26,7 +26,7 @@ "defaultLicense" : "GPLv2-CPE", "groupId" : "org.graalvm.tools", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "url" : "http://openjdk.java.net/projects/graal", "developer" : { diff --git a/truffle/external_repos/simplelanguage/pom.xml b/truffle/external_repos/simplelanguage/pom.xml index 7fdaa6fc37d8..5d9545a123bf 100644 --- a/truffle/external_repos/simplelanguage/pom.xml +++ b/truffle/external_repos/simplelanguage/pom.xml @@ -48,7 +48,7 @@ UTF-8 jdt_apt - 23.1.3-dev + 23.1.5-dev 11 11 diff --git a/truffle/external_repos/simplelanguage/sl b/truffle/external_repos/simplelanguage/sl index 59f10a39e513..df434100a8da 100755 --- a/truffle/external_repos/simplelanguage/sl +++ b/truffle/external_repos/simplelanguage/sl @@ -41,7 +41,7 @@ # # If you update this number make sure the graalvm.version value in ./pom.xml matches -VERSION="23.1.3-dev" +VERSION="23.1.5-dev" # If you update this number make sure the antlr.version value in language/pom.xml matches ANTLR_VERSION="4.12.0" diff --git a/truffle/external_repos/simpletool/pom.xml b/truffle/external_repos/simpletool/pom.xml index 5b591cc00542..810e6ab33d87 100644 --- a/truffle/external_repos/simpletool/pom.xml +++ b/truffle/external_repos/simpletool/pom.xml @@ -49,7 +49,7 @@ UTF-8 1.8 1.8 - 23.1.3-dev + 23.1.5-dev diff --git a/truffle/mx.truffle/mx_truffle.py b/truffle/mx.truffle/mx_truffle.py index 15358b7738cc..9df3b85bb8d3 100644 --- a/truffle/mx.truffle/mx_truffle.py +++ b/truffle/mx.truffle/mx_truffle.py @@ -1036,10 +1036,10 @@ def __init__(self, suite, name, deps, workingSets, **kwargs): self.out_dir = self.get_output_root() if mx.get_os() == 'windows': self.delegate = mx_native.DefaultNativeProject(suite, name, subDir, [], [], None, - mx.join(self.out_dir, 'libffi-3.4.4'), + mx.join(self.out_dir, 'libffi-3.4.6'), 'static_lib', deliverable='ffi', - cflags=['-MD', '-O2', '-DFFI_BUILDING_DLL']) + cflags=['-MD', '-O2', '-DFFI_STATIC_BUILD']) self.delegate._source = dict(tree=['include', 'src', mx.join('src', 'x86')], @@ -1073,7 +1073,7 @@ def getArchivableResults(self, use_relpath=True, single=False): 'include/ffi.h', 'include/ffitarget.h'], mx.join(self.out_dir, 'libffi-build'), - mx.join(self.out_dir, 'libffi-3.4.4')) + mx.join(self.out_dir, 'libffi-3.4.6')) configure_args = ['--disable-dependency-tracking', '--disable-shared', '--with-pic', diff --git a/truffle/mx.truffle/suite.py b/truffle/mx.truffle/suite.py index 4b15d6526c5f..ef59a25ef839 100644 --- a/truffle/mx.truffle/suite.py +++ b/truffle/mx.truffle/suite.py @@ -41,7 +41,7 @@ suite = { "mxversion": "6.39.0", "name" : "truffle", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "release" : False, "groupId" : "org.graalvm.truffle", "sourceinprojectwhitelist" : [], @@ -72,12 +72,12 @@ "LIBFFI_SOURCES" : { "resource" : True, - "version" : "3.4.4", + "version" : "3.4.6", "urls" : [ "https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/libffi-{version}.tar.gz", "https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz", ], - "digest" : "sha512:88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889", + "digest" : "sha512:033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39", }, "ANTLR4": { diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/FileSystemsTest.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/FileSystemsTest.java index 1c46f71b41be..631a8ceb1264 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/FileSystemsTest.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/FileSystemsTest.java @@ -2044,7 +2044,7 @@ public void testSetAttribute() throws IOException { boolean canRead = cfg.canRead(); boolean canWrite = cfg.canWrite(); AbstractExecutableTestLanguage.evalTestLanguage(ctx, TestSetAttributeLanguage.class, "", configuration, path, usePublicFile, canRead, canWrite, supportsUnixAttributes(), - supportsSetLastAccessTime()); + supportsSetLastAccessTime(), supportsSetCreationTime()); } @Registration @@ -2059,6 +2059,7 @@ protected Object execute(RootNode node, Env env, Object[] contextArguments, Obje boolean canWrite = (boolean) contextArguments[4]; boolean supportsUnixAttributes = (boolean) contextArguments[5]; boolean supportsSetLastAccessTime = (boolean) contextArguments[6]; + boolean supportsSetCreationTime = (boolean) contextArguments[7]; TruffleFile root = resolve(env, usePublicFile, path); try { TruffleFile file = root.resolve(FILE_CHANGE_ATTRS); @@ -2067,14 +2068,18 @@ protected Object execute(RootNode node, Env env, Object[] contextArguments, Obje Assert.assertTrue(formatErrorMessage("Expected SecurityException", configurationName, path), canWrite); Assert.assertEquals(time, file.getAttribute(TruffleFile.LAST_MODIFIED_TIME)); Assert.assertTrue(formatErrorMessage("Expected SecurityException", configurationName, path), canRead); + file.setAttribute(TruffleFile.LAST_ACCESS_TIME, time); + FileTime lastAccessTime = file.getAttribute(TruffleFile.LAST_ACCESS_TIME); // Workaround for issue JDK-8298187: The file last access time does not work on // JDK-20 on macOS with the hfs file system. if (supportsSetLastAccessTime) { - file.setAttribute(TruffleFile.LAST_ACCESS_TIME, time); - Assert.assertEquals(time, file.getAttribute(TruffleFile.LAST_ACCESS_TIME)); + Assert.assertEquals(time, lastAccessTime); } file.setAttribute(TruffleFile.CREATION_TIME, time); - Assert.assertEquals(time, file.getAttribute(TruffleFile.CREATION_TIME)); + FileTime creationTime = file.getAttribute(TruffleFile.CREATION_TIME); + if (supportsSetCreationTime) { + Assert.assertEquals(time, creationTime); + } file.setAttribute(TruffleFile.UNIX_PERMISSIONS, EnumSet.of(PosixFilePermission.OWNER_READ)); Assert.assertEquals(EnumSet.of(PosixFilePermission.OWNER_READ), file.getAttribute(TruffleFile.UNIX_PERMISSIONS)); file.setAttribute(TruffleFile.UNIX_PERMISSIONS, EnumSet.of(PosixFilePermission.OWNER_READ)); @@ -2106,6 +2111,17 @@ private boolean supportsSetLastAccessTime() throws IOException { return true; } + /** + * Returns {@code true} if the operating system supports file creation time modification. Note: + * Posix does not support setting a file's creation time directly. MacOS and BSD Unix, however, + * provide an additional system call {@code fsetattrlist} utilized by Java NIO to set the + * creation time. On Linux, the Posix functions {@code utimes}, {@code futimens}, or + * {@code utimensat} are employed, allowing modification only of access and modification times. + */ + private static boolean supportsSetCreationTime() { + return OSUtils.isWindows() || OSUtils.getCurrent() == OSUtils.OS.Darwin; + } + @Test public void testGetAttributes() throws IOException { Context ctx = cfg.getContext(); diff --git a/truffle/src/com.oracle.truffle.nfi.native/src/closure.c b/truffle/src/com.oracle.truffle.nfi.native/src/closure.c index 792c3dc55722..cbc9653c4357 100644 --- a/truffle/src/com.oracle.truffle.nfi.native/src/closure.c +++ b/truffle/src/com.oracle.truffle.nfi.native/src/closure.c @@ -40,7 +40,7 @@ */ #if defined(_WIN32) // Workaround for static linking. See comment in ffi.h, line 115. -#define FFI_BUILDING +#define FFI_STATIC_BUILD #endif #include "trufflenfi.h" diff --git a/truffle/src/com.oracle.truffle.nfi.native/src/jni.c b/truffle/src/com.oracle.truffle.nfi.native/src/jni.c index c50d5291b8bd..0e7259c49d8c 100644 --- a/truffle/src/com.oracle.truffle.nfi.native/src/jni.c +++ b/truffle/src/com.oracle.truffle.nfi.native/src/jni.c @@ -40,7 +40,7 @@ */ #if defined(_WIN32) // Workaround for static linking. See comment in ffi.h, line 115. -#define FFI_BUILDING +#define FFI_STATIC_BUILD #endif #include "native.h" diff --git a/truffle/src/com.oracle.truffle.nfi.native/src/signature.c b/truffle/src/com.oracle.truffle.nfi.native/src/signature.c index 351f85507a89..23bddd6a5853 100644 --- a/truffle/src/com.oracle.truffle.nfi.native/src/signature.c +++ b/truffle/src/com.oracle.truffle.nfi.native/src/signature.c @@ -40,7 +40,7 @@ */ #if defined(_WIN32) // Workaround for static linking. See comment in ffi.h, line 115. -#define FFI_BUILDING +#define FFI_STATIC_BUILD #endif #include "native.h" diff --git a/truffle/src/libffi/patches/windows-amd64/0001-Preconfigure-sources-for-x64-Windows-build.patch b/truffle/src/libffi/patches/windows-amd64/0001-Preconfigure-sources-for-x64-Windows-build.patch index cdbab9f6f261..884695dac285 100644 --- a/truffle/src/libffi/patches/windows-amd64/0001-Preconfigure-sources-for-x64-Windows-build.patch +++ b/truffle/src/libffi/patches/windows-amd64/0001-Preconfigure-sources-for-x64-Windows-build.patch @@ -1,10 +1,11 @@ -From dcbda6eaf27ea03dd09b0d7edf67351c07209f2f Mon Sep 17 00:00:00 2001 +From fd913e2cce4901c12be4b6e0d88a1a719cc3a8fb Mon Sep 17 00:00:00 2001 From: Roland Schatz -Date: Thu, 7 Apr 2022 18:09:05 +0200 +Date: Mon, 8 Jul 2024 14:18:28 +0200 Subject: [PATCH 1/2] Preconfigure sources for x64 Windows build -The configuration was done using Git for Windows to run -`configure` from Developer Command Prompt: +The configuration was done using the x64 Native Tools Command Prompt for +VS 2022, with Git for Windows on the PATH. To reproduce run this +command: > sh configure --disable-builddir ^ --disable-dependency-tracking ^ @@ -16,22 +17,22 @@ The configuration was done using Git for Windows to run CXXCPP="cl -nologo -EP" ^ --build=amd64-mingw64 --- - fficonfig.h.in => fficonfig.h | 125 ++++++++++++++++--------------- - include/{ffi.h.in => ffi.h} | 18 ++--- + fficonfig.h.in => fficonfig.h | 103 ++++++++++++++++--------------- + include/{ffi.h.in => ffi.h} | 14 ++--- {src/x86 => include}/ffitarget.h | 0 - 3 files changed, 72 insertions(+), 71 deletions(-) - rename fficonfig.h.in => fficonfig.h (71%) + 3 files changed, 59 insertions(+), 58 deletions(-) + rename fficonfig.h.in => fficonfig.h (70%) rename include/{ffi.h.in => ffi.h} (98%) rename {src/x86 => include}/ffitarget.h (100%) diff --git a/fficonfig.h.in b/fficonfig.h -similarity index 71% +similarity index 70% rename from fficonfig.h.in rename to fficonfig.h -index d38b781..6284190 100644 +index 2e4aac6..59723f3 100644 --- a/fficonfig.h.in +++ b/fficonfig.h -@@ -1,171 +1,172 @@ +@@ -1,159 +1,160 @@ +/* fficonfig.h. Generated from fficonfig.h.in by configure. */ /* fficonfig.h.in. Generated from configure.ac by autoheader. */ @@ -39,10 +40,6 @@ index d38b781..6284190 100644 -#undef AC_APPLE_UNIVERSAL_BUILD +/* #undef AC_APPLE_UNIVERSAL_BUILD */ - /* Define to 1 if using 'alloca.c'. */ --#undef C_ALLOCA -+/* #undef C_ALLOCA */ - /* Define to the flags needed for the .section .eh_frame directive. */ -#undef EH_FRAME_FLAGS +/* #undef EH_FRAME_FLAGS */ @@ -76,11 +73,7 @@ index d38b781..6284190 100644 -#undef FFI_NO_STRUCTS +/* #undef FFI_NO_STRUCTS */ - /* Define to 1 if you have 'alloca', as a function or macro. */ --#undef HAVE_ALLOCA -+#define HAVE_ALLOCA 1 - - /* Define to 1 if works. */ + /* Define to 1 if you have the header file. */ -#undef HAVE_ALLOCA_H +/* #undef HAVE_ALLOCA_H */ @@ -137,30 +130,6 @@ index d38b781..6284190 100644 -#undef HAVE_MEMFD_CREATE +/* #undef HAVE_MEMFD_CREATE */ - /* Define to 1 if you have the `mkostemp' function. */ --#undef HAVE_MKOSTEMP -+/* #undef HAVE_MKOSTEMP */ - - /* Define to 1 if you have the `mkstemp' function. */ --#undef HAVE_MKSTEMP -+/* #undef HAVE_MKSTEMP */ - - /* Define to 1 if you have the `mmap' function. */ --#undef HAVE_MMAP -+/* #undef HAVE_MMAP */ - - /* Define if mmap with MAP_ANON(YMOUS) works. */ --#undef HAVE_MMAP_ANON -+/* #undef HAVE_MMAP_ANON */ - - /* Define if mmap of /dev/zero works. */ --#undef HAVE_MMAP_DEV_ZERO -+/* #undef HAVE_MMAP_DEV_ZERO */ - - /* Define if read-only mmap of a plain file works. */ --#undef HAVE_MMAP_FILE -+/* #undef HAVE_MMAP_FILE */ - /* Define if your compiler supports pointer authentication. */ -#undef HAVE_PTRAUTH +/* #undef HAVE_PTRAUTH */ @@ -193,10 +162,6 @@ index d38b781..6284190 100644 -#undef HAVE_SYS_MEMFD_H +/* #undef HAVE_SYS_MEMFD_H */ - /* Define to 1 if you have the header file. */ --#undef HAVE_SYS_MMAN_H -+/* #undef HAVE_SYS_MMAN_H */ - /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H 1 @@ -231,7 +196,7 @@ index d38b781..6284190 100644 /* Define to the full name and version of this package. */ -#undef PACKAGE_STRING -+#define PACKAGE_STRING "libffi 3.4.4" ++#define PACKAGE_STRING "libffi 3.4.6" /* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME @@ -243,7 +208,7 @@ index d38b781..6284190 100644 /* Define to the version of this package. */ -#undef PACKAGE_VERSION -+#define PACKAGE_VERSION "3.4.4" ++#define PACKAGE_VERSION "3.4.6" /* The size of `double', as computed by sizeof. */ -#undef SIZEOF_DOUBLE @@ -257,15 +222,6 @@ index d38b781..6284190 100644 -#undef SIZEOF_SIZE_T +#define SIZEOF_SIZE_T 8 - /* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be -@@ -173,22 +174,22 @@ - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ --#undef STACK_DIRECTION -+/* #undef STACK_DIRECTION */ - /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ @@ -283,11 +239,11 @@ index d38b781..6284190 100644 /* Version number of package */ -#undef VERSION -+#define VERSION "3.4.4" ++#define VERSION "3.4.6" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -@@ -198,12 +199,12 @@ +@@ -163,7 +164,7 @@ # endif #else # ifndef WORDS_BIGENDIAN @@ -296,24 +252,18 @@ index d38b781..6284190 100644 # endif #endif - /* Define to `unsigned int' if does not define. */ --#undef size_t -+/* #undef size_t */ - - - #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE diff --git a/include/ffi.h.in b/include/ffi.h similarity index 98% rename from include/ffi.h.in rename to include/ffi.h -index 227ac79..6318a33 100644 +index e5c1dae..ef012e2 100644 --- a/include/ffi.h.in +++ b/include/ffi.h @@ -1,5 +1,5 @@ /* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ -+ libffi 3.4.4 - - Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green ++ libffi 3.4.6 + - Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. @@ -50,8 +50,8 @@ extern "C" { @@ -336,25 +286,7 @@ index 227ac79..6318a33 100644 #define FFI_TYPE_LONGDOUBLE 4 #else #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE -@@ -223,7 +223,7 @@ FFI_EXTERN ffi_type ffi_type_float; - FFI_EXTERN ffi_type ffi_type_double; - FFI_EXTERN ffi_type ffi_type_pointer; - --#if @HAVE_LONG_DOUBLE@ -+#if 0 - FFI_EXTERN ffi_type ffi_type_longdouble; - #else - #define ffi_type_longdouble ffi_type_double -@@ -232,7 +232,7 @@ FFI_EXTERN ffi_type ffi_type_longdouble; - #ifdef FFI_TARGET_HAS_COMPLEX_TYPE - FFI_EXTERN ffi_type ffi_type_complex_float; - FFI_EXTERN ffi_type ffi_type_complex_double; --#if @HAVE_LONG_DOUBLE@ -+#if 0 - FFI_EXTERN ffi_type ffi_type_complex_longdouble; - #else - #define ffi_type_complex_longdouble ffi_type_complex_double -@@ -333,7 +333,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated)); +@@ -322,7 +322,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated)); __declspec(align(8)) #endif typedef struct { @@ -363,7 +295,7 @@ index 227ac79..6318a33 100644 void *trampoline_table; void *trampoline_table_entry; #else -@@ -394,7 +394,7 @@ ffi_prep_closure_loc (ffi_closure*, +@@ -375,7 +375,7 @@ ffi_prep_closure_loc (ffi_closure*, # pragma pack 8 #endif typedef struct { @@ -372,7 +304,7 @@ index 227ac79..6318a33 100644 void *trampoline_table; void *trampoline_table_entry; #else -@@ -419,7 +419,7 @@ typedef struct { +@@ -400,7 +400,7 @@ typedef struct { } ffi_raw_closure; typedef struct { @@ -386,5 +318,5 @@ similarity index 100% rename from src/x86/ffitarget.h rename to include/ffitarget.h -- -2.38.4 +2.44.1 diff --git a/truffle/src/libffi/patches/windows-amd64/0002-Adjust-sources-for-building-with-mx.patch b/truffle/src/libffi/patches/windows-amd64/0002-Adjust-sources-for-building-with-mx.patch index 5446e46a2201..f9148d673830 100644 --- a/truffle/src/libffi/patches/windows-amd64/0002-Adjust-sources-for-building-with-mx.patch +++ b/truffle/src/libffi/patches/windows-amd64/0002-Adjust-sources-for-building-with-mx.patch @@ -1,14 +1,14 @@ -From e5a5380862ea8e92c3e0c1634c5f305c8648425b Mon Sep 17 00:00:00 2001 +From 9601e9219678f2a1ad628ae78e4d8c11c27217a9 Mon Sep 17 00:00:00 2001 From: Roland Schatz Date: Wed, 17 May 2023 16:10:46 +0200 Subject: [PATCH 2/2] Adjust sources for building with mx --- include/Makefile.am | 9 - - include/Makefile.in | 610 --------------------------------- + include/Makefile.in | 609 --------------------------------- {include => src}/ffi_common.h | 0 fficonfig.h => src/fficonfig.h | 0 - 4 files changed, 619 deletions(-) + 4 files changed, 618 deletions(-) delete mode 100644 include/Makefile.am delete mode 100644 include/Makefile.in rename {include => src}/ffi_common.h (100%) @@ -31,10 +31,10 @@ index 5f0d406..0000000 -nodist_include_HEADERS = ffi.h ffitarget.h diff --git a/include/Makefile.in b/include/Makefile.in deleted file mode 100644 -index 7e3bbf0..0000000 +index ae3ad01..0000000 --- a/include/Makefile.in +++ /dev/null -@@ -1,610 +0,0 @@ +@@ -1,609 +0,0 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. -# @configure_input@ - @@ -219,7 +219,6 @@ index 7e3bbf0..0000000 -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ffi.h.in -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ --ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_LTLDFLAGS = @AM_LTLDFLAGS@ @@ -654,5 +653,5 @@ similarity index 100% rename from fficonfig.h rename to src/fficonfig.h -- -2.38.4 +2.44.1 diff --git a/vm/mx.vm/suite.py b/vm/mx.vm/suite.py index 8fbec9aa87d4..e747f8bad3de 100644 --- a/vm/mx.vm/suite.py +++ b/vm/mx.vm/suite.py @@ -1,6 +1,6 @@ suite = { "name": "vm", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "mxversion": "6.41.0", "release" : False, "groupId" : "org.graalvm", diff --git a/wasm/mx.wasm/suite.py b/wasm/mx.wasm/suite.py index 8a1ab2175530..a015f4ee425a 100644 --- a/wasm/mx.wasm/suite.py +++ b/wasm/mx.wasm/suite.py @@ -42,7 +42,7 @@ "mxversion": "6.41.0", "name" : "wasm", "groupId" : "org.graalvm.wasm", - "version" : "23.1.4.1", + "version" : "23.1.5.0", "versionConflictResolution" : "latest", "url" : "http://graalvm.org/", "developer" : {