From 232540fa250f2a1e51cb1958761dc8716f1cd112 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 19 May 2004 05:48:34 +0000 Subject: [PATCH] Worklist items from a previous model build stay in the worklist...this causes lots of problems. We've added a reset method to take care of this... --- Repair/RepairCompiler/MCC/IR/RepairGenerator.java | 1 + Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc | 12 ++++++++++-- Repair/RepairCompiler/MCC/Runtime/SimpleHash.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index 1114e1a..f0acb61 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -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() { diff --git a/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc b/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc index bed5c1f..c1579f2 100755 --- a/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc +++ b/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc @@ -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; diff --git a/Repair/RepairCompiler/MCC/Runtime/SimpleHash.h b/Repair/RepairCompiler/MCC/Runtime/SimpleHash.h index 0823fd4..eda2467 100755 --- a/Repair/RepairCompiler/MCC/Runtime/SimpleHash.h +++ b/Repair/RepairCompiler/MCC/Runtime/SimpleHash.h @@ -46,6 +46,7 @@ private: public: WorkList(); ~WorkList(); + void reset(); void add(int id, int type, int lvalue, int rvalue); int hasMoreElements(); int getid(); -- 2.34.1