[m-dev.] diff: MLDS back-end: fix an XXX in ml_code_gen.m

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 24 18:26:27 AEST 2000


Estimated hours taken: 0.25

compiler/ml_code_gen.m:
	Fix an XXX: don't output calls to the
	MR_OBTAIN_GLOBAL_LOCK() and MR_RELEASE_GLOBAL_LOCK()
	macros unless the module was compiled with `--parallel'.

Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.45
diff -u -d -r1.45 ml_code_gen.m
--- compiler/ml_code_gen.m	2000/05/17 21:59:44	1.45
+++ compiler/ml_code_gen.m	2000/05/24 08:08:37
@@ -666,6 +666,7 @@
 :- import_module hlds_pred, hlds_goal, hlds_data, prog_data.
 :- import_module goal_util, type_util, mode_util, builtin_ops.
 :- import_module passes_aux, modules.
+:- import_module globals, options.
 
 :- import_module bool, string, list, map, set, term, require, std_util.
 
@@ -1806,16 +1807,16 @@
 	% Generate code fragments to obtain and release the global lock
 	% (this is used for ensuring thread safety in a concurrent
 	% implementation)
-	% XXX we should only generate these if the `parallel' option
-	% was enabled
 	%
 	=(MLDSGenInfo),
+	{ ml_gen_info_get_module_info(MLDSGenInfo, ModuleInfo) },
+	{ module_info_globals(ModuleInfo, Globals) },
+	{ globals__lookup_bool_option(Globals, parallel, Parallel) },
 	{ thread_safe(Attributes, ThreadSafe) },
-	{ ThreadSafe = thread_safe ->
-		ObtainLock = "",
-		ReleaseLock = ""
-	;
-		ml_gen_info_get_module_info(MLDSGenInfo, ModuleInfo),
+	{
+		Parallel = no,
+		ThreadSafe = not_thread_safe
+	->
 		module_info_pred_info(ModuleInfo, PredId, PredInfo),
 		pred_info_name(PredInfo, Name),
 		llds_out__quote_c_string(Name, MangledName),
@@ -1823,6 +1824,9 @@
 			MangledName, """);\n"], ObtainLock),
 		string__append_list(["\tMR_RELEASE_GLOBAL_LOCK(""",
 			MangledName, """);\n"], ReleaseLock)
+	;
+		ObtainLock = "",
+		ReleaseLock = ""
 	},
 
 	%

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list