[m-rev.] for post-commit review: last call modulo constructor for hlc.gc

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Oct 17 17:59:19 AEST 2005


On Mon, 17 Oct 2005, Zoltan Somogyi wrote:

> Implement --optimize-constructor-last-call for hlc grades.
>
> compiler/lco.m:
> 	Include the types of pointed-to fields in the types of the address-of
> 	variables generated by the transformation, since the HLC backend needs
> 	it.
>
> library/private_builtin.m:
> 	Add a new type, store_at_ref_type, for use by the new version of the
> 	transformation in lco.m.
>
> compiler/ml_call_gen.m:
> 	Handle the form of builtin used by store_at_ref.
>
> compiler/ml_unify_gen.m:
> 	Handle construction unifications that take the addresses of some
> 	fields.
>
> compiler/ml_closure_gen.m:
> 	Conform to the change in ml_unify_gen.m.
>
> compiler/handle_options.m:
> 	Do not disable --optimize-constructor-last-call in hlc grades.
>
> compiler/add_pred.m:
> 	When creating the implementation of the store_at_ref builtin,
> 	don't make the body of the predicate be an invocation of the builtin
> 	itself, since the generated HLC code is not type-correct C. Instead,
> 	make it "true". Since the predicate itself (as distinct from the
> 	builtin operation) is never used, this is OK.
>
> 	Minor cleanups.
>
> compiler/mlds_to_c.m:
> 	Make the generated C code somewhat easier to read.
>
> 	Convert to four-space indentation.
>
> compiler/options.m:
> 	Add an option, opt_level_number, which records the selected
> 	optimization level numerically. The idea is that optimizations such
> 	as --optimize-constructor-last-call, which produce speedups only
> 	at some but not all optimization levels, can be enabled only when
> 	they help. This capability is not yet used; that will require further
> 	experimentation.
>
> 	Convert to four-space indentation.
>
> compiler/mlds.m:
> 	Translate store_at_ref Mercury types into a pointer MLDS type.
>
> 	Minor cleanups.
>
> compiler/ml_code_gen.m:
> compiler/ml_code_util.m:
> 	Minor cleanups.
>
...

 Index: compiler/ml_unify_gen.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
> retrieving revision 1.88
> diff -u -b -r1.88 ml_unify_gen.m
> --- compiler/ml_unify_gen.m	14 Oct 2005 01:42:46 -0000	1.88
> +++ compiler/ml_unify_gen.m	17 Oct 2005 07:34:25 -0000

...

> @@ -757,6 +777,28 @@
>          Statements = [Statement | Statements0]
>      ).
>
> +:- pred ml_gen_field_take_address_assigns(list(take_addr_info)::in,
> +    mlds__lval::in, mlds__type::in, maybe(mlds__tag)::in, prog_context::in,
> +    ml_gen_info::in, list(mlds__statement)::out) is det.
> +
> +ml_gen_field_take_address_assigns([], _, _, _, _, _, []).
> +ml_gen_field_take_address_assigns([TakeAddrInfo | TakeAddrInfos],
> +        CellLval, CellType, MaybeTag, Context, Info, [Assign | Assigns]) :-
> +    TakeAddrInfo = take_addr_info(AddrVar, Offset, ConsArgType, FieldType),
> +    % I am not sure that the types specified here are always the right ones,
> +    % particularly in cases where the field whose address we are taking has
> +    % a non-du type such as int or float. However, I can't think of a test case
> +    % in which a predicate fills in a field of such a type after a *recursive*
> +    % call, since recursive calls tend to generate values of recursive (i.e.
> +    % discriminated union) types. -zs

There should be an XXX on that comment.

Looks good otherwise.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list