package task8.jvm.cmd;
import task8.jvm.clz.ClassFile;
import task8.jvm.constant.ConstantPool;
import task8.jvm.engine.ExecutionResult;
import task8.jvm.engine.Heap;
import task8.jvm.engine.StackFrame;
public class BiPushCmd extends OneOperandCmd {
public BiPushCmd(ClassFile clzFile, String opCode) {
super(clzFile,opCode);
}
@Override
public String toString(ConstantPool pool) {
return this.getOffset()+": "+ this.getOpCode()+" " + this.getReadableCodeText() + " " + this.getOperand();
}
@Override
public void execute(StackFrame frame, ExecutionResult result) {
frame.getOprandStack().push(Heap.getInstance().newInt(getOperand()));
}
}