Top Fields Constructors Methods
org.jruby.ir

public Class IRClosure

extends IRScope
Class Inheritance
Known Direct Subclasses
org.jruby.ir.IREvalScript, org.jruby.ir.IRFor
Imports
java.util.ArrayList, .EnumSet, .List, java.util.function.Supplier, org.jruby.RubySymbol, org.jruby.ast.DefNode, .IterNode, org.jruby.ext.coverage.CoverageData, org.jruby.ir.builder.LazyMethodDefinitionAST, org.jruby.ir.instructions.*, org.jruby.ir.interpreter.ClosureInterpreterContext, .InterpreterContext, org.jruby.ir.operands.*, org.jruby.ir.persistence.IRWriter, .IRWriterEncoder, org.jruby.ir.transformations.inlining.CloneInfo, .SimpleCloneInfo, org.jruby.parser.StaticScope, org.jruby.runtime.ArgumentDescriptor, .BlockBody, .Helpers, .IRBlockBody, .MixedModeIRBlockBody, .InterpretedIRBlockBody, .Signature, org.jruby.util.ByteList

Field Summary

Modifier and TypeField and Description
protected ArgumentDescriptor[]
private IRBlockBody
body

Added for interp/JIT purposes

private static final ByteList
private static final ByteList
public final int
private boolean
private Signature
private IterNode
Inherited from org.jruby.ir.IRScope:
compilablefullInterpreterContextinterpreterContextlocalVarsLOGnextClosureIndexoptimizedInterpreterContext

Constructor Summary

AccessConstructor and Description
protected
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, ByteList prefix, int coverageMode)

protected
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, ByteList prefix)

protected
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, int closureId, ByteList fullName)

protected
IRClosure(IRClosure c, IRScope lexicalParent, int closureId, ByteList fullName)

Used by cloning code for inlining

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature)

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, int coverageMode)

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, int coverageMode)

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix)

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, boolean isBeginEndBlock)

public
IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, boolean isBeginEndBlock, int coverageMode)

Method Summary

Modifier and TypeMethod and Description
public InterpreterContext
allocateInterpreterContext(List<Instr> instructions, int temporaryVariableCount, EnumSet<IRFlags> flags)

Overrides org.jruby.ir.IRScope.allocateInterpreterContext.

Make version specific to scope which needs it (e.g. Closure vs non-closure).

public InterpreterContext
allocateInterpreterContext(Supplier<List<Instr>> instructions, int temporaryVariableCount, EnumSet<IRFlags> flags)

Overrides org.jruby.ir.IRScope.allocateInterpreterContext.

Make version specific to scope which needs it (e.g. Closure vs non-closure).

protected IRClosure
public IRClosure
public IRMethod
protected LocalVariable
public ArgumentDescriptor[]
public BlockBody
public LocalVariable
getLocalVariable(RubySymbol name, int depth)

Overrides org.jruby.ir.IRScope.getLocalVariable.

Find or create a local variable.

public Label
public LocalVariable
public int
public IRScopeType
public Signature
public boolean
public boolean
public boolean
public boolean
public void
public void
setArgumentDescriptors(ArgumentDescriptor[] argDesc)

Set upon completion of IRBuild of this IRClosure.

public void
public void
public void
public String
Inherited from org.jruby.ir.IRScope:
accessesParentsLocalVariablesaddChildScopeaddClosureallocateInitialFlagsanyUsesEvalbuildJVMExceptionTablebuiltInterpreterContextcanCaptureCallersBindingcanReceiveBreakscanReceiveNonlocalReturnscaptureParentRefinementscleanupAfterExecutioncorrectVariableDepthForForLoopsForEncodingdebugOutputdependsdumpToIGVequalsexecutesOncegetASTgetByteNamegetClosuresgetCoverageModegetDynamicScopegetEncodinggetExecutedPassesgetExecutionContextgetFilegetFileNamegetFullInterpreterContextgetFullyQualifiedNamegetIdgetInterpreterContextgetLexicalParentgetLexicalScopesgetLinegetLineNumbergetLocalVariablesgetManagergetNamegetNearestMethodgetNearestModuleReferencingScopeDepthgetNearestNonClosurelikeScopegetNearestTopLocalVariableScopegetNewLabelgetNextLabelIndexgetOptimizedInterpreterContextgetRootLexicalScopegetScopeIdgetSelfgetStaticScopehasBeenBuilthasBreakInstructionshasFlipFlopshashCodehasLoopshasNonLocalReturnsinlineMethodinlineMethodCompiledinlineMethodJITinliningAllowedisModuleBodyisNestedInClosureisNonSingletonClassBodyisRuby2KeywordsisScopeContainedByisScriptScopeisWithinENDlookupExistingLVarmaybeUsingRefinementsneedsCodeCoverageparentMaybeUsingRefinementspersistScopeFlagsprepareForCompilationprepareFullBuildreceivesClosureArgreceivesKeywordArgsremoveClosuresetAccessesParentsLocalVariablessetByteNamesetCanCaptureCallersBindingsetCanReceiveBreakssetCanReceiveNonlocalReturnssetCoverageModesetFileNamesetHasBreakInstructionssetHasFlipFlopssetHasLoopssetHasNonLocalReturnssetIsMaybeUsingRefinementssetNeedsCodeCoveragesetNextLabelIndexsetReceivesClosureArgsetReceivesKeywordArgssetRuby2KeywordssetUsesEvalsetUsesSupersetUsesZSupertoStringtoStringCompileFormtoStringInstrsusesEvalusesSuperusesZSuper

