source: doc/theses/mike_brooks_MMath/benchmarks/list/fx-lq-list.h@ d2e6f84

Last change on this file since d2e6f84 was 6c58850, checked in by Michael Brooks <mlbrooks@…>, 6 weeks ago

Revise data in linked-list plots with streamlined harness and data from runs on swift.

No change to text discussing the plots, so some of that discussion is now stale.

Harness changes allow more ifdef feature disabling and eliminate side-array usage, keeping all per-node harness state inside the list nodes.

Completely disable the interleaving experiment, which was not giving discernable data.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#include <sys/queue.h>
2#include <assert.h>
3#include <stddef.h>
4#include <stdbool.h>
5
6#define HEADNAME_(S) S ## Head
7
8#define BFX_INTRUSION(S) LIST_ENTRY(S) xx;
9#define BFX_EXTRUSION_DECL(S)
10#define BFX_EXTRUSION_FOLLOWUP(S) LIST_HEAD(HEADNAME_(S), S);
11#define BFX_LIST_HEAD_T(S) struct HEADNAME_(S)
12#define BFX_LISTED_ELEM_T(S) S*
13
14#define BFX_INSERT_FIRST(S, lst, item) ({LIST_INSERT_HEAD(&lst, &item, xx); &item;})
15#define BFX_INSERT_LAST(S, lst, item) assert(false&&"unimplemented INSERT_LAST on lq-list")
16#define BFX_INSERT_BEFORE(S, lst, item, refIter) ({LIST_INSERT_BEFORE(refIter, &item, xx); &item;})
17#define BFX_INSERT_AFTER(S, lst, item, refIter) ({LIST_INSERT_AFTER(refIter, &item, xx); &item;})
18#define BFX_REMOVE_FIRST(S, lst) ({ S * first = LIST_FIRST( &lst ); LIST_REMOVE( first, xx ); })
19#define BFX_REMOVE_LAST(S, lst) assert(false&&"unimplemented REMOVE_LAST on lq-list")
20#define BFX_REMOVE_HERE(S, lst, refIter) LIST_REMOVE( refIter, xx )
21#define BFX_INIT(S, lst) LIST_INIT(&lst);
22
23#define BFX_GET_FIRST(S, lst) LIST_FIRST(&lst)
24#define BFX_GET_AFTER(S, lst, iter) LIST_NEXT(iter, xx)
25#define BFX_GET_BEFORE(S, lst, iter) HACK_UNSUPPORTED_PREV(S, lst, iter, xx)
26#define BFX_IS_VALID_POS(S, lst, iter) ((iter)!=NULL)
27#define BFX_DEREF_POS(S, lst, iter) (iter)
28
29#define HACK_UNSUPPORTED_PREV(S, lst, iter, NAME) ({ \
30 S * answer = NULL; \
31 S ** linkAtMe = (iter)->NAME.le_prev; \
32 if ( &(lst) != (BFX_LIST_HEAD_T(S)*)linkAtMe ) { \
33 answer = (S*)( (char*)linkAtMe - offsetof(S, NAME) ); \
34 } \
35 answer; \
36})
37
38#if 0
39void bobs_moveNext() { observedItem = ((observedItem)->xx.le_next); }
40struct { struct B_UserItem *le_next; struct B_UserItem **le_prev; } xx;
41struct { struct B_UserItem *tqe_next; struct B_UserItem * *tqe_prev; } xx;
42
43void bobs_movePrev() {
44 observedItem = (*(((struct B_UserItemHead *)((observedItem)->xx.tqe_prev))->tqh_last)); }
45
46#endif
Note: See TracBrowser for help on using the repository browser.