Skip to content

Commit

Permalink
Use @DenyReplace for non-adoptable nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Jul 24, 2022
1 parent c9da626 commit ac1c1c5
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.profiles.ValueProfile;

Expand Down Expand Up @@ -78,6 +79,7 @@ protected static final void doAboutToReturn(final VirtualFrame frame, final NonL
}
}

@DenyReplace
private static final class AboutToReturnNoopNode extends AboutToReturnNode {
private static final AboutToReturnNoopNode SINGLETON = new AboutToReturnNoopNode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.oracle.truffle.api.dsl.Cached.Shared;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
Expand Down Expand Up @@ -53,6 +54,7 @@ protected static final void doHandleRawValue(final VirtualFrame frame, final int
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
private static final class HandlePrimitiveFailedNoopNode extends HandlePrimitiveFailedNode {
private static final HandlePrimitiveFailedNoopNode SINGLETON = new HandlePrimitiveFailedNoopNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameSlotKind;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;

import de.hpi.swa.trufflesqueak.model.BlockClosureObject;
Expand Down Expand Up @@ -145,6 +146,7 @@ protected final Object readAndClearObject(final Frame frame) {
}
}

@DenyReplace
private static final class FrameArgumentReadNode extends FrameStackReadNode {
private static final EconomicMap<Integer, FrameArgumentReadNode> SINGLETONS = EconomicMap.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameSlotKind;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;

import de.hpi.swa.trufflesqueak.nodes.AbstractNode;
Expand Down Expand Up @@ -87,6 +88,7 @@ protected final boolean isDoubleOrIllegal(final Frame frame) {
}
}

@DenyReplace
private static final class FrameArgumentWriteNode extends FrameStackWriteNode {
private static final EconomicMap<Integer, FrameArgumentWriteNode> SINGLETONS = EconomicMap.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.Node;

import de.hpi.swa.trufflesqueak.image.SqueakImageContext;
Expand Down Expand Up @@ -39,6 +40,7 @@ public static CheckForInterruptsQuickNode create(final CompiledCodeObject code)

public abstract void execute(VirtualFrame frame);

@DenyReplace
private static final class NoCheckForInterruptsNode extends CheckForInterruptsQuickNode {
private static final NoCheckForInterruptsNode SINGLETON = new NoCheckForInterruptsNode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.DenyReplace;

import de.hpi.swa.trufflesqueak.image.SqueakImageConstants;
import de.hpi.swa.trufflesqueak.model.ArrayObject;
Expand All @@ -31,6 +32,7 @@
import de.hpi.swa.trufflesqueak.util.MiscUtils;

public final class NullPlugin extends AbstractPrimitiveFactoryHolder {
@DenyReplace
@SqueakPrimitive(names = "primitiveScreenScaleFactor")
public static final class PrimScreenScaleFactorNode extends AbstractSingletonPrimitiveNode {
@Override
Expand All @@ -39,6 +41,7 @@ public Object execute() {
}
}

@DenyReplace
@SqueakPrimitive(names = "primitiveHighResClock")
public static final class PrimHighResClockNode extends AbstractSingletonPrimitiveNode {
@Override
Expand All @@ -47,6 +50,7 @@ public Object execute() {
}
}

@DenyReplace
@SqueakPrimitive(names = "primitiveMultipleBytecodeSetsActive")
public static final class PrimMultipleBytecodeSetsActive0Node extends AbstractSingletonPrimitiveNode {
@Override
Expand All @@ -66,6 +70,7 @@ protected final boolean doSet(@SuppressWarnings("unused") final Object receiver,
}
}

@DenyReplace
@SqueakPrimitive(names = "primitiveUtcWithOffset")
public static final class PrimUtcWithOffset1Node extends AbstractSingletonPrimitiveNode {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.DenyReplace;

import de.hpi.swa.trufflesqueak.exceptions.PrimitiveExceptions.PrimitiveFailed;
import de.hpi.swa.trufflesqueak.model.BooleanObject;
Expand All @@ -21,6 +22,8 @@
import de.hpi.swa.trufflesqueak.nodes.primitives.SqueakPrimitive;

public final class SecurityPlugin extends AbstractPrimitiveFactoryHolder {

@DenyReplace
@SqueakPrimitive(names = "primitiveCanWriteImage")
public static final class PrimCanWriteImageNode extends AbstractSingletonPrimitiveNode {
@Override
Expand All @@ -47,6 +50,7 @@ protected static final Object doGet(@SuppressWarnings("unused") final Object rec
}
}

@DenyReplace
@SqueakPrimitive(names = "primitiveGetUntrustedUserDirectory")
public static final class PrimGetUntrustedUserDirectoryNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;

Expand Down Expand Up @@ -572,6 +573,7 @@ protected static final ClassObject doClass(@SuppressWarnings("unused") final Obj
}
}

@DenyReplace
@SqueakPrimitive(indices = 112)
public static final class PrimBytesLeftNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down Expand Up @@ -787,6 +789,7 @@ private static boolean hasPendingFinalizationsWithLogging(final SqueakImageConte
}
}

@DenyReplace
@SqueakPrimitive(indices = 131)
public static final class PrimIncrementalGCNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down Expand Up @@ -1186,6 +1189,7 @@ protected static final Object returnValue(final Object receiver) {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 257)
public static final class PrimQuickReturnTrueNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1195,6 +1199,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 258)
public static final class PrimQuickReturnFalseNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1204,6 +1209,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 259)
public static final class PrimQuickReturnNilNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1213,6 +1219,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 260)
public static final class PrimQuickReturnMinusOneNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1222,6 +1229,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 261)
public static final class PrimQuickReturnZeroNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1231,6 +1239,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 262)
public static final class PrimQuickReturnOneNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -1240,6 +1249,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 263)
public static final class PrimQuickReturnTwoNode extends AbstractSingletonPrimitiveNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.profiles.BranchProfile;
Expand Down Expand Up @@ -789,6 +790,7 @@ protected static final void doFail(final WeakVariablePointersObject rcvr, final
}
}

