Skip to content

Commit

Permalink
Address remaining (Truffle) warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Dec 16, 2023
1 parent 1eb8588 commit 8c6249f
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:

env:
VERBOSE_GRAALVM_LAUNCHERS: true
MX_GATE_OPTS: '--strict-mode --omit-clean --no-warning-as-error'
MX_GATE_OPTS: '--strict-mode --omit-clean'

jobs:
style_and_build_config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import de.hpi.swa.trufflesqueak.nodes.dispatch.DispatchClosureNode;
import de.hpi.swa.trufflesqueak.util.FrameAccess;

@SuppressWarnings("truffle-inlining")
public abstract class AboutToReturnNode extends AbstractNode {
public static AboutToReturnNode create(final CompiledCodeObject code) {
if (code.isUnwindMarked()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import de.hpi.swa.trufflesqueak.nodes.context.frame.FrameStackWriteNode;
import de.hpi.swa.trufflesqueak.util.FrameAccess;

@SuppressWarnings("truffle-inlining")
public abstract class HandlePrimitiveFailedNode extends AbstractNode {
public static HandlePrimitiveFailedNode create(final CompiledCodeObject code) {
if (code.hasStoreIntoTemp1AfterCallPrimitive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.hpi.swa.trufflesqueak.nodes.context.frame.GetOrCreateContextNode;
import de.hpi.swa.trufflesqueak.util.FrameAccess;

@SuppressWarnings("truffle-inlining")
public abstract class MaterializeContextOnMethodExitNode extends AbstractNode {
public static MaterializeContextOnMethodExitNode create() {
return MaterializeContextOnMethodExitNodeGen.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected abstract static class GetOrCreateContextOrMarkerNode extends AbstractN
@Specialization(guards = "doesNotNeedSender(code, assumptionProfile, node)")
protected static final Object doGetContextOrMarker(final VirtualFrame frame, @SuppressWarnings("unused") final Node node, @SuppressWarnings("unused") final CompiledCodeObject code,
@SuppressWarnings("unused") @Shared("assumptionProfile") @Cached final InlinedExactClassProfile assumptionProfile,
@Cached final GetContextOrMarkerNode getContextOrMarkerNode) {
@Cached(inline = false) final GetContextOrMarkerNode getContextOrMarkerNode) {
return getContextOrMarkerNode.execute(frame);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public abstract class DispatchClosureNode extends AbstractNode {
@Specialization(guards = {"closure.getCompiledBlock() == cachedBlock"}, assumptions = {"cachedBlock.getCallTargetStable()"}, limit = "INLINE_CACHE_SIZE")
protected static final Object doDirect(final BlockClosureObject closure, final Object[] arguments,
@Cached("closure.getCompiledBlock()") final CompiledCodeObject cachedBlock,
@Cached("create(cachedBlock.getCallTarget())") final DirectCallNode directCallNode) {
@Cached(value = "create(cachedBlock.getCallTarget())", inline = false) final DirectCallNode directCallNode) {
return directCallNode.call(arguments);
}

@ReportPolymorphism.Megamorphic
@Specialization(replaces = "doDirect")
protected static final Object doIndirect(final BlockClosureObject closure, final Object[] arguments,
@Cached final IndirectCallNode indirectCallNode) {
@Cached(inline = false) final IndirectCallNode indirectCallNode) {
return indirectCallNode.call(closure.getCompiledBlock().getCallTarget(), arguments);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static DispatchSuperSendNode create(final CompiledCodeObject code, final

@Specialization(guards = {"method.getMethodClass(readNode, node) == cachedMethodClass"}, assumptions = {"cachedMethodClass.getClassHierarchyStable()", "dispatchNode.getCallTargetStable()"})
protected static final Object doCached(final VirtualFrame frame,
@Bind("this") final Node node,
@SuppressWarnings("unused") @Bind("this") final Node node,
@SuppressWarnings("unused") @Cached final AbstractPointersObjectReadNode readNode,
@SuppressWarnings("unused") @Cached(value = "method.getMethodClassSlow()", neverDefault = false) final ClassObject cachedMethodClass,
@Cached("create(frame, selector, argumentCount, cachedMethodClass, lookupInSuperClassSlow(cachedMethodClass))") final CachedDispatchNode dispatchNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected static final Object doDirect(@SuppressWarnings("unused") final Compile
@ReportPolymorphism.Megamorphic
@Specialization(replaces = "doDirect")
protected static final Object doIndirect(final CompiledCodeObject method, final Object[] receiverAndArguments, final Object contextOrMarker,
@Cached final IndirectCallNode callNode) {
@Cached(inline = false) final IndirectCallNode callNode) {
return callNode.call(method.getCallTarget(), FrameAccess.newWith(contextOrMarker, null, receiverAndArguments));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.hpi.swa.trufflesqueak.nodes.accessing.SqueakObjectClassNode;
import de.hpi.swa.trufflesqueak.nodes.bytecodes.SendBytecodes.SelfSendNode;

@SuppressWarnings("truffle-inlining")
@ImportStatic(SelfSendNode.class)
public abstract class LookupClassNode extends AbstractNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private static Object calloutToLib(final SqueakImageContext image, final String
return interopLib.invokeMember(ffiTest, name, argumentsConverted);
}

private String getModuleName(final AbstractPointersObjectReadNode readExternalLibNode, final Node inlineTarget, final AbstractSqueakObject receiver,
private static String getModuleName(final AbstractPointersObjectReadNode readExternalLibNode, final Node inlineTarget, final AbstractSqueakObject receiver,
final PointersObject externalLibraryFunction) {
final Object moduleObject = readExternalLibNode.execute(inlineTarget, externalLibraryFunction, ObjectLayouts.EXTERNAL_LIBRARY_FUNCTION.MODULE);
if (moduleObject != NilObject.SINGLETON) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ protected static final PointersObject doExitNonEmpty(final VirtualFrame frame, f
@Cached final AbstractPointersObjectReadNode readNode,
@Exclusive @Cached final AbstractPointersObjectWriteNode writeNode,
@Cached final ResumeProcessNode resumeProcessNode,
@Cached final FrameStackPointerIncrementNode frameStackPointerIncrementNode) {
@Cached(inline = false) final FrameStackPointerIncrementNode frameStackPointerIncrementNode) {
final PointersObject owningProcess = mutex.removeFirstLinkOfList(readNode, writeNode, node);
writeNode.execute(node, mutex, MUTEX.OWNER, owningProcess);
try {
Expand Down Expand Up @@ -1058,7 +1058,7 @@ protected static final Object doEnter(final VirtualFrame frame, final Node node,
final PointersObject effectiveProcess,
@Cached final AddLastLinkToListNode addLastLinkToListNode,
@Cached final WakeHighestPriorityNode wakeHighestPriorityNode,
@Cached final FrameStackPushNode pushNode) {
@Cached(inline = false) final FrameStackPushNode pushNode) {
addLastLinkToListNode.execute(node, effectiveProcess, mutex);
try {
wakeHighestPriorityNode.executeWake(frame, node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ protected abstract static class PrimScanCharactersNode extends AbstractPrimitive

@Specialization(guards = {"startIndex > 0", "stopIndex > 0", "sourceString.isByteType()", "stopIndex <= sourceString.getByteLength()", "receiver.size() >= 4",
"arraySizeNode.execute(node, stops) >= 258", "hasCorrectSlots(pointersReadNode, arraySizeNode, node, receiver)"}, limit = "1")
protected final Object doScan(final PointersObject receiver, final long startIndex, final long stopIndex, final NativeObject sourceString, final long rightX,
protected static final Object doScan(final PointersObject receiver, final long startIndex, final long stopIndex, final NativeObject sourceString, final long rightX,
final ArrayObject stops, final long kernData,
@Bind("this") final Node node,
@Cached final AbstractPointersObjectReadNode pointersReadNode,
Expand Down Expand Up @@ -299,12 +299,13 @@ protected final Object doScan(final PointersObject receiver, final long startInd
return arrayReadNode.execute(node, stops, END_OF_RUN);
}

private void storeStateInReceiver(final AbstractPointersObjectWriteNode writeNode, final Node inlineTarget, final PointersObject receiver, final long scanDestX, final long scanLastIndex) {
private static void storeStateInReceiver(final AbstractPointersObjectWriteNode writeNode, final Node inlineTarget, final PointersObject receiver, final long scanDestX,
final long scanLastIndex) {
writeNode.execute(inlineTarget, receiver, CHARACTER_SCANNER.DEST_X, scanDestX);
writeNode.execute(inlineTarget, receiver, CHARACTER_SCANNER.LAST_INDEX, scanLastIndex);
}

protected final boolean hasCorrectSlots(final AbstractPointersObjectReadNode readNode, final ArrayObjectSizeNode arraySizeNode, final Node inlineTarget, final PointersObject receiver) {
protected static final boolean hasCorrectSlots(final AbstractPointersObjectReadNode readNode, final ArrayObjectSizeNode arraySizeNode, final Node inlineTarget, final PointersObject receiver) {
return readNode.execute(inlineTarget, receiver, CHARACTER_SCANNER.DEST_X) instanceof Long &&
readNode.execute(inlineTarget, receiver, CHARACTER_SCANNER.XTABLE) instanceof ArrayObject &&
readNode.execute(inlineTarget, receiver, CHARACTER_SCANNER.MAP) instanceof final ArrayObject scanMap && arraySizeNode.execute(inlineTarget, scanMap) == 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*/
package de.hpi.swa.trufflesqueak.nodes.process;

import com.oracle.truffle.api.dsl.Bind;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Cached.Shared;
import com.oracle.truffle.api.dsl.GenerateCached;
import com.oracle.truffle.api.dsl.GenerateInline;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.Node;

Expand All @@ -22,6 +23,8 @@
import de.hpi.swa.trufflesqueak.nodes.accessing.AbstractPointersObjectNodes.AbstractPointersObjectReadNode;
import de.hpi.swa.trufflesqueak.nodes.accessing.AbstractPointersObjectNodes.AbstractPointersObjectWriteNode;

@GenerateInline
@GenerateCached(false)
public abstract class RemoveProcessFromListNode extends AbstractNode {

public final void executeRemove(final PointersObject process, final PointersObject list,
Expand All @@ -30,15 +33,15 @@ public final void executeRemove(final PointersObject process, final PointersObje
final Node inlineTarget) {
final Object first = readNode.execute(inlineTarget, list, LINKED_LIST.FIRST_LINK);
final Object last = readNode.execute(inlineTarget, list, LINKED_LIST.LAST_LINK);
executeRemove(process, list, first, last);
executeRemove(inlineTarget, process, list, first, last);
writeNode.executeNil(inlineTarget, process, PROCESS.NEXT_LINK);
}

protected abstract void executeRemove(PointersObject process, PointersObject list, Object first, Object last);
protected abstract void executeRemove(Node node, PointersObject process, PointersObject list, Object first, Object last);

@Specialization(guards = "process == first")
protected final void doRemoveEqual(final PointersObject process, final PointersObject list, @SuppressWarnings("unused") final PointersObject first, final AbstractSqueakObject last,
@Bind("this") final Node node,
protected static final void doRemoveEqual(final Node node, final PointersObject process, final PointersObject list, @SuppressWarnings("unused") final PointersObject first,
final AbstractSqueakObject last,
@Shared("readNode") @Cached final AbstractPointersObjectReadNode readNode,
@Shared("writeNode") @Cached final AbstractPointersObjectWriteNode writeNode) {
final Object next = readNode.execute(node, process, PROCESS.NEXT_LINK);
Expand All @@ -49,8 +52,7 @@ protected final void doRemoveEqual(final PointersObject process, final PointersO
}

@Specialization(guards = "process != first")
protected final void doRemoveNotEqual(final PointersObject process, final PointersObject list, final PointersObject first, final AbstractSqueakObject last,
@Bind("this") final Node node,
protected static final void doRemoveNotEqual(final Node node, final PointersObject process, final PointersObject list, final PointersObject first, final AbstractSqueakObject last,
@Shared("readNode") @Cached final AbstractPointersObjectReadNode readNode,
@Shared("writeNode") @Cached final AbstractPointersObjectWriteNode writeNode) {
PointersObject temp = first;
Expand Down

1 comment on commit 8c6249f

@TruffleSqueak-Bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance Report (8c6249f)

Benchmarks ran on graalvm-jdk-21+35.1.

Steady (after 100 iterations)

Benchmark Name Min Geomean Median Mean Max Total (ms) Total (min)
Bounce 543 552 545.66 544 545.65 109131 1.82
CD 476 491 480.32 479 480.31 96064 1.6
DeltaBlue 277 474 401.09 400.5 399.73 80218 1.34
Havlak 1136 1190 1167.91 1172 1167.85 233582 3.89
Json 371 380 373.84 372 373.83 74768 1.25
List 292 310 292.83 292 292.82 58566 0.98
Mandelbrot 132 146 133.04 133 133.02 26607 0.44
NBody 249 263 251.72 250 251.7 50343 0.84
Permute 151 166 153.49 153 153.48 30698 0.51
Queens 231 242 231.85 232 231.84 46370 0.77
Richards 1228 1245 1233.05 1233 1233.04 246609 4.11
Sieve 163 174 164.13 164 164.12 32826 0.55
Storage 137 147 139.35 138 139.33 27871 0.46
Towers 203 218 205.01 204 205 41001 0.68
5589 5998 5773.27 5766.5 5771.71 1154654 19.24

8c6249f-2-steady.svg

Warmup (first 100 iterations)

8c6249f-3-warmup.svg

Please sign in to comment.