Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] Rename UndefinedPlaceholder U as it causes very long filena…
Browse files Browse the repository at this point in the history
…mes.
chrisseaton committed Jan 19, 2015
1 parent 2d033dc commit 8b84e49
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
Original file line number Diff line number Diff line change
@@ -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;
@@ -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 {
@@ -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")
6 changes: 2 additions & 4 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -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, //
64 changes: 32 additions & 32 deletions core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -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;
@@ -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);
}

@@ -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());
@@ -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 {
@@ -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 {
@@ -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) {
@@ -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();

@@ -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();
}
@@ -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();

@@ -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();

@@ -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();

@@ -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();
@@ -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;
@@ -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;
@@ -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();
@@ -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("");
@@ -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();
@@ -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());
@@ -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();
@@ -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());
@@ -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());
@@ -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
@@ -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());
Original file line number Diff line number Diff line change
@@ -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;
@@ -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);
@@ -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);
@@ -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);
}

11 changes: 5 additions & 6 deletions core/src/main/java/org/jruby/truffle/nodes/core/ClassNodes.java
Original file line number Diff line number Diff line change
@@ -16,10 +16,9 @@
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
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.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyClass;
@@ -74,7 +73,7 @@ public NewNode(NewNode prev) {
}

@Specialization
public RubyBasicObject newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public RubyBasicObject newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, @SuppressWarnings("unused") U block) {
return doNewInstance(frame, rubyClass, args, null);
}

@@ -112,18 +111,18 @@ void moduleInitialize(VirtualFrame frame, RubyClass rubyClass, RubyProc block) {
}

