Stream: git-wasmtime

Topic: wasmtime / issue #5564 Allow giving `MemFlags` for each o...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 12 2023 at 18:45):

Kixiron opened issue #5564:

Currently functions like FunctionBuilder::emit_small_memory_copy() and FunctionBuilder::emit_small_memory_compare() only allow giving a single MemFlags that (presumably) applies to both pointers when allowing disjoint flags could be beneficial, e.g. in the case where you're copying from a readonly pointer to a non-readonly pointer, or comparisons where only one side is readonly.

Additionally, the normal FunctionBuilder::call_memcmp() and FunctionBuilder::call_memcpy() functions don't take flag arguments which could be beneficial for potentially de-duplicating calls

view this post on Zulip Wasmtime GitHub notifications bot (Jan 12 2023 at 19:05):

bjorn3 commented on issue #5564:

call_memcmp and call_memcpy directly generate a call instruction, so there is nothing to attach the MemFlags too.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 12 2023 at 19:12):

jameysharp commented on issue #5564:

This is a good point! I'd guess aligned could have a significant impact even if it's only set on one operand.

However just last month @bjorn3 proposed to introduce dedicated Cranelift IR instructions for these operations (#5479). I think we'll want to get rid of the corresponding cranelift-frontend functions entirely at that point. Also, off-hand I'm guessing we can't do many of the optimizations that dual mem-flags would enable without first plumbing these operations all the way to the backend.

So I'm going to close this, folding it into that issue as a suggestion that the new instructions should have one MemFlags for each pointer operand.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 12 2023 at 19:12):

jameysharp closed issue #5564:

Currently functions like FunctionBuilder::emit_small_memory_copy() and FunctionBuilder::emit_small_memory_compare() only allow giving a single MemFlags that (presumably) applies to both pointers when allowing disjoint flags could be beneficial, e.g. in the case where you're copying from a readonly pointer to a non-readonly pointer, or comparisons where only one side is readonly.

Additionally, the normal FunctionBuilder::call_memcmp() and FunctionBuilder::call_memcpy() functions don't take flag arguments which could be beneficial for potentially de-duplicating calls


Last updated: Dec 23 2024 at 12:05 UTC