[wasm-shape] Print module instantiation error

This commit is contained in:
Behdad Esfahbod 2023-02-26 12:18:31 -07:00
parent 7e397d8695
commit 142ceaf246
1 changed files with 6 additions and 4 deletions

View File

@ -133,6 +133,8 @@ static hb_wasm_shape_plan_t *
acquire_shape_plan (hb_face_t *face, acquire_shape_plan (hb_face_t *face,
const hb_wasm_face_data_t *face_data) const hb_wasm_face_data_t *face_data)
{ {
char error[128];
/* Fetch cached one if available. */ /* Fetch cached one if available. */
hb_wasm_shape_plan_t *plan = face_data->plan.get_acquire (); hb_wasm_shape_plan_t *plan = face_data->plan.get_acquire ();
if (likely (plan && face_data->plan.cmpexch (plan, nullptr))) if (likely (plan && face_data->plan.cmpexch (plan, nullptr)))
@ -146,12 +148,12 @@ acquire_shape_plan (hb_face_t *face,
constexpr uint32_t stack_size = 32 * 1024, heap_size = 2 * 1024 * 1024; constexpr uint32_t stack_size = 32 * 1024, heap_size = 2 * 1024 * 1024;
module_inst = plan->module_inst = wasm_runtime_instantiate(face_data->wasm_module, module_inst = plan->module_inst = wasm_runtime_instantiate (face_data->wasm_module,
stack_size, heap_size, stack_size, heap_size,
nullptr, 0); error, sizeof (error));
if (unlikely (!module_inst)) if (unlikely (!module_inst))
{ {
DEBUG_MSG (WASM, face_data, "Create wasm module instance failed."); DEBUG_MSG (WASM, face_data, "Create wasm module instance failed: %s", error);
goto fail; goto fail;
} }