summaryrefslogtreecommitdiffstats
path: root/src/H5VM.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5VM.c')
-rw-r--r--src/H5VM.c92
1 files changed, 28 insertions, 64 deletions
diff --git a/src/H5VM.c b/src/H5VM.c
index 452d378..7be8eab 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -12,13 +12,14 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 10, 1997
*/
#include "H5private.h"
#include "H5Eprivate.h"
+#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h"
#include "H5VMprivate.h"
@@ -33,21 +34,21 @@ typedef struct H5VM_memcpy_ud_t {
/* Local prototypes */
static void
-H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+H5VM__stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
const hsize_t *size, hsize_t *stride1);
static void
-H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+H5VM__stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
const hsize_t *size, hsize_t *stride1, hsize_t *stride2);
#ifdef LATER
static void
-H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
+H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size,
unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst,
unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src);
#endif /* LATER */
/*-------------------------------------------------------------------------
- * Function: H5VM_stride_optimize1
+ * Function: H5VM__stride_optimize1
*
* Purpose: Given a stride vector which references elements of the
* specified size, optimize the dimensionality, the stride
@@ -62,15 +63,13 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+H5VM__stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
const hsize_t *size, hsize_t *stride1)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/*
* This has to be true because if we optimize the dimensionality down to
@@ -93,7 +92,7 @@ H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
/*-------------------------------------------------------------------------
- * Function: H5VM_stride_optimize2
+ * Function: H5VM__stride_optimize2
*
* Purpose: Given two stride vectors which reference elements of the
* specified size, optimize the dimensionality, the stride
@@ -108,18 +107,13 @@ H5VM_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
+H5VM__stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
const hsize_t *size, hsize_t *stride1, hsize_t *stride2)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/*
* This has to be true because if we optimize the dimensionality down to
@@ -246,11 +240,6 @@ H5VM_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -349,8 +338,6 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size,
* Programmer: Robb Matzke
* Friday, October 17, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -400,8 +387,6 @@ done:
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -438,7 +423,7 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size,
/* Compute an optimal destination stride vector */
dst_start = H5VM_hyper_stride(n, size, total_size, offset, dst_stride);
- H5VM_stride_optimize1(&n, &elmt_size, size, dst_stride);
+ H5VM__stride_optimize1(&n, &elmt_size, size, dst_stride);
/* Copy */
ret_value = H5VM_stride_fill(n, elmt_size, size, dst_stride, dst+dst_start,
@@ -475,11 +460,6 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size,
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- * Unrolled loops for common cases
- * Quincey Koziol
- * ?, ? ?, 2001?
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -623,7 +603,7 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size,
#endif /* NO_INLINED_CODE */
/* Optimize the strides as a pair */
- H5VM_stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride);
+ H5VM__stride_optimize2(&n, &elmt_size, size, dst_stride, src_stride);
/* Perform the copy in terms of stride */
ret_value = H5VM_stride_copy(n, elmt_size, size,
@@ -644,8 +624,6 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -704,8 +682,6 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -732,7 +708,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -749,7 +725,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -773,8 +749,6 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -801,7 +775,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -818,7 +792,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
}
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
}
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -827,7 +801,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
#ifdef LATER
/*-------------------------------------------------------------------------
- * Function: H5VM_stride_copy2
+ * Function: H5VM__stride_copy2
*
* Purpose: Similar to H5VM_stride_copy() except the source and
* destination each have their own dimensionality and size and
@@ -839,12 +813,10 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
-H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
+H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* destination */
unsigned dst_n, const hsize_t *dst_size,
@@ -864,7 +836,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
int j; /* Local index variable */
hbool_t carry;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDassert(elmt_size < SIZET_MAX);
HDassert(dst_n>0);
@@ -877,7 +849,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
/* Copy an element */
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
- HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
+ H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */
/* Decrement indices and advance pointers */
for (j=(int)(dst_n-1), carry=TRUE; j>=0 && carry; --j) {
@@ -917,8 +889,6 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
* Programmer: Quincey Koziol
* Thursday, June 18, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -936,7 +906,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
HDassert(size < SIZET_MAX && size > 0);
HDassert(count < SIZET_MAX && count > 0);
- HDmemcpy(dst, src, size); /* copy first item */
+ H5MM_memcpy(dst, src, size); /* copy first item */
/* Initialize counters, etc. while compensating for first element copied */
copy_size = size;
@@ -947,7 +917,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
/* copy until we've copied at least half of the items */
while (items_left >= copy_items)
{
- HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */
+ H5MM_memcpy(dst, _dst, copy_size); /* copy the current chunk */
dst += copy_size; /* move the offset for the next chunk */
items_left -= copy_items; /* decrement the number of items left */
@@ -955,7 +925,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
copy_items *= 2; /* increase the count of items we are copying */
} /* end while */
if (items_left > 0) /* if there are any items left to copy */
- HDmemcpy(dst, _dst, items_left * size);
+ H5MM_memcpy(dst, _dst, items_left * size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5VM_array_fill() */
@@ -974,8 +944,6 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
* Programmer: Quincey Koziol
* Monday, April 28, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1055,8 +1023,6 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
* Programmer: Quincey Koziol
* Tuesday, June 22, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -1139,8 +1105,6 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down,
* Programmer: Quincey Koziol
* Wednesday, April 16, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1226,7 +1190,7 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk,
/* Defer to H5VM_chunk_index_scaled */
chunk_idx = H5VM_chunk_index_scaled(ndims, coord, chunk, down_nchunks, scaled_coord);
-
+
FUNC_LEAVE_NOAPI(chunk_idx)
} /* end H5VM_chunk_index() */
@@ -1623,7 +1587,7 @@ src_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_src_len);
+ H5MM_memcpy(dst, src, tmp_src_len);
/* Accumulate number of bytes copied */
acc_len += tmp_src_len;
@@ -1666,7 +1630,7 @@ dst_smaller:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;
@@ -1709,7 +1673,7 @@ equal:
acc_len = 0;
do {
/* Copy data */
- HDmemcpy(dst, src, tmp_dst_len);
+ H5MM_memcpy(dst, src, tmp_dst_len);
/* Accumulate number of bytes copied */
acc_len += tmp_dst_len;