Selected Documentation for Messaging-Cells Library
Macros | Functions
shared.h File Reference

C shared structures (by the manageru and all workerus). It is included in global.h and cell.hh. More...

#include <stdint.h>
#include <inttypes.h>
#include "attribute.h"
#include "log.h"
#include "rr_array.h"
#include "shared_eph.h"
+ Include dependency graph for shared.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define mc_addr_in_manageru(addr)   (! mc_addr_in_sys(addr))
 Returns true if 'addr' is in the manageru.
 
#define mc_dref(typ_nam, glb_pt, pt_field)   ((typ_nam*)mc_addr_set_id(mc_addr_get_id(glb_pt), (glb_pt)->pt_field))
 
#define mc_dref_field(cls_base, base, cls_field, field)   ((cls_field*)(uint8_t*)(((uint8_t*)base) + mc_offsetof(&cls_base::field)))
 
#define MC_IS_ALIGNED_16(ptr)   ((((uintptr_t)ptr) & 0x1) == 0)
 True if ptr is 16 aligned.
 
#define MC_IS_ALIGNED_32(ptr)   ((((uintptr_t)ptr) & 0x3) == 0)
 True if ptr is 32 aligned.
 
#define MC_IS_ALIGNED_64(ptr)   ((((uintptr_t)ptr) & 0x7) == 0)
 True if ptr is 64 aligned.
 
#define mc_loop_set_var(var, val)
 Warranted set of an off-workeru variable (loops until reading the value). Use only if needed.
 
#define mc_init_arr_objs(sz, arr, cls)
 Inits an array 'arr' of objects of class 'cls' and size 'sz' with 'new'.
 
#define mc_init_arr_vals(sz, arr, val)
 Inits an array 'arr' of objects of size 'sz' with 'val'.
 
#define mc_manageru_pt_to_workeru_pt(pt)   (mc_manageru_addr_to_workeru_addr((mc_addr_t)(pt)))
 Maps a manageru pointer to a workeru pointer.
 
#define mc_workeru_pt_to_manageru_pt(pt)   (mc_workeru_addr_to_manageru_addr((mc_addr_t)(pt)))
 Maps a workeru pointer to a manageru pointer.
 

Functions

bool mc_inline_fn mc_addr_in_workeru (mc_addr_t addr, mc_workeru_id_t koid)
 Returns true if 'addr' is local to the workeru with id 'koid'.
 
bool mc_inline_fn mc_addr_in_sys (mc_addr_t addr)
 Returns true if 'addr' is in any of the workerus of the epiphany system.
 
mc_opt_sz_fn uint8_t * mc_memset (uint8_t *dest, uint8_t val, mc_size_t sz) mc_external_code_ram
 Library EXTERNAL RAM running version of memset.
 
mc_opt_sz_fn uint8_t * mc_memcpy (uint8_t *dest, const uint8_t *src, mc_size_t sz) mc_external_code_ram
 Library EXTERNAL RAM running version of memcpy.
 
mc_opt_sz_fn uint8_t * mc_memmove (uint8_t *dest, const uint8_t *src, mc_size_t sz) mc_external_code_ram
 Library EXTERNAL RAM running version of memmove.
 
uint16_t mc_strlen (char *str) mc_external_code_ram
 Library EXTERNAL RAM running version of strlen.
 
uint8_t mc_strcmp (char *str1, char *str2) mc_external_code_ram
 Library EXTERNAL RAM running version of strcmp.
 
mc_addr_t mc_manageru_addr_to_workeru_addr (mc_addr_t h_addr) mc_external_code_ram
 Maps a manageru address to a workeru address.
 
mc_addr_t mc_workeru_addr_to_manageru_addr (mc_addr_t c_addr) mc_external_code_ram
 Maps a workeru address to a manageru address.
 

Detailed Description

C shared structures (by the manageru and all workerus). It is included in global.h and cell.hh.

Macro Definition Documentation

#define mc_dref (   typ_nam,
  glb_pt,
  pt_field 
)    ((typ_nam*)mc_addr_set_id(mc_addr_get_id(glb_pt), (glb_pt)->pt_field))

Remote dereference of a 'pt_field' of remote object pointer 'glb_pt' (with id) and returns it as a 'typ_nam' pointer

#define mc_dref_field (   cls_base,
  base,
  cls_field,
  field 
)    ((cls_field*)(uint8_t*)(((uint8_t*)base) + mc_offsetof(&cls_base::field)))

Remote dereference of a 'field' of class 'cls_field' in a remote object structure 'base' (not a pointer) of class 'cls_base'.