Support unboxed tuples and sums in GHCi
This MR adds support for unboxed tuples and sums in GHCi.
It consists of roughly the following changes:
- generate bytecode from STG instead of Core (so we can make use of the unarisation step)
- save the types in
Breakpoint
annotations (since STG lacks anexprType
function and GHCi needs to show the type of breakpoints) (this part is the first commits in this MR and also in the separate MR !4589 (closed)) - new bytecode instructions
RETURN_TUPLE
/PUSH_ALTS_TUPLE
for returning and receiving an unboxed tuple (or sum) - new closures
stg_ctoi_t
andstg_ret_t
for converting tuples between the native (object code) calling convention and bytecode calling convention
Limitation:
Due to the way the stack pointer is handled in the native calling convention, we need an "adjustment frame" that depends on the size of the tuple. The MR includes adjustment frames stg_ctoi_t1 .. stg_ctoi_t62
and as such can handle tuples that use up to 62 stack words (in the native calling convention). It's easy to add more when needed, but it requires GHC and the RTS to be recompiled.
A fully general solution might require changing the native calling convention (in particular where Sp
points when returning a tuple)
Edited by Luite Stegeman