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: cca4a33ae680
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f5a0db9dc639
Choose a head ref
  • 2 commits
  • 11 files changed
  • 1 contributor

Commits on Dec 30, 2015

  1. Copy the full SHA
    5469c41 View commit details
  2. Copy the full SHA
    f5a0db9 View commit details
1 change: 1 addition & 0 deletions spec/truffle/tags/language/predefined_tags.txt
Original file line number Diff line number Diff line change
@@ -9,3 +9,4 @@ windows:The predefined global constant STDERR has the encodings set by #set_enco
fails:Predefined global $_ is set to the last line read by e.g. StringIO#gets
fails:Predefined global $_ is set at the method-scoped level rather than block-scoped
fails:Global variable $0 actually sets the program name
slow:The predefined global constant ARGV contains Strings encoded in locale Encoding
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
import org.jruby.truffle.nodes.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.nodes.objects.AllocateObjectNode;
import org.jruby.truffle.nodes.objects.AllocateObjectNodeGen;
import org.jruby.truffle.nodes.supercall.GeneralSuperReCallNode;
import org.jruby.truffle.nodes.supercall.SuperCallNode;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
import org.jruby.truffle.runtime.ModuleOperations;
import org.jruby.truffle.runtime.NotProvided;
@@ -222,8 +222,8 @@ private Object methodMissing(Object self, DynamicObject nameObject, Object[] arg
}

private boolean lastCallWasSuper() {
final GeneralSuperReCallNode callNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), GeneralSuperReCallNode.class);
return callNode != null;
final SuperCallNode superCallNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), SuperCallNode.class);
return superCallNode != null;
}

/**
Original file line number Diff line number Diff line change
@@ -1284,11 +1284,7 @@ public CallMethodMissingWithStaticName(RubyContext context, SourceSection source
@Override
public Object execute(VirtualFrame frame) {
final Object[] originalUserArguments = RubyArguments.extractUserArguments(frame.getArguments());
final Object[] newUserArguments = new Object[originalUserArguments.length + 1];

newUserArguments[0] = methodName;
System.arraycopy(originalUserArguments, 0, newUserArguments, 1, originalUserArguments.length);

final Object[] newUserArguments = ArrayUtils.unshift(originalUserArguments, methodName);
return methodMissing.call(frame, RubyArguments.getSelf(frame.getArguments()), "method_missing", RubyArguments.getBlock(frame.getArguments()), newUserArguments);
}
}
Original file line number Diff line number Diff line change
@@ -101,10 +101,7 @@ public Object executeDispatch(
switch (getDispatchAction()) {
case CALL_METHOD:
// When calling #method_missing we need to prepend the symbol

final Object[] modifiedArgumentsObjects = new Object[1 + argumentsObjects.length];
modifiedArgumentsObjects[0] = getCachedNameAsSymbol();
ArrayUtils.arraycopy(argumentsObjects, 0, modifiedArgumentsObjects, 1, argumentsObjects.length);
final Object[] modifiedArgumentsObjects = ArrayUtils.unshift(argumentsObjects, getCachedNameAsSymbol());

return call(callNode, frame, method, receiverObject, blockObject, modifiedArgumentsObjects);

Original file line number Diff line number Diff line change
@@ -98,9 +98,8 @@ public Object executeDispatch(
}

if (dispatchAction == DispatchAction.CALL_METHOD) {
final Object[] modifiedArgumentsObjects = new Object[1 + argumentsObjects.length];
modifiedArgumentsObjects[0] = toSymbolNode.executeRubySymbol(frame, name);
ArrayUtils.arraycopy(argumentsObjects, 0, modifiedArgumentsObjects, 1, argumentsObjects.length);
final DynamicObject nameSymbol = toSymbolNode.executeRubySymbol(frame, name);
final Object[] modifiedArgumentsObjects = ArrayUtils.unshift(argumentsObjects, nameSymbol);

return call(frame, missingMethod, receiverObject, blockObject, modifiedArgumentsObjects);
} else if (dispatchAction == DispatchAction.RESPOND_TO_METHOD) {

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes.supercall;

import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.ArrayOperations;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;

/**
* Get the arguments of a super call with explicit arguments.
*/
public class ReadSuperArgumentsNode extends RubyNode {

@Children private final RubyNode[] arguments;
private final boolean isSplatted;

public ReadSuperArgumentsNode(RubyContext context, SourceSection sourceSection, RubyNode[] arguments, boolean isSplatted) {
super(context, sourceSection);
assert !isSplatted || arguments.length == 1;
this.arguments = arguments;
this.isSplatted = isSplatted;
}

@ExplodeLoop
@Override
public final Object execute(VirtualFrame frame) {
CompilerAsserts.compilationConstant(arguments.length);

// Execute the arguments
final Object[] argumentsObjects = new Object[arguments.length];
for (int i = 0; i < arguments.length; i++) {
argumentsObjects[i] = arguments[i].execute(frame);
}

if (isSplatted) {
// TODO(CS): need something better to splat the arguments array
return ArrayOperations.toObjectArray((DynamicObject) argumentsObjects[0]);
} else {
return argumentsObjects;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.nodes.supercall;

import java.util.Arrays;

import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.array.ArrayUtils;
import org.jruby.truffle.runtime.core.ArrayOperations;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;

/**
* Get the arguments of a super call with implicit arguments (using the ones of the surrounding method).
*/
public class ReadZSuperArgumentsNode extends RubyNode {

private final boolean hasRestParameter;
@Children private final RubyNode[] reloadNodes;

public ReadZSuperArgumentsNode(RubyContext context, SourceSection sourceSection, boolean hasRestParameter, RubyNode[] reloadNodes) {
super(context, sourceSection);
this.hasRestParameter = hasRestParameter;
this.reloadNodes = reloadNodes;

}

@ExplodeLoop
@Override
public final Object execute(VirtualFrame frame) {
CompilerAsserts.compilationConstant(reloadNodes.length);

// Reload the arguments
Object[] superArguments = new Object[reloadNodes.length];
for (int n = 0; n < superArguments.length; n++) {
superArguments[n] = reloadNodes[n].execute(frame);
}

if (hasRestParameter) {
CompilerDirectives.transferToInterpreter();
// TODO (eregon, 22 July 2015): Assumes rest arg is last, not true if post or keyword args.
final Object restArg = superArguments[superArguments.length - 1];
assert RubyGuards.isRubyArray(restArg);
final Object[] restArgs = ArrayOperations.toObjectArray((DynamicObject) restArg);
final int restArgIndex = reloadNodes.length - 1;
superArguments = Arrays.copyOf(superArguments, restArgIndex + restArgs.length);
ArrayUtils.arraycopy(restArgs, 0, superArguments, restArgIndex, restArgs.length);
}

return superArguments;
}

}
Loading