X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=snapshot.cc;h=95a6593a44829c1ae4c1152203b2bbee1162cb94;hb=b7153285e24941be76175eeb163d25f6f604f96f;hp=9020bb70e840ab445ab059fe3a0a2cbda7fb7653;hpb=8b6e648f00b31633f9d72850df82ecdb4dc2699e;p=model-checker.git diff --git a/snapshot.cc b/snapshot.cc index 9020bb7..95a6593 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -3,7 +3,7 @@ #include #include #include -#include +#include "hashtable.h" #include #include #include "snapshot.h" @@ -281,7 +281,7 @@ snapshot_id takeSnapshot( ){ */ void rollBack( snapshot_id theID ){ #if USE_MPROTECT_SNAPSHOT - std::map< void *, bool, std::less< void * >, MyAlloc< std::pair< const void *, bool > > > duplicateMap; + HashTable< void *, bool, uintptr_t, 4, MYMALLOC, MYCALLOC, MYFREE> duplicateMap; for(unsigned int region=0; regionlastRegion;region++) { if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ | PROT_WRITE ) == -1 ){ perror("mprotect"); @@ -290,14 +290,8 @@ void rollBack( snapshot_id theID ){ } } for(unsigned int page=snapshotrecord->snapShots[theID].firstBackingPage; pagelastBackingPage; page++) { - bool oldVal = false; - if( duplicateMap.find( snapshotrecord->backingRecords[page].basePtrOfPage ) != duplicateMap.end() ){ - oldVal = true; - } - else{ - duplicateMap[ snapshotrecord->backingRecords[page].basePtrOfPage ] = true; - } - if( !oldVal ){ + if( !duplicateMap.contains(snapshotrecord->backingRecords[page].basePtrOfPage )) { + duplicateMap.put(snapshotrecord->backingRecords[page].basePtrOfPage, true); memcpy(snapshotrecord->backingRecords[page].basePtrOfPage, &snapshotrecord->backingStore[page], sizeof(struct SnapShotPage)); } }