[m-rev.] for review: add foreign code support to mmake for the IL backend

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jul 18 01:24:37 AEST 2001


On 17-Jul-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> Hi,
> 
> 
> ===================================================================
> 
> 
> Estimated hours taken: 5
> Branches: main
> 
> Add mmake support for building modules which contain foreign code on the
> IL backend.
> Note that currently we don't install mercury_il.dll and mercury_mcpp.dll
> somewhere where the C compiler can find them, so this change doesn't
> work out of the box.
> 
> compiler/mlds_to_ilasm.m:
>     Change the output file name for cpp files to <modulename>__cpp_code.cpp

While making this change, it would be a good idea to move to
__mcpp_code.cpp instead of cpp_code.cpp.

You should use simple_foreign_language_string and update it to use mcpp.

> 
> compiler/mlds_to_mcpp.m:
>     No longer output a reference to <modulename>.dll, as the cpp code
>     doesn't refer to any of the entities defined in this dll.

This is required for --high-level-data, but it doens't
matter too much because in fact you have to #include *ALL* the DLLs that
you might possibly see types from, so your change will only break it a
little bit more than it is already.

> 
> compiler/modules.m:
>     If a module contains some foreign code and we are on the IL backend
>     generate a dependency which causes the foreign code dll to be built.
>     Generate the make variable .foreign, .foreign_cs, .foreign_os and
>     .foreign_dlls which refer to all the foreign modules.
>     Generate rules to clean the foreign modules up.
> 
> scripts/Mmake.rules:
>     Turn some unix paths into windows paths.
>     
> library/Mmakefile:
>     Use the new .foreign variables to build the library instead of the
>     previous hacks.
> 

I'd like some more comments about what .foreign, .foreign_dlls,
.foreign_objs, and .foreign_cs are supposed to play (e.g. what kind of
files they can contain).  For the case of C++ it's not so hard to guess
but if the system handles other files too it would be good to know
whether we can reuse these variables for other purposes.

> Index: compiler/modules.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
> retrieving revision 1.172
> diff -u -r1.172 modules.m
> --- compiler/modules.m	17 Jul 2001 08:56:30 -0000	1.172
> +++ compiler/modules.m	17 Jul 2001 13:41:10 -0000
> @@ -1776,7 +1776,7 @@
>  write_dependency_file(Module, AllDepsSet, MaybeTransOptDeps) -->
>  	{ Module = module_imports(SourceFileName, ModuleName, ParentDeps,
>  			IntDeps, ImplDeps, IndirectDeps, _InclDeps, FactDeps0,
> -			_ContainsForeignCode, _Items, _Error, _Timestamps) },
> +			ContainsForeignCode, Items, _Error, _Timestamps) },
>  	globals__io_lookup_bool_option(verbose, Verbose),
>  	{ module_name_to_make_var_name(ModuleName, MakeVarName) },
>  	module_name_to_file_name(ModuleName, ".d", yes, DependencyFileName),
> @@ -2030,9 +2030,46 @@
>  				SourceFileName, "\n",
>  			"\trm -rf ", DirFileName, "\n",
>  			"\t$(MCS) $(ALL_GRADEFLAGS) $(ALL_MCSFLAGS) ",
> -				SourceFileName, "\n"
> +				SourceFileName, "\n\n"
>  		]),
>  
> +		% If we are on the IL backend and the current module
> +		% contains some foreign code, generate a dependency
> +		% between the dll containing the mercury code and the
> +		% dll containing the foreign code.

This comment is not complete, the code it describes does quite a bit
more than that.

Otherwise the change is fine.

-- 
       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