[m-rev.] for post-commit review: eliminate more redundant work

Peter Wang novalazy at gmail.com
Tue Sep 8 17:49:21 AEST 2009


On 2009-09-08, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> --- compiler/mlds.m	4 Sep 2009 02:27:53 -0000	1.176
> +++ compiler/mlds.m	4 Sep 2009 08:30:26 -0000
> @@ -1835,12 +1835,37 @@
>              MLDSType = mlds_ptr_type(MLDSRefType)
>          ;
>              module_info_get_type_table(ModuleInfo, TypeTable),
> -            search_type_ctor_defn(TypeTable, TypeCtor, TypeDefn),
> -            hlds_data.get_type_defn_body(TypeDefn, Body),
> -            Body = hlds_foreign_type(ForeignTypeBody),
> +            ( search_type_ctor_defn(TypeTable, TypeCtor, TypeDefn) ->
> +                hlds_data.get_type_defn_body(TypeDefn, TypeBody),
> +                ( TypeBody = hlds_foreign_type(ForeignTypeBody) ->
> +                    MLDSType = foreign_type_to_mlds_type(ModuleInfo,
> +                        ForeignTypeBody)
> +                ;
> +                    Category = classify_type_defn_body(TypeBody),
> +                    ExportedType = non_foreign_type(Type),
> +                    MLDSType = mercury_type(Type, Category, ExportedType)
> +                )
> +            ;
> +                Category = classify_type_ctor(ModuleInfo, TypeCtor),
> +                ExportedType = non_foreign_type(Type),
> +                MLDSType = mercury_type(Type, Category, ExportedType)
> +            )
> +        )

I needed the following patch to restore the Java backend.  Without it,
type_infos, etc. are not classified with their more precise categories.

I think classify_type_defn_body should not be exported from type_util.m
with its current interface as it doesn't have enough information to
return the precise categories.

Peter

diff --git a/compiler/mlds.m b/compiler/mlds.m
index c212f74..9d90fd2 100644
--- a/compiler/mlds.m
+++ b/compiler/mlds.m
@@ -1840,6 +1840,10 @@ mercury_type_to_mlds_type(ModuleInfo, Type) = MLDSType :-
                 ( TypeBody = hlds_foreign_type(ForeignTypeBody) ->
                     MLDSType = foreign_type_to_mlds_type(ModuleInfo,
                         ForeignTypeBody)
+                ; TypeBody = hlds_abstract_type(_) ->
+                    Category = classify_type_ctor(ModuleInfo, TypeCtor),
+                    ExportedType = non_foreign_type(Type),
+                    MLDSType = mercury_type(Type, Category, ExportedType)
                 ;   
                     Category = classify_type_defn_body(TypeBody),
                     ExportedType = non_foreign_type(Type),
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list