Skip to content

Commit

Permalink
Merge branch 'master' into non-indy-jit
Browse files Browse the repository at this point in the history
Conflicts:
	core/src/main/java/org/jruby/util/cli/Options.java
headius committed Oct 16, 2014

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nomadium Miguel Landaeta
2 parents 8e8f161 + 1e84749 commit 7021c5a
Showing 117 changed files with 3,634 additions and 658 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ matrix:
jdk: oraclejdk7
fast_finish: true
allow_failures:
- env: TARGET='-Pcomplete'
- env: TARGET='-Prake -Dtask=spec:compiler'

branches:
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyInstanceConfig.java
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ public void tryProcessArgumentsWithRubyopts() {

if (rubyopt.split("\\s").length != 0) {
String[] rubyoptArgs = rubyopt.split("\\s+");
new ArgumentProcessor(rubyoptArgs, false, true, this).processArguments();
new ArgumentProcessor(rubyoptArgs, false, true, true, this).processArguments();
}
} catch (SecurityException se) {
// ignore and do nothing
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/parser/StaticScope.java
Original file line number Diff line number Diff line change
@@ -559,7 +559,9 @@ public Type getType() {

public StaticScope duplicate() {
StaticScope dupe = new StaticScope(type, enclosingScope, variableNames == null ? NO_NAMES : variableNames);
dupe.setIRScope(irScope);
// irScope is not guaranteed to be set onto StaticScope until it is executed for the first time.
// We can call duplicate before its first execution.
if (irScope != null) dupe.setIRScope(irScope);
dupe.setScopeType(scopeType);
dupe.setPreviousCRefScope(previousCRefScope);
dupe.setModule(cref);
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import org.jruby.truffle.nodes.RubyRootNode;
import org.jruby.truffle.nodes.core.CoreMethodNodeManager;
import org.jruby.truffle.nodes.methods.MethodDefinitionNode;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyArray;
@@ -121,7 +121,7 @@ public Object get() {
return callTarget.call(RubyArguments.pack(null, parentFrame, self, null, new Object[]{}));
}

}, NilPlaceholder.INSTANCE);
}, truffleContext.getCoreLibrary().getNilObject());
}

