[m-rev.] for review: add new grade component for rbmm

Julien Fischer juliensf at csse.unimelb.edu.au
Thu May 24 14:56:26 AEST 2007


Estimated hours taken: 1
Branches: main

Add a new grade component for use with region-based memory management.

runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
doc/user_guide.texi:
 	Add the grade component `.rbmm' for use with region-based memory
 	management.

Julien.

Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.107
diff -u -r1.107 compile_target_code.m
--- compiler/compile_target_code.m	7 May 2007 05:21:29 -0000	1.107
+++ compiler/compile_target_code.m	24 May 2007 04:41:34 -0000
@@ -696,6 +696,14 @@
          SinglePrecFloat = no,
          SinglePrecFloatOpt = ""
      ),
+    globals.io_lookup_bool_option(use_regions, UseRegions, !IO),
+    (
+        UseRegions = yes,
+        UseRegionsOpt = "-DMR_USE_REGIONS "
+    ;
+        UseRegions = no,
+        UseRegionsOpt = ""
+    ),
      globals.io_lookup_bool_option(type_layout, TypeLayoutOption, !IO),
      (
          TypeLayoutOption = no,
@@ -783,6 +791,7 @@
          ReserveTagOpt,
          MinimalModelOpt,
          SinglePrecFloatOpt,
+        UseRegionsOpt,
          TypeLayoutOpt,
          InlineAllocOpt, " ",
          AnsiOpt, " ", 
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.299
diff -u -r1.299 handle_options.m
--- compiler/handle_options.m	7 May 2007 06:59:23 -0000	1.299
+++ compiler/handle_options.m	24 May 2007 04:41:34 -0000
@@ -2149,7 +2149,9 @@
                                  % PIC (position independent code)?
      ;       comp_lowlevel       % what to do to target code
      ;       comp_trace          % tracing/debugging options
-    ;       comp_stack_extend.  % automatic stack extension
+    ;       comp_stack_extend   % automatic stack extension
+    ;       comp_regions.       % Whether or not to use region-based memory
+                                % management.

  convert_grade_option(GradeString, Options0, Options) :-
      reset_grade_options(Options0, Options1),
@@ -2485,6 +2487,10 @@
  grade_component_table("stseg", comp_stack_extend,
      [extend_stacks_when_needed - bool(no), stack_segments - bool(yes)],
      no, yes).
+ 
+    % Region-based memory managment components
+grade_component_table("rbmm", comp_regions, [use_regions - bool(yes)],
+    no, yes).

  :- pred reset_grade_options(option_table::in, option_table::out) is det.

Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.562
diff -u -r1.562 options.m
--- compiler/options.m	24 May 2007 01:37:44 -0000	1.562
+++ compiler/options.m	24 May 2007 04:41:34 -0000
@@ -293,7 +293,6 @@
      ;       record_term_sizes_as_words
      ;       record_term_sizes_as_cells
      ;       experimental_complexity
-    ;       region_analysis

      % (c) Miscellaneous
      ;       gc
@@ -307,6 +306,7 @@
      ;       maybe_thread_safe_opt
      ;       extend_stacks_when_needed
      ;       stack_segments
+    ;       use_regions

      % Data representation compilation model options
      ;       reserve_tag
@@ -560,6 +560,7 @@
      ;       distance_granularity
      ;       parallelism_target
      ;       implicit_parallelism
+    ;       region_analysis

      % Stuff for the CTGC system (structure sharing / structure reuse).
      ;       structure_sharing_analysis
@@ -1071,7 +1072,6 @@
      record_term_sizes_as_words          -   bool(no),
      record_term_sizes_as_cells          -   bool(no),
      experimental_complexity             -   string(""),
-    region_analysis                     -   bool(no),
      % (c) Miscellaneous optional features
      gc                                  -   string("boehm"),
      parallel                            -   bool(no),
@@ -1079,6 +1079,7 @@
      maybe_thread_safe_opt               -   string("no"),
      extend_stacks_when_needed           -   bool(no),
      stack_segments                      -   bool(no),
+    use_regions                         -   bool(no),
      use_minimal_model_stack_copy        -   bool(no),
      use_minimal_model_own_stacks        -   bool(no),
      minimal_model_debug                 -   bool(no),
@@ -1330,6 +1331,7 @@
      distance_granularity                -   int(0),
      parallelism_target                  -   int(4),
      implicit_parallelism                -   bool(no),
+    region_analysis                     -   bool(no),

      % HLDS -> LLDS
      smart_indexing                      -   bool(no),
@@ -1848,6 +1850,7 @@
  long_option("maybe-thread-safe",    maybe_thread_safe_opt).
  long_option("extend-stacks-when-needed",    extend_stacks_when_needed).
  long_option("stack-segments",       stack_segments).
+long_option("use-regions",          use_regions).
  % Data representation options
  long_option("reserve-tag",          reserve_tag).
  long_option("use-minimal-model-stack_copy", use_minimal_model_stack_copy).
@@ -3658,8 +3661,6 @@
          "\tlisted in the given file.",
          "\tThis option is supported for the C back-end, with",
          "\t--no-highlevel-code."
-%       "--region-analysis",
-%       "\tEnable the analysis for region based memory management"
      ]),

      io.write_string("      Miscellaneous optional features\n"),
@@ -3704,6 +3705,9 @@
          "--stack-segments",
          "\tSpecify that code that increments a stack pointer must allocate",
          "\ta new stack segment when the limit on the old one is reached."
+        % RBMM is undocumented since it is still experimental.
+        %"--use-regions\t\t(grade modifier: `.rbmm')",
+        %"\tEnable support for region-based memory managment."
      ]),

      io.write_string("\n    LLDS back-end compilation model options:\n"),
