Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't use pass-by-value for large parameters.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 10 Mar 2019 17:50:42 +0000 (18:50 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 11 Mar 2019 08:18:41 +0000 (09:18 +0100)
src/mc/mc_global.cpp
src/mc/mc_unw.hpp
src/mc/remote/RemoteClient.cpp
src/mc/sosp/RegionSnapshot.hpp
src/msg/msg_private.hpp
src/msg/msg_task.cpp

index f85660a..0dfb9f8 100644 (file)
@@ -122,7 +122,7 @@ void MC_automaton_load(const char *file)
 namespace simgrid {
 namespace mc {
 
-void dumpStack(FILE* file, unw_cursor_t cursor)
+void dumpStack(FILE* file, unw_cursor_t&& cursor)
 {
   int nframe = 0;
   char buffer[100];
@@ -165,7 +165,7 @@ static void MC_dump_stacks(FILE* file)
     context.initialize(&mc_model_checker->process(), &raw_context);
 
     unw_cursor_t cursor = context.cursor();
-    simgrid::mc::dumpStack(file, cursor);
+    simgrid::mc::dumpStack(file, std::move(cursor));
   }
 }
 #endif
index 4e949d4..aedcf7e 100644 (file)
@@ -75,7 +75,7 @@ public:
   static unw_addr_space_t createUnwindAddressSpace();
 };
 
-void dumpStack(FILE* file, unw_cursor_t cursor);
+void dumpStack(FILE* file, unw_cursor_t&& cursor);
 void dumpStack(FILE* file, pid_t pid);
 }
 }
index 9275ec5..9904e03 100644 (file)
@@ -628,7 +628,7 @@ void RemoteClient::dumpStack()
     return;
   }
 
-  simgrid::mc::dumpStack(stderr, cursor);
+  simgrid::mc::dumpStack(stderr, std::move(cursor));
 
   _UPT_destroy(context);
   unw_destroy_addr_space(as);
index 4e051c4..d1011af 100644 (file)
@@ -205,7 +205,7 @@ public:
   const Buffer& flat_data() const { return flat_data_; }
   Buffer& flat_data() { return flat_data_; }
 
-  void page_data(ChunkedData page_data)
+  void page_data(ChunkedData&& page_data)
   {
     storage_type_ = StorageType::Chunked;
     flat_data_.clear();
index adf3cc3..ab76546 100644 (file)
@@ -29,8 +29,8 @@ class Task {
   bool is_used_    = false; /* Indicates whether the task is used in SIMIX currently */
 
   explicit Task(std::string name, double flops_amount, double bytes_amount, void* data);
-  explicit Task(std::string name, std::vector<s4u::Host*> hosts, std::vector<double> flops_amount,
-                std::vector<double> bytes_amount, void* data);
+  explicit Task(std::string name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
+                std::vector<double>&& bytes_amount, void* data);
 
   void report_multiple_use() const;
 
index 5fa41d1..8068a8d 100644 (file)
@@ -27,8 +27,8 @@ Task::Task(std::string name, double flops_amount, double bytes_amount, void* dat
     MC_ignore_heap(&(id_), sizeof(id_));
 }
 
-Task::Task(std::string name, std::vector<s4u::Host*> hosts, std::vector<double> flops_amount,
-           std::vector<double> bytes_amount, void* data)
+Task::Task(std::string name, std::vector<s4u::Host*>&& hosts, std::vector<double>&& flops_amount,
+           std::vector<double>&& bytes_amount, void* data)
     : Task(std::move(name), 1.0, 0, data)
 {
   parallel_             = true;