Stream: general

Topic: ✔ ask help for emit_veneer.


view this post on Zulip yang yu (Aug 25 2022 at 06:52):

why check if need emit_island on block is finished emiting.
https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/machinst/vcode.rs#L1032
I mean if this should check before every inst is emited.
what is a block is too big exceeds LabelUse::max_pos_range().

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Notification Bot (Aug 25 2022 at 07:10):

yang yu has marked this topic as resolved.

view this post on Zulip yang yu (Aug 25 2022 at 07:10):

why check if need emit_island on block is finished emiting.
https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/machinst/vcode.rs#L1032
I mean if this should check before every inst is emited.
what if a block is too big exceeds LabelUse::max_pos_range().

A fast and secure runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Chris Fallin (Aug 25 2022 at 16:32):

hi @yang yu -- we check at the end of blocks because currently the veneer does not include a jump around itself; so it can only go in places where we would never otherwise "fall into" the execution

view this post on Zulip Chris Fallin (Aug 25 2022 at 16:32):

the emission code computes a "worst-case size" for the following block and ensures that it emits an island if emitting the block would otherwise go past the deadline

view this post on Zulip yang yu (Aug 26 2022 at 05:07):

@Chris Fallin do you means current block can't be too big to cause exceeds max size?
so check at the end maybe better for performance?

view this post on Zulip Chris Fallin (Aug 26 2022 at 05:12):

@yang yu yes, the emit logic computes the maximum size a block could be, ahead of time: it knows how many instructions, and it knows the maximum size of a single instruction (it's a method on MachInst). It checks between blocks whether the next block is too big, and would make some branches out of range. If so, it emits the island between the blocks

view this post on Zulip Chris Fallin (Aug 26 2022 at 05:13):

the simpler way would be to check before every instruction, as you said; but the downside then is that the island has to have a jump around it, and could come in the middle of a hot loop, for example

view this post on Zulip Chris Fallin (Aug 26 2022 at 05:13):

it's better to put it between basic blocks, because then it's more likely we won't have to jump around it (more often than the program would otherwise jump)

view this post on Zulip yang yu (Aug 26 2022 at 05:27):

@Chris Fallin ok,thanks.

view this post on Zulip Notification Bot (Aug 26 2022 at 05:27):

yang yu has marked this topic as unresolved.

view this post on Zulip Notification Bot (Aug 30 2022 at 07:30):

yang yu has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC