Class CloneInfo

java.lang.Object
org.jruby.ir.transformations.inlining.CloneInfo
Direct Known Subclasses:
InlineCloneInfo, SimpleCloneInfo

public abstract class CloneInfo extends Object
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 Details

  • Constructor Details

    • CloneInfo

      protected CloneInfo(IRScope scope)
  • Method Details

    • cloneForCloningClosure

      public SimpleCloneInfo cloneForCloningClosure(IRClosure clonedClosure)
    • getScope

      public IRScope getScope()
      Returns:
      The IRScope this cloning operation is happening in (or is coming from).
    • getRenamedLabelSimple

      protected abstract Label getRenamedLabelSimple(Label l)
    • getRenamedLabel

      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 - to be renamed.
      Returns:
      the new Label
    • getRenamedSelfVariable

      protected abstract Variable getRenamedSelfVariable(Variable self)
      How do we rename %self?
      Parameters:
      self - to be renamed
      Returns:
      the new self or itself
    • getRenamedVariableSimple

      protected abstract Variable getRenamedVariableSimple(Variable variable)
      How are typical variables renamed if they were not yet found in the variable renaming map?
      Parameters:
      variable - to be renamed
      Returns:
      the new variable
    • getRenamedVariable

      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 - to be renamed
      Returns:
      the new Variable