Class

scala.tools.nsc.backend.icode.BasicBlocks

BasicBlock

Related Doc: package BasicBlocks

Permalink

class BasicBlock extends ProgramPoint[ICodes.BasicBlock]

This class represents a basic block. Each basic block contains a list of instructions that are either executed all, or none. No jumps to/from the "middle" of the basic block are allowed (modulo exceptions).

Self Type
ICodes.BasicBlock
Source
BasicBlocks.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BasicBlock
  2. ProgramPoint
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BasicBlock(label: Int, method: ICodes.IMethod)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink

    Test two objects for inequality.

    Test two objects for inequality.

    returns

    true if !(this == that), false otherwise.

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink

    Equivalent to x.hashCode except for boxed numeric types and null.

    Equivalent to x.hashCode except for boxed numeric types and null. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to any2stringadd[ICodes.BasicBlock] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ICodes.BasicBlock, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to ArrowAssoc[ICodes.BasicBlock] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    AnyRef → Any
  6. def apply(n: Int): ICodes.Instruction

    Permalink

    Return the n-th instruction.

  7. final def asInstanceOf[T0]: T0

    Permalink

    Cast the receiver object to be of type T0.

    Cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expression List(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

    the receiver object.

    Definition Classes
    Any
    Exceptions thrown

    ClassCastException if the receiver object is not an instance of the erasure of type T0.

  8. def blockContents: String

    Permalink
  9. def clear(): Unit

    Permalink
  10. def clone(): AnyRef

    Permalink

    Create a copy of the receiver object.

    Create a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
    Note

    not specified by SLS as a member of AnyRef

  11. def close(): Unit

    Permalink

    Close the block

  12. def closeWith(instr: ICodes.Instruction, pos: Global.Position): Unit

    Permalink
  13. def closeWith(instr: ICodes.Instruction): Unit

    Permalink

    do nothing if block is already closed

  14. def closed: Boolean

    Permalink

    Is this block closed?

  15. def closed_=(b: Boolean): Unit

    Permalink
  16. def code: ICodes.Code

    Permalink
  17. def directSuccessors: List[ICodes.BasicBlock]

    Permalink
  18. def emit(is: Seq[ICodes.Instruction]): Unit

    Permalink
  19. def emit(instr: ICodes.Instruction, pos: Global.Position): Unit

    Permalink

    Emitting does not set touched to true.

    Emitting does not set touched to true. During code generation this is a hotspot and setting the flag for each emit is a waste. Caching should happen only after a block is closed, which sets the DIRTYSUCCS flag.

  20. def emit(instr: ICodes.Instruction): Unit

    Permalink

    Add a new instruction at the end of the block, using the same source position as the last emitted instruction

  21. def emitOnly(is: ICodes.Instruction*): Unit

    Permalink

    The semantics of this are a little odd but it's designed to work seamlessly with the existing code.

    The semantics of this are a little odd but it's designed to work seamlessly with the existing code. It emits each supplied instruction, then closes the block. The odd part is that if the instruction has pos == NoPosition, it calls the 1-arg emit, but otherwise it calls the 2-arg emit. This way I could retain existing behavior exactly by calling setPos on any instruction using the two arg version which I wanted to include in a call to emitOnly.

  22. def ensuring(cond: (ICodes.BasicBlock) ⇒ Boolean, msg: ⇒ Any): ICodes.BasicBlock

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to Ensuring[ICodes.BasicBlock] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. def ensuring(cond: (ICodes.BasicBlock) ⇒ Boolean): ICodes.BasicBlock

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to Ensuring[ICodes.BasicBlock] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  24. def ensuring(cond: Boolean, msg: ⇒ Any): ICodes.BasicBlock

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to Ensuring[ICodes.BasicBlock] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  25. def ensuring(cond: Boolean): ICodes.BasicBlock

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to Ensuring[ICodes.BasicBlock] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. def enterIgnoreMode(): Unit

    Permalink

    Enter ignore mode: new 'emit'ted instructions will not be added to this basic block.

    Enter ignore mode: new 'emit'ted instructions will not be added to this basic block. It makes the generation of THROW and RETURNs easier.

  27. final def eq(arg0: AnyRef): Boolean

    Permalink

    Tests whether the argument (that) is a reference to the receiver object (this).

    Tests whether the argument (that) is a reference to the receiver object (this).

    The eq method implements an equivalence relation on non-null instances of AnyRef, and has three additional properties:

    • It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false.
    • For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.
    • null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  28. def equals(other: Any): Boolean

    Permalink

    The equality method for reference types.

    The equality method for reference types. Default implementation delegates to eq.

    See also equals in scala.Any.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    Definition Classes
    BasicBlock → AnyRef → Any
  29. def exceptionHandlerStart: Boolean

    Permalink

    Is this block the start block of an exception handler?

    Is this block the start block of an exception handler?

    Definition Classes
    BasicBlockProgramPoint
  30. def exceptionHandlerStart_=(b: Boolean): Unit

    Permalink
  31. def exceptionSuccessors: List[ICodes.BasicBlock]

    Permalink
  32. def exceptionSuccessorsForBlock(block: ICodes.BasicBlock): List[ICodes.BasicBlock]

    Permalink
  33. def finalize(): Unit

    Permalink

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the finalize method is invoked, as well as the interaction between finalize and non-local returns and exceptions, are all platform dependent.

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
    Note

    not specified by SLS as a member of AnyRef

  34. def flagsString: String

    Permalink
  35. final def foreach[U](f: (ICodes.Instruction) ⇒ U): Unit

    Permalink

    Apply a function to all the instructions of the block.

  36. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to StringFormat[ICodes.BasicBlock] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  37. def fromList(is: List[ICodes.Instruction]): Unit

    Permalink
  38. def fullString: String

    Permalink
  39. def getArray: Array[ICodes.Instruction]

    Permalink

    return the underlying array of instructions

  40. final def getClass(): Class[_]

    Permalink

    A representation that corresponds to the dynamic class of the receiver object.

    A representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    Definition Classes
    AnyRef → Any
    Note

    not specified by SLS as a member of AnyRef

  41. def hasFlag(flag: Int): Boolean

    Permalink

    Does this block have the given flag?

  42. def hashCode(): Int

    Permalink

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in scala.Any.

    returns

    the hash code value for this object.

    Definition Classes
    BasicBlock → AnyRef → Any
  43. def ignore: Boolean

    Permalink

    When set, the emit methods will be ignored.

  44. def ignore_=(b: Boolean): Unit

    Permalink
  45. def indexOf(inst: ICodes.Instruction): Int

    Permalink

    Return the index of inst.

    Return the index of inst. Uses reference equality. Returns -1 if not found.

  46. final def isEmpty: Boolean

    Permalink
  47. final def isInstanceOf[T0]: Boolean

    Permalink

    Test whether the dynamic type of the receiver object is T0.

    Test whether the dynamic type of the receiver object is T0.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression 1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    Definition Classes
    Any
  48. def iterator: Iterator[ICodes.Instruction]

    Permalink

    Return an iterator over the instructions in this basic block.

  49. def killIf(cond: Boolean): Unit

    Permalink

    if cond is true, closes this block, entersIgnoreMode, and removes the block from its list of blocks.

    if cond is true, closes this block, entersIgnoreMode, and removes the block from its list of blocks. Used to allow a block to be started and then cancelled when it is discovered to be unreachable.

  50. def killUnless(cond: Boolean): Unit

    Permalink

    Same as killIf but with the logic of the condition reversed

  51. val label: Int

    Permalink
  52. def lastInstruction: ICodes.Instruction

    Permalink

    Return the last instruction of this basic block.

  53. def length: Int

    Permalink

    The number of instructions in this basic block so far.

  54. def loopHeader: Boolean

    Permalink

    Is this block the head of a while?

  55. def loopHeader_=(b: Boolean): Unit

    Permalink
  56. val method: ICodes.IMethod

    Permalink
  57. final def ne(arg0: AnyRef): Boolean

    Permalink

    Equivalent to !(this eq that).

    Equivalent to !(this eq that).

    returns

    true if the argument is not a reference to the receiver object; false otherwise.

    Definition Classes
    AnyRef
  58. final def nonEmpty: Boolean

    Permalink
  59. final def notify(): Unit

    Permalink

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  60. final def notifyAll(): Unit

    Permalink

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
    AnyRef
    Note

    not specified by SLS as a member of AnyRef

  61. def open(): Unit

    Permalink
  62. def predContents: String

    Permalink
  63. def predecessors: List[ICodes.BasicBlock]

    Permalink

    Returns the predecessors of this block.

    Returns the predecessors of this block.

    Definition Classes
    BasicBlockProgramPoint
  64. var preds: List[ICodes.BasicBlock]

    Permalink

    Cached predecessors.

  65. def removeInstructionsAt(positions: Int*): Unit

    Permalink

    Removes instructions found at the given positions.

  66. def removeLastInstruction(): Unit

    Permalink

    Remove the last instruction of this basic block.

    Remove the last instruction of this basic block. It is fast for an open block, but slower when the block is closed.

  67. def replaceInstruction(oldInstr: ICodes.Instruction, is: List[ICodes.Instruction]): Boolean

    Permalink

    Replaces oldInstr with is.

    Replaces oldInstr with is. It does not update the position field in the newly inserted instructions, so it behaves differently than the one-instruction versions of this function.

  68. def replaceInstruction(oldInstr: ICodes.Instruction, newInstr: ICodes.Instruction): Boolean

    Permalink

    Replace the given instruction with the new one.

    Replace the given instruction with the new one. Returns true if it actually changed something. The replacing instruction is given the nsc.util.Position of the instruction it replaces.

  69. def replaceInstruction(pos: Int, instr: ICodes.Instruction): Boolean

    Permalink

    Replace the instruction at the given position.

    Replace the instruction at the given position. Used by labels when they are anchored. The replacing instruction is given the nsc.util.Position of the instruction it replaces.

  70. def size: Int

    Permalink
  71. def subst(map: Map[ICodes.Instruction, ICodes.Instruction]): Unit

    Permalink

    Replaces all instructions found in the map.

  72. def succContents: String

    Permalink
  73. def successors: List[ICodes.BasicBlock]

    Permalink
    Definition Classes
    BasicBlockProgramPoint
  74. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  75. def take(n: Int): Seq[ICodes.Instruction]

    Permalink
  76. def toList: List[ICodes.Instruction]

    Permalink
  77. def toString(): String

    Permalink

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

    a String representation of the object.

    Definition Classes
    BasicBlock → AnyRef → Any
  78. def touched: Boolean

    Permalink

    Has this basic block been modified since the last call to 'successors'?

  79. def touched_=(b: Boolean): Unit

    Permalink
  80. val varsInScope: Set[ICodes.Local]

    Permalink

    Local variables that are in scope at entry of this basic block.

    Local variables that are in scope at entry of this basic block. Used for debugging information.

  81. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. def [B](y: B): (ICodes.BasicBlock, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ICodes.BasicBlock to ArrowAssoc[ICodes.BasicBlock] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ICodes.BasicBlock to any2stringadd[ICodes.BasicBlock]

Inherited by implicit conversion StringFormat from ICodes.BasicBlock to StringFormat[ICodes.BasicBlock]

Inherited by implicit conversion Ensuring from ICodes.BasicBlock to Ensuring[ICodes.BasicBlock]

Inherited by implicit conversion ArrowAssoc from ICodes.BasicBlock to ArrowAssoc[ICodes.BasicBlock]

Ungrouped