XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, xbt, "Logging specific to mc_compare in mc");
+using simgrid::mc::remote;
+
namespace simgrid {
namespace mc {
-struct HeapLocation;
-typedef std::array<HeapLocation, 2> HeapLocationPair;
-typedef std::set<HeapLocationPair> HeapLocationPairs;
-struct HeapArea;
-struct ProcessComparisonState;
-struct StateComparator;
-
-static int compare_heap_area(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1,
- Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level);
-}
-}
-
-using simgrid::mc::remote;
-
/*********************************** Heap comparison ***********************************/
/***************************************************************************************/
-namespace simgrid {
-namespace mc {
-
class HeapLocation {
public:
int block_ = 0;
}
};
+typedef std::array<HeapLocation, 2> HeapLocationPair;
+typedef std::set<HeapLocationPair> HeapLocationPairs;
+
+struct ProcessComparisonState;
+struct StateComparator;
+
static inline
HeapLocationPair makeHeapLocationPair(int block1, int fragment1, int block2, int fragment2)
{
- return simgrid::mc::HeapLocationPair{{
- simgrid::mc::HeapLocation(block1, fragment1),
- simgrid::mc::HeapLocation(block2, fragment2)
- }};
+ return HeapLocationPair{{HeapLocation(block1, fragment1), HeapLocation(block2, fragment2)}};
}
class HeapArea : public HeapLocation {
void initHeapInformation(xbt_mheap_t heap, std::vector<simgrid::mc::IgnoredHeapRegion>* i);
};
-namespace {
-
-/** A hash which works with more stuff
- *
- * It can hash pairs: the standard hash currently doesn't include this.
- */
-template <class X> class hash : public std::hash<X> {
-};
-
-template <class X, class Y> class hash<std::pair<X, Y>> {
-public:
- std::size_t operator()(std::pair<X,Y>const& x) const
- {
- hash<X> h1;
- hash<X> h2;
- return h1(x.first) ^ h2(x.second);
- }
-};
-
-}
+static int compare_heap_area(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1,
+ Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level);
class StateComparator {
public:
std::size_t heaplimit;
std::array<ProcessComparisonState, 2> processStates;
- std::unordered_set<std::pair<void*, void*>, hash<std::pair<void*, void*>>> compared_pointers;
+ std::unordered_set<std::pair<void*, void*>, simgrid::xbt::hash<std::pair<void*, void*>>> compared_pointers;
void clear()
{
if (not equal) {
XBT_DEBUG("Block %zu not found (size_used = %zu, addr = %p)", i1, heapinfo1->busy_block.busy_size, addr_block1);
- i1 = state.heaplimit + 1;
return false;
}
if (not equal) {
XBT_DEBUG("Block %zu, fragment_ %zu not found (size_used = %zd, address = %p)\n", i1, j1,
heapinfo1->busy_frag.frag_size[j1], addr_frag1);
- i1 = state.heaplimit + 1;
return false;
}
}