[m-rev.] for review: fix problem with mmc --make and .mm grades

Julien Fischer juliensf at cs.mu.OZ.AU
Sat Jan 15 00:06:15 AEDT 2005


On Fri, 14 Jan 2005, Zoltan Somogyi wrote:

> > +	% the resulting grade string will contain both and
> > +	% we may end up looking for the library in a directory
> > +	% that doesn't exist.
> > +	%
> > +	(
> > +		string__sub_string_search(Grade0, ".mm", MM_Index),
> > +		string__split(Grade1, MM_Index, MM_LeftPart, MM_RightPart0),
> > +		string__append(".mm", MM_RightPart, MM_RightPart0)
> > +	->
> > +		Grade = MM_LeftPart ++ MM_RightPart
> > +	;
> > +		string__sub_string_search(Grade0, ".dmm", DMM_Index),
> > +		string__split(Grade1, DMM_Index, DMM_LeftPart, DMM_RightPart0),
> > +		string__append(".dmm", DMM_RightPart, DMM_RightPart0)
> > +	->
> > +		Grade = DMM_LeftPart ++ DMM_RightPart
> > +	;
> > +		Grade = Grade1
> >  	).
>
> This looks too hacky to me. The right solution would be to add a flag to
> each entry in grade_component_table to say whether or not it should be used
> in constructing the grade string. That would also handle picreg.
>

I've done so for the minimal model components.  With respect to the
.picreg component, the section of the header in the init files that
contains a comment saying what the grade is differs depending on
whether mmake or mmc --make is being used, when --pic-reg is enabled.

e.g. when using mmake the comment says that the grade is asm_fast.gc,
while with mmc --make it reported as asm_fast.gc.picreg.  Which one
should it be?  For the time being I've just left the handling of
the .picreg as it is.

A new diff and log message that fixes the .mm problem follows:

Estimated hours taken: 2
Branches: main

Fix a bug that has been causing the following tests to
fail on aral in the .mmsc grades.

	grade_subdirs/hello
	mmc_make/hello
	mmc_make/rebuild

The problem was that the grade string returned by
grade_directory_component/2 would contain not only the
.mmsc component but also the .mm  (which is an alternative
name for it).  This was a problem for mmc --make because it
ended up looking for the library in directory that did not
exist.

compiler/handle_options.m:
	In .mmsc and .dmmsc grades, make sure that the
	grade strings returned by grade_directory_component/2
	do not also contain the components .mm and .dmm.

	Fix a typo in a comment:s/procesing/processing/

Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.215
diff -u -r1.215 handle_options.m
--- compiler/handle_options.m	14 Jan 2005 05:56:02 -0000	1.215
+++ compiler/handle_options.m	14 Jan 2005 12:45:26 -0000
@@ -7,7 +7,7 @@
 % File: handle_options.m.
 % Main authors: fjh, zs.

-% This module does post-procesing on the command-line options, after
+% This module does post-processing on the command-line options, after
 % getopt has done its stuff.

 % It also contains code for handling the --grade option.
