Compiler may emit PUSH_L instructions which crosses stack chunk boundary
While attempting to build Cabal
with GHC loaded via optimised Core in GHCi, @mpickering encountered a segfault, typically in Word64Map
.
The problem appears to be that bytecode compiler will freely produce PUSH_L
instructions which reference free variables of parent BCOs. However, this introduces the possibility that we will refer to a stack frame living in a previous stack chunk. This possibility is not accounted for by the interpreter. Instead we just happily look beyond the end of the stack.