projects
/
repair.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Had a bug in our implementation. If the list empties when the tail is at the last...
[repair.git]
/
Repair
/
RepairCompiler
/
MCC
/
Runtime
/
SimpleHash.cc
diff --git
a/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc
b/Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc
index 07f8a12b97511c5eb7f77fdb46f22da89f462592..6281d150906ea41f4dacad41add0e523d4222f51 100755
(executable)
--- a/
Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc
+++ b/
Repair/RepairCompiler/MCC/Runtime/SimpleHash.cc
@@
-119,10
+119,12
@@
void WorkList::pop() {
int newoffset=tailoffset+4;
struct ListNode *ptr=tail;
if (newoffset>=WLISTSIZE) {
int newoffset=tailoffset+4;
struct ListNode *ptr=tail;
if (newoffset>=WLISTSIZE) {
- newoffset-=WLISTSIZE;
- struct ListNode *oldptr=ptr;
- ptr=ptr->next;
- free(oldptr);
+ if (newoffset!=WLISTSIZE||head!=tail) {
+ newoffset-=WLISTSIZE;
+ struct ListNode *oldptr=ptr;
+ ptr=ptr->next;
+ free(oldptr);
+ }
}
tail=ptr;
tailoffset=newoffset;
}
tail=ptr;
tailoffset=newoffset;
@@
-136,6
+138,10
@@
void WorkList::add(int id,int type, int lvalue, int rvalue) {
}
headoffset=0;
head=head->next;
}
headoffset=0;
head=head->next;
+ if (tailoffset==WLISTSIZE) { /* roll the tail over also */
+ tailoffset=0;
+ tail=tail->next;
+ }
}
head->data[headoffset++]=id;
head->data[headoffset++]=type;
}
head->data[headoffset++]=id;
head->data[headoffset++]=type;