This introduces wasm.CallEngine internal type, and assign it to the api.Function implementations. api.Function.Call now uses that CallEngine assigned to it to make function calls. Internally, when creating CallEngine implementation, the compiler engine allocates call frames and values stack. Previously, we allocate these stacks for each function calls, which was a severe overhead as we can recognize in the benchmarks. As a result, this reduces the memory usage (== reduces the GC jobs) as long as we reuse the same api.Function multiple times. As a side effect, now api.Function.Call is not goroutine-safe. So this adds the comment about it on that method. Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
19 KiB
19 KiB