X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/242fde5e8077f8193db4df5f262a9672085c8d8a..05736ee0ede974fcf9fb60a13a40c50d62fcc19d:/src/mc/PageStore.hpp diff --git a/src/mc/PageStore.hpp b/src/mc/PageStore.hpp index 5dee482f77..4226ffd799 100644 --- a/src/mc/PageStore.hpp +++ b/src/mc/PageStore.hpp @@ -10,22 +10,23 @@ #include #include -#include -#include +#include +#include -#include "mc_mmu.h" -#include "mc_forward.hpp" +#include + +#include "src/mc/mc_mmu.h" +#include "src/mc/mc_forward.hpp" namespace simgrid { namespace mc { /** @brief Storage for snapshot memory pages * - * The first (lower) layer of the per-page snapshot mechanism is a page - * store: it's responsibility is to store immutable shareable - * reference-counted memory pages independently of the snapshoting - * logic. Snapshot management and representation, soft-dirty tracking is - * handled to an higher layer. READMORE + * The first (lower) layer of the per-page snapshot mechanism is a page store: + * its responsibility is to store immutable sharable reference-counted memory + * pages independently of the snapshotting logic. Snapshot management and + * representation is handled to an higher layer. READMORE * * Data structure: * @@ -78,8 +79,8 @@ private: // Types // 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 page_set_type; - typedef boost::unordered_map pages_map_type; + typedef std::unordered_set page_set_type; + typedef std::unordered_map pages_map_type; private: // Fields: /** First page */ @@ -110,8 +111,7 @@ public: // Methods /** @brief Decrement the reference count for a given page * - * Decrement the reference count of this page. Used when a snapshot is - * destroyed. + * Decrement the reference count of this page. Used when a snapshot is destroyed. * * If the reference count reaches zero, the page is recycled: * it is added to the `free_pages_` list and removed from the `hash_index_`. @@ -132,7 +132,7 @@ public: // Methods void ref_page(size_t pageno); /** @brief Store a page in the page store */ - size_t store_page(void* page); + std::size_t store_page(void* page); /** @brief Get a page from its page number * @@ -172,7 +172,7 @@ void PageStore::ref_page(size_t pageno) inline __attribute__((always_inline)) const void* PageStore::get_page(std::size_t pageno) const { - return mc_page_from_number(this->memory_, pageno); + return (void*) simgrid::mc::mmu::join(pageno, (std::uintptr_t) this->memory_); } inline __attribute__((always_inline)) @@ -182,7 +182,7 @@ std::size_t PageStore::get_ref(std::size_t pageno) } inline __attribute__((always_inline)) -size_t PageStore::size() { +std::size_t PageStore::size() { return this->top_index_ - this->free_pages_.size(); }