From a0c73106e6802f9af5dfe508f1271f86791db4dc Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 10 Jun 2020 09:31:35 +0200 Subject: [PATCH] Remove dummy infrastructure for object pinning #102 --- .../image/SqueakImageConstants.java | 4 +- .../model/AbstractSqueakObjectWithHash.java | 14 ------- .../impl/MiscellaneousPrimitives.java | 41 ------------------- 3 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakImageConstants.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakImageConstants.java index 7494caefe..4e927a80f 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakImageConstants.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/image/SqueakImageConstants.java @@ -5,7 +5,6 @@ */ package de.hpi.swa.trufflesqueak.image; -import de.hpi.swa.trufflesqueak.model.AbstractSqueakObjectWithHash; import de.hpi.swa.trufflesqueak.util.MiscUtils; public final class SqueakImageConstants { @@ -95,6 +94,7 @@ public static final class ObjectHeader { private static final int NUM_SLOTS_SIZE = 1 << 8; private static final int HASH_AND_CLASS_INDEX_SIZE = 1 << 22; private static final int FORMAT_SIZE = 1 << 5; + private static final int PINNED_BIT_SHIFT = 30; public static int getClassIndex(final long headerWord) { return MiscUtils.bitSplit(headerWord, 0, HASH_AND_CLASS_INDEX_SIZE); @@ -113,7 +113,7 @@ public static int getNumSlots(final long headerWord) { } public static boolean isPinned(final long headerWord) { - return (headerWord >> AbstractSqueakObjectWithHash.PINNED_BIT_SHIFT & 1) == 1; + return (headerWord >> PINNED_BIT_SHIFT & 1) == 1; } public static long getHeader(final long numSlots, final long identityHash, final long format, final long classIndex) { diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/AbstractSqueakObjectWithHash.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/AbstractSqueakObjectWithHash.java index 891467de2..0b82c9fed 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/AbstractSqueakObjectWithHash.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/AbstractSqueakObjectWithHash.java @@ -18,8 +18,6 @@ public abstract class AbstractSqueakObjectWithHash extends AbstractSqueakObject public static final int IDENTITY_HASH_MASK = 0x400000 - 1; /* Generate new hash if hash is 0 (see SpurMemoryManager>>#hashBitsOf:). */ public static final long HASH_UNINITIALIZED = 0; - public static final int PINNED_BIT_SHIFT = 30; - private static final int PINNED_BIT_MASK = 1 << PINNED_BIT_SHIFT; public final SqueakImageContext image; private long squeakHash; @@ -83,26 +81,14 @@ public final boolean needsSqueakHash() { return squeakHash == HASH_UNINITIALIZED; } - public final boolean isPinned() { - return (squeakHash >> PINNED_BIT_SHIFT & 1) == 1; - } - public String getClassName() { return "???NotAClass"; } - public final void setPinned() { - setSqueakHash(getSqueakHash() | PINNED_BIT_MASK); - } - public final void setSqueakHash(final long newHash) { squeakHash = newHash; } - public final void unsetPinned() { - setSqueakHash(getSqueakHash() & ~PINNED_BIT_MASK); - } - public final boolean getMarkingFlag() { return markingFlag; } diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/MiscellaneousPrimitives.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/MiscellaneousPrimitives.java index 32c2bd103..d2d3d2f10 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/MiscellaneousPrimitives.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/primitives/impl/MiscellaneousPrimitives.java @@ -790,47 +790,6 @@ protected static final ArrayObject doNil(@SuppressWarnings("unused") final Class } } - @GenerateNodeFactory - @SqueakPrimitive(indices = 183) - protected abstract static class PrimIsPinnedNode extends AbstractPrimitiveNode implements UnaryPrimitive { - - @Specialization - protected static final boolean isPinned(final AbstractSqueakObjectWithClassAndHash receiver, - @CachedContext(SqueakLanguage.class) final SqueakImageContext image) { - PrimPinNode.printWarningIfNotTesting(image); - return BooleanObject.wrap(receiver.isPinned()); - } - } - - @GenerateNodeFactory - @SqueakPrimitive(indices = 184) - protected abstract static class PrimPinNode extends AbstractPrimitiveNode implements BinaryPrimitive { - - @Specialization(guards = "enable") - protected static final boolean doPinEnable(final AbstractSqueakObjectWithClassAndHash receiver, @SuppressWarnings("unused") final boolean enable, - @CachedContext(SqueakLanguage.class) final SqueakImageContext image) { - printWarningIfNotTesting(image); - final boolean wasPinned = receiver.isPinned(); - receiver.setPinned(); - return BooleanObject.wrap(wasPinned); - } - - @Specialization(guards = "!enable") - protected static final boolean doPinDisable(final AbstractSqueakObjectWithClassAndHash receiver, @SuppressWarnings("unused") final boolean enable, - @CachedContext(SqueakLanguage.class) final SqueakImageContext image) { - printWarningIfNotTesting(image); - final boolean wasPinned = receiver.isPinned(); - receiver.unsetPinned(); - return BooleanObject.wrap(wasPinned); - } - - private static void printWarningIfNotTesting(final SqueakImageContext image) { - if (!image.isTesting()) { - image.printToStdErr("Object pinning is not supported by this vm, but requested from Squeak/Smalltalk."); - } - } - } - @GenerateNodeFactory @SqueakPrimitive(indices = 240) protected abstract static class PrimUTCClockNode extends AbstractPrimitiveNode implements UnaryPrimitiveWithoutFallback {