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()
.
yang yu has marked this topic as resolved.
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().
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
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
@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?
@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
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
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)
@Chris Fallin ok,thanks.
yang yu has marked this topic as unresolved.
yang yu has marked this topic as resolved.
Last updated: Dec 23 2024 at 12:05 UTC