[m-rev.] Java: Foreign language interface support

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 10 18:01:26 AEDT 2003


On 10-Feb-2003, Michael Wybrow <mjwybrow at cs.mu.OZ.AU> wrote:
> Add Java support to the foreign language interface.
> 
> Index: make.module_target.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/make.module_target.m,v
> retrieving revision 1.21
> diff -u -r1.21 make.module_target.m
> --- make.module_target.m	23 Jan 2003 00:24:05 -0000	1.21
> +++ make.module_target.m	4 Feb 2003 05:38:20 -0000
> @@ -379,8 +379,9 @@
>  	compile_target_code__assemble(ErrorStream, PIC, ModuleName,
>  		Succeeded).
>  build_object_code(ModuleName, java, _, ErrorStream, _Imports, Succeeded) -->
> -	compile_target_code__compile_java_file(ErrorStream,
> -		ModuleName, Succeeded).
> +	module_name_to_file_name(ModuleName, ".java", no, JavaFile),

Shouldn't that be "yes" rather than "no" there?

Since this code is about to create the file, it should pass "yes"
here to ensure that the directory will be created before trying to
create the file within that directory.

Please test that Java compilation works with `--use-subdirs'.

> --- mlds_to_java.m	23 Jan 2003 04:26:36 -0000	1.35
> +++ mlds_to_java.m	10 Feb 2003 03:17:14 -0000
> @@ -20,13 +20,14 @@
>  %	multidet and nondet predicates
>  %	test tests/benchmarks/*.m
>  %	generate optimized tailcalls
> +%	handle foreign code written in Java
> +%
>  % TODO: 
>  %	General code cleanup
>  %	handle static ground terms
>  %	RTTI (requires static ground terms)
>  %	generate names of classes etc. correctly (mostly same as IL backend)
>  %
> -%	handle foreign code written in Java
>  %	handle foreign code written in C 

You should add "support foreign_import_module for Java" to this list.

> +:- pred output_target_code_component(mlds__context, target_code_component,
> +		io__state, io__state).
> +:- mode output_target_code_component(in, in, di, uo) is det.
> +
> +output_target_code_component(_Context, user_target_code(CodeString,
> +		_MaybeUserContext, _Attrs), !IO) :-
> +	io__write_string(CodeString, !IO).

Does Java support `#line' or equivalent?

If so, there should at least be an XXX comment here.


Otherwise, that looks good -- thanks!

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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