Worklist items from a previous model build stay in the worklist...this causes lots...
authorbdemsky <bdemsky>
Wed, 19 May 2004 05:48:34 +0000 (05:48 +0000)
committerbdemsky <bdemsky>
Wed, 19 May 2004 05:48:34 +0000 (05:48 +0000)
Repair/RepairCompiler/MCC/IR/RepairGenerator.java
Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc
Repair/RepairCompiler/MCC/Runtime/SimpleHash.h

index 1114e1af8876f682a4271289113db61aad282eb8..f0acb61f85864c7dd568b242b78fe09d40287de6 100755 (executable)
@@ -479,6 +479,7 @@ public class RepairGenerator {
        craux.outputline("while (1)");
        craux.startblock();
        craux.outputline(name+ " * "+newmodel.getSafeSymbol()+"=new "+name+"();");
+       craux.outputline(worklist.getSafeSymbol()+"->reset();");
     }
     
     private void generate_teardown() {
index bed5c1fc3ad9780c35dd042784ef874c016e9441..c1579f22fe40dbe70ff1ef16943679dec9273624 100755 (executable)
@@ -79,6 +79,12 @@ WorkList::WorkList() {
   tailoffset=0;
 }
 
+void WorkList::reset() {
+  head=tail;
+  headoffset=0;
+  tailoffset=0;
+}
+
 int WorkList::hasMoreElements() {
   //  return (ptr != 0);
   return ((head!=tail)||(headoffset!=tailoffset));
@@ -124,10 +130,12 @@ void WorkList::pop() {
 
 void WorkList::add(int id,int type, int lvalue, int rvalue) {
   if (headoffset==WLISTSIZE) {
-    head->next=(struct ListNode *)malloc(sizeof(struct ListNode));
+    if (head->next==0) {
+      head->next=(struct ListNode *)malloc(sizeof(struct ListNode));
+      head->next=0;
+    }
     headoffset=0;
     head=head->next;
-    head->next=0;
   }
   head->data[headoffset++]=id;
   head->data[headoffset++]=type;
index 0823fd4ed91c6cafc01206991d8dc7f14cacdab4..eda2467867eb7eae2d1a6ee90970434049eca46f 100755 (executable)
@@ -46,6 +46,7 @@ private:
 public:
     WorkList();
     ~WorkList();
+    void reset();
     void add(int id, int type, int lvalue, int rvalue);
     int hasMoreElements();
     int getid();