Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remove C typedefs (mc_foobar_t) and mc_forward.h
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 15 Mar 2016 12:18:19 +0000 (13:18 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 15 Mar 2016 12:31:35 +0000 (13:31 +0100)
21 files changed:
include/xbt/mmalloc.h
src/mc/Frame.hpp
src/mc/ModelChecker.hpp
src/mc/ObjectInformation.hpp
src/mc/Type.hpp
src/mc/Variable.hpp
src/mc/mc_checkpoint.cpp
src/mc/mc_compare.cpp
src/mc/mc_diff.cpp
src/mc/mc_forward.h [deleted file]
src/mc/mc_private.h
src/mc/mc_safety.h
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h
src/mc/mc_state.h
src/simix/libsmx.cpp
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.h
src/simix/simcalls.py
tools/cmake/DefinePackages.cmake

index af93032..a8b49c4 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
-#include "src/mc/mc_forward.h"
 
 SG_BEGIN_DECL()
 
index 243610a..2619402 100644 (file)
@@ -13,7 +13,7 @@
 #include <xbt/base.h>
 #include <xbt/range.hpp>
 
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "src/mc/LocationList.hpp"
 #include "src/mc/Variable.hpp"
 #include "src/mc/Frame.hpp"
index 1f7665d..7babe6a 100644 (file)
@@ -36,7 +36,7 @@ class ModelChecker {
   PageStore page_store_;
   std::unique_ptr<Process> process_;
 public:
-  mc_snapshot_t parent_snapshot_;
+  simgrid::mc::Snapshot* parent_snapshot_;
 
 public:
   ModelChecker(ModelChecker const&) = delete;
index 56f80dc..9a55d87 100644 (file)
@@ -15,7 +15,7 @@
 #include <xbt/base.h>
 
 #include "src/xbt/memory_map.hpp"
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "src/mc/Type.hpp"
 #include "src/mc/Frame.hpp"
 
index 5839a3b..972b08d 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <dwarf.h>
 
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "src/mc/LocationList.hpp"
 
 namespace simgrid {
index f3b8e0a..5f43e5c 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "src/mc/LocationList.hpp"
 
 namespace simgrid {
index f4f6cd8..961936e 100644 (file)
@@ -115,7 +115,7 @@ RegionSnapshot privatized_region(
 #endif
 
 static
-void add_region(int index, mc_snapshot_t snapshot,
+void add_region(int index, simgrid::mc::Snapshot* snapshot,
                                   simgrid::mc::RegionType type,
                                   simgrid::mc::ObjectInformation* object_info,
                                   void *start_addr, void* permanent_addr,
@@ -148,7 +148,7 @@ void add_region(int index, mc_snapshot_t snapshot,
   return;
 }
 
-static void get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snapshot)
+static void get_memory_regions(simgrid::mc::Process* process, simgrid::mc::Snapshot* snapshot)
 {
   const size_t n = process->object_infos.size();
   snapshot->snapshot_regions.resize(n + 1);
@@ -394,7 +394,7 @@ static std::vector<s_mc_stack_frame_t> unwind_stack_frames(simgrid::mc::UnwindCo
   return std::move(result);
 };
 
-static std::vector<s_mc_snapshot_stack_t> take_snapshot_stacks(mc_snapshot_t * snapshot)
+static std::vector<s_mc_snapshot_stack_t> take_snapshot_stacks(simgrid::mc::Snapshot* * snapshot)
 {
   std::vector<s_mc_snapshot_stack_t> res;
 
@@ -425,7 +425,7 @@ static std::vector<s_mc_snapshot_stack_t> take_snapshot_stacks(mc_snapshot_t * s
 
 }
 
-static void snapshot_handle_ignore(mc_snapshot_t snapshot)
+static void snapshot_handle_ignore(simgrid::mc::Snapshot* snapshot)
 {
   xbt_assert(snapshot->process());
   
@@ -447,7 +447,7 @@ static void snapshot_handle_ignore(mc_snapshot_t snapshot)
 
 }
 
-static void snapshot_ignore_restore(mc_snapshot_t snapshot)
+static void snapshot_ignore_restore(simgrid::mc::Snapshot* snapshot)
 {
   for (auto const& ignored_data : snapshot->ignored_data)
     snapshot->process()->write_bytes(
@@ -540,13 +540,13 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
   return std::move(fds);
 }
 
-mc_snapshot_t take_snapshot(int num_state)
+simgrid::mc::Snapshot* take_snapshot(int num_state)
 {
   XBT_DEBUG("Taking snapshot %i", num_state);
 
   simgrid::mc::Process* mc_process = &mc_model_checker->process();
 
-  mc_snapshot_t snapshot = new simgrid::mc::Snapshot(mc_process);
+  simgrid::mc::Snapshot* snapshot = new simgrid::mc::Snapshot(mc_process);
 
   snapshot->num_state = num_state;
 
@@ -584,7 +584,7 @@ mc_snapshot_t take_snapshot(int num_state)
 }
 
 static inline
-void restore_snapshot_regions(mc_snapshot_t snapshot)
+void restore_snapshot_regions(simgrid::mc::Snapshot* snapshot)
 {
   for(std::unique_ptr<s_mc_mem_region_t> const& region : snapshot->snapshot_regions) {
     // For privatized, variables we decided it was not necessary to take the snapshot:
@@ -605,7 +605,7 @@ void restore_snapshot_regions(mc_snapshot_t snapshot)
 }
 
 static inline
-void restore_snapshot_fds(mc_snapshot_t snapshot)
+void restore_snapshot_fds(simgrid::mc::Snapshot* snapshot)
 {
   if (mc_mode == MC_MODE_SERVER)
     xbt_die("FD snapshot not implemented in client/server mode.");
@@ -624,7 +624,7 @@ void restore_snapshot_fds(mc_snapshot_t snapshot)
   }
 }
 
-void restore_snapshot(mc_snapshot_t snapshot)
+void restore_snapshot(simgrid::mc::Snapshot* snapshot)
 {
   XBT_DEBUG("Restore snapshot %i", snapshot->num_state);
   const bool use_soft_dirty = _sg_mc_sparse_checkpoint && _sg_mc_soft_dirty;
index 33371e4..22dbfaf 100644 (file)
@@ -13,6 +13,7 @@
 #include <xbt/sysdep.h>
 
 #include "src/internal_config.h"
+#include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_safety.h"
 #include "src/mc/mc_liveness.h"
 #include "src/mc/mc_private.h"
@@ -70,8 +71,8 @@ extern "C" {
 
 static int compare_areas_with_type(ComparisonState& state,
                                    int process_index,
-                                   void* real_area1, mc_snapshot_t snapshot1, mc_mem_region_t region1,
-                                   void* real_area2, mc_snapshot_t snapshot2, mc_mem_region_t region2,
+                                   void* real_area1, simgrid::mc::Snapshot* snapshot1, mc_mem_region_t region1,
+                                   void* real_area2, simgrid::mc::Snapshot* snapshot2, mc_mem_region_t region2,
                                    simgrid::mc::Type* type, int pointer_level)
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
@@ -227,8 +228,8 @@ static int compare_areas_with_type(ComparisonState& state,
 static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
                                     int process_index,
                                     mc_mem_region_t r1,
-                                    mc_mem_region_t r2, mc_snapshot_t snapshot1,
-                                    mc_snapshot_t snapshot2)
+                                    mc_mem_region_t r2, simgrid::mc::Snapshot* snapshot1,
+                                    simgrid::mc::Snapshot* snapshot2)
 {
   xbt_assert(r1 && r2, "Missing region.");
 
@@ -290,8 +291,8 @@ static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
 }
 
 static int compare_local_variables(int process_index,
-                                   mc_snapshot_t snapshot1,
-                                   mc_snapshot_t snapshot2,
+                                   simgrid::mc::Snapshot* snapshot1,
+                                   simgrid::mc::Snapshot* snapshot2,
                                    mc_snapshot_stack_t stack1,
                                    mc_snapshot_stack_t stack2)
 {
@@ -351,7 +352,8 @@ int snapshot_compare(void *state1, void *state2)
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
 
-  mc_snapshot_t s1, s2;
+  simgrid::mc::Snapshot* s1;
+  simgrid::mc::Snapshot* s2;
   int num1, num2;
 
   if (_sg_mc_liveness) {        /* Liveness MC */
index 6e2bb9f..f0d0896 100644 (file)
@@ -288,7 +288,7 @@ void reset_heap_information()
 
 // TODO, have a robust way to find it in O(1)
 static inline
-mc_mem_region_t MC_get_heap_region(mc_snapshot_t snapshot)
+mc_mem_region_t MC_get_heap_region(simgrid::mc::Snapshot* snapshot)
 {
   size_t n = snapshot->snapshot_regions.size();
   for (size_t i=0; i!=n; ++i) {
@@ -299,7 +299,7 @@ mc_mem_region_t MC_get_heap_region(mc_snapshot_t snapshot)
   xbt_die("No heap region");
 }
 
-int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
+int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot* snapshot2)
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
   struct s_mc_diff *state = mc_diff_info;
@@ -653,8 +653,8 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
  */
 static int compare_heap_area_without_type(struct s_mc_diff *state, int process_index,
                                           const void *real_area1, const void *real_area2,
-                                          mc_snapshot_t snapshot1,
-                                          mc_snapshot_t snapshot2,
+                                          simgrid::mc::Snapshot* snapshot1,
+                                          simgrid::mc::Snapshot* snapshot2,
                                           xbt_dynar_t previous, int size,
                                           int check_ignore)
 {
@@ -742,8 +742,8 @@ static int compare_heap_area_without_type(struct s_mc_diff *state, int process_i
  */
 static int compare_heap_area_with_type(struct s_mc_diff *state, int process_index,
                                        const void *real_area1, const void *real_area2,
-                                       mc_snapshot_t snapshot1,
-                                       mc_snapshot_t snapshot2,
+                                       simgrid::mc::Snapshot* snapshot1,
+                                       simgrid::mc::Snapshot* snapshot2,
                                        xbt_dynar_t previous, simgrid::mc::Type* type,
                                        int area_size, int check_ignore,
                                        int pointer_level)
@@ -951,7 +951,7 @@ top:
  */
 static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::Type* type,
                                  int offset, int area_size,
-                                 mc_snapshot_t snapshot, int process_index)
+                                 simgrid::mc::Snapshot* snapshot, int process_index)
 {
 
   // Beginning of the block, the infered variable type if the type of the block:
@@ -1005,8 +1005,8 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
  * @param pointer_level
  * @return 0 (same), 1 (different), -1
  */
-int compare_heap_area(int process_index, const void *area1, const void *area2, mc_snapshot_t snapshot1,
-                      mc_snapshot_t snapshot2, xbt_dynar_t previous,
+int compare_heap_area(int process_index, const void *area1, const void *area2, simgrid::mc::Snapshot* snapshot1,
+                      simgrid::mc::Snapshot* snapshot2, xbt_dynar_t previous,
                       simgrid::mc::Type* type, int pointer_level)
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
diff --git a/src/mc/mc_forward.h b/src/mc/mc_forward.h
deleted file mode 100644 (file)
index 40d9993..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/** \file mc_forward.h
- *
- *  Define type names for pointers of MC objects for the C code
- */
-
-#ifndef SIMGRID_MC_FORWARD_H
-#define SIMGRID_MC_FORWARD_H
-
-#ifdef __cplusplus
-
-// If we're in C++, we give the real definition:
-#include "mc_forward.hpp"
-typedef simgrid::mc::Snapshot *mc_snapshot_t;
-typedef simgrid::mc::Type *mc_type_t;
-
-#else
-
-// Otherwise we use dummy opaque structs:
-typedef struct _mc_snapshot_t *mc_snapshot_t;
-typedef struct _s_mc_type_t *mc_type_t;
-
-#endif
-
-#endif
index de35d20..964e94d 100644 (file)
 #include "xbt/parmap.h"
 #include <xbt/base.h>
 
-#include "src/mc/mc_forward.h"
+#ifdef __cplusplus
+#include "src/mc/mc_forward.hpp"
+#endif
+
 #include "src/mc/mc_protocol.h"
 
 SG_BEGIN_DECL()
index 931584b..689d93a 100644 (file)
@@ -31,7 +31,7 @@ extern XBT_PRIVATE simgrid::mc::ReductionMode reduction_mode;
 int modelcheck_safety(void);
 
 struct XBT_PRIVATE VisitedState {
-  mc_snapshot_t system_state;
+  simgrid::mc::Snapshot* system_state;
   size_t heap_bytes_used;
   int nb_processes;
   int num;
index 12a3ef6..49147ba 100644 (file)
@@ -148,8 +148,8 @@ int MC_snapshot_region_memcmp(
  * @return same as memcmp
  * */
 int MC_snapshot_memcmp(
-  const void* addr1, mc_snapshot_t snapshot1,
-  const void* addr2, mc_snapshot_t snapshot2, int process_index, size_t size)
+  const void* addr1, simgrid::mc::Snapshot* snapshot1,
+  const void* addr2, simgrid::mc::Snapshot* snapshot2, int process_index, size_t size)
 {
   mc_mem_region_t region1 = mc_get_snapshot_region(addr1, snapshot1, process_index);
   mc_mem_region_t region2 = mc_get_snapshot_region(addr2, snapshot2, process_index);
index e73b228..2711b69 100644 (file)
@@ -129,7 +129,7 @@ typedef struct XBT_PRIVATE s_mc_snapshot_stack {
 } s_mc_snapshot_stack_t, *mc_snapshot_stack_t;
 
 typedef struct s_mc_global_t {
-  mc_snapshot_t snapshot;
+  simgrid::mc::Snapshot* snapshot;
   int prev_pair;
   char *prev_req;
   int initial_communications_pattern_done;
@@ -169,7 +169,7 @@ public: // To be private
 extern "C" {
 
 static inline __attribute__ ((always_inline))
-mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int process_index, mc_mem_region_t region)
+mc_mem_region_t mc_get_region_hinted(void* addr, simgrid::mc::Snapshot* snapshot, int process_index, mc_mem_region_t region)
 {
   if (region->contain(simgrid::mc::remote(addr)))
     return region;
@@ -177,7 +177,7 @@ mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int pro
     return mc_get_snapshot_region(addr, snapshot, process_index);
 }
 
-static const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot);
+static const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot);
 
 }
 
@@ -186,8 +186,8 @@ static const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot);
 namespace simgrid {
 namespace mc {
 
-XBT_PRIVATE mc_snapshot_t take_snapshot(int num_state);
-XBT_PRIVATE void restore_snapshot(mc_snapshot_t);
+XBT_PRIVATE simgrid::mc::Snapshot* take_snapshot(int num_state);
+XBT_PRIVATE void restore_snapshot(simgrid::mc::Snapshot*);
 
 }
 }
@@ -207,11 +207,11 @@ int MC_snapshot_region_memcmp(
   const void* addr1, mc_mem_region_t region1,
   const void* addr2, mc_mem_region_t region2, std::size_t size);
 XBT_PRIVATE int MC_snapshot_memcmp(
-  const void* addr1, mc_snapshot_t snapshot1,
-  const void* addr2, mc_snapshot_t snapshot2, int process_index, std::size_t size);
+  const void* addr1, simgrid::mc::Snapshot* snapshot1,
+  const void* addr2, simgrid::mc::Snapshot* snapshot2, int process_index, std::size_t size);
 
 static inline __attribute__ ((always_inline))
-const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot)
+const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot)
 {
   if(snapshot==NULL)
       xbt_die("snapshot is NULL");
index 40c9a6e..292d15c 100644 (file)
@@ -47,7 +47,7 @@ typedef struct XBT_PRIVATE mc_state {
   s_smx_simcall_t executed_req;         /* The executed request of the state */
   int req_num;                      /* The request number (in the case of a
                                        multi-request like waitany ) */
-  mc_snapshot_t system_state;      /* Snapshot of system state */
+  simgrid::mc::Snapshot* system_state;      /* Snapshot of system state */
   int num;
   int in_visited_states;
   // comm determinism verification (xbt_dynar_t<xbt_dynar_t<mc_comm_pattern_t>):
index 5eacc32..278ce88 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "src/mc/mc_replay.h"
 #include "smx_private.h"
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "xbt/ex.h"
 #include "mc/mc.h"
 #include "src/simix/smx_host_private.h"
index 05e6b82..f5035a2 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "smx_private.h"
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #include "xbt/ex.h"
 #include <simgrid/simix.hpp>
   
index ecaa6b8..d7a8dc8 100644 (file)
@@ -16,7 +16,7 @@
 #include <xbt/base.h>
 #include "smx_private.h"
 #if HAVE_MC
-#include "src/mc/mc_forward.h"
+#include "src/mc/mc_forward.hpp"
 #endif
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
index 0d5427b..71bd4ed 100644 (file)
@@ -16,7 +16,6 @@ SG_BEGIN_DECL()
 XBT_PUBLIC_DATA(const char*) simcall_names[]; /* Name of each simcall */
 
 #include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
-#include "src/mc/mc_forward.h" /* Definition of mc_snapshot_t, used by one simcall */
 
 typedef int (*simix_match_func_t)(void *, void *, smx_synchro_t);
 typedef void (*simix_copy_data_func_t)(smx_synchro_t, void*, size_t);
index 0265346..3bf49a5 100755 (executable)
@@ -309,7 +309,7 @@ if __name__ == '__main__':
     fd.write('#include <xbt/base.h>\n')
     fd.write('#include "smx_private.h"\n')
     fd.write('#if HAVE_MC\n')
-    fd.write('#include "src/mc/mc_forward.h"\n')
+    fd.write('#include "src/mc/mc_forward.hpp"\n')
     fd.write('#endif\n')
     fd.write('\n')
     fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n')
@@ -362,7 +362,7 @@ if __name__ == '__main__':
     #
     fd = header('popping_bodies.cpp')
     fd.write('#include "smx_private.h"\n')
-    fd.write('#include "src/mc/mc_forward.h"\n')
+    fd.write('#include "src/mc/mc_forward.hpp"\n')
     fd.write('#include "xbt/ex.h"\n')
     fd.write('#include <simgrid/simix.hpp>\n')
     handle(fd, Simcall.body, simcalls, simcalls_dict)
index 79e7ee3..5047e92 100644 (file)
@@ -568,8 +568,6 @@ set(MC_SRC
   src/mc/Type.hpp
   src/mc/Variable.cpp
   src/mc/Variable.hpp
-
-  src/mc/mc_forward.h
   src/mc/mc_forward.hpp
   src/mc/Process.hpp
   src/mc/Process.cpp