Pushing on the `val_stack` vector is CL's biggest source of calls to malloc/realloc/free, by some margin. It accounts for about 27.7% of all heap blocks allocated when compiling wasm_lua_binarytrees. This change removes pretty much all dynamic allocation by changing to a SmallVec<[Value; 8]> instead. A fixed size of 4 gets all the gains to be had, in testing, so 8 gives some safety margin and is harmless from a stack-use perspective: 8 Values will occupy 32 bytes. As a bonus, this change also reduces the compiler's dynamic instruction count by about 0.5%.
This crate contains the core Cranelift code generator. It translates code from an intermediate representation into executable machine code.