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