X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9d5979aa0885c51a5240678817c35eb4b1ea54b4..38673a54ed696e3bf4fb66577f40e5586436674d:/src/simix/simcalls.py diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 1051d4a90e..421ca262ee 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 ( @@ -159,7 +159,7 @@ class Simcall(object): res.append(' if (false) /* Go to that function to follow the code flow through the simcall barrier */') if self.need_handler: res.append(' simcall_HANDLER_%s(%s);' % (self.name, - ', '.join(["&SIMIX_process_self()->simcall_"] + [arg.name for arg in self.args]))) + ', '.join(["&simgrid::kernel::actor::ActorImpl::self()->simcall_"] + [arg.name for arg in self.args]))) else: res.append(' SIMIX_%s(%s);' % (self.name, ', '.join(arg.name for arg in self.args))) @@ -307,14 +307,15 @@ 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') @@ -334,12 +335,12 @@ if __name__ == '__main__': 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('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_.call_));\n') - fd.write(' SIMCALL_SET_MC_VALUE(simcall_, times_considered_);\n') - fd.write(' if (simcall_.inspector_ != nullptr)\n') - fd.write(' simcall_.inspector_->prepare(times_considered_);\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') @@ -362,7 +363,8 @@ 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/kernel/actor/ActorImpl.hpp"\n') fd.write('#include "src/mc/mc_forward.hpp"\n') fd.write('#include "xbt/ex.h"\n') fd.write('#include \n') @@ -378,11 +380,10 @@ using simgrid::simix::Simcall; template inline static R simcall(Simcall call, T const&... t) { - smx_actor_t self = SIMIX_process_self(); + auto self = simgrid::kernel::actor::ActorImpl::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);