diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-04-08 03:46:48 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-04-08 03:46:48 (GMT) |
commit | 13ca97618db62034fa78b8d87f7160cb2a1f4bfc (patch) | |
tree | 08409d4a9670de57059d50e7dc4790d7d88ded43 /src/H5FLprivate.h | |
parent | d4ab501d637389fc8f6dbae8ab12c6e032b19dfd (diff) | |
download | hdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.zip hdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.tar.gz hdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.tar.bz2 |
[svn-r10580] Purpose:
Code optimization
Description:
Add "base" size to array free list code, to accomodate skip list nodes.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Solaris 2.9 (shanti)
Diffstat (limited to 'src/H5FLprivate.h')
-rw-r--r-- | src/H5FLprivate.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 88c179b..ba26146 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -201,7 +201,8 @@ typedef struct H5FL_arr_head_t { size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ int maxelem; /* Maximum number of elements in an array */ - size_t size; /* Size of the array elements in the list */ + size_t base_size; /* Size of the "base" object in the list */ + size_t elem_size; /* Size of the array elements in the list */ H5FL_arr_node_t *list_arr; /* Array of lists of free blocks */ } H5FL_arr_head_t; @@ -211,16 +212,22 @@ typedef struct H5FL_arr_head_t { #define H5FL_ARR_NAME(t) H5_##t##_arr_free_list #ifndef H5_NO_ARR_FREE_LISTS /* Common macro for H5FL_BLK_DEFINE & H5FL_BLK_DEFINE_STATIC */ -#define H5FL_ARR_DEFINE_COMMON(t,m) H5FL_arr_head_t H5FL_ARR_NAME(t)={0,0,0,#t"_arr",m+1,sizeof(t),NULL} +#define H5FL_ARR_DEFINE_COMMON(b,t,m) H5FL_arr_head_t H5FL_ARR_NAME(t)={0,0,0,#t"_arr",m+1,b,sizeof(t),NULL} /* Declare a free list to manage arrays of type 't' */ -#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) +#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(0,t,m) + +/* Declare a free list to manage base 'b' + arrays of type 't' */ +#define H5FL_BARR_DEFINE(b,t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(sizeof(b),t,m) /* Reference a free list for arrays of type 't' defined in another file */ #define H5FL_ARR_EXTERN(t) extern H5_DLL H5FL_arr_head_t H5FL_ARR_NAME(t) /* Declare a static free list to manage arrays of type 't' */ -#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m) +#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(0,t,m) + +/* Declare a static free list to manage base 'b' + arrays of type 't' */ +#define H5FL_BARR_DEFINE_STATIC(b,t,m) static H5FL_ARR_DEFINE_COMMON(sizeof(b),t,m) /* Allocate an array of type 't' */ #define H5FL_ARR_MALLOC(t,elem) H5FL_arr_malloc(&(H5FL_ARR_NAME(t)),elem) @@ -236,15 +243,17 @@ typedef struct H5FL_arr_head_t { #else /* H5_NO_ARR_FREE_LISTS */ /* Common macro for H5FL_ARR_DEFINE & H5FL_ARR_DEFINE_STATIC */ -#define H5FL_ARR_DEFINE_COMMON(t,m) int H5FL_ARR_NAME(t) - -#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) -#define H5FL_ARR_EXTERN(t) extern H5_DLL int H5FL_ARR_NAME(t) -#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m) -#define H5FL_ARR_MALLOC(t,elem) H5MM_malloc((elem)*sizeof(t)) -#define H5FL_ARR_CALLOC(t,elem) H5MM_calloc((elem)*sizeof(t)) +#define H5FL_ARR_DEFINE_COMMON(t,m) size_t H5FL_ARR_NAME(t) + +#define H5FL_ARR_DEFINE(t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) = 0 +#define H5FL_BARR_DEFINE(b,t,m) H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) = sizeof(b) +#define H5FL_ARR_EXTERN(t) extern H5_DLL H5FL_ARR_DEFINE_COMMON(t,m) +#define H5FL_ARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m) = 0 +#define H5FL_BARR_DEFINE_STATIC(t,m) static H5FL_ARR_DEFINE_COMMON(t,m) = sizeof(b) +#define H5FL_ARR_MALLOC(t,elem) H5MM_malloc(H5FL_ARR_NAME(t) + ((elem)*sizeof(t))) +#define H5FL_ARR_CALLOC(t,elem) H5MM_calloc(H5FL_ARR_NAME(t) + ((elem)*sizeof(t))) #define H5FL_ARR_FREE(t,obj) H5MM_xfree(obj) -#define H5FL_ARR_REALLOC(t,obj,new_elem) H5MM_realloc(obj,(new_elem)*sizeof(t)) +#define H5FL_ARR_REALLOC(t,obj,new_elem) H5MM_realloc(obj,H5FL_ARR_NAME(t) + ((new_elem)*sizeof(t))) #endif /* H5_NO_ARR_FREE_LISTS */ /* Data structure for free list of sequence blocks */ |