@@ -4344,6 +4348,9 @@
          "\tinformation generated by mdprof_feedback.",
          "\tThe profiling feedback file can be specified using the",
          "\t--feedback file option."
+% `--region-analysis' is not documented because it is still experimental.
+%       "--region-analysis",
+%       "\tEnable the analysis for region based-memory management."
      ]).

  :- pred options_help_hlds_llds_optimization(io::di, io::uo) is det.
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.520
diff -u -r1.520 user_guide.texi
--- doc/user_guide.texi	24 May 2007 01:37:47 -0000	1.520
+++ doc/user_guide.texi	24 May 2007 04:41:34 -0000
@@ -7424,6 +7424,11 @@
  precision floats are used by default.
  This option is not yet supported for the IL or Java back-ends.

+ at c RBMM is undocumented since it is still experimental.
+ at c @sp 1
+ at c @item @code{--use-regions} (grades: any grade containing @samp{.rbmm}) 
+ at c Enable support for region-based memory managment."
+
  @end table

  @node Developer compilation model options
@@ -8165,6 +8170,12 @@
  parallelism) using deep profiling feedback information generated by
  mdprof_feedback. The profiling feedback file can be specified using the
  --feedback-file option.
+
+ at c This is not documented because it is still experimental.
+ at c @sp 1
+ at c @item --region-analysis
+ at c @findex --region-analysis
+ at c Enable the analysis for region-based memory management.

  @end table

Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.96
diff -u -r1.96 mercury_conf_param.h
--- runtime/mercury_conf_param.h	13 Apr 2007 04:56:44 -0000	1.96
+++ runtime/mercury_conf_param.h	24 May 2007 04:41:34 -0000
@@ -63,6 +63,7 @@
  ** MR_PIC_REG
  ** MR_HIGHTAGS
  ** MR_TAGBITS
+** MR_USE_REGIONS
  **	See the documentation for
  **		--high-level-code
  **		--high-level-data
@@ -85,6 +86,7 @@
  **		--pic-reg
  **		--tags
  **		--num-tag-bits
+**		--use-regions
  **	(respectively) in the mmc help message or the Mercury User's Guide.
  **
  ** MR_PIC
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.70
diff -u -r1.70 mercury_grade.h
--- runtime/mercury_grade.h	2 Mar 2007 02:56:41 -0000	1.70
+++ runtime/mercury_grade.h	24 May 2007 04:41:34 -0000
@@ -412,8 +412,16 @@
    #define MR_GRADE_OPT_PART_16	MR_GRADE_OPT_PART_15
  #endif

-#define MR_GRADE		MR_GRADE_PART_16
-#define MR_GRADE_OPT		MR_GRADE_OPT_PART_16
+#if defined(MR_USE_REGIONS)
+  #define MR_GRADE_PART_17	MR_PASTE2(MR_GRADE_PART_16, _rbmm)
+  #define MR_GRADE_OPT_PART_17	MR_GRADE_OPT_PART_16 ".rbmm"
+#else
+  #define MR_GRADE_PART_17	MR_GRADE_PART_16
+  #define MR_GRADE_OPT_PART_17	MR_GRADE_OPT_PART_16
+#endif
+
+#define MR_GRADE		MR_GRADE_PART_17
+#define MR_GRADE_OPT		MR_GRADE_OPT_PART_17

  #define MR_GRADE_VAR		MR_PASTE2(MR_grade_,MR_GRADE)
  #define MR_GRADE_STRING 	MR_STRINGIFY(MR_GRADE)
Index: scripts/canonical_grade.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/canonical_grade.sh-subr,v
retrieving revision 1.17
diff -u -r1.17 canonical_grade.sh-subr
--- scripts/canonical_grade.sh-subr	2 Mar 2007 02:56:42 -0000	1.17
+++ scripts/canonical_grade.sh-subr	24 May 2007 04:41:34 -0000
@@ -170,3 +170,9 @@
  			exit 1
  			;;
  esac
+
+case $use_regions in
+	true)		GRADE="$GRADE.rbmm" ;;
+	false)		;;
+esac
+
Index: scripts/init_grade_options.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/init_grade_options.sh-subr,v
retrieving revision 1.28
diff -u -r1.28 init_grade_options.sh-subr
--- scripts/init_grade_options.sh-subr	2 Mar 2007 02:56:42 -0000	1.28
+++ scripts/init_grade_options.sh-subr	24 May 2007 04:41:34 -0000
@@ -51,6 +51,7 @@
  	--low-level-debug
  	--extend-stacks-when-needed
  	--stack-segments
+	--use-regions
  		See the documentation in the \"Invocation\" section
  		of the Mercury User's Guide."

@@ -86,6 +87,7 @@
  ll_debug=false
  extend_stacks=false
  stack_segments=false
+use_regions=false

  case $# in
  	0) set - --grade "$DEFAULT_GRADE" ;;
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.119
diff -u -r1.119 mgnuc.in
--- scripts/mgnuc.in	2 Mar 2007 02:56:42 -0000	1.119
+++ scripts/mgnuc.in	24 May 2007 04:41:34 -0000
@@ -409,6 +409,11 @@
      false)          STACK_SEGMENTS_OPTS="" ;;
  esac

+case $use_regions in
+    true)           REGION_OPTS="-DMR_USE_REGIONS" ;;
+    false)          REGION_OPTS="" ;;
+esac
+
  GCC_OPTS="$NEST_OPTS $ASM_OPTS $GOTO_OPTS $REG_OPTS"

  # check that special grades are only used with gcc
@@ -609,6 +614,7 @@
      $SINGLE_PREC_FLOAT_OPTS\
      $SPLIT_OPTS\
      $THREAD_OPTS\
+    $REGION_OPTS\
      $PICREG_OPTS\
      $ARCH_OPTS\
      $ARG_OPTS\
Index: scripts/parse_grade_options.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/parse_grade_options.sh-subr,v
retrieving revision 1.34
diff -u -r1.34 parse_grade_options.sh-subr
--- scripts/parse_grade_options.sh-subr	2 Mar 2007 02:56:42 -0000	1.34
+++ scripts/parse_grade_options.sh-subr	24 May 2007 04:41:34 -0000
@@ -200,6 +200,11 @@
      --no-stack-segments)
          stack_segments=false ;;

+    --use-regions)
+        use_regions=true;;
+    --no-use-regions)
+        use_regions=false ;; 
+
      -s|--grade)
          shift
          grade="$1";
@@ -237,6 +242,7 @@
          ll_debug=false
          extend_stacks=false
          stack_segments=false
+        use_regions=false

          grade_pieces=`echo $grade | tr '.' ' '`
          for grade_piece in $grade_pieces
@@ -489,6 +495,9 @@
                      stack_segments=true
                      ;;

+                rbmm)
+                    use_regions=true
+                    ;;
                  *)
                      echo "$0: unknown grade component \`$grade_piece'" 1>&2
                      exit 1


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