/** Snapshotting configurables */
-/** If USE_MPROTECT_SNAPSHOT=1, then snapshot by using mmap() and mprotect()
+/**
+ * If USE_MPROTECT_SNAPSHOT=2, then snapshot by tuned mmap() algorithm
+ * If USE_MPROTECT_SNAPSHOT=1, then snapshot by using mmap() and mprotect()
* If USE_MPROTECT_SNAPSHOT=0, then snapshot by using fork() */
-#define USE_MPROTECT_SNAPSHOT 0
+#define USE_MPROTECT_SNAPSHOT 2
/** Size of signal stack */
#define SIGSTACKSIZE 32768
* @param theID is the snapshot identifier to rollback to.
*/
void rollBack( snapshot_id theID ){
+#if USE_MPOTECT_SNAPSHOT==2
+ if (snapshotrecord->lastSnapShot==(theID+1)) {
+ for(unsigned int page=snapshotrecord->snapShots[theID].firstBackingPage; page<snapshotrecord->lastBackingPage; page++) {
+ memcpy(snapshotrecord->backingRecords[page].basePtrOfPage, &snapshotrecord->backingStore[page], sizeof(struct SnapShotPage));
+ }
+ return;
+ }
+#endif
+
#if USE_MPROTECT_SNAPSHOT
HashTable< void *, bool, uintptr_t, 4, model_malloc, model_calloc, model_free> duplicateMap;
for(unsigned int region=0; region<snapshotrecord->lastRegion;region++) {