[m-rev.] for review: new required_feature_set feature
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Jan 24 22:43:09 AEDT 2008
Estimated hours taken: 1
Branches: main
Support a new feature in required_feature_set pragmas that specifies that a
module should be compiled with conservative garbage collection enabled.
This feature is only checked when using the C backends, the other backends
ignore it.
compiler/prog_data.m:
Add the new feature.
compiler/prog_io_pragma.m:
Parse the new feature.
compiler/add_pragma.m:
If a conservative_gc feature is present check that
conservative GC is implied by the current options
and emit an error message if it is not. Do nothing
in the case where `--garbage-collection automatic'
because that implies the use of one of the non-C
backends.
compiler/mercury_to_mercury.m:
Conform to the above change.
doc/reference_manual.texi:
Document the new feature.
Julien.
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.77
diff -u -r1.77 add_pragma.m
--- compiler/add_pragma.m 22 Jan 2008 15:06:08 -0000 1.77
+++ compiler/add_pragma.m 24 Jan 2008 11:39:02 -0000
@@ -3893,6 +3893,32 @@
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
)
+ ;
+ Feature = reqf_conservative_gc,
+ globals.get_gc_method(Globals, GC_Method),
+ (
+ % We consider gc_automatic to be conservative even it may not be.
+ % This is okay because this feature is only of interest with the
+ % C or asm backends. We ignore it if the target language is
+ % something else.
+ %
+ ( GC_Method = gc_automatic
+ ; GC_Method = gc_boehm
+ ; GC_Method = gc_boehm_debug
+ ; GC_Method = gc_mps
+ )
+ ;
+ ( GC_Method = gc_accurate
+ ; GC_Method = gc_none
+ ),
+ Pieces = [
+ words("Error: this module must be compiled in a grade that"),
+ words("uses conservative garbage collection.")
+ ],
+ Msg = simple_msg(Context, [always(Pieces)]),
+ Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
+ !:Specs = [Spec | !.Specs]
+ )
).
%----------------------------------------------------------------------------%
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.324
diff -u -r1.324 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 22 Jan 2008 15:06:12 -0000 1.324
+++ compiler/mercury_to_mercury.m 24 Jan 2008 11:39:02 -0000
@@ -3816,6 +3816,8 @@
add_string("trailing", !U).
mercury_format_required_feature(reqf_strict_sequential, !U) :-
add_string("strict_sequential", !U).
+mercury_format_required_feature(reqf_conservative_gc, !U) :-
+ add_string("conservative_gc", !U).
%-----------------------------------------------------------------------------%
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.202
diff -u -r1.202 prog_data.m
--- compiler/prog_data.m 22 Jan 2008 15:06:14 -0000 1.202
+++ compiler/prog_data.m 24 Jan 2008 11:39:02 -0000
@@ -637,7 +637,8 @@
; reqf_memo
; reqf_parallel_conj
; reqf_trailing
- ; reqf_strict_sequential.
+ ; reqf_strict_sequential
+ ; reqf_conservative_gc.
%-----------------------------------------------------------------------------%
%
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.131
diff -u -r1.131 prog_io_pragma.m
--- compiler/prog_io_pragma.m 10 Jan 2008 04:29:53 -0000 1.131
+++ compiler/prog_io_pragma.m 24 Jan 2008 11:39:04 -0000
@@ -2747,6 +2747,7 @@
string_to_required_feature("parallel_conj", reqf_parallel_conj).
string_to_required_feature("trailing", reqf_trailing).
string_to_required_feature("strict_sequential", reqf_strict_sequential).
+string_to_required_feature("conservative_gc", reqf_conservative_gc).
%-----------------------------------------------------------------------------%
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.418
diff -u -r1.418 reference_manual.texi
--- doc/reference_manual.texi 24 Jan 2008 04:29:36 -0000 1.418
+++ doc/reference_manual.texi 24 Jan 2008 11:39:04 -0000
@@ -10540,9 +10540,15 @@
feature.
@item @samp{strict_sequential}
-This feature specifes that a semantics that is equivalent to the strict
+This feature specifies that a semantics that is equivalent to the strict
sequential operational semantics must be used.
+ at item @samp{conservative_gc}
+This feature specifies that a module requires conservative garbage
+collection.
+This feature is only check when using the C backends, it is ignored
+by the non-C backends.
+
@end table
When a module containing a @samp{pragma require_feature_set} declaration
--------------------------------------------------------------------------
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