Skip to content
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

Upstream from graalvm-community-jdk21u into Mandrel 23.1 #788

Merged
merged 25 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dd8e47c
New dev cycle GraalVM Community 23.1.5
jerboaa Aug 27, 2024
3194b7a
GHA: Bump to newer upload/download-artifact actions
jerboaa Aug 27, 2024
dced1b1
GHA: Bump action versions to avoid deprecation warnings
jerboaa Aug 27, 2024
625032b
Merge pull request #19 from jerboaa/quarkus_gha_bumps
zakkak Aug 27, 2024
06b1af9
Merge pull request #18 from jerboaa/version_bump_community_jdk21
zakkak Aug 27, 2024
d93665f
[GR-51529] FileSystemsTest#testSetAttribute() fails on JDK-23-linux.
simonis Aug 28, 2024
cba7b53
Merge pull request #20 from simonis/fix-truffle-filesystem-tests
zakkak Aug 28, 2024
b3480b4
Add correct values to GCHeapSummary
roberttoyonaga Mar 25, 2024
9045610
Minor cleanups.
christianhaeubl Mar 27, 2024
810bf87
add JFR test proxy configuration.
roberttoyonaga Aug 20, 2024
12f891c
add exit handlers if jfr or nmt is in the image
roberttoyonaga Mar 1, 2024
f407f33
remove check for NMT since it does not exist in GraalVM for JDK21
roberttoyonaga Aug 20, 2024
d2a466d
Merge pull request #2 from roberttoyonaga/GR-52940
zakkak Aug 28, 2024
e83311b
Merge pull request #3 from roberttoyonaga/GR-52454
zakkak Aug 28, 2024
ab24a74
Fix AArch64AtomicMove.
teshull Apr 25, 2024
56ae873
Update LIBFFI to 3.4.6
zakkak Jun 17, 2024
bab7110
Fix windows patches.
rschatz Jul 8, 2024
2d5a579
Fix libffi build on windows.
rschatz Jul 9, 2024
7127f4a
Correctly handle resource include patterns
loicottet Aug 29, 2023
1b0c49c
Allow custom constructors for arrays and enums
vjovanov Jun 11, 2024
14a73c8
Merge pull request #11 from zakkak/2024-08-21-backport-aarch64-atomic…
zakkak Aug 28, 2024
fe54a9a
Merge pull request #10 from zakkak/2024-08-21-backport-custom-cons
zakkak Aug 28, 2024
47161c4
Merge pull request #9 from zakkak/2024-07-18-fix-graal-9038
zakkak Aug 28, 2024
722c5d5
Merge pull request #8 from zakkak/2024-08-20-backport-libffi-update
zakkak Aug 28, 2024
012215a
Merge branch 'community-backports-jdk21u' into Mandrel 23.1
jerboaa Aug 29, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
2 changes: 1 addition & 1 deletion compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -169,53 +169,64 @@ 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);
});
if (setConditionFlags) {
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);
}
});
}
}
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion espresso/mx.espresso/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
2 changes: 1 addition & 1 deletion regex/mx.regex/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
2 changes: 1 addition & 1 deletion sdk/mx.sdk/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>resourceName</code> to canonical variant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,6 +36,7 @@

import jdk.jfr.Recording;
import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.consumer.RecordedObject;

public class TestGCHeapSummaryEvent extends JfrRecordingTest {
@Test
Expand All @@ -49,5 +51,18 @@ public void test() throws Throwable {

private static void validateEvents(List<RecordedEvent> 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);
}
}
}
2 changes: 1 addition & 1 deletion tools/mx.tools/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
Loading