Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Rename UndefinedPlaceholder U as it causes very long filena…
…mes.
  • Loading branch information
chrisseaton committed Jan 19, 2015
1 parent 2d033dc commit 8b84e49
Show file tree
Hide file tree
Showing 24 changed files with 157 additions and 169 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Expand Up @@ -23,7 +23,7 @@
import org.jruby.truffle.nodes.yield.YieldDispatchNode;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.core.*;

import java.math.BigInteger;
Expand Down Expand Up @@ -174,8 +174,8 @@ public RubyEncoding executeRubyEncoding(VirtualFrame frame) throws UnexpectedRes
return RubyTypesGen.RUBYTYPES.expectRubyEncoding(execute(frame));
}

public UndefinedPlaceholder executeUndefinedPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectUndefinedPlaceholder(execute(frame));
public U executeUndefinedPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectU(execute(frame));
}

public RubyEncodingConverter executeRubyEncodingConverter(VirtualFrame frame) throws UnexpectedResultException {
Expand Down Expand Up @@ -285,7 +285,7 @@ public boolean isLexicalScope(Object value) {

@SuppressWarnings("static-method")
public boolean isUndefinedPlaceholder(Object value) {
return value instanceof UndefinedPlaceholder;
return value instanceof U;
}

@SuppressWarnings("static-method")
Expand Down
6 changes: 2 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Expand Up @@ -10,17 +10,15 @@
package org.jruby.truffle.nodes;

import com.oracle.truffle.api.dsl.TypeSystem;
import org.jruby.truffle.nodes.dispatch.DispatchAction;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.core.*;

/**
* The list of types and type conversions that the AST interpreter knows about and can specialise
* using. Used by the DSL.
*/
@TypeSystem({ //
UndefinedPlaceholder.class, //
U.class, //
boolean.class, //
byte.class, //
int.class, //
Expand Down
64 changes: 32 additions & 32 deletions core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Expand Up @@ -35,7 +35,7 @@
import org.jruby.truffle.nodes.core.ArrayNodesFactory.AtNodeFactory;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.control.BreakException;
import org.jruby.truffle.runtime.control.NextException;
import org.jruby.truffle.runtime.control.RaiseException;
Expand Down Expand Up @@ -654,7 +654,7 @@ public IndexNode(IndexNode prev) {
}

@Specialization
public Object index(RubyArray array, int index, UndefinedPlaceholder undefined) {
public Object index(RubyArray array, int index, U undefined) {
return atNode.executeAt(array, index);
}

Expand Down Expand Up @@ -715,7 +715,7 @@ public Object sliceObject(RubyArray array, int start, int length) {
}

@Specialization(guards = "isObject")
public Object sliceObject(RubyArray array, RubyRange.IntegerFixnumRange range, UndefinedPlaceholder undefined) {
public Object sliceObject(RubyArray array, RubyRange.IntegerFixnumRange range, U undefined) {
notDesignedForCompilation();

final int normalisedIndex = array.normaliseIndex(range.getBegin());
Expand Down Expand Up @@ -750,7 +750,7 @@ public IndexSetNode(IndexSetNode prev) {
}

@Specialization(guards = "isNull")
public Object setNullIntegerFixnum(RubyArray array, int index, int value, UndefinedPlaceholder unused) {
public Object setNullIntegerFixnum(RubyArray array, int index, int value, U unused) {
if (index == 0) {
array.setStore(new int[]{value}, 1);
} else {
Expand All @@ -762,7 +762,7 @@ public Object setNullIntegerFixnum(RubyArray array, int index, int value, Undefi
}

@Specialization(guards = "isNull")
public Object setNullLongFixnum(RubyArray array, int index, long value, UndefinedPlaceholder unused) {
public Object setNullLongFixnum(RubyArray array, int index, long value, U unused) {
if (index == 0) {
array.setStore(new long[]{value}, 1);
} else {
Expand All @@ -774,7 +774,7 @@ public Object setNullLongFixnum(RubyArray array, int index, long value, Undefine
}

@Specialization(guards = "isNull")
public Object setNullObject(RubyArray array, int index, Object value, UndefinedPlaceholder unused) {
public Object setNullObject(RubyArray array, int index, Object value, U unused) {
notDesignedForCompilation();

if (index == 0) {
Expand All @@ -787,7 +787,7 @@ public Object setNullObject(RubyArray array, int index, Object value, UndefinedP
}

@Specialization(guards = "isIntegerFixnum")
public int setIntegerFixnum(RubyArray array, int index, int value, UndefinedPlaceholder unused) {
public int setIntegerFixnum(RubyArray array, int index, int value, U unused) {
final int normalisedIndex = array.normaliseIndex(index);
int[] store = (int[]) array.getStore();

Expand Down Expand Up @@ -820,7 +820,7 @@ public int setIntegerFixnum(RubyArray array, int index, int value, UndefinedPlac
}

@Specialization(guards = "isIntegerFixnum")
public long setLongInIntegerFixnum(RubyArray array, int index, long value, UndefinedPlaceholder unused) {
public long setLongInIntegerFixnum(RubyArray array, int index, long value, U unused) {
if (array.getAllocationSite() != null) {
array.getAllocationSite().convertedIntToLong();
}
Expand Down Expand Up @@ -891,13 +891,13 @@ public RubyArray setIntegerFixnum(RubyArray array, int start, int length, RubyAr
}

@Specialization(guards = "isLongFixnum")
public int setLongFixnum(RubyArray array, int index, int value, UndefinedPlaceholder unused) {
public int setLongFixnum(RubyArray array, int index, int value, U unused) {
setLongFixnum(array, index, (long) value, unused);
return value;
}

@Specialization(guards = "isLongFixnum")
public long setLongFixnum(RubyArray array, int index, long value, UndefinedPlaceholder unused) {
public long setLongFixnum(RubyArray array, int index, long value, U unused) {
final int normalisedIndex = array.normaliseIndex(index);
long[] store = (long[]) array.getStore();

Expand Down Expand Up @@ -930,7 +930,7 @@ public long setLongFixnum(RubyArray array, int index, long value, UndefinedPlace
}

@Specialization(guards = "isFloat")
public double setFloat(RubyArray array, int index, double value, UndefinedPlaceholder unused) {
public double setFloat(RubyArray array, int index, double value, U unused) {
final int normalisedIndex = array.normaliseIndex(index);
double[] store = (double[]) array.getStore();

Expand Down Expand Up @@ -963,7 +963,7 @@ public double setFloat(RubyArray array, int index, double value, UndefinedPlaceh
}

@Specialization(guards = "isObject")
public Object setObject(RubyArray array, int index, Object value, UndefinedPlaceholder unused) {
public Object setObject(RubyArray array, int index, Object value, U unused) {
final int normalisedIndex = array.normaliseIndex(index);
Object[] store = (Object[]) array.getStore();

Expand Down Expand Up @@ -1008,14 +1008,14 @@ public Object setObject(RubyArray array, int start, int length, Object value) {

if (begin >= array.getSize()) {
// We don't care of length in this case
return setObject(array, start, value, UndefinedPlaceholder.INSTANCE);
return setObject(array, start, value, U.INSTANCE);
} else {
throw new UnsupportedOperationException();
}
}

@Specialization(guards = "isIntegerFixnum")
public RubyArray setIntegerFixnumRange(RubyArray array, RubyRange.IntegerFixnumRange range, RubyArray other, UndefinedPlaceholder unused) {
public RubyArray setIntegerFixnumRange(RubyArray array, RubyRange.IntegerFixnumRange range, RubyArray other, U unused) {
if (range.doesExcludeEnd()) {
CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException();
Expand Down Expand Up @@ -1898,52 +1898,52 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyArray initialize(RubyArray array, int size, UndefinedPlaceholder defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, int size, U defaultValue, U block) {
return initialize(array, size, getContext().getCoreLibrary().getNilObject(), block);
}

@Specialization
public RubyArray initialize(RubyArray array, long size, UndefinedPlaceholder defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, long size, U defaultValue, U block) {
if (size > Integer.MAX_VALUE) {
throw new IllegalStateException();
}
return initialize(array, (int) size, getContext().getCoreLibrary().getNilObject(), block);
}

@Specialization
public RubyArray initialize(RubyArray array, int size, int defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, int size, int defaultValue, U block) {
final int[] store = new int[size];
Arrays.fill(store, defaultValue);
array.setStore(store, size);
return array;
}

@Specialization
public RubyArray initialize(RubyArray array, int size, long defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, int size, long defaultValue, U block) {
final long[] store = new long[size];
Arrays.fill(store, defaultValue);
array.setStore(store, size);
return array;
}

@Specialization
public RubyArray initialize(RubyArray array, int size, double defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, int size, double defaultValue, U block) {
final double[] store = new double[size];
Arrays.fill(store, defaultValue);
array.setStore(store, size);
return array;
}

@Specialization
public RubyArray initialize(RubyArray array, int size, Object defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, int size, Object defaultValue, U block) {
final Object[] store = new Object[size];
Arrays.fill(store, defaultValue);
array.setStore(store, size);
return array;
}

@Specialization
public RubyArray initialize(VirtualFrame frame, RubyArray array, int size, UndefinedPlaceholder defaultValue, RubyProc block) {
public RubyArray initialize(VirtualFrame frame, RubyArray array, int size, U defaultValue, RubyProc block) {
Object store = arrayBuilder.start(size);

int count = 0;
Expand All @@ -1966,7 +1966,7 @@ public RubyArray initialize(VirtualFrame frame, RubyArray array, int size, Undef
}

@Specialization
public RubyArray initialize(RubyArray array, RubyArray copy, UndefinedPlaceholder defaultValue, UndefinedPlaceholder block) {
public RubyArray initialize(RubyArray array, RubyArray copy, U defaultValue, U block) {
notDesignedForCompilation();
array.setStore(copy.slowToArray(), copy.getSize());
return array;
Expand Down Expand Up @@ -2094,7 +2094,7 @@ public Object inject(VirtualFrame frame, RubyArray array, Object initial, RubyPr
}

@Specialization
public Object inject(VirtualFrame frame, RubyArray array, RubySymbol symbol, UndefinedPlaceholder unused) {
public Object inject(VirtualFrame frame, RubyArray array, RubySymbol symbol, U unused) {
notDesignedForCompilation();

final Object[] store = array.slowToArray();
Expand Down Expand Up @@ -2214,7 +2214,7 @@ public JoinNode(JoinNode prev) {
}

@Specialization
public RubyString join(RubyArray array, UndefinedPlaceholder unused) {
public RubyString join(RubyArray array, U unused) {
Object separator = getContext().getCoreLibrary().getGlobalVariablesObject().getInstanceVariable("$,");
if (separator == getContext().getCoreLibrary().getNilObject()) {
separator = getContext().makeString("");
Expand Down Expand Up @@ -3434,15 +3434,15 @@ public SortNode(SortNode prev) {
}

@Specialization(guards = "isNull")
public RubyArray sortNull(RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortNull(RubyArray array, U block) {
notDesignedForCompilation();

return new RubyArray(getContext().getCoreLibrary().getArrayClass());
}

@ExplodeLoop
@Specialization(guards = {"isIntegerFixnum", "isSmall"})
public RubyArray sortVeryShortIntegerFixnum(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortVeryShortIntegerFixnum(VirtualFrame frame, RubyArray array, U block) {
final int[] store = (int[]) array.getStore();

final int size = array.getSize();
Expand All @@ -3467,7 +3467,7 @@ public RubyArray sortVeryShortIntegerFixnum(VirtualFrame frame, RubyArray array,
}

@Specialization(guards = "isIntegerFixnum")
public RubyArray sortIntegerFixnum(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortIntegerFixnum(VirtualFrame frame, RubyArray array, U block) {
notDesignedForCompilation();

final Object[] boxed = ArrayUtils.box((int[]) array.getStore());
Expand All @@ -3478,7 +3478,7 @@ public RubyArray sortIntegerFixnum(VirtualFrame frame, RubyArray array, Undefine

@ExplodeLoop
@Specialization(guards = {"isLongFixnum", "isSmall"})
public RubyArray sortVeryShortLongFixnum(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortVeryShortLongFixnum(VirtualFrame frame, RubyArray array, U block) {
final long[] store = (long[]) array.getStore();

final int size = array.getSize();
Expand All @@ -3503,7 +3503,7 @@ public RubyArray sortVeryShortLongFixnum(VirtualFrame frame, RubyArray array, Un
}

@Specialization(guards = "isLongFixnum")
public RubyArray sortLongFixnum(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortLongFixnum(VirtualFrame frame, RubyArray array, U block) {
notDesignedForCompilation();

final Object[] boxed = ArrayUtils.box((long[]) array.getStore());
Expand All @@ -3513,7 +3513,7 @@ public RubyArray sortLongFixnum(VirtualFrame frame, RubyArray array, UndefinedPl
}

@Specialization(guards = "isFloat")
public RubyArray sortDouble(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortDouble(VirtualFrame frame, RubyArray array, U block) {
notDesignedForCompilation();

final Object[] boxed = ArrayUtils.box((double[]) array.getStore());
Expand All @@ -3523,7 +3523,7 @@ public RubyArray sortDouble(VirtualFrame frame, RubyArray array, UndefinedPlaceh
}

@Specialization(guards = {"isObject", "isSmall"})
public RubyArray sortVeryShortObject(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortVeryShortObject(VirtualFrame frame, RubyArray array, U block) {
final Object[] store = (Object[]) array.getStore();

// Insertion sort
Expand All @@ -3545,7 +3545,7 @@ public RubyArray sortVeryShortObject(VirtualFrame frame, RubyArray array, Undefi
}

@Specialization(guards = "isObject")
public RubyArray sortObject(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
public RubyArray sortObject(VirtualFrame frame, RubyArray array, U block) {
notDesignedForCompilation();

final Object[] store = Arrays.copyOf((Object[]) array.getStore(), array.getSize());
Expand Down
Expand Up @@ -24,7 +24,7 @@
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.ObjectIDOperations;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.util.ArrayUtils;
Expand Down Expand Up @@ -232,14 +232,14 @@ public InstanceEvalNode(InstanceEvalNode prev) {
}

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, UndefinedPlaceholder block) {
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, U block) {
notDesignedForCompilation();

return getContext().eval(string.getBytes(), receiver, this);
}

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, UndefinedPlaceholder string, RubyProc block) {
public Object instanceEval(VirtualFrame frame, Object receiver, U string, RubyProc block) {
notDesignedForCompilation();

return yield.dispatchWithModifiedSelf(frame, block, receiver);
Expand All @@ -259,7 +259,7 @@ public MethodMissingNode(MethodMissingNode prev) {
}

@Specialization
public Object methodMissing(Object self, Object[] args, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public Object methodMissing(Object self, Object[] args, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

return methodMissing(self, args, (RubyProc) null);
Expand Down Expand Up @@ -325,7 +325,7 @@ public SendNode(SendNode prev) {
}

@Specialization
public Object send(VirtualFrame frame, Object self, Object[] args, UndefinedPlaceholder block) {
public Object send(VirtualFrame frame, Object self, Object[] args, U block) {
return send(frame, self, args, (RubyProc) null);
}

Expand Down

0 comments on commit 8b84e49

Please sign in to comment.