korat.instrumentation.bytecode
Class OperandStack

java.lang.Object
  extended by korat.instrumentation.bytecode.OperandStack

public class OperandStack
extends Object

Author:
Aleksandar Milicevic

Nested Class Summary
static class OperandStack.ConsumedByKind
           
static class OperandStack.ElemKind
           
static class OperandStack.StackElem
          Memento class that stores needed informations about stack elements
 
Field Summary
private  OperandStack.StackElem lastPoppedOut
           
private  Stack<OperandStack.StackElem> opStack
          Stack of the array object pushed onto the stack.
 
Constructor Summary
OperandStack()
           
 
Method Summary
 void clear()
           
 OperandStack.StackElem get(int index)
           
 OperandStack getClone()
           
 OperandStack.StackElem getLastPoppedOut()
           
 boolean isEmpty()
           
 OperandStack.StackElem peek()
           
 OperandStack.StackElem pop()
           
 void push(CtClass elemType)
           
 void push(CtClass elemType, OperandStack.ElemKind kind)
           
 void push(OperandStack.StackElem elem)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

opStack

private Stack<OperandStack.StackElem> opStack

Stack of the array object pushed onto the stack.

A stack like this has to be maintained because when you get to, let's say, ARRAYLENGTH instruction, you cannot know which array it reffers to. You would want to query the top of the stack and find out what's there, but I don't think that javassist lets you do that. One solution is to monitor (track) stack changes by yourself.


lastPoppedOut

private OperandStack.StackElem lastPoppedOut
Constructor Detail

OperandStack

public OperandStack()
Method Detail

getLastPoppedOut

public OperandStack.StackElem getLastPoppedOut()

push

public void push(OperandStack.StackElem elem)

push

public void push(CtClass elemType)

push

public void push(CtClass elemType,
                 OperandStack.ElemKind kind)

pop

public OperandStack.StackElem pop()

peek

public OperandStack.StackElem peek()

isEmpty

public boolean isEmpty()

clear

public void clear()

get

public OperandStack.StackElem get(int index)

size

public int size()

toString

public String toString()
Overrides:
toString in class Object

getClone

public OperandStack getClone()