[m-dev.] for review: Aditi [4]

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jul 16 17:20:35 AEST 1998


Hi Simon,

Some of the new pragmas you are supposed to be mutually
exclusive.  Is that checked?  If so, where?

> +type_is_aditi_state(Type) :-
> +        type_to_type_id(Type,
> +                qualified(unqualified("aditi"), "state") - 0, []).

>  :- pred type_is_enumeration(type, module_info).
>  :- mode type_is_enumeration(in, in) is semidet.
> Index: compiler/unused_args.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/unused_args.m,v
> retrieving revision 1.51
> diff -u -t -u -r1.51 unused_args.m
> --- unused_args.m	1998/06/27 08:42:10	1.51
> +++ unused_args.m	1998/06/29 00:46:28
> @@ -963,12 +963,14 @@
>          pred_info_get_markers(PredInfo0, Markers),
>          pred_info_get_goal_type(PredInfo0, GoalType),
>          pred_info_get_class_context(PredInfo0, ClassContext),
> +        pred_info_get_aditi_owner(PredInfo0, Owner),
>          map__init(EmptyProofs),
>                  % *** This will need to be fixed when the condition
>                  %       field of the pred_info becomes used.
>          pred_info_init(PredModule, qualified(PredModule, Name), Arity, Tvars,
>                  ArgTypes, true, Context, ClausesInfo, Status, Markers,
> -                GoalType, PredOrFunc, ClassContext, EmptyProofs, PredInfo1),
> +                GoalType, PredOrFunc, ClassContext, EmptyProofs, Owner,
> +                PredInfo1),
>          pred_info_set_typevarset(PredInfo1, TypeVars, PredInfo).
>  
>  
> @@ -1007,9 +1009,9 @@
>                  proc_call_info::in, proc_call_info::out,
>                  module_info::in, module_info::out) is det.
>  
> - make_imported_unused_args_pred_infos([], ProcCallInfo, ProcCallInfo,
> +make_imported_unused_args_pred_infos([], ProcCallInfo, ProcCallInfo,
>                                  ModuleInfo, ModuleInfo).
> - make_imported_unused_args_pred_infos([OptProc | OptProcs],
> +make_imported_unused_args_pred_infos([OptProc | OptProcs],
>                  ProcCallInfo0, ProcCallInfo, ModuleInfo0, ModuleInfo) :-
>          module_info_unused_arg_info(ModuleInfo0, UnusedArgInfo),
>          map__lookup(UnusedArgInfo, OptProc, UnusedArgs),
> @@ -1485,7 +1487,6 @@
>                  )
>          ;
>                  { WarnedPredIds1 = WarnedPredIds0 }
> -
>          ),
>          output_warnings_and_pragmas(ModuleInfo, UnusedArgInfo,
>                  WriteOptPragmas, DoWarn, Rest, WarnedPredIds1).
> Index: compiler/notes/compiler_design.html
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/notes/compiler_design.html,v
> retrieving revision 1.20
> diff -u -t -u -r1.20 compiler_design.html
> --- compiler_design.html	1998/06/04 17:26:23	1.20
> +++ compiler_design.html	1998/06/25 03:05:11
> @@ -32,12 +32,12 @@
>  stages:
>  
>  <ol>
> -<li> parsing (source files -> HLDS)
> +<li> parsing (source files -> HLDS)

Why?

> -<li> semantic analysis and error checking (HLDS -> annotated HLDS)
> +<li> semantic analysis and error checking (HLDS -> annotated HLDS)

> -<li> high-level transformations (annotated HLDS -> annotated HLDS)
> +<li> high-level transformations (annotated HLDS -> annotated HLDS)

Ditto.

> -<li> low-level optimizations (LLDS -> LLDS)
> -<li> output C code (LLDS -> C)
> +<li> low-level optimizations (LLDS -> LLDS or RL -> RL)
> +<li> output code (LLDS -> C or RL -> bytecode)
>  </ol>
>  
>  <p>
> @@ -452,7 +452,7 @@
>  
>  <li> issue warnings about unused arguments from predicates, and create
>    specialized versions without them (unused_args.m); type_infos are
> -  often unused
> +  often unused.
>  
>  <li> elimination of dead procedures (dead_proc_elim.m). Inlining, higher-order
>    specialization and the elimination of unused args can make procedures dead
> @@ -462,6 +462,14 @@
>  <li> elimination of useless assignments, assignments that merely introduce
>    another name for an already existing variable (excess.m).
>  
> +<li> supplementary magic sets or supplementary context transformation of
> +        Aditi procedures (magic.m, magic_util.m, context.m).
> +  The magic sets or context transformations must be applied to convert the
> +  program to a form for which Aditi-RL bytecode can be generated. These
> +  transformations are defined for predicates whose definitions are in
> +  disjunctive normal form. The module dnf.m translates definitions into DNF,
> +  introducing auxiliary predicates as necessary.

If dnf.m gets executed before those other three modules, then
it should be described (I suggest in a seperate <li> item) before them.

> +<li> rl_dump.m writes the RL type defined in rl.m to <module>.rl_dump.

Doesn't HTML have <var>...</var> or something like that?

> +++ mkinit.c	1998/07/07 02:13:35
> @@ -32,6 +32,12 @@
>  #define MAXLINE         256     /* maximum number of characters per line */
>                                  /* (characters after this limit are ignored) */
>  
> +
> +typedef struct String_List_ {
> +                char *data;
> +                struct String_List_ *next;
> +        } String_List;

s/String_List_/String_List_struct/

> +                for (j = init_strlen; isalnum(line[j]) || line[j] == '_'; j++)

The calls to isalnum() need to cast the argument to unsigned char.
Or (better) replace them with calls to MR_isalnum()
(which you can copy from the Mercury runtime).

> +                output_init_function(line+init_strlen);

s/+/ + /

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list