Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Boost.Context context factory
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 4 Jun 2015 10:51:06 +0000 (12:51 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 5 Jun 2015 10:50:44 +0000 (12:50 +0200)
 * This is a portable replacement for ucontext.h (makecontext,
   swapcontext, getcontext, setcontext) which is not in recent POSIX
   specs and was apparently removed from Mac OS X since 10.9. POSIX
   2008 still has ucontext_t however (moved into signal.h).

 * Currently works only for Boost <= 1.55 (the Boost.Context API
   changed slightly afterwards).

 * Does not work with MC because we currently depend on the contexts
   being ucontext_t (we'd have to convert fcontext into ucontext_t).

 * No support for parallel execution support (yet).

buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/PrintArgs.cmake
buildtools/Cmake/src/internal_config.h.in
src/mc/mc_process.cpp
src/simix/smx_context.c
src/simix/smx_context_boost.cpp [new file with mode: 0644]
src/simix/smx_private.h

index 9b19319..4c0e446 100644 (file)
@@ -51,6 +51,7 @@ MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
   ENDFOREACH()
   FOREACH(FACTORY ${FACTORIES})
     if ((${FACTORY} STREQUAL "thread") OR
+        (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXT) OR
         (${FACTORY} STREQUAL "raw" AND HAVE_RAWCTX) OR
         (${FACTORY} STREQUAL "ucontext" AND CONTEXT_UCONTEXT))
       ADD_TESH("${NAME}-${FACTORY}" "--cfg" "contexts/factory:${FACTORY}" ${ARGR})
@@ -208,54 +209,54 @@ IF(NOT enable_memcheck)
   ADD_TESH(msg-remote-io                         --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/io/remote.tesh)
   ADD_TESH(msg-start-kill-time                   --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/start_kill_time/start_kill_time.tesh)
   ADD_TESH(msg-chainsend                         --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chainsend --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend --cd ${CMAKE_HOME_DIRECTORY}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/chainsend/chainsend.tesh)
-  ADD_TESH_FACTORIES(msg-sendrecv-CLM03          "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_CLM03.tesh)
-  ADD_TESH_FACTORIES(msg-sendrecv-Vegas          "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Vegas.tesh)
-  ADD_TESH_FACTORIES(msg-sendrecv-Reno           "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Reno.tesh)
-  ADD_TESH_FACTORIES(msg-suspend                 "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/suspend/suspend.tesh)
+  ADD_TESH_FACTORIES(msg-sendrecv-CLM03          "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_CLM03.tesh)
+  ADD_TESH_FACTORIES(msg-sendrecv-Vegas          "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Vegas.tesh)
+  ADD_TESH_FACTORIES(msg-sendrecv-Reno           "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Reno.tesh)
+  ADD_TESH_FACTORIES(msg-suspend                 "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/suspend/suspend.tesh)
   # This one is not usable:
   # ADD_TESH_FACTORIES(msg-exception                 "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/exception/exception.tesh)
-  ADD_TESH_FACTORIES(msg-pmm                     "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/pmm/pmm.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-bypass      "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_bypass.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-kill        "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_kill.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-multicore   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_multicore.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-mailbox   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic           "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-forwarder "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-failure   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave             "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-forwarder   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-failure     "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-mailbox     "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-cpu-ti      "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/masterslave --cd ${CMAKE_HOME_DIRECTORY}/examples/msg masterslave/masterslave_cpu_ti_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-masterslave-vivaldi     "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_vivaldi.tesh)
-  ADD_TESH_FACTORIES(msg-cloud-master-worker-vm      "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/master_worker_vm.tesh)
-  ADD_TESH_FACTORIES(msg-cloud-two-tasks-vm      "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/two_tasks_vm.tesh)
-  ADD_TESH_FACTORIES(msg-cloud-simple-vm         "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/simple_vm.tesh)
-  ADD_TESH_FACTORIES(msg-energy-pstates          "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/pstate/pstate.tesh)
-  ADD_TESH_FACTORIES(msg-energy-consumption      "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e2/energy_consumption.tesh)
-  ADD_TESH_FACTORIES(msg-energy-concurrent-tasks "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e3/concurrent_tasks.tesh)
-  ADD_TESH_FACTORIES(msg-token-ring              "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg/token_ring ${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring/token_ring.tesh)
-  ADD_TESH_FACTORIES(msg-migration               "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/migration/migration.tesh)
+  ADD_TESH_FACTORIES(msg-pmm                     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/pmm/pmm.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-bypass      "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_bypass.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-kill        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_kill.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-multicore   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_multicore.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-mailbox   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic           "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-forwarder "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-no-crosstraffic-failure   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave             "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-forwarder   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_forwarder_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-failure     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_failure_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-mailbox     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_mailbox_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-cpu-ti      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/masterslave --cd ${CMAKE_HOME_DIRECTORY}/examples/msg masterslave/masterslave_cpu_ti_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-masterslave-vivaldi     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_vivaldi.tesh)
+  ADD_TESH_FACTORIES(msg-cloud-master-worker-vm      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/master_worker_vm.tesh)
+  ADD_TESH_FACTORIES(msg-cloud-two-tasks-vm      "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/two_tasks_vm.tesh)
+  ADD_TESH_FACTORIES(msg-cloud-simple-vm         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/cloud/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/ --cd ${CMAKE_BINARY_DIR}/examples/msg/cloud/ ${CMAKE_HOME_DIRECTORY}/examples/msg/cloud/simple_vm.tesh)
+  ADD_TESH_FACTORIES(msg-energy-pstates          "thread;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/pstate/pstate.tesh)
+  ADD_TESH_FACTORIES(msg-energy-consumption      "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e2/energy_consumption.tesh)
+  ADD_TESH_FACTORIES(msg-energy-concurrent-tasks "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e3/concurrent_tasks.tesh)
+  ADD_TESH_FACTORIES(msg-token-ring              "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg/token_ring ${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring/token_ring.tesh)
+  ADD_TESH_FACTORIES(msg-migration               "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/migration/migration.tesh)
   ADD_TESH_FACTORIES(msg-ptask                   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_task/parallel_task.tesh)
-  ADD_TESH_FACTORIES(msg-priority                "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/priority/priority.tesh)
-  ADD_TESH_FACTORIES(msg-properties              "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/properties/msg_prop.tesh)
-  ADD_TESH_FACTORIES(msg-icomms                  "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/icomms --cd ${CMAKE_BINARY_DIR}/examples/msg/icomms ${CMAKE_HOME_DIRECTORY}/examples/msg/icomms/peer.tesh)
-  ADD_TESH_FACTORIES(msg-actions                 "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/actions --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/actions actions.tesh)
-  ADD_TESH_FACTORIES(msg-chord-no-crosstraffic   "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord.tesh)
+  ADD_TESH_FACTORIES(msg-priority                "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/priority/priority.tesh)
+  ADD_TESH_FACTORIES(msg-properties              "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/properties/msg_prop.tesh)
+  ADD_TESH_FACTORIES(msg-icomms                  "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/icomms --cd ${CMAKE_BINARY_DIR}/examples/msg/icomms ${CMAKE_HOME_DIRECTORY}/examples/msg/icomms/peer.tesh)
+  ADD_TESH_FACTORIES(msg-actions                 "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/actions --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/actions actions.tesh)
+  ADD_TESH_FACTORIES(msg-chord-no-crosstraffic   "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord.tesh)
   ADD_TESH_FACTORIES(msg-chord-no-crosstraffic-parallel "thread;ucontext;raw" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord.tesh)
-  ADD_TESH_FACTORIES(msg-chord                   "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord_crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-chord                   "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord_crosstraffic.tesh)
   ADD_TESH_FACTORIES(msg-chord-parallel          "thread;ucontext;raw" --cfg contexts/nthreads:4  ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/chord --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/chord chord_crosstraffic.tesh)
-  ADD_TESH_FACTORIES(msg-bittorrent              "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/bittorrent --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/bittorrent bittorrent.tesh)
+  ADD_TESH_FACTORIES(msg-bittorrent              "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/bittorrent --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/bittorrent bittorrent.tesh)
   ADD_TESH_FACTORIES(msg-bittorrent-parallel     "thread;ucontext;raw" --cfg contexts/nthreads:4  ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/bittorrent --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/bittorrent bittorrent.tesh)
-  ADD_TESH_FACTORIES(msg-kademlia                "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/kademlia --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/kademlia kademlia.tesh)
+  ADD_TESH_FACTORIES(msg-kademlia                "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/kademlia --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/kademlia kademlia.tesh)
   ADD_TESH_FACTORIES(msg-kademlia-parallel       "thread;ucontext;raw" --cfg contexts/nthreads:4 --cfg contexts/factory:thread ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/kademlia --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/kademlia kademlia.tesh)
-  ADD_TESH_FACTORIES(msg-gtnets-crosstraffic     "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-crosstraffic.tesh)
+  ADD_TESH_FACTORIES(msg-gtnets-crosstraffic     "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-crosstraffic.tesh)
   IF(HAVE_GTNETS)
-    ADD_TESH_FACTORIES(msg-gtnets-waxman         "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-waxman.tesh)
-    ADD_TESH_FACTORIES(msg-gtnets-dogbone        "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-dogbone-gtnets.tesh)
-    ADD_TESH_FACTORIES(msg-gtnets-onelink        "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-onelink-gtnets.tesh)
-    ADD_TESH_FACTORIES(msg-gtnets-dogbone-lv08   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-dogbone-lv08.tesh)
-    ADD_TESH_FACTORIES(msg-gtnets-onelink-lv08   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-onelink-lv08.tesh)
+    ADD_TESH_FACTORIES(msg-gtnets-waxman         "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-waxman.tesh)
+    ADD_TESH_FACTORIES(msg-gtnets-dogbone        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-dogbone-gtnets.tesh)
+    ADD_TESH_FACTORIES(msg-gtnets-onelink        "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-onelink-gtnets.tesh)
+    ADD_TESH_FACTORIES(msg-gtnets-dogbone-lv08   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-dogbone-lv08.tesh)
+    ADD_TESH_FACTORIES(msg-gtnets-onelink-lv08   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/gtnets-onelink-lv08.tesh)
     ADD_TESH(msg-tracing-gtnets-waxman         --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/tracing-gtnets-waxman.tesh)
     ADD_TESH(msg-tracing-gtnets-dogbone        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/tracing-gtnets-dogbone-gtnets.tesh)
     ADD_TESH(msg-tracing-gtnets-onelink        --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/tracing-gtnets-onelink-gtnets.tesh)
@@ -263,7 +264,7 @@ IF(NOT enable_memcheck)
     ADD_TESH(msg-tracing-gtnets-onelink-lv08   --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/gtnets/tracing-gtnets-onelink-lv08.tesh)
   ENDIF()
   IF(HAVE_NS3)
-    ADD_TESH_FACTORIES(msg-ns3                   "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
+    ADD_TESH_FACTORIES(msg-ns3                   "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/ns3/ns3.tesh)
   ENDIF()
 
   ADD_TESH(tracing-ms                          --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/ms.tesh)
@@ -352,16 +353,16 @@ IF(NOT enable_memcheck)
     # smpi broken usage
     ADD_TESH_FACTORIES(tesh-smpi-broken          "thread"              --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong broken_hostfiles.tesh)
     # smpi examples
-    ADD_TESH_FACTORIES(tesh-smpi-bcast           "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/bcast --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast bcast.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-reduce          "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/reduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce reduce.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-vector          "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-hvector         "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/hvector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector hvector.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-indexed         "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/indexed --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed indexed.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-struct          "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-pt2pt           "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong pt2pt.tesh)
-    ADD_TESH_FACTORIES(tesh-smpi-compute         "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/compute --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute compute.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-bcast           "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/bcast --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast bcast.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-reduce          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/reduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce reduce.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-vector          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-hvector         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/hvector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector hvector.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-indexed         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/indexed --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed indexed.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-struct          "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-pt2pt           "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong pt2pt.tesh)
+    ADD_TESH_FACTORIES(tesh-smpi-compute         "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/compute --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute compute.tesh)
     IF(NOT WIN32)
-      ADD_TESH_FACTORIES(tesh-smpi-shared        "thread;ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
+      ADD_TESH_FACTORIES(tesh-smpi-shared        "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
     ENDIF()
     # https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
     ADD_TESH_FACTORIES(tesh-smpi-bug-17132       "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.tesh)
@@ -454,12 +455,12 @@ IF(NOT enable_memcheck)
     ENDIF()
 
     # BEGIN TESH TESTS
-    ADD_TESH_FACTORIES(smpi-energy               "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
+    ADD_TESH_FACTORIES(smpi-energy               "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
     IF(SMPI_FORTRAN)
-      ADD_TESH_FACTORIES(smpi-energy-f77         "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f77/energy.tesh)
-      ADD_TESH_FACTORIES(smpi-energy-f90         "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f90/energy.tesh)
+      ADD_TESH_FACTORIES(smpi-energy-f77         "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f77/energy.tesh)
+      ADD_TESH_FACTORIES(smpi-energy-f90         "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f90/energy.tesh)
     ENDIF()
-    ADD_TESH_FACTORIES(smpi-msg-masterslave      "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_msg_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh)
+    ADD_TESH_FACTORIES(smpi-msg-masterslave      "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_msg_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh)
     IF(NOT HAVE_MC)
       ADD_TESH(smpi-replay-multiple      --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple --cd ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/replay_multiple.tesh)
     ENDIF()
index c4eb5fd..7fcb767 100644 (file)
@@ -379,9 +379,20 @@ set(SIMIX_SRC
   src/simix/smx_synchro.c
   src/simix/smx_vm.c
   src/simix/popping.c
+
   ${SIMIX_GENERATED_SRC}
   )
 
+if (HAVE_BOOST_CONTEXT)
+  set(SIMIX_SRC
+      ${SIMIX_SRC}
+      src/simix/smx_context_boost.cpp)
+else()
+  set(EXTRA_DIST
+      ${EXTRA_DIST}
+      src/simix/smx_context_boost.cpp)
+endif()
+
 set(SIMGRID_SRC
   src/simgrid/sg_config.c
   )
index 3e3e538..fc2aa83 100644 (file)
@@ -33,6 +33,7 @@ endif()
 # Compute the dependencies of SimGrid
 #####################################
 set(SIMGRID_DEP "-lm")
+set(SIMGRID_DEP "${SIMGRID_DEP} ${Boost_CONTEXT_LIBRARY}")
 
 if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
     AND NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.0
index 9805a49..e4ed2e8 100644 (file)
@@ -74,65 +74,67 @@ if(enable_print_message)
 endif()
 
 message("\nConfiguration of package `simgrid':")
-message("        BUILDNAME ...........: ${BUILDNAME}")
-message("        SITE ................: ${SITE}")
+message("        BUILDNAME ...................: ${BUILDNAME}")
+message("        SITE ........................: ${SITE}")
 if(release)
-  message("        Release .............: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (release build)")
+  message("        Release .....................: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (release build)")
 else()
-  message("        Release .............: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (development build)")
+  message("        Release .....................: simgrid-${release_version}${SIMGRID_VERSION_EXTRA} (development build)")
 endif()
 message("")
-message("        Compiler: C .........: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})")
-message("                version .....: ${COMPILER_C_VERSION}")
+message("        Compiler: C .................: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})")
+message("                version .............: ${COMPILER_C_VERSION}")
 if(CMAKE_CXX_COMPILER)
-  message("        Compiler: C++ .......: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})")
-  message("                version .....: ${COMPILER_CXX_VERSION}")
+  message("        Compiler: C++ ...............: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})")
+  message("                version .............: ${COMPILER_CXX_VERSION}")
 endif()
 if(CMAKE_Java_COMPILER)
-  message("        Compiler: Java ......: ${CMAKE_Java_COMPILER} (${CMAKE_Java_COMPILER_ID})")
-  message("                version .....: ${COMPILER_Java_VERSION}")
+  message("        Compiler: Java ..............: ${CMAKE_Java_COMPILER} (${CMAKE_Java_COMPILER_ID})")
+  message("                version .............: ${COMPILER_Java_VERSION}")
 endif()
 if(CMAKE_Fortran_COMPILER)
-  message("        Compiler: Fortran ...: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})")
-  message("                version .....: ${COMPILER_Fortran_VERSION}")
+  message("        Compiler: Fortran ...........: ${CMAKE_Fortran_COMPILER} (${CMAKE_Fortran_COMPILER_ID})")
+  message("                version .............: ${COMPILER_Fortran_VERSION}")
 endif()
-message("        Linker: .............: ${CMAKE_LINKER}")
+message("        Linker: .....................: ${CMAKE_LINKER}")
 message("")
-message("        CFlags ..............: ${CMAKE_C_FLAGS}")
-message("        CXXFlags ............: ${CMAKE_CXX_FLAGS}")
-message("        LDFlags .............: ${CMAKE_C_LINK_FLAGS}")
+message("        CFlags ......................: ${CMAKE_C_FLAGS}")
+message("        CXXFlags ....................: ${CMAKE_CXX_FLAGS}")
+message("        LDFlags .....................: ${CMAKE_C_LINK_FLAGS}")
 message("")
 if(NOT APPLE AND NOT WIN32)
-  message("        Compile Gtnets ......: ${HAVE_GTNETS}")
-  message("        Compile NS-3 ........: ${HAVE_NS3}")
-  message("        Gtnets path .........: ${gtnets_path}")
-  message("        NS-3 path ...........: ${ns3_path}")
+  message("        Compile Gtnets ..............: ${HAVE_GTNETS}")
+  message("        Compile NS-3 ................: ${HAVE_NS3}")
+  message("        Gtnets path .................: ${gtnets_path}")
+  message("        NS-3 path ...................: ${ns3_path}")
 endif()
-message("        Compile Java ........: ${HAVE_Java}")
-message("        Compile Scala........: ${HAVE_Scala}")
-message("        Compile Lua .........: ${HAVE_LUA}")
-message("        Compile Smpi ........: ${HAVE_SMPI}")
-message("        Compile MPI testsuite: ${enable_smpi_MPICH3_testsuite}")
-message("        Compile Smpi f77 ....: ${SMPI_FORTRAN}")
-message("        Compile Smpi f90 ....: ${SMPI_FORTRAN}")
-message("        Compile Static ......: ${enable_lib_static}")
+
+message("        Compile Java ................: ${HAVE_Java}")
+message("        Compile Scala................: ${HAVE_Scala}")
+message("        Compile Lua .................: ${HAVE_LUA}")
+message("        Compile Smpi ................: ${HAVE_SMPI}")
+message("        Compile MPI testsuite .......: ${enable_smpi_MPICH3_testsuite}")
+message("        Compile Smpi f77 ............: ${SMPI_FORTRAN}")
+message("        Compile Smpi f90 ............: ${SMPI_FORTRAN}")
+message("        Compile Boost.Context support: ${HAVE_BOOST_CONTEXT}")
+message("        Compile Static ..............: ${enable_lib_static}")
 if(enable_java)
-  message("        Native lib in jar ...: ${enable_lib_in_jar}")
+  message("        Native lib in jar ...........: ${enable_lib_in_jar}")
 endif()
 message("")
-message("        Maintainer mode .....: ${enable_maintainer_mode}")
-message("        Documentation........: ${enable_documentation}")
-message("        Model checking ......: ${HAVE_MC}")
-message("        Tracing mode ........: ${enable_tracing}")
-message("        Jedule  mode ........: ${enable_jedule}")
-message("        Latency bound .......: ${enable_latency_bound_tracking}")
-message("        Graphviz mode .......: ${HAVE_GRAPHVIZ}")
-message("        Sigc++ mode .........: ${HAVE_LIBSIGC++}")
-message("        Mallocators .........: ${enable_mallocators}")
+message("        Maintainer mode .............: ${enable_maintainer_mode}")
+message("        Documentation................: ${enable_documentation}")
+message("        Model checking ..............: ${HAVE_MC}")
+message("        Tracing mode ................: ${enable_tracing}")
+message("        Jedule  mode ................: ${enable_jedule}")
+message("        Latency bound ...............: ${enable_latency_bound_tracking}")
+message("        Graphviz mode ...............: ${HAVE_GRAPHVIZ}")
+message("        Sigc++ mode .................: ${HAVE_LIBSIGC++}")
+message("        Mallocators .................: ${enable_mallocators}")
 message("")
-message("        Simgrid dependencies : ${SIMGRID_DEP}")
+message("        Simgrid dependencies ........: ${SIMGRID_DEP}")
 message("")
-message("        INSTALL_PREFIX ......: ${CMAKE_INSTALL_PREFIX}")
+message("        INSTALL_PREFIX ..............: ${CMAKE_INSTALL_PREFIX}")
 
 exec_program("${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/Testing/Notes/" OUTPUT_VARIABLE OKIDOKI)
 file(WRITE ${PROJECT_BINARY_DIR}/Testing/Notes/Build  "GIT version : ${GIT_VERSION}\n")
index 71ffdbd..3612538 100644 (file)
 #cmakedefine PROCESSOR_x86_64 @PROCESSOR_x86_64@
 #cmakedefine CMAKE_SYSTEM_PROCESSOR @CMAKE_SYSTEM_PROCESSOR@
 #cmakedefine HAVE_RAWCTX @HAVE_RAWCTX@
+#cmakedefine HAVE_BOOST_CONTEXT @HAVE_BOOST_CONTEXT@
 
 /* Define to 1 if you have the GNU ld library */
 #cmakedefine HAVE_GNU_LD @HAVE_GNU_LD@
index c0da9ea..836cf4b 100644 (file)
@@ -48,6 +48,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc,
 
 static const char *const FILTERED_LIBS[] = {
   "libstdc++",
+  "libboost_context",
   "libc++",
   "libm",
   "libgcc_s",
index f222f62..95c0ae8 100644 (file)
@@ -1,6 +1,6 @@
 /* a fast and simple context switching library                              */
 
-/* Copyright (c) 2009-2014. The SimGrid Team.
+/* Copyright (c) 2009-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -85,6 +85,12 @@ void SIMIX_context_mod_init(void)
         /* use raw contexts */
         SIMIX_ctx_raw_factory_init(&simix_global->context_factory);
       }
+#endif
+#ifdef HAVE_BOOST_CONTEXT
+      else if (!strcmp(smx_context_factory_name, "boost")) {
+        /* use Boost.Context */
+        SIMIX_ctx_boost_factory_init(&simix_global->context_factory);
+      }
 #endif
       else {
         XBT_ERROR("Invalid context factory specified. Valid factories on this machine:");
diff --git a/src/simix/smx_context_boost.cpp b/src/simix/smx_context_boost.cpp
new file mode 100644 (file)
index 0000000..ce8d08a
--- /dev/null
@@ -0,0 +1,168 @@
+/* Copyright (c) 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 Userspace context switching implementation based on Boost.Context */
+
+#include <cstdint>
+
+#include <boost/context/all.hpp>
+
+#include "xbt/log.h"
+#include "smx_private.h"
+#include "internal_config.h"
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
+
+typedef struct s_smx_ctx_boost {
+  s_smx_ctx_base_t super;       /* Fields of super implementation */
+  boost::context::fcontext_t* fc;
+  void* stack;
+} s_smx_ctx_boost_t, *smx_ctx_boost_t;
+
+static int smx_ctx_boost_factory_finalize(smx_context_factory_t *factory);
+static smx_context_t
+smx_ctx_boost_create_context(xbt_main_func_t code, int argc, char **argv,
+    void_pfn_smxprocess_t cleanup_func, smx_process_t process);
+static void smx_ctx_boost_free(smx_context_t context);
+
+static void smx_ctx_boost_wrapper(std::intptr_t arg);
+
+static void smx_ctx_boost_stop_serial(smx_context_t context);
+static void smx_ctx_boost_suspend_serial(smx_context_t context);
+static void smx_ctx_boost_resume_serial(smx_process_t first_process);
+static void smx_ctx_boost_runall_serial(void);
+
+static unsigned long boost_process_index = 0;
+static boost::context::fcontext_t boost_maestro_fcontext;
+static smx_ctx_boost_t boost_maestro_context;
+
+void SIMIX_ctx_boost_factory_init(smx_context_factory_t *factory)
+{
+  smx_ctx_base_factory_init(factory);
+  XBT_VERB("Activating boost context factory");
+
+  (*factory)->finalize = smx_ctx_boost_factory_finalize;
+  (*factory)->create_context = smx_ctx_boost_create_context;
+  /* Do not overload that method (*factory)->finalize */
+  (*factory)->free = smx_ctx_boost_free;
+  (*factory)->name = "smx_boost_context_factory";
+
+  if (SIMIX_context_is_parallel()) {
+    THROWF(arg_error, 0, "No thread support for parallel context execution");
+  } else {
+    (*factory)->stop = smx_ctx_boost_stop_serial;
+    (*factory)->suspend = smx_ctx_boost_suspend_serial;
+    (*factory)->runall = smx_ctx_boost_runall_serial;
+  }
+}
+
+/* Initialization functions */
+
+static int smx_ctx_boost_factory_finalize(smx_context_factory_t *factory)
+{
+  return smx_ctx_base_factory_finalize(factory);
+}
+
+static smx_context_t
+smx_ctx_boost_create_context(xbt_main_func_t code, int argc, char **argv,
+    void_pfn_smxprocess_t cleanup_func, smx_process_t process)
+{
+  smx_ctx_boost_t context =
+      (smx_ctx_boost_t) smx_ctx_base_factory_create_context_sized(
+          sizeof(s_smx_ctx_boost_t),
+          code,
+          argc,
+          argv,
+          cleanup_func,
+          process);
+
+  /* if the user provided a function for the process then use it,
+     otherwise it is the context for maestro */
+  if (code) {
+    context->stack = SIMIX_context_stack_new();
+    // We need to pass the bottom of the stack to make_fcontext,
+    // depending on the stack direction it may be the lower or higher address:
+#if PTH_STACKGROWTH == -1
+    void* stack = (char*) context->stack + smx_context_usable_stack_size - 1;
+#else
+    void* stack = context->stack;
+#endif
+   context->fc = boost::context::make_fcontext(
+                      stack,
+                      smx_context_usable_stack_size,
+                      smx_ctx_boost_wrapper);
+  } else if (process != nullptr && boost_maestro_context == nullptr) {
+    context->stack = nullptr;
+    context->fc = &boost_maestro_fcontext;
+    boost_maestro_context = context;
+  }
+
+  return (smx_context_t) context;
+}
+
+static void smx_ctx_boost_free(smx_context_t c)
+{
+  smx_ctx_boost_t context = (smx_ctx_boost_t) c;
+  if (!context)
+    return;
+  if ((smx_ctx_boost_t) c == boost_maestro_context)
+    boost_maestro_context = nullptr;
+  SIMIX_context_stack_delete(context->stack);
+  smx_ctx_base_free(c);
+}
+
+static void smx_ctx_boost_wrapper(std::intptr_t arg)
+{
+  smx_context_t context = (smx_context_t) arg;
+  context->code(context->argc, context->argv);
+  smx_ctx_boost_stop_serial(context);
+}
+
+static void smx_ctx_boost_stop_serial(smx_context_t context)
+{
+  smx_ctx_base_stop(context);
+  simix_global->context_factory->suspend(context);
+}
+
+static void smx_ctx_boost_suspend_serial(smx_context_t context)
+{
+  /* determine the next context */
+  smx_ctx_boost_t next_context;
+  unsigned long int i = boost_process_index++;
+
+  if (i < xbt_dynar_length(simix_global->process_to_run)) {
+    /* execute the next process */
+    XBT_DEBUG("Run next process");
+    next_context = (smx_ctx_boost_t) xbt_dynar_get_as(
+        simix_global->process_to_run, i, smx_process_t)->context;
+  }
+  else {
+    /* all processes were run, return to maestro */
+    XBT_DEBUG("No more process to run");
+    next_context = (smx_ctx_boost_t) boost_maestro_context;
+  }
+  SIMIX_context_set_current((smx_context_t) next_context);
+  boost::context::jump_fcontext(
+    ((smx_ctx_boost_t)context)->fc, next_context->fc, (intptr_t)next_context);
+}
+
+static void smx_ctx_boost_resume_serial(smx_process_t first_process)
+{
+  smx_ctx_boost_t context = (smx_ctx_boost_t) first_process->context;
+  SIMIX_context_set_current((smx_context_t) context);
+  boost::context::jump_fcontext(boost_maestro_context->fc, context->fc,
+    (intptr_t)context);
+}
+
+static void smx_ctx_boost_runall_serial(void)
+{
+  smx_process_t first_process =
+      xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t);
+  boost_process_index = 1;
+
+  /* execute the first process */
+  smx_ctx_boost_resume_serial(first_process);
+}
index 4a48723..60831b8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 #include "popping_private.h"
 #include "smx_synchro_private.h"
 
+SG_BEGIN_DECL()
+
 /* Define only for SimGrid benchmarking purposes */
 //#define TIME_BENCH_PER_SR     /* this aims at measuring the time spent in each scheduling round per each thread. The code is thus run in sequential to bench separately each SSR */
 //#define TIME_BENCH_AMDAHL     /* this aims at measuring the porting of time that could be parallelized at maximum (to get the optimal speedup by applying the amdahl law). */
@@ -60,13 +62,7 @@ extern unsigned long simix_process_maxpid;
 
 extern xbt_dict_t watched_hosts_lib;
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 XBT_PUBLIC(void) SIMIX_clean(void);
-#ifdef __cplusplus
-}
-#endif
 
 /******************************** Exceptions *********************************/
 /** @brief Ask to the provided simix process to raise the provided exception */
@@ -224,6 +220,7 @@ smx_context_t SIMIX_context_get_current(void);
 void SIMIX_ctx_thread_factory_init(smx_context_factory_t *factory);
 void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory);
 void SIMIX_ctx_raw_factory_init(smx_context_factory_t *factory);
+void SIMIX_ctx_boost_factory_init(smx_context_factory_t *factory);
 
 /* ****************************** */
 /* context manipulation functions */
@@ -331,4 +328,6 @@ XBT_PUBLIC(int) SIMIX_process_get_maxpid(void);
 
 void SIMIX_post_create_environment(void);
 
+SG_END_DECL()
+
 #endif