Skip to content

Commit

Permalink
[Truffle] Remove more notDesigneds.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed May 7, 2015
1 parent a5b4813 commit af42d09
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public InitializeNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public RubyNilClass initialize(RubyEncodingConverter self, Object source, Object destination, Object options) {
notDesignedForCompilation();

// Adapted from RubyConverter - see attribution there

Ruby runtime = getContext().getRuntime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ public void initialize() {
}

private void initializeGlobalVariables() {
RubyNode.notDesignedForCompilation();

RubyBasicObject globals = globalVariablesObject;

globals.getObjectType().setInstanceVariable(globals, "$LOAD_PATH", new RubyArray(arrayClass));
Expand Down Expand Up @@ -420,8 +418,6 @@ private void initializeConstants() {
}

private void initializeSignalConstants() {
RubyNode.notDesignedForCompilation();

Object[] signals = new Object[SignalOperations.SIGNALS_LIST.size()];

int i = 0;
Expand Down Expand Up @@ -576,8 +572,6 @@ public void defineConstant(int encodingListIndex, String constName) {
}

public RubyClass getMetaClass(Object object) {
RubyNode.notDesignedForCompilation();

if (object instanceof RubyBasicObject) {
return ((RubyBasicObject) object).getMetaClass();
} else if (object instanceof Boolean) {
Expand All @@ -601,8 +595,6 @@ public RubyClass getMetaClass(Object object) {
}

public RubyClass getLogicalClass(Object object) {
RubyNode.notDesignedForCompilation();

if (object instanceof RubyBasicObject) {
return ((RubyBasicObject) object).getLogicalClass();
} else if (object instanceof Boolean) {
Expand All @@ -629,8 +621,6 @@ public RubyClass getLogicalClass(Object object) {
* Convert a value to a {@code Float}, without doing any lookup.
*/
public static double toDouble(Object value) {
RubyNode.notDesignedForCompilation();

assert value != null;

if (value instanceof RubyNilClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public RubyArray(RubyClass arrayClass, ArrayAllocationSite allocationSite, Objec
}

public static RubyArray fromObject(RubyClass arrayClass, Object object) {
RubyNode.notDesignedForCompilation();

final Object store;

if (object instanceof Integer) {
Expand All @@ -75,8 +73,6 @@ public static RubyArray fromObjects(RubyClass arrayClass, Object... objects) {
}

private static Object storeFromObjects(Object... objects) {
RubyNode.notDesignedForCompilation();

if (objects.length == 0) {
return null;
}
Expand Down Expand Up @@ -145,8 +141,6 @@ private static Object storeFromObjects(Object... objects) {
}

public Object[] slowToArray() {
RubyNode.notDesignedForCompilation();

return Arrays.copyOf(ArrayUtils.box(store), size);
}

Expand All @@ -165,17 +159,13 @@ public Object slowShift() {
}

public void slowUnshift(Object... values) {
RubyNode.notDesignedForCompilation();

final Object[] newStore = new Object[size + values.length];
System.arraycopy(values, 0, newStore, 0, values.length);
ArrayUtils.copy(store, newStore, values.length, size);
setStore(newStore, newStore.length);
}

public void slowPush(Object value) {
RubyNode.notDesignedForCompilation();

store = Arrays.copyOf(ArrayUtils.box(store), size + 1);
((Object[]) store)[size] = value;
size++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,7 @@ public long verySlowGetObjectID() {
return objectID;
}

@CompilerDirectives.TruffleBoundary
public void setInstanceVariables(Map<Object, Object> instanceVariables) {
RubyNode.notDesignedForCompilation();

assert instanceVariables != null;

getObjectType().setInstanceVariables(this, instanceVariables);
}


public Map<Object, Object> getInstanceVariables() {
RubyNode.notDesignedForCompilation();

return getObjectType().getInstanceVariables(this);
}

public Object[] getFieldNames() {
return getObjectType().getFieldNames(this);
}

public Object getInstanceVariable(String name) {
RubyNode.notDesignedForCompilation();

final Object value = getObjectType().getInstanceVariable(this, name);

if (value == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public void initialize(RubyClass superclass) {
* used.
*/
protected void unsafeSetSuperclass(RubyClass superClass) {
RubyNode.notDesignedForCompilation();

assert parentModule == null;

parentModule = superClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ private RubyFiber(RubyThread parent, FiberManager fiberManager, ThreadManager th
}

public void initialize(final RubyProc block) {
RubyNode.notDesignedForCompilation();

name = "Ruby Fiber@" + block.getSharedMethodInfo().getSourceSection().getShortDescription();
final Thread thread = new Thread(new Runnable() {
@Override
Expand Down Expand Up @@ -146,8 +144,6 @@ public void run() {
}

protected void run(final Runnable task) {
RubyNode.notDesignedForCompilation();

start();
try {
task.run();
Expand Down Expand Up @@ -190,8 +186,6 @@ private void sendMessageTo(RubyFiber fiber, FiberMessage message) {
* message.
*/
private Object[] waitForResume() {
RubyNode.notDesignedForCompilation();

final FiberMessage message = getContext().getThreadManager().runUntilResult(new BlockingActionWithoutGlobalLock<FiberMessage>() {
@Override
public FiberMessage block() throws InterruptedException {
Expand Down Expand Up @@ -223,8 +217,6 @@ public FiberMessage block() throws InterruptedException {
* received.
*/
private void resume(RubyFiber fiber, boolean yield, Object... args) {
RubyNode.notDesignedForCompilation();

sendMessageTo(fiber, new FiberResumeMessage(yield, this, args));
}

Expand All @@ -236,8 +228,6 @@ public Object[] transferControlTo(RubyFiber fiber, boolean yield, Object[] args)

public void shutdown() {
assert !isRootFiber;
RubyNode.notDesignedForCompilation();

sendMessageTo(this, new FiberExitMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public RubyMatchData(RubyClass rubyClass, RubyString source, Regex regex, Region
}

public Object[] valuesAt(int... indices) {
RubyNode.notDesignedForCompilation();

final Object[] result = new Object[indices.length];

for (int n = 0; n < indices.length; n++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ public void getAdoptedByLexicalParent(RubyModule lexicalParent, String name, Nod
}

private void updateAnonymousChildrenModules() {
RubyNode.notDesignedForCompilation();

for (Entry<String, RubyConstant> entry : constants.entrySet()) {
RubyConstant constant = entry.getValue();
if (constant.getValue() instanceof RubyModule) {
Expand Down Expand Up @@ -170,8 +168,6 @@ public boolean isOnlyAModule() {

@TruffleBoundary
public void include(Node currentNode, RubyModule module) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);

// We need to traverse the module chain in reverse order
Expand Down Expand Up @@ -214,8 +210,6 @@ public void setAutoloadConstant(Node currentNode, String name, RubyString filena
}

private void setConstantInternal(Node currentNode, String name, Object value, boolean autoload) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);

RubyConstant previous = constants.get(name);
Expand All @@ -232,8 +226,6 @@ private void setConstantInternal(Node currentNode, String name, Object value, bo

@TruffleBoundary
public RubyConstant removeConstant(Node currentNode, String name) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);
RubyConstant oldConstant = constants.remove(name);
newLexicalVersion();
Expand All @@ -242,26 +234,20 @@ public RubyConstant removeConstant(Node currentNode, String name) {

@TruffleBoundary
public void setClassVariable(Node currentNode, String variableName, Object value) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);

classVariables.put(variableName, value);
}

@TruffleBoundary
public void removeClassVariable(Node currentNode, String variableName) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);

classVariables.remove(variableName);
}

@TruffleBoundary
public void addMethod(Node currentNode, InternalMethod method) {
RubyNode.notDesignedForCompilation();

assert method != null;

if (getContext().getCoreLibrary().isLoadingRubyCore()) {
Expand All @@ -283,8 +269,6 @@ public void addMethod(Node currentNode, InternalMethod method) {

@TruffleBoundary
public void removeMethod(Node currentNode, String methodName) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);

methods.remove(methodName);
Expand All @@ -293,7 +277,6 @@ public void removeMethod(Node currentNode, String methodName) {

@TruffleBoundary
public void undefMethod(Node currentNode, String methodName) {
RubyNode.notDesignedForCompilation();
final InternalMethod method = ModuleOperations.lookupMethod(this, methodName);
if (method == null) {
throw new UnsupportedOperationException();
Expand All @@ -304,7 +287,6 @@ public void undefMethod(Node currentNode, String methodName) {

@TruffleBoundary
public void undefMethod(Node currentNode, InternalMethod method) {
RubyNode.notDesignedForCompilation();
addMethod(currentNode, method.undefined());
}

Expand Down Expand Up @@ -333,8 +315,6 @@ public InternalMethod deepMethodSearch(String name) {

@TruffleBoundary
public void alias(Node currentNode, String newName, String oldName) {
RubyNode.notDesignedForCompilation();

InternalMethod method = deepMethodSearch(oldName);

if (method == null) {
Expand All @@ -347,8 +327,6 @@ public void alias(Node currentNode, String newName, String oldName) {

@TruffleBoundary
public void changeConstantVisibility(Node currentNode, String name, boolean isPrivate) {
RubyNode.notDesignedForCompilation();

checkFrozen(currentNode);
RubyConstant rubyConstant = constants.get(name);

Expand All @@ -362,8 +340,6 @@ public void changeConstantVisibility(Node currentNode, String name, boolean isPr

@TruffleBoundary
public void appendFeatures(Node currentNode, RubyModule other) {
RubyNode.notDesignedForCompilation();

// TODO(CS): check only run once
other.include(currentNode, this);
}
Expand All @@ -390,14 +366,10 @@ public String toString() {
}

public void newVersion() {
RubyNode.notDesignedForCompilation();

newVersion(new HashSet<RubyModule>(), false);
}

public void newLexicalVersion() {
RubyNode.notDesignedForCompilation();

newVersion(new HashSet<RubyModule>(), true);
}

Expand All @@ -421,21 +393,15 @@ private void newVersion(Set<RubyModule> alreadyInvalidated, boolean considerLexi
}

public void addDependent(RubyModule dependent) {
RubyNode.notDesignedForCompilation();

dependents.add(dependent);
}

public void addLexicalDependent(RubyModule lexicalChild) {
RubyNode.notDesignedForCompilation();

if (lexicalChild != this)
lexicalDependents.add(lexicalChild);
}

public Assumption getUnmodifiedAssumption() {
RubyNode.notDesignedForCompilation();

return unmodifiedAssumption.getAssumption();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ public CallTarget getCallTargetForType() {
}

public Object rootCall(Object... args) {
RubyNode.notDesignedForCompilation();

// TODO(CS): handle exceptions in here?

return getCallTargetForType().call(RubyArguments.pack(getMethod(), declarationFrame, self, block, args));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ private void setFrame(Frame frame, String name, Object value) {
public void setThread(String name, Object value) {
assert value != null;

RubyNode.notDesignedForCompilation();
getContext().getThreadManager().getCurrentThread().getThreadLocals().getObjectType().setInstanceVariable(getContext().getThreadManager().getCurrentThread().getThreadLocals(), name, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public void forceEncoding(Encoding encoding) {
@Override
@TruffleBoundary
public String toString() {
RubyNode.notDesignedForCompilation();

return Helpers.decodeByteList(getContext().getRuntime(), bytes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public static RubySymbol newSymbol(RubyContext runtime, String name) {
public RubyProc toProc(SourceSection sourceSection, final Node currentNode) {
// TODO(CS): cache this?

RubyNode.notDesignedForCompilation();

final RubyContext context = getContext();

final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo(sourceSection, null, Arity.NO_ARGUMENTS, symbol, true, null, false);
Expand All @@ -72,8 +70,6 @@ public ByteList getSymbolBytes() {
}

public org.jruby.RubySymbol getJRubySymbol() {
RubyNode.notDesignedForCompilation();

return getContext().getRuntime().newSymbol(bytes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ public void acquiredLock(Lock lock) {
}

public void releasedLock(Lock lock) {
RubyNode.notDesignedForCompilation();

// TODO: this is O(ownedLocks.length).
ownedLocks.remove(lock);
}
Expand Down

0 comments on commit af42d09

Please sign in to comment.