'Emit an array of env_def_t structures (see modulemixin.c)
storing the pickled environment constants for each of the
exported functions.'

def _emit_environment_array(self, llvm_module, builder, pyapi):

    env_defs = []
    for entry in self.export_entries:
        env = self.function_environments[entry]
        env_def = pyapi.serialize_uncached(env.consts)
        env_defs.append(env_def)
    env_defs_init = lc.Constant.array(self.env_def_ty, env_defs)
    gv = self.context.insert_unique_const(llvm_module, '.module_environments', env_defs_init)
    return gv.gep([ZERO, ZERO])
