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.generic.ConstantPoolGen; 00006 import de.fub.bytecode.generic.Type; 00007 import de.fub.bytecode.generic.InstructionHandle; 00008 import gov.nasa.arc.ase.util.Debug; 00009 00010 public class INVOKEINTERFACE extends AbstractInstruction { 00011 private de.fub.bytecode.generic.INVOKEINTERFACE peer; 00012 00013 public boolean examine(SystemState ss, KernelState ks, ThreadInfo th) { 00014 ConstantPoolGen cpg = th.getCPG(); 00015 00016 String methodName = peer.getMethodName(cpg); 00017 String sig = peer.getSignature(cpg); 00018 String classname = peer.getClassName(cpg); 00019 00020 ClassInfo ci = ks.dynamic_area.getClass(th.getCalleeThis(peer.consumeStack(cpg))); 00021 MethodInfo mi = ci.getMethodInfo(methodName+sig); 00022 00023 return !mi.getClassInfo().isMethodDeterministic(ss, ks, th, methodName+sig); 00024 } 00025 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) { 00026 ConstantPoolGen cpg = th.getCPG(); 00027 00028 String methodName = peer.getMethodName(cpg); 00029 String sig = peer.getSignature(cpg); 00030 String classname = peer.getClassName(cpg); 00031 00032 ClassInfo ci = ks.dynamic_area.getClass(th.getCalleeThis(peer.consumeStack(cpg))); 00033 MethodInfo mi = ci.getMethodInfo(methodName+sig); 00034 00035 return mi.getClassInfo().executeMethod(ss, ks, th, methodName+sig); 00036 } 00037 public boolean isExecutable(SystemState ss, KernelState ks, ThreadInfo th) { 00038 ConstantPoolGen cpg = th.getCPG(); 00039 00040 String methodName = peer.getMethodName(cpg); 00041 String sig = peer.getSignature(cpg); 00042 String classname = peer.getClassName(cpg); 00043 00044 ClassInfo ci = ks.dynamic_area.getClass(th.getCalleeThis(peer.consumeStack(cpg))); 00045 MethodInfo mi = ci.getMethodInfo(methodName+sig); 00046 00047 return mi.getClassInfo().isMethodExecutable(ss, ks, th, methodName+sig); 00048 } 00049 public void setPeer(de.fub.bytecode.generic.Instruction i) { 00050 peer = (de.fub.bytecode.generic.INVOKEINTERFACE)i; 00051 } 00052 }