[m-rev.] for review: pragma foreign_import_module on the IL backend

Peter Ross pro at missioncriticalit.com
Sat Dec 21 02:21:52 AEDT 2002


On Sat, Dec 21, 2002 at 01:51:46AM +1100, Simon Taylor wrote:
> On 20-Dec-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > On Fri, Dec 13, 2002 at 05:48:38PM +1100, Simon Taylor wrote:
> > > On 10-Dec-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > Index: compiler/modules.m
> > > > ===================================================================
> > > > @@ -2833,10 +2844,10 @@
> > > >  	% scripts/Mmake.rules).
> > > >  	% 
> > > >  :- pred write_foreign_dependency_for_il(io__output_stream::in,sym_name::in,
> > > > -		list(module_name)::in, foreign_language::in,
> > > > -		io__state::di, io__state::uo) is det.
> > > > -write_foreign_dependency_for_il(DepStream, ModuleName, AllDeps, ForeignLang)
> > > > -		-->
> > > > +		list(module_name)::in, foreign_import_module_info::in,
> > > > +		foreign_language::in, io__state::di, io__state::uo) is det.
> > > > +write_foreign_dependency_for_il(DepStream, ModuleName, AllDeps,
> > > > +		ForeignImports, ForeignLang) -->
> > > >  	( 
> > > >  		{ ForeignModuleName = foreign_language_module_name(
> > > >  			ModuleName, ForeignLang) },
> > > > @@ -2880,8 +2891,13 @@
> > > >  			;
> > > >  				Prefix = "/r:"
> > > >  			},
> > > > +			{ ForeignDeps = list__map(
> > > > +				(func(M) =
> > > > +					foreign__module_name(M, ModuleName)
> > > > +				), ForeignImports) },
> > > > +			{ Deps = AllDeps ++ ForeignDeps },
> > > >  			write_dll_dependencies_list(
> > > > -				referenced_dlls(ModuleName, AllDeps),
> > > > +				referenced_dlls(ModuleName, Deps),
> > > >  				Prefix, DepStream),
> > > >  			io__nl(DepStream)
> > > 
> > > I'm not sure why Deps can't just be ForeignDeps.
> > > At least it deserves a comment.
> > > 
> > Because in mlds_to_managed__output_language_specific_header_code we output a
> > #using for each of the imports for MC++ and we do something similar in
> > modules.m for C#.
> > 
> > Are you sure that this needs a comment?  Why were you unsure?
> 
> I don't understand why are we adding #using declarations for all imports,
> not just the modules for which there are foreign_import_module declarations.
> 
I believe it is because the IL backend is strongly typed.  This means
that when high-level data is enabled, and one has a foreign proc whose
type is not defined in the current module then you need to reference the
assembly where that type is defined.  Hence we reference all the
assemblies which could contain types which are arguments to a
foreign_proc, ie the set of direct imports.
--------------------------------------------------------------------------
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