(snapshot) removing mbFinalize and usage of finalize
authorSubramanian Ganapathy <sganapat@uci.edu>
Thu, 14 Jun 2012 23:13:59 +0000 (16:13 -0700)
committerSubramanian Ganapathy <sganapat@uci.edu>
Thu, 14 Jun 2012 23:13:59 +0000 (16:13 -0700)
Now there is no need for finalize mechanism at all.
All that was required was resetting the rollback id

main.cc
snapshot-interface.h
snapshot.cc
snapshot.h
snapshotimp.h

diff --git a/main.cc b/main.cc
index 66ad9f1..b38f7ef 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -78,7 +78,6 @@ void real_main() {
        delete model;
 
        DEBUG("Exiting\n");
-       finalize();
 }
 
 int main_numargs;
index 48fa2e3..5f54edb 100644 (file)
@@ -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;
index 9a69a4b..eeeb58c 100644 (file)
@@ -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
-}
index cbbe007..629f63a 100644 (file)
@@ -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
index 7ab009e..e9f6d8b 100644 (file)
@@ -63,7 +63,6 @@ struct Snapshot {
        snapshot_id mIDToRollback;
        ucontext_t mContextToRollback;
        snapshot_id currSnapShotID;
-       volatile bool mbFinalize;
 };
 extern struct Snapshot * sTheRecord;
 #endif