@Override
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public Object execute(VirtualFrame frame) {

return dispatch.dispatch(
frame,
NilPlaceholder.INSTANCE,
getContext().getCoreLibrary().getNilObject(),
RubyArguments.getSelf(frame.getArguments()),
receiverObject,
name,
@@ -85,14 +85,14 @@ public Object isDefined(VirtualFrame frame) {
*/

if (e.getRubyException().getLogicalClass() == context.getCoreLibrary().getNameErrorClass()) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

throw e;
}

if (value == null) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
} else {
return context.makeString("constant");
}
16 changes: 8 additions & 8 deletions core/src/main/java/org/jruby/truffle/nodes/RubyCallNode.java
Original file line number Diff line number Diff line change
@@ -161,13 +161,13 @@ private Object[] splat(Object argument) {
public Object isDefined(VirtualFrame frame) {
notDesignedForCompilation();

if (receiver.isDefined(frame) == NilPlaceholder.INSTANCE) {
return NilPlaceholder.INSTANCE;
if (receiver.isDefined(frame) == getContext().getCoreLibrary().getNilObject()) {
return getContext().getCoreLibrary().getNilObject();
}

for (RubyNode argument : arguments) {
if (argument.isDefined(frame) == NilPlaceholder.INSTANCE) {
return NilPlaceholder.INSTANCE;
if (argument.isDefined(frame) == getContext().getCoreLibrary().getNilObject()) {
return getContext().getCoreLibrary().getNilObject();
}
}

@@ -185,7 +185,7 @@ public Object isDefined(VirtualFrame frame) {

receiverObject = receiver.execute(frame);
} catch (Exception e) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

final RubyBasicObject receiverBasicObject = context.getCoreLibrary().box(receiverObject);
@@ -200,12 +200,12 @@ public Object isDefined(VirtualFrame frame) {
final Object r = respondToMissing.call(frame, receiverBasicObject, "respond_to_missing?", null, context.makeString(methodName));

if (r != Dispatch.MISSING && !respondToMissingCast.executeBoolean(frame, r)) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}
} else if (method.isUndefined()) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
} else if (!ignoreVisibility && !method.isVisibleTo(this, self)) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

return context.makeString("method");
5 changes: 0 additions & 5 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.nodes.yield.YieldDispatchNode;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.RubyCallStack;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
@@ -96,10 +95,6 @@ public double executeFloat(VirtualFrame frame) throws UnexpectedResultException
return RubyTypesGen.RUBYTYPES.expectDouble(execute(frame));
}

public NilPlaceholder executeNilPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectNilPlaceholder(execute(frame));
}

public Object[] executeObjectArray(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectObjectArray(execute(frame));
}
7 changes: 0 additions & 7 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
import com.oracle.truffle.api.dsl.ImplicitCast;
import com.oracle.truffle.api.dsl.TypeSystem;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.core.RubyArray;
@@ -31,7 +30,6 @@
@TypeSystem({ //
Dispatch.DispatchAction.class, //
UndefinedPlaceholder.class, //
NilPlaceholder.class, //
boolean.class, //
int.class, //
long.class, //
@@ -73,11 +71,6 @@

public class RubyTypes {

@ImplicitCast
public NilPlaceholder unboxNil(@SuppressWarnings("unused") RubyNilClass value) {
return NilPlaceholder.INSTANCE;
}

@ImplicitCast
public boolean unboxBoolean(RubyTrueClass value) {
return true;
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyNilClass;

@NodeChild("child")
public abstract class ArrayCastNode extends RubyNode {
@@ -43,8 +44,8 @@ public RubyArray doArray(RubyArray array) {
}

@Specialization
public NilPlaceholder doNil(NilPlaceholder nilPlaceholder) {
return nilPlaceholder;
public RubyNilClass doNil(RubyNilClass nil) {
return nil;
}

@Specialization
@@ -54,7 +55,7 @@ public Object doObject(VirtualFrame frame, Object object) {
final Object result = toArrayNode.call(frame, object, "to_ary", null, new Object[]{});

if (result == Dispatch.MISSING) {
return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

if (!(result instanceof RubyArray)) {
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public BooleanCastNode(BooleanCastNode copy) {
}

@Specialization
public boolean doNil(@SuppressWarnings("unused") NilPlaceholder nil) {
public boolean doNil(@SuppressWarnings("unused") RubyNilClass nil) {
return false;
}

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyBignum;
@@ -59,7 +59,7 @@ public RubyBasicObject box(Object value) {
return (RubyBasicObject) value;
}

if (seenNil && value instanceof NilPlaceholder) {
if (seenNil && value instanceof RubyNilClass) {
return getContext().getCoreLibrary().getNilObject();
}

@@ -94,7 +94,7 @@ public RubyBasicObject box(Object value) {
return (RubyBasicObject) value;
}

if (value instanceof NilPlaceholder) {
if (value instanceof RubyNilClass) {
seenNil = true;
return getContext().getCoreLibrary().getNilObject();
}
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public ProcCastNode(ProcCastNode prev) {
}

@Specialization
public NilPlaceholder doNil(NilPlaceholder nil) {
public RubyNilClass doNil(RubyNilClass nil) {
return nil;
}

Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import org.jruby.truffle.runtime.core.*;

/**
* Wraps some node that will produce either a {@link RubyProc} or a {@link NilPlaceholder} and
* Wraps some node that will produce either a {@link RubyProc} or a {@link RubyNilClass} and
* returns {@code null} in case of the latter. Used in parts of the dispatch chain.
*/
@NodeChild(value = "child", type = RubyNode.class)
@@ -32,7 +32,7 @@ public ProcOrNullNode(ProcOrNullNode prev) {
}

@Specialization
public Object doNil(@SuppressWarnings("unused") NilPlaceholder nil) {
public Object doNil(@SuppressWarnings("unused") RubyNilClass nil) {
return null;
}

Original file line number Diff line number Diff line change
@@ -58,13 +58,13 @@ public RubyArray doArray(RubyArray array) {
public RubyArray doObject(VirtualFrame frame, Object object) {
notDesignedForCompilation();

if (object == NilPlaceholder.INSTANCE) {
if (object == getContext().getCoreLibrary().getNilObject()) {
switch (nilBehavior) {
case EMPTY_ARRAY:
return new RubyArray(getContext().getCoreLibrary().getArrayClass());

case ARRAY_WITH_NIL:
return RubyArray.fromObject(getContext().getCoreLibrary().getArrayClass(), NilPlaceholder.INSTANCE);
return RubyArray.fromObject(getContext().getCoreLibrary().getArrayClass(), getContext().getCoreLibrary().getNilObject());

default: {
CompilerAsserts.neverPartOfCompilation();
Original file line number Diff line number Diff line change
@@ -29,11 +29,7 @@ public BreakNode(RubyContext context, SourceSection sourceSection, RubyNode chil

@Override
public Object execute(VirtualFrame frame) {
if (child instanceof NilLiteralNode) {
throw BreakException.NIL;
} else {
throw new BreakException(child.execute(frame));
}
throw new BreakException(child.execute(frame));
}

}
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.RubyRootNode;
import org.jruby.truffle.nodes.cast.BooleanCastNode;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.BreakException;
import org.jruby.truffle.runtime.control.NextException;
@@ -82,7 +82,7 @@ public Object execute(VirtualFrame frame) {
}
}

return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

}
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import org.jruby.truffle.nodes.literal.*;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.control.*;
import org.jruby.truffle.runtime.core.RubyNilClass;

public class NextNode extends RubyNode {

@@ -32,11 +33,7 @@ public NextNode(RubyContext context, SourceSection sourceSection, RubyNode child
public Object execute(VirtualFrame frame) {
notDesignedForCompilation();

if (child instanceof NilLiteralNode) {
throw NextException.NIL;
} else {
throw new NextException(child.execute(frame));
}
throw new NextException(child.execute(frame));
}

}
Original file line number Diff line number Diff line change
@@ -12,7 +12,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.NilPlaceholder;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.UndefinedPlaceholder;
import org.jruby.truffle.runtime.core.*;

@@ -72,11 +72,6 @@ public double executeFloat(VirtualFrame frame) throws UnexpectedResultException
return child.executeFloat(frame);
}

@Override
public NilPlaceholder executeNilPlaceholder(VirtualFrame frame) throws UnexpectedResultException {
return child.executeNilPlaceholder(frame);
}

@Override
public Object[] executeObjectArray(VirtualFrame frame) throws UnexpectedResultException {
return child.executeObjectArray(frame);
Original file line number Diff line number Diff line change
@@ -14,8 +14,9 @@
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.nodes.*;
import org.jruby.truffle.nodes.*;
import org.jruby.truffle.nodes.literal.NilLiteralNode;
import org.jruby.truffle.nodes.literal.ObjectLiteralNode;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.core.RubyNilClass;

import java.util.ArrayList;
import java.util.Arrays;
@@ -36,7 +37,7 @@ public static RubyNode sequence(RubyContext context, SourceSection sourceSection
final List<RubyNode> flattened = flatten(sequence, true);

if (flattened.isEmpty()) {
return new NilLiteralNode(context, sourceSection);
return new ObjectLiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject());
} else if (flattened.size() == 1) {
return flattened.get(0);
} else {
@@ -51,7 +52,7 @@ private static List<RubyNode> flatten(List<RubyNode> sequence, boolean allowTrai
final boolean lastNode = n == sequence.size() - 1;
final RubyNode node = sequence.get(n);

if (node instanceof NilLiteralNode) {
if (node instanceof ObjectLiteralNode && ((ObjectLiteralNode) node).getObject() instanceof RubyNilClass) {
if (allowTrailingNil && lastNode) {
flattened.add(node);
}
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ public Object execute(VirtualFrame frame) {
}
}

return NilPlaceholder.INSTANCE;
return getContext().getCoreLibrary().getNilObject();
}

}
Loading

0 comments on commit 7021c5a

Please sign in to comment.