Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Don't use unprototyped functions
[simgrid.git] / src / mc / mc_page_store.h
index de67f55..45965e7 100644 (file)
@@ -9,6 +9,7 @@
 #ifdef __cplusplus
 #include <vector>
 
+#include <boost/array.hpp>
 #include <boost/utility.hpp>
 #include <boost/unordered_map.hpp>
 #include <boost/unordered_set.hpp>
 
 #include <xbt.h>
 
-#include "mc_private.h"
 #include "mc_mmu.h"
 
-#ifndef MC_PAGE_SNAPSHOT_H
-#define MC_PAGE_SNAPSHOT_H
+#ifndef MC_PAGE_STORE_H
+#define MC_PAGE_STORE_H
 
 struct s_mc_pages_store;
 
@@ -79,10 +79,25 @@ struct s_mc_pages_store;
  *
  */
 struct s_mc_pages_store {
-private: // Types
+public: // Types
+#ifdef MC_PAGE_STORE_MD4
+  typedef boost::array<uint64_t,2> hash_type;
+#else
   typedef uint64_t hash_type;
-  typedef boost ::unordered_set<size_t> page_set_type;
+#endif
+private: // Types
+#ifdef MC_PAGE_STORE_MD4
+  // We are using a secure hash to identify a page.
+  // We assume there will not be any collision: we need to map a hash
+  // to a single page index.
+  typedef boost::unordered_map<hash_type, size_t> pages_map_type;
+#else
+  // We are using a cheap hash to index a page.
+  // We should expect collision and we need to associate multiple page indices
+  // to the same hash.
+  typedef boost::unordered_set<size_t> page_set_type;
   typedef boost::unordered_map<hash_type, page_set_type> pages_map_type;
+#endif
 
 private: // Fields:
   /** First page
@@ -195,6 +210,12 @@ size_t s_mc_pages_store::capacity() {
 
 #endif
 
+SG_BEGIN_DECL()
+
+typedef struct s_mc_pages_store s_mc_pages_store_t, * mc_pages_store_t;
+mc_pages_store_t mc_pages_store_new(void);
+void mc_pages_store_delete(mc_pages_store_t store);
+
 /**
  */
 static inline __attribute__((always_inline))
@@ -205,4 +226,6 @@ const void* mc_page_store_get_page(mc_pages_store_t page_store, size_t pageno)
   return mc_page_from_number(memory, pageno);
 }
 
+SG_END_DECL()
+
 #endif