diff --git a/src/c-writer.cc b/src/c-writer.cc index a698cd595..76ff52f91 100644 --- a/src/c-writer.cc +++ b/src/c-writer.cc @@ -3558,6 +3558,9 @@ void CWriter::Write(const ExprList& exprs) { Write(", ", StackVar(num_params - i)); } Write(");", Newline()); + if (IsSingleUnsharedMemory()) { + InstallSegueBase(module_->memories[0], false /* save_old_value */); + } DropTypes(num_params + 1); PushTypes(decl.sig.result_types); if (num_results > 1) { diff --git a/test/wasm2c/check-imports.txt b/test/wasm2c/check-imports.txt index 7870c8859..f162e0663 100644 --- a/test/wasm2c/check-imports.txt +++ b/test/wasm2c/check-imports.txt @@ -869,6 +869,9 @@ u32 w2c_test_f0(w2c_test* instance, u32 var_p0) { u32 var_i0; var_i0 = var_p0; var_i0 = CALL_INDIRECT((*instance->w2c_env_0x5F_indirect_function_table), u32 (*)(void*), w2c_test_t1, var_i0, (*instance->w2c_env_0x5F_indirect_function_table).data[var_i0].module_instance); +#if WASM_RT_USE_SEGUE_FOR_THIS_MODULE + wasm_rt_segue_write_base((*instance->w2c_env_0x5F_linear_memory).data); +#endif FUNC_EPILOGUE; return var_i0; } diff --git a/test/wasm2c/hello.txt b/test/wasm2c/hello.txt index 2e72bf0e8..60d180999 100644 --- a/test/wasm2c/hello.txt +++ b/test/wasm2c/hello.txt @@ -911,6 +911,9 @@ void w2c_test_0x5Fstart_0(w2c_test* instance) { var_i3 = 0u; var_i4 = 0u; var_i0 = CALL_INDIRECT(instance->w2c_T0, u32 (*)(void*, u32, u32, u32, u32), w2c_test_t0, var_i4, instance->w2c_T0.data[var_i4].module_instance, var_i0, var_i1, var_i2, var_i3); +#if WASM_RT_USE_SEGUE_FOR_THIS_MODULE + wasm_rt_segue_write_base(instance->w2c_memory.data); +#endif w2c_wasi__snapshot__preview1_proc_exit(instance->w2c_wasi__snapshot__preview1_instance, var_i0); FUNC_EPILOGUE; }