[m-rev.] diff: remove support for legacy purity behaviour for foreign procs
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Jun 16 02:35:06 AEST 2011
Branches: main
Delete the (now unused) notion of legacy purity behaviour for foreign
procs from the compiler.
compiler/prog_data.m:
Delete the (unused) legacy_purity_behaviour field from
the pragma_foreign_proc_attributes structure.
Delete the access predicates for that field.
compiler/purity.m:
Conform to the above change.
compiler/add_pragma.m:
Delete a reference to c_code pragmas in an error message.
Julien.
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.117
diff -u -r1.117 add_pragma.m
--- compiler/add_pragma.m 23 May 2011 05:07:59 -0000 1.117
+++ compiler/add_pragma.m 15 Jun 2011 15:30:25 -0000
@@ -2175,7 +2175,6 @@
pred_info_is_imported(!.PredInfo)
->
Pieces = [words("Error: `:- pragma foreign_proc'"),
- words("(or `pragma c_code')"),
words("declaration for imported"),
simple_call(simple_call_id(PredOrFunc, PredName, Arity)),
suffix("."), nl],
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.227
diff -u -r1.227 prog_data.m
--- compiler/prog_data.m 23 May 2011 05:08:09 -0000 1.227
+++ compiler/prog_data.m 15 Jun 2011 15:11:42 -0000
@@ -996,7 +996,6 @@
foreign_language.
:- func get_tabled_for_io(pragma_foreign_proc_attributes) =
proc_tabled_for_io.
-:- func get_legacy_purity_behaviour(pragma_foreign_proc_attributes) = bool.
:- func get_may_throw_exception(pragma_foreign_proc_attributes) =
proc_may_throw_exception.
:- func get_ordinary_despite_detism(pragma_foreign_proc_attributes) = bool.
@@ -1040,9 +1039,6 @@
:- pred set_may_throw_exception(proc_may_throw_exception::in,
pragma_foreign_proc_attributes::in,
pragma_foreign_proc_attributes::out) is det.
-:- pred set_legacy_purity_behaviour(bool::in,
- pragma_foreign_proc_attributes::in,
- pragma_foreign_proc_attributes::out) is det.
:- pred set_ordinary_despite_detism(bool::in,
pragma_foreign_proc_attributes::in,
pragma_foreign_proc_attributes::out) is det.
@@ -1205,10 +1201,6 @@
attr_terminates :: proc_terminates,
attr_user_annotated_sharing :: user_annotated_sharing,
attr_may_throw_exception :: proc_may_throw_exception,
-
- % There is some special case behaviour for pragma c_code
- % and pragma import purity if legacy_purity_behaviour is `yes'.
- attr_legacy_purity_behaviour :: bool,
attr_ordinary_despite_detism :: bool,
attr_may_modify_trail :: proc_may_modify_trail,
attr_may_call_mm_tabled :: may_call_mm_tabled,
@@ -1225,7 +1217,7 @@
attributes(Language, proc_may_call_mercury, proc_not_thread_safe,
proc_not_tabled_for_io, purity_impure, depends_on_mercury_calls,
no_user_annotated_sharing, default_exception_behaviour,
- no, no, proc_may_modify_trail, default_calls_mm_tabled,
+ no, proc_may_modify_trail, default_calls_mm_tabled,
native_if_possible, proc_default_affects_liveness,
proc_default_allocates_memory, proc_default_registers_roots,
no, []).
@@ -1238,7 +1230,6 @@
get_terminates(Attrs) = Attrs ^ attr_terminates.
get_user_annotated_sharing(Attrs) = Attrs ^ attr_user_annotated_sharing.
get_may_throw_exception(Attrs) = Attrs ^ attr_may_throw_exception.
-get_legacy_purity_behaviour(Attrs) = Attrs ^ attr_legacy_purity_behaviour.
get_ordinary_despite_detism(Attrs) = Attrs ^ attr_ordinary_despite_detism.
get_may_modify_trail(Attrs) = Attrs ^ attr_may_modify_trail.
get_may_call_mm_tabled(Attrs) = Attrs ^ attr_may_call_mm_tabled.
@@ -1265,8 +1256,6 @@
!Attrs ^ attr_user_annotated_sharing := UserSharing.
set_may_throw_exception(MayThrowException, !Attrs) :-
!Attrs ^ attr_may_throw_exception := MayThrowException.
-set_legacy_purity_behaviour(Legacy, !Attrs) :-
- !Attrs ^ attr_legacy_purity_behaviour := Legacy.
set_ordinary_despite_detism(OrdinaryDespiteDetism, !Attrs) :-
!Attrs ^ attr_ordinary_despite_detism := OrdinaryDespiteDetism.
set_may_modify_trail(MayModifyTrail, !Attrs) :-
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.145
diff -u -r1.145 purity.m
--- compiler/purity.m 23 May 2011 05:08:10 -0000 1.145
+++ compiler/purity.m 15 Jun 2011 15:16:27 -0000
@@ -685,23 +685,10 @@
),
GoalExpr = if_then_else(Vars, Cond, Then, Else)
;
- GoalExpr0 = call_foreign_proc(Attributes, PredId, _, _, _, _, _),
- ModuleInfo = !.Info ^ pi_module_info,
- LegacyBehaviour = get_legacy_purity_behaviour(Attributes),
- (
- LegacyBehaviour = yes,
- % Get the purity from the declaration, and set it here so that
- % it is correct for later use.
- module_info_pred_info(ModuleInfo, PredId, PredInfo),
- pred_info_get_purity(PredInfo, Purity),
- set_purity(Purity, Attributes, NewAttributes),
- GoalExpr = GoalExpr0 ^ foreign_attr := NewAttributes
- ;
- LegacyBehaviour = no,
- GoalExpr = GoalExpr0,
- Purity = get_purity(Attributes)
- ),
- ContainsTrace = contains_no_trace_goal
+ GoalExpr0 = call_foreign_proc(Attributes, _, _, _, _, _, _),
+ Purity = get_purity(Attributes),
+ ContainsTrace = contains_no_trace_goal,
+ GoalExpr = GoalExpr0
;
GoalExpr0 = shorthand(ShortHand0),
(
--------------------------------------------------------------------------
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