/*********************************** Host *************************************/
//XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_dict(u_smx_scalar_t *args);
-XBT_PUBLIC(smx_host_t) SIMIX_host_get_by_name(u_smx_scalar_t *args);
+XBT_PUBLIC(smx_host_t) SIMIX_host_get_by_name(const char *name);
XBT_PUBLIC(smx_host_t) SIMIX_host_self(void);
XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
-XBT_PUBLIC(const char*) SIMIX_host_get_name(u_smx_scalar_t *args); /* FIXME: make private: only the name of SIMIX_host_self() should be public without request */
+XBT_PUBLIC(const char*) SIMIX_host_get_name(smx_host_t host); /* FIXME: make private: only the name of SIMIX_host_self() should be public without request */
XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
-XBT_PUBLIC(void*) SIMIX_host_get_data(u_smx_scalar_t *args);
-XBT_PUBLIC(void) SIMIX_host_set_data(u_smx_scalar_t *args);
+XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
+XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
/********************************* Process ************************************/
XBT_PUBLIC(int) SIMIX_process_count(void);
((smx_action_t) action)->simcalls = fifo;
}
+xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name){
+ return SIMIX_asr_get_properties(name);
+}
xbt_dict_t SIMIX_asr_get_properties(const char *name)
{
return xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
// }
// return host_dict;
//}
-
-smx_host_t SIMIX_host_get_by_name(u_smx_scalar_t *args)
-{
- const char *name = args[0].cc;
+smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t simcall, const char *name){
+ return SIMIX_host_get_by_name(name);
+}
+smx_host_t SIMIX_host_get_by_name(const char *name){
xbt_assert(((simix_global != NULL)
&& (host_lib != NULL)),
"Environment not set yet");
return (process == NULL) ? NULL : SIMIX_process_get_host(process);
}
+const char* SIMIX_pre_host_self_get_name(smx_simcall_t simcall){
+ return SIMIX_host_self_get_name();
+}
/* needs to be public and without simcall because it is called
by exceptions and logging events */
const char* SIMIX_host_self_get_name(void)
if (host == NULL || SIMIX_process_self() == simix_global->maestro_process)
return "";
- return SIMIX_host_get_name(SIMIX_pack_args(PTR(host)));
+ return SIMIX_host_get_name(host);
}
-const char* SIMIX_host_get_name(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+const char* SIMIX_pre_host_get_name(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_name(host);
+}
+const char* SIMIX_host_get_name(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters");
return host->name;
}
-xbt_dict_t SIMIX_host_get_properties(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_properties(host);
+}
+xbt_dict_t SIMIX_host_get_properties(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.get_properties(host->host);
}
-double SIMIX_host_get_speed(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+double SIMIX_pre_host_get_speed(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_speed(host);
+}
+double SIMIX_host_get_speed(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_speed(host->host, 1.0);
}
-double SIMIX_host_get_available_speed(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+double SIMIX_pre_host_get_available_speed(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_available_speed(host);
+}
+double SIMIX_host_get_available_speed(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_available_speed(host->host);
}
-int SIMIX_host_get_state(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+int SIMIX_pre_host_get_state(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_state(host);
+}
+int SIMIX_host_get_state(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_state(host->host);
}
+void* SIMIX_pre_host_self_get_data(smx_simcall_t simcall){
+ return SIMIX_host_self_get_data();
+}
void* SIMIX_host_self_get_data(void)
{
smx_host_t self = SIMIX_host_self();
- return SIMIX_host_get_data(SIMIX_pack_args(PTR(self)));
+ return SIMIX_host_get_data(self);
}
void SIMIX_host_self_set_data(void *data)
{
smx_host_t self = SIMIX_host_self();
- SIMIX_host_set_data(SIMIX_pack_args(PTR(self), PTR(data)));
+ SIMIX_host_set_data(self, data);
}
-void* SIMIX_host_get_data(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
+void* SIMIX_pre_host_get_data(smx_simcall_t simcall,smx_host_t host){
+ return SIMIX_host_get_data(host);
+}
+void* SIMIX_host_get_data(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return host->data;
arg->properties = properties;
arg->auto_restart = auto_restart;
- if( SIMIX_host_get_state(SIMIX_pack_args(PTR(host))) == SURF_RESOURCE_OFF
+ if( SIMIX_host_get_state(host) == SURF_RESOURCE_OFF
&& !xbt_dict_get_or_null(watched_hosts_lib,host->name)){
xbt_dict_set(watched_hosts_lib,host->name,host,NULL);
XBT_DEBUG("Have push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",host->name);
xbt_die("No function for simix_global->autorestart");
}
-void SIMIX_host_set_data(u_smx_scalar_t *args)
-{
- smx_host_t host = args[0].p;
- void *data = args[1].p;
+void SIMIX_pre_host_set_data(smx_simcall_t simcall, smx_host_t host, void *data) {
+ SIMIX_host_set_data(host, data);
+}
+void SIMIX_host_set_data(smx_host_t host, void *data){
xbt_assert((host != NULL), "Invalid parameters");
xbt_assert((host->data == NULL), "Data already set");
host->data = data;
}
-smx_action_t SIMIX_host_execute(u_smx_scalar_t args[])
-{
- const char *name = args[0].p;
- smx_host_t host = args[1].p;
- double computation_amount = args[2].d;
- double priority = args[3].d;
+smx_action_t SIMIX_pre_host_execute(smx_simcall_t simcall,const char *name,
+ smx_host_t host, double computation_amount, double priority){
+ return SIMIX_host_execute(name, host, computation_amount, priority);
+}
+smx_action_t SIMIX_host_execute(const char *name,
+ smx_host_t host, double computation_amount, double priority){
/* alloc structures and initialize */
smx_action_t action = xbt_mallocator_get(simix_global->action_mallocator);
return action;
}
-smx_action_t SIMIX_host_parallel_execute(u_smx_scalar_t *args)
-{
- const char *name = args[0].cc;
- int host_nb = args[1].i;
- smx_host_t *host_list = args[2].p;
- double *computation_amount = args[3].p;
- double *communication_amount = args[4].p;
- double amount = args[5].d;
- double rate = args[6].d;
+smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t simcall, const char *name,
+ int host_nb, smx_host_t *host_list,
+ double *computation_amount, double *communication_amount,
+ double amount, double rate){
+ return SIMIX_host_parallel_execute(name, host_nb, host_list, computation_amount,
+ communication_amount, amount, rate);
+}
+smx_action_t SIMIX_host_parallel_execute(const char *name,
+ int host_nb, smx_host_t *host_list,
+ double *computation_amount, double *communication_amount,
+ double amount, double rate){
+
void **workstation_list = NULL;
int i;
return action;
}
-void SIMIX_host_execution_destroy(u_smx_scalar_t *args)
-{
- smx_action_t action = args[0].p;
+void SIMIX_pre_host_execution_destroy(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_host_execution_destroy(action);
+}
+void SIMIX_host_execution_destroy(smx_action_t action){
XBT_DEBUG("Destroy action %p", action);
if (action->execution.surf_exec) {
xbt_mallocator_release(simix_global->action_mallocator, action);
}
-void SIMIX_host_execution_cancel(u_smx_scalar_t *args)
-{
- smx_action_t action = args[0].p;
+void SIMIX_pre_host_execution_cancel(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_host_execution_cancel(action);
+}
+void SIMIX_host_execution_cancel(smx_action_t action){
XBT_DEBUG("Cancel action %p", action);
if (action->execution.surf_exec)
surf_workstation_model->action_cancel(action->execution.surf_exec);
}
-double SIMIX_host_execution_get_remains(u_smx_scalar_t *args)
-{
- smx_action_t action = args[0].p;
+double SIMIX_pre_host_execution_get_remains(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_host_execution_get_remains(action);
+}
+double SIMIX_host_execution_get_remains(smx_action_t action){
double result = 0.0;
if (action->state == SIMIX_RUNNING)
return result;
}
-e_smx_state_t SIMIX_host_execution_get_state(u_smx_scalar_t *args)
-{
- smx_action_t action = args[0].p;
+e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_host_execution_get_state(action);
+}
+e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action){
return action->state;
}
-void SIMIX_host_execution_set_priority(u_smx_scalar_t *args)
-{
- smx_action_t action = args[0].p;
- double priority = args[1].d;
+void SIMIX_pre_host_execution_set_priority(smx_simcall_t simcall, smx_action_t action,
+ double priority){
+ return SIMIX_host_execution_set_priority(action, priority);
+}
+void SIMIX_host_execution_set_priority(smx_action_t action, double priority){
if(action->execution.surf_exec)
surf_workstation_model->set_priority(action->execution.surf_exec, priority);
}
-void SIMIX_pre_host_execution_wait(u_smx_scalar_t *args)
-{
- smx_simcall_t simcall = args[0].p;
- smx_action_t action = args[1].p;
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action){
XBT_DEBUG("Wait for execution of action %p, state %d", action, (int)action->state);
}
/* We no longer need it */
- SIMIX_host_execution_destroy(SIMIX_pack_args(PTR(action)));
+ SIMIX_host_execution_destroy(action);
}
void SIMIX_post_host_execute(smx_action_t action)
#ifdef HAVE_TRACING
+void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
+ const char *category){
+ SIMIX_set_category(action, category);
+}
void SIMIX_set_category(smx_action_t action, const char *category)
{
if (action->state != SIMIX_RUNNING) return;
void SIMIX_host_restart_processes(smx_host_t host);
void SIMIX_host_autorestart(smx_host_t host);
-xbt_dict_t SIMIX_host_get_properties(u_smx_scalar_t *args);
-double SIMIX_host_get_speed(u_smx_scalar_t *args);
-double SIMIX_host_get_available_speed(u_smx_scalar_t *args);
-int SIMIX_host_get_state(u_smx_scalar_t *args);
-smx_action_t SIMIX_host_execute(u_smx_scalar_t *args);
-smx_action_t SIMIX_host_parallel_execute(u_smx_scalar_t *args);
-void SIMIX_host_execution_destroy(u_smx_scalar_t *args);
-void SIMIX_host_execution_cancel(u_smx_scalar_t *args);
-double SIMIX_host_execution_get_remains(u_smx_scalar_t *args);
-e_smx_state_t SIMIX_host_execution_get_state(u_smx_scalar_t *args);
-void SIMIX_host_execution_set_priority(u_smx_scalar_t *args);
-void SIMIX_pre_host_execution_wait(u_smx_scalar_t *args);
+xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
+double SIMIX_host_get_speed(smx_host_t host);
+double SIMIX_host_get_available_speed(smx_host_t host);
+int SIMIX_host_get_state(smx_host_t host);
+smx_action_t SIMIX_host_execute(const char *name,
+ smx_host_t host, double computation_amount, double priority);
+smx_action_t SIMIX_host_parallel_execute(const char *name,
+ int host_nb, smx_host_t *host_list,
+ double *computation_amount, double *communication_amount,
+ double amount, double rate);
+void SIMIX_host_execution_destroy(smx_action_t action);
+void SIMIX_host_execution_cancel(smx_action_t action);
+double SIMIX_host_execution_get_remains(smx_action_t action);
+e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
+void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
+
+// pre prototypes
+smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
+const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
+const char* SIMIX_pre_host_get_name(smx_simcall_t, smx_host_t);
+xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t, smx_host_t);
+double SIMIX_pre_host_get_speed(smx_simcall_t, smx_host_t);
+double SIMIX_pre_host_get_available_speed(smx_simcall_t, smx_host_t);
+int SIMIX_pre_host_get_state(smx_simcall_t, smx_host_t);
+void* SIMIX_pre_host_self_get_data(smx_simcall_t);
+void* SIMIX_pre_host_get_data(smx_simcall_t, smx_host_t);
+void SIMIX_pre_host_set_data(smx_simcall_t, smx_host_t, void*);
+smx_action_t SIMIX_pre_host_execute(smx_simcall_t, const char*, smx_host_t, double, double);
+smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t, const char*, int, smx_host_t*,
+ double*, double*, double, double);
+void SIMIX_pre_host_execution_destroy(smx_simcall_t, smx_action_t);
+void SIMIX_pre_host_execution_cancel(smx_simcall_t, smx_action_t);
+double SIMIX_pre_host_execution_get_remains(smx_simcall_t, smx_action_t);
+e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t, smx_action_t);
+void SIMIX_pre_host_execution_set_priority(smx_simcall_t, smx_action_t, double);
void SIMIX_host_execution_suspend(smx_action_t action);
void SIMIX_host_execution_resume(smx_action_t action);
void SIMIX_post_host_execute(smx_action_t action);
#ifdef HAVE_TRACING
+void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
+ const char *category);
void SIMIX_set_category(smx_action_t action, const char *category);
#endif
//SIMIX FILE READ
-void SIMIX_pre_file_read(smx_simcall_t simcall)
+void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream)
{
- smx_action_t action = SIMIX_file_read(simcall->issuer,
- simcall->file_read.ptr,
- simcall->file_read.size,
- simcall->file_read.nmemb,
- simcall->file_read.stream);
+ smx_action_t action = SIMIX_file_read(simcall->issuer, ptr, size, nmemb, stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE WRITE
-void SIMIX_pre_file_write(smx_simcall_t simcall)
+void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream)
{
- smx_action_t action = SIMIX_file_write(simcall->issuer,
- simcall->file_write.ptr,
- simcall->file_write.size,
- simcall->file_write.nmemb,
- simcall->file_write.stream);
+ smx_action_t action = SIMIX_file_write(simcall->issuer, ptr, size, nmemb, stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE OPEN
-void SIMIX_pre_file_open(smx_simcall_t simcall)
+void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
+ const char* path, const char* mode)
{
- smx_action_t action = SIMIX_file_open(simcall->issuer,
- simcall->file_open.mount,
- simcall->file_open.path,
- simcall->file_open.mode);
+ smx_action_t action = SIMIX_file_open(simcall->issuer, mount, path, mode);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE CLOSE
-void SIMIX_pre_file_close(smx_simcall_t simcall)
+void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fp)
{
- smx_action_t action = SIMIX_file_close(simcall->issuer,
- simcall->file_close.fp);
+ smx_action_t action = SIMIX_file_close(simcall->issuer, fp);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE STAT
-void SIMIX_pre_file_stat(smx_simcall_t simcall)
+void SIMIX_pre_file_stat(smx_simcall_t simcall, smx_file_t fd, s_file_stat_t buf)
{
- smx_action_t action = SIMIX_file_stat(simcall->issuer,
- simcall->file_stat.fd,
- simcall->file_stat.buf);
+ smx_action_t action = SIMIX_file_stat(simcall->issuer, fd, buf);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE UNLINK
-void SIMIX_pre_file_unlink(smx_simcall_t simcall)
+void SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd)
{
- smx_action_t action = SIMIX_file_unlink(simcall->issuer,
- simcall->file_unlink.fd);
+ smx_action_t action = SIMIX_file_unlink(simcall->issuer, fd);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE LS
-void SIMIX_pre_file_ls(smx_simcall_t simcall)
+void SIMIX_pre_file_ls(smx_simcall_t simcall,
+ const char* mount, const char* path)
{
smx_action_t action = SIMIX_file_ls(simcall->issuer,
simcall->file_ls.mount, simcall->file_ls.path);
#include "simgrid/simix.h"
#include "smx_smurf_private.h"
-void SIMIX_pre_file_read(smx_simcall_t simcall);
-void SIMIX_pre_file_write(smx_simcall_t simcall);
-void SIMIX_pre_file_open(smx_simcall_t simcall);
-void SIMIX_pre_file_close(smx_simcall_t simcall);
-void SIMIX_pre_file_stat(smx_simcall_t simcall);
-void SIMIX_pre_file_unlink(smx_simcall_t simcall);
-void SIMIX_pre_file_ls(smx_simcall_t simcall);
+void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream);
+void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
+ size_t nmemb, smx_file_t strea);
+void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
+ const char* path, const char* mode);
+void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fp);
+void SIMIX_pre_file_stat(smx_simcall_t simcall, smx_file_t fd, s_file_stat_t buf);
+void SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd);
+void SIMIX_pre_file_ls(smx_simcall_t simcall,
+ const char* mount, const char* path);
smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
void SIMIX_io_destroy(smx_action_t action);
void SIMIX_io_finish(smx_action_t action);
+// pre prototypes
+
#endif
/* Rendez-Vous Points */
/******************************************************************************/
+smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name){
+ return SIMIX_rdv_create(name);
+}
smx_rdv_t SIMIX_rdv_create(const char *name)
{
/* two processes may have pushed the same rdv_create simcall at the same time */
return rdv;
}
+void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_destroy(rdv);
+}
void SIMIX_rdv_destroy(smx_rdv_t rdv)
{
if (rdv->name)
return rdv_points;
}
+smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name){
+ return SIMIX_rdv_get_by_name(name);
+}
smx_rdv_t SIMIX_rdv_get_by_name(const char *name)
{
return xbt_dict_get_or_null(rdv_points, name);
}
+int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host){
+ return SIMIX_rdv_comm_count_by_host(rdv, host);
+}
int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
{
smx_action_t comm = NULL;
return count;
}
+smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_get_head(rdv);
+}
smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv)
{
return xbt_fifo_get_item_content(xbt_fifo_get_first_item(rdv->comm_fifo));
}
+smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_get_receiver(rdv);
+}
/**
* \brief get the receiver (process associated to the mailbox)
* \param rdv The rendez-vous point
return rdv->permanent_receiver;
}
+void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
+ smx_process_t process){
+ SIMIX_rdv_set_receiver(rdv, process);
+}
/**
* \brief set the receiver of the rendez vous point to allow eager sends
* \param rdv The rendez-vous point
* \param process The receiving process
*/
-void SIMIX_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process)
+void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t process)
{
rdv->permanent_receiver=process;
}
return act;
}
+void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_comm_destroy(action);
+}
/**
* \brief Destroy a communicate action
* \param action The communicate action to be destroyed
}
}
+void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *data, double timeout){
+ smx_action_t comm = SIMIX_comm_isend(simcall->issuer, rdv, task_size, rate,
+ src_buff, src_buff_size, match_fun, NULL,
+ data, 0);
+ simcall->mc_value = 0;
+ SIMIX_pre_comm_wait(simcall, comm, timeout);
+}
+smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void (*clean_fun)(void *),
+ void *data, int detached){
+ return SIMIX_comm_isend(simcall->issuer, rdv, task_size, rate, src_buff,
+ src_buff_size, match_fun, clean_fun, data, detached);
+
+}
smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
double task_size, double rate,
void *src_buff, size_t src_buff_size,
return (detached ? NULL : other_action);
}
+void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data, double timeout){
+ smx_action_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff,
+ dst_buff_size, match_fun, data);
+ simcall->mc_value = 0;
+ SIMIX_pre_comm_wait(simcall, comm, timeout);
+}
+smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data){
+ return SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, dst_buff_size,
+ match_fun, data);
+}
smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
void *dst_buff, size_t *dst_buff_size,
int (*match_fun)(void *, void *, smx_action_t), void *data)
return other_action;
}
+smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
+ int src, int tag,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data){
+ return SIMIX_comm_iprobe(simcall->issuer, rdv, src, tag, match_fun, data);
+}
smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
int tag, int (*match_fun)(void *, void *, smx_action_t), void *data)
return other_action;
}
-void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx)
+void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout)
{
-
+ int idx = simcall->mc_value;
/* the simcall may be a wait, a send or a recv */
surf_action_t sleep;
}
}
-void SIMIX_pre_comm_test(smx_simcall_t simcall)
+void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action)
{
- smx_action_t action = simcall->comm_test.comm;
-
if(MC_is_active()){
simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
if(simcall->comm_test.result){
}
}
-void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx)
+void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions)
{
+ int idx = simcall->mc_value;
unsigned int cursor;
smx_action_t action;
- xbt_dynar_t actions = simcall->comm_testany.comms;
simcall->comm_testany.result = -1;
if (MC_is_active()){
SIMIX_simcall_answer(simcall);
}
-void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx)
+void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions)
{
+ int idx = simcall->mc_value;
smx_action_t action;
unsigned int cursor = 0;
- xbt_dynar_t actions = simcall->comm_waitany.comms;
if (MC_is_active()){
action = xbt_dynar_get_as(actions, idx, smx_action_t);
}
}
+void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_comm_cancel(action);
+}
void SIMIX_comm_cancel(smx_action_t action)
{
/* if the action is a waiting state means that it is still in a rdv */
/************* Action Getters **************/
+double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_remains(action);
+}
/**
* \brief get the amount remaining from the communication
* \param action The communication
return remains;
}
+e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_state(action);
+}
e_smx_state_t SIMIX_comm_get_state(smx_action_t action)
{
return action->state;
}
+void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_src_data(action);
+}
/**
* \brief Return the user data associated to the sender of the communication
* \param action The communication
return action->comm.src_data;
}
+void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_dst_data(action);
+}
/**
* \brief Return the user data associated to the receiver of the communication
* \param action The communication
return action->comm.dst_data;
}
+smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_src_proc(action);
+}
smx_process_t SIMIX_comm_get_src_proc(smx_action_t action)
{
return action->comm.src_proc;
}
+smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_dst_proc(action);
+}
smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action)
{
return action->comm.dst_proc;
int (*)(void *, void *, smx_action_t), void *data);
void SIMIX_comm_destroy(smx_action_t action);
void SIMIX_comm_destroy_internal_actions(smx_action_t action);
-void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx);
smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
-void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx);
+void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
+void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
void SIMIX_post_comm(smx_action_t action);
-void SIMIX_pre_comm_test(smx_simcall_t simcall);
-void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx);
+void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action);
+void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions);
void SIMIX_comm_cancel(smx_action_t action);
double SIMIX_comm_get_remains(smx_action_t action);
e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
+// pre prototypes
+smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
+ int src, int tag,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data);
+smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
+void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv);
+smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name);
+int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host);
+smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv);
+smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv);
+void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
+ smx_process_t process);
+void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *data, double timeout);
+smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void (*clean_fun)(void *),
+ void *data, int detached);
+void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data, double timeout);
+smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data);
+void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action);
+void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action);
+double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action);
+e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action);
+void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action);
+void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action);
+smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action);
+smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action);
#endif
return xbt_fifo_size(process->comms) > 0;
}
+void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process) {
+ SIMIX_process_cleanup(process);
+}
/**
* \brief Moves a process to the list of processes to destroy.
*/
return process;
}
+
+void SIMIX_pre_process_create(smx_simcall_t simcall,
+ smx_process_t *process,
+ const char *name,
+ xbt_main_func_t code,
+ void *data,
+ const char *hostname,
+ double kill_time,
+ int argc, char **argv,
+ xbt_dict_t properties,
+ int auto_restart){
+ return SIMIX_process_create(process, name, code, data, hostname,
+ kill_time, argc, argv, properties, auto_restart);
+}
/**
* \brief Internal function to create a process.
*
xbt_dynar_reset(simix_global->process_to_run);
}
+void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process) {
+ SIMIX_process_kill(process, simcall->issuer);
+}
/**
* \brief Internal function to kill a SIMIX process.
*
}
+void SIMIX_pre_process_killall(smx_simcall_t simcall) {
+ SIMIX_process_killall(simcall->issuer);
+}
/**
* \brief Kills all running processes.
* \param issuer this one will not be killed
SIMIX_process_empty_trash();
}
+void SIMIX_pre_process_change_host(smx_simcall_t simcall, smx_process_t process,
+ smx_host_t dest)
+{
+ process->new_host = dest;
+}
void SIMIX_process_change_host(smx_process_t process,
smx_host_t dest)
{
xbt_swag_insert(process, dest->process_list);
}
-void SIMIX_pre_process_change_host(smx_process_t process, smx_host_t dest)
-{
- process->new_host = dest;
-}
-void SIMIX_pre_process_suspend(smx_simcall_t simcall)
+void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process)
{
- smx_process_t process = simcall->process_suspend.process;
smx_action_t action_suspend =
SIMIX_process_suspend(process, simcall->issuer);
return NULL;
}
} else {
- return SIMIX_host_execute(SIMIX_pack_args(PTR("suspend"), PTR(process->smx_host), DOUBLE(0.0), DOUBLE(1.0)));
+ return SIMIX_host_execute("suspend", process->smx_host, 0.0, 1.0);
}
}
+void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process){
+ SIMIX_process_resume(process, simcall->issuer);
+}
+
void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
{
xbt_assert((process != NULL), "Invalid parameters");
return simix_process_maxpid;
}
+int SIMIX_pre_process_count(smx_simcall_t simcall){
+ return SIMIX_process_count();
+}
int SIMIX_process_count(void)
{
return xbt_swag_size(simix_global->process_list);
}
+void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t self){
+ return SIMIX_process_self_get_data(self);
+}
+
void* SIMIX_process_self_get_data(smx_process_t self)
{
xbt_assert(self == SIMIX_process_self(), "This is not the current process");
return SIMIX_process_get_data(self);
}
+void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process,
+ void *data){
+ SIMIX_process_set_data(process, data);
+}
void SIMIX_process_self_set_data(smx_process_t self, void *data)
{
xbt_assert(self == SIMIX_process_self(), "This is not the current process");
SIMIX_process_set_data(self, data);
}
+void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_data(process);
+}
void* SIMIX_process_get_data(smx_process_t process)
{
return process->data;
process->data = data;
}
+smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_host(process);
+}
smx_host_t SIMIX_process_get_host(smx_process_t process)
{
return process->smx_host;
return SIMIX_process_get_name(process);
}
+const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process) {
+ return SIMIX_process_get_name(process);
+}
const char* SIMIX_process_get_name(smx_process_t process)
{
return process->name;
return NULL;
}
+int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_is_suspended(process);
+}
int SIMIX_process_is_suspended(smx_process_t process)
{
return process->suspended;
}
+xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_properties(process);
+}
xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
{
return process->properties;
}
-void SIMIX_pre_process_sleep(smx_simcall_t simcall)
+void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration)
{
if (MC_is_active()) {
- MC_process_clock_add(simcall->issuer, simcall->process_sleep.duration);
+ MC_process_clock_add(simcall->issuer, duration);
simcall->process_sleep.result = SIMIX_DONE;
SIMIX_simcall_answer(simcall);
return;
}
- smx_action_t action = SIMIX_process_sleep(simcall->issuer, simcall->process_sleep.duration);
+ smx_action_t action = SIMIX_process_sleep(simcall->issuer, duration);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
return res;
}
+
+
void SIMIX_process_on_exit_runall(smx_process_t process) {
s_smx_process_exit_fun_t exit_fun;
(exit_fun.fun)(exit_fun.arg);
}
}
+
+void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process,
+ int_f_pvoid_t fun, void *data) {
+ SIMIX_process_on_exit(process, fun, data);
+}
+
void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data) {
xbt_assert(process, "current process not found: are you in maestro context ?");
xbt_dynar_push_as(process->on_exit,s_smx_process_exit_fun_t,exit_fun);
}
+
+void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
+ int auto_restart) {
+ SIMIX_process_auto_restart_set(process, auto_restart);
+}
/**
* \brief Sets the auto-restart status of the process.
* If set to 1, the process will be automatically restarted when its host
void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart) {
process->auto_restart = auto_restart;
}
+
+smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process) {
+ return SIMIX_process_restart(process, simcall->issuer);
+}
/**
* \brief Restart a process.
* Restart a process, starting it again from the beginning.
void SIMIX_process_yield(smx_process_t self);
xbt_running_ctx_t *SIMIX_process_get_running_context(void);
void SIMIX_process_exception_terminate(xbt_ex_t * e);
-void SIMIX_pre_process_change_host(smx_process_t process,
+void SIMIX_pre_process_change_host(smx_simcall_t, smx_process_t process,
smx_host_t dest);
void SIMIX_process_change_host(smx_process_t process,
smx_host_t dest);
-void SIMIX_pre_process_change_host(smx_process_t process, smx_host_t host);
-void SIMIX_pre_process_suspend(smx_simcall_t simcall);
+void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process);
smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer);
void SIMIX_process_resume(smx_process_t process, smx_process_t issuer);
void* SIMIX_process_get_data(smx_process_t process);
smx_process_t SIMIX_process_get_by_name(const char* name);
int SIMIX_process_is_suspended(smx_process_t process);
xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
-void SIMIX_pre_process_sleep(smx_simcall_t simcall);
+void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration);
smx_action_t SIMIX_process_sleep(smx_process_t process, double duration);
void SIMIX_post_process_sleep(smx_action_t action);
void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart);
smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer);
+// pre prototypes
+void SIMIX_pre_process_create(smx_simcall_t simcall, smx_process_t *process,
+ const char *name, xbt_main_func_t code, void *data,
+ const char *hostname, double kill_time, int argc,
+ char **argv, xbt_dict_t properties, int auto_restart);
+void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_killall(smx_simcall_t simcall);
+void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process);
+int SIMIX_pre_process_count(smx_simcall_t simcall);
+void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t process);
+void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process,
+ void *data);
+smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process);
+const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process);
+int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process);
+xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process,
+ int_f_pvoid_t fun, void *data);
+void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
+ int auto_restart);
+smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process);
#endif
void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
{
XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
-
+ simcall->mc_value = value;
switch (simcall->call) {
- case SIMCALL_COMM_TEST:
- SIMIX_pre_comm_test(simcall);
- break;
-
- case SIMCALL_COMM_TESTANY:
- SIMIX_pre_comm_testany(simcall, value);
- break;
-
- case SIMCALL_COMM_WAIT:
- SIMIX_pre_comm_wait(simcall,
- simcall->comm_wait.comm,
- simcall->comm_wait.timeout,
- value);
- break;
-
- case SIMCALL_COMM_WAITANY:
- SIMIX_pre_comm_waitany(simcall, value);
- break;
-
- case SIMCALL_COMM_SEND:
- {
- smx_action_t comm = SIMIX_comm_isend(
- simcall->issuer,
- simcall->comm_send.rdv,
- simcall->comm_send.task_size,
- simcall->comm_send.rate,
- simcall->comm_send.src_buff,
- simcall->comm_send.src_buff_size,
- simcall->comm_send.match_fun,
- NULL, /* no clean function since it's not detached */
- simcall->comm_send.data,
- 0);
- SIMIX_pre_comm_wait(simcall, comm, simcall->comm_send.timeout, 0);
- break;
- }
-
- case SIMCALL_COMM_ISEND:
- simcall->comm_isend.result = SIMIX_comm_isend(
- simcall->issuer,
- simcall->comm_isend.rdv,
- simcall->comm_isend.task_size,
- simcall->comm_isend.rate,
- simcall->comm_isend.src_buff,
- simcall->comm_isend.src_buff_size,
- simcall->comm_isend.match_fun,
- simcall->comm_isend.clean_fun,
- simcall->comm_isend.data,
- simcall->comm_isend.detached);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_RECV:
- {
- smx_action_t comm = SIMIX_comm_irecv(
- simcall->issuer,
- simcall->comm_recv.rdv,
- simcall->comm_recv.dst_buff,
- simcall->comm_recv.dst_buff_size,
- simcall->comm_recv.match_fun,
- simcall->comm_recv.data);
- SIMIX_pre_comm_wait(simcall, comm, simcall->comm_recv.timeout, 0);
- break;
- }
-
- case SIMCALL_COMM_IRECV:
- simcall->comm_irecv.result = SIMIX_comm_irecv(
- simcall->issuer,
- simcall->comm_irecv.rdv,
- simcall->comm_irecv.dst_buff,
- simcall->comm_irecv.dst_buff_size,
- simcall->comm_irecv.match_fun,
- simcall->comm_irecv.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_IPROBE:
- simcall->comm_iprobe.result = SIMIX_comm_iprobe(
- simcall->issuer,
- simcall->comm_iprobe.rdv,
- simcall->comm_iprobe.src,
- simcall->comm_iprobe.tag,
- simcall->comm_iprobe.match_fun,
- simcall->comm_iprobe.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_DESTROY:
- SIMIX_comm_destroy(simcall->comm_destroy.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_CANCEL:
- SIMIX_comm_cancel(simcall->comm_cancel.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_REMAINS:
- simcall->comm_get_remains.result =
- SIMIX_comm_get_remains(simcall->comm_get_remains.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_STATE:
- simcall->comm_get_state.result =
- SIMIX_comm_get_state(simcall->comm_get_state.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_SRC_DATA:
- simcall->comm_get_src_data.result = SIMIX_comm_get_src_data(simcall->comm_get_src_data.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_DST_DATA:
- simcall->comm_get_dst_data.result = SIMIX_comm_get_dst_data(simcall->comm_get_dst_data.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_SRC_PROC:
- simcall->comm_get_src_proc.result =
- SIMIX_comm_get_src_proc(simcall->comm_get_src_proc.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_DST_PROC:
- simcall->comm_get_dst_proc.result =
- SIMIX_comm_get_dst_proc(simcall->comm_get_dst_proc.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
-#ifdef HAVE_LATENCY_BOUND_TRACKING
- case SIMCALL_COMM_IS_LATENCY_BOUNDED:
- simcall->comm_is_latency_bounded.result =
- SIMIX_comm_is_latency_bounded(simcall->comm_is_latency_bounded.comm);
- SIMIX_simcall_answer(simcall);
- break;
-#endif
-
- case SIMCALL_RDV_CREATE:
- simcall->rdv_create.result = SIMIX_rdv_create(simcall->rdv_create.name);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_DESTROY:
- SIMIX_rdv_destroy(simcall->rdv_destroy.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GET_BY_NAME:
- simcall->rdv_get_by_name.result =
- SIMIX_rdv_get_by_name(simcall->rdv_get_by_name.name);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_COMM_COUNT_BY_HOST:
- simcall->rdv_comm_count_by_host.result = SIMIX_rdv_comm_count_by_host(
- simcall->rdv_comm_count_by_host.rdv,
- simcall->rdv_comm_count_by_host.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GET_HEAD:
- simcall->rdv_get_head.result = SIMIX_rdv_get_head(simcall->rdv_get_head.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_SET_RECV:
- SIMIX_rdv_set_receiver(simcall->rdv_set_rcv_proc.rdv, simcall->rdv_set_rcv_proc.receiver);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GET_RECV:
- simcall->rdv_get_rcv_proc.result = SIMIX_rdv_get_receiver(simcall->rdv_set_rcv_proc.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_BY_NAME:
- simcall->host_get_by_name.result =
- SIMIX_host_get_by_name(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_NAME:
- simcall->host_get_name.result = SIMIX_host_get_name(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_PROPERTIES:
- simcall->host_get_properties.result =
- SIMIX_host_get_properties(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_SPEED:
- simcall->host_get_speed.result =
- SIMIX_host_get_speed(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_AVAILABLE_SPEED:
- simcall->host_get_available_speed.result =
- SIMIX_host_get_available_speed(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_STATE:
- simcall->host_get_state.result =
- SIMIX_host_get_state(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_DATA:
- simcall->host_get_data.result = SIMIX_host_get_data(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_SET_DATA:
- SIMIX_host_set_data(SIMIX_pack_args(PTR(simcall->host_set_data.host), PTR(simcall->host_set_data.data)));
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTE:
- simcall->host_execute.result = simcall_table[simcall->call](simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_PARALLEL_EXECUTE:
- simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_DESTROY:
- SIMIX_host_execution_destroy(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_CANCEL:
- SIMIX_host_execution_cancel(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_GET_REMAINS:
- simcall->host_execution_get_remains.result =
- SIMIX_host_execution_get_remains(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_GET_STATE:
- simcall->host_execution_get_state.result =
- SIMIX_host_execution_get_state(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
- SIMIX_host_execution_set_priority(simcall->args);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_WAIT:
- SIMIX_pre_host_execution_wait(simcall->args);
- break;
-
- case SIMCALL_PROCESS_CREATE:
- SIMIX_process_create(
- simcall->process_create.process,
- simcall->process_create.name,
- simcall->process_create.code,
- simcall->process_create.data,
- simcall->process_create.hostname,
- simcall->process_create.kill_time,
- simcall->process_create.argc,
- simcall->process_create.argv,
- simcall->process_create.properties,
- simcall->process_create.auto_restart);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_KILL:
- SIMIX_process_kill(simcall->process_kill.process,simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_KILLALL:
- SIMIX_process_killall(simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_CLEANUP:
- SIMIX_process_cleanup(simcall->process_cleanup.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_CHANGE_HOST:
- SIMIX_pre_process_change_host(
- simcall->process_change_host.process,
- simcall->process_change_host.dest);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_SUSPEND:
- SIMIX_pre_process_suspend(simcall);
- break;
-
- case SIMCALL_PROCESS_RESUME:
- SIMIX_process_resume(simcall->process_resume.process, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_COUNT:
- simcall->process_count.result = SIMIX_process_count();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_DATA:
- simcall->process_get_data.result =
- SIMIX_process_get_data(simcall->process_get_data.process);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_ON_EXIT:
- SIMIX_process_on_exit(simcall->process_on_exit.process,
- simcall->process_on_exit.fun,
- simcall->process_on_exit.data);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_RESTART:
- simcall->process_restart.result = SIMIX_process_restart(simcall->process_restart.process, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_AUTO_RESTART_SET:
- SIMIX_process_auto_restart_set(simcall->process_auto_restart.process,simcall->process_auto_restart.auto_restart);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_SET_DATA:
- SIMIX_process_set_data(
- simcall->process_set_data.process,
- simcall->process_set_data.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_HOST:
- simcall->process_get_host.result = SIMIX_process_get_host(simcall->process_get_host.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_NAME:
- simcall->process_get_name.result = SIMIX_process_get_name(simcall->process_get_name.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_IS_SUSPENDED:
- simcall->process_is_suspended.result =
- SIMIX_process_is_suspended(simcall->process_is_suspended.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_PROPERTIES:
- simcall->process_get_properties.result =
- SIMIX_process_get_properties(simcall->process_get_properties.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_SLEEP:
- SIMIX_pre_process_sleep(simcall);
- break;
-
-#ifdef HAVE_TRACING
- case SIMCALL_SET_CATEGORY:
- SIMIX_set_category(
- simcall->set_category.action,
- simcall->set_category.category);
- SIMIX_simcall_answer(simcall);
- break;
-#endif
-
- case SIMCALL_MUTEX_INIT:
- simcall->mutex_init.result = SIMIX_mutex_init();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_DESTROY:
- SIMIX_mutex_destroy(simcall->mutex_destroy.mutex);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_LOCK:
- SIMIX_pre_mutex_lock(simcall);
- break;
-
- case SIMCALL_MUTEX_TRYLOCK:
- simcall->mutex_trylock.result =
- SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_UNLOCK:
- SIMIX_mutex_unlock(simcall->mutex_unlock.mutex, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_INIT:
- simcall->cond_init.result = SIMIX_cond_init();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_DESTROY:
- SIMIX_cond_destroy(simcall->cond_destroy.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_SIGNAL:
- SIMIX_cond_signal(simcall->cond_signal.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_WAIT:
- SIMIX_pre_cond_wait(simcall);
- break;
-
- case SIMCALL_COND_WAIT_TIMEOUT:
- SIMIX_pre_cond_wait_timeout(simcall);
- break;
-
- case SIMCALL_COND_BROADCAST:
- SIMIX_cond_broadcast(simcall->cond_broadcast.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_INIT:
- simcall->sem_init.result = SIMIX_sem_init(simcall->sem_init.capacity);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_DESTROY:
- SIMIX_sem_destroy(simcall->sem_destroy.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_RELEASE:
- SIMIX_sem_release(simcall->sem_release.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_WOULD_BLOCK:
- simcall->sem_would_block.result =
- SIMIX_sem_would_block(simcall->sem_would_block.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_ACQUIRE:
- SIMIX_pre_sem_acquire(simcall);
+SIMCALL_LIST(SIMCALL_CASE, SIMCALL_SEP_NOTHING)
+ case NUM_SIMCALLS:;
break;
-
- case SIMCALL_SEM_ACQUIRE_TIMEOUT:
- SIMIX_pre_sem_acquire_timeout(simcall);
- break;
-
- case SIMCALL_SEM_GET_CAPACITY:
- simcall->sem_get_capacity.result =
- SIMIX_sem_get_capacity(simcall->sem_get_capacity.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_FILE_READ:
- SIMIX_pre_file_read(simcall);
- break;
-
- case SIMCALL_FILE_WRITE:
- SIMIX_pre_file_write(simcall);
- break;
-
- case SIMCALL_FILE_OPEN:
- SIMIX_pre_file_open(simcall);
- break;
-
- case SIMCALL_FILE_CLOSE:
- SIMIX_pre_file_close(simcall);
- break;
-
- case SIMCALL_FILE_STAT:
- SIMIX_pre_file_stat(simcall);
- break;
-
- case SIMCALL_FILE_UNLINK:
- SIMIX_pre_file_unlink(simcall);
- break;
-
- case SIMCALL_FILE_LS:
- SIMIX_pre_file_ls(simcall);
- break;
-
- case SIMCALL_ASR_GET_PROPERTIES:
- simcall->asr_get_properties.result =
- SIMIX_asr_get_properties(simcall->asr_get_properties.name);
- SIMIX_simcall_answer(simcall);
- break;
-
-#ifdef HAVE_MC
- case SIMCALL_MC_SNAPSHOT:
- simcall->mc_snapshot.s = MC_take_snapshot();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MC_COMPARE_SNAPSHOTS:
- simcall->mc_compare_snapshots.result =
- snapshot_compare(simcall->mc_compare_snapshots.snapshot1, simcall->mc_compare_snapshots.snapshot2, NULL, NULL);
- SIMIX_simcall_answer(simcall);
- break;
-#endif /* HAVE_MC */
-
- case SIMCALL_NONE:
+ case SIMCALL_NONE:;
THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
SIMIX_process_get_name(simcall->issuer),
SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
/* New Simcal interface */
/* FIXME: add types for every simcall */
-const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" };
-
+//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" };
+/* FIXME find a way to make this work
simcall_handler_t simcall_table[NUM_SIMCALLS] = {
#undef SIMCALL_ENUM_ELEMENT
-#define SIMCALL_ENUM_ELEMENT(x,y) &y /* generate strings from the enumeration values */
+#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values
SIMCALL_LIST
#undef SIMCALL_ENUM_ELEMENT
-};
-
-
-void SIMIX_simcall_typecheck(const char *fmt, ...)
-{
- return;
-}
-
-void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
-{
- smx_process_t self = SIMIX_process_self();
- self->simcall.call = simcall_id;
- self->simcall.args = args;
-
- if (self != simix_global->maestro_process) {
- XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
- SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-
- SIMIX_process_yield(self);
- } else {
-
- SIMIX_simcall_pre(&self->simcall, 0);
- }
-}
+};*/
/* New Simcal interface */
/* FIXME: add types for every simcall */
-const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p", [SIMCALL_HOST_EXECUTION_WAIT] = "%p%p" };
+//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p", [SIMCALL_HOST_EXECUTION_WAIT] = "%p%p" };
+/*TOFIX find a way to make this work
simcall_handler_t simcall_table[NUM_SIMCALLS] = {
#undef SIMCALL_ENUM_ELEMENT
-#define SIMCALL_ENUM_ELEMENT(x,y) &y /* generate strings from the enumeration values */
+#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values
SIMCALL_LIST
#undef SIMCALL_ENUM_ELEMENT
-};
+};*/
+SIMCALL_LIST(SIMCALL_FUNC, SIMCALL_SEP_NOTHING)
void SIMIX_simcall_typecheck(const char *fmt, ...)
{
return;
}
-void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
+smx_simcall_t __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
{
smx_process_t self = SIMIX_process_self();
self->simcall.call = simcall_id;
SIMIX_simcall_pre(&self->simcall, 0);
}
+ return &(self->simcall);
}
*
* */
-#define SIMCALL_LIST1 \
-SIMCALL_ENUM_ELEMENT(SIMCALL_NONE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_BY_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_PROPERTIES),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_SPEED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_AVAILABLE_SPEED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_SET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_PARALLEL_EXECUTE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_CANCEL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_REMAINS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_SET_PRIORITY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CREATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILLALL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CLEANUP),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CHANGE_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SUSPEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESUME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_COUNT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_IS_SUSPENDED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_PROPERTIES),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SLEEP),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_ON_EXIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_AUTO_RESTART_SET),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESTART),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_CREATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GEY_BY_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_COMM_COUNT_BY_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_HEAD),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_SET_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_SEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_ISEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IRECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_CANCEL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAITANY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TEST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TESTANY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IPROBE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_REMAINS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_PROC),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_PROC),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_LOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_TRYLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_UNLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_SIGNAL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT_TIMEOUT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_BROADCAST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_RELEASE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_WOULD_BLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE_TIMEOUT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_GET_CAPACITY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_READ),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_WRITE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_OPEN),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_CLOSE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_STAT), \
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_UNLINK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_LS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_ASR_GET_PROPERTIES), \
-/* ****************************************************************************************** */ \
-/* TUTORIAL: New API */ \
-/* ****************************************************************************************** */ \
-SIMCALL_ENUM_ELEMENT(SIMCALL_NEW_API_INIT)
+/****************************
+ * SIMCALL GENERATING MACRO *
+ ****************************
+ *
+ * action(ENUM_NAME, func_name, result_type, params…)
+ *
+ **/
+
+/*
+ * Some macro machinery to get a MAP over the arguments of a variadic macro.
+ * It uses a FOLD to apply a macro to every argument, and because there is
+ * no recursion in the C preprocessor we must create a new macro for every
+ * depth of FOLD's recursion.
+ */
+
+/* FOLD macro */
+#define FE_0(WHAT, X, ...)
+#define FE_1(I, WHAT, X) WHAT(I, X)
+#define FE_2(I, WHAT, X, ...) WHAT(I, X), FE_1(I+1, WHAT, __VA_ARGS__)
+#define FE_3(I, WHAT, X, ...) WHAT(I, X), FE_2(I+1, WHAT, __VA_ARGS__)
+#define FE_4(I, WHAT, X, ...) WHAT(I, X), FE_3(I+1, WHAT, __VA_ARGS__)
+#define FE_5(I, WHAT, X, ...) WHAT(I, X), FE_4(I+1, WHAT, __VA_ARGS__)
+#define FE_6(I, WHAT, X, ...) WHAT(I, X), FE_5(I+1, WHAT, __VA_ARGS__)
+#define FE_7(I, WHAT, X, ...) WHAT(I, X), FE_6(I+1, WHAT, __VA_ARGS__)
+#define FE_8(I, WHAT, X, ...) WHAT(I, X), FE_7(I+1, WHAT, __VA_ARGS__)
+#define FE_9(I, WHAT, X, ...) WHAT(I, X), FE_8(I+1, WHAT, __VA_ARGS__)
+#define FE_10(I, WHAT, X, ...) WHAT(I, X), FE_9(I+1, WHAT, __VA_ARGS__)
+
+
+/* NOTE: add as many FE_n as needed (maximum number of simcall arguments )*/
+
+/* Make a MAP macro usgin FOLD (will apply 'action' to the arguments.
+ * GET_MACRO is a smart hack that counts the number of arguments passed to
+ * the variadic macro, and it is used to invoke the right FOLD depth.
+ */
+#define GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
+#define MAP(action, ...) \
+ GET_MACRO(, ##__VA_ARGS__, FE_10,FE_9,FE_8,FE_7,FE_6,FE_5,FE_4,FE_3,FE_2,FE_1, FE_0) (0, action, __VA_ARGS__)
+
+/*
+ * Define scalar type wrappers to ease the use of simcalls.
+ * These are used to wrap the arguments in SIMIX_simcall macro.
+ */
+#define TCHAR(n) (n, char, c)
+#define TSTRING(n) (n, const char*, cc)
+#define TSHORT(n) (n, short, s)
+#define TINT(n) (n, int, i)
+#define TLONG(n) (n, long, l)
+#define TUCHAR(n) (n, unsigned char, uc)
+#define TUSHORT(n) (n, unsigned short, us)
+#define TUINT(n) (n, unsigned int, ui)
+#define TULONG(n) (n, unsigned long, ul)
+#define TFLOAT(n) (n, float, f)
+#define TDOUBLE(n) (n, double, d)
+#define TPTR(n) (n, void*, p)
+#define TCPTR(n) (n, const void*, cp)
+#define TSIZE(n) (n, size_t, si)
+#define TSTAT(n) (n, s_file_stat_t, fs)
+#define TVOID(n) (n, void)
+#define TSPEC(n,t) (n, t, p)
+
+/* use comma or nothing to separate elements*/
+#define SIMCALL_SEP_COMMA ,
+#define SIMCALL_SEP_NOTHING
+
+/* get the name of the parameter */
+#define SIMCALL_NAME_(name, type, field) name
+#define SIMCALL_NAME(i, v) SIMCALL_NAME_ v
+
+/* get the %s format code of the parameter */
+#define SIMCALL_FORMAT_(name, type, field) %field
+#define SIMCALL_FORMAT(i, v) SIMCALL_FORMAT_ v
+
+/* get the parameter declaration */
+#define SIMCALL_ARG_(name, type, field) type name
+#define SIMCALL_ARG(i, v) SIMCALL_ARG_ v
+
+/* get the parameter initialisation field */
+#define SIMCALL_INIT_FIELD_(name, type, field) {.field = name}
+#define SIMCALL_INIT_FIELD(i, v) SIMCALL_INIT_FIELD_ v
+
+/* get the case of the parameter */
+#define SIMCALL_CASE_PARAM_(name, type, field) field
+#define SIMCALL_CASE_PARAM(i, v) simcall->args[i].SIMCALL_CASE_PARAM_ v
+
+/* generate some code for SIMCALL_CASE if the simcall has an answer */
+#define MAYBE2(_0, _1, func, ...) func
+
+#define SIMCALL_WITH_RESULT_BEGIN(name, type, field) simcall->result.field =
+#define SIMCALL_WITHOUT_RESULT_BEGIN(name, type, field)
+#define SIMCALL_RESULT_BEGIN_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_RESULT_BEGIN, SIMCALL_WITHOUT_RESULT_BEGIN)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_RESULT_BEGIN(answer, res) answer(SIMCALL_RESULT_BEGIN_ res)
+
+#define SIMCALL_RESULT_END_(name, type, ...)\
+ SIMIX_simcall_answer(simcall);
+#define SIMCALL_RESULT_END(answer, res) answer(SIMCALL_RESULT_END_ res)
+
+/* generate some code for BODY function */
+#define SIMCALL_FUNC_RETURN_TYPE_(name, type, ...) type
+#define SIMCALL_FUNC_RETURN_TYPE(res) SIMCALL_FUNC_RETURN_TYPE_ res
+
+#define SIMCALL_WITH_FUNC_SIMCALL(name, type, field) smx_simcall_t simcall =
+#define SIMCALL_WITHOUT_FUNC_SIMCALL(name, type, field)
+#define SIMCALL_FUNC_SIMCALL_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_FUNC_SIMCALL, SIMCALL_WITHOUT_FUNC_SIMCALL)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_FUNC_SIMCALL(res) SIMCALL_FUNC_SIMCALL_ res
+
+#define SIMCALL_WITH_FUNC_RETURN(name, type, field) return simcall->result.field;
+#define SIMCALL_WITHOUT_FUNC_RETURN(name, type, field)
+#define SIMCALL_FUNC_RETURN_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_FUNC_RETURN, SIMCALL_WITHOUT_FUNC_RETURN)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_FUNC_RETURN(res) SIMCALL_FUNC_RETURN_ res
+
+
+/* generate the simcall enumeration */
+#define SIMCALL_ENUM(type, ...)\
+ type
+
+/* generate strings from the enumeration values */
+#define SIMCALL_TYPE(type, name, answer, res, ...)\
+ [type] = STRINGIFY(MAP(SIMCALL_FORMAT, __VA_ARGS__))
+
+/* generate the simcalls functions */
+#define SIMCALL_FUNC(type, name, answer, res, ...)\
+ SIMCALL_FUNC_RETURN_TYPE(res) simcall_BODY_##name(MAP(SIMCALL_ARG, ##__VA_ARGS__)) { \
+ SIMCALL_FUNC_SIMCALL(res) __SIMIX_simcall(type, (u_smx_scalar_t[]){MAP(SIMCALL_INIT_FIELD, ##__VA_ARGS__)}); \
+ SIMCALL_FUNC_RETURN(res)\
+ }
+
+/* generate the simcalls prototypes functions */
+#define VOID_IF_EMPTY(...) GET_CLEAN(,##__VA_ARGS__,,,,,,,,,,,void)
+#define SIMCALL_FUNC_PROTO(type, name, answer, res, ...)\
+ SIMCALL_FUNC_RETURN_TYPE(res) simcall_BODY_##name(VOID_IF_EMPTY(__VA_ARGS__) MAP(SIMCALL_ARG, ##__VA_ARGS__));
+
+
+/* generate a comma if there is an argument*/
+#define WITHOUT_COMMA
+#define WITH_COMMA ,
+#define GET_CLEAN(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10, NAME,...) NAME
+#define MAYBE_COMMA(...) GET_CLEAN(,##__VA_ARGS__,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITHOUT_COMMA)
+
+/* generate the simcalls cases for the SIMIX_simcall_pre function */
+#define WITH_ANSWER(...) __VA_ARGS__
+#define WITHOUT_ANSWER(...)
+#define SIMCALL_CASE(type, name, answer, res, ...)\
+ case type:;\
+ SIMCALL_RESULT_BEGIN(answer, res) SIMIX_pre_ ## name(simcall MAYBE_COMMA(__VA_ARGS__) MAP(SIMCALL_CASE_PARAM, ##__VA_ARGS__));\
+ SIMCALL_RESULT_END(answer, res)\
+ break;
+
+/* stringify arguments */
+#define STRINGIFY_(...) #__VA_ARGS__
+#define STRINGIFY(...) STRINGIFY_(__VA_ARGS__)
+
+/* the list of simcalls definitions */
+#define SIMCALL_LIST1(action, sep) \
+action(SIMCALL_HOST_GET_BY_NAME, host_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(NAME)) sep \
+action(SIMCALL_HOST_GET_NAME, host_get_name, WITH_ANSWER, TSTRING(result), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_HOST_GET_PROPERTIES, host_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_HOST_GET_SPEED, host_get_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_HOST_GET_AVAILABLE_SPEED, host_get_available_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(result, smx_host_t)) sep \
+action(SIMCALL_HOST_GET_STATE, host_get_state, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_HOST_GET_DATA, host_get_data, WITH_ANSWER, TPTR(result), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_HOST_SET_DATA, host_set_data, WITH_ANSWER, TVOID(result), TSPEC(host, smx_host_t), TPTR(data)) sep \
+action(SIMCALL_HOST_EXECUTE, host_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TSPEC(host, smx_host_t), TDOUBLE(computation_amount), TDOUBLE(priority)) sep \
+action(SIMCALL_HOST_PARALLEL_EXECUTE, host_parallel_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TINT(host_nb), TSPEC(host_list, smx_host_t*), TSPEC(computation_amount, double*), TSPEC(communication_amount, double*), TDOUBLE(amount), TDOUBLE(rate)) sep \
+action(SIMCALL_HOST_EXECUTION_DESTROY, host_execution_destroy, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \
+action(SIMCALL_HOST_EXECUTION_CANCEL, host_execution_cancel, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \
+action(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(execution, smx_action_t)) sep \
+action(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+action(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
+action(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+action(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \
+action(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result)) sep \
+action(SIMCALL_PROCESS_CLEANUP, process_cleanup, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_CHANGE_HOST, process_change_host, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(dest, smx_host_t)) sep \
+action(SIMCALL_PROCESS_SUSPEND, process_suspend, WITHOUT_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_RESUME, process_resume, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_COUNT, process_count, WITH_ANSWER, TINT(result)) sep \
+action(SIMCALL_PROCESS_GET_DATA, process_get_data, WITH_ANSWER, TPTR(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_SET_DATA, process_set_data, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TPTR(data)) sep \
+action(SIMCALL_PROCESS_GET_HOST, process_get_host, WITH_ANSWER, TSPEC(result, smx_host_t), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_GET_NAME, process_get_name, WITH_ANSWER, TSTRING(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_IS_SUSPENDED, process_is_suspended, WITH_ANSWER, TINT(result), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_GET_PROPERTIES, process_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_PROCESS_SLEEP, process_sleep, WITHOUT_ANSWER, TINT(result), TDOUBLE(duration)) sep \
+action(SIMCALL_PROCESS_ON_EXIT, process_on_exit, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(fun, int_f_pvoid_t), TPTR(data)) sep \
+action(SIMCALL_PROCESS_AUTO_RESTART_SET, process_auto_restart_set, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TINT(auto_restart)) sep \
+action(SIMCALL_PROCESS_RESTART, process_restart, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(process, smx_process_t)) sep \
+action(SIMCALL_RDV_CREATE, rdv_create, WITH_ANSWER, TSPEC(result, smx_rdv_t), TSTRING(name)) sep \
+action(SIMCALL_RDV_DESTROY, rdv_destroy, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t)) sep \
+action(SIMCALL_RDV_GET_BY_NAME, rdv_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \
+action(SIMCALL_RDV_COMM_COUNT_BY_HOST, rdv_comm_count_by_host, WITH_ANSWER, TUINT(result), TSPEC(rdv, smx_rdv_t), TSPEC(host, smx_host_t)) sep \
+action(SIMCALL_RDV_GET_HEAD, rdv_get_head, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t)) sep \
+action(SIMCALL_RDV_SET_RECV, rdv_set_receiver, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TSPEC(receiver, smx_process_t)) sep \
+action(SIMCALL_RDV_GET_RECV, rdv_get_receiver, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(rdv, smx_rdv_t)) sep \
+action(SIMCALL_COMM_IPROBE, comm_iprobe, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TINT(src), TINT(tag), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \
+action(SIMCALL_COMM_SEND, comm_send, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \
+action(SIMCALL_COMM_ISEND, comm_isend, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TSPEC(clean_fun, simix_clean_func_t), TPTR(data), TINT(detached)) sep \
+action(SIMCALL_COMM_RECV, comm_recv, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \
+action(SIMCALL_COMM_IRECV, comm_irecv, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \
+action(SIMCALL_COMM_DESTROY, comm_destroy, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_CANCEL, comm_cancel, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_WAITANY, comm_waitany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \
+action(SIMCALL_COMM_WAIT, comm_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(comm, smx_action_t), TDOUBLE(timeout)) sep \
+action(SIMCALL_COMM_TEST, comm_test, WITHOUT_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_TESTANY, comm_testany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \
+action(SIMCALL_COMM_GET_REMAINS, comm_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_GET_STATE, comm_get_state, WITH_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_GET_SRC_DATA, comm_get_src_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_GET_DST_DATA, comm_get_dst_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_GET_SRC_PROC, comm_get_src_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_COMM_GET_DST_PROC, comm_get_dst_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \
+action(SIMCALL_MUTEX_INIT, mutex_init, WITH_ANSWER, TSPEC(result, smx_mutex_t)) sep \
+action(SIMCALL_MUTEX_DESTROY, mutex_destroy, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+action(SIMCALL_MUTEX_LOCK, mutex_lock, WITHOUT_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+action(SIMCALL_MUTEX_TRYLOCK, mutex_trylock, WITH_ANSWER, TINT(result), TSPEC(mutex, smx_mutex_t)) sep \
+action(SIMCALL_MUTEX_UNLOCK, mutex_unlock, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+action(SIMCALL_COND_INIT, cond_init, WITH_ANSWER, TSPEC(result, smx_cond_t)) sep \
+action(SIMCALL_COND_DESTROY, cond_destroy, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+action(SIMCALL_COND_SIGNAL, cond_signal, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+action(SIMCALL_COND_WAIT, cond_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t)) sep \
+action(SIMCALL_COND_WAIT_TIMEOUT, cond_wait_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t), TDOUBLE(timeout)) sep \
+action(SIMCALL_COND_BROADCAST, cond_broadcast, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+action(SIMCALL_SEM_INIT, sem_init, WITH_ANSWER, TSPEC(result, smx_sem_t), TINT(capacity)) sep \
+action(SIMCALL_SEM_DESTROY, sem_destroy, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+action(SIMCALL_SEM_RELEASE, sem_release, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+action(SIMCALL_SEM_WOULD_BLOCK, sem_would_block, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
+action(SIMCALL_SEM_ACQUIRE, sem_acquire, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+action(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t), TDOUBLE(timeout)) sep \
+action(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
+action(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TDOUBLE(result), TPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(stream, smx_file_t)) sep \
+action(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TCPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(stream, smx_file_t)) sep \
+action(SIMCALL_FILE_OPEN, file_open, WITHOUT_ANSWER, TSPEC(result, smx_file_t), TSTRING(mount), TSTRING(path), TSTRING(mode)) sep \
+action(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TSPEC(fp, smx_file_t)) sep \
+action(SIMCALL_FILE_STAT, file_stat, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t), TSTAT(buf)) sep \
+action(SIMCALL_FILE_UNLINK, file_unlink, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
+action(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \
+action(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep
/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
* because they are not always present */
#ifdef HAVE_LATENCY_BOUND_TRACKING
-#define SIMCALL_LIST2 \
-,SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IS_LATENCY_BOUNDED, SIMIX_comm_is_latency_bounded)
+#define SIMCALL_LIST2(action, sep) \
+action(SIMCALL_COMM_IS_LATENCY_BOUNDED, comm_is_latency_bounded, WITH_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep
#else
-#define SIMCALL_LIST2
+#define SIMCALL_LIST2(action, sep)
#endif
#ifdef HAVE_TRACING
-#define SIMCALL_LIST3 \
-,SIMCALL_ENUM_ELEMENT(SIMCALL_SET_CATEGORY, SIMIX_set_category)
+#define SIMCALL_LIST3(action, sep) \
+action(SIMCALL_SET_CATEGORY, set_category, WITH_ANSWER, TVOID(result), TSPEC(action, smx_action_t), TSTRING(category)) sep
#else
-#define SIMCALL_LIST3
+#define SIMCALL_LIST3(action, sep)
#endif
#ifdef HAVE_MC
-#define SIMCALL_LIST4 \
- ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_SNAPSHOT) \
- ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_COMPARE_SNAPSHOTS)
+#define SIMCALL_LIST4(action, sep) \
+action(SIMCALL_MC_SNAPSHOT, mc_snapshot, WITH_ANSWER, TPTR(result)) sep \
+action(SIMCALL_MC_COMPARE_SNAPSHOTS, mc_compare_snapshots, WITH_ANSWER, TINT(result), TPTR(s1), TPTR(s2)) sep
#else
-#define SIMCALL_LIST4
+#define SIMCALL_LIST4(action, sep)
#endif
/* SIMCALL_LIST is the final macro to use */
-#define SIMCALL_LIST SIMCALL_LIST1 SIMCALL_LIST2 SIMCALL_LIST3 SIMCALL_LIST4
+#define SIMCALL_LIST(action, ...) \
+ SIMCALL_LIST1(action, ##__VA_ARGS__)\
+ SIMCALL_LIST2(action, ##__VA_ARGS__)\
+ SIMCALL_LIST3(action, ##__VA_ARGS__)\
+ SIMCALL_LIST4(action, ##__VA_ARGS__)
+
/* you can redefine the following macro differently to generate something else
* with the list of enumeration values (e.g. a table of strings or a table of function pointers) */
* \brief All possible simcalls.
*/
typedef enum {
-SIMCALL_LIST
+SIMCALL_NONE,
+SIMCALL_LIST(SIMCALL_ENUM, SIMCALL_SEP_COMMA)
+SIMCALL_NEW_API_INIT,
+NUM_SIMCALLS
} e_smx_simcall_t;
+typedef int (*simix_match_func_t)(void *, void *, smx_action_t);
+typedef void (*simix_clean_func_t)(void *);
+
+/**
+ * \brief Prototypes of SIMIX
+ */
+SIMCALL_LIST(SIMCALL_FUNC_PROTO, SIMCALL_SEP_NOTHING)
+
+
+/* Pack all possible scalar types in an union */
+union u_smx_scalar {
+ char c;
+ const char* cc;
+ short s;
+ int i;
+ long l;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long ul;
+ float f;
+ double d;
+ size_t si;
+ s_file_stat_t fs;
+ void* p;
+ const void* cp;
+};
+
/**
* \brief Represents a simcall to the kernel.
*/
typedef struct s_smx_simcall {
e_smx_simcall_t call;
smx_process_t issuer;
+ int mc_value;
union u_smx_scalar *args;
+ union u_smx_scalar result;
//FIXME: union u_smx_scalar retval;
union {
};
} s_smx_simcall_t, *smx_simcall_t;
+
+
/******************************** General *************************************/
void SIMIX_simcall_push(smx_process_t self);
void SIMIX_simcall_post(smx_action_t);
smx_simcall_t SIMIX_simcall_mine(void);
const char *SIMIX_simcall_name(e_smx_simcall_t kind);
+//TOFIX put it in a better place
+xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name);
/*************************** New simcall interface ****************************/
-/* Pack all possible scalar types in an union */
-union u_smx_scalar {
- char c;
- const char* cc;
- short s;
- int i;
- long l;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long ul;
- float f;
- double d;
- void* p;
-};
-
#define SIMIX_pack_args(...) (u_smx_scalar_t[]){MAP(INIT_FIELD, __VA_ARGS__)}
*/
/* FOLD macro */
-#define FE_1(WHAT, X) WHAT(X)
-#define FE_2(WHAT, X, ...) WHAT(X), FE_1(WHAT, __VA_ARGS__)
-#define FE_3(WHAT, X, ...) WHAT(X), FE_2(WHAT, __VA_ARGS__)
-#define FE_4(WHAT, X, ...) WHAT(X), FE_3(WHAT, __VA_ARGS__)
-#define FE_5(WHAT, X, ...) WHAT(X), FE_4(WHAT, __VA_ARGS__)
+#define FE_0(WHAT, X, ...)
+#define FE_1(I, WHAT, X) WHAT(I, X)
+#define FE_2(I, WHAT, X, ...) WHAT(I, X), FE_1(I+1, WHAT, __VA_ARGS__)
+#define FE_3(I, WHAT, X, ...) WHAT(I, X), FE_2(I+1, WHAT, __VA_ARGS__)
+#define FE_4(I, WHAT, X, ...) WHAT(I, X), FE_3(I+1, WHAT, __VA_ARGS__)
+#define FE_5(I, WHAT, X, ...) WHAT(I, X), FE_4(I+1, WHAT, __VA_ARGS__)
+#define FE_6(I, WHAT, X, ...) WHAT(I, X), FE_5(I+1, WHAT, __VA_ARGS__)
+#define FE_7(I, WHAT, X, ...) WHAT(I, X), FE_6(I+1, WHAT, __VA_ARGS__)
+#define FE_8(I, WHAT, X, ...) WHAT(I, X), FE_7(I+1, WHAT, __VA_ARGS__)
+#define FE_9(I, WHAT, X, ...) WHAT(I, X), FE_8(I+1, WHAT, __VA_ARGS__)
+#define FE_10(I, WHAT, X, ...) WHAT(I, X), FE_9(I+1, WHAT, __VA_ARGS__)
+
+
/* NOTE: add as many FE_n as needed (maximum number of simcall arguments )*/
/* Make a MAP macro usgin FOLD (will apply 'action' to the arguments.
* GET_MACRO is a smart hack that counts the number of arguments passed to
* the variadic macro, and it is used to invoke the right FOLD depth.
*/
-#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
-#define MAP(action,...) \
- GET_MACRO(__VA_ARGS__,FE_5,FE_4,FE_3,FE_2,FE_1) (action, __VA_ARGS__)
-
+#define GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
+#define MAP(action, ...) \
+ GET_MACRO(, ##__VA_ARGS__, FE_10,FE_9,FE_8,FE_7,FE_6,FE_5,FE_4,FE_3,FE_2,FE_1, FE_0) (0, action, __VA_ARGS__)
/* Generate code to initialize the field 'x' with value 'y' of an structure or union */
#define INIT_FIELD_(x,y) {.x = y}
SIMIX_simcall_typecheck(simcall_types[id], MAP(SECOND, __VA_ARGS__)); \
__SIMIX_simcall(id, (u_smx_scalar_t[]){MAP(INIT_FIELD, __VA_ARGS__)})
-void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args);
+smx_simcall_t __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args);
/*
* \biref Dummy variadic function used to typecheck the arguments of a simcall
}
/*********************************** Mutex ************************************/
+smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall){
+ return SIMIX_mutex_init();
+}
/**
* \brief Initialize a mutex.
*
* \brief Handles a mutex lock simcall.
* \param simcall the simcall
*/
-void SIMIX_pre_mutex_lock(smx_simcall_t simcall)
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
{
XBT_IN("(%p)",simcall);
/* FIXME: check where to validate the arguments */
smx_action_t sync_act = NULL;
- smx_mutex_t mutex = simcall->mutex_lock.mutex;
smx_process_t process = simcall->issuer;
if (mutex->locked) {
XBT_OUT();
}
+int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex){
+ return SIMIX_mutex_trylock(mutex, simcall->issuer);
+}
/**
* \brief Tries to lock a mutex.
*
return 1;
}
+void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex){
+ SIMIX_mutex_unlock(mutex, simcall->issuer);
+}
/**
* \brief Unlocks a mutex.
*
XBT_OUT();
}
+void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex){
+ SIMIX_mutex_destroy(mutex);
+}
/**
* \brief Destroys a mutex.
*
/********************************* Condition **********************************/
+smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall){
+ return SIMIX_cond_init();
+}
/**
* \brief Initialize a condition.
*
* It have to be called before the use of the condition.
* \return A condition
*/
-smx_cond_t SIMIX_cond_init()
+smx_cond_t SIMIX_cond_init(void)
{
XBT_IN("()");
s_smx_process_t p;
* \brief Handle a condition waiting simcall without timeouts
* \param simcall the simcall
*/
-void SIMIX_pre_cond_wait(smx_simcall_t simcall)
+void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex)
{
XBT_IN("(%p)",simcall);
smx_process_t issuer = simcall->issuer;
- smx_cond_t cond = simcall->cond_wait.cond;
- smx_mutex_t mutex = simcall->cond_wait.mutex;
_SIMIX_cond_wait(cond, mutex, -1, issuer, simcall);
XBT_OUT();
* \brief Handle a condition waiting simcall with timeouts
* \param simcall the simcall
*/
-void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall)
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond,
+ smx_mutex_t mutex, double timeout)
{
XBT_IN("(%p)",simcall);
smx_process_t issuer = simcall->issuer;
- smx_cond_t cond = simcall->cond_wait_timeout.cond;
- smx_mutex_t mutex = simcall->cond_wait_timeout.mutex;
- double timeout = simcall->cond_wait_timeout.timeout;
_SIMIX_cond_wait(cond, mutex, timeout, issuer, simcall);
XBT_OUT();
XBT_OUT();
}
+void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_signal(cond);
+}
/**
* \brief Signalizes a condition.
*
mutex = simcall->cond_wait_timeout.mutex;
simcall->call = SIMCALL_MUTEX_LOCK;
- simcall->mutex_lock.mutex = mutex;
- SIMIX_pre_mutex_lock(simcall);
+ SIMIX_pre_mutex_lock(simcall, mutex);
}
XBT_OUT();
}
+void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_broadcast(cond);
+}
/**
* \brief Broadcasts a condition.
*
XBT_OUT();
}
+void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_destroy(cond);
+}
/**
* \brief Destroys a contidion.
*
/******************************** Semaphores **********************************/
#define SMX_SEM_NOLIMIT 99999
+smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value){
+ return SIMIX_sem_init(value);
+}
/** @brief Initialize a semaphore */
smx_sem_t SIMIX_sem_init(unsigned int value)
{
return sem;
}
+void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem){
+ SIMIX_sem_destroy(sem);
+}
/** @brief Destroys a semaphore */
void SIMIX_sem_destroy(smx_sem_t sem)
{
XBT_OUT();
}
+void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem){
+ SIMIX_sem_release(sem);
+}
/** @brief release the semaphore
*
* Unlock a process waiting on the semaphore.
XBT_OUT();
}
+XBT_INLINE int SIMIX_pre_sem_would_block(smx_simcall_t simcall, smx_sem_t sem){
+ return SIMIX_sem_would_block(sem);
+}
/** @brief Returns true if acquiring this semaphore would block */
XBT_INLINE int SIMIX_sem_would_block(smx_sem_t sem)
{
return (sem->value <= 0);
}
+int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem){
+ return SIMIX_sem_get_capacity(sem);
+}
/** @brief Returns the current capacity of the semaphore */
int SIMIX_sem_get_capacity(smx_sem_t sem)
{
* \brief Handles a sem acquire simcall without timeout.
* \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire(smx_simcall_t simcall)
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem)
{
XBT_IN("(%p)",simcall);
- _SIMIX_sem_wait(simcall->sem_acquire.sem, -1, simcall->issuer, simcall);
+ _SIMIX_sem_wait(sem, -1, simcall->issuer, simcall);
XBT_OUT();
}
* \brief Handles a sem acquire simcall with timeout.
* \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall)
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout)
{
XBT_IN("(%p)",simcall);
- _SIMIX_sem_wait(simcall->sem_acquire_timeout.sem,
- simcall->sem_acquire_timeout.timeout, simcall->issuer, simcall);
+ _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);
XBT_OUT();
}
smx_mutex_t SIMIX_mutex_init(void);
void SIMIX_mutex_destroy(smx_mutex_t mutex);
-void SIMIX_pre_mutex_lock(smx_simcall_t simcall);
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer);
void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer);
smx_cond_t SIMIX_cond_init(void);
void SIMIX_cond_destroy(smx_cond_t cond);
void SIMIX_cond_signal(smx_cond_t cond);
-void SIMIX_pre_cond_wait(smx_simcall_t simcall);
-void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall);
+void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond,
+ smx_mutex_t mutex, double timeout);
void SIMIX_cond_broadcast(smx_cond_t cond);
smx_sem_t SIMIX_sem_init(unsigned int value);
void SIMIX_sem_destroy(smx_sem_t sem);
void SIMIX_sem_release(smx_sem_t sem);
int SIMIX_sem_would_block(smx_sem_t sem);
-void SIMIX_pre_sem_acquire(smx_simcall_t simcall);
-void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall);
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
int SIMIX_sem_get_capacity(smx_sem_t sem);
+// pre prototypes
+smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall);
+void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex);
+int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
+void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex);
+smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall);
+void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond);
+void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond);
+void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond);
+smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value);
+void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem);
+void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem);
+XBT_INLINE int SIMIX_pre_sem_would_block(smx_simcall_t simcall, smx_sem_t sem);
+int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
#endif
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
+/* generate strings from the enumeration values */
static const char* simcall_names[] = {
-#undef SIMCALL_ENUM_ELEMENT
-#define SIMCALL_ENUM_ELEMENT(x,y) #x /* generate strings from the enumeration values */
-SIMCALL_LIST
-#undef SIMCALL_ENUM_ELEMENT
+SIMCALL_LIST(SIMCALL_TYPE, SIMCALL_SEP_COMMA)
+[SIMCALL_NONE] = "NONE"
};
/**
if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
simcall->host_execute.result = NULL;
- SIMIX_simcall(SIMCALL_HOST_EXECUTE, PTR(name), PTR(host), DOUBLE(computation_amount), DOUBLE(priority));
-
+ simcall_BODY_host_execute(name, host, computation_amount, priority);
return simcall->host_execute.result;
}
simcall->host_execution_wait.execution = execution;
simcall->host_execution_wait.simcall = simcall;
- SIMIX_simcall(SIMCALL_HOST_EXECUTION_WAIT, PTR(simcall), PTR(execution));
+ simcall_BODY_host_execution_wait(execution);
if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
simcall->host_execution_wait.result = -1;
i2++;
}
- /* Init equal information */
- i1 = 1;
-
- while(i1<=heaplimit){
- if(heapinfo1[i1].type == 0){
- heapinfo1[i1].busy_block.equal_to = -1;
- }
- if(heapinfo1[i1].type > 0){
- for(j1=0; j1 < MAX_FRAGMENT_PER_BLOCK; j1++){
- heapinfo1[i1].busy_frag.equal_to[j1] = -1;
- }
- }
- i1++;
- }
-
- i2 = 1;
-
- while(i2<=heaplimit){
- if(heapinfo2[i2].type == 0){
- heapinfo2[i2].busy_block.equal_to = -1;
- }
- if(heapinfo2[i2].type > 0){
- for(j2=0; j2 < MAX_FRAGMENT_PER_BLOCK; j2++){
- heapinfo2[i2].busy_frag.equal_to[j2] = -1;
- }
- }
- i2++;
- }
-
/* Check busy blocks*/
i1 = 1;
}
- if(heapinfo1[i1].busy_block.busy_size == 0){
- i1++;
- continue;
- }
-
- i2 = 1;
- equal = 0;
-
- /* Try first to associate to same block in the other heap */
- if(heapinfo2[current_block].type == heapinfo1[current_block].type){
-
- if(heapinfo1[current_block].busy_block.busy_size == heapinfo2[current_block].busy_block.busy_size){
-
- addr_block2 = ((void*) (((ADDR2UINT(current_block)) - 1) * BLOCKSIZE + (char*)heapbase2));
-
- add_heap_area_pair(previous, current_block, -1, current_block, -1);
-
- if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
- if(in_mmalloc_ignore((int)current_block, -1))
- res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 1);
- else
- res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
- }else{
- res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
- }
-
- if(res_compare == 0){
- for(k=1; k < heapinfo2[current_block].busy_block.size; k++)
- heapinfo2[current_block+k].busy_block.equal_to = 1 ;
- for(k=1; k < heapinfo1[current_block].busy_block.size; k++)
- heapinfo1[current_block+k].busy_block.equal_to = 1 ;
- equal = 1;
- match_equals(previous);
- i1 = i1 + heapinfo1[i1].busy_block.size;
- }
-
- xbt_dynar_reset(previous);
-
- }
-
- }
-
while(i2 <= heaplimit && !equal){
addr_block2 = ((void*) (((ADDR2UINT(i2)) - 1) * BLOCKSIZE + (char*)heapbase2));