X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a816e6918b9e43989783b770363e14efb1856a8e..969efc2d75b963ab3125f3907adc154bfcae599b:/src/simix/simcalls.py diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index da35fdf7d6..e0ada4e2b4 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -68,7 +68,7 @@ class Simcall(object): print ('{') print (' // Your code handling the simcall') print ('}') -# return False + return False else: if self.name in self.simcalls_pre: print ( @@ -229,30 +229,19 @@ def parse(fn): def header(name): fd = open(name, 'w') - fd.write( - '/**********************************************************************/\n') - fd.write( - '/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */\n') - fd.write( - '/* */\n') - fd.write( - '/* DO NOT EVER CHANGE THIS FILE */\n') - fd.write( - '/* */\n') - fd.write( - '/* change simcalls specification in src/simix/simcalls.in */\n') - fd.write( - '/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved. */\n') - fd.write( - '/**********************************************************************/\n\n') + fd.write('/**********************************************************************/\n') + fd.write('/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */\n') + fd.write('/* */\n') + fd.write('/* DO NOT EVER CHANGE THIS FILE */\n') + fd.write('/* */\n') + fd.write('/* change simcalls specification in src/simix/simcalls.in */\n') + fd.write('/* Copyright (c) 2014-2021. The SimGrid Team. All rights reserved. */\n') + fd.write('/**********************************************************************/\n\n') fd.write('/*\n') - fd.write( - ' * Note that the name comes from http://en.wikipedia.org/wiki/Popping\n') - fd.write( - ' * Indeed, the control flow is doing a strange dance in there.\n') + fd.write(' * Note that the name comes from http://en.wikipedia.org/wiki/Popping\n') + fd.write(' * Indeed, the control flow is doing a strange dance in there.\n') fd.write(' *\n') - fd.write( - ' * That\'s not about http://en.wikipedia.org/wiki/Poop, despite the odor :)\n') + fd.write(' * That\'s not about http://en.wikipedia.org/wiki/Poop, despite the odor :)\n') fd.write(' */\n\n') return fd @@ -318,22 +307,22 @@ if __name__ == '__main__': fd = header("popping_generated.cpp") - fd.write('#include "smx_private.hpp"\n') + fd.write('#include \n') fd.write('#include \n') fd.write('#include \n') fd.write('#if SIMGRID_HAVE_MC\n') fd.write('#include "src/mc/mc_forward.hpp"\n') fd.write('#endif\n') fd.write('#include "src/kernel/activity/ConditionVariableImpl.hpp"\n') - fd.write('#include "src/mc/checker/SimcallInspector.hpp"\n') + fd.write('#include "src/kernel/actor/SimcallObserver.hpp"\n') + fd.write('#include "src/kernel/context/Context.hpp"\n') fd.write('\n') fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n') fd.write('using simgrid::simix::Simcall;') fd.write('\n') - fd.write( - '/** @brief Simcalls\' names (generated from src/simix/simcalls.in) */\n') + fd.write('/** @brief Simcalls\' names (generated from src/simix/simcalls.in) */\n') fd.write('constexpr std::array simcall_names{{\n') fd.write(' "Simcall::NONE",\n') @@ -342,18 +331,16 @@ if __name__ == '__main__': fd.write('}};\n\n') fd.write('/** @private\n') - fd.write( - ' * @brief (in kernel mode) unpack the simcall and activate the handler\n') + fd.write(' * @brief (in kernel mode) unpack the simcall and activate the handler\n') fd.write(' *\n') fd.write(' * This function is generated from src/simix/simcalls.in\n') fd.write(' */\n') - fd.write( - 'void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered_) {\n') - fd.write( - ' XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_.call_));\n') - fd.write(' SIMCALL_SET_MC_VALUE(simcall_, times_considered_);\n') - fd.write(' if (simcall_.inspector_ != nullptr)\n') - fd.write(' simcall_.inspector_->is_pending(times_considered_);\n') + fd.write('void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)\n') + fd.write('{\n') + fd.write(' XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));\n') + fd.write(' simcall_.mc_value_ = times_considered;\n') + fd.write(' if (simcall_.observer_ != nullptr)\n') + fd.write(' simcall_.observer_->prepare(times_considered);\n') fd.write(' if (context_->wannadie())\n') fd.write(' return;\n') @@ -376,7 +363,7 @@ if __name__ == '__main__': # popping_bodies.cpp # fd = header('popping_bodies.cpp') - fd.write('#include "smx_private.hpp"\n') + fd.write('#include "src/kernel/EngineImpl.hpp"\n') fd.write('#include "src/mc/mc_forward.hpp"\n') fd.write('#include "xbt/ex.h"\n') fd.write('#include \n') @@ -394,9 +381,8 @@ inline static R simcall(Simcall call, T const&... t) { smx_actor_t self = SIMIX_process_self(); simgrid::simix::marshal(&self->simcall_, call, t...); - if (self != simix_global->maestro_) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->get_cname(), SIMIX_simcall_name(self->simcall_.call_), - (int)self->simcall_.call_); + if (not simgrid::kernel::EngineImpl::get_instance()->is_maestro(self)) { + XBT_DEBUG("Yield process '%s' on simcall %s", self->get_cname(), SIMIX_simcall_name(self->simcall_)); self->yield(); } else { self->simcall_handle(0);