Package com.tonic.analysis.absexec
Class Stack
- java.lang.Object
-
- com.tonic.analysis.absexec.Stack
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetSize()StackCtxpeek()Returns the top entry without removing it.StackCtxpop()Removes and returns the top entry.voidpush(StackCtx ctx)Pushes an entry, growing the backing array if needed.
-
-
-
Constructor Detail
-
Stack
public Stack(int maxStack)
Creates an empty stack sized for the method's declared max stack.- Parameters:
maxStack- the method's declared operand-stack depth
-
Stack
public Stack(Stack other)
Copies another stack for a forked frame.- Parameters:
other- the stack to copy
-
-
Method Detail
-
push
public void push(StackCtx ctx)
Pushes an entry, growing the backing array if needed.- Parameters:
ctx- the entry to push
-
pop
public StackCtx pop()
Removes and returns the top entry.- Returns:
- the popped entry
- Throws:
IllegalStateException- if the stack is empty
-
peek
public StackCtx peek()
Returns the top entry without removing it.- Returns:
- the top stack entry
-
getSize
public int getSize()
- Returns:
- the size
-
-