[m-rev.] for post-commit review: tprop_cache

Julien Fischer jfischer at opturion.com
Tue May 30 16:22:26 AEST 2023


On Tue, 30 May 2023, Zoltan Somogyi wrote:

> Propagate a type into a user inst_name just once.
> 
> compiler/inst_mode_type_prop.m:
>     Define a data structure, the tprop_cache, that records whether
>     we have already propagated a type into a user defined inst name.
>
>     Thread this data structure through all the code that propagates
>     types into insts, and use it to propagate a type into a user inst name
>     (which consists of doing a bunch of checks, and generating errors
>     if those checks fail) only if have not done it before. For the
>     valid/inst_perf_bug_2.m test case, this reduces the number of checks
>     from more than 16 million to just 12. On my laptop, this reduces
>     the compilation time from more than 13 seconds to just above one second.
>
>     Call check_user_inst_args, the new version of maybe_check_user_inst_args,
>     as part of do_check_for_bad_use_of_user_inst. maybe_check_user_inst_args
>     only ever did anything if do_check_for_bad_use_of_user_inst gave it
>     the data it needed, but the communication between the two predicates
>     was bad. The two calls to maybe_check_user_inst_args invoked it under
>     seemingly different conditions, but the conditions were actually identical,
>     because they would have differed only if the inst name being worked was
>     was both a user inst (tested in do_check_for_bad_use_of_user_inst) and
>     a typed inst (test in its caller).
> 
> compiler/post_typecheck.m:
>     Thread the tprop_cache through this module as well, since it is
>     this module that invokes inst_mode_type_prop.m to do its job.
> 
> compiler/add_special_pred.m:
>     Conform to the changes above.

That's fine.

Julien.


More information about the reviews mailing list