Stream: git-wasmtime

Topic: wasmtime / PR #3850 Shrink the size of the anyfunc table ...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 16:19):

alexcrichton opened PR #3850 from smaller-anyfunc-table to main:

This commit shrinks the size of the VMCallerCheckedAnyfunc table
allocated into a VMContext to be the size of the number of "escaped"
functions in a module rather than the number of functions in a module.
Escaped functions include exports, table elements, etc, and are
typically an order of magnitude smaller than the number of functions in
general. This should greatly shrink the VMContext for some modules
which while we aren't necessarily having any problems with that today
shouldn't cause any problems in the future.

The original motivation for this was that this came up during the recent
lazy-table-initialization work and while it no longer has a direct
performance benefit since tables aren't initialized at all on
instantiation it should still improve long-running instances
theoretically with smaller VMContext allocations as well as better
locality between anyfuncs.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 16:56):

alexcrichton updated PR #3850 from smaller-anyfunc-table to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:01):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:01):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:01):

cfallin created PR review comment:

Could we extract a helper (add_func_with_signature or somesuch) since this occurs in three spots and is now a bit repetitive?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:01):

cfallin created PR review comment:

Since anyfunc will always be reserved_value (we assert this just below), can we use that as an indicator here rather than a separate HashSet?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:01):

cfallin edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:15):

alexcrichton updated PR #3850 from smaller-anyfunc-table to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:15):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:15):

alexcrichton created PR review comment:

Oh nice idea!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:21):

sunfishcode submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:21):

sunfishcode submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:21):

sunfishcode created PR review comment:

"Global" in the comment here is a little ambiguous; would it be correct to say "module-wide" instead?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2022 at 17:21):

sunfishcode created PR review comment:

What would you think about adding is_escaping(&self) -> bool and non_escaping() -> Self functions for FunctionType, instead of having is_reserved_value() and reserved_value() calls in lots of places? That'd make code using this more self-explanitory.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 28 2022 at 14:54):

alexcrichton updated PR #3850 from smaller-anyfunc-table to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 28 2022 at 15:28):

alexcrichton updated PR #3850 from smaller-anyfunc-table to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 28 2022 at 15:39):

alexcrichton updated PR #3850 from smaller-anyfunc-table to main.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 28 2022 at 16:11):

alexcrichton merged PR #3850.


Last updated: Nov 22 2024 at 16:03 UTC