cuflow/cached.h: Cached Function Calls
[[experimental]]

Data Structures

struct  cuflowP_cached_node

Defines

#define CUFLOW_CACHED_GRAN_SIZEW   1
#define CUFLOW_CACHED_GRAN_SIZEB   (CU_WORD_SIZE*CUFLOW_CACHED_GRAN_SIZEW)
#define CUFLOW_CACHED_ARG_SIZEG(NAME)
#define CUFLOW_CACHED_ARG_SIZE(NAME)   (CUFLOW_CACHED_ARG_SIZEG(NAME)*CUFLOW_CACHED_GRAN_SIZEB)
#define cuflowP_cached_decls(NAME, arg_members, res_members, linkage)
#define cuflow_cached_edecl(NAME, arg_members, res_members)   cuflowP_cached_decls(NAME, arg_members, res_members, extern)
#define cuflow_cached_edef(NAME)   extern void NAME##_fn(NAME##_arg_t *arg)
#define cuflow_cached_sdecl(NAME, arg_members, res_members)   cuflowP_cached_decls(NAME, arg_members, res_members, static)
#define cuflow_cached_sdef(NAME)   static void NAME##_fn(NAME##_arg_t *arg)
#define cuflow_cached_def(NAME, arg_members, res_members)
#define CUFLOW_CACHED_NODE_FROM_ARG(NAME, arg)
#define cuflow_cached_arg_res(NAME)   NAME##_result_t res = &CUFLOW_CACHED_NODE_FROM_ARG(NAME, arg)->res
#define cuflow_cached_set_gain(NAME, x)
#define cuflow_cached_call(NAME, arg_block, result_out)
#define cuflow_cached_sched_call(NAME, arg_block, promise_out)

Typedefs

typedef unsigned long cuflow_gain_t
typedef struct cuflowP_cached_node cuflowP_cached_node_t

Functions

typedef cu_clop0 (cuflow_cached_clop_t, void)
void * cuflowP_cached_call (void *arg, size_t arg_sizeg, size_t full_size)
void * cuflowP_sched_cached_call (void *arg, size_t, size_t)

Define Documentation

#define cuflow_cached_arg_res ( NAME   )     NAME##_result_t res = &CUFLOW_CACHED_NODE_FROM_ARG(NAME, arg)->res

Used in a cached function definition, inserts declarations and initialisation of two local variables arg and res. arg is the initialised argument struct from the caller, and res is the result struct to be filled out.

#define CUFLOW_CACHED_ARG_SIZEG ( NAME   ) 
Value:
((sizeof(struct NAME##_arg) + CUFLOW_CACHED_GRAN_SIZEB - 1)             \
     / CUFLOW_CACHED_GRAN_SIZEB)
#define cuflow_cached_call ( NAME,
arg_block,
result_out   ) 
Value:
do {                                                            \
        NAME##_t cuL_padded_arg;                                        \
        NAME##_init(&cuL_padded_arg);                                   \
        NAME##_arg_t *arg = &cuL_padded_arg.arg;                        \
        { cuPP_splice arg_block }                                       \
        {                                                               \
            NAME##_node_t *cuL_node = cuflowP_cached_call(              \
                    &cuL_padded_arg, CUFLOW_CACHED_ARG_SIZEG(NAME),     \
                    sizeof(struct NAME##_node));                        \
            *(result_out) = &cuL_node->res;                             \
        }                                                               \
    } while (0)
#define cuflow_cached_def ( NAME,
arg_members,
res_members   ) 
Value:
cuflow_cached_sdecl(NAME, arg_members, res_members);            \
    cuflow_cached_sdef(NAME)

Emits type definitions and declarations for a cached function with static linkage, and the prototype of the function. Shall be followed by the body of the function.

#define cuflow_cached_edecl ( NAME,
arg_members,
res_members   )     cuflowP_cached_decls(NAME, arg_members, res_members, extern)

Emits type definitions and declarations for a cached function with external linkage.

#define cuflow_cached_edef ( NAME   )     extern void NAME##_fn(NAME##_arg_t *arg)

Emits the prototype of the cached function with external linkage. This shall be followed by the body of the function.

#define CUFLOW_CACHED_NODE_FROM_ARG ( NAME,
arg   ) 
Value:
((NAME##_node_t *)                                                      \
     ((char *)(arg) - offsetof(struct NAME##_node, padded_arg)))
#define cuflow_cached_sched_call ( NAME,
arg_block,
promise_out   ) 
Value:
do {                                                            \
        NAME##_t cuL_padded_arg;                                        \
        NAME##_init(&cuL_padded_arg);                                   \
        NAME##_arg_t *arg = &cuL_padded_arg.arg;                        \
        { cuPP_splice arg_block }                                       \
        *(promise_out) = (NAME##_promise_t)cuflowP_sched_cached_call(   \
                    &cuL_padded_arg, CUFLOW_CACHED_ARG_SIZEG(NAME),     \
                    sizeof(struct NAME##_node));                        \
    } while (0)
#define cuflow_cached_sdecl ( NAME,
arg_members,
res_members   )     cuflowP_cached_decls(NAME, arg_members, res_members, static)

Emits type definitions and declarations for a cached function with static linkage.

#define cuflow_cached_sdef ( NAME   )     static void NAME##_fn(NAME##_arg_t *arg)

Emits the prototype of the cached function with static linkage. This shall be followed by the body of the function.

#define cuflow_cached_set_gain ( NAME,
 ) 
Value:
(cu_to(cuflowP_cached_node,                                             \
           CUFLOW_CACHED_NODE_FROM_ARG(NAME, arg))->access_gain = x)
Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.