00001 package gov.nasa.arc.ase.jpf.jvm.bytecode;
00002
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import de.fub.bytecode.classfile.ConstantPool;
00006 import de.fub.bytecode.classfile.Constant;
00007 import de.fub.bytecode.classfile.ConstantDouble;
00008 import de.fub.bytecode.classfile.ConstantLong;
00009 import de.fub.bytecode.generic.Type;
00010 import de.fub.bytecode.generic.ConstantPoolGen;
00011 import de.fub.bytecode.generic.InstructionHandle;
00012 import gov.nasa.arc.ase.util.Debug;
00013
00014 public class LDC2_W extends AbstractInstruction {
00015 private de.fub.bytecode.generic.LDC2_W peer;
00016 private int id;
00017
00018 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00019 ConstantPoolGen cpg = th.getCPG();
00020 ConstantPool cp = cpg.getConstantPool();
00021 Constant cons = cp.getConstant(peer.getIndex());
00022
00023 if (peer.getType(cpg) == Type.LONG) {
00024
00025 long value = ((ConstantLong)cons).getBytes();
00026
00027
00028 th.push2(value);
00029 } else {
00030
00031 double value = ((ConstantDouble)cons).getBytes();
00032
00033
00034 th.push2(Types.doubleToLong(value));
00035 }
00036
00037 return th.getPC().getNext();
00038 }
00039 public void setPeer(de.fub.bytecode.generic.Instruction i) {
00040 peer = (de.fub.bytecode.generic.LDC2_W)i;
00041 }
00042 }