From d753114ef4b34aa83dfac6b838f3f2fa498ff6ef Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 2 Jul 2019 15:47:05 +0200 Subject: [PATCH 1/1] Cosmetics: improve indentation. --- src/simix/popping_accessors.hpp | 28 +--- src/simix/popping_bodies.cpp | 43 ++---- src/simix/popping_generated.cpp | 246 ++++++++++++++------------------ src/simix/simcalls.py | 21 +-- 4 files changed, 135 insertions(+), 203 deletions(-) diff --git a/src/simix/popping_accessors.hpp b/src/simix/popping_accessors.hpp index ac6089114a..d175c0d692 100644 --- a/src/simix/popping_accessors.hpp +++ b/src/simix/popping_accessors.hpp @@ -123,8 +123,7 @@ static inline simgrid::kernel::activity::ExecImpl** simcall_execution_waitany_fo { return simgrid::simix::unmarshal_raw(simcall->args[0]); } -static inline void simcall_execution_waitany_for__set__execs(smx_simcall_t simcall, - simgrid::kernel::activity::ExecImpl** arg) +static inline void simcall_execution_waitany_for__set__execs(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** arg) { simgrid::simix::marshal(simcall->args[0], arg); } @@ -1079,27 +1078,12 @@ XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_acto XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout); XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration); XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution); -XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, - simgrid::kernel::activity::ExecImpl** execs, size_t count, - double timeout); +XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout); XBT_PRIVATE void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution); -XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, - double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, - simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, - void* data, double timeout); -XBT_PRIVATE boost::intrusive_ptr -simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, - unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, - simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, - bool detached); -XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, - unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, - simix_copy_data_func_t copy_data_fun, void* data, double timeout, - double rate); -XBT_PRIVATE boost::intrusive_ptr -simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, - size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, - void* data, double rate); +XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout); +XBT_PRIVATE boost::intrusive_ptr simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached); +XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate); +XBT_PRIVATE boost::intrusive_ptr simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate); XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout); XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm, double timeout); XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm); diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 148b2e8e51..f3af8b79fa 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -67,13 +67,11 @@ inline static int simcall_BODY_execution_wait(simgrid::kernel::activity::ExecImp return simcall(SIMCALL_EXECUTION_WAIT, execution); } -inline static int simcall_BODY_execution_waitany_for(simgrid::kernel::activity::ExecImpl** execs, size_t count, - double timeout) +inline static int simcall_BODY_execution_waitany_for(simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ simcall_HANDLER_execution_waitany_for(&SIMIX_process_self()->simcall, execs, count, timeout); - return simcall(SIMCALL_EXECUTION_WAITANY_FOR, execs, - count, timeout); + return simcall(SIMCALL_EXECUTION_WAITANY_FOR, execs, count, timeout); } inline static bool simcall_BODY_execution_test(simgrid::kernel::activity::ExecImpl* execution) @@ -83,50 +81,32 @@ inline static bool simcall_BODY_execution_test(simgrid::kernel::activity::ExecIm return simcall(SIMCALL_EXECUTION_TEST, execution); } -inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, - unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, - simix_copy_data_func_t copy_data_fun, void* data, double timeout) +inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ simcall_HANDLER_comm_send(&SIMIX_process_self()->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); - return simcall(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, - src_buff_size, match_fun, copy_data_fun, data, timeout); + return simcall(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); } -inline static boost::intrusive_ptr -simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, - size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, - simix_copy_data_func_t copy_data_fun, void* data, bool detached) +inline static boost::intrusive_ptr simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); - return simcall, smx_actor_t, smx_mailbox_t, double, - double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, - bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, - copy_data_fun, data, detached); + return simcall, smx_actor_t, smx_mailbox_t, double, double, unsigned char*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); } -inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, - size_t* dst_buff_size, simix_match_func_t match_fun, - simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) +inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ simcall_HANDLER_comm_recv(&SIMIX_process_self()->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); - return simcall(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, - copy_data_fun, data, timeout, rate); + return simcall(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); } -inline static boost::intrusive_ptr -simcall_BODY_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, - simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate) +inline static boost::intrusive_ptr simcall_BODY_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ simcall_HANDLER_comm_irecv(&SIMIX_process_self()->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); - return simcall, smx_actor_t, smx_mailbox_t, - unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>( - SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); + return simcall, smx_actor_t, smx_mailbox_t, unsigned char*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } inline static int simcall_BODY_comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) @@ -232,4 +212,5 @@ inline static void simcall_BODY_run_blocking(std::function const* code) if (0) /* Go to that function to follow the code flow through the simcall barrier */ SIMIX_run_blocking(code); return simcall const*>(SIMCALL_RUN_BLOCKING, code); -} /** @endcond */ +} +/** @endcond */ diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 4457433413..a78e0f4fb4 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -64,146 +64,112 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { if (simcall->issuer->context_->iwannadie) return; switch (simcall->call) { -case SIMCALL_PROCESS_SUSPEND: - simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_PROCESS_JOIN: - simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); - break; - -case SIMCALL_PROCESS_SLEEP: - simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_EXECUTION_WAIT: - simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_EXECUTION_WAITANY_FOR: - simcall_HANDLER_execution_waitany_for( - simcall, simgrid::simix::unmarshal(simcall->args[0]), - simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); - break; - -case SIMCALL_EXECUTION_TEST: - simcall_HANDLER_execution_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_COMM_SEND: - simcall_HANDLER_comm_send( - simcall, simgrid::simix::unmarshal(simcall->args[0]), - simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), - simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), - simgrid::simix::unmarshal(simcall->args[5]), - simgrid::simix::unmarshal(simcall->args[6]), - simgrid::simix::unmarshal(simcall->args[7]), - simgrid::simix::unmarshal(simcall->args[8]), simgrid::simix::unmarshal(simcall->args[9])); - break; - -case SIMCALL_COMM_ISEND: - simgrid::simix::marshal>( - simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal(simcall->args[0]), - simgrid::simix::unmarshal(simcall->args[1]), - simgrid::simix::unmarshal(simcall->args[2]), - simgrid::simix::unmarshal(simcall->args[3]), - simgrid::simix::unmarshal(simcall->args[4]), - simgrid::simix::unmarshal(simcall->args[5]), - simgrid::simix::unmarshal(simcall->args[6]), - simgrid::simix::unmarshal(simcall->args[7]), - simgrid::simix::unmarshal(simcall->args[8]), - simgrid::simix::unmarshal(simcall->args[9]), - simgrid::simix::unmarshal(simcall->args[10]))); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_RECV: - simcall_HANDLER_comm_recv( - simcall, simgrid::simix::unmarshal(simcall->args[0]), - simgrid::simix::unmarshal(simcall->args[1]), - simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), - simgrid::simix::unmarshal(simcall->args[4]), - simgrid::simix::unmarshal(simcall->args[5]), - simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), - simgrid::simix::unmarshal(simcall->args[8])); - break; - -case SIMCALL_COMM_IRECV: - simgrid::simix::marshal>( - simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal(simcall->args[0]), - simgrid::simix::unmarshal(simcall->args[1]), - simgrid::simix::unmarshal(simcall->args[2]), - simgrid::simix::unmarshal(simcall->args[3]), - simgrid::simix::unmarshal(simcall->args[4]), - simgrid::simix::unmarshal(simcall->args[5]), - simgrid::simix::unmarshal(simcall->args[6]), - simgrid::simix::unmarshal(simcall->args[7]))); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_WAITANY: - simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); - break; - -case SIMCALL_COMM_WAIT: - simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); - break; - -case SIMCALL_COMM_TEST: - simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_COMM_TESTANY: - simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); - break; - -case SIMCALL_MUTEX_LOCK: - simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_MUTEX_TRYLOCK: - simgrid::simix::marshal(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal(simcall->args[0]))); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MUTEX_UNLOCK: - simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal(simcall->args[0])); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COND_WAIT: - simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); - break; - -case SIMCALL_COND_WAIT_TIMEOUT: - simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); - break; - -case SIMCALL_SEM_ACQUIRE: - simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_SEM_ACQUIRE_TIMEOUT: - simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); - break; - -case SIMCALL_IO_WAIT: - simcall_HANDLER_io_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); - break; - -case SIMCALL_MC_RANDOM: - simgrid::simix::marshal(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]))); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RUN_KERNEL: - SIMIX_run_kernel(simgrid::simix::unmarshal const*>(simcall->args[0])); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RUN_BLOCKING: - SIMIX_run_blocking(simgrid::simix::unmarshal const*>(simcall->args[0])); - break; + case SIMCALL_PROCESS_SUSPEND: + simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_PROCESS_JOIN: + simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + break; + + case SIMCALL_PROCESS_SLEEP: + simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_EXECUTION_WAIT: + simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_EXECUTION_WAITANY_FOR: + simcall_HANDLER_execution_waitany_for(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + break; + + case SIMCALL_EXECUTION_TEST: + simcall_HANDLER_execution_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_COMM_SEND: + simcall_HANDLER_comm_send(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8]), simgrid::simix::unmarshal(simcall->args[9])); + break; + + case SIMCALL_COMM_ISEND: + simgrid::simix::marshal>(simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8]), simgrid::simix::unmarshal(simcall->args[9]), simgrid::simix::unmarshal(simcall->args[10]))); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_COMM_RECV: + simcall_HANDLER_comm_recv(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8])); + break; + + case SIMCALL_COMM_IRECV: + simgrid::simix::marshal>(simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]))); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_COMM_WAITANY: + simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + break; + + case SIMCALL_COMM_WAIT: + simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + break; + + case SIMCALL_COMM_TEST: + simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_COMM_TESTANY: + simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + break; + + case SIMCALL_MUTEX_LOCK: + simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_MUTEX_TRYLOCK: + simgrid::simix::marshal(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal(simcall->args[0]))); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_MUTEX_UNLOCK: + simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal(simcall->args[0])); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_COND_WAIT: + simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + break; + + case SIMCALL_COND_WAIT_TIMEOUT: + simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + break; + + case SIMCALL_SEM_ACQUIRE: + simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_SEM_ACQUIRE_TIMEOUT: + simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + break; + + case SIMCALL_IO_WAIT: + simcall_HANDLER_io_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); + break; + + case SIMCALL_MC_RANDOM: + simgrid::simix::marshal(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]))); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_RUN_KERNEL: + SIMIX_run_kernel(simgrid::simix::unmarshal const*>(simcall->args[0])); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_RUN_BLOCKING: + SIMIX_run_blocking(simgrid::simix::unmarshal const*>(simcall->args[0])); + break; + case NUM_SIMCALLS: break; case SIMCALL_NONE: diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index d757d8153c..622ae8ba3c 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -129,9 +129,10 @@ class Simcall(object): def case(self): res = [] + indent = ' ' args = ["simgrid::simix::unmarshal<%s>(simcall->args[%d])" % (arg.rettype(), i) for i, arg in enumerate(self.args)] - res.append('case SIMCALL_%s:' % (self.name.upper())) + res.append(indent + 'case SIMCALL_%s:' % (self.name.upper())) if self.need_handler: call = "simcall_HANDLER_%s(simcall%s%s)" % (self.name, ", " if len(args) > 0 else "", @@ -139,12 +140,12 @@ class Simcall(object): else: call = "SIMIX_%s(%s)" % (self.name, ', '.join(args)) if self.call_kind == 'Func': - res.append(" simgrid::simix::marshal<%s>(simcall->result, %s);" % (self.res.rettype(), call)) + res.append(indent + " simgrid::simix::marshal<%s>(simcall->result, %s);" % (self.res.rettype(), call)) else: - res.append(" " + call + ";") + res.append(indent + " " + call + ";") if self.call_kind != 'Blck': - res.append(' SIMIX_simcall_answer(simcall);') - res.append(' break;') + res.append(indent + ' SIMIX_simcall_answer(simcall);') + res.append(indent + ' break;') res.append('') return '\n'.join(res) @@ -265,8 +266,9 @@ def handle(fd, func, simcalls, guarded_simcalls): for guard, ll in guarded_simcalls.items(): fd.write('\n#if %s\n' % (guard)) fd.write('\n'.join(func(simcall) for simcall in ll)) - fd.write('\n#endif\n') + fd.write('\n#endif') + fd.write('\n') if __name__ == '__main__': simcalls, simcalls_dict = parse('simcalls.in') @@ -286,7 +288,7 @@ if __name__ == '__main__': fd.write('#include "src/simix/popping_private.hpp"') handle(fd, Simcall.accessors, simcalls, simcalls_dict) fd.write( - "\n\n/* The prototype of all simcall handlers, automatically generated for you */\n\n") + "\n/* The prototype of all simcall handlers, automatically generated for you */\n\n") handle(fd, Simcall.handler_prototype, simcalls, simcalls_dict) fd.close() @@ -302,7 +304,6 @@ if __name__ == '__main__': handle(fd, Simcall.enum, simcalls, simcalls_dict) - fd.write('\n') fd.write(' NUM_SIMCALLS\n') fd.write('} e_smx_simcall_t;\n') fd.close() @@ -330,7 +331,7 @@ if __name__ == '__main__': fd.write(' "SIMCALL_NONE",\n') handle(fd, Simcall.string, simcalls, simcalls_dict) - fd.write('\n};\n\n') + fd.write('};\n\n') fd.write('/** @private\n') fd.write( @@ -393,5 +394,5 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) } ''') handle(fd, Simcall.body, simcalls, simcalls_dict) - fd.write(" /** @endcond */\n") + fd.write("/** @endcond */\n") fd.close() -- 2.20.1