[m-rev.] trivial diff: replace bools with has_main/0

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Aug 31 17:16:07 AEST 2007


Estimated hours taken: 0.2
Branches: main

Avoid using a bool in the IL backend to represent whether main/2 is present.

compiler/mlds_to_il.m:
 	Use the type `has_main'/0 instead of a bool.

compiler/modules.m:
compiler/prog_data.m:
 	Shift the type `has_main'/0 to the latter module.

compiler/compile_target_code.m:
compiler/make.module_target.m:
 	Conform to the above change.

Julien.

Index: compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.119
diff -u -r1.119 compile_target_code.m
--- compile_target_code.m	29 Aug 2007 01:27:03 -0000	1.119
+++ compile_target_code.m	31 Aug 2007 07:01:28 -0000
@@ -17,6 +17,7 @@
  :- interface.

  :- import_module parse_tree.
+:- import_module parse_tree.prog_data.
  :- import_module parse_tree.prog_io.
  :- import_module parse_tree.modules.
  :- import_module libs.
Index: make.module_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.module_target.m,v
retrieving revision 1.58
diff -u -r1.58 make.module_target.m
--- make.module_target.m	28 Aug 2007 05:32:32 -0000	1.58
+++ make.module_target.m	31 Aug 2007 07:01:28 -0000
@@ -73,6 +73,7 @@
  :- import_module hlds.passes_aux.
  :- import_module libs.compiler_util.
  :- import_module libs.process_util.
+:- import_module parse_tree.prog_data.
  :- import_module parse_tree.prog_foreign.
  :- import_module transform_hlds.
  :- import_module transform_hlds.mmc_analysis.
Index: mlds_to_il.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.192
diff -u -r1.192 mlds_to_il.m
--- mlds_to_il.m	31 Aug 2007 06:36:41 -0000	1.192
+++ mlds_to_il.m	31 Aug 2007 07:01:28 -0000
@@ -204,7 +204,7 @@
                                      % .cctor init instructions
                  class_members       :: list(class_member),
                                      % class methods and fields
-                has_main            :: bool,
+                has_main            :: has_main,
                                      % class contains main
                  class_foreign_langs :: set(foreign_language),
                                      % class foreign code
@@ -1173,7 +1173,7 @@
              model_det, no)
      ->
          EntryPoint = [entrypoint],
-        !:Info = !.Info ^ has_main := yes,
+        !:Info = !.Info ^ has_main := has_main,

          il_info_get_next_block_id(InnerTryBlockId, !Info),
          il_info_get_next_block_id(OuterTryBlockId, !Info),
@@ -4433,7 +4433,7 @@
          DebugIlAsm, VerifiableCode, ByRefTailCalls, MsCLR, RotorCLR) =
      il_info(ModuleName, AssemblyName, Imports, set.init, ILDataRep,
          DebugIlAsm, VerifiableCode, ByRefTailCalls, MsCLR, RotorCLR,
-        empty, empty, [], no, set.init, set.init,
+        empty, empty, [], no_main, set.init, set.init,
          map.init, empty, counter.init(1), counter.init(1), no,
          Args, MethodName, CSharpMethodName, DefaultSignature) :-
      Args = [],
@@ -4453,7 +4453,7 @@
      !:Info = !.Info ^ alloc_instrs := empty,
      !:Info = !.Info ^ init_instrs := empty,
      !:Info = !.Info ^ class_members := [],
-    !:Info = !.Info ^ has_main := no,
+    !:Info = !.Info ^ has_main := no_main,
      !:Info = !.Info ^ class_foreign_langs := set.init,
      !:Info = !.Info ^ field_names := set.list_to_set(FieldNames).

Index: modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.438
diff -u -r1.438 modules.m
--- modules.m	28 Aug 2007 05:32:33 -0000	1.438
+++ modules.m	31 Aug 2007 07:01:28 -0000
@@ -335,10 +335,6 @@
      --->    contains_foreign_export
      ;       no_foreign_export.

-:- type has_main
-    --->    has_main
-    ;       no_main.
-
      % When doing smart recompilation record for each module the suffix of
      % the file that was read and the modification time of the file.
      %
Index: prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.193
diff -u -r1.193 prog_data.m
--- prog_data.m	27 Aug 2007 06:22:14 -0000	1.193
+++ prog_data.m	31 Aug 2007 07:01:28 -0000
@@ -1599,6 +1599,12 @@
      --->    must_be_qualified
      ;       may_be_unqualified.

+    % Does a module contain the predicate main/2?
+    %
+:- type has_main
+    --->    has_main
+    ;       no_main.
+
  %-----------------------------------------------------------------------------%
  %-----------------------------------------------------------------------------%


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