Field Detail

argDescback to summary
protected ArgumentDescriptor[] argDesc
bodyback to summary
private IRBlockBody body

Added for interp/JIT purposes

CLOSUREback to summary
private static final ByteList CLOSURE
CLOSURE_CLONEback to summary
private static final ByteList CLOSURE_CLONE
closureIdback to summary
public final int closureId
isENDback to summary
private boolean isEND
signatureback to summary
private Signature signature
sourceback to summary
private IterNode source

Constructor Detail

IRClosureback to summary
protected IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, ByteList prefix, int coverageMode)
IRClosureback to summary
protected IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, ByteList prefix)
IRClosureback to summary
protected IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, int closureId, ByteList fullName)
IRClosureback to summary
protected IRClosure(IRClosure c, IRScope lexicalParent, int closureId, ByteList fullName)

Used by cloning code for inlining

IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature)
IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, int coverageMode)
IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, int coverageMode)
IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix)
IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, boolean isBeginEndBlock)
IRClosureback to summary
public IRClosure(IRManager manager, IRScope lexicalParent, int lineNumber, StaticScope staticScope, Signature signature, ByteList prefix, boolean isBeginEndBlock, int coverageMode)

Method Detail

allocateInterpreterContextback to summary
public InterpreterContext allocateInterpreterContext(List<Instr> instructions, int temporaryVariableCount, EnumSet<IRFlags> flags)

Overrides org.jruby.ir.IRScope.allocateInterpreterContext.

Doc from org.jruby.ir.IRScope.allocateInterpreterContext.

Make version specific to scope which needs it (e.g. Closure vs non-closure).

Annotations
@Override
allocateInterpreterContextback to summary
public InterpreterContext allocateInterpreterContext(Supplier<List<Instr>> instructions, int temporaryVariableCount, EnumSet<IRFlags> flags)

Overrides org.jruby.ir.IRScope.allocateInterpreterContext.

Doc from org.jruby.ir.IRScope.allocateInterpreterContext.

Make version specific to scope which needs it (e.g. Closure vs non-closure).

Annotations
@Override
cloneForInliningback to summary
protected IRClosure cloneForInlining(CloneInfo ii, IRClosure clone)
cloneForInliningback to summary
public IRClosure cloneForInlining(CloneInfo ii)
convertToMethodback to summary
public IRMethod convertToMethod(ByteList name)
findExistingLocalVariableback to summary
protected LocalVariable findExistingLocalVariable(RubySymbol name, int scopeDepth)

Overrides org.jruby.ir.IRScope.findExistingLocalVariable.

Annotations
@Override
getArgumentDescriptorsback to summary
public ArgumentDescriptor[] getArgumentDescriptors()
getBlockBodyback to summary
public BlockBody getBlockBody()
getLocalVariableback to summary
public LocalVariable getLocalVariable(RubySymbol name, int depth)

Overrides org.jruby.ir.IRScope.getLocalVariable.

Doc from org.jruby.ir.IRScope.getLocalVariable.

Find or create a local variable. By default, scopes are assumed to only check current depth. Blocks/Closures override this because they have special nesting rules.

Annotations
@Override
getNewLabelback to summary
public Label getNewLabel()

Overrides org.jruby.ir.IRScope.getNewLabel.

Annotations
@Override
getNewLocalVariableback to summary
public LocalVariable getNewLocalVariable(RubySymbol name, int depth)

Overrides org.jruby.ir.IRScope.getNewLocalVariable.

getNextClosureIdback to summary
public int getNextClosureId()

Overrides org.jruby.ir.IRScope.getNextClosureId.

Annotations
@Override
getScopeTypeback to summary
public IRScopeType getScopeType()

Implements abstract org.jruby.ir.IRScope.getScopeType.

Annotations
@Override
getSignatureback to summary
public Signature getSignature()
isENDback to summary
public boolean isEND()
isNestedClosuresSafeForMethodConversionback to summary
public boolean isNestedClosuresSafeForMethodConversion()
isTopLocalVariableScopeback to summary
public boolean isTopLocalVariableScope()

Overrides org.jruby.ir.IRScope.isTopLocalVariableScope.

Annotations
@Override
isWhereFlipFlopStateVariableIsback to summary
public boolean isWhereFlipFlopStateVariableIs()

Overrides org.jruby.ir.IRScope.isWhereFlipFlopStateVariableIs.

persistScopeHeaderback to summary
public void persistScopeHeader(IRWriterEncoder file)

Overrides org.jruby.ir.IRScope.persistScopeHeader.

setArgumentDescriptorsback to summary
public void setArgumentDescriptors(ArgumentDescriptor[] argDesc)

Set upon completion of IRBuild of this IRClosure.

setIsENDback to summary
public void setIsEND()
setSignatureback to summary
public void setSignature(Signature signature)
setSourceback to summary
public void setSource(IterNode iter)
toStringBodyback to summary
public String toStringBody()