00001 package gov.nasa.arc.ase.jpf.jvm.bytecode; 00002 00003 import de.fub.bytecode.classfile.ConstantPool; 00004 import gov.nasa.arc.ase.jpf.jvm.SystemState; 00005 import gov.nasa.arc.ase.jpf.jvm.KernelState; 00006 import gov.nasa.arc.ase.jpf.jvm.ThreadInfo; 00007 import gov.nasa.arc.ase.util.Debug; 00008 00009 public class INSTANCEOF extends Instruction { 00010 private String type; 00011 00012 public Instruction execute(SystemState ss, KernelState ks, ThreadInfo th) { 00013 int objref = th.pop(); 00014 00015 if(objref == -1) 00016 th.push(1, false); 00017 else if(ks.da.get(objref).instanceOf(type)) 00018 th.push(1, false); 00019 else 00020 th.push(0, false); 00021 00022 return th.getPC().getNext(); 00023 } 00024 public void setPeer(de.fub.bytecode.generic.Instruction i, ConstantPool cp) { 00025 type = cp.constantToString(cp.getConstant(((de.fub.bytecode.generic.INSTANCEOF)i).getIndex())).replace('.', '/'); 00026 if(!type.startsWith("[")) type = "L" + type + ";"; 00027 } 00028 }