-
Notifications
You must be signed in to change notification settings - Fork 0
/
linden.h
105 lines (84 loc) · 2.22 KB
/
linden.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef PRIOQ_H
#define PRIOQ_H
#include "linden_common.h"
#include "rsl_c.h"
typedef unsigned long pkey_t;
typedef unsigned long pval_t;
#define KEY_NULL 0
#define NUM_LEVELS 32
/* Internal key values with special meanings. */
#define SENTINEL_KEYMIN ( 0UL) /* Key value of first dummy node. */
#define SENTINEL_KEYMAX (~1UL) /* Key value of last dummy node. */
typedef struct node_s
{
pkey_t k;
int level;
int inserting; //char pad2[4];
pval_t v;
struct node_s *next[1];
} node_t;
typedef struct
{
int max_offset;
int max_level;
int nthreads;
node_t *head;
node_t *tail;
char pad[128];
} pq_t;
typedef ALIGNED(64) struct thread_data {
val_t first;
long range;
int update;
int unit_tx;
int alternate;
int randomized;
int pq;
int sl;
int es;
int effective;
int first_remove;
unsigned long nb_collisions;
unsigned long nb_clean;
unsigned long nb_add;
unsigned long nb_added;
unsigned long nb_remove;
unsigned long nb_removed;
unsigned long nb_contains;
unsigned long nb_found;
unsigned long nb_aborts;
unsigned long nb_aborts_locked_read;
unsigned long nb_aborts_locked_write;
unsigned long nb_aborts_validate_read;
unsigned long nb_aborts_validate_write;
unsigned long nb_aborts_validate_commit;
unsigned long nb_aborts_invalid_memory;
unsigned long nb_aborts_double_write;
unsigned long max_retries;
unsigned int nb_threads;
unsigned int seed;
unsigned int seed2;
sl_intset_t *set;
barrier_t *barrier;
unsigned long failures_because_contention;
int id;
/* LINDEN */
int lin;
pq_t *linden_set;
/* RSL */
int rsl;
rsl_t *rpq;
int rpqInserts;
} thread_data_t;
#define get_marked_ref(_p) ((void *)(((uintptr_t)(_p)) | 1))
#define get_unmarked_ref(_p) ((void *)(((uintptr_t)(_p)) & ~1))
#define is_marked_ref(_p) (((uintptr_t)(_p)) & 1)
/* Interface */
extern pq_t *pq_init(int max_offset);
extern void pq_destroy(pq_t *pq);
extern int insert(pq_t *pq, pkey_t k, pval_t v);
extern pval_t deletemin(pq_t *pq, thread_data_t *d);
extern pval_t deletemin_key(pq_t *pq, pkey_t *key, thread_data_t *d);
extern void sequential_length(pq_t *pq);
extern int empty(pq_t *pq);
#endif // PRIOQ_H