Skip to content

Commit c20fe94

Browse files
committed
Minor cleanups
1 parent 5edb6f4 commit c20fe94

File tree

9 files changed

+30
-43
lines changed

9 files changed

+30
-43
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/java/BytecodeParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public boolean canMergeIntrinsicReturns() {
537537
* A scoped object for tasks to be performed after inlining during parsing such as processing
538538
* {@linkplain BytecodeFrame#isPlaceholderBci(int) placeholder} frames states.
539539
*/
540-
static class InliningScope implements AutoCloseable {
540+
protected static class InliningScope implements AutoCloseable {
541541
final ResolvedJavaMethod callee;
542542
FrameState stateBefore;
543543
final Mark mark;
@@ -971,7 +971,7 @@ protected BytecodeParser(GraphBuilderPhase.Instance graphBuilderInstance, Struct
971971
int entryBCI, IntrinsicContext intrinsicContext) {
972972
super(graphBuilderInstance.providers);
973973
invocationPluginReceiver = new InvocationPluginReceiver(this);
974-
this.bytecodeProvider = intrinsicContext == null ? new ResolvedJavaMethodBytecodeProvider() : intrinsicContext.getBytecodeProvider();
974+
this.bytecodeProvider = intrinsicContext == null ? ResolvedJavaMethodBytecodeProvider.INSTANCE : intrinsicContext.getBytecodeProvider();
975975
this.code = bytecodeProvider.getBytecode(method);
976976
this.method = code.getMethod();
977977
this.graphBuilderInstance = graphBuilderInstance;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/MemoryMapControlSinkNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import jdk.graal.compiler.nodes.memory.MemoryMapNode;
3434

3535
/**
36-
* {@link ControlSinkNode}that might have a {@link MemoryMapNode} attached. This map can be used to
36+
* {@link ControlSinkNode} that might have a {@link MemoryMapNode} attached. This map can be used to
3737
* update the memory graph during inlining.
3838
*/
3939
@NodeInfo

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/CachingPEGraphDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
* A graph decoder that provides all necessary encoded graphs on-the-fly (by parsing the methods and
6161
* encoding the graphs).
6262
*/
63-
public class CachingPEGraphDecoder extends PEGraphDecoder {
63+
public final class CachingPEGraphDecoder extends PEGraphDecoder {
6464

6565
private static final TimerKey BuildGraphTimer = DebugContext.timer("PartialEvaluation-GraphBuilding");
6666

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/PEGraphDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ public PEGraphDecoder(Architecture architecture, StructuredGraph graph, CoreProv
878878
this.forceLink = forceLink;
879879
}
880880

881-
protected static LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method, LoopExplosionPlugin loopExplosionPlugin) {
881+
private static LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method, LoopExplosionPlugin loopExplosionPlugin) {
882882
if (loopExplosionPlugin == null) {
883883
return LoopExplosionKind.NONE;
884884
} else {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/PartialEvaluator.java

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -367,22 +367,14 @@ private final class PELoopExplosionPlugin implements LoopExplosionPlugin {
367367
@Override
368368
public LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method) {
369369
TruffleCompilerRuntime.LoopExplosionKind explosionKind = getMethodInfo(method).loopExplosion();
370-
switch (explosionKind) {
371-
case NONE:
372-
return LoopExplosionKind.NONE;
373-
case FULL_EXPLODE:
374-
return LoopExplosionKind.FULL_EXPLODE;
375-
case FULL_EXPLODE_UNTIL_RETURN:
376-
return LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN;
377-
case FULL_UNROLL:
378-
return LoopExplosionKind.FULL_UNROLL;
379-
case MERGE_EXPLODE:
380-
return LoopExplosionKind.MERGE_EXPLODE;
381-
case FULL_UNROLL_UNTIL_RETURN:
382-
return LoopExplosionKind.FULL_UNROLL_UNTIL_RETURN;
383-
default:
384-
throw new IllegalStateException("Unsupported TruffleCompilerRuntime.LoopExplosionKind: " + String.valueOf(explosionKind));
385-
}
370+
return switch (explosionKind) {
371+
case NONE -> LoopExplosionKind.NONE;
372+
case FULL_EXPLODE -> LoopExplosionKind.FULL_EXPLODE;
373+
case FULL_EXPLODE_UNTIL_RETURN -> LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN;
374+
case FULL_UNROLL -> LoopExplosionKind.FULL_UNROLL;
375+
case MERGE_EXPLODE -> LoopExplosionKind.MERGE_EXPLODE;
376+
case FULL_UNROLL_UNTIL_RETURN -> LoopExplosionKind.FULL_UNROLL_UNTIL_RETURN;
377+
};
386378
}
387379
}
388380

@@ -422,13 +414,12 @@ private GraphBuilderConfiguration getGraphBuilderConfigurationCopy(boolean force
422414
protected abstract GraphBuilderPhase.Instance createGraphBuilderPhaseInstance(CoreProviders providers, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts);
423415

424416
@SuppressWarnings("try")
425-
public void doGraphPE(TruffleTierContext context, InlineInvokePlugin inlineInvokePlugin, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
426-
InlineInvokePlugin[] inlineInvokePlugins = new InlineInvokePlugin[]{
427-
inlineInvokePlugin
428-
};
417+
public final void doGraphPE(TruffleTierContext context, InlineInvokePlugin inlineInvokePlugin, EconomicMap<ResolvedJavaMethod, EncodedGraph> graphCache) {
429418
PEGraphDecoder decoder = createGraphDecoder(context,
430419
context.isFirstTier() ? firstTierDecodingPlugins : lastTierDecodingPlugins,
431-
inlineInvokePlugins,
420+
new InlineInvokePlugin[]{
421+
inlineInvokePlugin
422+
},
432423
new InterceptReceiverPlugin(context.compilable),
433424
nodePlugins,
434425
new TruffleSourceLanguagePositionProvider(context.task),

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/host/TruffleKnownHostTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public boolean isInInterpreterFastPath(ResolvedJavaMethod method) {
7878
}
7979

8080
/**
81-
* Determines if {@code method} is a method is a transferToInterpreter method from
81+
* Determines if {@code method} is a transferToInterpreter method from
8282
* CompilerDirectives.
8383
*/
8484
public boolean isTransferToInterpreterMethod(ResolvedJavaMethod method) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/nodes/frame/NewFrameNode.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ public final class NewFrameNode extends FixedWithNextNode implements IterableNod
8080
*/
8181
public static final byte FrameSlotKindObjectTag = 0; // FrameSlotKind.Object.tag
8282
public static final byte FrameSlotKindLongTag = 1; // FrameSlotKind.Long.tag
83-
private static final byte FrameSlotKindIntTag = 2; // FrameSlotKind.Int.tag
84-
private static final byte FrameSlotKindDoubleTag = 3; // FrameSlotKind.Double.tag
85-
private static final byte FrameSlotKindFloatTag = 4; // FrameSlotKind.Float.tag
86-
private static final byte FrameSlotKindBooleanTag = 5; // FrameSlotKind.Boolean.tag
87-
private static final byte FrameSlotKindByteTag = 6; // FrameSlotKind.Byte.tag
83+
public static final byte FrameSlotKindIntTag = 2; // FrameSlotKind.Int.tag
84+
public static final byte FrameSlotKindDoubleTag = 3; // FrameSlotKind.Double.tag
85+
public static final byte FrameSlotKindFloatTag = 4; // FrameSlotKind.Float.tag
86+
public static final byte FrameSlotKindBooleanTag = 5; // FrameSlotKind.Boolean.tag
87+
public static final byte FrameSlotKindByteTag = 6; // FrameSlotKind.Byte.tag
8888
public static final byte FrameSlotKindIllegalTag = 7; // FrameSlotKind.Illegal.tag
8989
public static final byte FrameSlotKindStaticTag = 8; // FrameSlotKind.Static.tag
9090

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/phases/inlining/AgnosticInliningPhase.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,18 @@ public AgnosticInliningPhase(PartialEvaluator partialEvaluator, PostPartialEvalu
6060
this.postPartialEvaluationSuite = postPartialEvaluationSuite;
6161
}
6262

63-
private static InliningPolicyProvider chosenProvider(String name) {
64-
for (InliningPolicyProvider provider : AgnosticInliningPhase.POLICY_PROVIDERS) {
65-
if (provider.getName().equals(name)) {
66-
return provider;
67-
}
68-
}
69-
throw new IllegalStateException("No inlining policy provider with provided name: " + name);
70-
}
71-
7263
private static InliningPolicyProvider getInliningPolicyProvider(TruffleTierContext context) {
7364
boolean firstTier = context.isFirstTier();
7465
final String policy = (firstTier ? TruffleCompilerOptions.FirstTierInliningPolicy : TruffleCompilerOptions.InliningPolicy).getValue(context.compilerOptions);
7566
if (Objects.equals(policy, "")) {
7667
return POLICY_PROVIDERS.get(firstTier ? POLICY_PROVIDERS.size() - 1 : 0);
7768
} else {
78-
return chosenProvider(policy);
69+
for (InliningPolicyProvider provider : POLICY_PROVIDERS) {
70+
if (provider.getName().equals(policy)) {
71+
return provider;
72+
}
73+
}
74+
throw new IllegalStateException("No inlining policy provider with provided name: " + policy);
7975
}
8076
}
8177

truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedCallTarget.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ private boolean frameDescriptorEquals(FrameDescriptor parentFrameDescriptor) {
829829
return false;
830830
}
831831

832-
private Object executeRootNode(VirtualFrame frame, CompilationState tier) {
832+
private final Object executeRootNode(VirtualFrame frame, CompilationState tier) {
833833
try {
834834
Object toRet = rootNode.execute(frame);
835835
TruffleSafepoint.poll(rootNode);

0 commit comments

Comments
 (0)