Skip to content

Commit

Permalink
[Truffle] Fix Method#to_proc rather than adding a condition in instan…
Browse files Browse the repository at this point in the history
…ce_exec.
  • Loading branch information
eregon committed Mar 18, 2015
1 parent 83f583d commit af8184e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Expand Up @@ -225,8 +225,6 @@ public Object instanceEval(VirtualFrame frame, Object receiver, UndefinedPlaceho
@CoreMethod(names = "instance_exec", needsBlock = true, argumentsAsArray = true)
public abstract static class InstanceExecNode extends YieldingCoreMethodNode {

private final ConditionProfile rubyMethodProfile = ConditionProfile.createBinaryProfile();

public InstanceExecNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
Expand All @@ -239,10 +237,6 @@ public InstanceExecNode(InstanceExecNode prev) {
public Object instanceExec(VirtualFrame frame, Object receiver, Object[] arguments, RubyProc block) {
notDesignedForCompilation();

if (rubyMethodProfile.profile(block.getSelfCapturedInScope() instanceof RubyMethod)) {
return yield(frame, block, arguments);
}

return yieldWithModifiedSelf(frame, block, receiver, arguments);
}

Expand Down
3 changes: 2 additions & 1 deletion truffle/src/main/ruby/core/shims.rb
Expand Up @@ -145,8 +145,9 @@ def _offset_to_milliseconds
class Method

def to_proc
meth = self
proc { |*args|
self.call(*args)
meth.call(*args)
}
end

Expand Down

0 comments on commit af8184e

Please sign in to comment.