@@ -1617,7 +1617,8 @@
 	set__init(NoComps),
 	list__foldl2((pred(CompStr::in, Opts0::in, Opts::out,
 			CompSet0::in, CompSet::out) is semidet :-
-		grade_component_table(CompStr, Comp, CompOpts, MaybeTargets),
+		grade_component_table(CompStr, Comp, CompOpts, MaybeTargets,
+			_),
 			% Check that the component isn't mentioned
 			% more than once.
 		\+ set__member(Comp, CompSet0),
@@ -1690,7 +1691,8 @@

 compute_grade_components(Options, GradeComponents) :-
 	solutions((pred(CompData::out) is nondet :-
-		grade_component_table(Name, Comp, CompOpts, MaybeTargets),
+		grade_component_table(Name, Comp, CompOpts, MaybeTargets,
+			IncludeInGradeString),
 			% For possible component of the grade string
 			% include it in the actual grade string if all
 			% the option setting that it implies are true.
@@ -1703,6 +1705,12 @@
 			list__member(Opt - Value, CompOpts),
 			\+ map__search(Options, Opt, Value)
 		),
+
+			% Don't include `.mm' or `.dmm' in grade strings
+			% because they are just synonyms for `.mmsc' and
+			% `.dmmsc' respectively.
+			%
+		IncludeInGradeString = yes,

 			% When checking gcc_ext there exist grades which
 			% can have more then one possible target, ensure that
@@ -1717,11 +1725,18 @@
 		CompData = Comp - Name
 	), GradeComponents).

+	% grade_component_table(ComponetStr, Component,
+	% 	Options, MaybeTargets, IncludeInGradeStr).
+	%
+	% `IncludeInGradeStr' is `yes' if the component should
+	% be included in the grade strings and `no' otherwise.
+	%
 :- pred grade_component_table(string, grade_component,
-	list(pair(option, option_data)), maybe(list(option_data))).
-:- mode grade_component_table(in, out, out, out) is semidet.
-:- mode grade_component_table(out, in, out, out) is multi.
-:- mode grade_component_table(out, out, out, out) is multi.
+	list(pair(option, option_data)), maybe(list(option_data)),
+	bool).
+:- mode grade_component_table(in, out, out, out, out) is semidet.
+:- mode grade_component_table(out, in, out, out, out) is multi.
+:- mode grade_component_table(out, out, out, out, out) is multi.

 	% Base components
 	% These specify the basic compilation model we use,
@@ -1733,7 +1748,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("reg", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1741,7 +1756,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("jump", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(yes),
@@ -1749,7 +1764,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("asm_jump", gcc_ext, [
 		asm_labels		- bool(yes),
 		gcc_non_local_gotos	- bool(yes),
@@ -1757,7 +1772,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("fast", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(yes),
@@ -1765,7 +1780,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("asm_fast", gcc_ext, [
 		asm_labels		- bool(yes),
 		gcc_non_local_gotos	- bool(yes),
@@ -1773,7 +1788,7 @@
 		highlevel_code		- bool(no),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c")])).
+		yes([string("c")]), yes).
 grade_component_table("hl", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1781,7 +1796,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(yes)],
-		yes([string("c"), string("asm")])).
+		yes([string("c"), string("asm")]), yes).
 grade_component_table("hlc", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1789,7 +1804,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("c"), string("asm")])).
+		yes([string("c"), string("asm")]), yes).
 grade_component_table("hl_nest", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1797,7 +1812,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(yes),
 		highlevel_data		- bool(yes)],
-		yes([string("c"), string("asm")])).
+		yes([string("c"), string("asm")]), yes).
 grade_component_table("hlc_nest", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1805,7 +1820,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(yes),
 		highlevel_data		- bool(no)],
-		yes([string("c"), string("asm")])).
+		yes([string("c"), string("asm")]), yes).
 grade_component_table("il", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1813,7 +1828,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(yes)],
-		yes([string("il")])).
+		yes([string("il")]), yes).
 grade_component_table("ilc", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1821,7 +1836,7 @@
 		highlevel_code		- bool(yes),
 		gcc_nested_functions	- bool(no),
 		highlevel_data		- bool(no)],
-		yes([string("il")])).
+		yes([string("il")]), yes).
 grade_component_table("java", gcc_ext, [
 		asm_labels		- bool(no),
 		gcc_non_local_gotos	- bool(no),
@@ -1829,84 +1844,87 @@
 		gcc_nested_functions	- bool(no),
 		highlevel_code		- bool(yes),
 		highlevel_data		- bool(yes)],
-		yes([string("java")])).
+		yes([string("java")]), yes).

 	% Parallelism/multithreading components.
-grade_component_table("par", par, [parallel - bool(yes)], no).
+grade_component_table("par", par, [parallel - bool(yes)], no, yes).

 	% GC components
-grade_component_table("gc", gc, [gc - string("boehm")], no).
-grade_component_table("mps", gc, [gc - string("mps")], no).
-grade_component_table("agc", gc, [gc - string("accurate")], no).
+grade_component_table("gc", gc, [gc - string("boehm")], no, yes).
+grade_component_table("mps", gc, [gc - string("mps")], no, yes).
+grade_component_table("agc", gc, [gc - string("accurate")], no, yes).

 	% Profiling components
 grade_component_table("prof", prof,
 	[profile_time - bool(yes), profile_calls - bool(yes),
-	profile_memory - bool(no), profile_deep - bool(no)], no).
+	profile_memory - bool(no), profile_deep - bool(no)], no, yes).
 grade_component_table("proftime", prof,
 	[profile_time - bool(yes), profile_calls - bool(no),
-	profile_memory - bool(no), profile_deep - bool(no)], no).
+	profile_memory - bool(no), profile_deep - bool(no)], no, yes).
 grade_component_table("profcalls", prof,
 	[profile_time - bool(no), profile_calls - bool(yes),
-	profile_memory - bool(no), profile_deep - bool(no)], no).
+	profile_memory - bool(no), profile_deep - bool(no)], no, yes).
 grade_component_table("memprof", prof,
 	[profile_time - bool(no), profile_calls - bool(yes),
-	profile_memory - bool(yes), profile_deep - bool(no)], no).
+	profile_memory - bool(yes), profile_deep - bool(no)], no, yes).
 grade_component_table("profall", prof,
 	[profile_time - bool(yes), profile_calls - bool(yes),
-	profile_memory - bool(yes), profile_deep - bool(no)], no).
+	profile_memory - bool(yes), profile_deep - bool(no)], no, yes).
 grade_component_table("profdeep", prof,
 	[profile_time - bool(no), profile_calls - bool(no),
-	profile_memory - bool(no), profile_deep - bool(yes)], no).
+	profile_memory - bool(no), profile_deep - bool(yes)], no, yes).

 	% Term size components
 grade_component_table("tsw", term_size,
 	[record_term_sizes_as_words - bool(yes),
-	record_term_sizes_as_cells - bool(no)], no).
+	record_term_sizes_as_cells - bool(no)], no, yes).
 grade_component_table("tsc", term_size,
 	[record_term_sizes_as_words - bool(no),
-	record_term_sizes_as_cells - bool(yes)], no).
+	record_term_sizes_as_cells - bool(yes)], no, yes).

 	% Trailing components
-grade_component_table("tr", trail, [use_trail - bool(yes)], no).
+grade_component_table("tr", trail, [use_trail - bool(yes)], no, yes).

 	% Tag reservation components
-grade_component_table("rt", tag, [reserve_tag - bool(yes)], no).
+grade_component_table("rt", tag, [reserve_tag - bool(yes)], no, yes).

-	% Mimimal model tabling components
+	% Minimal model tabling components
+	% NOTE: We don't include `.mm' and `.dmm' in grade strings
+	% because they are just synonyms fo `.mmsc' and `.dmmsc'.
+	%
 grade_component_table("mm", minimal_model,
 	[use_minimal_model_stack_copy - bool(yes),
 	use_minimal_model_own_stacks - bool(no),
-	minimal_model_debug - bool(no)], no).
+	minimal_model_debug - bool(no)], no, no).
 grade_component_table("dmm", minimal_model,
 	[use_minimal_model_stack_copy - bool(yes),
 	use_minimal_model_own_stacks - bool(no),
-	minimal_model_debug - bool(yes)], no).
+	minimal_model_debug - bool(yes)], no, no).
 grade_component_table("mmsc", minimal_model,
 	[use_minimal_model_stack_copy - bool(yes),
 	use_minimal_model_own_stacks - bool(no),
-	minimal_model_debug - bool(no)], no).
+	minimal_model_debug - bool(no)], no, yes).
 grade_component_table("dmmsc", minimal_model,
 	[use_minimal_model_stack_copy - bool(yes),
 	use_minimal_model_own_stacks - bool(no),
-	minimal_model_debug - bool(yes)], no).
+	minimal_model_debug - bool(yes)], no, yes).
 grade_component_table("mmos", minimal_model,
 	[use_minimal_model_stack_copy - bool(no),
 	use_minimal_model_own_stacks - bool(yes),
-	minimal_model_debug - bool(no)], no).
+	minimal_model_debug - bool(no)], no, yes).
 grade_component_table("dmmos", minimal_model,
 	[use_minimal_model_stack_copy - bool(no),
 	use_minimal_model_own_stacks - bool(yes),
-	minimal_model_debug - bool(yes)], no).
+	minimal_model_debug - bool(yes)], no, yes).

 	% Pic reg components
-grade_component_table("picreg", pic, [pic_reg - bool(yes)], no).
+grade_component_table("picreg", pic, [pic_reg - bool(yes)], no, yes).

 	% Debugging/Tracing components
 grade_component_table("decldebug", trace,
-	[exec_trace - bool(yes), decl_debug - bool(yes)], no).
+	[exec_trace - bool(yes), decl_debug - bool(yes)], no, yes).
 grade_component_table("debug", trace,
-	[exec_trace - bool(yes), decl_debug - bool(no)], no).
+	[exec_trace - bool(yes), decl_debug - bool(no)], no, yes).

 :- pred reset_grade_options(option_table::in, option_table::out) is det.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list