Description
During codegen, we try to calculate the instruction size to get an idea of how much memory is needed to store the machine code. Next we allocate the memory from runtime and then output the instructions in the memory. In some situation, we mispredict (overestimate) the size of instruction and during outputting, we end up outputting an instruction of smaller size. The root of the problem is because there are two separate code paths that estimate (emitIns*
methods) and output (emitOut*
methods) instruction. We should unify this code so we know accurate instruction size and hence reduce memory wastage and speedup the throughput by not going through estimate and then outputting phase separately.
Relevant discussion in #12840, #57041, #12178, #8748 (comment)
category:design
theme:intrinsics
skill-level:expert
cost:large
impact:medium