Packages

case class State(locals: IndexedSeq[Expression], stack: List[Expression] = List(), cond: Expression = Literal.TrueLiteral, expr: Option[Expression] = None) extends Product with Serializable

State is used as the main representation of block state, as we walk the bytecode.

Given a set of instructions, we will use State variables to track what happens to the stack.

The final State generated is later used to simplify expressions.

Example 1: { return 0 }

This is in java byte code: iconst 0 ireturn

iconst 0 => pushes 0 to stack ireturn => pops and returns

Example 2: { return 2 + 2 + 1 }

1) State(locals, empty stack, no condition, expr?) // expr ==it is no expression

iconst 2 NOTE: 2 is literal here so is 1 2) State(locals, 2::Nil, no condition, expr is still empty)

iconst 2 3) State(locals, 2::2::Nil, no condiiton...)

iadd (pop 2 and 2 + push 4 into stack) 4) State(locals, Add(2, 2)::Nil, no condition, expr is still empoty)

iconst 1 5) State(locals, 1::Add(2,2)::Nil, ..)

iadd (pop 1 and 4 + push 5 into sack) 6) Add(1, Add(2,2)) :: Nil

ireturn (pop 5 from stack) 7) return Add...

State == Add stack == lhs/rhs

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. State
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new State(locals: IndexedSeq[Expression], stack: List[Expression] = List(), cond: Expression = Literal.TrueLiteral, expr: Option[Expression] = None)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. val cond: Expression
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. val expr: Option[Expression]
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. val locals: IndexedSeq[Expression]
  12. def merge(that: Option[State]): State
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def remap(oldExp: Expression, newExp: Expression): State
  17. val stack: List[Expression]
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    State → AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped