[BIOSAL] [PATCH] thorium: change action naming to follow Minix-style convention

Boisvert, Sebastien boisvert at anl.gov
Wed Nov 5 16:07:09 CST 2014


Reviewed-by: Sébastien Boisvert <boisvert at anl.gov>

> From: biosal-bounces at lists.cels.anl.gov [biosal-bounces at lists.cels.anl.gov] on behalf of George K. Thiruvathukal [gkt at cs.luc.edu]
> Sent: Wednesday, November 05, 2014 3:53 PM
> To: biosal at lists.cels.anl.gov
> Subject: [BIOSAL] [PATCH] thorium: change action naming to follow Minix-style convention
> 
> 
> 
> 
> 
> Signed-off-by: George K. Thiruvathukal <gkt at cs.luc.edu>
> 
> ---
>  core/structures/fast_ring.c                    |   3 +-
>  engine/thorium/actor.h                         | 107 ++++++++++++++-----------
>  engine/thorium/message.h                       |   4 +-
>  engine/thorium/modules/actions.h               |  19 +++--
>  engine/thorium/modules/binomial_tree_message.h |   5 +-
>  engine/thorium/modules/send_helpers.h          |   5 +-
>  engine/thorium/node.h                          |   9 ++-
>  engine/thorium/transport/message_multiplexer.h |   4 +-
>  examples/ring/ring.h                           |  14 ++--
>  9 files changed, 96 insertions(+), 74 deletions(-)
> 
> diff --git a/core/structures/fast_ring.c b/core/structures/fast_ring.c
> index 1e57a2f..a7e4242 100644
> --- a/core/structures/fast_ring.c
> +++ b/core/structures/fast_ring.c
> @@ -587,8 +587,7 @@ void core_fast_ring_use_multiple_producers(struct core_fast_ring *self)
>      self->use_multiple_producers = YES;
> -    marker = THORIUM_MESSAGE_INVALID_ACTION;
> -
> +    marker = ACTION_INVALID;
>      i = 0;
>      while (i < (int)self->number_of_cells) {
> diff --git a/engine/thorium/actor.h b/engine/thorium/actor.h
> index 9e013f4..6ae48e0 100644
> --- a/engine/thorium/actor.h
> +++ b/engine/thorium/actor.h
> @@ -48,40 +48,49 @@
>  #define THORIUM_ACTOR_EXPOSE_ACQUAINTANCE_VECTOR
>  */
> +/*
> + * We are going to use the Minix convention:
> + * - predefined actions all have negative values
> + * - each module where ACTION_ are defined has a unique base
> + *   in actor.h, the base is #defined as ACTOR_ACTION_BASE
> + * - each action is a displacement from the base
> + */
> +#define ACTOR_ACTION_BASE -1000
> +
>  /* for control */
> -#define ACTION_START 0x00000885
> -#define ACTION_START_REPLY 0x0000232f
> -#define ACTION_STOP 0x0000388c
> -#define ACTION_STOP_REPLY 0x00006fd8
> -#define ACTION_ASK_TO_STOP 0x0000607b
> -#define ACTION_ASK_TO_STOP_REPLY 0x00003602
> +#define ACTION_START (ACTOR_ACTION_BASE + 0)
> +#define ACTION_START_REPLY (ACTOR_ACTION_BASE + 1)
> +#define ACTION_STOP (ACTOR_ACTION_BASE + 2)
> +#define ACTION_STOP_REPLY (ACTOR_ACTION_BASE + 3)
> +#define ACTION_ASK_TO_STOP (ACTOR_ACTION_BASE + 4)
> +#define ACTION_ASK_TO_STOP_REPLY (ACTOR_ACTION_BASE + 5)
> -#define ACTION_SET_CONSUMER 0x000020a9
> -#define ACTION_SET_CONSUMER_REPLY 0x00004db0
> +#define ACTION_SET_CONSUMER (ACTOR_ACTION_BASE + 6)
> +#define ACTION_SET_CONSUMER_REPLY (ACTOR_ACTION_BASE + 7)
> -#define ACTION_SET_PRODUCER 0x00002856
> -#define ACTION_SET_PRODUCER_REPLY 0x00000037
> -#define ACTION_SET_PRODUCERS 0x00005c0b
> -#define ACTION_SET_PRODUCERS_REPLY 0x0000774d
> +#define ACTION_SET_PRODUCER (ACTOR_ACTION_BASE + 8)
> +#define ACTION_SET_PRODUCER_REPLY (ACTOR_ACTION_BASE + 9)
> +#define ACTION_SET_PRODUCERS (ACTOR_ACTION_BASE + 10)
> +#define ACTION_SET_PRODUCERS_REPLY (ACTOR_ACTION_BASE + 11)
> -#define ACTION_SET_CONSUMERS 0x0000671d
> -#define ACTION_SET_CONSUMERS_REPLY 0x000071e4
> +#define ACTION_SET_CONSUMERS (ACTOR_ACTION_BASE + 12)
> +#define ACTION_SET_CONSUMERS_REPLY (ACTOR_ACTION_BASE + 13)
>  /* runtime info */
> -#define ACTION_GET_NODE_NAME 0x00003323
> -#define ACTION_GET_NODE_NAME_REPLY 0x00004d9a
> -#define ACTION_GET_NODE_WORKER_COUNT 0x0000147d
> -#define ACTION_GET_NODE_WORKER_COUNT_REPLY 0x000004ec
> +#define ACTION_GET_NODE_NAME (ACTOR_ACTION_BASE + 14)
> +#define ACTION_GET_NODE_NAME_REPLY (ACTOR_ACTION_BASE + 15)
> +#define ACTION_GET_NODE_WORKER_COUNT (ACTOR_ACTION_BASE + 16)
> +#define ACTION_GET_NODE_WORKER_COUNT_REPLY (ACTOR_ACTION_BASE + 17)
>  /* control YIELD is used as a yielding process.
>   * an actor sends this to itself
>   * when it receives ACTION_YIELD_REPLY, it continues
>   * its work
>   */
> -#define ACTION_YIELD 0x00000173
> -#define ACTION_YIELD_REPLY 0x000016f1
> +#define ACTION_YIELD (ACTOR_ACTION_BASE + 18)
> +#define ACTION_YIELD_REPLY (ACTOR_ACTION_BASE + 19)
> -#define ACTION_PROXY_MESSAGE 0x00004bed
> +#define ACTION_PROXY_MESSAGE (ACTOR_ACTION_BASE + 20)
>  /* affinity */
>  /*
> @@ -92,23 +101,23 @@
>  */
>  /* synchronization */
> -#define ACTION_SYNCHRONIZE 0x00004ac9
> -#define ACTION_SYNCHRONIZE_REPLY 0x00000663
> -#define ACTION_SYNCHRONIZED 0x0000453d
> +#define ACTION_SYNCHRONIZE (ACTOR_ACTION_BASE + 21)
> +#define ACTION_SYNCHRONIZE_REPLY (ACTOR_ACTION_BASE + 22)
> +#define ACTION_SYNCHRONIZED (ACTOR_ACTION_BASE + 23)
>  /* spawn new actors remotely */
> -#define ACTION_SPAWN 0x00000119
> -#define ACTION_SPAWN_REPLY 0x00007b68
> +#define ACTION_SPAWN (ACTOR_ACTION_BASE + 24)
> +#define ACTION_SPAWN_REPLY (ACTOR_ACTION_BASE + 25)
>  /* for import and export */
> -#define ACTION_PACK_ENABLE 0x000015d3
> -#define ACTION_PACK_DISABLE 0x00007f0f
> -#define ACTION_PACK 0x00004cae
> -#define ACTION_PACK_REPLY 0x000024fc
> -#define ACTION_UNPACK 0x00001c73
> -#define ACTION_UNPACK_REPLY 0x000064e4
> -#define ACTION_PACK_SIZE 0x00003307
> -#define ACTION_PACK_SIZE_REPLY 0x00005254
> +#define ACTION_PACK_ENABLE (ACTOR_ACTION_BASE + 26)
> +#define ACTION_PACK_DISABLE (ACTOR_ACTION_BASE + 27)
> +#define ACTION_PACK (ACTOR_ACTION_BASE + 28)
> +#define ACTION_PACK_REPLY (ACTOR_ACTION_BASE + 29)
> +#define ACTION_UNPACK (ACTOR_ACTION_BASE + 30)
> +#define ACTION_UNPACK_REPLY (ACTOR_ACTION_BASE + 31)
> +#define ACTION_PACK_SIZE (ACTOR_ACTION_BASE + 32)
> +#define ACTION_PACK_SIZE_REPLY (ACTOR_ACTION_BASE + 33)
>  /* cloning */
>  /* design notes:
> @@ -130,19 +139,19 @@ reply THORIUM_ CLONE_REPLY with newly spawned actor
>   * CLONE takes one int (the spawner) and returns CLONE_REPLY
>   *
>   */
> -#define ACTION_CLONE 0x00000d60
> +#define ACTION_CLONE (ACTOR_ACTION_BASE + 34)
>  /* CLONE_REPLY returns one int: the clone name */
> -#define ACTION_CLONE_REPLY 0x00006881
> +#define ACTION_CLONE_REPLY (ACTOR_ACTION_BASE + 35)
>  /* for migration */
> -#define ACTION_MIGRATE 0x000073ff
> -#define ACTION_MIGRATE_REPLY 0x00001442
> -#define ACTION_MIGRATE_NOTIFY_ACQUAINTANCES 0x000029b6
> -#define ACTION_MIGRATE_NOTIFY_ACQUAINTANCES_REPLY 0x00007fe2
> -#define ACTION_FORWARD_MESSAGES 0x00000bef
> -#define ACTION_FORWARD_MESSAGES_REPLY 0x00002ff3
> -#define ACTION_SET_SUPERVISOR 0x0000312f
> -#define ACTION_SET_SUPERVISOR_REPLY 0x00007b18
> +#define ACTION_MIGRATE (ACTOR_ACTION_BASE + 36)
> +#define ACTION_MIGRATE_REPLY (ACTOR_ACTION_BASE + 37)
> +#define ACTION_MIGRATE_NOTIFY_ACQUAINTANCES (ACTOR_ACTION_BASE + 38)
> +#define ACTION_MIGRATE_NOTIFY_ACQUAINTANCES_REPLY (ACTOR_ACTION_BASE + 39)
> +#define ACTION_FORWARD_MESSAGES (ACTOR_ACTION_BASE + 39)
> +#define ACTION_FORWARD_MESSAGES_REPLY (ACTOR_ACTION_BASE + 40)
> +#define ACTION_SET_SUPERVISOR (ACTOR_ACTION_BASE + 41)
> +#define ACTION_SET_SUPERVISOR_REPLY (ACTOR_ACTION_BASE + 42)
>  /* name change for acquaintances
> @@ -161,8 +170,8 @@ ACTION_NOTIFY_NAME_CHANGE (source is old name, name is new name)
>  the actor just need to change any acquaintance with old name to
>  new name.
>  */
> -#define ACTION_NOTIFY_NAME_CHANGE 0x000068b9
> -#define ACTION_NOTIFY_NAME_CHANGE_REPLY 0x00003100
> +#define ACTION_NOTIFY_NAME_CHANGE (ACTOR_ACTION_BASE + 43)
> +#define ACTION_NOTIFY_NAME_CHANGE_REPLY (ACTOR_ACTION_BASE + 44)
>  /*
>   * Messages for actors that are data stores
> @@ -171,9 +180,9 @@ new name.
>  /* Auto-scaling stuff
>   */
> -#define ACTION_ENABLE_AUTO_SCALING 0x00000ede
> -#define ACTION_DISABLE_AUTO_SCALING 0x00002b88
> -#define ACTION_DO_AUTO_SCALING 0x000064de
> +#define ACTION_ENABLE_AUTO_SCALING (ACTOR_ACTION_BASE + 45)
> +#define ACTION_DISABLE_AUTO_SCALING (ACTOR_ACTION_BASE + 46)
> +#define ACTION_DO_AUTO_SCALING (ACTOR_ACTION_BASE + 47)
>  /*
>   * some actor constants
> diff --git a/engine/thorium/message.h b/engine/thorium/message.h
> index f67c9fa..10821fa 100644
> --- a/engine/thorium/message.h
> +++ b/engine/thorium/message.h
> @@ -17,8 +17,8 @@
>   * A message can not be distributed with the action specific
>   * ACTION_INVALID.
>   */
> -#define THORIUM_MESSAGE_INVALID_ACTION          0x00000000
> -#define ACTION_INVALID THORIUM_MESSAGE_INVALID_ACTION
> +
> +#define ACTION_INVALID -1
>  /*
>   * Use tracepoints to analyze the life cycle of messages.
> diff --git a/engine/thorium/modules/actions.h b/engine/thorium/modules/actions.h
> index a038e45..f858ca4 100644
> --- a/engine/thorium/modules/actions.h
> +++ b/engine/thorium/modules/actions.h
> @@ -12,20 +12,23 @@
>   * ACTOR_PING can be used by concrete actors, it is
>   * not being used by biosal systems.
>   */
> -#define ACTION_PING 0x000040b3
> -#define ACTION_PING_REPLY 0x00006eda
> +
> +#define PING_ACTION_BASE -3000
> +
> +#define ACTION_PING (PING_ACTION_BASE + 0)
> +#define ACTION_PING_REPLY (PING_ACTION_BASE + 1)
>  /*
>   * The notify messages can be used freely.
>   */
> -#define ACTION_NOTIFY 0x0000710b
> -#define ACTION_NOTIFY_REPLY 0x00005f82
> +#define ACTION_NOTIFY (PING_ACTION_BASE + 2)
> +#define ACTION_NOTIFY_REPLY (PING_ACTION_BASE + 3)
> -#define ACTION_RESET 0x00005045
> -#define ACTION_RESET_REPLY 0x0000056d
> +#define ACTION_RESET (PING_ACTION_BASE + 4)
> +#define ACTION_RESET_REPLY (PING_ACTION_BASE + 5)
> -#define ACTION_BEGIN 0x0000125f
> -#define ACTION_BEGIN_REPLY 0x0000214a
> +#define ACTION_BEGIN (PING_ACTION_BASE + 6)
> +#define ACTION_BEGIN_REPLY (PING_ACTION_BASE + 7)
>  struct core_vector;
>  struct thorium_actor;
> diff --git a/engine/thorium/modules/binomial_tree_message.h b/engine/thorium/modules/binomial_tree_message.h
> index b24f1ac..d84690b 100644
> --- a/engine/thorium/modules/binomial_tree_message.h
> +++ b/engine/thorium/modules/binomial_tree_message.h
> @@ -7,7 +7,10 @@ struct thorium_message;
>  struct thorium_actor;
>  /* binomial-tree */
> -#define ACTION_BINOMIAL_TREE_SEND 0x00005b36
> +
> +#define BINOMIAL_TREE_ACTION_BASE -4000
> +
> +#define ACTION_BINOMIAL_TREE_SEND (BINOMIAL_TREE_ACTION_BASE + 0)
>  /*
>  #define DEBUG_BINOMIAL_TREE
> diff --git a/engine/thorium/modules/send_helpers.h b/engine/thorium/modules/send_helpers.h
> index 549cfc1..97a31fe 100644
> --- a/engine/thorium/modules/send_helpers.h
> +++ b/engine/thorium/modules/send_helpers.h
> @@ -6,8 +6,9 @@
>  #include <stdint.h>
> -#define ACTION_SET_PRODUCERS_FOR_WORK_STEALING 0x002f77ab
> -#define ACTION_SET_PRODUCERS_FOR_WORK_STEALING_REPLY 0x0038c869
> +#define SEND_HELPERS_ACTION_BASE -5000
> +#define ACTION_SET_PRODUCERS_FOR_WORK_STEALING (SEND_HELPERS_ACTION_BASE + 0)
> +#define ACTION_SET_PRODUCERS_FOR_WORK_STEALING_REPLY (SEND_HELPERS_ACTION_BASE + 1)
>  /*
>   * Actor helpers are function that work on a thorium_actor but that do not access attributes
> diff --git a/engine/thorium/node.h b/engine/thorium/node.h
> index 918a695..8ddbb65 100644
> --- a/engine/thorium/node.h
> +++ b/engine/thorium/node.h
> @@ -41,10 +41,11 @@
>  /* Some message tags at the node level instead of the actor level
>   */
> -#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTOR 0x00002438
> -#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTORS 0x00004c19
> -#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTORS_REPLY 0x00003ad3
> -#define ACTION_THORIUM_NODE_START 0x0000082c
> +#define NODE_ACTION_BASE -6000
> +#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTOR (NODE_ACTION_BASE + 0)
> +#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTORS (NODE_ACTION_BASE + 1)
> +#define ACTION_THORIUM_NODE_ADD_INITIAL_ACTORS_REPLY (NODE_ACTION_BASE + 2)
> +#define ACTION_THORIUM_NODE_START (NODE_ACTION_BASE + 3)
>  /*
>   * Use deterministic actor names.
> diff --git a/engine/thorium/transport/message_multiplexer.h b/engine/thorium/transport/message_multiplexer.h
> index f7e0aeb..29ff07b 100644
> --- a/engine/thorium/transport/message_multiplexer.h
> +++ b/engine/thorium/transport/message_multiplexer.h
> @@ -17,7 +17,9 @@ struct thorium_message;
>  /*
>   * The multiplexer needs its own action
>   */
> -#define ACTION_MULTIPLEXER_MESSAGE 0x0024afc9
> +
> +#define MULTIPLEXER_ACTION_BASE -7000
> +#define ACTION_MULTIPLEXER_MESSAGE (MULTIPLEXER_ACTION_BASE + 0)
>  /*
>   * Genomic graph traversal is characterized by:
> diff --git a/examples/ring/ring.h b/examples/ring/ring.h
> index 9086768..7f83393 100644
> --- a/examples/ring/ring.h
> +++ b/examples/ring/ring.h
> @@ -18,11 +18,15 @@ struct ring {
>      int previous;
>  };
> -#define ACTION_RING_READY 0x000067db
> -#define ACTION_RING_KILL 0x00004cfe
> -#define ACTION_RING_SET_NEXT 0x00003833
> -#define ACTION_RING_PUSH_NEXT 0x0000153c
> -#define ACTION_RING_SPAWN 0x00001bd7
> +/* see notes in actor.h about how we number internal Thorium engine messages */
> +
> +#define RING_ACTION_BASE -2000
> +
> +#define ACTION_RING_READY (RING_ACTION_BASE + 0)
> +#define ACTION_RING_KILL (RING_ACTION_BASE + 1)
> +#define ACTION_RING_SET_NEXT (RING_ACTION_BASE + 2)
> +#define ACTION_RING_PUSH_NEXT (RING_ACTION_BASE + 3)
> +#define ACTION_RING_SPAWN (RING_ACTION_BASE + 4)
>  extern struct thorium_script ring_script;
> -- 
> 1.9.3 (Apple Git-50)
> 
> 
> 
> 


More information about the BIOSAL mailing list