[m-rev.] for review: delete the trseg component and --trail-segments option

Julien Fischer jfischer at opturion.com
Sat Apr 2 21:18:18 AEDT 2022


For review by anyone.

---------------------

Delete the trseg component and --trail-segments option.

Trail segments have been the default in trailing grades since Mercury 20.06.
Delete the trseg grade components and --trail-segment option since apart from
acting as synonyms for the tr component and --use-trail option repsectively,
they no longer do anything.

compiler/compute_grade.m:
compiler/handle_options.m:
compiler/options.m:
doc/user_guide.texi:
grade_lib/grade_vars.m:
scripts/parse_grade_option.sh-subr:
grade_lib/grade_string.m:
grade_lib/grade_vars.m:
    Delete the trseg grade component and --trail-segments option.

compiler/add_pragma.m:
    Update the wording of an error message.

NEWS:
    Announce the above.

extras/trail/Mercury.options:
extras/trailed_update/Mmakefile:
extras/references/Mercury.options:
tests/invalid/test_feature_set.err_exp:
     Conform to the above changes

Julien.

diff --git a/NEWS b/NEWS
index 8bd10cf..82ad6e5 100644
--- a/NEWS
+++ b/NEWS
@@ -229,6 +229,9 @@ Changes to the Mercury compiler
  * We have fixed a bug where `--warn-unused-imports` did not warn about
    unused modules that are also imported by an ancestor of the current module.

+* The deprecated option `--trail-segments` has been deleted and the grade
+  component `trseg` is no longer accepted as a synonym for `tr`.
+
  NEWS for Mercury 22.01
  ======================

