⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erl_nmgc.h

📁 OTP是开放电信平台的简称
💻 H
📖 第 1 页 / 共 2 页
字号:
} while(0)*//* Return and remove the youngest element - treat the storage as a * stack. Always check that there are elements in the queue before * using INC_STORAGE_POP! */#define INC_STORAGE_POP(name) (ASSERT_EXPR(name##size != 0),            \    name##size--,                                                       \    (--name##free != name##head->data - 1) ?                            \    name##free : (name##head = name##head->prev,                        \                  name##free = name##head->data + INC_STORAGE_SIZE - 1))/* Return and remove the oldest element - treat the storage as a * queue. Always check that there are elements in the queue before * using INC_STORAGE_GET! */#define INC_STORAGE_GET(name) (ASSERT_EXPR(name##size != 0),            \    name##size--,                                                       \    (++name##last_free != name##tail->data + INC_STORAGE_SIZE) ?        \     name##last_free : (name##tail = name##tail->next,                  \                        name##last_free = name##tail->data))/* Advance the head to the next free location. If the storage is full, * a new storage is allocated and linked into the list. */#define INC_STORAGE_NEXT(name) do {                                     \    if (name##free == name##last_free) {                                \        name##tail = (INC_Storage*)erts_alloc(ERTS_ALC_T_OBJECT_STACK,  \                                              sizeof(INC_Storage));     \        memcpy(name##tail->data,name##head->data,                       \               INC_STORAGE_SIZE * sizeof(INC_Object));                  \        name##tail->next = name##head->next;                            \        name##head->next = name##tail;                                  \        name##tail->prev = name##tail->next->prev;                      \        name##tail->next->prev = name##tail;                            \        name##last_free = ((void*)name##tail +                          \                         ((void*)name##last_free - (void*)name##head)); \    }                                                                   \    name##free++;                                                       \    name##size++;                                                       \    if (name##free == name##head->data + INC_STORAGE_SIZE) {            \        name##head = name##head->next;                                  \        name##free = name##head->data;                                  \    }                                                                   \} while(0)/* The head of this storage is the next free location. This is where * the next element will be stored. */#define INC_STORAGE_HEAD(name) (name##free)/* Return the top - the youngest element in the storage. *//* #define INC_STORAGE_TOP(name) (name##free - 1 with some magic..) *//* True if the storage is empty, false otherwise */#define INC_STORAGE_EMPTY(name) (name##size == 0)/* Store a new element in the head of the storage and advance the head * to the next free location. */#define INC_STORE(name,ptr,sz) do {                                      \    INC_STORAGE_HEAD(name)->this = ptr;                                  \    INC_STORAGE_HEAD(name)->size = sz;                                   \    INC_STORAGE_NEXT(name);                                              \} while(0)/* An iterator. Use it together with INC_STORAGE_STEP to browse throuh * the storage. Please note that it is not possible to remove an entry * in the middle of the storage, use GET or POP to remove enties. */#define INC_STORAGE_ITERATOR(name)                                      \    INC_Storage *name##iterator_head = name##tail;                      \    INC_Object *name##iterator_current = name##last_free;               \    int name##iterator_left = name##size;/* Return the next element in the storage (sorted by age, oldest * first) or NULL if the storage is empty or the last element has been * returned already. */#define INC_STORAGE_STEP(name) (name##iterator_left == 0 ? NULL :       \    (name##iterator_left--,                                             \     (++name##iterator_current != name##iterator_head->data +           \      INC_STORAGE_SIZE) ? name##iterator_current :                      \     (name##iterator_head = name##iterator_head->next,                  \      name##iterator_current = name##iterator_head->data)))/* Erase the storage. */#define INC_STORAGE_ERASE(name)do {                             \    name##head->prev->next = NULL;                              \    while (name##head != NULL) {                                \        name##tail = name##head;                                \        name##head = name##head->next;                          \        erts_free(ERTS_ALC_T_OBJECT_STACK,(void*)name##tail);   \    }                                                           \    name##tail = NULL;                                          \    name##free = NULL;                                          \    name##last_free = NULL;                                     \    name##size = 0;                                             \} while(0)/* * Structures used by the non-moving memory manager */typedef struct{  Eterm *this;  unsigned long size;} INC_Object;typedef struct inc_storage {  struct inc_storage *next;  struct inc_storage *prev;  INC_Object data[INC_STORAGE_SIZE];} INC_Storage;typedef struct inc_mem_block{  unsigned long size;  struct inc_mem_block *prev;  struct inc_mem_block *next;} INC_MemBlock;typedef struct inc_page{  struct inc_page *next;  Eterm start[1]; /* Has to be last in struct, this is where the data start */} INC_Page;/* * Heap pointers for the non-moving memory area. */extern INC_Page *inc_used_mem;extern INC_MemBlock *inc_free_list;extern unsigned char *blackmap;extern Eterm **fwdptrs;extern Eterm *inc_fromspc;extern Eterm *inc_fromend;extern Process *inc_active_proc;extern Process *inc_active_last;extern Eterm *inc_alloc_limit;extern int   inc_words_to_go;INC_STORAGE_DECLARATION(extern,gray);INC_STORAGE_DECLARATION(extern,root);void erts_init_incgc(void);void erts_cleanup_incgc(void);void erts_incremental_gc(Process *p, int sz, Eterm* objv, int nobj);Eterm *erts_inc_alloc(int need);#else#  define INC_STORE(lst,ptr,sz)#  define INC_MARK_FORWARD(ptr)#  define INC_IS_FORWARDED(ptr)#  define INC_FORWARD_VALUE(ptr)#endif /* INCREMENTAL */#endif /* _ERL_NMGC_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -