diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8e82e2d1..e1ebb7af1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,5 +153,5 @@ jobs: run: | mx --env trufflesqueak-svm build --dependencies GRAALVM_TRUFFLESQUEAK_SVM_JAVA17 echo "$(mx --env trufflesqueak-svm graalvm-home)/bin" >> $GITHUB_PATH - - name: Run Cuis-Smalltalk tests on TruffleSqueak + - name: Run Cuis-Smalltalk tests on TruffleSqueak in native mode run: trufflesqueak --native --headless --experimental-options --engine.CompilationFailureAction=ExitVM --engine.TreatPerformanceWarningsAsErrors=all images/Cuis6.0-????.image -s src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/runCuisTests.st diff --git a/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/AbstractSqueakTestCase.java b/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/AbstractSqueakTestCase.java index cc0556056..8e2b909c6 100644 --- a/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/AbstractSqueakTestCase.java +++ b/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/AbstractSqueakTestCase.java @@ -39,11 +39,11 @@ public abstract class AbstractSqueakTestCase { protected static SqueakImageContext image; protected static PointersObject nilClassBinding; - protected static CompiledCodeObject makeMethod(final byte[] bytes, final Object[] literals) { + protected static final CompiledCodeObject makeMethod(final byte[] bytes, final Object[] literals) { return new CompiledCodeObject(image, bytes, literals, image.compiledMethodClass); } - protected static CompiledCodeObject makeMethod(final Object[] literals, final int... intbytes) { + protected static final CompiledCodeObject makeMethod(final Object[] literals, final int... intbytes) { final byte[] bytes = new byte[intbytes.length + 1]; for (int i = 0; i < intbytes.length; i++) { bytes[i] = (byte) intbytes[i]; @@ -55,15 +55,15 @@ protected static CompiledCodeObject makeMethod(final Object[] literals, final in return makeMethod(bytes, literals); } - protected static long makeHeader(final int numArgs, final int numTemps, final int numLiterals, final boolean hasPrimitive, final boolean needsLargeFrame) { // shortcut + protected static final long makeHeader(final int numArgs, final int numTemps, final int numLiterals, final boolean hasPrimitive, final boolean needsLargeFrame) { // shortcut return CompiledCodeObject.makeHeader(true, numArgs, numTemps, numLiterals, hasPrimitive, needsLargeFrame); } - protected CompiledCodeObject makeMethod(final int... intbytes) { + protected static final CompiledCodeObject makeMethod(final int... intbytes) { return makeMethod(new Object[]{makeHeader(0, 5, 14, false, true), nilClassBinding}, intbytes); } - protected static Object runMethod(final CompiledCodeObject code, final Object receiver, final Object... arguments) { + protected static final Object runMethod(final CompiledCodeObject code, final Object receiver, final Object... arguments) { final VirtualFrame frame = createTestFrame(code); Object result = null; try { @@ -74,11 +74,11 @@ protected static Object runMethod(final CompiledCodeObject code, final Object re return result; } - protected ExecuteTopLevelContextNode createContext(final CompiledCodeObject code, final Object receiver) { + protected static final ExecuteTopLevelContextNode createContext(final CompiledCodeObject code, final Object receiver) { return createContext(code, receiver, ArrayUtils.EMPTY_ARRAY); } - protected static ExecuteTopLevelContextNode createContext(final CompiledCodeObject code, final Object receiver, final Object[] arguments) { + protected static final ExecuteTopLevelContextNode createContext(final CompiledCodeObject code, final Object receiver, final Object[] arguments) { final ContextObject testContext = ContextObject.create(image, code.getSqueakContextSize()); testContext.setReceiver(receiver); testContext.setCodeObject(code); @@ -96,34 +96,34 @@ protected static ExecuteTopLevelContextNode createContext(final CompiledCodeObje return ExecuteTopLevelContextNode.create(image, null, testContext, false); } - protected Object runMethod(final Object receiver, final int... intbytes) { + protected static final Object runMethod(final Object receiver, final int... intbytes) { return runMethod(receiver, new AbstractSqueakObject[0], intbytes); } - protected Object runMethod(final Object receiver, final Object[] arguments, final int... intbytes) { + protected static final Object runMethod(final Object receiver, final Object[] arguments, final int... intbytes) { final CompiledCodeObject method = makeMethod(intbytes); return runMethod(method, receiver, arguments); } - protected Object runBinaryPrimitive(final int primCode, final Object rcvr, final Object... arguments) { + protected static final Object runBinaryPrimitive(final int primCode, final Object rcvr, final Object... arguments) { return runPrim(new Object[]{17104899L}, primCode, rcvr, arguments); } - protected Object runQuinaryPrimitive(final int primCode, final Object rcvr, final Object... arguments) { + protected static final Object runQuinaryPrimitive(final int primCode, final Object rcvr, final Object... arguments) { return runPrim(new Object[]{68222979L}, primCode, rcvr, arguments); } - protected Object runPrim(final Object[] literals, final int primCode, final Object rcvr, final Object... arguments) { + protected static final Object runPrim(final Object[] literals, final int primCode, final Object rcvr, final Object... arguments) { final CompiledCodeObject method = makeMethod(literals, 139, primCode & 0xFF, (primCode & 0xFF00) >> 8); return runMethod(method, rcvr, arguments); } - protected static VirtualFrame createTestFrame(final CompiledCodeObject code) { + protected static final VirtualFrame createTestFrame(final CompiledCodeObject code) { final Object[] arguments = FrameAccess.newWith(code, NilObject.SINGLETON, null, new Object[]{NilObject.SINGLETON}); return Truffle.getRuntime().createVirtualFrame(arguments, code.getFrameDescriptor()); } - protected static SqueakImage loadImageContext(final String imagePath) { + protected static final SqueakImage loadImageContext(final String imagePath) { assert context == null && image == null; final Builder contextBuilder = Context.newBuilder(); contextBuilder.allowAllAccess(true); @@ -150,7 +150,7 @@ protected static SqueakImage loadImageContext(final String imagePath) { } } - protected static void destroyImageContext() { + protected static final void destroyImageContext() { // Close context if existing (for reloading mechanism). context.close(true); context = null; diff --git a/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/SqueakPrimitiveTest.java b/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/SqueakPrimitiveTest.java index 123cb6d60..85f666a00 100644 --- a/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/SqueakPrimitiveTest.java +++ b/src/de.hpi.swa.trufflesqueak.test/src/de/hpi/swa/trufflesqueak/test/SqueakPrimitiveTest.java @@ -23,6 +23,7 @@ import de.hpi.swa.trufflesqueak.model.LargeIntegerObject; import de.hpi.swa.trufflesqueak.model.NilObject; +@SuppressWarnings("static-method") public final class SqueakPrimitiveTest extends AbstractSqueakTestCaseWithDummyImage { @Test public void testPrimEquivalent() { diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/exceptions/SqueakExceptions.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/exceptions/SqueakExceptions.java index da15020b7..6501ab8a7 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/exceptions/SqueakExceptions.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/exceptions/SqueakExceptions.java @@ -30,6 +30,7 @@ public final class SqueakExceptions { + @SuppressWarnings("static-method") @ExportLibrary(InteropLibrary.class) protected abstract static class AbstractSqueakException extends AbstractTruffleException { private static final long serialVersionUID = 1L; @@ -51,17 +52,17 @@ protected AbstractSqueakException(final String message, final Node location) { @ExportMessage @TruffleBoundary - protected Object toDisplayString(@SuppressWarnings("unused") final boolean allowSideEffects) { + protected final Object toDisplayString(@SuppressWarnings("unused") final boolean allowSideEffects) { return toString(); } @ExportMessage - protected boolean hasLanguage() { + protected final boolean hasLanguage() { return true; } @ExportMessage - protected Class> getLanguage() { + protected final Class> getLanguage() { return SqueakLanguage.class; } } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/SqueakLanguageView.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/SqueakLanguageView.java index 9ef66f696..9ba479741 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/SqueakLanguageView.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/SqueakLanguageView.java @@ -8,7 +8,6 @@ import static com.oracle.truffle.api.CompilerDirectives.shouldNotReachHere; -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.TruffleLanguage; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Cached.Shared; @@ -84,21 +83,4 @@ private static boolean isPrimitiveOrFromOtherLanguage(final Object value) { throw shouldNotReachHere(e); } } - - @TruffleBoundary - public static Object forValue(final Object value) { - if (value == null) { - return null; - } - final InteropLibrary lib = InteropLibrary.getFactory().getUncached(value); - try { - if (lib.hasLanguage(value) && lib.getLanguage(value) == SqueakLanguage.class) { - return value; - } else { - return create(value); - } - } catch (final UnsupportedMessageException e) { - throw shouldNotReachHere(e); - } - } } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/WrapToSqueakNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/WrapToSqueakNode.java index b48aaa800..55ab83325 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/WrapToSqueakNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/interop/WrapToSqueakNode.java @@ -41,10 +41,6 @@ public final Object[] executeObjects(final Object... values) { return wrappedElements; } - public final ArrayObject executeList(final Object... values) { - return (ArrayObject) executeWrap(values); - } - @Specialization protected static final boolean doBoolean(final boolean value) { return value; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/ClassObject.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/ClassObject.java index db58a03e1..7f2e34247 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/ClassObject.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/ClassObject.java @@ -6,9 +6,7 @@ */ package de.hpi.swa.trufflesqueak.model; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import com.oracle.truffle.api.Assumption; import com.oracle.truffle.api.CompilerDirectives; @@ -238,7 +236,7 @@ public boolean isCompiledMethodClass() { return this == image.compiledMethodClass; } - public boolean includesBehavior(final ClassObject squeakClass) { + private boolean includesBehavior(final ClassObject squeakClass) { ClassObject current = this; while (current != null) { if (current == squeakClass) { @@ -413,23 +411,6 @@ public CompiledCodeObject lookupMethodInMethodDictSlow(final NativeObject select return (CompiledCodeObject) lookupInMethodDictSlow(selector); } - @TruffleBoundary - public Object[] listInteropMembers() { - final List methodNames = new ArrayList<>(); - ClassObject lookupClass = this; - while (lookupClass != null) { - final VariablePointersObject methodDictObject = lookupClass.getMethodDict(); - final Object[] methodDictVariablePart = methodDictObject.getVariablePart(); - for (final Object methodSelector : methodDictVariablePart) { - if (methodSelector instanceof NativeObject) { - methodNames.add(((NativeObject) methodSelector).asStringUnsafe().replace(':', '_')); - } - } - lookupClass = lookupClass.getSuperclassOrNull(); - } - return methodNames.toArray(new String[0]); - } - public int getBasicInstanceSize() { return (int) (format & 0xffff); } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/CompiledCodeObject.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/CompiledCodeObject.java index b0f82c5ab..fce14fed3 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/CompiledCodeObject.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/CompiledCodeObject.java @@ -64,13 +64,13 @@ public final class CompiledCodeObject extends AbstractSqueakObjectWithClassAndHa * Literals are cached in the AST and bytes are represented by nodes, so this should not affect * performance. Find out why it does affect performance. */ - @CompilationFinal(dimensions = 1) protected Object[] literals; - @CompilationFinal(dimensions = 1) protected byte[] bytes; - @CompilationFinal protected int numArgs; - @CompilationFinal protected int numLiterals; - @CompilationFinal protected boolean hasPrimitive; - @CompilationFinal protected boolean needsLargeFrame; - @CompilationFinal protected int numTemps; + @CompilationFinal(dimensions = 1) private Object[] literals; + @CompilationFinal(dimensions = 1) private byte[] bytes; + @CompilationFinal private int numArgs; + @CompilationFinal private int numLiterals; + @CompilationFinal private boolean hasPrimitive; + @CompilationFinal private boolean needsLargeFrame; + @CompilationFinal private int numTemps; private AbstractSqueakBytecodeDecoder decoder; @@ -103,14 +103,14 @@ public CompiledCodeObject(final SqueakImageContext image, final byte[] bc, final bytes = bc; } - protected CompiledCodeObject(final CompiledCodeObject original) { + private CompiledCodeObject(final CompiledCodeObject original) { super(original); frameDescriptor = original.frameDescriptor; setLiteralsAndBytes(original.literals.clone(), original.bytes.clone()); decoder = original.decoder; } - protected CompiledCodeObject(final CompiledCodeObject outerCode, final int startPC) { + private CompiledCodeObject(final CompiledCodeObject outerCode, final int startPC) { super(outerCode); outerCode.shadowBlocks.put(startPC, this); @@ -222,7 +222,7 @@ private void renewCallTarget() { initializeCallTargetUnsafe(); } - protected void initializeCallTargetUnsafe() { + private void initializeCallTargetUnsafe() { CompilerAsserts.neverPartOfCompilation(); final SqueakLanguage language = SqueakImageContext.getSlow().getLanguage(); final RootNode rootNode; @@ -322,7 +322,7 @@ public int findLineNumber(final int index) { return decoder.findLineNumber(this, index); } - protected void decodeHeader() { + private void decodeHeader() { CompilerDirectives.transferToInterpreterAndInvalidate(); final long header = (long) literals[0]; numLiterals = CompiledCodeHeaderDecoder.getNumLiterals(header); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/LargeIntegerObject.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/LargeIntegerObject.java index 63c12f4df..426ff16eb 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/LargeIntegerObject.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/LargeIntegerObject.java @@ -475,11 +475,6 @@ public int compareTo(final long b) { } } - @TruffleBoundary(transferToInterpreterOnException = false) - public double doubleValue() { - return integer.doubleValue(); - } - /** {@link BigInteger#signum()} does not need a {@link TruffleBoundary}. */ public boolean isZero() { return integer.signum() == 0; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/NilObject.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/NilObject.java index 34d32d280..16733ee08 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/NilObject.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/NilObject.java @@ -30,10 +30,6 @@ public static Object nullToNil(final Object object) { return object == null ? SINGLETON : object; } - public static Object nullToNil(final Object object, final ConditionProfile profile) { - return profile.profile(object == null) ? SINGLETON : object; - } - @Override public long getSqueakHash() { return SQUEAK_HASH; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/layout/SlotLocation.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/layout/SlotLocation.java index c65592386..d284a72e0 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/layout/SlotLocation.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/layout/SlotLocation.java @@ -397,7 +397,7 @@ public final void unset(final AbstractPointersObject object) { } } - protected static int getPrimitiveUsedMask(final int index) { + private static int getPrimitiveUsedMask(final int index) { assert 0 <= index && index < Integer.SIZE; return 1 << index; } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/DoItRootNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/DoItRootNode.java index 642b3b2a4..519992b45 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/DoItRootNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/DoItRootNode.java @@ -16,7 +16,7 @@ import de.hpi.swa.trufflesqueak.model.NilObject; public final class DoItRootNode extends RootNode { - @Child protected WrapToSqueakNode wrapNode = WrapToSqueakNode.create(); + @Child private WrapToSqueakNode wrapNode = WrapToSqueakNode.create(); private final SqueakImageContext image; private final Object maybeClosure; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteBytecodeNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteBytecodeNode.java index a7a1cb111..30bc30dc7 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteBytecodeNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/ExecuteBytecodeNode.java @@ -33,7 +33,7 @@ public final class ExecuteBytecodeNode extends AbstractExecuteContextNode { private static final int LOCAL_RETURN_PC = -2; - protected final CompiledCodeObject code; + private final CompiledCodeObject code; private final int initialPC; private SourceSection section; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/StartContextRootNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/StartContextRootNode.java index ecc80682e..039800b78 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/StartContextRootNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/StartContextRootNode.java @@ -63,7 +63,7 @@ public Object execute(final VirtualFrame frame) { } @ExplodeLoop - public void initializeFrame(final VirtualFrame frame) { + private void initializeFrame(final VirtualFrame frame) { if (writeTempNodes == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); final BlockClosureObject closure = FrameAccess.getClosure(frame); @@ -88,8 +88,8 @@ public void initializeFrame(final VirtualFrame frame) { // TODO: avoid nilling out of temp slots to allow slot specializations // Initialize remaining temporary variables with nil in newContext. - for (int i = 0; i < writeTempNodes.length; i++) { - writeTempNodes[i].executeWrite(frame, NilObject.SINGLETON); + for (final FrameStackWriteNode node : writeTempNodes) { + node.executeWrite(frame, NilObject.SINGLETON); } } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/accessing/ArrayObjectNodes.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/accessing/ArrayObjectNodes.java index 78b02cdb6..5a96d65a2 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/accessing/ArrayObjectNodes.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/accessing/ArrayObjectNodes.java @@ -335,7 +335,7 @@ public static ArrayObjectCopyIntoObjectArrayNode create(final int offset) { } public static ArrayObjectCopyIntoObjectArrayNode createForFrameArguments() { - return ArrayObjectCopyIntoObjectArrayNodeGen.create(FrameAccess.getArgumentStartIndex()); + return create(FrameAccess.getArgumentStartIndex()); } public abstract void execute(Object[] target, ArrayObject obj); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/PushBytecodes.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/PushBytecodes.java index 1182a0afe..ef4e55d45 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/PushBytecodes.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/PushBytecodes.java @@ -441,7 +441,7 @@ private static Object getPushValue(final Object literal) { } public static final class PushNewArrayNode extends AbstractPushNode { - @Child protected ArrayNode arrayNode; + @Child private ArrayNode arrayNode; protected PushNewArrayNode(final CompiledCodeObject code, final int index, final int numBytecodes, final byte param) { super(code, index, numBytecodes); @@ -469,7 +469,7 @@ public ArrayNode(final int arraySize) { } protected static final class ArrayFromStackNode extends ArrayNode { - @Child protected FrameStackPopNNode popNNode; + @Child private FrameStackPopNNode popNNode; public ArrayFromStackNode(final int arraySize) { super(arraySize); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/ReturnBytecodes.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/ReturnBytecodes.java index f62f38929..39f88cd79 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/ReturnBytecodes.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/ReturnBytecodes.java @@ -44,7 +44,7 @@ public final Object executeReturn(final VirtualFrame frame) { } public abstract static class AbstractNormalReturnNode extends AbstractReturnNode { - @Child protected AbstractReturnKindNode returnNode; + @Child private AbstractReturnKindNode returnNode; protected AbstractNormalReturnNode(final VirtualFrame frame, final CompiledCodeObject code, final int index) { super(code, index); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SendBytecodes.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SendBytecodes.java index 038d5ff4c..bb794ec2a 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SendBytecodes.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/bytecodes/SendBytecodes.java @@ -226,7 +226,7 @@ public NativeObject getSelector() { return dispatchNode.getSelector(); } - protected Object peekAtReceiver(final VirtualFrame frame) { + private Object peekAtReceiver(final VirtualFrame frame) { if (peekAtReceiverNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); final int sp = FrameAccess.getStackPointer(frame); @@ -235,7 +235,7 @@ protected Object peekAtReceiver(final VirtualFrame frame) { return peekAtReceiverNode.executeRead(frame); } - protected ClassObject popDirectedClass(final VirtualFrame frame) { + private ClassObject popDirectedClass(final VirtualFrame frame) { if (readDirectedClassNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); /* Decrement sp to pop directed class. */ diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/dispatch/LookupClassGuard.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/dispatch/LookupClassGuard.java index a90d458b2..7fb784ce4 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/dispatch/LookupClassGuard.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/dispatch/LookupClassGuard.java @@ -65,9 +65,6 @@ public static LookupClassGuard create(final Object receiver) { private static final class NilGuard extends LookupClassGuard { private static final NilGuard SINGLETON = new NilGuard(); - private NilGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver == NilObject.SINGLETON; @@ -82,9 +79,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class TrueGuard extends LookupClassGuard { private static final TrueGuard SINGLETON = new TrueGuard(); - private TrueGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver == Boolean.TRUE; @@ -99,9 +93,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class FalseGuard extends LookupClassGuard { private static final FalseGuard SINGLETON = new FalseGuard(); - private FalseGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver == Boolean.FALSE; @@ -116,9 +107,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class SmallIntegerGuard extends LookupClassGuard { private static final SmallIntegerGuard SINGLETON = new SmallIntegerGuard(); - private SmallIntegerGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver instanceof Long; @@ -133,9 +121,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class CharacterGuard extends LookupClassGuard { private static final CharacterGuard SINGLETON = new CharacterGuard(); - private CharacterGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver instanceof Character || receiver instanceof CharacterObject; @@ -150,9 +135,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class DoubleGuard extends LookupClassGuard { private static final DoubleGuard SINGLETON = new DoubleGuard(); - private DoubleGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver instanceof Double; @@ -167,9 +149,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class ContextObjectGuard extends LookupClassGuard { private static final ContextObjectGuard SINGLETON = new ContextObjectGuard(); - private ContextObjectGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver instanceof ContextObject; @@ -184,9 +163,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class FloatObjectGuard extends LookupClassGuard { private static final ForeignObjectGuard SINGLETON = new ForeignObjectGuard(); - private FloatObjectGuard() { - } - @Override protected boolean check(final Object receiver) { return receiver instanceof FloatObject; @@ -247,9 +223,6 @@ protected ClassObject getSqueakClassInternal(final SqueakImageContext image) { private static final class ForeignObjectGuard extends LookupClassGuard { private static final ForeignObjectGuard SINGLETON = new ForeignObjectGuard(); - private ForeignObjectGuard() { - } - @Override protected boolean check(final Object receiver) { return !SqueakGuards.isAbstractSqueakObject(receiver) && !SqueakGuards.isUsedJavaPrimitive(receiver); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/interrupts/CheckForInterruptsState.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/interrupts/CheckForInterruptsState.java index a59550e84..858b070af 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/interrupts/CheckForInterruptsState.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/interrupts/CheckForInterruptsState.java @@ -176,7 +176,7 @@ public boolean shouldTriggerNoTimer() { return shouldTriggerNoTimer; } - public void resetTriggers() { + private void resetTriggers() { shouldTrigger = false; shouldTriggerNoTimer = false; } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/UnixOSProcessPlugin.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/UnixOSProcessPlugin.java index 73921acde..db637ce95 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/UnixOSProcessPlugin.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/UnixOSProcessPlugin.java @@ -529,7 +529,7 @@ protected final String getFunctionName() { } @Override - protected String getFunctionSignature() { + protected final String getFunctionSignature() { return "(SINT32,SINT32):SINT32"; } } @@ -549,7 +549,7 @@ protected final String getFunctionName() { } @Override - protected String getFunctionSignature() { + protected final String getFunctionSignature() { return "(SINT32,SINT32):SINT32"; } } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/ArithmeticPrimitives.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/ArithmeticPrimitives.java index 913f1df59..fdb183456 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/ArithmeticPrimitives.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/ArithmeticPrimitives.java @@ -280,12 +280,12 @@ protected static final Object doLongDouble(final long lhs, final double rhs, @SqueakPrimitive(indices = 10) protected abstract static class PrimDivideNode extends AbstractArithmeticPrimitiveNode implements BinaryPrimitiveFallback { @Specialization(guards = {"rhs != 0", "!isOverflowDivision(lhs, rhs)", "isIntegralWhenDividedBy(lhs, rhs)"}) - public static final long doLong(final long lhs, final long rhs) { + protected static final long doLong(final long lhs, final long rhs) { return lhs / rhs; } @Specialization(guards = {"rhs != 0", "!isOverflowDivision(lhs, rhs)"}, replaces = "doLong") - public final Object doLongFraction(final long lhs, final long rhs, + protected final Object doLongFraction(final long lhs, final long rhs, @Cached final ConditionProfile fractionProfile, @Cached final AbstractPointersObjectWriteNode writeNode) { if (fractionProfile.profile(SqueakGuards.isIntegralWhenDividedBy(lhs, rhs))) { @@ -297,7 +297,7 @@ public final Object doLongFraction(final long lhs, final long rhs, @SuppressWarnings("unused") @Specialization(guards = {"isOverflowDivision(lhs, rhs)"}) - public final LargeIntegerObject doLongOverflow(final long lhs, final long rhs) { + protected final LargeIntegerObject doLongOverflow(final long lhs, final long rhs) { return LargeIntegerObject.createLongMinOverflowResult(getContext()); } @@ -351,13 +351,13 @@ protected static final long doLongLargeInteger(final long lhs, final LargeIntege @SqueakPrimitive(indices = 13) protected abstract static class PrimQuoNode extends AbstractArithmeticPrimitiveNode implements BinaryPrimitiveFallback { @Specialization(guards = {"rhs != 0", "!isOverflowDivision(lhs, rhs)"}) - public static final long doLong(final long lhs, final long rhs) { + protected static final long doLong(final long lhs, final long rhs) { return lhs / rhs; } @SuppressWarnings("unused") @Specialization(guards = {"isOverflowDivision(lhs, rhs)"}) - public final LargeIntegerObject doLongOverflow(final long lhs, final long rhs) { + protected final LargeIntegerObject doLongOverflow(final long lhs, final long rhs) { return LargeIntegerObject.createLongMinOverflowResult(getContext()); } @@ -665,7 +665,7 @@ protected static final Object doLargeIntegerLong(final LargeIntegerObject lhs, f } @Specialization - protected Object doLargeInteger(final LargeIntegerObject lhs, final LargeIntegerObject rhs) { + protected static final Object doLargeInteger(final LargeIntegerObject lhs, final LargeIntegerObject rhs) { return lhs.floorMod(rhs); } } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/IOPrimitives.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/IOPrimitives.java index 8d20f6b15..4072b5a9e 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/IOPrimitives.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/IOPrimitives.java @@ -517,7 +517,7 @@ protected static final void doFail(final ArrayObject rcvr, final long start, fin throw PrimitiveFailed.GENERIC_ERROR; } - protected final ArrayObjectSizeNode getSizeNode() { + private ArrayObjectSizeNode getSizeNode() { if (sizeNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); sizeNode = insert(ArrayObjectSizeNode.create()); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/process/SignalSemaphoreNode.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/process/SignalSemaphoreNode.java index ddfac5552..1da3f2f84 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/process/SignalSemaphoreNode.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/process/SignalSemaphoreNode.java @@ -27,14 +27,14 @@ public static SignalSemaphoreNode create() { public abstract void executeSignal(VirtualFrame frame, Object semaphore); @Specialization(guards = {"isSemaphore(semaphore)", "semaphore.isEmptyList(readNode)"}, limit = "1") - public static final void doSignalEmpty(final PointersObject semaphore, + protected static final void doSignalEmpty(final PointersObject semaphore, @Shared("readNode") @Cached final AbstractPointersObjectReadNode readNode, @Shared("writeNode") @Cached final AbstractPointersObjectWriteNode writeNode) { writeNode.execute(semaphore, SEMAPHORE.EXCESS_SIGNALS, readNode.executeLong(semaphore, SEMAPHORE.EXCESS_SIGNALS) + 1); } @Specialization(guards = {"isSemaphore(semaphore)", "!semaphore.isEmptyList(readNode)"}, limit = "1") - public static final void doSignal(final VirtualFrame frame, final PointersObject semaphore, + protected static final void doSignal(final VirtualFrame frame, final PointersObject semaphore, @Shared("readNode") @Cached final AbstractPointersObjectReadNode readNode, @Shared("writeNode") @Cached final AbstractPointersObjectWriteNode writeNode, @Cached final ResumeProcessNode resumeProcessNode) { diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/FrameAccess.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/FrameAccess.java index d4f383fc8..30611ac2a 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/FrameAccess.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/FrameAccess.java @@ -189,10 +189,6 @@ public static ContextObject getContext(final Frame frame) { return (ContextObject) frame.getObject(SlotIndicies.THIS_CONTEXT.ordinal()); } - public static boolean hasContext(final VirtualFrame frame) { - return FrameAccess.getContext(frame) != null; - } - public static boolean hasEscapedContext(final VirtualFrame frame) { final ContextObject context = getContext(frame); return context != null && context.hasEscaped(); diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/MethodCacheEntry.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/MethodCacheEntry.java index 379f32a90..da3565c33 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/MethodCacheEntry.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/MethodCacheEntry.java @@ -16,9 +16,6 @@ public final class MethodCacheEntry { private NativeObject selector; private Object result; - public MethodCacheEntry() { - } - public ClassObject getClassObject() { return classObject; } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/UnsafeUtils.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/UnsafeUtils.java index a8d5f41e7..2ea49a3df 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/UnsafeUtils.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/util/UnsafeUtils.java @@ -188,7 +188,7 @@ public static short getShortFromBytes(final byte[] bytes, final long index) { return UNSAFE.getShort(bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET + index * Unsafe.ARRAY_BYTE_INDEX_SCALE); } - public static Unsafe initUnsafe() { + private static Unsafe initUnsafe() { try { // Fast path when we are trusted. return Unsafe.getUnsafe();