Skip to content

Commit

Permalink
Revert "Re-enable the implicit call protocol paths in CompiledIRBlock…
Browse files Browse the repository at this point in the history
…Body"

Since this is looking prettttty close now (1 failure in test:mri:jit),
I am re-enabling Charlie's fixes to turn off non-explicit-call-protocol
paths in CompiledIRBlockBody.

Note that if we turn off block call protocol again, this code should
again be re-enabled.

This reverts commit a968fc7.
subbuss committed Dec 19, 2015
1 parent 78f73ec commit f16350c
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions core/src/main/java/org/jruby/runtime/CompiledIRBlockBody.java
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ public ArgumentDescriptor[] getArgumentDescriptors() {

@Override
public boolean canCallDirect() {
return closure.hasExplicitCallProtocol();
return true;
}

@Override
@@ -58,44 +58,44 @@ protected IRubyObject yieldDirect(ThreadContext context, Block block, IRubyObjec
}
}

@Override
protected IRubyObject commonYieldPath(ThreadContext context, Block block, Block.Type type, IRubyObject[] args, IRubyObject self, Block blockArg) {
Binding binding = block.getBinding();
Visibility oldVis = binding.getFrame().getVisibility();
Frame prevFrame = context.preYieldNoScope(binding);

// SSS FIXME: Maybe, we should allocate a NoVarsScope/DummyScope for for-loop bodies because the static-scope here
// probably points to the parent scope? To be verified and fixed if necessary. There is no harm as it is now. It
// is just wasteful allocation since the scope is not used at all.
DynamicScope prevScope = binding.getDynamicScope();
if (this.pushScope) {
// SSS FIXME: for lambdas, this behavior is different
// compared to what InterpretedIRBlockBody and MixedModeIRBlockBody do
context.pushScope(DynamicScope.newDynamicScope(getStaticScope(), prevScope, this.evalType.get()));
} else if (this.reuseParentScope) {
// Reuse! We can avoid the push only if surrounding vars aren't referenced!
context.pushScope(prevScope);
}

self = IRRuntimeHelpers.updateBlockState(block, self);

if (usesKwargs) IRRuntimeHelpers.frobnicateKwargsArgument(context, getSignature().required(), args);

try {
return (IRubyObject) handle.invokeExact(context, block, getStaticScope(), self, args, blockArg, binding.getMethod(), block.type);
} catch (Throwable t) {
Helpers.throwException(t);
return null; // not reached
} finally {
// IMPORTANT: Do not clear eval-type in case this is reused in bindings!
// Ex: eval("...", foo.instance_eval { binding })
// The dyn-scope used for binding needs to have its eval-type set to INSTANCE_EVAL
binding.getFrame().setVisibility(oldVis);
if (this.pushScope || this.reuseParentScope) {
context.postYield(binding, prevFrame);
} else {
context.postYieldNoScope(prevFrame);
}
}
}
// @Override
// protected IRubyObject commonYieldPath(ThreadContext context, Block block, Block.Type type, IRubyObject[] args, IRubyObject self, Block blockArg) {
// Binding binding = block.getBinding();
// Visibility oldVis = binding.getFrame().getVisibility();
// Frame prevFrame = context.preYieldNoScope(binding);
//
// // SSS FIXME: Maybe, we should allocate a NoVarsScope/DummyScope for for-loop bodies because the static-scope here
// // probably points to the parent scope? To be verified and fixed if necessary. There is no harm as it is now. It
// // is just wasteful allocation since the scope is not used at all.
// DynamicScope prevScope = binding.getDynamicScope();
// if (this.pushScope) {
// // SSS FIXME: for lambdas, this behavior is different
// // compared to what InterpretedIRBlockBody and MixedModeIRBlockBody do
// context.pushScope(DynamicScope.newDynamicScope(getStaticScope(), prevScope, this.evalType.get()));
// } else if (this.reuseParentScope) {
// // Reuse! We can avoid the push only if surrounding vars aren't referenced!
// context.pushScope(prevScope);
// }
//
// self = IRRuntimeHelpers.updateBlockState(block, self);
//
// if (usesKwargs) IRRuntimeHelpers.frobnicateKwargsArgument(context, getSignature().required(), args);
//
// try {
// return (IRubyObject) handle.invokeExact(context, block, getStaticScope(), self, args, blockArg, binding.getMethod(), block.type);
// } catch (Throwable t) {
// Helpers.throwException(t);
// return null; // not reached
// } finally {
// // IMPORTANT: Do not clear eval-type in case this is reused in bindings!
// // Ex: eval("...", foo.instance_eval { binding })
// // The dyn-scope used for binding needs to have its eval-type set to INSTANCE_EVAL
// binding.getFrame().setVisibility(oldVis);
// if (this.pushScope || this.reuseParentScope) {
// context.postYield(binding, prevFrame);
// } else {
// context.postYieldNoScope(prevFrame);
// }
// }
// }
}

0 comments on commit f16350c

Please sign in to comment.