HPCToolkit
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "randomizer.h"
#include "cskiplist.h"
Go to the source code of this file.
Macros | |
#define | NULL 0 |
#define | CSKL_DEBUG 0 |
#define | NO_LAYER -1 |
#define | SIZEOF_CSKLNODE_T(L) (sizeof(csklnode_t) + sizeof(void*) * L) |
#define | NUM_NODES 10 |
#define | NODE_STR_LEN 4096 |
Enumerations | |
enum | cskiplist_find_type { cskiplist_find_early_exit, cskiplist_find_full } |
Functions | |
static csklnode_t * | csklnode_alloc_node (int height, mem_alloc m_alloc) |
static void | csklnode_add_nodes_to_lfl (int maxheight, mem_alloc m_alloc) |
static csklnode_t * | csklnode_alloc_from_lfl (void *val) |
static void | csklnode_free_to_lfl (csklnode_t *node) |
static void | csklnode_populate_lfl (int maxheight, mem_alloc m_alloc) |
static csklnode_t * | csklnode_malloc (void *val, int maxheight, mem_alloc m_alloc) |
static bool | cskiplist_node_is_removable (csklnode_t *candidate, int layer) |
static int | cskiplist_find_helper (val_cmp compare, int max_height, csklnode_t *pred, void *val, csklnode_t *preds[], csklnode_t *succs[], cskiplist_find_type ft) |
static csklnode_t * | cskiplist_find (val_cmp compare, cskiplist_t *cskl, void *value) |
static void | unlock_preds (csklnode_t *preds[], mcs_node_t mcs_nodes[], int highestLocked) |
static void | cskl_links_tostr (int max_height, char str[], int max_cskl_str_len) |
static bool | cskl_del_bulk_unsynch (val_cmp cmpfn, cskiplist_t *cskl, void *lo, void *hi, mem_free m_free) |
void | cskl_init () |
void | cskl_free (void *anode) |
cskiplist_t * | cskl_new (void *lsentinel, void *rsentinel, int max_height, val_cmp compare, val_cmp inrange, mem_alloc m_alloc) |
void * | cskl_cmp_find (cskiplist_t *cskl, void *value) |
void * | cskl_inrange_find (cskiplist_t *cskl, void *value) |
csklnode_t * | cskl_insert (cskiplist_t *cskl, void *value, mem_alloc m_alloc) |
bool | cskl_delete (cskiplist_t *cskl, void *value) |
bool | cskl_cmp_del_bulk_unsynch (cskiplist_t *cskl, void *lo, void *hi, mem_free m_free) |
bool | cskl_inrange_del_bulk_unsynch (cskiplist_t *cskl, void *lo, void *hi, mem_free m_free) |
void | cskl_levels_tostr (int height, int max_height, char str[], int max_cskl_str_len) |
void | cskl_append_node_str (char nodestr[], char str[], int max_cskl_str_len) |
void | cskl_tostr (cskiplist_t *cskl, cskl_node_tostr node_tostr, char csklstr[], int max_cskl_str_len) |
static void | cskl_links_dump (csklnode_t *node, int max_height) |
void | cskl_dump (cskiplist_t *cskl, cskl_node_tostr node_tostr) |
static void | cskl_links_print (csklnode_t *node, int max_height) |
void | cskl_print (cskiplist_t *cskl, cskl_node_tostr node_tostr) |
int | cskl_check_node_dump (val_cmp compare, int max_height, cskl_node_tostr node_tostr, csklnode_t *node) |
void | cskl_check_dump (cskiplist_t *cs, cskl_node_tostr node_tostr) |
Variables | |
static csklnode_t * | GF_cskl_nodes = NULL |
static mcs_lock_t | GFCN_lock |
static __thread csklnode_t * | _lf_cskl_nodes = NULL |
#define CSKL_DEBUG 0 |
Definition at line 79 of file cskiplist.c.
#define NO_LAYER -1 |
Definition at line 81 of file cskiplist.c.
#define NODE_STR_LEN 4096 |
Definition at line 757 of file cskiplist.c.
#define NULL 0 |
Definition at line 76 of file cskiplist.c.
#define NUM_NODES 10 |
Definition at line 86 of file cskiplist.c.
#define SIZEOF_CSKLNODE_T | ( | L | ) | (sizeof(csklnode_t) + sizeof(void*) * L) |
Definition at line 84 of file cskiplist.c.
enum cskiplist_find_type |
Enumerator | |
---|---|
cskiplist_find_early_exit | |
cskiplist_find_full |
Definition at line 99 of file cskiplist.c.
|
static |
Definition at line 286 of file cskiplist.c.
|
static |
from Herlihy, 2006. pre-conditions: preds[] and succs[] are arrays of csklnode_t* of length cskl->max_height.
post-conditions: if val is in cskl, return the first layer where val is found, otherwise return NO_LAYER.
preds[i]->val < val <= succs[i] for i = low..cskl->max_height-1, where low = (ft == cskiplist_find_full)? 0: found_layer, in other words, preds[i] is the node that precedes the found node at level i succs[i] is the node that follows the found node at level i.
if val is found, val == succs[cskiplist_find_helper(compare, val, preds, succs, ft)]
Definition at line 246 of file cskiplist.c.
|
inlinestatic |
Definition at line 220 of file cskiplist.c.
void cskl_append_node_str | ( | char | nodestr[], |
char | str[], | ||
int | max_cskl_str_len | ||
) |
Definition at line 697 of file cskiplist.c.
void cskl_check_dump | ( | cskiplist_t * | cs, |
cskl_node_tostr | node_tostr | ||
) |
Definition at line 861 of file cskiplist.c.
int cskl_check_node_dump | ( | val_cmp | compare, |
int | max_height, | ||
cskl_node_tostr | node_tostr, | ||
csklnode_t * | node | ||
) |
Definition at line 826 of file cskiplist.c.
bool cskl_cmp_del_bulk_unsynch | ( | cskiplist_t * | cskl, |
void * | lo, | ||
void * | hi, | ||
mem_free | m_free | ||
) |
Definition at line 666 of file cskiplist.c.
void* cskl_cmp_find | ( | cskiplist_t * | cskl, |
void * | value | ||
) |
|
static |
Definition at line 340 of file cskiplist.c.
bool cskl_delete | ( | cskiplist_t * | cskl, |
void * | value | ||
) |
void cskl_dump | ( | cskiplist_t * | cskl, |
cskl_node_tostr | node_tostr | ||
) |
void cskl_free | ( | void * | anode | ) |
Definition at line 422 of file cskiplist.c.
void cskl_init | ( | ) |
Definition at line 409 of file cskiplist.c.
bool cskl_inrange_del_bulk_unsynch | ( | cskiplist_t * | cskl, |
void * | lo, | ||
void * | hi, | ||
mem_free | m_free | ||
) |
Definition at line 672 of file cskiplist.c.
void* cskl_inrange_find | ( | cskiplist_t * | cskl, |
void * | value | ||
) |
Definition at line 475 of file cskiplist.c.
csklnode_t* cskl_insert | ( | cskiplist_t * | cskl, |
void * | value, | ||
mem_alloc | m_alloc | ||
) |
Definition at line 483 of file cskiplist.c.
void cskl_levels_tostr | ( | int | height, |
int | max_height, | ||
char | str[], | ||
int | max_cskl_str_len | ||
) |
|
static |
|
static |
|
static |
cskiplist_t* cskl_new | ( | void * | lsentinel, |
void * | rsentinel, | ||
int | max_height, | ||
val_cmp | compare, | ||
val_cmp | inrange, | ||
mem_alloc | m_alloc | ||
) |
Definition at line 441 of file cskiplist.c.
void cskl_print | ( | cskiplist_t * | cskl, |
cskl_node_tostr | node_tostr | ||
) |
void cskl_tostr | ( | cskiplist_t * | cskl, |
cskl_node_tostr | node_tostr, | ||
char | csklstr[], | ||
int | max_cskl_str_len | ||
) |
|
static |
Definition at line 132 of file cskiplist.c.
|
static |
|
static |
Definition at line 118 of file cskiplist.c.
|
static |
|
static |
Definition at line 203 of file cskiplist.c.
|
static |
Definition at line 177 of file cskiplist.c.
|
inlinestatic |
Definition at line 311 of file cskiplist.c.
|
static |
Definition at line 107 of file cskiplist.c.
|
static |
Definition at line 105 of file cskiplist.c.
|
static |
Definition at line 106 of file cskiplist.c.