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