00001 package gov.nasa.arc.ase.jpf.jvm;
00002
00003
00004 import java.util.Hashtable;
00005 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction;
00006 import gov.nasa.arc.ase.util.Debug;
00007
00008 public class Labels {
00009 private static Hashtable labels = new Hashtable();
00010
00011 public static boolean isAt(String label, ThreadInfo th) {
00012 Instruction pc = (Instruction)labels.get(label);
00013
00014 if(pc == null) return false;
00015
00016 return th.getPC() == pc;
00017 }
00018 public static void set(String label, Instruction pc) {
00019 if(!VirtualMachine.observableLabels.contains(label)) {
00020 Debug.println(Debug.MESSAGE, "Ignored label: " + label);
00021 return;
00022 }
00023
00024 if(labels.containsKey(label)) return;
00025
00026 labels.put(label, pc);
00027 pc.setObservable();
00028 Debug.println(Debug.MESSAGE, "New label: " + label);
00029 }
00030 }