Skip to content

Commit

Permalink
Remove dummy infrastructure for object pinning
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Jun 10, 2020
1 parent 505bf4e commit a0c7310
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a0c7310

Please sign in to comment.