Top Description Fields Constructors Methods
org.jruby.ir.transformations.inlining

public abstract Class CloneInfo

extends Object
Class Inheritance
Known Direct Subclasses
org.jruby.ir.transformations.inlining.InlineCloneInfo, org.jruby.ir.transformations.inlining.SimpleCloneInfo
Imports
java.util.HashMap, .Map, org.jruby.ir.IRClosure, .IRScope, org.jruby.ir.operands.Label, .Self, .Variable

Base class for cloning context object. Simple cloning and inline cloning both have some common state and logic such as needing to maintain references to new constructed replacement labels and variables.

Field Summary

Modifier and TypeField and Description
protected final Map<Label, Label>
protected final IRScope
protected final Map<Variable, Variable>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public SimpleCloneInfo
public Label

Returns:

the new Label
getRenamedLabel
(Label
to be renamed.
label
)

Return a new instance of a label for the newly cloned scope.

protected abstract Label
protected abstract Variable

Returns:

the new self or itself
getRenamedSelfVariable
(Variable
to be renamed
self
)

How do we rename %self?

public Variable

Returns:

the new Variable
getRenamedVariable
(Variable
to be renamed
variable
)

Return a new instance of a variable for the newly cloned scope.

protected abstract Variable

Returns:

the new variable
getRenamedVariableSimple
(Variable
to be renamed
variable
)

How are typical variables renamed if they were not yet found in the variable renaming map?

public IRScope

Returns:

The IRScope this cloning operation is happening in (or is coming from).
getScope
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

labelRenameMapback to summary
protected final Map<Label, Label> labelRenameMap
scopeback to summary
protected final IRScope scope
variableRenameMapback to summary
protected final Map<Variable, Variable> variableRenameMap

Constructor Detail

CloneInfoback to summary
protected CloneInfo(IRScope scope)

Method Detail

cloneForCloningClosureback to summary
public SimpleCloneInfo cloneForCloningClosure(IRClosure clonedClosure)
getRenamedLabelback to summary
public Label getRenamedLabel(Label label)

Return a new instance of a label for the newly cloned scope. Maps are maintained because Labels expect to share the same instance across a CFG.

Parameters
label:Label

to be renamed.

Returns:Label

the new Label

getRenamedLabelSimpleback to summary
protected abstract Label getRenamedLabelSimple(Label l)
getRenamedSelfVariableback to summary
protected abstract Variable getRenamedSelfVariable(Variable self)

How do we rename %self?

Parameters
self:Variable

to be renamed

Returns:Variable

the new self or itself

getRenamedVariableback to summary
public Variable getRenamedVariable(Variable variable)

Return a new instance of a variable for the newly cloned scope. Maps are maintained because Variables typically share the same instance across a CFG (of the same lexical depth).

Parameters
variable:Variable

to be renamed

Returns:Variable

the new Variable

getRenamedVariableSimpleback to summary
protected abstract Variable getRenamedVariableSimple(Variable variable)

How are typical variables renamed if they were not yet found in the variable renaming map?

Parameters
variable:Variable

to be renamed

Returns:Variable

the new variable

getScopeback to summary
public IRScope getScope()
Returns:IRScope

The IRScope this cloning operation is happening in (or is coming from).