[m-rev.] for review: merge foreign_type pragma on to the main branch

Tyson Dowd trd at cs.mu.OZ.AU
Tue Oct 23 13:07:25 AEST 2001


On 22-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> Hi,
> 
> For Tyson to review.
> 
> Tyson can you fix up the documentation for this change I know that you
> will write it much better than me.

There is no way to specify the "language"(*) the foreign type declaration
should apply to.  Without that, this syntax will certainly have to
change.

However it would make sense for me to both fix this and the
documentation at the same time.  

How about we commit this change without the syntax (e.g. no changes to
prog_io_pragma.m)?  Then it is an MLDS and HLDS extension, with no
syntax to use (or abuse) it on the main branch yet.  I will take the 
syntax and add it straight away.

This is the approach I took for merging the attributes change over, it
is an MLDS feature that is currently unused.  It has the same problem in
that there is no "language"(*) parameter in that syntax either.

(*) Actually language might not quite be enough - you may want to use a
different definition for a type depending upon other grade options.
E.g. high-level or low-level data.

> Also how should we handle the compare and unify predicates for foreign
> types?  I have left some XXXs in this diff where we generate the code
> for compare and unify.

Strictly speaking, the user should have to supply them.

> ===================================================================
> 
> 
> Estimated hours taken: 8
> Branches: main
> 
> Merge the foreign_type pragma changes from the dotnet branch to the main
> branch.
> 
> compiler/prog_data.m:
>     Add a type to hold the data from parsing a pragma foreign_type decl.
> 
> compiler/prog_io_pragma.m:
>     Parse the pragma foreign_type.
> 
> compiler/hlds_data.m:
>     Add a new alternative to hlds_type_body where the body of the type
>     is a foreign type.
> 
> compiler/make_hlds.m:
>     Place the foreign_type pragmas into the HLDS.
> 
> compiler/export.m:
>     Change export__type_to_type_string so that we return the
>     foreign type representation if it exists.
> 
> compiler/llds.m:
>     Since export__type_to_type_string needs a module_info, we add a new
>     field to pragma_c_arg_decl which is the result of calling
>     export__type_to_type_string.  This avoids threading the module_info
>     around various llds passes.
> 
> compiler/mlds.m:
>     Table the result of export__type_to_type_string so as to avoid
>     passing the module_info around the MLDS backend.
>     Also add the foreign_type alternative to mlds__type.
>     Update mercury_type_to_mlds_type so that handles types which are
>     foreign types.
>     
> compiler/mlds_to_il.m:
>     Convert a mlds__foreign_type into an ilds__type.  Note that the
>     basic types aren't allowed to appear in the assembler in their
>     System.* form so we detect all these cases and convert to the basic
>     type instead.
> 
> compiler/ilds.m:
>     The CLR spec requires that System.Object and System.String be
>     treated specially in the IL assembly (you have to use the name
>     object and string instead of the System.* names), so add them as
>     base types.
> 
> compiler/ilasm.m:
>     Changes to handle the additions to the simple ilds types.
> 
> doc/reference_manual.texi:
>     Document the new pragma.
> 
> compiler/fact_table.m:
> compiler/llds_out.m:
> compiler/ml_code_gen.m:
> compiler/ml_code_util.m:
> compiler/ml_simplify_switch.m:
> compiler/ml_switch_gen.m:
> compiler/ml_unify_gen.m:
> compiler/mlds_to_c.m:
> compiler/mlds_to_csharp.m:
> compiler/mlds_to_gcc.m:
> compiler/mlds_to_java.m:
> compiler/mlds_to_mcpp.m:
> compiler/pragma_c_gen.m:
> compiler/rtti_to_mlds.m:
>     Changes to handle the tabling of calls to export__type_to_string.
> 
> compiler/hlds_out.m:
> compiler/intermod.m:
> compiler/magic_util.m:
> compiler/ml_type_gen.m:
> compiler/recompilation_usage.m:
> compiler/recompilation_version.m:
> compiler/term_util.m:
> compiler/type_ctor_info.m:
> compiler/unify_proc.m:
>     Changes to hanlde the new hlds_type_body.

s/hanlde/handle/

> 
> compiler/mercury_to_mercury.m:
>     Output the pragma foreign_type declaration.
> 
> compiler/module_qual.m:
>     Qualify the pragma foreign_type declarations.
> 
> compiler/modules.m:
>     Pragma foreign_type is allowed in the interface.
> 

I am working on reviewing this change now...

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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