From d2dc2b3fe9406aefaa10458f36aa2bc09f0ef113 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Thu, 20 Jun 2024 07:21:01 -0700 Subject: [PATCH 1/2] doc: modifies the GC section Signed-off-by: Takeshi Yoneda --- doc/OVERVIEW.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/OVERVIEW.md b/doc/OVERVIEW.md index add6f63..7f97a2f 100644 --- a/doc/OVERVIEW.md +++ b/doc/OVERVIEW.md @@ -462,7 +462,10 @@ Internally, `runtime.GC` is called whenever the heap runs out (see [1](https://tinygo.org/lang-support/#garbage-collection), [2](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/runtime/gc_conservative.go#L218-L239)) in TinyGo. -TinyGo allows us to disable GC, but we cannot do that since internally we need to use maps (implicitly causes allocation) for saving the Virtual Machine's state. Theoretically, we can implement our own GC algorithms tailored for proxy-wasm through `alloc(uintptr)` [interface](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/runtime/gc_none.go#L13) with `-gc=none` option. This is a future TODO. +TinyGo allows us to disable GC, so theoretically, we can implement our own GC algorithms tailored for Proxy-Wasm through `alloc(uintptr)` [interface](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/runtime/gc_none.go#L13) with `-gc=none` option. +For example, create an arena for each context and free the arena when the context is destroyed. However, it is difficult to implement that +since internally we need to use global maps (implicitly causes allocation outside the context scope, globally) for saving the Virtual Machine's state (e.g. context id to context implementation mapping). +So this is not implemented yet, and that is a future TODO. ## `recover` not implemented From 365b41950ba8a48dbfe5f69894eee441f31e06a0 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Thu, 20 Jun 2024 07:24:02 -0700 Subject: [PATCH 2/2] update Signed-off-by: Takeshi Yoneda --- doc/OVERVIEW.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/OVERVIEW.md b/doc/OVERVIEW.md index 7f97a2f..5f7a6a8 100644 --- a/doc/OVERVIEW.md +++ b/doc/OVERVIEW.md @@ -462,7 +462,7 @@ Internally, `runtime.GC` is called whenever the heap runs out (see [1](https://tinygo.org/lang-support/#garbage-collection), [2](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/runtime/gc_conservative.go#L218-L239)) in TinyGo. -TinyGo allows us to disable GC, so theoretically, we can implement our own GC algorithms tailored for Proxy-Wasm through `alloc(uintptr)` [interface](https://github.com/tinygo-org/tinygo/blob/v0.14.1/src/runtime/gc_none.go#L13) with `-gc=none` option. +TinyGo allows us to disable GC, so theoretically, we can implement our own GC algorithms tailored for Proxy-Wasm through with `-gc=custom` and the build tag `-tags=custommalloc`. For example, create an arena for each context and free the arena when the context is destroyed. However, it is difficult to implement that since internally we need to use global maps (implicitly causes allocation outside the context scope, globally) for saving the Virtual Machine's state (e.g. context id to context implementation mapping). So this is not implemented yet, and that is a future TODO.