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.Constant; 00006 import de.fub.bytecode.classfile.ConstantPool; 00007 import de.fub.bytecode.generic.ConstantPoolGen; 00008 import de.fub.bytecode.generic.InstructionHandle; 00009 import gov.nasa.arc.ase.util.Debug; 00010 00011 public class INSTANCEOF extends AbstractInstruction { 00012 private de.fub.bytecode.generic.INSTANCEOF peer; 00013 00014 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) { 00015 ConstantPoolGen cpg = th.getCPG(); 00016 ConstantPool cp = cpg.getConstantPool(); 00017 Constant constant = cp.getConstant(peer.getIndex()); 00018 String classname = cp.constantToString(constant); 00019 int objref = th.pop(); 00020 00021 th.push(ks.dynamic_area.instanceOfClass(objref, classname) ? 1 : 0); 00022 00023 return th.getPC().getNext(); 00024 } 00025 public void setPeer(de.fub.bytecode.generic.Instruction i) { 00026 peer = (de.fub.bytecode.generic.INSTANCEOF)i; 00027 } 00028 }