[m-rev.] diff: code duplication in ml_unify_gen.m

Peter Wang wangp at students.csse.unimelb.edu.au
Thu May 17 11:11:35 AEST 2007


Estimated hours taken: 0.1
Branches: main

compiler/ml_unify_gen.m:
	Fix code duplication in ml_gen_det_deconstruct_2 which used to be
	necessary for switch detection to work.

Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.111
diff -u -r1.111 ml_unify_gen.m
--- compiler/ml_unify_gen.m	7 May 2007 05:21:33 -0000	1.111
+++ compiler/ml_unify_gen.m	17 May 2007 01:03:07 -0000
@@ -1312,6 +1312,8 @@
         ; Tag = tabling_info_tag(_, _)
         ; Tag = deep_profiling_proc_layout_tag(_, _)
         ; Tag = table_io_decl_tag(_, _)
+        ; Tag = shared_local_tag(_Bits1, _Num1)
+        ; Tag = reserved_address_tag(_)
         ),
         Statements = []
     ;
@@ -1329,23 +1331,10 @@
             unexpected(this_file, "ml_code_gen: no_tag: arity != 1")
         )
     ;
-        Tag = single_functor_tag,
-        ml_gen_var(!.Info, Var, VarLval),
-        ml_variable_types(!.Info, Args, ArgTypes),
-        ml_field_names_and_types(!.Info, Type, ConsId, ArgTypes, Fields),
-        ml_tag_offset_and_argnum(Tag, _, OffSet, ArgNum),
-        ml_gen_unify_args(ConsId, Args, Modes, ArgTypes, Fields, Type,
-            VarLval, OffSet, ArgNum, Tag, Context, Statements, !Info)
-    ;
-        Tag = unshared_tag(_UnsharedTag),
-        ml_gen_var(!.Info, Var, VarLval),
-        ml_variable_types(!.Info, Args, ArgTypes),
-        ml_field_names_and_types(!.Info, Type, ConsId, ArgTypes, Fields),
-        ml_tag_offset_and_argnum(Tag, _, OffSet, ArgNum),
-        ml_gen_unify_args(ConsId, Args, Modes, ArgTypes, Fields, Type,
-            VarLval, OffSet, ArgNum, Tag, Context, Statements, !Info)
-    ;
-        Tag = shared_remote_tag(_PrimaryTag, _SecondaryTag),
+        ( Tag = single_functor_tag
+        ; Tag = unshared_tag(_UnsharedTag)
+        ; Tag = shared_remote_tag(_PrimaryTag, _SecondaryTag)
+        ),
         ml_gen_var(!.Info, Var, VarLval),
         ml_variable_types(!.Info, Args, ArgTypes),
         ml_field_names_and_types(!.Info, Type, ConsId, ArgTypes, Fields),
@@ -1353,16 +1342,6 @@
         ml_gen_unify_args(ConsId, Args, Modes, ArgTypes, Fields, Type,
             VarLval, OffSet, ArgNum, Tag, Context, Statements, !Info)
     ;
-        % For constants, if the deconstruction is det, then we already
-        % know the value of the constant, so Statements = [].
-        Tag = shared_local_tag(_Bits1, _Num1),
-        Statements = []
-    ;
-        % For constants, if the deconstruction is det, then we already
-        % know the value of the constant, so Statements = [].
-        Tag = reserved_address_tag(_),
-        Statements = []
-    ;
         % For shared_with_reserved_address, the sharing is only important
         % for tag tests, not for det deconstructions, so here we just recurse
         % on the real representation.

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