From bb036bc4e402d9c1f8aca06be246d662627ddcd6 Mon Sep 17 00:00:00 2001 From: yeom Date: Sat, 13 Nov 2010 04:06:40 +0000 Subject: [PATCH] fixes on hashStructure : when parent bin is ready, it should not be inserted to the table. --- Robust/src/Runtime/oooJava/hashStructure.c | 18 +++++++++++++++++- Robust/src/Runtime/oooJava/hashStructure.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Robust/src/Runtime/oooJava/hashStructure.c b/Robust/src/Runtime/oooJava/hashStructure.c index 4f9c57de..a51e5f2e 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.c +++ b/Robust/src/Runtime/oooJava/hashStructure.c @@ -89,6 +89,11 @@ inline int rcr_BWRITEBINCASE(HashStructure *T, int key, SESEcommon *task, struct } while(val==(BinItem_rcr*)0x1); if (val==NULL) { + if (((INTPTR)task)&PARENTBIN) { + be->head=val; + return READY; + } + BinItem_rcr * b=(BinItem_rcr*)rcr_createWriteBinItem( T ); WriteBinItem_rcr * td = (WriteBinItem_rcr*)b; b->total=1; @@ -205,6 +210,11 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct } while(val==(BinItem_rcr*)0x1); if (val==NULL) { + if (((INTPTR)task)&PARENTBIN) { + be->head=val; + return READY; + } + BinItem_rcr * b=(BinItem_rcr*)rcr_createReadBinItem( T ); ReadBinItem_rcr* readbin=(ReadBinItem_rcr*)b; TraverserData * td = &(readbin->array[readbin->index++]); @@ -268,6 +278,11 @@ inline int rcr_BREADBINCASE(HashStructure *T, int key, SESEcommon *task, struct } if (ISREADBIN(bintail->type)) { + if ((((INTPTR)task)&PARENTBIN)&&(bintail->status==READY)) { + be->head=val; + return READY; + } + int stat=rcr_TAILREADCASE(T, val, bintail, key, task, rcrrec, index); if (mode) { struct BinItem_rcr * bt=be->tail; @@ -457,7 +472,8 @@ void rcr_RETIREHASHTABLE(HashStructure *T, SESEcommon *task, int key, BinItem_rc //poolfreeinto( T->memPoolWrite, ptr ); } else break; - } + } else + break; } ptr = next; } diff --git a/Robust/src/Runtime/oooJava/hashStructure.h b/Robust/src/Runtime/oooJava/hashStructure.h index 81a64804..26ec2f40 100644 --- a/Robust/src/Runtime/oooJava/hashStructure.h +++ b/Robust/src/Runtime/oooJava/hashStructure.h @@ -16,7 +16,7 @@ #define READBIN 0 #define WRITEBIN 1 #define BINMASK 1 -#define PARENTBIN 1 +#define PARENTBIN 1ULL #define SPEC 2 #define READY 1 //Item is ready and we haven't seen this bin before -- 2.34.1