/* 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. */
+#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
+#include "src/kernel/actor/SimcallObserver.hpp"
+#include "src/kernel/context/Context.hpp"
#include "src/simix/popping_private.hpp"
#include "xbt/log.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(simix, "transmuting from user request into kernel handlers");
+constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
+ "Simcall::NONE",
+ "Simcall::RUN_KERNEL",
+ "Simcall::RUN_BLOCKING",
+}};
+
+/** @private
+ * @brief (in kernel mode) unpack the simcall and activate the handler
+ *
+ * This function is generated from src/simix/simcalls.in
+ */
+void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
+{
+ XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));
+ if (simcall_.observer_ != nullptr)
+ simcall_.observer_->prepare(times_considered);
+ if (context_->wannadie())
+ return;
+ switch (simcall_.call_) {
+ case simgrid::simix::Simcall::RUN_KERNEL:
+ SIMIX_run_kernel(simcall_.code_);
+ simcall_answer();
+ break;
+
+ case simgrid::simix::Simcall::RUN_BLOCKING:
+ SIMIX_run_blocking(simcall_.code_);
+ break;
+
+ case simgrid::simix::Simcall::NONE:
+ throw std::invalid_argument(
+ simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(), get_host()->get_cname()));
+ default:
+ THROW_IMPOSSIBLE;
+ }
+}
+
void SIMIX_run_kernel(std::function<void()> const* code)
{
(*code)();
+++ /dev/null
-/**********************************************************************/
-/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
-/* */
-/* DO NOT EVER CHANGE THIS FILE */
-/* */
-/* change simcalls specification in src/simix/simcalls.in */
-/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */
-/**********************************************************************/
-
-/*
- * Note that the name comes from http://en.wikipedia.org/wiki/Popping
- * Indeed, the control flow is doing a strange dance in there.
- *
- * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
- */
-
-namespace simgrid {
-namespace simix {
-/**
- * @brief All possible simcalls.
- */
-enum class Simcall {
- NONE,
- RUN_KERNEL,
- RUN_BLOCKING,
-};
-
-constexpr int NUM_SIMCALLS = 3;
-} // namespace simix
-} // namespace simgrid
+++ /dev/null
-/**********************************************************************/
-/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
-/* */
-/* DO NOT EVER CHANGE THIS FILE */
-/* */
-/* change simcalls specification in src/simix/simcalls.in */
-/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */
-/**********************************************************************/
-
-/*
- * Note that the name comes from http://en.wikipedia.org/wiki/Popping
- * Indeed, the control flow is doing a strange dance in there.
- *
- * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
- */
-
-#include <simgrid/config.h>
-#include <simgrid/host.h>
-#include <xbt/base.h>
-#if SIMGRID_HAVE_MC
-#include "src/mc/mc_forward.hpp"
-#endif
-#include "src/kernel/activity/ConditionVariableImpl.hpp"
-#include "src/kernel/actor/SimcallObserver.hpp"
-#include "src/kernel/context/Context.hpp"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
-
-using simgrid::simix::Simcall;
-/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
-constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
- "Simcall::NONE",
- "Simcall::RUN_KERNEL",
- "Simcall::RUN_BLOCKING",
-}};
-
-/** @private
- * @brief (in kernel mode) unpack the simcall and activate the handler
- *
- * This function is generated from src/simix/simcalls.in
- */
-void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
-{
- XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));
- if (simcall_.observer_ != nullptr)
- simcall_.observer_->prepare(times_considered);
- if (context_->wannadie())
- return;
- switch (simcall_.call_) {
- case Simcall::RUN_KERNEL:
- SIMIX_run_kernel(simcall_.code_);
- simcall_answer();
- break;
-
- case Simcall::RUN_BLOCKING:
- SIMIX_run_blocking(simcall_.code_);
- break;
-
- case Simcall::NONE:
- throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
- get_cname(),
- sg_host_get_name(get_host())));
- default:
- THROW_IMPOSSIBLE;
- }
-}
#include <boost/intrusive_ptr.hpp>
/********************************* Simcalls *********************************/
-#include "popping_enum.hpp" /* Definition of Simcall, with one value per simcall */
+namespace simgrid {
+namespace simix {
+/** All possible simcalls. */
+enum class Simcall {
+ NONE,
+ RUN_KERNEL,
+ RUN_BLOCKING,
+};
+constexpr int NUM_SIMCALLS = 3;
+/** @brief Simcalls' names */
+} // namespace simix
+} // namespace simgrid
XBT_PUBLIC_DATA const std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names; /* Name of each simcall */
return False
return True
- def enum(self):
- return ' %s,' % (self.name.upper())
-
def string(self):
return ' "Simcall::%s",' % self.name.upper()
print("Some checks fail!")
sys.exit(1)
- #
- # popping_enum.hpp
- #
- fd = header("popping_enum.hpp")
- fd.write('namespace simgrid {\n')
- fd.write('namespace simix {\n')
- fd.write('/**\n')
- fd.write(' * @brief All possible simcalls.\n')
- fd.write(' */\n')
- fd.write('enum class Simcall {\n')
- fd.write(' NONE,\n')
-
- handle(fd, Simcall.enum, simcalls, simcalls_dict)
-
- fd.write('};\n')
- fd.write('\n')
- fd.write('constexpr int NUM_SIMCALLS = ' + str(1 + len(simcalls)) + ';\n')
- fd.write('} // namespace simix\n')
- fd.write('} // namespace simgrid\n')
- fd.close()
-
- #
- # popping_generated.cpp
- #
-
- fd = header("popping_generated.cpp")
-
- fd.write('#include <simgrid/config.h>\n')
- fd.write('#include <simgrid/host.h>\n')
- fd.write('#include <xbt/base.h>\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/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);\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('constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{\n')
-
- fd.write(' "Simcall::NONE",\n')
- handle(fd, Simcall.string, simcalls, simcalls_dict)
-
- fd.write('}};\n\n')
-
- fd.write('/** @private\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('{\n')
- fd.write(' XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));\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')
- fd.write(' switch (simcall_.call_) {\n')
-
- handle(fd, Simcall.case, simcalls, simcalls_dict)
-
- fd.write(' case Simcall::NONE:\n')
- fd.write(' throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",\n')
- fd.write(' get_cname(),\n')
- fd.write(' sg_host_get_name(get_host())));\n')
- fd.write(' default:\n')
- fd.write(' THROW_IMPOSSIBLE;\n')
- fd.write(' }\n')
- fd.write('}\n')
-
- fd.close()
if __name__ == '__main__':
main()
src/simix/simcalls.in
src/simix/simcalls.py
src/simix/popping_private.hpp
- src/simix/popping_generated.cpp
- src/simix/popping_enum.hpp
src/smpi/colls/coll_tuned_topo.hpp
src/smpi/colls/colls_private.hpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp
src/plugins/vm/VmLiveMigration.hpp
)
-set(SIMIX_GENERATED_SRC src/simix/popping_generated.cpp )
set(SIMIX_SRC
src/kernel/future.cpp
src/simix/libsmx.cpp
src/kernel/actor/SimcallObserver.hpp
src/kernel/actor/SynchroObserver.cpp
src/kernel/actor/SynchroObserver.hpp
-
- ${SIMIX_GENERATED_SRC}
)
# Boost context may not be available