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: 68199606c839
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 88a7994edbfe
Choose a head ref
  • 3 commits
  • 10 files changed
  • 1 contributor

Commits on Nov 11, 2014

  1. Revert "[Truffle] Raise NameError in #method_missing if it came from …

    …a VCall."
    
    * There is no need for such knowledge.
    
    This reverts commit 6d424b4.
    
    Conflicts:
    	core/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
    eregon committed Nov 11, 2014
    Copy the full SHA
    540fd31 View commit details
  2. Copy the full SHA
    0583cad View commit details
  3. [Truffle] Fix a couple exception messages.

    * Remove the nameErrorNoMethod since we don't need it anymore
      and it is confusing with its noMethodError cousin.
    eregon committed Nov 11, 2014
    Copy the full SHA
    88a7994 View commit details
11 changes: 0 additions & 11 deletions core/src/main/java/org/jruby/truffle/nodes/RubyCallNode.java
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ public class RubyCallNode extends RubyNode {
@Children protected final RubyNode[] arguments;

private final boolean isSplatted;
private final boolean isVCall;

@Child protected DispatchHeadNode dispatchHead;

@@ -57,12 +56,7 @@ public RubyCallNode(RubyContext context, SourceSection section, String methodNam
this(context, section, methodName, receiver, block, isSplatted, false, false, arguments);
}


public RubyCallNode(RubyContext context, SourceSection section, String methodName, RubyNode receiver, RubyNode block, boolean isSplatted, boolean ignoreVisibility, boolean rubiniusPrimitive, RubyNode... arguments) {
this(context, section, methodName, receiver, block, isSplatted, false, ignoreVisibility, rubiniusPrimitive, arguments);
}

public RubyCallNode(RubyContext context, SourceSection section, String methodName, RubyNode receiver, RubyNode block, boolean isSplatted, boolean isVCall, boolean ignoreVisibility, boolean rubiniusPrimitive, RubyNode... arguments) {
super(context, section);

this.methodName = methodName;
@@ -77,7 +71,6 @@ public RubyCallNode(RubyContext context, SourceSection section, String methodNam

this.arguments = arguments;
this.isSplatted = isSplatted;
this.isVCall = isVCall;

dispatchHead = new DispatchHeadNode(context, ignoreVisibility, false, rubiniusPrimitive, Dispatch.MissingBehavior.CALL_METHOD_MISSING);
respondToMissing = new DispatchHeadNode(context, true, Dispatch.MissingBehavior.RETURN_MISSING);
@@ -218,8 +211,4 @@ public String getName() {
return methodName;
}

public boolean isVCall() {
return isVCall;
}

}
Original file line number Diff line number Diff line change
@@ -12,14 +12,10 @@
import java.math.*;
import java.util.*;

import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeUtil;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyCallNode;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.cast.UnboxingNodeFactory;
import org.jruby.truffle.nodes.dispatch.Dispatch;
@@ -243,21 +239,7 @@ public Object methodMissing(RubyBasicObject self, Object[] args, RubyProc block)
}

private Object methodMissing(RubyBasicObject self, RubySymbol name, Object[] args, RubyProc block) {
if (lastCallWasVCall()) {
throw new RaiseException(getContext().getCoreLibrary().nameErrorNoMethod(name.toString(), self.toString(), this));
} else {
throw new RaiseException(getContext().getCoreLibrary().noMethodError(name.toString(), self.toString(), this));
}
}

private boolean lastCallWasVCall() {
final RubyCallNode callNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), RubyCallNode.class);

if (callNode == null) {
return false;
}

