mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
example/wasm: remove allocator selection
add comment refering to the wasm header instead
This commit is contained in:
parent
fc1f44a28a
commit
3400819fbd
@ -73,29 +73,11 @@ int iwasm_bytecode_exec_main(uint8_t *bytecode, size_t bytecode_len, int argc, c
|
|||||||
bool iwasm_runtime_init(void)
|
bool iwasm_runtime_init(void)
|
||||||
{
|
{
|
||||||
RuntimeInitArgs init_args;
|
RuntimeInitArgs init_args;
|
||||||
/* chose allocator non defaults to system allocator */
|
|
||||||
#define FUNC_ALLOC
|
|
||||||
// #define POOL_ALLOC
|
|
||||||
|
|
||||||
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||||
#ifdef POOL_ALLOC
|
/* using default system allocator, pool allocator and
|
||||||
static char global_heap_buf[256 * 1024] = { 0 };//(256 kB)
|
* and allocator function hooks are available
|
||||||
|
* see <wamr>/core/iwasm/include/wasm_export.h l99..*/
|
||||||
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_size = sizeof(global_heap_buf);
|
|
||||||
#elif defined(FUNC_ALLOC)
|
|
||||||
init_args.mem_alloc_type = Alloc_With_Allocator;
|
|
||||||
/*deactivate Wpedantic for some lines*/
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
||||||
init_args.mem_alloc_option.allocator.malloc_func = malloc;
|
|
||||||
init_args.mem_alloc_option.allocator.realloc_func = realloc;
|
|
||||||
init_args.mem_alloc_option.allocator.free_func = free;
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#else
|
|
||||||
init_args.mem_alloc_type = Alloc_With_System_Allocator;
|
init_args.mem_alloc_type = Alloc_With_System_Allocator;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* initialize runtime environment */
|
/* initialize runtime environment */
|
||||||
if (!wasm_runtime_full_init(&init_args)) {
|
if (!wasm_runtime_full_init(&init_args)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user