diff --git a/compiler/add_pragma.m b/compiler/add_pragma.m
index b98bb5b..7a88674 100644
--- a/compiler/add_pragma.m
+++ b/compiler/add_pragma.m
@@ -1404,8 +1404,7 @@ check_required_feature(Globals, Context, Feature, !Specs) :-
              Pieces = [words("Error: this module must be compiled in a grade"),
                  words("that supports trailing.")],
              VerbosePieces = [words("Grades that support trailing contain"),
-                words("the grade modifiers"), quote("tr"),
-                words("or"), quote("trseg"), suffix("."), nl],
+                words("the grade modifier"), quote("tr"), suffix("."), nl],
              Msg = simple_msg(Context,
                  [always(Pieces), verbose_only(verbose_once, VerbosePieces)]),
              Spec = error_spec($pred, severity_error, phase_parse_tree_to_hlds,
diff --git a/compiler/compute_grade.m b/compiler/compute_grade.m
index f593357..ebabe3f 100644
--- a/compiler/compute_grade.m
+++ b/compiler/compute_grade.m
@@ -176,14 +176,8 @@ check_grade_component_compatibility(Globals, Target, GC_Method, !Specs) :-
      % Trailing is only supported by the C back-ends.
      %
      globals.lookup_bool_option(Globals, use_trail,  UseTrail),
-    globals.lookup_bool_option(Globals, trail_segments, TrailSegments),
-    ( if
-        % NOTE: We haven't yet implicitly enabled use_trail segments
-        % if trail_segments are enabled, so we must check both here.
-        ( UseTrail = yes
-        ; TrailSegments = yes
-        )
-    then
+    (
+        UseTrail = yes,
          (
              ( Target = target_java
              ; Target = target_csharp
@@ -195,8 +189,8 @@ check_grade_component_compatibility(Globals, Target, GC_Method, !Specs) :-
          ;
              Target = target_c
          )
-    else
-        true
+    ;
+        UseTrail = no
      ),

      % Stack segments are only supported by the low level C back-end.
@@ -633,11 +627,7 @@ grade_component_table("tsc", comp_term_size,

      % Trailing components.
  grade_component_table("tr", comp_trail,
-    [use_trail - bool(yes), trail_segments - bool(yes)], no, yes).
-    % NOTE: we do no include `.trseg' in grades strings because it
-    % it is just a synonym for `.tr'.
-grade_component_table("trseg", comp_trail,
-    [use_trail - bool(yes), trail_segments - bool(yes)], no, no).
+    [use_trail - bool(yes)], no, yes).

      % Minimal model tabling components.
      % NOTE: we do not include `.mm' and `.dmm' in grade strings
@@ -736,7 +726,6 @@ grade_start_values(profile_time - bool(no)).
  grade_start_values(profile_calls - bool(no)).
  grade_start_values(profile_memory - bool(no)).
  grade_start_values(use_trail - bool(no)).
-grade_start_values(trail_segments - bool(no)).
  grade_start_values(use_minimal_model_stack_copy - bool(no)).
  grade_start_values(use_minimal_model_own_stacks - bool(no)).
  grade_start_values(minimal_model_debug - bool(no)).
diff --git a/compiler/handle_options.m b/compiler/handle_options.m
index b8556b4..f7411ad 100644
--- a/compiler/handle_options.m
+++ b/compiler/handle_options.m
@@ -2226,9 +2226,6 @@ handle_option_to_option_implications(!Globals) :-
      option_implies(exec_trace, stack_trace, bool(yes), !Globals),
      option_implies(profile_deep, stack_trace, bool(yes), !Globals),

-    % Using trail segments implies the use of the trail.
-    option_implies(trail_segments, use_trail, bool(yes), !Globals),
-
      % The results of trail usage analysis assume that trail usage
      % optimization is being done, i.e. that redundant trailing
      % operations are really being eliminated.
diff --git a/compiler/options.m b/compiler/options.m
index ceb0583..920700e 100644
--- a/compiler/options.m
+++ b/compiler/options.m
@@ -510,7 +510,6 @@
      ;       parallel
      ;       threadscope
      ;       use_trail
-    ;       trail_segments
      ;       use_minimal_model_stack_copy
      ;       use_minimal_model_own_stacks
      ;       minimal_model_debug
@@ -1518,7 +1517,6 @@ optdef(oc_grade, gc,                                    string("boehm")).
  optdef(oc_grade, parallel,                              bool(no)).
  optdef(oc_grade, threadscope,                           bool(no)).
  optdef(oc_grade, use_trail,                             bool(no)).
-optdef(oc_grade, trail_segments,                        bool(no)).
  optdef(oc_grade, maybe_thread_safe_opt,                 string("no")).
  optdef(oc_grade, extend_stacks_when_needed,             bool(no)).
  optdef(oc_grade, stack_segments,                        bool(no)).
@@ -2483,7 +2481,6 @@ long_option("gc",                   gc).
  long_option("garbage-collection",   gc).
  long_option("parallel",             parallel).
  long_option("use-trail",            use_trail).
-long_option("trail-segments",       trail_segments).
  long_option("type-layout",          type_layout).
  long_option("maybe-thread-safe",    maybe_thread_safe_opt).
  long_option("extend-stacks-when-needed",    extend_stacks_when_needed).
@@ -5368,9 +5365,6 @@ options_help_compilation_model(Stream, !IO) :-
          "\tThis is necessary for interfacing with constraint solvers,",
          "\tor for backtrackable destructive update.",
          "\tThis option is not yet supported for the C# or Java backends.",
-        "--trail-segments\t\t\t(grade modifier: `.trseg')",
-        "\tThis option is deprecated as trail segments are now used by",
-        "\tdefault. The `.trseg' grade modifier is a synonym for `.tr'.",
          "--parallel\t\t(grade modifier: `.par')",
          "\tEnable parallel execution support for the low-level C grades.",
          "\tEnable concurrency (via pthreads) for the high-level C grades.",
diff --git a/doc/user_guide.texi b/doc/user_guide.texi
index db81c5e..c077e9b 100644
--- a/doc/user_guide.texi
+++ b/doc/user_guide.texi
@@ -8179,7 +8179,6 @@ as these are the two fastest.
  @cindex .stseg (grade modifier)
  @cindex .threadscope (grade modifier)
  @cindex .tr (grade modifier)
- at cindex .trseg (grade modifier)

  The grade modifiers may be given in any order.
  Each grade modifier sets one or more compilation model options.
@@ -8213,7 +8212,6 @@ all of which are available only when targeting C.
  @item trailing
  The default is no trailing.
  Applications that need trailing should specify the grade modifier @samp{.tr}.
- at samp{.trseg} is currently accepted as synonym for @samp{.tr}.
  Trailing is available only when targeting C.

  (A trail is a data structure
@@ -8432,9 +8430,6 @@ they are followed by descriptions of those options.
  @item @samp{.tr}
  @code{--use-trail --no-trail-segments}.

- at item @samp{.trseg}
- at code{--use-trail --trail-segments}.
-
  @c @item @samp{.tsw}
  @c @code{--record-term-sizes-as-words}.

@@ -8766,7 +8761,7 @@ This is the case for the C# and Java back-ends, which always use
  the underlying implementation's garbage collector.

  @sp 1
- at item @code{--use-trail} (grades: any grade containing @samp{.tr} or @samp{.trseg})
+ at item @code{--use-trail} (grades: any grade containing @samp{.tr})
  @findex --use-trail
  @cindex Trailing
  @cindex Constraint solving
@@ -8777,15 +8772,6 @@ This is necessary for interfacing with constraint solvers,
  or for backtrackable destructive update.
  This option is only supported by the C back-ends.

- at item @code{--trail-segments} (grades: any grade containing @samp{.trseg})
- at findex --trail-segments
- at cindex Trailing
- at cindex Constraint solving
- at cindex Backtrackable destructive update
- at cindex Destructive update, backtrackable
-This option is deprecated as trailing now always uses trail segments.
-The @samp{.trseg} grade modifier is a synonym for @samp{.tr}.
-
  @sp 1
  @item @code{--parallel}
  @findex --parallel
diff --git a/extras/references/Mercury.options b/extras/references/Mercury.options
index 121cfa8..c0b2d61 100644
--- a/extras/references/Mercury.options
+++ b/extras/references/Mercury.options
@@ -1,12 +1,12 @@
  #-----------------------------------------------------------------------------#
  # Copyright (C) 2011 The University of Melbourne.
-# Copyright (C) 2018 The Mercury team.
+# Copyright (C) 2018, 2022 The Mercury team.
  # This file is distributed under the terms specified in COPYING.LIB.
  #-----------------------------------------------------------------------------#

-MCFLAGS = --use-trail --trail-segments        \
-	  --use-grade-subdirs		      \
-          --libgrades-include-component trseg \
+MCFLAGS = --use-trail	        		\
+	  --use-grade-subdirs		      	\
+          --libgrades-include-component tr 	\
  	  --extra-library-header c_reference.h

  MCFLAGS-global = --no-warn-nothing-exported --no-warn-interface-imports
diff --git a/extras/trail/Mercury.options b/extras/trail/Mercury.options
index 18b59db..707d4a0 100644
--- a/extras/trail/Mercury.options
+++ b/extras/trail/Mercury.options
@@ -2,11 +2,10 @@ TRAIL_INSTALL_PREFIX=.

  MCFLAGS = \
  	--use-trail			\
-	--trail-segments		\
  	--use-grade-subdirs		\
  	--libgrades-exclude java	\
  	--libgrades-exclude csharp	\
-	--libgrades-include trseg	\
+	--libgrades-include tr		\
  	--install-prefix $(TRAIL_INSTALL_PREFIX)

  MCFLAGS-mercury_trail=--no-warn-nothing-exported --no-warn-interface-imports 
diff --git a/extras/trailed_update/Mmakefile b/extras/trailed_update/Mmakefile
index 36fb742..e3c065e 100644
--- a/extras/trailed_update/Mmakefile
+++ b/extras/trailed_update/Mmakefile
@@ -6,7 +6,7 @@
  # This file is distributed under the terms specified in COPYING.LIB.
  #-----------------------------------------------------------------------------#

-GRADEFLAGS += --use-trail --trail-segments
+GRADEFLAGS += --use-trail

  # enable C debugging
  MGNUCFLAGS = -g
diff --git a/grade_lib/grade_string.m b/grade_lib/grade_string.m
index c014208..83a7db2 100644
--- a/grade_lib/grade_string.m
+++ b/grade_lib/grade_string.m
@@ -677,9 +677,7 @@ translate_grade_component(ComponentStr, Setting, Settings) :-
          Setting = svar_term_size_prof - svalue_term_size_prof_words,
          Settings = []
      ;
-        ( ComponentStr = "tr"
-        ; ComponentStr = "trseg"
-        ),
+        ComponentStr = "tr",
          Setting = svar_trail - svalue_trail_yes,
          Settings = []
      ;
diff --git a/grade_lib/grade_vars.m b/grade_lib/grade_vars.m
index 2a1b0ec..8960d85 100644
--- a/grade_lib/grade_vars.m
+++ b/grade_lib/grade_vars.m
@@ -111,10 +111,6 @@
      --->    grade_var_trail_no
      ;       grade_var_trail_yes.

-:- type grade_var_trail_segments
-    --->    grade_var_trail_segments_no
-    ;       grade_var_trail_segments_yes.
-
  :- type grade_var_minmodel
      --->    grade_var_minmodel_no
      ;       grade_var_minmodel_stack_copy
diff --git a/scripts/parse_grade_options.sh-subr b/scripts/parse_grade_options.sh-subr
index 4d8b48b..2a7a437 100644
--- a/scripts/parse_grade_options.sh-subr
+++ b/scripts/parse_grade_options.sh-subr
@@ -439,10 +439,6 @@
                      use_trail=true
                      ;;

-                trseg)
-                    use_trail=true
-                    ;;
-
                  mm)
                      use_minimal_model_stack_copy=true
                      minimal_model_debug=false
diff --git a/tests/invalid/test_feature_set.err_exp b/tests/invalid/test_feature_set.err_exp
index de5a81a..0dd16c7 100644
--- a/tests/invalid/test_feature_set.err_exp
+++ b/tests/invalid/test_feature_set.err_exp
@@ -3,7 +3,7 @@ test_feature_set.m:013:   supports memoisation.
  test_feature_set.m:013: Error: this module must be compiled in a grade that
  test_feature_set.m:013:   supports trailing.
  test_feature_set.m:013:   Grades that support trailing contain the grade
-test_feature_set.m:013:   modifiers `tr' or `trseg'.
+test_feature_set.m:013:   modifier `tr'.
  test_feature_set.m:013: Error: this module must be compiled in a grade that
  test_feature_set.m:013:   uses single precision floats.
  test_feature_set.m:013:   Grades that use single precision floats contain the


More information about the reviews mailing list