-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improve wasm calli thunk lookup #120199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve wasm calli thunk lookup #120199
Conversation
Put the thunks into hash table, this will also serve later for the generated thunk lookups Add CallFunc_F64_RetF64
Tagging subscribers to this area: @mangod9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the WASM calli thunk lookup system to improve performance and maintainability by replacing array-based lookups with a hash table implementation. It also adds support for new data types in WASM function signatures.
- Replaces direct array indexing with a hash table for thunk lookups to improve performance and scalability
- Adds support for F64 (double) type conversions and a new
CallFunc_F64_RetF64
thunk function - Expands type conversion support to include I8, U8, I64, F32, and F64 element types
Does Mono build the hashtable of the thunks during startup, or is the hashtable pre-built at build time? We may want the latter, especially for AOT. |
mono currently uses binary search in static table
I think we can improve it gradually? I remember you told me that part of runtime already does something similar, we didn't talk about the details though. We can use perfect hash or just precompute the hash values for the signature string keys. Or do you have another idea? |
This is android for pinvoke by symbol name. They pre-build the hash table. |
This is sorted table with precalculated keys. I think they use binary search for lookup. That is similar to what mono does now for interpreter to native. |
I think for AOT it would make sense to use actual precalculated hash table, for interp only it will depend on the size, but I don't expect it to be too large. I think we don't need it now though, that's why I used the existing SHash and runtime initialization. |
Co-authored-by: Aaron Robinson <[email protected]>
Put the thunks into hash table, this will also serve later for the generated thunk lookups
Add CallFunc_F64_RetF64