Skip to content

Commit

Permalink
[GR-42702] Remove unused code in compiler.nodes.
Browse files Browse the repository at this point in the history
PullRequest: graal/14403
  • Loading branch information
wirthi committed Apr 26, 2023
2 parents 455c29f + c3c0145 commit 596abcc
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public boolean check(int left, int right) {
case BT:
return UnsignedMath.belowThan(left, right);
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

public static final class CanonicalizedCondition {
Expand Down Expand Up @@ -163,7 +163,7 @@ public CanonicalizedCondition canonicalize() {
canonicalCondition = CanonicalCondition.BT;
break;
default:
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}
return new CanonicalizedCondition(canonicalCondition, canonicalMirror(), canonicalNegate());
}
Expand Down Expand Up @@ -197,7 +197,7 @@ public boolean isCanonical() {
case AE:
return false;
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

/**
Expand Down Expand Up @@ -227,7 +227,7 @@ public boolean canonicalMirror() {
case AE:
return false;
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

/**
Expand Down Expand Up @@ -257,7 +257,7 @@ public boolean canonicalNegate() {
case AE:
return true;
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

/**
Expand Down Expand Up @@ -288,7 +288,7 @@ public final Condition negate() {
case AE:
return BT;
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

public boolean implies(Condition other) {
Expand Down Expand Up @@ -317,7 +317,7 @@ public boolean implies(Condition other) {
case AE:
return false;
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

/**
Expand Down Expand Up @@ -348,7 +348,7 @@ public final Condition mirror() {
case AE:
return BE;
}
throw new IllegalArgumentException();
throw new IllegalArgumentException(); // ExcludeFromJacocoGeneratedReport
}

/**
Expand All @@ -359,15 +359,6 @@ public final boolean isUnsigned() {
return this == Condition.BT || this == Condition.BE || this == Condition.AT || this == Condition.AE;
}

/**
* Checks if this conditional operation is commutative.
*
* @return {@code true} if this operation is commutative
*/
public final boolean isCommutative() {
return this == EQ || this == NE;
}

/**
* Attempts to fold a comparison between two constants and return the result.
*
Expand Down Expand Up @@ -426,7 +417,7 @@ public boolean foldCondition(PrimitiveConstant lp, PrimitiveConstant rp, boolean
case BT:
return UnsignedMath.belowThan(x, y);
default:
throw new GraalError("expected condition: %s", this);
throw new GraalError("expected condition: %s", this); // ExcludeFromJacocoGeneratedReport
}
}
case Long: {
Expand Down Expand Up @@ -454,7 +445,7 @@ public boolean foldCondition(PrimitiveConstant lp, PrimitiveConstant rp, boolean
case BT:
return UnsignedMath.belowThan(x, y);
default:
throw new GraalError("expected condition: %s", this);
throw new GraalError("expected condition: %s", this); // ExcludeFromJacocoGeneratedReport
}
}
case Float: {
Expand All @@ -477,7 +468,7 @@ public boolean foldCondition(PrimitiveConstant lp, PrimitiveConstant rp, boolean
case GE:
return x >= y;
default:
throw new GraalError("expected condition: %s", this);
throw new GraalError("expected condition: %s", this); // ExcludeFromJacocoGeneratedReport
}
}
case Double: {
Expand All @@ -500,11 +491,11 @@ public boolean foldCondition(PrimitiveConstant lp, PrimitiveConstant rp, boolean
case GE:
return x >= y;
default:
throw new GraalError("expected condition: %s", this);
throw new GraalError("expected condition: %s", this); // ExcludeFromJacocoGeneratedReport
}
}
default:
throw new GraalError("expected value kind %s while folding condition: %s", lp.getJavaKind(), this);
throw new GraalError("expected value kind %s while folding condition: %s", lp.getJavaKind(), this); // ExcludeFromJacocoGeneratedReport
}
}

Expand Down Expand Up @@ -625,7 +616,7 @@ public boolean trueIsDisjoint(Condition other) {
return in(other, EQ, AE, AT);
}
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

/**
Expand Down Expand Up @@ -714,7 +705,7 @@ public Condition join(Condition other) {
return null;
}
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}

public Condition meet(Condition other) {
Expand Down Expand Up @@ -799,6 +790,6 @@ public Condition meet(Condition other) {
return null;
}
}
throw new IllegalArgumentException(this.toString());
throw new IllegalArgumentException(this.toString()); // ExcludeFromJacocoGeneratedReport
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -991,12 +991,6 @@ class HotSpotSnippetReplacementsImpl extends HotSpotReplacementsImpl {
protected GraphMaker createGraphMaker(ResolvedJavaMethod substitute, ResolvedJavaMethod original) {
return new SnippetGraphMaker(this, substitute, original);
}

@Override
public boolean isEncodingSnippets() {
return true;
}

}

class SnippetGraphMaker extends ReplacementsImpl.GraphMaker {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,6 @@ public enum OperandFlag {
ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT));
}

/**
* The flags of the base and index value of an address.
*/
protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL);

private final LIRInstructionClass<?> instructionClass;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
import static jdk.vm.ci.code.ValueUtil.asStackSlot;
import static jdk.vm.ci.code.ValueUtil.isStackSlot;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.CONST;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.OUTGOING;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;

import org.graalvm.collections.EconomicSet;
import org.graalvm.collections.Equivalence;
Expand Down Expand Up @@ -83,7 +81,6 @@ public interface LabelHoldingOp {
*/
public static final class LabelOp extends LIRInstruction implements LabelHoldingOp {
public static final LIRInstructionClass<LabelOp> TYPE = LIRInstructionClass.create(LabelOp.class);
public static final EnumSet<OperandFlag> incomingFlags = EnumSet.of(REG, STACK);

/**
* In the LIR, every register and variable must be defined before it is used. For method
Expand Down Expand Up @@ -182,20 +179,13 @@ public Label getLabel() {
public boolean isPhiIn() {
return getPhiSize() > 0;
}

public void forEachIncomingValue(InstructionValueProcedure proc) {
for (int i = 0; i < incomingValues.length; i++) {
incomingValues[i] = proc.doValue(this, incomingValues[i], OperandMode.DEF, incomingFlags);
}
}
}

/**
* LIR operation that is an unconditional jump to a {@link #destination()}.
*/
public static class JumpOp extends LIRInstruction implements BlockEndOp {
public static final LIRInstructionClass<JumpOp> TYPE = LIRInstructionClass.create(JumpOp.class);
public static final EnumSet<OperandFlag> outgoingFlags = EnumSet.of(REG, STACK, CONST, OUTGOING);

@Alive({REG, STACK, CONST, OUTGOING}) private Value[] outgoingValues;

Expand Down Expand Up @@ -529,32 +519,4 @@ public void emitCode(CompilationResultBuilder crb) {
}
}

public static final class StackMove extends LIRInstruction implements ValueMoveOp {
public static final LIRInstructionClass<StackMove> TYPE = LIRInstructionClass.create(StackMove.class);

@Def({STACK, HINT}) protected AllocatableValue result;
@Use({STACK}) protected AllocatableValue input;

public StackMove(AllocatableValue result, AllocatableValue input) {
super(TYPE);
this.result = result;
this.input = input;
}

@Override
public void emitCode(CompilationResultBuilder crb) {
throw new GraalError(this + " should have been removed");
}

@Override
public AllocatableValue getInput() {
return input;
}

@Override
public AllocatableValue getResult() {
return result;
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -359,15 +359,6 @@ public void recordInlineDataInCode(Constant data) {
}
}

public void recordInlineDataInCodeWithNote(Constant data, Object note) {
assert data != null;
int pos = asm.position();
debug.log("Inline data in code: pos = %d, data = %s, note = %s", pos, data, note);
if (data instanceof VMConstant) {
compilationResult.recordDataPatchWithNote(pos, new ConstantReference((VMConstant) data), note);
}
}

public AbstractAddress recordDataSectionReference(Data data) {
assert data != null;
DataSectionReference reference = compilationResult.getDataSection().insertData(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.PrimitiveConstant;
import jdk.vm.ci.meta.ResolvedJavaType;

/**
* The {@code ConstantNode} represents a {@link Constant constant}.
Expand Down Expand Up @@ -103,10 +102,6 @@ private ConstantNode(Constant value, Stamp stamp, int stableDimension, boolean i
}
}

public ConstantNode(@InjectedNodeParameter Stamp stamp, @InjectedNodeParameter ConstantReflectionProvider constantReflection, @ConstantNodeParameter ResolvedJavaType type) {
this(constantReflection.asJavaClass(type), stamp);
}

/**
* @return the constant value represented by this node
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.graalvm.compiler.core.common.CompilationIdentifier;
import org.graalvm.compiler.core.common.GraalOptions;
import org.graalvm.compiler.core.common.cfg.BlockMap;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.debug.JavaMethodContext;
Expand Down Expand Up @@ -259,7 +258,6 @@ public StructuredGraph build() {
}
}

public static final long INVALID_GRAPH_ID = -1;
private static final AtomicLong uniqueGraphIds = new AtomicLong();

private StartNode start;
Expand Down Expand Up @@ -393,21 +391,6 @@ protected boolean compress(boolean minimizeSize) {
return false;
}

public Stamp getReturnStamp() {
Stamp returnStamp = null;
for (ReturnNode returnNode : getNodes(ReturnNode.TYPE)) {
ValueNode result = returnNode.result();
if (result != null) {
if (returnStamp == null) {
returnStamp = result.stamp(NodeView.DEFAULT);
} else {
returnStamp = returnStamp.meet(result.stamp(NodeView.DEFAULT));
}
}
}
return returnStamp;
}

@Override
public String toString() {
StringBuilder buf = new StringBuilder(getClass().getSimpleName() + ":" + graphId);
Expand Down Expand Up @@ -1109,10 +1092,6 @@ protected void afterRegister(Node node) {
}
}

public NodeSourcePosition getCallerContext() {
return callerContext;
}

public OptimizationLog getOptimizationLog() {
return optimizationLog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,4 @@ public static void addBefore(FixedNode position) {
StructuredGraph graph = position.graph();
graph.addBeforeFixed(position, graph.add(new VerifyHeapNode()));
}

public static void addAfter(FixedWithNextNode position) {
StructuredGraph graph = position.graph();
graph.addAfterFixed(position, graph.add(new VerifyHeapNode()));
}

}
Loading

0 comments on commit 596abcc

Please sign in to comment.