mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
platforms/nuttx: Add support for custom name sections & configurable heap pool (#407)
Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
c13746c22c
commit
78c525d21c
|
@ -21,6 +21,7 @@ static char **app_argv;
|
||||||
static int
|
static int
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
|
/* clang-format off */
|
||||||
printf("Usage: iwasm [-options] wasm_file [args...]\n");
|
printf("Usage: iwasm [-options] wasm_file [args...]\n");
|
||||||
printf("options:\n");
|
printf("options:\n");
|
||||||
printf(" -f|--function name Specify a function name of the module to run rather\n"
|
printf(" -f|--function name Specify a function name of the module to run rather\n"
|
||||||
|
@ -46,6 +47,7 @@ print_help()
|
||||||
#if WASM_ENABLE_LIB_PTHREAD != 0
|
#if WASM_ENABLE_LIB_PTHREAD != 0
|
||||||
printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n");
|
printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n");
|
||||||
#endif
|
#endif
|
||||||
|
/* clang-format on */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,10 +91,8 @@ validate_env_str(char *env)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_GLOBAL_HEAP_BUF 1
|
#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
|
||||||
|
static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE * BH_KB] = { 0 };
|
||||||
#if USE_GLOBAL_HEAP_BUF != 0
|
|
||||||
static char global_heap_buf[164 * 1024] = { 0 };
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WASM_ENABLE_MULTI_MODULE != 0
|
#if WASM_ENABLE_MULTI_MODULE != 0
|
||||||
|
@ -105,12 +105,13 @@ handle_module_path(const char *module_path)
|
||||||
|
|
||||||
static char *module_search_path = ".";
|
static char *module_search_path = ".";
|
||||||
static bool
|
static bool
|
||||||
module_reader_callback(const char *module_name, uint8 **p_buffer,
|
module_reader_callback(const char *module_name,
|
||||||
|
uint8 **p_buffer,
|
||||||
uint32 *p_size)
|
uint32 *p_size)
|
||||||
{
|
{
|
||||||
const char *format = "%s/%s.wasm";
|
const char *format = "%s/%s.wasm";
|
||||||
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name) +
|
int sz = strlen(module_search_path) + strlen("/") + strlen(module_name)
|
||||||
strlen(".wasm") + 1;
|
+ strlen(".wasm") + 1;
|
||||||
char *wasm_file_name = BH_MALLOC(sz);
|
char *wasm_file_name = BH_MALLOC(sz);
|
||||||
if (!wasm_file_name) {
|
if (!wasm_file_name) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -245,7 +246,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||||
|
|
||||||
#if USE_GLOBAL_HEAP_BUF != 0
|
#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0
|
||||||
init_args.mem_alloc_type = Alloc_With_Pool;
|
init_args.mem_alloc_type = Alloc_With_Pool;
|
||||||
init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
|
init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
|
||||||
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
||||||
|
|
|
@ -113,6 +113,19 @@ else
|
||||||
CFLAGS += -DWASM_DISABLE_HW_BOUND_CHECK=0
|
CFLAGS += -DWASM_DISABLE_HW_BOUND_CHECK=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_INTERPRETERS_WAMR_CUSTOM_NAME_SECTIONS),y)
|
||||||
|
CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=1
|
||||||
|
else
|
||||||
|
CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_INTERPRETERS_WAMR_GLOBAL_HEAP_POOL),y)
|
||||||
|
CFLAGS += -DWASM_ENABLE_GLOBAL_HEAP_POOL=1
|
||||||
|
CFLAGS += -DWASM_GLOBAL_HEAP_SIZE=$(CONFIG_INTERPRETERS_WAMR_GLOBAL_HEAP_POOL_SIZE)
|
||||||
|
else
|
||||||
|
CFLAGS += -DWASM_ENABLE_GLOBAL_HEAP_POOL=0
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS += -DBH_ENABLE_MEMORY_PROFILING=0
|
CFLAGS += -DBH_ENABLE_MEMORY_PROFILING=0
|
||||||
|
|
||||||
CFLAGS += -Wno-strict-prototypes -Wno-shadow -Wno-unused-variable
|
CFLAGS += -Wno-strict-prototypes -Wno-shadow -Wno-unused-variable
|
||||||
|
|
Loading…
Reference in New Issue
Block a user