[m-rev.] diff: run process_lambdas for structure reuse

Peter Wang novalazy at gmail.com
Thu May 1 12:36:05 AEST 2008


Branches: main

compiler/mercury_compile.m:
	Run process_lambdas when making .opt, .trans_opt and .analysis files
	when performing structure sharing/reuse analyses to reduce
	discrepancies with the results when making .c files.

Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.468
diff -u -p -r1.468 mercury_compile.m
--- compiler/mercury_compile.m	17 Apr 2008 04:21:51 -0000	1.468
+++ compiler/mercury_compile.m	1 May 2008 02:32:22 -0000
@@ -2286,7 +2286,12 @@ maybe_write_optfile(MakeOptInt, !HLDS, !
                 (
                     % Closure analysis assumes that lambda expressions have
                     % been converted into separate predicates.
-                    ClosureAnalysis = yes,
+                    % Structure sharing/reuse analysis results can be affected
+                    % by process_lambdas.
+                    ( ClosureAnalysis = yes
+                    ; SharingAnalysis = yes
+                    )
+                ->
                     mercury_compile.process_lambdas(Verbose, Stats,
                         !HLDS, !IO),
 
@@ -2294,7 +2299,7 @@ maybe_write_optfile(MakeOptInt, !HLDS, !
                     mercury_compile.maybe_closure_analysis(Verbose, Stats,
                         !HLDS, !IO)
                 ;
-                    ClosureAnalysis = no
+                    true
                 ),
                 (
                     ExceptionAnalysis = yes,
@@ -2401,10 +2406,13 @@ output_trans_opt_file(!.HLDS, !DumpInfo,
     % Closure analysis assumes that lambda expressions have
     % been converted into separate predicates.
     (
-        ClosureAnalysis = yes,
+        ( ClosureAnalysis = yes
+        ; SharingAnalysis = yes
+        )
+    ->
         process_lambdas(Verbose, Stats, !HLDS, !IO)
     ;
-        ClosureAnalysis = no
+        true
     ),
     maybe_dump_hlds(!.HLDS, 110, "lambda", !DumpInfo, !IO),
     maybe_closure_analysis(Verbose, Stats, !HLDS, !IO),
@@ -2452,10 +2460,13 @@ output_analysis_file(ModuleName, !.HLDS,
     % Closure analysis assumes that lambda expressions have
     % been converted into separate predicates.
     (
-        ClosureAnalysis = yes,
+        ( ClosureAnalysis = yes
+        ; SharingAnalysis = yes
+        )
+    ->
         process_lambdas(Verbose, Stats, !HLDS, !IO)
     ;
-        ClosureAnalysis = no
+        true
     ),
     maybe_dump_hlds(!.HLDS, 110, "lambda", !DumpInfo, !IO),
     maybe_closure_analysis(Verbose, Stats, !HLDS, !IO),


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list