Stream: git-wasmtime

Topic: wasmtime / Issue #2824 Cranelift: Rework or remove the Co...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2021 at 12:07):

bjorn3 opened Issue #2824:

The old backends used the CodeSink to emit instruction bytes and relocations as they were being generated. The machinst backends store everything in a MachBuffer before finally emitting the compiled code one byte at a time to the CodeSink. Unlike a plain memcpy this is not easily vectorizable. In addition there are a lot of branches to check if the current instruction has a relocation, can trap or is a call site.

I propose that either the CodeSink interface is removed in favor of giving the embedder direct access to the MachBufferFinalized or the CodeSink interface will get a put_bytes function that allows copying all bytes at the same time in combination with explicit offsets for the reloc_external, trap and add_call_site methods.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 12 2021 at 18:37):

cfallin commented on Issue #2824:

Yes, agreed, this would be great!

We're somewhat constrained until we eventually remove the old backend infrastructure (which is on my TODO list but not my very highest priority at the moment). Once that happens, I think we'll want to look over the codegen-crate interfaces generally to see if there are any other possible efficiency improvements like this one.


Last updated: Dec 23 2024 at 12:05 UTC