@Specialization
public RubyClass initialize(RubyClass rubyClass, UndefinedPlaceholder superclass, UndefinedPlaceholder block) {
public RubyClass initialize(RubyClass rubyClass, U superclass, U block) {
return initialize(rubyClass, getContext().getCoreLibrary().getObjectClass(), block);
}

@Specialization
public RubyClass initialize(RubyClass rubyClass, RubyClass superclass, UndefinedPlaceholder block) {
public RubyClass initialize(RubyClass rubyClass, RubyClass superclass, U block) {
rubyClass.initialize(superclass);
return rubyClass;
}

@Specialization
public RubyClass initialize(VirtualFrame frame, RubyClass rubyClass, UndefinedPlaceholder superclass, RubyProc block) {
public RubyClass initialize(VirtualFrame frame, RubyClass rubyClass, U superclass, RubyProc block) {
return initialize(frame, rubyClass, getContext().getCoreLibrary().getObjectClass(), block);
}

Original file line number Diff line number Diff line change
@@ -168,7 +168,7 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails
}

if (methodDetails.getMethodAnnotation().needsBlock()) {
argumentsNodes.add(new ReadBlockNode(context, sourceSection, UndefinedPlaceholder.INSTANCE));
argumentsNodes.add(new ReadBlockNode(context, sourceSection, U.INSTANCE));
}

RubyNode methodNode = null;
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.runtime.RubyCallStack;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyException;
import org.jruby.truffle.runtime.core.RubyNilClass;
@@ -34,7 +34,7 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyNilClass initialize(RubyException exception, UndefinedPlaceholder message) {
public RubyNilClass initialize(RubyException exception, U message) {
notDesignedForCompilation();

exception.initialize(getContext().makeString(" "), RubyCallStack.getBacktrace(this));
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import com.oracle.truffle.api.source.SourceSection;
import jnr.posix.FileStat;
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 org.jruby.util.ByteList;

@@ -232,7 +232,7 @@ public ExpandPathNode(ExpandPathNode prev) {
}

@Specialization
public RubyString expandPath(RubyString path, @SuppressWarnings("unused") UndefinedPlaceholder dir) {
public RubyString expandPath(RubyString path, @SuppressWarnings("unused") U dir) {
return getContext().makeString(RubyFile.expandPath(path.toString()));
}

Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import org.jruby.truffle.nodes.RubyNode;
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.CoreLibrary;
import org.jruby.truffle.runtime.core.RubyBasicObject;
@@ -70,7 +70,7 @@ public Object execute(VirtualFrame frame) {
}
}

if (hasSeenUndefined && value instanceof UndefinedPlaceholder) {
if (hasSeenUndefined && value instanceof U) {
return value;
}

@@ -104,7 +104,7 @@ public Object execute(VirtualFrame frame) {
}
}

if (value instanceof UndefinedPlaceholder) {
if (value instanceof U) {
hasSeenUndefined = true;
return value;
}
@@ -179,7 +179,7 @@ public RubyRange.LongFixnumRange executeLongFixnumRange(VirtualFrame frame) thro
}

@Override
public UndefinedPlaceholder executeUndefinedPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
public U executeUndefinedPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
try {
return super.executeUndefinedPlaceholder(frame);
} catch (UnexpectedResultException e) {
Original file line number Diff line number Diff line change
@@ -19,11 +19,10 @@
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.nodes.methods.UnsupportedOperationBehavior;
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.RubyArray;
import org.jruby.truffle.runtime.core.RubyBasicObject;
@@ -1621,13 +1620,13 @@ public ToSNode(ToSNode prev) {

@CompilerDirectives.TruffleBoundary
@Specialization
public RubyString toS(int n, UndefinedPlaceholder undefined) {
public RubyString toS(int n, U undefined) {
return getContext().makeString(Integer.toString(n));
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubyString toS(long n, UndefinedPlaceholder undefined) {
public RubyString toS(long n, U undefined) {
return getContext().makeString(Long.toString(n));
}

10 changes: 5 additions & 5 deletions core/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.DebugOperations;
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 org.jruby.truffle.runtime.hash.Entry;
import org.jruby.truffle.runtime.hash.HashOperations;
@@ -606,23 +606,23 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyNilClass initialize(RubyHash hash, UndefinedPlaceholder defaultValue, UndefinedPlaceholder block) {
public RubyNilClass initialize(RubyHash hash, U defaultValue, U block) {
notDesignedForCompilation();
hash.setStore(null, 0, null, null);
hash.setDefaultBlock(null);
return getContext().getCoreLibrary().getNilObject();
}

@Specialization
public RubyNilClass initialize(RubyHash hash, UndefinedPlaceholder defaultValue, RubyProc block) {
public RubyNilClass initialize(RubyHash hash, U defaultValue, RubyProc block) {
notDesignedForCompilation();
hash.setStore(null, 0, null, null);
hash.setDefaultBlock(block);
return getContext().getCoreLibrary().getNilObject();
}

@Specialization
public RubyNilClass initialize(RubyHash hash, Object defaultValue, UndefinedPlaceholder block) {
public RubyNilClass initialize(RubyHash hash, Object defaultValue, U block) {
notDesignedForCompilation();
hash.setDefaultValue(defaultValue);
return getContext().getCoreLibrary().getNilObject();
@@ -1044,7 +1044,7 @@ public DefaultNode(DefaultNode prev) {
}

@Specialization
public Object defaultElement(VirtualFrame frame, RubyHash hash, UndefinedPlaceholder undefined) {
public Object defaultElement(VirtualFrame frame, RubyHash hash, U undefined) {
Object ret = hash.getDefaultValue();

// TODO (nirvdrum Dec. 1, 2014): This needs to evaluate the defaultProc if it exists before it tries defaultValue.
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.BranchProfile;
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.RedoException;
@@ -92,7 +92,7 @@ public TimesNode(TimesNode prev) {
}

@Specialization
public RubyArray times(VirtualFrame frame, int n, UndefinedPlaceholder block) {
public RubyArray times(VirtualFrame frame, int n, U block) {
notDesignedForCompilation();

final int[] array = new int[n];
52 changes: 26 additions & 26 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -355,7 +355,7 @@ public CallerNode(CallerNode prev) {
}

@Specialization
public Object caller(UndefinedPlaceholder omit) {
public Object caller(U omit) {
return caller(1);
}

@@ -561,21 +561,21 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
}

@Specialization
public Object eval(VirtualFrame frame, RubyString source, UndefinedPlaceholder binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
public Object eval(VirtualFrame frame, RubyString source, U binding, U filename, U lineNumber) {
notDesignedForCompilation();

return eval(source, getCallerBinding(frame), filename, lineNumber);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
public Object eval(RubyString source, RubyBinding binding, U filename, U lineNumber) {
notDesignedForCompilation();

return getContext().eval(source.getBytes(), binding, this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, UndefinedPlaceholder lineNumber) {
public Object eval(RubyString source, RubyBinding binding, RubyString filename, U lineNumber) {
notDesignedForCompilation();

// TODO (nirvdrum Dec. 29, 2014) Do something with the supplied filename.
@@ -591,14 +591,14 @@ public Object eval(RubyString source, RubyBinding binding, RubyString filename,
}

@Specialization(guards = "!isRubyString(arguments[0])")
public Object eval(VirtualFrame frame, RubyBasicObject object, UndefinedPlaceholder binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
public Object eval(VirtualFrame frame, RubyBasicObject object, U binding, U filename, U lineNumber) {
notDesignedForCompilation();

return eval(frame, object, getCallerBinding(frame), filename, lineNumber);
}

@Specialization(guards = "!isRubyString(arguments[0])")
public Object eval(VirtualFrame frame, RubyBasicObject object, RubyBinding binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
public Object eval(VirtualFrame frame, RubyBasicObject object, RubyBinding binding, U filename, U lineNumber) {
notDesignedForCompilation();

Object coerced;
@@ -630,7 +630,7 @@ public Object eval(VirtualFrame frame, RubyBasicObject object, RubyBinding bindi
}

@Specialization(guards = "!isRubyBinding(arguments[1])")
public Object eval(RubyBasicObject source, RubyBasicObject badBinding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
public Object eval(RubyBasicObject source, RubyBasicObject badBinding, U filename, U lineNumber) {
throw new RaiseException(
getContext().getCoreLibrary().typeError(
String.format("wrong argument type %s (expected binding)",
@@ -713,7 +713,7 @@ public ExitNode(ExitNode prev) {
}

@Specialization
public Object exit(UndefinedPlaceholder exitCode) {
public Object exit(U exitCode) {
notDesignedForCompilation();

getContext().shutdown();
@@ -744,7 +744,7 @@ public ExitBangNode(ExitBangNode prev) {
}

@Specialization
public RubyNilClass exit(UndefinedPlaceholder exitCode) {
public RubyNilClass exit(U exitCode) {
return exit(1);
}

@@ -1361,7 +1361,7 @@ public MethodsNode(MethodsNode prev) {
}

@Specialization
public RubyArray methods(RubyBasicObject self, UndefinedPlaceholder unused) {
public RubyArray methods(RubyBasicObject self, U unused) {
return methods(self, true);
}

@@ -1479,7 +1479,7 @@ public PrivateMethodsNode(PrivateMethodsNode prev) {
}

@Specialization
public RubyArray private_methods(RubyBasicObject self, UndefinedPlaceholder unused) {
public RubyArray private_methods(RubyBasicObject self, U unused) {
return private_methods(self, true);
}

@@ -1549,11 +1549,11 @@ public RubyArray methods(RubyBasicObject self, boolean includeInherited) {
getContext().getRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getSource().getName(), Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getStartLine(), "Object#methods always returns inherited methods at the moment");
}

return methods(self, UndefinedPlaceholder.INSTANCE);
return methods(self, U.INSTANCE);
}

@Specialization
public RubyArray methods(RubyBasicObject self, UndefinedPlaceholder includeInherited) {
public RubyArray methods(RubyBasicObject self, U includeInherited) {
notDesignedForCompilation();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());
@@ -1587,21 +1587,21 @@ public RaiseNode(RaiseNode prev) {
}

@Specialization
public Object raise(VirtualFrame frame, UndefinedPlaceholder undefined1, UndefinedPlaceholder undefined2, Object undefined3) {
public Object raise(VirtualFrame frame, U undefined1, U undefined2, Object undefined3) {
notDesignedForCompilation();

return raise(frame, getContext().getCoreLibrary().getRuntimeErrorClass(), getContext().makeString("re-raised - don't have the current exception yet!"), undefined1);
}

@Specialization
public Object raise(VirtualFrame frame, RubyString message, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(VirtualFrame frame, RubyString message, U undefined1, Object undefined2) {
notDesignedForCompilation();

return raise(frame, getContext().getCoreLibrary().getRuntimeErrorClass(), message, undefined1);
}

@Specialization
public Object raise(VirtualFrame frame, RubyClass exceptionClass, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(VirtualFrame frame, RubyClass exceptionClass, U undefined1, Object undefined2) {
notDesignedForCompilation();

return raise(frame, exceptionClass, getContext().makeString(""), undefined1);
@@ -1623,7 +1623,7 @@ public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString mes
}

@Specialization
public Object raise(RubyException exception, UndefinedPlaceholder undefined1, Object undefined2) {
public Object raise(RubyException exception, U undefined1, Object undefined2) {
throw new RaiseException(exception);
}

@@ -1641,7 +1641,7 @@ public RandNode(RandNode prev) {
}

@Specialization
public double rand(UndefinedPlaceholder undefined) {
public double rand(U undefined) {
return getContext().getRandom().nextDouble();
}

@@ -1745,7 +1745,7 @@ public RespondToNode(RespondToNode prev) {
public abstract boolean executeDoesRespondTo(VirtualFrame frame, Object object, Object name, boolean includePrivate);

@Specialization
public boolean doesRespondTo(VirtualFrame frame, Object object, RubyString name, UndefinedPlaceholder checkVisibility) {
public boolean doesRespondTo(VirtualFrame frame, Object object, RubyString name, U checkVisibility) {
return dispatch.doesRespondTo(frame, name, object);
}

@@ -1759,7 +1759,7 @@ public boolean doesRespondTo(VirtualFrame frame, Object object, RubyString name,
}

@Specialization
public boolean doesRespondTo(VirtualFrame frame, Object object, RubySymbol name, UndefinedPlaceholder checkVisibility) {
public boolean doesRespondTo(VirtualFrame frame, Object object, RubySymbol name, U checkVisibility) {
return dispatch.doesRespondTo(frame, name, object);
}

@@ -1785,12 +1785,12 @@ public RespondToMissingNode(RespondToMissingNode prev) {
}

@Specialization
public boolean doesRespondToMissing(Object object, RubyString name, UndefinedPlaceholder includeAll) {
public boolean doesRespondToMissing(Object object, RubyString name, U includeAll) {
return false;
}

@Specialization
public boolean doesRespondToMissing(Object object, RubySymbol name, UndefinedPlaceholder includeAll) {
public boolean doesRespondToMissing(Object object, RubySymbol name, U includeAll) {
return false;
}

@@ -1902,7 +1902,7 @@ public RubyArray singletonMethods(RubyBasicObject self, boolean includeInherited
}

@Specialization
public RubyArray singletonMethods(RubyBasicObject self, UndefinedPlaceholder includeInherited) {
public RubyArray singletonMethods(RubyBasicObject self, U includeInherited) {
return singletonMethods(self, false);
}

@@ -1947,7 +1947,7 @@ public SleepNode(SleepNode prev) {
}

@Specialization
public double sleep(UndefinedPlaceholder duration) {
public double sleep(U duration) {
return doSleep(0);
}

@@ -2177,7 +2177,7 @@ public ThrowNode(ThrowNode prev) {
}

@Specialization
public Object doThrow(Object tag, UndefinedPlaceholder value) {
public Object doThrow(Object tag, U value) {
return doThrow(tag, (Object) value);
}

@@ -2192,7 +2192,7 @@ public Object doThrow(Object tag, Object value) {
RubyCallStack.getBacktrace(this)));
}

if (value instanceof UndefinedPlaceholder) {
if (value instanceof U) {
throw new ThrowException(tag, getContext().getCoreLibrary().getNilObject());
} else {
throw new ThrowException(tag, value);
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/truffle/nodes/core/MathNodes.java
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.dispatch.*;
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.RubyArray;
import org.jruby.truffle.runtime.core.RubyBignum;
@@ -710,27 +710,27 @@ public LogNode(LogNode prev) {
}

@Specialization
public double function(int a, UndefinedPlaceholder b) {
public double function(int a, U b) {
return doFunction(a);
}

@Specialization
public double function(long a, UndefinedPlaceholder b) {
public double function(long a, U b) {
return doFunction(a);
}

@Specialization
public double function(RubyBignum a, UndefinedPlaceholder b) {
public double function(RubyBignum a, U b) {
return doFunction(a.doubleValue());
}

@Specialization
public double function(double a, UndefinedPlaceholder b) {
public double function(double a, U b) {
return doFunction(a);
}

@Specialization
public double function(VirtualFrame frame, Object a, UndefinedPlaceholder b) {
public double function(VirtualFrame frame, Object a, U b) {
if (isANode.executeIsA(frame, a, getContext().getCoreLibrary().getNumericClass())) {
try {
return doFunction(
42 changes: 21 additions & 21 deletions core/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
Original file line number Diff line number Diff line change
@@ -396,23 +396,23 @@ public ClassEvalNode(ClassEvalNode prev) {
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, @SuppressWarnings("unused") UndefinedPlaceholder file, @SuppressWarnings("unused") UndefinedPlaceholder line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, @SuppressWarnings("unused") U file, @SuppressWarnings("unused") U line, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

final Source source = Source.fromText(code.getBytes(), "(eval)");
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") UndefinedPlaceholder line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") U line, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") int line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") int line, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
@@ -429,14 +429,14 @@ public RubyNode wrap(RubyNode node) {
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule self, @SuppressWarnings("unused") UndefinedPlaceholder code, @SuppressWarnings("unused") UndefinedPlaceholder file, @SuppressWarnings("unused") UndefinedPlaceholder line, RubyProc block) {
public Object classEval(VirtualFrame frame, RubyModule self, @SuppressWarnings("unused") U code, @SuppressWarnings("unused") U file, @SuppressWarnings("unused") U line, RubyProc block) {
notDesignedForCompilation();

return yield.dispatchWithModifiedSelf(frame, block, self);
}

@Specialization
public Object classEval(RubyModule self, UndefinedPlaceholder code, UndefinedPlaceholder file, UndefinedPlaceholder line, UndefinedPlaceholder block) {
public Object classEval(RubyModule self, U code, U file, U line, U block) {
notDesignedForCompilation();

throw new RaiseException(getContext().getCoreLibrary().argumentError(0, 1, 2, this));
@@ -560,7 +560,7 @@ public ConstantsNode(ConstantsNode prev) {
}

@Specialization
public RubyArray constants(RubyModule module, UndefinedPlaceholder unused) {
public RubyArray constants(RubyModule module, U unused) {
return constants(module, true);
}

@@ -591,7 +591,7 @@ public ConstDefinedNode(ConstDefinedNode prev) {
}

@Specialization
public boolean isConstDefined(RubyModule module, RubyString name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
public boolean isConstDefined(RubyModule module, RubyString name, @SuppressWarnings("unused") U inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, module, name.toString()) != null;
@@ -609,7 +609,7 @@ public boolean isConstDefined(RubyModule module, RubyString name, boolean inheri
}

@Specialization
public boolean isConstDefined(RubyModule module, RubySymbol name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
public boolean isConstDefined(RubyModule module, RubySymbol name, @SuppressWarnings("unused") U inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, module, name.toString()) != null;
@@ -730,14 +730,14 @@ public DefineMethodNode(DefineMethodNode prev) {
}

@Specialization
public RubySymbol defineMethod(RubyModule module, RubyString name, @SuppressWarnings("unused") UndefinedPlaceholder proc, RubyProc block) {
public RubySymbol defineMethod(RubyModule module, RubyString name, @SuppressWarnings("unused") U proc, RubyProc block) {
notDesignedForCompilation();

return defineMethod(module, name, block, UndefinedPlaceholder.INSTANCE);
return defineMethod(module, name, block, U.INSTANCE);
}

@Specialization
public RubySymbol defineMethod(RubyModule module, RubyString name, RubyProc proc, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public RubySymbol defineMethod(RubyModule module, RubyString name, RubyProc proc, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

final RubySymbol symbol = getContext().getSymbolTable().getSymbol(name.getBytes());
@@ -746,22 +746,22 @@ public RubySymbol defineMethod(RubyModule module, RubyString name, RubyProc proc
}

@Specialization
public RubySymbol defineMethod(RubyModule module, RubySymbol name, @SuppressWarnings("unused") UndefinedPlaceholder proc, RubyProc block) {
public RubySymbol defineMethod(RubyModule module, RubySymbol name, @SuppressWarnings("unused") U proc, RubyProc block) {
notDesignedForCompilation();

return defineMethod(module, name, block, UndefinedPlaceholder.INSTANCE);
return defineMethod(module, name, block, U.INSTANCE);
}

@Specialization
public RubySymbol defineMethod(RubyModule module, RubySymbol name, RubyProc proc, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public RubySymbol defineMethod(RubyModule module, RubySymbol name, RubyProc proc, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

defineMethod(module, name, proc);
return name;
}

@Specialization
public RubySymbol defineMethod(RubyModule module, RubySymbol name, RubyMethod method, UndefinedPlaceholder block) {
public RubySymbol defineMethod(RubyModule module, RubySymbol name, RubyMethod method, U block) {
notDesignedForCompilation();

module.addMethod(this, method.getMethod().withNewName(name.toString()));
@@ -803,7 +803,7 @@ void classEval(VirtualFrame frame, RubyModule module, RubyProc block) {
}

@Specialization
public RubyModule initialize(RubyModule module, UndefinedPlaceholder block) {
public RubyModule initialize(RubyModule module, U block) {
return module;
}

@@ -916,7 +916,7 @@ public MethodDefinedNode(MethodDefinedNode prev) {
}

@Specialization
public boolean isMethodDefined(RubyModule module, RubyString name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
public boolean isMethodDefined(RubyModule module, RubyString name, @SuppressWarnings("unused") U inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupMethod(module, name.toString()) != null;
@@ -934,7 +934,7 @@ public boolean isMethodDefined(RubyModule module, RubyString name, boolean inher
}

@Specialization
public boolean isMethodDefined(RubyModule module, RubySymbol name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
public boolean isMethodDefined(RubyModule module, RubySymbol name, @SuppressWarnings("unused") U inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupMethod(module, name.toString()) != null;
@@ -1163,7 +1163,7 @@ public PrivateInstanceMethodsNode(PrivateInstanceMethodsNode prev) {
}

@Specialization
public RubyArray privateInstanceMethods(RubyModule module, UndefinedPlaceholder argument) {
public RubyArray privateInstanceMethods(RubyModule module, U argument) {
return privateInstanceMethods(module, false);
}

@@ -1201,7 +1201,7 @@ public PublicInstanceMethodsNode(PublicInstanceMethodsNode prev) {
}

@Specialization
public RubyArray publicInstanceMethods(RubyModule module, UndefinedPlaceholder argument) {
public RubyArray publicInstanceMethods(RubyModule module, U argument) {
return publicInstanceMethods(module, false);
}

@@ -1238,7 +1238,7 @@ public InstanceMethodsNode(InstanceMethodsNode prev) {
}

@Specialization
public RubyArray instanceMethods(RubyModule module, UndefinedPlaceholder argument) {
public RubyArray instanceMethods(RubyModule module, U argument) {
notDesignedForCompilation();

return instanceMethods(module, true);
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import org.jruby.truffle.runtime.ModuleOperations;
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.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyBignum;
import org.jruby.truffle.runtime.core.RubyClass;
@@ -97,7 +97,7 @@ public EachObjectNode(EachObjectNode prev) {
}

@Specialization
public int eachObject(VirtualFrame frame, @SuppressWarnings("unused") UndefinedPlaceholder ofClass, RubyProc block) {
public int eachObject(VirtualFrame frame, @SuppressWarnings("unused") U ofClass, RubyProc block) {
notDesignedForCompilation();

final Collection<RubyBasicObject> liveObjects = getContext().getObjectSpaceManager().collectLiveObjects().values();
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
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.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyBinding;
import org.jruby.truffle.runtime.core.RubyNilClass;
@@ -89,7 +89,7 @@ public CallNode(CallNode prev) {
}

@Specialization
public Object call(VirtualFrame frame, RubyProc proc, Object[] args, UndefinedPlaceholder block) {
public Object call(VirtualFrame frame, RubyProc proc, Object[] args, U block) {
return yieldNode.dispatch(frame, proc, args);
}

12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
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.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyEncoding;
@@ -197,7 +197,7 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") UndefinedPlaceholder options) {
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") U options) {
notDesignedForCompilation();

regexp.initialize(this, string.getBytes());
@@ -208,7 +208,7 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarn
public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarnings("unused") RubyNilClass options) {
notDesignedForCompilation();

return initialize(regexp, string, UndefinedPlaceholder.INSTANCE);
return initialize(regexp, string, U.INSTANCE);
}

@Specialization
@@ -218,7 +218,7 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyString string, boolean optio
if (booleanOptionsProfile.profile(options)) {
return initialize(regexp, string, Option.IGNORECASE);
} else {
return initialize(regexp, string, UndefinedPlaceholder.INSTANCE);
return initialize(regexp, string, U.INSTANCE);
}
}

@@ -238,7 +238,7 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyString string, @SuppressWarn
}

@Specialization
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnings("unused") UndefinedPlaceholder options) {
public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnings("unused") U options) {
notDesignedForCompilation();

regexp.initialize(this, from.getSource(), from.getRegex().getOptions()); // TODO: is copying needed?
@@ -251,7 +251,7 @@ public RubyRegexp initialize(RubyRegexp regexp, RubyRegexp from, @SuppressWarnin

getContext().getWarnings().warn("flags ignored");

return initialize(regexp, from, UndefinedPlaceholder.INSTANCE);
return initialize(regexp, from, U.INSTANCE);
}
}

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.common.IRubyWarnings;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;
import org.jruby.truffle.runtime.core.RubyProc;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.truffle.runtime.signal.ProcSignalHandler;
@@ -36,7 +36,7 @@ public SignalNode(SignalNode prev) {
}

@Specialization
public Object trap(RubyString signalName, UndefinedPlaceholder command, final RubyProc block) {
public Object trap(RubyString signalName, U command, final RubyProc block) {
notDesignedForCompilation();

final Signal signal = new Signal(signalName.toString());
@@ -52,7 +52,7 @@ public Object trap(RubyString signalName, UndefinedPlaceholder command, final Ru
}

@Specialization
public Object trap(RubyString signalName, RubyString command, UndefinedPlaceholder block) {
public Object trap(RubyString signalName, RubyString command, U block) {
notDesignedForCompilation();
getContext().getRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getSource().getName(), Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getStartLine(), "Signal#trap with a string command not implemented yet");
return getContext().getCoreLibrary().getNilObject();
34 changes: 16 additions & 18 deletions core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
Original file line number Diff line number Diff line change
@@ -24,13 +24,11 @@
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
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;
import org.jruby.util.ByteList;
import org.jruby.util.Pack;
import org.jruby.util.StringSupport;
@@ -200,7 +198,7 @@ public GetIndexNode(GetIndexNode prev) {
}

@Specialization(rewriteOn = UnexpectedResultException.class)
public RubyString getIndexInBounds(RubyString string, int index, UndefinedPlaceholder undefined) throws UnexpectedResultException {
public RubyString getIndexInBounds(RubyString string, int index, U undefined) throws UnexpectedResultException {
final int normalisedIndex = string.normaliseIndex(index);
final ByteList bytes = string.getBytes();

@@ -212,7 +210,7 @@ public RubyString getIndexInBounds(RubyString string, int index, UndefinedPlaceh
}

@Specialization(contains = "getIndexInBounds")
public Object getIndex(RubyString string, int index, UndefinedPlaceholder undefined) {
public Object getIndex(RubyString string, int index, U undefined) {
int normalisedIndex = string.normaliseIndex(index);
final ByteList bytes = string.getBytes();

@@ -225,7 +223,7 @@ public Object getIndex(RubyString string, int index, UndefinedPlaceholder undefi
}

@Specialization
public Object slice(RubyString string, RubyRange.IntegerFixnumRange range, UndefinedPlaceholder undefined) {
public Object slice(RubyString string, RubyRange.IntegerFixnumRange range, U undefined) {
notDesignedForCompilation();

final String javaString = string.toString();
@@ -431,7 +429,7 @@ public ChompNode(ChompNode prev) {
}

@Specialization
public RubyString chomp(RubyString string, UndefinedPlaceholder undefined) {
public RubyString chomp(RubyString string, U undefined) {
notDesignedForCompilation();
return string.getContext().makeString(StringNodesHelper.chomp(string));
}
@@ -744,15 +742,15 @@ public GsubNode(GsubNode prev) {
}

@Specialization
public RubyString gsub(VirtualFrame frame, RubyString string, RubyString regexpString, RubyString replacement, UndefinedPlaceholder block) {
public RubyString gsub(VirtualFrame frame, RubyString string, RubyString regexpString, RubyString replacement, U block) {
notDesignedForCompilation();

final RubyRegexp regexp = new RubyRegexp(this, getContext().getCoreLibrary().getRegexpClass(), escape(frame, regexpString).getBytes(), Option.DEFAULT);
return gsub(string, regexp, replacement, block);
}

@Specialization
public RubyString gsub(RubyString string, RubyRegexp regexp, RubyString replacement, @SuppressWarnings("unused") UndefinedPlaceholder block) {
public RubyString gsub(RubyString string, RubyRegexp regexp, RubyString replacement, @SuppressWarnings("unused") U block) {
notDesignedForCompilation();

return regexp.gsub(string, replacement.toString());
@@ -774,15 +772,15 @@ public RubyString gsub(RubyString string, RubyRegexp regexp, RubyString replacem
}

@Specialization
public RubyString gsub(VirtualFrame frame, RubyString string, RubyString regexpString, @SuppressWarnings("unused") UndefinedPlaceholder replacement, RubyProc block) {
public RubyString gsub(VirtualFrame frame, RubyString string, RubyString regexpString, @SuppressWarnings("unused") U replacement, RubyProc block) {
notDesignedForCompilation();

final RubyRegexp regexp = new RubyRegexp(this, getContext().getCoreLibrary().getRegexpClass(), escape(frame, regexpString).getBytes(), Option.DEFAULT);
return gsub(frame, string, regexp, replacement, block);
}

@Specialization
public RubyString gsub(VirtualFrame frame, RubyString string, RubyRegexp regexp, @SuppressWarnings("unused") UndefinedPlaceholder replacement, RubyProc block) {
public RubyString gsub(VirtualFrame frame, RubyString string, RubyRegexp regexp, @SuppressWarnings("unused") U replacement, RubyProc block) {
notDesignedForCompilation();

final RubyContext context = getContext();
@@ -881,7 +879,7 @@ public InitializeNode(InitializeNode prev) {
}

@Specialization
public RubyString initialize(RubyString self, UndefinedPlaceholder from) {
public RubyString initialize(RubyString self, U from) {
return self;
}

@@ -996,7 +994,7 @@ public LjustNode(LjustNode prev) {
}

@Specialization
public RubyString ljust(RubyString string, int length, @SuppressWarnings("unused") UndefinedPlaceholder padding) {
public RubyString ljust(RubyString string, int length, @SuppressWarnings("unused") U padding) {
notDesignedForCompilation();

return getContext().makeString(RubyString.ljust(string.toString(), length, " "));
@@ -1066,7 +1064,7 @@ public RindexNode(RindexNode prev) {
}

@Specialization
public Object rindex(RubyString string, RubyString subString, @SuppressWarnings("unused") UndefinedPlaceholder endPosition) {
public Object rindex(RubyString string, RubyString subString, @SuppressWarnings("unused") U endPosition) {
notDesignedForCompilation();

return rindex(string, subString, string.length());
@@ -1112,7 +1110,7 @@ public RjustNode(RjustNode prev) {
}

@Specialization
public RubyString rjust(RubyString string, int length, @SuppressWarnings("unused") UndefinedPlaceholder padding) {
public RubyString rjust(RubyString string, int length, @SuppressWarnings("unused") U padding) {
notDesignedForCompilation();

return getContext().makeString(RubyString.rjust(string.toString(), length, " "));
@@ -1185,7 +1183,7 @@ public ScanNode(ScanNode prev) {
}

@Specialization
public RubyArray scan(RubyString string, RubyString regexpString, UndefinedPlaceholder block) {
public RubyArray scan(RubyString string, RubyString regexpString, U block) {
notDesignedForCompilation();

final RubyRegexp regexp = new RubyRegexp(this, getContext().getCoreLibrary().getRegexpClass(), regexpString.getBytes(), Option.DEFAULT);
@@ -1201,7 +1199,7 @@ public RubyString scan(VirtualFrame frame, RubyString string, RubyString regexpS
}

@Specialization
public RubyArray scan(RubyString string, RubyRegexp regexp, UndefinedPlaceholder block) {
public RubyArray scan(RubyString string, RubyRegexp regexp, U block) {
notDesignedForCompilation();

return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), (Object[]) regexp.scan(string));
@@ -1329,7 +1327,7 @@ public RubyArray split(RubyString string, RubyRegexp sep) {
}

@Specialization
public RubyArray split(RubyString string, UndefinedPlaceholder sep) {
public RubyArray split(RubyString string, U sep) {
notDesignedForCompilation();

return splitHelper(string, " ");
Original file line number Diff line number Diff line change
@@ -15,10 +15,9 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.RubyThread.Status;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
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.control.ThreadExitException;
import org.jruby.truffle.runtime.core.*;
@@ -214,7 +213,7 @@ public RaiseNode(RaiseNode prev) {
}

@Specialization
public RubyNilClass raise(VirtualFrame frame, RubyThread thread, RubyString message, UndefinedPlaceholder undefined) {
public RubyNilClass raise(VirtualFrame frame, RubyThread thread, RubyString message, U undefined) {
return raise(frame, thread, getContext().getCoreLibrary().getRuntimeErrorClass(), message);
}

Original file line number Diff line number Diff line change
@@ -10,14 +10,9 @@
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.core.RubyBignum;
import org.jruby.truffle.runtime.core.RubyMethod;
import org.jruby.truffle.runtime.core.RubyProc;
import org.jruby.truffle.runtime.core.RubyUnboundMethod;

@CoreClass(name = "UnboundMethod")
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.U;

/**
* Read pre-optional argument.
@@ -46,7 +46,7 @@ public Object execute(VirtualFrame frame) {
break;

case UNDEFINED:
return UndefinedPlaceholder.INSTANCE;
return U.INSTANCE;

case NIL:
return getContext().getCoreLibrary().getNilObject();
Original file line number Diff line number Diff line change
@@ -10,15 +10,15 @@
package org.jruby.truffle.runtime;

/**
* The {@link UndefinedPlaceholder} is a value that represents an undefined value in Ruby. This is
* The {@link U} is a value that represents an undefined value in Ruby. This is
* used to differentiate between nil and the true absence of a value, such as an argument that has
* not been passed.
*/
public final class UndefinedPlaceholder {
public final class U {

public static final UndefinedPlaceholder INSTANCE = new UndefinedPlaceholder();
public static final U INSTANCE = new U();

private UndefinedPlaceholder() {
private U() {
}

}

0 comments on commit 8b84e49

Please sign in to comment.