Comment 1 for bug 744760

Revision history for this message
Matt Giuca (mgiuca) wrote :

Closure templates and the new_closure instruction are implemented. But ast_cfg currently never generates either of them.

Therefore, the remaining work is to have ast_cfg generate a closure template for each partial application, and a corresponding new_closure instruction. Then we can remove parcall, parcall_ctor and parcall_global.

Also needs a review of the typedict code. (Both the whole notion of prepending typedict arguments to closure templates, and also the type dict augmentation of the new_closure instruction.) In particular, in typedict.augment_instr_globalrefs, I am not sure what to do about ArgTypes, which should correspond to the types of the cvars. Do these need to be unified and have type dicts augmented? I wrote some unification code, but didn't commit it, since it currently only does a typecheck (and that isn't the role of typedict):

        % Unify the cvar types with ArgTypes
        ( tables.lookup_function(PT, Name, Func) ->
            ( Func ^ func_cvars = yes(CVars) ->
                CVarTypes = map(func({_,T}) = T, CVars),
                list.foldl_corresponding(...?, CVarTypes, ArgTypes, Varset, _),
            ;
                error("augment_instr_globalrefs: new_closure on non_CT: "
                      ++ Name)
            )
        ;
            error("augment_instr_globalrefs: not a global: " ++ Name)
        ),