[m-rev.] diff: java "linking"

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Feb 10 21:09:41 AEDT 2004


Estimated hours taken: 1
Branches: main

Have "mmc --grade java foo.m" generate the same shell script
as "mmc --grade java --make foo" and "mmake GRADE=java foo" do.

compiler/handle_options.m:
	Do not disable linking for Target = java.

compiler/mercury_compile.m:
	When linking and Target = java, call generate_java_shell_script.

Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.196
diff -u -d -r1.196 handle_options.m
--- compiler/handle_options.m	10 Feb 2004 09:56:28 -0000	1.196
+++ compiler/handle_options.m	10 Feb 2004 10:00:04 -0000
@@ -107,7 +107,6 @@
 			TargetCodeOnly),
 		globals__io_get_target(Target),
 		{ GenerateIL = (if Target = il then yes else no) },
-		{ GenerateJava = (if Target = java then yes else no) },
 		globals__io_lookup_bool_option(compile_only, CompileOnly),
 		globals__io_lookup_bool_option(aditi_only, AditiOnly),
 		{ bool__or_list([GenerateDependencies, MakeInterface,
@@ -115,8 +114,7 @@
 			MakeOptimizationInt, MakeTransOptInt,
 			ConvertToMercury, TypecheckOnly,
 			ErrorcheckOnly, TargetCodeOnly,
-			GenerateIL, GenerateJava,
-			CompileOnly, AditiOnly],
+			GenerateIL, CompileOnly, AditiOnly],
 			NotLink) },
 		{ bool__not(NotLink, Link) },
 		globals__io_lookup_bool_option(smart_recompilation, Smart),
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.301
diff -u -d -r1.301 mercury_compile.m
--- compiler/mercury_compile.m	3 Feb 2004 05:39:59 -0000	1.301
+++ compiler/mercury_compile.m	10 Feb 2004 10:03:32 -0000
@@ -387,11 +387,22 @@
 			->
 				file_name_to_module_name(FirstModule,
 					MainModuleName),
-				compile_with_module_options(MainModuleName,
-					OptionVariables, OptionArgs,
-					compile_target_code__link_module_list(
-						ModulesToLink),
-					Succeeded, !IO),
+				globals__get_target(Globals, Target),
+				( Target = java ->
+					% For Java, at the "link" step we just
+					% generate a shell script; the actual
+					% linking will be done at runtime by
+					% the Java interpreter.
+					create_java_shell_script(
+						MainModuleName, Succeeded, !IO)
+				;
+					compile_with_module_options(
+						MainModuleName,
+						OptionVariables, OptionArgs,
+					 compile_target_code__link_module_list(
+							ModulesToLink),
+						Succeeded, !IO)
+				),
 				maybe_set_exit_status(Succeeded, !IO)
 			;
 				true

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