Skip to content

Commit

Permalink
Remove thread-local block type that no longer seems to be needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jul 10, 2018
1 parent 02e852a commit fbd727f
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 18 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Expand Up @@ -1747,7 +1747,7 @@ private static IRubyObject[] prepareBlockArgsInternal(ThreadContext context, Blo
args = IRubyObject.NULL_ARRAY;
}

boolean isProcCall = context.getCurrentBlockType() == Block.Type.PROC;
boolean isProcCall = block.type == Block.Type.PROC;
org.jruby.runtime.Signature sig = block.getBody().getSignature();
if (block.type == Block.Type.LAMBDA) {
if (!isProcCall && sig.arityValue() != -1 && sig.required() != 1) {
Expand Down Expand Up @@ -1832,7 +1832,7 @@ public static IRubyObject[] prepareSingleBlockArgs(ThreadContext context, Block
return args;
}

boolean isProcCall = context.getCurrentBlockType() == Block.Type.PROC;
boolean isProcCall = block.type == Block.Type.PROC;
if (isProcCall) {
if (args.length == 0) {
args = context.runtime.getSingleNilArray();
Expand All @@ -1853,7 +1853,7 @@ public static IRubyObject[] prepareFixedBlockArgs(ThreadContext context, Block b
args = IRubyObject.NULL_ARRAY;
}

boolean isProcCall = context.getCurrentBlockType() == Block.Type.PROC;
boolean isProcCall = block.type == Block.Type.PROC;
if (block.type == Block.Type.LAMBDA) {
org.jruby.runtime.Signature sig = block.getBody().getSignature();
// We don't need to check for the 1 required arg case here
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/runtime/CompiledIRBlockBody.java
Expand Up @@ -146,7 +146,6 @@ public MethodHandle getHandle() {

@Override
protected IRubyObject callDirect(ThreadContext context, Block block, IRubyObject[] args, Block blockArg) {
context.setCurrentBlockType(block.type);
try {
return (IRubyObject)handle.invokeExact(context, block, getStaticScope(), (IRubyObject)null, args, blockArg, block.getBinding().getMethod(), block.type);
} catch (Throwable t) {
Expand All @@ -157,8 +156,6 @@ protected IRubyObject callDirect(ThreadContext context, Block block, IRubyObject

@Override
protected IRubyObject yieldDirect(ThreadContext context, Block block, IRubyObject[] args, IRubyObject self) {
context.setCurrentBlockType(block.type);
// if (block.type != Block.Type.NORMAL) System.out.println("MISMATCH: " + getScope());
try {
return (IRubyObject)handle.invokeExact(context, block, getStaticScope(), self, args, Block.NULL_BLOCK, block.getBinding().getMethod(), block.type);
} catch (Throwable t) {
Expand Down
Expand Up @@ -95,14 +95,12 @@ public boolean canCallDirect() {

@Override
protected IRubyObject callDirect(ThreadContext context, Block block, IRubyObject[] args, Block blockArg) {
context.setCurrentBlockType(block.type);
InterpreterContext ic = ensureInstrsReady(); // so we get debugging output
return Interpreter.INTERPRET_BLOCK(context, block, null, ic, args, block.getBinding().getMethod(), blockArg);
}

@Override
protected IRubyObject yieldDirect(ThreadContext context, Block block, IRubyObject[] args, IRubyObject self) {
context.setCurrentBlockType(block.type);
InterpreterContext ic = ensureInstrsReady(); // so we get debugging output
return Interpreter.INTERPRET_BLOCK(context, block, self, ic, args, block.getBinding().getMethod(), Block.NULL_BLOCK);
}
Expand Down
Expand Up @@ -113,7 +113,6 @@ protected IRubyObject callDirect(ThreadContext context, Block block, IRubyObject
// We should never get here if jittedBody is null
assert jittedBody != null : "direct call in MixedModeIRBlockBody without jitted body";

context.setCurrentBlockType(block.type);
return jittedBody.callDirect(context, block, args, blockArg);
}

Expand All @@ -122,7 +121,6 @@ protected IRubyObject yieldDirect(ThreadContext context, Block block, IRubyObjec
// We should never get here if jittedBody is null
assert jittedBody != null : "direct yield in MixedModeIRBlockBody without jitted body";

context.setCurrentBlockType(block.type);
return jittedBody.yieldDirect(context, block, args, self);
}

Expand Down
8 changes: 0 additions & 8 deletions core/src/main/java/org/jruby/runtime/ThreadContext.java
Expand Up @@ -257,14 +257,6 @@ public IRubyObject setErrorInfo(IRubyObject errorInfo) {
return errorInfo;
}

public Block.Type getCurrentBlockType() {
return currentBlockType;
}

public void setCurrentBlockType(Block.Type type) {
currentBlockType = type;
}

public Throwable getSavedExceptionInLambda() {
return savedExcInLambda;
}
Expand Down

0 comments on commit fbd727f

Please sign in to comment.