Data Structures | |
struct | tm_list |
Defines | |
#define | tm_list_color(l) (((tm_list*) (l))->_prev._c._color) |
The color of a tm_list element. | |
#define | tm_list_set_color(l, c) (((tm_list*) (l))->_prev._c._color = (c)) |
Sets the color of a tm_list element. | |
#define | tm_list_set_next(l, x) (((tm_list*) (l))->_next = (x)) |
Sets the next pointer of a tm_list element. | |
#define | tm_list_set_prev(l, x) (((tm_list*) (l))->_prev._c._bits = ((unsigned long) (x) >> 2)) |
Sets the prev pointer of a tm_list element. | |
#define | tm_list_next(l) ((void*) ((tm_list*) (l))->_next) |
The next element of a tm_list element. | |
#define | tm_list_prev(l) ((void*) ((unsigned long) ((tm_list*) (l))->_prev._word & ~ 0x3UL)) |
The prev element of a tm_list element. | |
#define | tm_list_INIT(N) tm_list _##N = { &_##N, { &_##N } }, *N = &_##N; |
Initialize a static tm_list element as empty and color == 0. | |
#define | tm_list_LOOP(l, x) do { tm_list *__l = (tm_list*) (l), *__x = tm_list_next(__l); while ( (void *) __x != (void *) (l) ) { x = (void*) __x; __x = tm_list_next(__x); { |
Begin a loop on tm_list l, for each element x. | |
#define | tm_list_LOOP_END }}} while(0) |
End a loop. | |
Functions | |
static __inline void | tm_list_init (void *l) |
Initialize a tm_list element as empty and color == 0;. | |
static __inline int | tm_list_empty (void *l) |
Returns true if a tm_list element is empty. | |
static __inline void * | tm_list_first (void *l) |
Returns the first element of a tm_list element. | |
static __inline void * | tm_list_last (void *l) |
Returns the last element of a tm_list element. | |
static __inline void | tm_list_remove (void *_p) |
Removes a tm_list element from its list. | |
static __inline void | tm_list_insert (void *l, void *p) |
Inserts tm_list element p at front of tm_list l. | |
static __inline void | tm_list_append (void *l, void *p) |
Appends tm_list element p at end of tm_list l. | |
static __inline void | tm_list_append_list (void *l, void *p) |
Appends tm_list p at end of tm_list l. | |
static __inline void | tm_list_remove_and_insert (void *l, void *p) |
Removes tm_list element p and inserts into tm_list l. | |
static __inline void | tm_list_remove_and_append (void *l, void *p) |
Removes tm_list element p and appends into tm_list l. | |
static __inline void * | tm_list_take_first (void *_l) |
Task first element from tm_list l. | |
static __inline void | tm_list_assert_layout () |
Assert tm_list layout. |
#define tm_list_color | ( | l | ) | (((tm_list*) (l))->_prev._c._color) |
The color of a tm_list element.
Definition at line 56 of file list.h.
Referenced by _tm_block_alloc_from_free_list(), _tm_block_reclaim(), _tm_node_init(), tm_node_iterator_next(), and tm_validate_lists().
#define tm_list_INIT | ( | N | ) | tm_list _##N = { &_##N, { &_##N } }, *N = &_##N; |
#define tm_list_LOOP | ( | l, | |||
x | ) | do { tm_list *__l = (tm_list*) (l), *__x = tm_list_next(__l); while ( (void *) __x != (void *) (l) ) { x = (void*) __x; __x = tm_list_next(__x); { |
Begin a loop on tm_list l, for each element x.
Definition at line 225 of file list.h.
Referenced by _tm_block_alloc_from_free_list(), _tm_check_sweep_error(), tm_block_scavenge(), tm_print_block_stats(), tm_print_stats(), and tm_validate_lists().
#define tm_list_LOOP_END }}} while(0) |
End a loop.
Definition at line 227 of file list.h.
Referenced by _tm_block_alloc_from_free_list(), _tm_check_sweep_error(), tm_block_scavenge(), tm_print_block_stats(), tm_print_stats(), and tm_validate_lists().
#define tm_list_next | ( | l | ) | ((void*) ((tm_list*) (l))->_next) |
The next element of a tm_list element.
Definition at line 68 of file list.h.
Referenced by _tm_block_sweep_init(), and tm_node_iterator_next().
#define tm_list_prev | ( | l | ) | ((void*) ((unsigned long) ((tm_list*) (l))->_prev._word & ~ 0x3UL)) |
#define tm_list_set_color | ( | l, | |||
c | ) | (((tm_list*) (l))->_prev._c._color = (c)) |
Sets the color of a tm_list element.
Definition at line 59 of file list.h.
Referenced by _tm_block_free(), _tm_node_init(), _tm_node_set_color(), tm_block_init(), tm_init(), and tm_type_init().
#define tm_list_set_next | ( | l, | |||
x | ) | (((tm_list*) (l))->_next = (x)) |
#define tm_list_set_prev | ( | l, | |||
x | ) | (((tm_list*) (l))->_prev._c._bits = ((unsigned long) (x) >> 2)) |
static __inline void tm_list_append | ( | void * | l, | |
void * | p | |||
) | [static] |
Appends tm_list element p at end of tm_list l.
Definition at line 161 of file list.h.
00162 { 00163 tm_list_insert(tm_list_prev(l), p); 00164 }
static __inline void tm_list_append_list | ( | void * | l, | |
void * | p | |||
) | [static] |
Appends tm_list p at end of tm_list l.
Definition at line 171 of file list.h.
00172 { 00173 if ( ! tm_list_empty(p) ) { 00174 tm_list_set_prev(tm_list_next(p), tm_list_prev(l)); 00175 tm_list_set_next(tm_list_prev(p), l); 00176 tm_list_set_next(tm_list_prev(l), tm_list_next(p)); 00177 tm_list_set_prev(l, tm_list_prev(p)); 00178 } 00179 00180 tm_list_init(p); 00181 }
static __inline void tm_list_assert_layout | ( | ) | [static] |
Assert tm_list layout.
Definition at line 234 of file list.h.
Referenced by tm_init().
00235 { 00236 tm_list_INIT(l); 00237 tm_list_INIT(r); 00238 00239 tm_assert(tm_list_color(l) == 0); 00240 00241 tm_assert_test(sizeof(tm_list*) == sizeof(void*)); 00242 tm_assert_test(sizeof(tm_list*) == sizeof(unsigned long)); 00243 00244 tm_assert_test(tm_list_next(l) == l); 00245 tm_assert_test(tm_list_prev(l) == l); 00246 tm_assert_test(l->_prev._c._bits == ((unsigned long) (l)) >> 2); 00247 tm_assert_test(tm_list_color(l) == 0); 00248 00249 tm_list_set_color(l, 3); 00250 tm_assert_test(tm_list_next(l) == l); 00251 tm_assert_test(tm_list_prev(l) == l); 00252 tm_assert_test(l->_prev._c._bits == ((unsigned long) (l)) >> 2); 00253 tm_assert_test(tm_list_color(l) == 3); 00254 00255 tm_list_set_color(r, 2); 00256 tm_list_insert(l, r); 00257 tm_assert_test(tm_list_next(l) == (void*) r); 00258 tm_assert_test(tm_list_prev(l) == (void*) r); 00259 tm_assert_test(tm_list_next(r) == (void*) l); 00260 tm_assert_test(tm_list_prev(r) == (void*) l); 00261 tm_assert_test(tm_list_color(l) == 3); 00262 tm_assert_test(tm_list_color(r) == 2); 00263 00264 tm_list_remove(r); 00265 tm_assert_test(tm_list_next(l) == (void*) l); 00266 tm_assert_test(tm_list_prev(l) == (void*) l); 00267 tm_assert_test(tm_list_next(r) == (void*) r); 00268 tm_assert_test(tm_list_prev(r) == (void*) r); 00269 tm_assert_test(tm_list_color(l) == 3); 00270 tm_assert_test(tm_list_color(r) == 2); 00271 00272 tm_list_insert(r, l); 00273 tm_assert_test(tm_list_next(l) == (void*) r); 00274 tm_assert_test(tm_list_prev(l) == (void*) r); 00275 tm_assert_test(tm_list_next(r) == (void*) l); 00276 tm_assert_test(tm_list_prev(r) == (void*) l); 00277 tm_assert_test(tm_list_color(l) == 3); 00278 tm_assert_test(tm_list_color(r) == 2); 00279 }
static __inline int tm_list_empty | ( | void * | l | ) | [static] |
Returns true if a tm_list element is empty.
Definition at line 93 of file list.h.
00094 { 00095 return tm_list_next(l) == l; 00096 }
static __inline void* tm_list_first | ( | void * | l | ) | [static] |
Returns the first element of a tm_list element.
Or 0 if tm_list is empty.
Definition at line 104 of file list.h.
Referenced by _tm_node_sweep_some_for_type(), and _tm_type_alloc_node_from_free_list().
00105 { 00106 return tm_list_empty(l) ? 00107 0 : 00108 tm_list_next(l); 00109 }
static __inline void tm_list_init | ( | void * | l | ) | [static] |
Initialize a tm_list element as empty and color == 0;.
l->next = l->prev = l;
Definition at line 82 of file list.h.
Referenced by _tm_node_init(), tm_block_init(), tm_init(), and tm_type_init().
static __inline void tm_list_insert | ( | void * | l, | |
void * | p | |||
) | [static] |
Inserts tm_list element p at front of tm_list l.
Definition at line 147 of file list.h.
Referenced by _tm_type_add_block(), and tm_type_new().
00148 { 00149 tm_list_set_next(p, tm_list_next(l)); 00150 tm_list_set_prev(p, l); 00151 00152 tm_list_set_prev(tm_list_next(l), p); 00153 tm_list_set_next(l, p); 00154 }
static __inline void* tm_list_last | ( | void * | l | ) | [static] |
Returns the last element of a tm_list element.
Or 0 if tm_list is empty.
Definition at line 117 of file list.h.
00118 { 00119 return tm_list_empty(l) ? 00120 0 : 00121 tm_list_prev(l); 00122 }
static __inline void tm_list_remove | ( | void * | _p | ) | [static] |
Removes a tm_list element from its list.
Element is marked empty. Color of element is unchanged.
Definition at line 131 of file list.h.
Referenced by _tm_block_alloc_from_free_list(), _tm_node_delete(), and _tm_type_remove_block().
00132 { 00133 tm_list *p = _p; 00134 00135 tm_list_set_prev((tm_list*) tm_list_next(p), tm_list_prev(p)); 00136 tm_list_set_next((tm_list*) tm_list_prev(p), tm_list_next(p)); 00137 00138 tm_list_set_next(_p, _p); 00139 tm_list_set_prev(_p, _p); 00140 }
static __inline void tm_list_remove_and_append | ( | void * | l, | |
void * | p | |||
) | [static] |
Removes tm_list element p and appends into tm_list l.
Definition at line 199 of file list.h.
Referenced by _tm_block_free(), and tm_node_set_color().
00200 { 00201 tm_list_remove(p); 00202 tm_list_append(l, p); 00203 }
static __inline void tm_list_remove_and_insert | ( | void * | l, | |
void * | p | |||
) | [static] |
Removes tm_list element p and inserts into tm_list l.
Definition at line 188 of file list.h.
00189 { 00190 tm_list_remove(p); 00191 tm_list_insert(l, p); 00192 }
static __inline void* tm_list_take_first | ( | void * | _l | ) | [static] |
Task first element from tm_list l.
Returns 0 if l is empty?
Definition at line 211 of file list.h.
00212 { 00213 tm_list *l = _l; 00214 if ( tm_list_next(l) != l ) { 00215 tm_list *p = tm_list_next(l); 00216 tm_list_remove(p); 00217 return p; 00218 } else { 00219 return 0; 00220 } 00221 }