alexcrichton opened PR #3850 from smaller-anyfunc-table
to main
:
This commit shrinks the size of the
VMCallerCheckedAnyfunc
table
allocated into aVMContext
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 theVMContext
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 smallerVMContext
allocations as well as better
locality between anyfuncs.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
alexcrichton updated PR #3850 from smaller-anyfunc-table
to main
.
cfallin submitted PR review.
cfallin submitted PR review.
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?
cfallin created PR review comment:
Since
anyfunc
will always bereserved_value
(we assert this just below), can we use that as an indicator here rather than a separateHashSet
?
cfallin edited PR review comment.
alexcrichton updated PR #3850 from smaller-anyfunc-table
to main
.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Oh nice idea!
sunfishcode submitted PR review.
sunfishcode submitted PR review.
sunfishcode created PR review comment:
"Global" in the comment here is a little ambiguous; would it be correct to say "module-wide" instead?
sunfishcode created PR review comment:
What would you think about adding
is_escaping(&self) -> bool
andnon_escaping() -> Self
functions forFunctionType
, instead of havingis_reserved_value()
andreserved_value()
calls in lots of places? That'd make code using this more self-explanitory.
alexcrichton updated PR #3850 from smaller-anyfunc-table
to main
.
alexcrichton updated PR #3850 from smaller-anyfunc-table
to main
.
alexcrichton updated PR #3850 from smaller-anyfunc-table
to main
.
alexcrichton merged PR #3850.
Last updated: Nov 22 2024 at 16:03 UTC