software.coley.cafedude.tree.Code Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cafedude-tree Show documentation
Show all versions of cafedude-tree Show documentation
Tree module for CafeDude, containing a simplified intermediate model for classes
The newest version!
package software.coley.cafedude.tree;
import software.coley.cafedude.tree.insn.Insn;
import javax.annotation.Nonnull;
import java.util.List;
/**
* Tree model of a method's code.
*
* @author Justus Garbe
*/
public class Code {
private final List instructions;
private final List locals;
private final List handlers;
private final int maxStack;
private final int maxLocals;
/**
* @param instructions
* List of instructions.
* @param locals
* List of local variables.
* @param handlers
* List of exception handlers.
* @param maxStack
* Maximum number of stack slots
* @param maxLocals
* Maximum number of local variables.
*/
public Code(@Nonnull List instructions, @Nonnull List locals,
@Nonnull List handlers, int maxStack, int maxLocals) {
this.instructions = instructions;
this.locals = locals;
this.handlers = handlers;
this.maxStack = maxStack;
this.maxLocals = maxLocals;
}
/**
* @return list of instructions.
*/
@Nonnull
public List getInstructions() {
return instructions;
}
/**
* @return list of local variables.
*/
@Nonnull
public List getLocals() {
return locals;
}
/**
* @return list of exception handlers.
*/
@Nonnull
public List getHandlers() {
return handlers;
}
/**
* @return Maximum number of values on the operand stack.
*/
public int getMaxStack() {
return maxStack;
}
/**
* @return Maximum number of local variables.
*/
public int getMaxLocals() {
return maxLocals;
}
}