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.InstructionHandle;
00007 import gov.nasa.arc.ase.util.Debug;
00008
00009 public class INVOKESTATIC extends AbstractInstruction {
00010 private de.fub.bytecode.generic.INVOKESTATIC peer;
00011
00012
00013
00014 public boolean examine(SystemState ss, KernelState ks, ThreadInfo th) {
00015 ConstantPoolGen cpg = th.getCPG();
00016
00017 String className = peer.getClassName(cpg);
00018 String sig = peer.getSignature(cpg);
00019 String methodName = peer.getMethodName(cpg);
00020
00021 ClassInfo ci = JPFVM.getJPFVM().getClass(className);
00022 return !ci.isStaticMethodDeterministic(ss, ks, th, methodName+sig);
00023 }
00024
00025
00026
00027 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00028 DynamicArea da = ks.dynamic_area;
00029 StaticArea sa = ks.static_area;
00030
00031 ConstantPoolGen cpg = th.getCPG();
00032
00033 String className = peer.getClassName(cpg);
00034 String sig = peer.getSignature(cpg);
00035 String methodName = peer.getMethodName(cpg);
00036
00037 ClassInfo ci = JPFVM.getJPFVM().getClass(className);
00038 if (!ks.static_area.hasClass(className)) {
00039 ks.static_area.addClass(ci);
00040 return ci.initialize(ss, ks, th);
00041 }
00042
00043 return ci.executeStaticMethod(ss, ks, th, methodName+sig);
00044 }
00045 public boolean isExecutable(SystemState ss, KernelState ks, ThreadInfo th) {
00046 ConstantPoolGen cpg = th.getCPG();
00047
00048 String className = peer.getClassName(cpg);
00049 String sig = peer.getSignature(cpg);
00050 String methodName = peer.getMethodName(cpg);
00051
00052 ClassInfo ci = JPFVM.getJPFVM().getClass(className);
00053 return ci.isStaticMethodExecutable(ss, ks, th, methodName+sig);
00054 }
00055 public void setPeer(de.fub.bytecode.generic.Instruction i) {
00056 peer = (de.fub.bytecode.generic.INVOKESTATIC)i;
00057 }
00058 }