Skip to content

Commit ffeb1e5

Browse files
committed
feat(mem-alloc): add test visibility and magic constants
Add MEM_ALLOC_API_INTER macro for exposing internal functions in test builds and magic value constants for aligned allocation detection.
1 parent be0226f commit ffeb1e5

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

core/shared/mem-alloc/ems/ems_gc_internal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ extern "C" {
1313
#include "bh_platform.h"
1414
#include "ems_gc.h"
1515

16+
/* Test visibility macro for internal functions */
17+
#ifndef MEM_ALLOC_API_INTER
18+
#ifdef WAMR_BUILD_TEST
19+
#define MEM_ALLOC_API_INTER
20+
#else
21+
#define MEM_ALLOC_API_INTER static
22+
#endif
23+
#endif
24+
1625
/* HMU (heap memory unit) basic block type */
1726
typedef enum hmu_type_enum {
1827
HMU_TYPE_MIN = 0,
@@ -87,6 +96,10 @@ hmu_verify(void *vheap, hmu_t *hmu);
8796
GC_ALIGN_8(HMU_SIZE + OBJ_PREFIX_SIZE + OBJ_SUFFIX_SIZE \
8897
+ (((x) > 8) ? (x) : 8))
8998

99+
/* Magic value for aligned allocation detection */
100+
#define ALIGNED_ALLOC_MAGIC_MASK 0xFFFF0000
101+
#define ALIGNED_ALLOC_MAGIC_VALUE 0xA11C0000
102+
90103
/**
91104
* hmu bit operation
92105
*/

0 commit comments

Comments
 (0)