From: Subramanian Ganapathy <sganapat@uci.edu>
Date: Thu, 14 Jun 2012 23:13:59 +0000 (-0700)
Subject: (snapshot) removing mbFinalize and usage of finalize
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=06c46bd5c02bb68c1a75edc4423e5281e497c6c1;p=cdsspec-compiler.git

(snapshot) removing mbFinalize and usage of finalize

Now there is no need for finalize mechanism at all.
All that was required was resetting the rollback id
---

diff --git a/main.cc b/main.cc
index 66ad9f1..b38f7ef 100644
--- a/main.cc
+++ b/main.cc
@@ -78,7 +78,6 @@ void real_main() {
 	delete model;
 
 	DEBUG("Exiting\n");
-	finalize();
 }
 
 int main_numargs;
diff --git a/snapshot-interface.h b/snapshot-interface.h
index 48fa2e3..5f54edb 100644
--- a/snapshot-interface.h
+++ b/snapshot-interface.h
@@ -13,7 +13,6 @@ typedef void (*VoidFuncPtr)();
 void initSnapShotLibrary(unsigned int numbackingpages,
 		unsigned int numsnapshots, unsigned int nummemoryregions,
 		unsigned int numheappages, VoidFuncPtr entryPoint);
-void finalize();
 
 struct stackEntry {
   struct stackEntry *next;
diff --git a/snapshot.cc b/snapshot.cc
index 9a69a4b..eeeb58c 100644
--- a/snapshot.cc
+++ b/snapshot.cc
@@ -120,7 +120,6 @@ void createSharedLibrary(){
 	sTheRecord->mStackSize = STACK_SIZE_DEFAULT;
 	sTheRecord->mIDToRollback = -1;
 	sTheRecord->currSnapShotID = 0;
-	sTheRecord->mbFinalize = false;
 #endif
 }
 
@@ -197,7 +196,7 @@ void initSnapShotLibrary(unsigned int numbackingpages,
 	pid_t forkedID = 0;
 	snapshotid = sTheRecord->currSnapShotID;
 	bool swapContext = false;
-	while( !sTheRecord->mbFinalize ){
+	while( true ){
 		sTheRecord->currSnapShotID=snapshotid+1;
 		forkedID = fork();
 		if( 0 == forkedID ){
@@ -311,14 +310,7 @@ void rollBack( snapshot_id theID ){
 		SSDEBUG("Invoked rollback");
 		exit(EXIT_SUCCESS);
 	}
+	sTheRecord->mIDToRollback = -1;
 #endif
 }
 
-/** The finalize method shuts down the snapshotting system.  */
-//Subramanian -- remove this function from the external interface and
-//have us call it internally
-void finalize(){
-#if !USE_MPROTECT_SNAPSHOT
-	sTheRecord->mbFinalize = true;
-#endif
-}
diff --git a/snapshot.h b/snapshot.h
index cbbe007..629f63a 100644
--- a/snapshot.h
+++ b/snapshot.h
@@ -11,7 +11,7 @@
 
 /* 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 1
+#define USE_MPROTECT_SNAPSHOT 0
 
 /* Size of signal stack */
 #define SIGSTACKSIZE 32768
diff --git a/snapshotimp.h b/snapshotimp.h
index 7ab009e..e9f6d8b 100644
--- a/snapshotimp.h
+++ b/snapshotimp.h
@@ -63,7 +63,6 @@ struct Snapshot {
 	snapshot_id mIDToRollback;
 	ucontext_t mContextToRollback;
 	snapshot_id currSnapShotID;
-	volatile bool mbFinalize;
 };
 extern struct Snapshot * sTheRecord;
 #endif