Maintenance and merging of Valgrind and Valgrind-Freya code paths (#2362)
None of the code paths have been tested for long and especially the Freya code paths have been long abandoned. This patch: - Merges Valgrind-Freya into Valgrind code path (there should be no need to choose between them, Valgrind should work just fine). - Removes leftover code (`VALGRIND_FREYA_CHECK_MEMPOOL_REQUEST` and `valgrind_freya_mempool_request`). - Adds `JMEM_` prefix to Valgrind-related macros (to correctly leave the `VALGRIND_` prefix to Valgrind). - Moves the definition of the Valgrind-related macros to a common header to avoid duplication. Note: Adding a CI job to perform Valgrind Memchecks is left for follow-up as it turns out to be excessively slow (>50 mins for a `--jerry-tests --jerry-test-suite` run, and even a simple `--jerry-tests` may get terminated prematurely because of timeout issues). JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -31,33 +31,6 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @{
|
||||
* Valgrind-related options and headers
|
||||
*/
|
||||
#ifdef JERRY_VALGRIND
|
||||
# include "memcheck.h"
|
||||
|
||||
# define VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS((p), (s))
|
||||
# define VALGRIND_UNDEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_UNDEFINED((p), (s))
|
||||
# define VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED((p), (s))
|
||||
#else /* !JERRY_VALGRIND */
|
||||
# define VALGRIND_NOACCESS_SPACE(p, s)
|
||||
# define VALGRIND_UNDEFINED_SPACE(p, s)
|
||||
# define VALGRIND_DEFINED_SPACE(p, s)
|
||||
#endif /* JERRY_VALGRIND */
|
||||
|
||||
#ifdef JERRY_VALGRIND_FREYA
|
||||
# include "memcheck.h"
|
||||
|
||||
# define VALGRIND_FREYA_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK((p), (s), 0, 0)
|
||||
# define VALGRIND_FREYA_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK((p), 0)
|
||||
#else /* !JERRY_VALGRIND_FREYA */
|
||||
# define VALGRIND_FREYA_MALLOCLIKE_SPACE(p, s)
|
||||
# define VALGRIND_FREYA_FREELIKE_SPACE(p)
|
||||
#endif /* JERRY_VALGRIND_FREYA */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Finalize pool manager
|
||||
*/
|
||||
@@ -96,11 +69,11 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
|
||||
{
|
||||
const jmem_pools_chunk_t *const chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
|
||||
|
||||
VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_p->next_p;
|
||||
|
||||
VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
return (void *) chunk_p;
|
||||
}
|
||||
@@ -118,11 +91,11 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
|
||||
{
|
||||
const jmem_pools_chunk_t *const chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
|
||||
|
||||
VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_p->next_p;
|
||||
|
||||
VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
return (void *) chunk_p;
|
||||
}
|
||||
@@ -144,7 +117,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
|
||||
|
||||
jmem_pools_chunk_t *const chunk_to_free_p = (jmem_pools_chunk_t *) chunk_p;
|
||||
|
||||
VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);
|
||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);
|
||||
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
if (size <= 8)
|
||||
@@ -167,7 +140,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
|
||||
}
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
|
||||
VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);
|
||||
JMEM_VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);
|
||||
} /* jmem_pools_free */
|
||||
|
||||
/**
|
||||
@@ -181,9 +154,9 @@ jmem_pools_collect_empty (void)
|
||||
|
||||
while (chunk_p)
|
||||
{
|
||||
VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
jmem_pools_chunk_t *const next_p = chunk_p->next_p;
|
||||
VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
jmem_heap_free_block (chunk_p, 8);
|
||||
chunk_p = next_p;
|
||||
@@ -195,9 +168,9 @@ jmem_pools_collect_empty (void)
|
||||
|
||||
while (chunk_p)
|
||||
{
|
||||
VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
jmem_pools_chunk_t *const next_p = chunk_p->next_p;
|
||||
VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
JMEM_VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));
|
||||
|
||||
jmem_heap_free_block (chunk_p, 16);
|
||||
chunk_p = next_p;
|
||||
@@ -205,12 +178,6 @@ jmem_pools_collect_empty (void)
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
} /* jmem_pools_collect_empty */
|
||||
|
||||
#undef VALGRIND_NOACCESS_SPACE
|
||||
#undef VALGRIND_UNDEFINED_SPACE
|
||||
#undef VALGRIND_DEFINED_SPACE
|
||||
#undef VALGRIND_FREYA_MALLOCLIKE_SPACE
|
||||
#undef VALGRIND_FREYA_FREELIKE_SPACE
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user