Skip to content

Commit

Permalink
[Truffle] Rename UndefinedPlaceholder to NotProvided for not provided…
Browse files Browse the repository at this point in the history
… arguments.
  • Loading branch information
eregon committed May 29, 2015
1 parent edb6c79 commit 13d3bfb
Show file tree
Hide file tree
Showing 30 changed files with 269 additions and 269 deletions.
6 changes: 3 additions & 3 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyGuards.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import org.jruby.truffle.nodes.core.MethodNodes;
import org.jruby.truffle.nodes.core.UnboundMethodNodes;
import org.jruby.truffle.runtime.ThreadLocalObject;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.core.*;

public abstract class RubyGuards {

public static boolean isUndefinedPlaceholder(Object value) {
return value instanceof UndefinedPlaceholder;
public static boolean isNotProvided(Object value) {
return value instanceof NotProvided;
}

public static boolean isBoolean(Object value) {
Expand Down
8 changes: 4 additions & 4 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.jruby.truffle.nodes.instrument.RubyWrapperNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.sockets.NativeSockets;

Expand Down Expand Up @@ -66,11 +66,11 @@ public void executeVoid(VirtualFrame frame) {

// Utility methods to execute and expect a particular type

public UndefinedPlaceholder executeUndefinedPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
public NotProvided executeNotProvided(VirtualFrame frame) throws UnexpectedResultException {
final Object value = execute(frame);

if (value instanceof UndefinedPlaceholder) {
return (UndefinedPlaceholder) value;
if (value instanceof NotProvided) {
return (NotProvided) value;
} else {
throw new UnexpectedResultException(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.NotProvided;

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

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

case NIL:
return nil();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Object execute(VirtualFrame frame) {
}

// It's possible the taintFromParameter value was misconfigured by the user, but the far more likely
// scenario is that the argument at that position is an UndefinedPlaceholder, which doesn't take up
// scenario is that the argument at that position is a NotProvided argument, which doesn't take up
// a space in the frame.
if (taintFromParameter < RubyArguments.getUserArgumentsCount(frame.getArguments())) {
final Object argument = RubyArguments.getUserArgument(frame.getArguments(), taintFromParameter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.jruby.truffle.nodes.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.array.ArrayUtils;
Expand Down Expand Up @@ -177,14 +177,14 @@ public InstanceEvalNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, UndefinedPlaceholder block) {
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, NotProvided block) {
CompilerDirectives.transferToInterpreter();

return getContext().instanceEval(string.getByteList(), receiver, this);
}

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, UndefinedPlaceholder string, RubyProc block) {
public Object instanceEval(VirtualFrame frame, Object receiver, NotProvided string, RubyProc block) {
return yield.dispatchWithModifiedSelf(frame, block, receiver, receiver);
}

Expand All @@ -205,7 +205,7 @@ public Object instanceExec(VirtualFrame frame, Object receiver, Object[] argumen
}

@Specialization
public Object instanceExec(Object receiver, Object[] arguments, UndefinedPlaceholder block) {
public Object instanceExec(Object receiver, Object[] arguments, NotProvided block) {
CompilerDirectives.transferToInterpreter();

throw new RaiseException(getContext().getCoreLibrary().localJumpError("no block given", this));
Expand All @@ -221,7 +221,7 @@ public MethodMissingNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public Object methodMissing(Object self, Object[] args, UndefinedPlaceholder block) {
public Object methodMissing(Object self, Object[] args, NotProvided block) {
CompilerDirectives.transferToInterpreter();

return methodMissing(self, args, (RubyProc) null);
Expand Down Expand Up @@ -281,7 +281,7 @@ public SendNode(RubyContext context, SourceSection sourceSection) {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;

Expand Down Expand Up @@ -661,7 +661,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@TruffleBoundary
@Specialization
public RubyString toS(RubyBasicObject value, UndefinedPlaceholder undefined) {
public RubyString toS(RubyBasicObject value, NotProvided base) {
return getContext().makeString(getBigIntegerValue(value).toString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyClass;
Expand Down Expand Up @@ -60,7 +60,7 @@ public NewNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public Object newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, UndefinedPlaceholder block) {
public Object newInstance(VirtualFrame frame, RubyClass rubyClass, Object[] args, NotProvided block) {
return doNewInstance(frame, rubyClass, args, null);
}

Expand Down Expand Up @@ -94,18 +94,18 @@ void moduleInitialize(VirtualFrame frame, RubyClass rubyClass, RubyProc block) {
}

@Specialization
public RubyClass initialize(RubyClass rubyClass, UndefinedPlaceholder superclass, UndefinedPlaceholder block) {
public RubyClass initialize(RubyClass rubyClass, NotProvided superclass, NotProvided 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, NotProvided 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, NotProvided superclass, RubyProc block) {
return initialize(frame, rubyClass, getContext().getCoreLibrary().getObjectClass(), block);
}

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

if (method.needsBlock()) {
argumentsNodes.add(new ReadBlockNode(context, sourceSection, UndefinedPlaceholder.INSTANCE));
argumentsNodes.add(new ReadBlockNode(context, sourceSection, NotProvided.INSTANCE));
}

final RubyNode methodNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.jruby.truffle.nodes.objectstorage.ReadHeadObjectFieldNode;
import org.jruby.truffle.runtime.RubyCallStack;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyException;
Expand All @@ -33,12 +33,12 @@ public InitializeNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject initialize(RubyException exception, UndefinedPlaceholder message) {
public RubyBasicObject initialize(RubyException exception, NotProvided message) {
exception.initialize(nil());
return exception;
}

@Specialization(guards = "!isUndefinedPlaceholder(message)")
@Specialization(guards = "!isNotProvided(message)")
public RubyBasicObject initialize(RubyException exception, Object message) {
exception.initialize(message);
return exception;
Expand Down Expand Up @@ -78,7 +78,7 @@ public CaptureBacktraceNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyBasicObject captureBacktrace(RubyException exception, UndefinedPlaceholder offset) {
public RubyBasicObject captureBacktrace(RubyException exception, NotProvided offset) {
return captureBacktrace(exception, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;

Expand Down Expand Up @@ -570,7 +570,7 @@ public RoundNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public Object round(double n, UndefinedPlaceholder undefinedPlaceholder) {
public Object round(double n, NotProvided ndigits) {
// Algorithm copied from JRuby - not shared as we want to branch profile it

if (Double.isInfinite(n)) {
Expand Down Expand Up @@ -606,7 +606,7 @@ public Object round(double n, UndefinedPlaceholder undefinedPlaceholder) {
return fixnumOrBignum.fixnumOrBignum(f);
}

@Specialization(guards = "!isUndefinedPlaceholder(ndigits)")
@Specialization(guards = "!isNotProvided(ndigits)")
public Object round(VirtualFrame frame, double n, Object ndigits) {
return ruby(frame, "round_internal(ndigits)", "ndigits", ndigits);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.oracle.truffle.api.utilities.BranchProfile;
import org.jruby.truffle.nodes.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.control.NextException;
import org.jruby.truffle.runtime.control.RedoException;
import org.jruby.truffle.runtime.core.RubyArray;
Expand Down Expand Up @@ -136,7 +136,7 @@ public TimesNode(RubyContext context, SourceSection sourceSection) {
}

@Specialization
public RubyArray times(VirtualFrame frame, int n, UndefinedPlaceholder block) {
public RubyArray times(VirtualFrame frame, int n, NotProvided block) {
final int[] array = new int[n];

for (int i = 0; i < n; i++) {
Expand Down

0 comments on commit 13d3bfb

Please sign in to comment.