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

Commits on Aug 10, 2016

  1. Copy the full SHA
    02ecc11 View commit details
  2. [Truffle] not let BasicObject#method_missing be fooled

    by overriding implementation of method_missing calling
    BasicObject#method_missing by super keyword.
    pitr-ch committed Aug 10, 2016
    Copy the full SHA
    698731a View commit details
  3. Copy the full SHA
    15979a8 View commit details
  4. Copy the full SHA
    edf4302 View commit details
  5. 3
    Copy the full SHA
    175cdf6 View commit details
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/ext/thread/Mutex.java
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
* rights and limitations under the License.
*
* Copyright (C) 2006 MenTaLguY <mental@rydia.net>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -108,7 +108,7 @@ public synchronized IRubyObject unlock(ThreadContext context) {
if (!lock.isHeldByCurrentThread()) {
throw runtime.newThreadError("Mutex is not owned by calling thread");
}

boolean hasQueued = lock.hasQueuedThreads();
context.getThread().unlock(lock);
return hasQueued ? context.nil : this;
@@ -148,7 +148,7 @@ public IRubyObject sleep(ThreadContext context, IRubyObject timeout) {
public IRubyObject synchronize(ThreadContext context, Block block) {
lock(context);
try {
return block.yield(context, null);
return block.call(context);
} finally {
unlock(context);
}
@@ -164,5 +164,5 @@ private void checkRelocking(ThreadContext context) {
throw context.runtime.newThreadError("Mutex relocking by same thread");
}
}

}
Original file line number Diff line number Diff line change
@@ -68,6 +68,3 @@ ActionController::LiveStreamTest:
- test_exception_callback_when_committed
- test_async_stream # fails on travis
- test_abort_with_full_buffer # fails intermittently on CI
ApplicationIntegrationTest:
- test_missing_route_helper_after_controller_access
- test_missing_route_helper_before_controller_access
2 changes: 1 addition & 1 deletion lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -400,7 +400,7 @@ def initialize(argv, options = {})

def run
Dir.chdir @options[:global][:dir] do
log "executing #{@subcommand}"
log format 'executing "%s" command', @subcommand
send "subcommand_#{@subcommand}", @argv_after_subcommand
end
end
Original file line number Diff line number Diff line change
@@ -14,8 +14,12 @@
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.CreateCast;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameInstance;
import com.oracle.truffle.api.frame.FrameInstanceVisitor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.IndirectCallNode;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeUtil;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.Source;
@@ -37,6 +41,7 @@
import org.jruby.truffle.language.NotProvided;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.RubyRootNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DispatchHeadNodeFactory;
@@ -47,7 +52,6 @@
import org.jruby.truffle.language.methods.InternalMethod;
import org.jruby.truffle.language.methods.UnsupportedOperationBehavior;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
import org.jruby.truffle.language.parser.ParserContext;
import org.jruby.truffle.language.supercall.SuperCallNode;
import org.jruby.truffle.language.yield.YieldNode;
@@ -311,20 +315,45 @@ private Object methodMissing(Object self, DynamicObject nameObject, Object[] arg
@TruffleBoundary
private DynamicObject buildMethodMissingException(Object self, DynamicObject nameObject, Object[] args, DynamicObject block) {
final String name = nameObject.toString();
final FrameInstance relevantCallerFrame = getRelevantCallerFrame();

if (lastCallWasSuper()) {
if (lastCallWasSuper(relevantCallerFrame)) {
return coreExceptions().noSuperMethodError(name, self, args, this);
} else if (lastCallWasCallingPrivateMethod(self, name)) {
return coreExceptions().privateMethodError(name, self, args, this);
} else if (lastCallWasVCall()) {
} else if (lastCallWasVCall(relevantCallerFrame)) {
return coreExceptions().nameErrorUndefinedLocalVariableOrMethod(name, self, this);
} else {
return coreExceptions().noMethodErrorOnReceiver(name, self, args, this);
}
}

private boolean lastCallWasSuper() {
final SuperCallNode superCallNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), SuperCallNode.class);
private FrameInstance getRelevantCallerFrame() {
return Truffle.getRuntime().iterateFrames(new FrameInstanceVisitor<FrameInstance>() {
@Override
public FrameInstance visitFrame(FrameInstance frameInstance) {
final Node callNode = frameInstance.getCallNode();
if (callNode == null) {
// skip current frame
return null;
}

final SuperCallNode superCallNode = NodeUtil.findParent(callNode, SuperCallNode.class);
final Frame frame = frameInstance.getFrame(FrameInstance.FrameAccess.READ_ONLY, true);
final String superMethodName = RubyArguments.getMethod(frame).getName();

if (superCallNode != null && superMethodName.equals("method_missing")) {
// skip super calls of method_missing itself
return null;
}

return frameInstance;
}
});
}

private boolean lastCallWasSuper(FrameInstance callerFrame) {
final SuperCallNode superCallNode = NodeUtil.findParent(callerFrame.getCallNode(), SuperCallNode.class);
return superCallNode != null;
}

@@ -337,8 +366,8 @@ private boolean lastCallWasCallingPrivateMethod(Object self, String name) {
return method != null && !method.isUndefined();
}

private boolean lastCallWasVCall() {
final RubyCallNode callNode = NodeUtil.findParent(Truffle.getRuntime().getCallerFrame().getCallNode(), RubyCallNode.class);
private boolean lastCallWasVCall(FrameInstance callerFrame) {
final RubyCallNode callNode = NodeUtil.findParent(callerFrame.getCallNode(), RubyCallNode.class);
return callNode != null && callNode.isVCall();
}

Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ public SuperCallNode(RubyContext context, SourceSection sourceSection, RubyNode
this.callMethodNode = CallInternalMethodNodeGen.create(context, sourceSection, null, new RubyNode[] {});
}

@ExplodeLoop
@Override
public final Object execute(VirtualFrame frame) {
final Object self = RubyArguments.getSelf(frame);