@DenyReplace
@SqueakPrimitive(indices = 106)
public static final class PrimScreenSizeNode extends AbstractSingletonPrimitiveNode {
@Child AbstractPointersObjectWriteNode writeNode = AbstractPointersObjectWriteNode.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.oracle.truffle.api.dsl.NodeFactory;
import com.oracle.truffle.api.dsl.ReportPolymorphism;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.profiles.ConditionProfile;
Expand Down Expand Up @@ -465,6 +466,7 @@ protected final Object doSignal(final Object receiver, final NilObject semaphore
}
}

@DenyReplace
@SqueakPrimitive(indices = 137)
public static final class PrimSecondClockNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down Expand Up @@ -502,6 +504,7 @@ protected final NativeObject setClipboardText(@SuppressWarnings("unused") final
}
}

@DenyReplace
@SqueakPrimitive(indices = 142)
public static final class PrimVMPathNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down Expand Up @@ -717,6 +720,7 @@ protected static final AbstractSqueakObject doCopy(final AbstractSqueakObjectWit
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 176)
public static final class PrimMaxIdentityHashNode extends AbstractSingletonPrimitiveNode {
Expand Down Expand Up @@ -748,6 +752,7 @@ protected final ArrayObject allInstances(final ClassObject classObject,
}
}

@DenyReplace
@SqueakPrimitive(indices = 240)
public static final class PrimUTCClockNode extends AbstractSingletonPrimitiveNode {
@Override
Expand All @@ -756,6 +761,7 @@ public Object execute() {
}
}

@DenyReplace
@SqueakPrimitive(indices = 241)
public static final class PrimLocalMicrosecondsClockNode extends AbstractSingletonPrimitiveNode {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameInstance;
import com.oracle.truffle.api.nodes.DenyReplace;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.profiles.BranchProfile;
Expand Down Expand Up @@ -412,6 +413,7 @@ protected static final ArrayObject doBadArgument(final ArrayObject receiver, fin
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 129)
public static final class PrimSpecialObjectsArrayNode extends AbstractSingletonPrimitiveNode {
Expand All @@ -421,6 +423,7 @@ public Object execute() {
}
}

@DenyReplace
@NodeInfo(cost = NodeCost.NONE)
@SqueakPrimitive(indices = 138)
public static final class PrimSomeObjectNode extends AbstractSingletonPrimitiveNode {
Expand Down

0 comments on commit ac1c1c5

Please sign in to comment.