[wasm-shape] Use JIT running-modes if available

Build wasm-micro-runtime with:

$ cmake . -DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1

or:

$ cmake . -DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1

The latter needs llvm and is harder to get working. Still trying.
This commit is contained in:
Behdad Esfahbod 2023-02-24 15:20:37 -07:00
parent 8d960dfe68
commit aa8f9eed63
1 changed files with 6 additions and 1 deletions

View File

@ -55,6 +55,11 @@ init_wasm ()
RuntimeInitArgs init_args;
memset (&init_args, 0, sizeof (RuntimeInitArgs));
if (wasm_runtime_is_running_mode_supported (Mode_LLVM_JIT))
init_args.running_mode = Mode_LLVM_JIT;
else if (wasm_runtime_is_running_mode_supported (Mode_Fast_JIT))
init_args.running_mode = Mode_Fast_JIT;
init_args.mem_alloc_type = Alloc_With_Allocator;
init_args.mem_alloc_option.allocator.malloc_func = (void *) hb_malloc;
init_args.mem_alloc_option.allocator.realloc_func = (void *) hb_realloc;
@ -157,7 +162,7 @@ _hb_wasm_shape (hb_shape_plan_t *shape_plan,
{
bool ret = true;
const hb_wasm_face_data_t *face_data = font->face->data.wasm;
constexpr uint32_t stack_size = 8092, heap_size = 2 * 1024 * 1024;
constexpr uint32_t stack_size = 32 * 1024, heap_size = 2 * 1024 * 1024;
wasm_module_inst_t module_inst = nullptr;
wasm_exec_env_t exec_env = nullptr;