Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: eaa4f2fd45d9
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6717b78f3c8e
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Dec 22, 2014

  1. Copy the full SHA
    b37dd0a View commit details
  2. Copy the full SHA
    17ccd40 View commit details
  3. Copy the full SHA
    6717b78 View commit details
12 changes: 12 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/cast/SplatCastNode.java
Original file line number Diff line number Diff line change
@@ -13,12 +13,14 @@
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
import org.jruby.RubyNil;
import org.jruby.truffle.nodes.*;
import org.jruby.truffle.nodes.core.ArrayDupNode;
import org.jruby.truffle.nodes.core.ArrayDupNodeFactory;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
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;
import org.jruby.truffle.runtime.core.RubyString;
@@ -96,6 +98,16 @@ public RubyArray splat(VirtualFrame frame, Object object) {

if (array instanceof RubyArray) {
return (RubyArray) array;
} else if (array instanceof RubyNilClass) {
return RubyArray.fromObject(getContext().getCoreLibrary().getArrayClass(), object);
} else {
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantConvertTo(
getContext().getCoreLibrary().getLogicalClass(object).getName(),
"Array",
"to_a",
getContext().getCoreLibrary().getLogicalClass(array).getName(),
this)
);
}
}

Original file line number Diff line number Diff line change
@@ -479,6 +479,11 @@ public RubyException typeErrorCantConvertTo(String from, String to, Node current
return typeError(String.format("can't convert %s to %s", from, to), currentNode);
}

public RubyException typeErrorCantConvertTo(String from, String to, String methodUsed, String given, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return typeError(String.format("can't convert %s to %s (%s#%s gives %s)", from, to, from, methodUsed, given), currentNode);
}

public RubyException typeErrorCantConvertInto(String from, String to, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return typeError(String.format("can't convert %s into %s", from, to), currentNode);
Original file line number Diff line number Diff line change
@@ -790,7 +790,7 @@ protected RubyNode translateMethodDefinition(SourceSection sourceSection, RubyNo

final MethodTranslator methodCompiler = new MethodTranslator(currentNode, context, this, newEnvironment, false, parent == null, source);

final MethodDefinitionNode functionExprNode = methodCompiler.compileFunctionNode(sourceSection, methodName, argsNode, bodyNode, ignoreLocalVisiblity);
final MethodDefinitionNode functionExprNode = methodCompiler.compileFunctionNode(sourceSection, methodName, argsNode, bodyNode, ignoreLocalVisiblity, sharedMethodInfo);

/*
* In the top-level, methods are defined in the class of the main object. This is
@@ -1245,7 +1245,7 @@ public RubyNode visitIterNode(org.jruby.ast.IterNode node) {
methodCompiler.useClassVariablesAsIfInClass = true;
}

return methodCompiler.compileFunctionNode(translate(node.getPosition()), sharedMethodInfo.getName(), argsNode, node.getBodyNode(), false);
return methodCompiler.compileFunctionNode(translate(node.getPosition()), sharedMethodInfo.getName(), argsNode, node.getBodyNode(), false, sharedMethodInfo);
}

@Override
@@ -2281,7 +2281,7 @@ public RubyNode visitLambdaNode(org.jruby.ast.LambdaNode node) {
throw new UnsupportedOperationException();
}

final MethodDefinitionNode definitionNode = methodCompiler.compileFunctionNode(translate(node.getPosition()), sharedMethodInfo.getName(), argsNode, node.getBodyNode(), false);
final MethodDefinitionNode definitionNode = methodCompiler.compileFunctionNode(translate(node.getPosition()), sharedMethodInfo.getName(), argsNode, node.getBodyNode(), false, sharedMethodInfo);

return new LambdaNode(context, translate(node.getPosition()), definitionNode);
}
Original file line number Diff line number Diff line change
@@ -41,7 +41,12 @@ public MethodTranslator(RubyNode currentNode, RubyContext context, BodyTranslato
this.isTopLevel = isTopLevel;
}

public MethodDefinitionNode compileFunctionNode(SourceSection sourceSection, String methodName, ArgsNode argsNode, org.jruby.ast.Node bodyNode, boolean ignoreLocalVisiblity) {
public MethodDefinitionNode compileFunctionNode(SourceSection sourceSection, String methodName, ArgsNode argsNode, org.jruby.ast.Node bodyNode, boolean ignoreLocalVisiblity, SharedMethodInfo sharedMethodInfo) {
if (PRINT_PARSE_TREE_METHOD_NAMES.contains(methodName)) {
System.err.println(methodName);
System.err.println(sharedMethodInfo.getParseTree().toString(true, 0));
}

final ParameterCollector parameterCollector = new ParameterCollector();
argsNode.accept(parameterCollector);

Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
public abstract class Translator extends org.jruby.ast.visitor.AbstractNodeVisitor<RubyNode> {

public static final Set<String> PRINT_AST_METHOD_NAMES = new HashSet<>(Arrays.asList(Options.TRUFFLE_TRANSLATOR_PRINT_AST.load().split(",")));
public static final Set<String> PRINT_PARSE_TREE_METHOD_NAMES = new HashSet<>(Arrays.asList(Options.TRUFFLE_TRANSLATOR_PRINT_PARSE_TREE.load().split(",")));

protected final RubyNode currentNode;
protected final RubyContext context;
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ public class Options {
public static final Option<Boolean> TRUFFLE_DISPATCH_METHODMISSING_ALWAYS_CLONED = bool(TRUFFLE, "truffle.call.method_missing_always_cloned", true, "Always clone #method_missing call targets.");
public static final Option<Boolean> TRUFFLE_DISPATCH_METHODMISSING_ALWAYS_INLINED = bool(TRUFFLE, "truffle.call.method_missing_always_inlined", true, "Always inline #method_missing call targets.");
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_AST = string(TRUFFLE, "truffle.translator.print_asts", "", "Comma delimited list of method names to print the AST of after translation.");
public static final Option<String> TRUFFLE_TRANSLATOR_PRINT_PARSE_TREE = string(TRUFFLE, "truffle.translator.print_parse_trees", "", "Comma delimited list of method names to print the JRuby parse tree of before translation.");

public static final Option<Boolean> NATIVE_ENABLED = bool(NATIVE, "native.enabled", true, "Enable/disable native code, including POSIX features and C exts.");
public static final Option<Boolean> NATIVE_VERBOSE = bool(NATIVE, "native.verbose", false, "Enable verbose logging of native extension loading.");
4 changes: 0 additions & 4 deletions spec/truffle/tags/language/method_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
fails:A method send with a single splatted Object argument raises a TypeError if #to_a does not return an Array
fails:A method send with a leading splatted Object argument raises a TypeError if #to_a does not return an Array
fails:A method send with a middle splatted Object argument raises a TypeError if #to_a does not return an Array
fails:A method send with a trailing splatted Object argument raises a TypeError if #to_a does not return an Array
fails:An element assignment method send with a single splatted Object argument does not call #to_ary
fails:An element assignment method send with a single splatted Object argument calls #to_a
fails:An element assignment method send with a single splatted Object argument wraps the argument in an Array if #to_a returns nil