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.InstructionHandle; 00006 import gov.nasa.arc.ase.util.Debug; 00007 00008 00009 public class TABLESWITCH extends AbstractInstruction { 00010 private de.fub.bytecode.generic.TABLESWITCH peer; 00011 00012 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) { 00013 int v = th.pop(); 00014 00015 int[] match = peer.getMatchs(); 00016 InstructionHandle[] targets = peer.getTargets(); 00017 00018 int nmatch = match.length; 00019 for(int i = 0; i < nmatch; i++) 00020 if (v == match[i]) { 00021 return targets[i]; 00022 } 00023 00024 return peer.getTarget(); 00025 } 00026 public void setPeer(de.fub.bytecode.generic.Instruction i) { 00027 peer = (de.fub.bytecode.generic.TABLESWITCH)i; 00028 } 00029 }