Stream: git-wasmtime

Topic: wasmtime / PR #6243 Mark loads from `VMCallerCheckedAnyfu...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2023 at 17:37):

alexcrichton opened PR #6243 from alexcrichton:more-readonly to bytecodealliance:main:

This commit marks the loads of *mut VMContext and the callee function pointer as readonly in the context of indirect function calls and additionally calls to imported functions (which are indirect). Once a VMCallerCheckedAnyfunc is initialized it's never modified so it should be valid to mark these as readonly and if called in a loop should be hoistable outside of the loop.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2023 at 17:37):

alexcrichton requested wasmtime-core-reviewers for a review on PR #6243.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2023 at 17:37):

alexcrichton requested jameysharp for a review on PR #6243.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2023 at 18:00):

jameysharp submitted PR review:

Yeah, this makes sense. Nice!

It'd be neat if there were some filetests demonstrating that this actually enables optimizations in some case.

I suspect there is no way to hoist the loads for indirect calls out of loops even with this change. funcref_ptr is the result of a load from a table, which is not read-only (right?), and it's followed by a function call, which we can't prove didn't change the table entry. But it shouldn't hurt to mark these loads as read-only anyway. If nothing else, it should leave more room for scheduling the loads against other work.

I think this should help with direct calls to imported functions, anyway.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 19 2023 at 19:56):

alexcrichton merged PR #6243.


Last updated: Nov 22 2024 at 17:03 UTC