return callNode.isVCall();
throw new RaiseException(getContext().getCoreLibrary().noMethodError(name.toString(), self.toString(), this));
}

}
Original file line number Diff line number Diff line change
@@ -48,15 +48,16 @@ protected void lookup() {

if (!(declaringModule instanceof RubyClass)) {
method = null;
throw new RaiseException(getContext().getCoreLibrary().nameErrorNoMethod(name, "wasn't a class", this));
throw new RaiseException(getContext().getCoreLibrary().typeError("wasn't a class: "+name, this));
}

assert declaringModule instanceof RubyClass;
method = ModuleOperations.lookupMethod(((RubyClass) declaringModule).getSuperClass(), name);

if (method == null || method.isUndefined()) {
method = null;
throw new RaiseException(getContext().getCoreLibrary().nameErrorNoMethod(name, "no such method", this));
// TODO: should add " for #{receiver.inspect}" in error message
throw new RaiseException(getContext().getCoreLibrary().noMethodError("super: no superclass method `"+method.getName()+"'", this));
}

final DirectCallNode newCallNode = Truffle.getRuntime().createDirectCallNode(method.getCallTarget());
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ public void initialize() {
mathModule = new RubyModule(context, objectClass, "Math");
nameErrorClass = new RubyClass(context, objectClass, standardErrorClass, "NameError");
nilClass = new RubyClass(context, objectClass, objectClass, "NilClass");
noMethodErrorClass = new RubyException.RubyExceptionClass(context, objectClass, standardErrorClass, "NoMethodError");
noMethodErrorClass = new RubyException.RubyExceptionClass(context, objectClass, nameErrorClass, "NoMethodError");
objectSpaceModule = new RubyModule(context, objectClass, "ObjectSpace");
procClass = new RubyProc.RubyProcClass(context, objectClass);
processClass = new RubyClass(context, objectClass, objectClass, "Process");
@@ -472,11 +472,6 @@ public RubyException nameErrorPrivateConstant(RubyModule module, String name, No
return nameError(String.format("private constant %s::%s referenced", module.getName(), name), currentNode);
}

public RubyException nameErrorNoMethod(String name, String object, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return nameError(String.format("undefined method `%s' for %s", name, object), currentNode);
}

public RubyException nameErrorInstanceNameNotAllowable(String name, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return nameError(String.format("`%s' is not allowable as an instance variable name", name), currentNode);
Original file line number Diff line number Diff line change
@@ -212,7 +212,7 @@ public RubyNode visitAttrAssignNode(org.jruby.ast.AttrAssignNode node) {
public RubyNode visitAttrAssignNodeExtraArgument(org.jruby.ast.AttrAssignNode node, RubyNode extraArgument) {
final CallNode callNode = new CallNode(node.getPosition(), node.getReceiverNode(), node.getName(), node.getArgsNode(), null);
boolean isAccessorOnSelf = (node.getReceiverNode() instanceof org.jruby.ast.SelfNode);
return visitCallNodeExtraArgument(callNode, extraArgument, isAccessorOnSelf, false);
return visitCallNodeExtraArgument(callNode, extraArgument, isAccessorOnSelf);
}

@Override
@@ -289,13 +289,13 @@ public RubyNode visitBreakNode(org.jruby.ast.BreakNode node) {

@Override
public RubyNode visitCallNode(CallNode node) {
return visitCallNodeExtraArgument(node, null, false, false);
return visitCallNodeExtraArgument(node, null, false);
}

/**
* See translateDummyAssignment to understand what this is for.
*/
public RubyNode visitCallNodeExtraArgument(CallNode node, RubyNode extraArgument, boolean ignoreVisibility, boolean isVCall) {
public RubyNode visitCallNodeExtraArgument(CallNode node, RubyNode extraArgument, boolean ignoreVisibility) {
final SourceSection sourceSection = translate(node.getPosition());

final RubyNode receiverTranslated = node.getReceiverNode().accept(this);
@@ -318,7 +318,7 @@ public RubyNode visitCallNodeExtraArgument(CallNode node, RubyNode extraArgument
new RescueNode[] {new RescueAnyNode(context, sourceSection, new ObjectLiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()))},
new ObjectLiteralNode(context, sourceSection, context.getCoreLibrary().getNilObject()));
} else {
translated = new RubyCallNode(context, sourceSection, node.getName(), receiverTranslated, argumentsAndBlock.getBlock(), argumentsAndBlock.isSplatted(), isVCall, ignoreVisibility, false, argumentsAndBlock.getArguments());
translated = new RubyCallNode(context, sourceSection, node.getName(), receiverTranslated, argumentsAndBlock.getBlock(), argumentsAndBlock.isSplatted(), ignoreVisibility, false, argumentsAndBlock.getArguments());
}

// return instrumenter.instrumentAsCall(translated, node.getName());
@@ -855,7 +855,7 @@ public RubyNode visitFCallNode(org.jruby.ast.FCallNode node) {
final org.jruby.ast.Node receiver = new org.jruby.ast.SelfNode(node.getPosition());
final CallNode callNode = new CallNode(node.getPosition(), receiver, node.getName(), node.getArgsNode(), node.getIterNode());

return visitCallNodeExtraArgument(callNode, null, true, false);
return visitCallNodeExtraArgument(callNode, null, true);
}

@Override
@@ -2037,7 +2037,7 @@ public RubyNode visitVCallNode(org.jruby.ast.VCallNode node) {
final org.jruby.ast.Node args = null;
final CallNode callNode = new CallNode(node.getPosition(), receiver, node.getName(), args, null);

return visitCallNodeExtraArgument(callNode, null, true, true);
return visitCallNodeExtraArgument(callNode, null, true);
}

@Override
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/module/autoload_tags.txt
Original file line number Diff line number Diff line change
@@ -38,6 +38,3 @@ fails:Module#autoload (concurrently) blocks a second thread while a first is doi
fails:Module#autoload when changing $LOAD_PATH does not reload a file due to a different load path
fails:Module#autoload (concurrently) blocks others threads while doing an autoload
fails:Module#autoload does not call Kernel#require or Kernel#load dynamically
fails:Module#autoload raises a NameError when the constant name has a space in it
fails:Module#autoload raises a NameError when the constant name starts with a number
fails:Module#autoload raises a NameError when the constant name starts with a lower case letter
1 change: 0 additions & 1 deletion spec/truffle/tags/core/module/class_variable_set_tags.txt
Original file line number Diff line number Diff line change
@@ -4,4 +4,3 @@ fails:Module#class_variable_set sets the value of a class variable with the give
fails:Module#class_variable_set raises a RuntimeError when self is frozen
fails:Module#class_variable_set converts a non string/symbol/fixnum name to string using to_str
fails:Module#class_variable_set raises a TypeError when the given names can't be converted to strings using to_str
fails:Module#class_variable_set raises a NameError when the given name is not allowed
Original file line number Diff line number Diff line change
@@ -4,4 +4,3 @@ fails:Module#remove_class_variable removes a class variable defined in a metacla
fails:Module#remove_class_variable raises a NameError when passed a symbol with one leading @
fails:Module#remove_class_variable raises a NameError when passed a symbol with no leading @
fails:Module#remove_class_variable raises a NameError when an uninitialized class variable is given
fails:Module#remove_class_variable raises a NameError when removing class variable declared in included module
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/module/remove_const_tags.txt
Original file line number Diff line number Diff line change
@@ -4,7 +4,3 @@ fails:Module#remove_const raises a NameError if the name contains non-alphabetic
fails:Module#remove_const calls #to_str to convert the given name to a String
fails:Module#remove_const raises a TypeError if conversion to a String by calling #to_str fails
fails:Module#remove_const is a private method
fails:Module#remove_const raises a NameError if the name starts with a non-alphabetic character
fails:Module#remove_const raises a NameError if the name does not start with a capital letter
fails:Module#remove_const raises a NameError and does not call #const_missing if the constant is not defined directly in the module
fails:Module#remove_const raises a NameError and does not call #const_missing if the constant is not defined
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/string/dup_tags.txt
Original file line number Diff line number Diff line change
@@ -2,5 +2,3 @@ fails:String#dup calls #initialize_copy on the new instance
fails:String#dup copies instance variables
fails:String#dup does not modify the original string when changing dupped string
fails:String#dup does not copy constants defined in the singleton class
fails:String#dup does not copy modules included in the singleton class
fails:String#dup does not copy singleton methods