af9147b3eabd80c87b7c2b0f8f7432a8bcb04f41
[jpf-core.git] / src / main / gov / nasa / jpf / listener / ConflictTracker.java
1 /*
2  * Copyright (C) 2014, United States Government, as represented by the
3  * Administrator of the National Aeronautics and Space Administration.
4  * All rights reserved.
5  *
6  * The Java Pathfinder core (jpf-core) platform is licensed under the
7  * Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  * 
10  *        http://www.apache.org/licenses/LICENSE-2.0. 
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and 
16  * limitations under the License.
17  */
18 package gov.nasa.jpf.listener;
19
20 import gov.nasa.jpf.Config;
21 import gov.nasa.jpf.JPF;
22 import gov.nasa.jpf.ListenerAdapter;
23 import gov.nasa.jpf.search.Search;
24 import gov.nasa.jpf.jvm.bytecode.*;
25 import gov.nasa.jpf.vm.*;
26 import gov.nasa.jpf.vm.bytecode.LocalVariableInstruction;
27 import gov.nasa.jpf.vm.bytecode.ReadInstruction;
28 import gov.nasa.jpf.vm.bytecode.StoreInstruction;
29 import gov.nasa.jpf.vm.bytecode.WriteInstruction;
30
31 import java.io.PrintWriter;
32
33 import java.util.*;
34
35 /**
36  * Listener using data flow analysis to find conflicts between smartApps.
37  **/
38
39 public class ConflictTracker extends ListenerAdapter {
40   private final PrintWriter out;
41   private final HashSet<String> conflictSet = new HashSet<String>(); // Variables we want to track
42   private final HashSet<String> appSet = new HashSet<String>(); // Apps we want to find their conflicts
43   private final HashSet<String> manualSet = new HashSet<String>(); // Writer classes with manual inputs to detect direct-direct(No Conflict) interactions
44   private final HashMap<Integer, Node> nodes = new HashMap<Integer, Node>(); // Nodes of a graph
45   private ArrayList<NameValuePair> tempSetSet = new ArrayList<NameValuePair>();
46   private long timeout;
47   private long startTime;
48   private Node parentNode = new Node(-2);
49   private String operation;
50   private String detail;
51   private String errorMessage;
52   private int depth;
53   private int id;
54   private boolean conflictFound = false;
55   private boolean manual = false;
56
57   private final String SET_LOCATION_METHOD = "setLocationMode";
58   private final String LOCATION_VAR = "locationMode";
59   
60   public ConflictTracker(Config config, JPF jpf) {
61     out = new PrintWriter(System.out, true);
62
63     String[] conflictVars = config.getStringArray("variables");
64     // We are not tracking anything if it is null
65     if (conflictVars != null) {
66       for (String var : conflictVars) {
67         conflictSet.add(var);
68       }
69     }
70     String[] apps = config.getStringArray("apps");
71     // We are not tracking anything if it is null
72     if (apps != null) {
73       for (String var : apps) {
74         appSet.add(var);
75       }
76     }
77     String[] manualClasses = config.getStringArray("manualClasses");
78     // We are not tracking anything if it is null
79     if (manualClasses != null) {
80       for (String var : manualClasses) {
81         manualSet.add(var);
82       }
83     }
84
85     // Timeout input from config is in minutes, so we need to convert into millis
86     timeout = config.getInt("timeout", 0) * 60 * 1000;
87     startTime = System.currentTimeMillis();
88   }
89
90   boolean propagateTheChange(Node currentNode) {
91     HashSet<Node> changed = new HashSet<Node>(currentNode.getSuccessors());
92     HashMap<Node, HashSet<Node>> parentQueueMap = new HashMap<Node, HashSet<Node>>();
93     HashSet<Node> parents = new HashSet<Node>();
94     parents.add(currentNode);
95
96     for (Node node : currentNode.getSuccessors()) {
97       parentQueueMap.put(node, parents);
98     }
99
100     while(!changed.isEmpty()) {
101       // Get the first element of the changed set and remove it
102       Node nodeToProcess = changed.iterator().next();
103       changed.remove(nodeToProcess);
104
105       // Update the changed parents
106       parents.clear();
107       parents = parentQueueMap.get(nodeToProcess);
108       boolean isChanged = false;
109
110       for (Node node : parents) {
111         // Update the edge
112         isChanged |= updateTheOutSet(node, nodeToProcess);
113       }
114
115       // Check for a conflict if the outSet of nodeToProcess is changed
116       if (isChanged) {
117         for (Node node : nodeToProcess.getSuccessors()) {
118           HashMap<Transition, ArrayList<NameValuePair>> setSets = nodeToProcess.getOutgoingEdges().get(node).getSetSetMap();
119           for (Map.Entry mapElement : setSets.entrySet()) {
120             Transition transition = (Transition)mapElement.getKey();
121             if (checkForConflict(nodeToProcess, node, transition))
122               return true;
123           }
124         }
125       }
126
127       // Update the parents list for the successors of the current node
128       parents.clear();
129       parents.add(nodeToProcess);
130
131       // Checking if the out set has changed or not(Add its successors to the change list!)
132       if (isChanged) {
133         for (Node i : nodeToProcess.getSuccessors()) {
134           if (!changed.contains(i))
135             changed.add(i);
136
137           // Update the list of updated parents for the current node
138           if (parentQueueMap.containsKey(i))
139             parentQueueMap.get(i).add(nodeToProcess);
140           else
141             parentQueueMap.put(i, parents);
142         }
143       }
144     }
145     return false;
146   }
147
148   String createErrorMessage(NameValuePair pair, HashMap<String, String> valueMap, HashMap<String, Integer> writerMap) {
149     String message = "Conflict found between the two apps. App"+pair.getAppNum()+
150                      " has written the value: "+pair.getValue()+
151                      " to the variable: "+pair.getVarName()+" while App"
152                      +writerMap.get(pair.getVarName())+" is overwriting the value: "
153                      +valueMap.get(pair.getVarName())+" to the same variable!";
154     System.out.println(message);        
155     return message;
156   }
157
158   boolean checkForConflict(Node parentNode, Node currentNode, Transition currentTransition) {
159     ArrayList<NameValuePair> setSet = parentNode.getOutgoingEdges().get(currentNode).getSetSetMap().get(currentTransition);
160     HashMap<String, String> valueMap = new HashMap<String, String>(); // HashMap from varName to value
161     HashMap<String, Integer> writerMap = new HashMap<String, Integer>(); //  HashMap from varName to appNum
162     HashMap<String, String> firstValueMap = new HashMap<String, String>(); // HashMap from varName to value - first instruction in transition
163     HashMap<String, Integer> firstWriterMap = new HashMap<String, Integer>(); // HashMap from varName to appNum - first instruction in transition
164         
165     // Update the valueMap and writerMap + check for conflict between the elements of setSet
166     for (int i = 0;i < setSet.size();i++) {
167       NameValuePair nameValuePair = setSet.get(i);
168       String varName = nameValuePair.getVarName();
169       String value = nameValuePair.getValue();
170       Integer appNum = nameValuePair.getAppNum();
171       Boolean isManual = nameValuePair.getIsManual();
172
173       if (valueMap.containsKey(varName)) {
174         // Check if we have a same writer
175         if (!writerMap.get(varName).equals(appNum)) {
176           // Check if we have a conflict or not
177           if (!valueMap.get(varName).equals(value)) {
178             errorMessage = createErrorMessage(nameValuePair, valueMap, writerMap);
179             return true;
180           }
181         }
182         valueMap.put(varName, value);
183         writerMap.put(varName, appNum);
184       } else {
185         valueMap.put(varName, value);
186         writerMap.put(varName, appNum);
187         if (!isManual) {
188           firstValueMap.put(varName, value);
189           firstWriterMap.put(varName, appNum);
190         }
191       }
192     }
193
194     // Check for conflict between outSet and this transition setSet
195     for (NameValuePair i : parentNode.getOutSet()) {
196       if (valueMap.containsKey(i.getVarName())) {
197         String value = firstValueMap.get(i.getVarName());
198         Integer writer = firstWriterMap.get(i.getVarName());
199         if ((value != null)&&(writer != null)) {
200           if (!value.equals(i.getValue())&&!writer.equals(i.getAppNum())) { 
201             // We have different values and different writers
202             errorMessage = createErrorMessage(i, firstValueMap, firstWriterMap);
203             return true;
204           }
205         }
206       }
207     }
208     return false;
209   }
210
211   boolean updateTheOutSet(Node parentNode, Node currentNode) {
212     HashMap<Transition, ArrayList<NameValuePair>> setSets = parentNode.getOutgoingEdges().get(currentNode).getSetSetMap();
213     HashSet<String> updatedVarNames = new HashSet<String>();
214     Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
215     HashMap<String, Integer> lastWriter = currentEdge.getLastWriter();
216     HashMap<String, String> lastValue = currentEdge.getLastValue();
217     HashMap<String, Integer> outSetVarMap = new HashMap<String, Integer>();
218     boolean isChanged = false;
219
220     for (Map.Entry mapElement : setSets.entrySet()) {
221       ArrayList<NameValuePair> setSet = (ArrayList<NameValuePair>)mapElement.getValue();
222   
223       for (int i = 0;i < setSet.size();i++) {
224         updatedVarNames.add(setSet.get(i).getVarName());
225       }
226     }
227
228     for (NameValuePair i : parentNode.getOutSet()) {
229       outSetVarMap.put(i.getVarName(), i.getAppNum());
230       if (!updatedVarNames.contains(i.getVarName()))
231         isChanged |= currentNode.getOutSet().add(i);
232     }
233
234
235     for (Map.Entry mapElement : setSets.entrySet()) {
236       ArrayList<NameValuePair> setSet = (ArrayList<NameValuePair>)mapElement.getValue();
237   
238       for (int i = 0;i < setSet.size();i++) {
239         String varName = setSet.get(i).getVarName();
240         Integer writer = lastWriter.get(varName);
241         String value = lastValue.get(varName);
242
243         if (setSet.get(i).getAppNum().equals(writer) 
244           && setSet.get(i).getValue().equals(value)) {
245           if (outSetVarMap.containsKey(varName)) {
246             Integer hashCode = outSetVarMap.get(varName).hashCode() * 31 +
247                                varName.hashCode();
248             currentNode.getOutSet().remove(hashCode);
249           }
250           isChanged |= currentNode.getOutSet().add(setSet.get(i));
251         }
252       }
253     }
254     return isChanged;
255   }
256
257   void updateTheEdge(Node currentNode, Transition transition) {
258     if (parentNode.getOutgoingEdges().containsKey(currentNode)) {
259       Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
260         if (currentEdge.getSetSetMap().containsKey(transition)) { // Update the transition
261           if (manual)
262             currentEdge.getSetSetMap().put(transition, tempSetSet);
263           else
264             currentEdge.getSetSetMap().get(transition).addAll(tempSetSet);
265         } else { // Add a new transition
266             currentEdge.getSetSetMap().put(transition, tempSetSet);
267         }
268     } else {
269       parentNode.getOutgoingEdges().put(currentNode, new Edge(parentNode, currentNode));
270       Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
271       currentEdge.getSetSetMap().put(transition, tempSetSet);
272     }
273
274     // Update the last writer and last value for this edge for each varName
275     Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
276     ArrayList<NameValuePair> setSet = currentEdge.getSetSetMap().get(transition);
277     for (int i = 0;i < setSet.size();i++) {
278       NameValuePair nameValuePair = setSet.get(i);
279       currentEdge.getLastWriter().put(nameValuePair.getVarName(), nameValuePair.getAppNum());
280       currentEdge.getLastValue().put(nameValuePair.getVarName(), nameValuePair.getValue());
281     }
282   }
283
284   
285
286   static class Node {
287     Integer id;
288     HashSet<Node> predecessors = new HashSet<Node>();
289     HashSet<Node> successors = new HashSet<Node>();
290     HashSet<NameValuePair> outSet = new HashSet<NameValuePair>();
291     HashMap<Node, Edge> outgoingEdges = new HashMap<Node, Edge>();
292
293     Node(Integer id) {
294       this.id = id;
295     }
296
297     Integer getId() {
298       return id;
299     }
300
301     HashSet<Node> getPredecessors() {
302       return predecessors;
303     }
304
305     HashSet<Node> getSuccessors() {
306       return successors;
307     }
308
309     HashSet<NameValuePair> getOutSet() {
310       return outSet;
311     }
312
313     HashMap<Node, Edge> getOutgoingEdges() {
314       return outgoingEdges;
315     }
316   }
317
318   static class Edge {
319     Node source, destination;
320     HashMap<String, Integer> lastWriter = new HashMap<String, Integer>();
321     HashMap<String, String> lastValue = new HashMap<String, String>();
322     HashMap<Transition, ArrayList<NameValuePair>> setSetMap = new HashMap<Transition, ArrayList<NameValuePair>>();
323
324     Edge(Node source, Node destination) {
325       this.source = source;
326       this.destination = destination;
327     }
328
329     Node getSource() {
330       return source;
331     }
332
333     Node getDestination() {
334       return destination;
335     }
336
337     HashMap<Transition, ArrayList<NameValuePair>> getSetSetMap() {
338       return setSetMap;
339     }
340
341     HashMap<String, Integer> getLastWriter() {
342       return lastWriter;
343     }
344
345     HashMap<String, String> getLastValue() {
346       return lastValue;
347     }
348   }
349
350   static class NameValuePair {
351     Integer appNum;
352     String value;
353     String varName;
354     boolean isManual;
355
356     NameValuePair(Integer appNum, String value, String varName, boolean isManual) {
357       this.appNum = appNum;
358       this.value = value;
359       this.varName = varName;
360       this.isManual = isManual;
361     }
362
363     void setAppNum(Integer appNum) {
364       this.appNum = appNum;
365     }
366
367     void setValue(String value) {
368       this.value = value;
369     }
370
371     void setVarName(String varName) {
372       this.varName = varName;
373     }
374
375     void setIsManual(String varName) {
376       this.isManual = isManual;
377     }
378
379     Integer getAppNum() {
380       return appNum;
381     }
382
383     String getValue() {
384       return value;
385     }
386
387     String getVarName() {
388       return varName;
389     }
390
391     boolean getIsManual() {
392       return isManual;
393     }
394
395     @Override
396     public boolean equals(Object o) {
397       if (o instanceof NameValuePair) {
398         NameValuePair other = (NameValuePair) o;
399         if (varName.equals(other.getVarName()))
400           return appNum.equals(other.getAppNum());
401       }
402       return false;
403     }
404
405     @Override
406     public int hashCode() {
407       return appNum.hashCode() * 31 + varName.hashCode();
408     }
409   }
410
411   @Override
412   public void stateRestored(Search search) {
413     id = search.getStateId();
414     depth = search.getDepth();
415     operation = "restored";
416     detail = null;
417
418     out.println("The state is restored to state with id: "+id+", depth: "+depth);
419   
420     // Update the parent node
421     if (nodes.containsKey(id)) {
422       parentNode = nodes.get(id);
423     } else {
424       parentNode = new Node(id);
425     }
426   }
427
428   @Override
429   public void searchStarted(Search search) {
430     out.println("----------------------------------- search started");
431   }
432  
433
434   @Override
435   public void stateAdvanced(Search search) {
436     String theEnd = null;
437     Transition transition = search.getTransition();
438     id = search.getStateId();
439     depth = search.getDepth();
440     operation = "forward";
441
442     // Add the node to the list of nodes
443     if (nodes.get(id) == null)
444       nodes.put(id, new Node(id));
445
446     Node currentNode = nodes.get(id);
447
448     // Update the edge based on the current transition
449     updateTheEdge(currentNode, transition);
450
451     // Reset the temporary variables and flags
452     tempSetSet = new ArrayList<NameValuePair>();
453     manual = false;
454
455     // Check for the conflict in this transition
456     conflictFound = checkForConflict(parentNode, currentNode, transition);
457
458     if (search.isNewState()) {
459       detail = "new";
460     } else {
461       detail = "visited";
462     }
463
464     if (search.isEndState()) {
465       out.println("This is the last state!");
466       theEnd = "end";
467     }
468
469     out.println("The state is forwarded to state with id: "+id+", depth: "+depth+" which is "+detail+" state: "+"% "+theEnd);
470     
471     // Updating the predecessors for this node
472     // Check if parent node is already in successors of the current node or not
473     if (!(currentNode.getPredecessors().contains(parentNode)))
474       currentNode.getPredecessors().add(parentNode);
475
476     // Update the successors for this node
477     // Check if current node is already in successors of the parent node or not
478     if (!(parentNode.getSuccessors().contains(currentNode)))
479       parentNode.getSuccessors().add(currentNode);
480
481     // Update the outset of the current node and check if it is changed or not to propagate the change
482     boolean isChanged = updateTheOutSet(parentNode, currentNode);
483
484     // Check if the outSet of this state has changed, update all of its successors' sets if any
485     if (isChanged) {
486       for (Node node : currentNode.getSuccessors()) {
487         HashMap<Transition, ArrayList<NameValuePair>> setSets = currentNode.getOutgoingEdges().get(node).getSetSetMap();
488         for (Map.Entry mapElement : setSets.entrySet()) {
489           Transition currentTransition = (Transition)mapElement.getKey();
490           conflictFound = conflictFound || checkForConflict(currentNode, node, currentTransition);
491         }
492       }
493       conflictFound = conflictFound || propagateTheChange(currentNode);
494     }
495     // Update the parent node
496     if (nodes.containsKey(id)) {
497       parentNode = nodes.get(id);
498     } else {
499       parentNode = new Node(id);
500     }
501   }
502
503   @Override
504   public void stateBacktracked(Search search) {
505     id = search.getStateId();
506     depth = search.getDepth();
507     operation = "backtrack";
508     detail = null;
509
510     out.println("The state is backtracked to state with id: "+id+", depth: "+depth);
511
512     // Update the parent node
513     if (nodes.containsKey(id)) {
514       parentNode = nodes.get(id);
515     } else {
516       parentNode = new Node(id);
517     }
518   }
519
520   @Override
521   public void searchFinished(Search search) {
522     out.println("----------------------------------- search finished");
523   }
524
525   private String getValue(ThreadInfo ti, Instruction inst, byte type) {
526     StackFrame frame;
527     int lo, hi;
528
529     frame = ti.getTopFrame();
530
531     if ((inst instanceof JVMLocalVariableInstruction) ||
532         (inst instanceof JVMFieldInstruction))
533     {
534       if (frame.getTopPos() < 0)
535         return(null);
536
537       lo = frame.peek();
538       hi = frame.getTopPos() >= 1 ? frame.peek(1) : 0;
539
540       return(decodeValue(type, lo, hi));
541     }
542
543     if (inst instanceof JVMArrayElementInstruction)
544       return(getArrayValue(ti, type));
545
546     return(null);
547   }
548
549   private final static String decodeValue(byte type, int lo, int hi) {
550     switch (type) {
551       case Types.T_ARRAY:   return(null);
552       case Types.T_VOID:    return(null);
553
554       case Types.T_BOOLEAN: return(String.valueOf(Types.intToBoolean(lo)));
555       case Types.T_BYTE:    return(String.valueOf(lo));
556       case Types.T_CHAR:    return(String.valueOf((char) lo));
557       case Types.T_DOUBLE:  return(String.valueOf(Types.intsToDouble(lo, hi)));
558       case Types.T_FLOAT:   return(String.valueOf(Types.intToFloat(lo)));
559       case Types.T_INT:     return(String.valueOf(lo));
560       case Types.T_LONG:    return(String.valueOf(Types.intsToLong(lo, hi)));
561       case Types.T_SHORT:   return(String.valueOf(lo));
562
563       case Types.T_REFERENCE:
564         ElementInfo ei = VM.getVM().getHeap().get(lo);
565         if (ei == null)
566           return(null);
567
568         ClassInfo ci = ei.getClassInfo();
569         if (ci == null)
570           return(null);
571
572         if (ci.getName().equals("java.lang.String"))
573           return('"' + ei.asString() + '"');
574
575         return(ei.toString());
576
577       default:
578         System.err.println("Unknown type: " + type);
579         return(null);
580      }
581   }
582
583   private String getArrayValue(ThreadInfo ti, byte type) {
584     StackFrame frame;
585     int lo, hi;
586
587     frame = ti.getTopFrame();
588     lo    = frame.peek();
589     hi    = frame.getTopPos() >= 1 ? frame.peek(1) : 0;
590
591     return(decodeValue(type, lo, hi));
592   }
593
594   private byte getType(ThreadInfo ti, Instruction inst) {
595     StackFrame frame;
596     FieldInfo fi;
597     String type;
598
599     frame = ti.getTopFrame();
600     if ((frame.getTopPos() >= 0) && (frame.isOperandRef())) {
601       return (Types.T_REFERENCE);
602     }
603
604     type = null;
605
606     if (inst instanceof JVMLocalVariableInstruction) {
607       type = ((JVMLocalVariableInstruction) inst).getLocalVariableType();
608     } else if (inst instanceof JVMFieldInstruction){
609       fi = ((JVMFieldInstruction) inst).getFieldInfo();
610       type = fi.getType();
611     }
612
613     if (inst instanceof JVMArrayElementInstruction) {
614       return (getTypeFromInstruction(inst));
615     }
616
617     if (type == null) {
618       return (Types.T_VOID);
619     }
620
621     return (decodeType(type));
622   }
623
624   private final static byte getTypeFromInstruction(Instruction inst) {
625     if (inst instanceof JVMArrayElementInstruction)
626       return(getTypeFromInstruction((JVMArrayElementInstruction) inst));
627
628     return(Types.T_VOID);
629   }
630
631   private final static byte decodeType(String type) {
632     if (type.charAt(0) == '?'){
633       return(Types.T_REFERENCE);
634     } else {
635       return Types.getBuiltinType(type);
636     }
637   }
638
639   // Find the variable writer
640   // It should be one of the apps listed in the .jpf file
641   private String getWriter(List<StackFrame> sfList, HashSet<String> writerSet) {
642     // Start looking from the top of the stack backward
643     for(int i=sfList.size()-1; i>=0; i--) {
644       MethodInfo mi = sfList.get(i).getMethodInfo();
645       if(!mi.isJPFInternal()) {
646         String method = mi.getStackTraceName();
647         // Check against the writers in the writerSet
648         for(String writer : writerSet) {
649           if (method.contains(writer)) {
650             return writer;
651           }
652         }
653       }
654     }
655
656     return null;
657   }
658
659   private void writeWriterAndValue(String writer, String value, String var) {
660     // Update the temporary Set set.
661     NameValuePair temp = new NameValuePair(1, value, var, manual);
662     if (writer.equals("App2"))
663       temp = new NameValuePair(2, value, var, manual);
664     
665     tempSetSet.add(temp);
666   }
667
668   @Override
669   public void instructionExecuted(VM vm, ThreadInfo ti, Instruction nextInsn, Instruction executedInsn) {
670     if (timeout > 0) {
671       if (System.currentTimeMillis() - startTime > timeout) {
672         StringBuilder sbTimeOut = new StringBuilder();
673         sbTimeOut.append("Execution timeout: " + (timeout / (60 * 1000)) + " minutes have passed!");
674         Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sbTimeOut.toString());
675         ti.setNextPC(nextIns);
676       }
677     }
678
679     if (conflictFound) {
680       StringBuilder sb = new StringBuilder();
681       sb.append(errorMessage);
682       Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sb.toString());
683       ti.setNextPC(nextIns);
684     } else {
685       if (conflictSet.contains(LOCATION_VAR)) {
686         MethodInfo mi = executedInsn.getMethodInfo();
687         // Find the last load before return and get the value here
688         if (mi.getName().equals(SET_LOCATION_METHOD) &&
689             executedInsn instanceof ALOAD && nextInsn instanceof ARETURN) {
690           byte type  = getType(ti, executedInsn);
691           String value = getValue(ti, executedInsn, type);
692
693           // Extract the writer app name
694           ClassInfo ci = mi.getClassInfo();
695           String writer = ci.getName();
696
697           // Update the temporary Set set.
698           writeWriterAndValue(writer, value, LOCATION_VAR);
699         }
700       } else {
701         if (executedInsn instanceof WriteInstruction) {
702           String varId = ((WriteInstruction) executedInsn).getFieldInfo().getFullName();
703
704           for (String var : conflictSet) {
705             if (varId.contains(var)) {
706               // Get variable info
707               byte type = getType(ti, executedInsn);
708               String value = getValue(ti, executedInsn, type);
709               String writer = getWriter(ti.getStack(), appSet);
710               // Just return if the writer is not one of the listed apps in the .jpf file
711               if (writer == null)
712                 return;
713
714               if (getWriter(ti.getStack(), manualSet) != null)
715                 manual = true;
716
717               // Update the temporary Set set.
718               writeWriterAndValue(writer, value, var);
719             }
720           }
721         }
722       }
723     }
724   }
725 }