[m-dev.] diff: avoid keeping parse tree live after building HLDS

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 12 00:05:42 AEDT 2001


Estimated hours taken: 0.25

compiler/mercury_compile.m:
	Reorder some code to encourage better GC behaviour: move a
	reference to `Module' (the parse tree) so that it doesn't
	remain live after we have built the HLDS.
	Also move a misplaced comment.

Workspace: /mnt/hg/home/hg/fjh/mercury
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.194
diff -u -d -r1.194 mercury_compile.m
--- compiler/mercury_compile.m	2001/02/10 09:23:47	1.194
+++ compiler/mercury_compile.m	2001/02/10 10:06:28
@@ -416,11 +416,12 @@
 :- mode mercury_compile(in, di, uo) is det.
 
 mercury_compile(Module) -->
+	{ module_imports_get_module_name(Module, ModuleName) },
+	% If we are only typechecking or error checking, then we should not
+	% modify any files, this includes writing to .d files.
 	globals__io_lookup_bool_option(typecheck_only, TypeCheckOnly),
 	globals__io_lookup_bool_option(errorcheck_only, ErrorCheckOnly),
 	{ bool__or(TypeCheckOnly, ErrorCheckOnly, DontWriteDFile) },
-	% If we are only typechecking or error checking, then we should not
-	% modify any files, this includes writing to .d files.
 	mercury_compile__pre_hlds_pass(Module, DontWriteDFile,
 		HLDS1, QualInfo, UndefTypes, UndefModes, Errors1),
 	mercury_compile__frontend_pass(HLDS1, QualInfo, UndefTypes,
@@ -458,7 +459,6 @@
 	    ; { MakeTransOptInt = yes } ->
 	    	mercury_compile__output_trans_opt_file(HLDS21)
 	    ;
-		{ module_imports_get_module_name(Module, ModuleName) },
 		mercury_compile__maybe_output_prof_call_graph(HLDS21,
 			Verbose, Stats, HLDS25),
 		mercury_compile__middle_pass(ModuleName, HLDS25, HLDS50),

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