Skip to content

Commit

Permalink
Merge with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhaeubl committed Jan 26, 2024
2 parents 92c9a70 + a477d45 commit cd7be3d
Show file tree
Hide file tree
Showing 225 changed files with 2,484 additions and 3,960 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ platform. There have been significant contributions from both industry
and academia so far and we thank you for considering to contribute your changes!

- Learn [how to become a GraalVM contributor](https://www.graalvm.org/community/contributors/).
- Check individual README.md and CONTRIBUTING.md files in the subprojects to learn how to build and import them into your IDE (for example, [the compiler README.md](compiler/README.md))
- Subscribe and post to [[email protected]](https://oss.oracle.com/mailman/listinfo/graalvm-dev) for questions related to working with the sources or extending the GraalVM ecosystem by creating new languages, tools, or embeddings.
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
],

"mx_version": "7.6.1",
"mx_version": "7.7.3",

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
Expand Down
3 changes: 3 additions & 0 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@
"java.base" : [
"jdk.internal.util",
],
"jdk.internal.vm.ci" : [
"jdk.vm.ci.meta",
],
},
"checkstyle": "jdk.graal.compiler",
"javaCompliance" : "21+",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ private void createStubs(AbstractProcessor processor, TargetVM targetVM, TypeEle
out.printf(" super(linkage.getDescriptor().getName(), options, providers, linkage);\n");
out.printf(" }\n");
} else {
out.printf(" private static final EnumSet<AMD64.CPUFeature> EMPTY_CPU_FEATURES_AMD64 = EnumSet.noneOf(AMD64.CPUFeature.class);\n");
out.printf(" private static final EnumSet<AArch64.CPUFeature> EMPTY_CPU_FEATURES_AARCH64 = EnumSet.noneOf(AArch64.CPUFeature.class);\n");
out.printf(" @SuppressWarnings(\"unused\") private static final EnumSet<AMD64.CPUFeature> EMPTY_CPU_FEATURES_AMD64 = EnumSet.noneOf(AMD64.CPUFeature.class);\n");
out.printf(" @SuppressWarnings(\"unused\") private static final EnumSet<AArch64.CPUFeature> EMPTY_CPU_FEATURES_AARCH64 = EnumSet.noneOf(AArch64.CPUFeature.class);\n");
}
out.printf("\n");
for (GenerateStubClass genClass : classes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public GraphNodeVerifier(AbstractProcessor processor) {
/**
* Returns a type element given a canonical name.
*
* @throws {@link NoClassDefFoundError} if a type element does not exist for {@code name}
* @throws NoClassDefFoundError if a type element does not exist for {@code name}
*/
public TypeElement getTypeElement(String name) {
return processor.getTypeElement(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@

import org.junit.Test;

import jdk.graal.compiler.core.common.GraalOptions;
import jdk.graal.compiler.java.BytecodeParserOptions;
import jdk.graal.compiler.nodes.spi.ProfileProvider;
import jdk.graal.compiler.options.OptionValues;
import jdk.vm.ci.meta.ResolvedJavaMethod;

public class ArrayLengthProviderTest extends GraalCompilerTest {

public static Object test0Snippet(ArrayList<?> list, boolean a) {
Expand All @@ -56,7 +62,7 @@ public static Object test0Snippet(ArrayList<?> list, boolean a) {
}
}

public static Object test1Snippet(ArrayList<?> list, boolean a, boolean b) {
public static Object test1Snippet(List<?> list, boolean a, boolean b) {
while (true) {
Object[] array = toArray(list);
if (a || b) {
Expand All @@ -72,6 +78,16 @@ public static Object[] toArray(List<?> list) {
return new Object[list.size()];
}

@Override
protected ProfileProvider getProfileProvider(ResolvedJavaMethod method) {
if (profile) {
return null;
}
return NO_PROFILE_PROVIDER;
}

boolean profile = true;

@Test
public void test0() {
test("test0Snippet", new ArrayList<>(Arrays.asList("a", "b")), true);
Expand All @@ -80,5 +96,15 @@ public void test0() {
@Test
public void test1() {
test("test1Snippet", new ArrayList<>(Arrays.asList("a", "b")), true, true);

}

@Test
public void test2() {
resetCache();
profile = false;
OptionValues o = new OptionValues(getInitialOptions(), GraalOptions.LoopUnswitch, false, BytecodeParserOptions.InlineDuringParsing, false);
test(o, "test1Snippet", new ArrayList<>(Arrays.asList("a", "b")), true, true);
profile = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static void runTest(InvariantsTool tool) {
OptionValues options = getInitialOptions();
CompilerThreadFactory factory = new CompilerThreadFactory("CheckInvariantsThread");
int availableProcessors = Runtime.getRuntime().availableProcessors();
ThreadPoolExecutor executor = new ThreadPoolExecutor(availableProcessors, availableProcessors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory);
ThreadPoolExecutor executor = new ThreadPoolExecutor(availableProcessors, availableProcessors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), factory);

List<String> errors = Collections.synchronizedList(new ArrayList<>());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@

public class InstanceOfCanonicalizationTest extends GraalCompilerTest {

@SuppressWarnings("unused")
public static boolean checkCastIncompatibleTypes(Object arr) {
// Cast first to a byte array, then to a boolean array. This only succeeds if arr is null.
byte[] barr = (byte[]) arr;
boolean[] bbarr = (boolean[]) (Object) barr;
return true;
}

@SuppressWarnings("cast")
public static int unsatisfiableInstanceOf(byte[] barr) {
// Plain instanceof does not allow null, so this will never succeed.
if ((Object) barr instanceof boolean[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ private void compile(LibGraalParams libgraal) {
}
} else {
compileTimes = new ConcurrentHashMap<>();
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), new CTWThreadFactory(libgraal));
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new CTWThreadFactory(libgraal));
for (Compilation task : tasks) {
threadPool.submit(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,23 @@
*/
package jdk.graal.compiler.hotspot.test;

import jdk.graal.compiler.api.test.Graal;
import jdk.graal.compiler.core.test.GraalCompilerTest;
import org.junit.Assume;
import org.junit.AssumptionViolatedException;

import jdk.graal.compiler.bytecode.Bytecode;
import jdk.graal.compiler.bytecode.ResolvedJavaMethodBytecode;
import jdk.graal.compiler.core.common.CompilationIdentifier;
import jdk.graal.compiler.core.test.GraalCompilerTest;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.hotspot.HotSpotBackend;
import jdk.graal.compiler.hotspot.HotSpotGraalRuntimeProvider;
import jdk.graal.compiler.hotspot.HotSpotReplacementsImpl;
import jdk.graal.compiler.hotspot.meta.HotSpotProviders;
import jdk.graal.compiler.nodes.Cancellable;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.StructuredGraph.AllowAssumptions;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.runtime.RuntimeProvider;
import org.junit.Assume;
import org.junit.AssumptionViolatedException;

import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
Expand Down Expand Up @@ -80,8 +77,6 @@ protected InstalledCode compileAndInstallSubstitution(Class<?> c, String methodN
}

protected InstalledCode compileAndInstallSubstitution(ResolvedJavaMethod method) {
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
CompilationIdentifier compilationId = runtime().getHostBackend().getCompilationIdentifier(method);
OptionValues options = getInitialOptions();
StructuredGraph graph = getIntrinsicGraph(method, compilationId, getDebugContext(options), AllowAssumptions.YES, null);
Expand All @@ -91,6 +86,7 @@ protected InstalledCode compileAndInstallSubstitution(ResolvedJavaMethod method)
return null;
}

@SuppressWarnings("unused")
public StructuredGraph getIntrinsicGraph(ResolvedJavaMethod method, CompilationIdentifier compilationId, DebugContext debug, AllowAssumptions allowAssumptions, Cancellable cancellable) {
GraphBuilderConfiguration.Plugins graphBuilderPlugins = getReplacements().getGraphBuilderPlugins();
InvocationPlugin plugin = graphBuilderPlugins.getInvocationPlugins().lookupInvocation(method, debug.getOptions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ static class A {
Object o = new Object();
}

@SuppressWarnings("unused")
public static void snippet4(Object external, boolean flag, boolean flag1) {
A escaped = new A();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public void testICompress() {
Stamp value0Stamp = StampFactory.forInteger(JavaKind.Int, value0, value0, value0 & INT_MASK, value0 & INT_MASK);
for (int value1 : inputs) {
Stamp value1Stamp = StampFactory.forInteger(JavaKind.Int, value1, value1, value1 & INT_MASK, value1 & INT_MASK);
Stamp valueStamp = (IntegerStamp) value0Stamp.meet(value1Stamp);
Stamp valueStamp = value0Stamp.meet(value1Stamp);
for (int mask0 : inputs) {
Stamp mask0Stamp = StampFactory.forInteger(JavaKind.Int, mask0, mask0, mask0 & INT_MASK, mask0 & INT_MASK);
for (int mask1 : inputs) {
Stamp mask1Stamp = StampFactory.forInteger(JavaKind.Int, mask1, mask1, mask1 & INT_MASK, mask1 & INT_MASK);
Stamp maskStamp = (IntegerStamp) mask0Stamp.meet(mask1Stamp);
Stamp maskStamp = mask0Stamp.meet(mask1Stamp);
IntegerStamp newStamp = (IntegerStamp) compressOp.foldStamp(valueStamp, maskStamp);
assertTrue(newStamp.contains(Integer.compress(value0, mask0)));
assertTrue(newStamp.contains(Integer.compress(value0, mask1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@
import java.util.Optional;
import java.util.function.Supplier;

import jdk.graal.compiler.core.test.GraalCompilerTest;
import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.EconomicSet;
import org.junit.Assert;
import org.junit.Test;

import jdk.graal.compiler.core.common.GraalOptions;
import jdk.graal.compiler.core.test.GraalCompilerTest;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.debug.DebugOptions;
import jdk.graal.compiler.nodes.GraphState;
import jdk.graal.compiler.nodes.OptimizationLog;
import jdk.graal.compiler.nodes.OptimizationLog.OptimizationEntry;
import jdk.graal.compiler.nodes.OptimizationLogImpl;
import jdk.graal.compiler.nodes.ReturnNode;
import jdk.graal.compiler.nodes.StructuredGraph;
Expand All @@ -45,9 +49,6 @@
import jdk.graal.compiler.phases.BasePhase;
import jdk.graal.compiler.phases.ClassTypeSequence;
import jdk.graal.compiler.phases.util.Providers;
import org.junit.Assert;
import org.junit.Test;

import jdk.vm.ci.meta.ResolvedJavaMethod;

/**
Expand Down Expand Up @@ -150,8 +151,8 @@ public void buildOptimizationTreeWhenEnabled() {
/**
* Tests that there is no reporting going on when the optimization log is disabled. In
* particular, the optimization tree shall not be built and
* {@link OptimizationLog.OptimizationEntry#withLazyProperty(String, Supplier) lazy properties}
* shall not be consumed.
* {@link OptimizationEntry#withLazyProperty(String, Supplier) lazy properties} shall not be
* consumed.
*/
@Test
public void noReportingWhenDisabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void before() {
*/
}

@SuppressWarnings("unused")
public void testWithAVX3Threshold(String testSelector, Class<? extends GraalCompilerTest> testClass) {
Runnable nopRunnable = () -> {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static final class RootNodeImpl extends RootNode {
super(null);
}

@Override
public Object execute(VirtualFrame frame) {
return Unlinked.call();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@
import java.util.Map;

import org.graalvm.collections.EconomicMap;
import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.core.phases.HighTier;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.loop.phases.ConvertDeoptimizeToGuardPhase;
import jdk.graal.compiler.nodes.ConstantNode;
import jdk.graal.compiler.nodes.Invoke;
import jdk.graal.compiler.nodes.InvokeNode;
import jdk.graal.compiler.nodes.InvokeWithExceptionNode;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import jdk.graal.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugins;
import jdk.graal.compiler.options.OptionKey;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.phases.common.CanonicalizerPhase;
import jdk.graal.compiler.phases.tiers.HighTierContext;
import jdk.graal.compiler.truffle.host.HostInliningPhase;
import jdk.graal.compiler.truffle.test.HostInliningTestFactory.IfNodeGen;
import org.graalvm.polyglot.Context;
import org.junit.Assert;
import org.junit.BeforeClass;
Expand All @@ -67,10 +46,10 @@
import org.junit.runners.Parameterized.Parameters;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.HostCompilerDirectives.BytecodeInterpreterSwitch;
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.ImplicitCast;
import com.oracle.truffle.api.dsl.Specialization;
Expand All @@ -83,6 +62,26 @@
import com.oracle.truffle.runtime.OptimizedCallTarget;
import com.oracle.truffle.runtime.OptimizedDirectCallNode;

import jdk.graal.compiler.api.directives.GraalDirectives;
import jdk.graal.compiler.core.phases.HighTier;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.loop.phases.ConvertDeoptimizeToGuardPhase;
import jdk.graal.compiler.nodes.ConstantNode;
import jdk.graal.compiler.nodes.Invoke;
import jdk.graal.compiler.nodes.InvokeNode;
import jdk.graal.compiler.nodes.InvokeWithExceptionNode;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
import jdk.graal.compiler.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver;
import jdk.graal.compiler.nodes.graphbuilderconf.InvocationPlugins;
import jdk.graal.compiler.options.OptionKey;
import jdk.graal.compiler.options.OptionValues;
import jdk.graal.compiler.phases.common.CanonicalizerPhase;
import jdk.graal.compiler.phases.tiers.HighTierContext;
import jdk.graal.compiler.truffle.host.HostInliningPhase;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaMethod;

Expand Down Expand Up @@ -869,7 +868,7 @@ int doDefault(boolean condition, @Cached InlinedCountingConditionProfile profile

}

static final IfNode IF_NODE = IfNodeGen.create();
static final IfNode IF_NODE = HostInliningTestFactory.IfNodeGen.create();

@BytecodeInterpreterSwitch
@ExpectNotInlined(name = "traceTransferToInterpreter", count = -1 /* any number of calls ok */)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Object testTruffleBoundary() {
throw new AssertionError();
}
try {
int result = (int) CompilerDirectives.interpreterOnly(new Callable<Object>() {
int result = (int) CompilerDirectives.interpreterOnly(new Callable<>() {
@Override
public Object call() throws Exception {
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ private void emitAlignmentForDirectCall(boolean align, int additionalInstruction
*
* @return the position of the emitted call instruction
*/
@SuppressWarnings("unused")
public int indirectCall(PostCallAction postCallAction, Register callReg, boolean mitigateDecodingAsDirectCall, InvokeTarget callTarget,
CallingConvention.Type callingConventionType) {
int indirectCallSize = needsRex(callReg) ? 3 : 2;
Expand Down Expand Up @@ -455,6 +456,7 @@ public int indirectCall(PostCallAction postCallAction, Register callReg, boolean
return beforeCall;
}

@SuppressWarnings("unused")
public int directCall(PostCallAction postCallAction, long address, Register scratch, InvokeTarget callTarget) {
int bytesToEmit = needsRex(scratch) ? 13 : 12;
mitigateJCCErratum(bytesToEmit);
Expand All @@ -480,6 +482,7 @@ public int directJmp(long address, Register scratch) {
return beforeJmp;
}

@SuppressWarnings("unused")
public int call(PostCallAction postCallAction, InvokeTarget callTarget) {
int beforeCall = position();
call();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import jdk.graal.compiler.lir.aarch64.AArch64RoundFloatToIntegerOp;
import jdk.graal.compiler.lir.gen.ArithmeticLIRGenerator;
import jdk.graal.compiler.lir.gen.ArithmeticLIRGeneratorTool;

import jdk.vm.ci.aarch64.AArch64Kind;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.JavaConstant;
Expand Down Expand Up @@ -242,7 +241,7 @@ public Value emitUShr(Value a, Value b) {
}

@Override
public Value emitFloatConvert(FloatConvert op, Value inputVal) {
public Value emitFloatConvert(FloatConvert op, Value inputVal, boolean canBeNaN, boolean canOverflow) {
PlatformKind resultPlatformKind = getFloatConvertResultKind(op);
LIRKind resultLirKind = LIRKind.combine(inputVal).changeType(resultPlatformKind);
Variable result = getLIRGen().newVariable(resultLirKind);
Expand Down
Loading

0 comments on commit cd7be3d

Please sign in to comment.