-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement lazy VMCallerCheckedAnyfunc initialization.
Currently, in the instance initialization path, we build an "anyfunc" for every imported function and every function in the module. These anyfuncs are used as function references in tables, both within a module and across modules (via function imports). Building all of these is quite wasteful if we never use most of them. Instead, it would be better to build only the ones that we use. This commit implements a technique to lazily initialize them: at the point that a pointer to an anyfunc is taken, we check whether it has actually been initialized. If it hasn't, we do so. We track whether an anyfunc has been initialized with a separate bitmap, and we only need to zero this bitmap at instantiation time. (This is important for performance too: even just zeroing a large array of anyfunc structs can be expensive, at the microsecond scale, for a module with thousands of functions.) Keeping the information around that is needed for this lazy init required a bit of refactoring in the InstanceAllocationRequest; a few fields now live in an `Arc` held by the instance while it exists.
- Loading branch information
Showing
20 changed files
with
278 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.