diff: fix for bug with polymorphic pragma c_code inlining
Fergus Henderson
fjh at cs.mu.oz.au
Mon May 5 18:59:50 AEST 1997
Hi,
If anyone wants to review this, they're welcome to.
The diff is pretty uninteresting, but the log message describes the
changes.
Fix a bug in inlining of polymorphic pragma c_code procedures.
The bug was that if the actual argument type has a specific type
of say `float', then the C variable for the corresponding formal
parameter will be declared to have type `Float', whereas without
inlining the argument type would have been polymorphic and so
the C variable would have been declared to have type `Word'.
Hence we need to keep track of the original argument types,
before any inlining or specialization has occurred, and use
these original argument types to determine how to declare
the C variables, rather than using the actual argument types
for this particular specialization.
compiler/hlds_goal.m:
Add a new field to pragma_c_code goals, holding the
original argument types (before any inlining or specialization)
of the pragma_c_code procedure.
compiler/make_hlds.m:
Initialize this field with the declared argument types for
the pragma c_code procedure.
compiler/polymorphism.m:
Update this field to account for the inserted type_info variables.
compiler/code_gen.m:
Pass this field to pragma_c_gen.m.
compiler/pragma_c_gen.m:
Use the original argument types field for the pragma variable
declarations, rather than looking up the actual types of the
arguments.
compiler/*.m:
Trivial changes to handle new field.
compiler/live_vars.m:
Comment out some code to avoid a warning about `fail'
in the condition of an if-then-else.
cvs diff: Diffing .
Index: bytecode_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.25
diff -u -r1.25 bytecode_gen.m
--- bytecode_gen.m 1997/03/20 00:33:30 1.25
+++ bytecode_gen.m 1997/05/05 04:45:32
@@ -226,7 +226,7 @@
tree(ElseCode,
EndofIfCode))))))
;
- GoalExpr = pragma_c_code(_, _, _, _, _, _, _),
+ GoalExpr = pragma_c_code(_, _, _, _, _, _, _, _),
Code = node([not_supported]),
ByteInfo = ByteInfo0
).
Index: code_aux.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_aux.m,v
retrieving revision 1.45
diff -u -r1.45 code_aux.m
--- code_aux.m 1997/02/23 06:05:26 1.45
+++ code_aux.m 1997/05/05 04:45:39
@@ -169,7 +169,7 @@
code_aux__goal_is_flat_2(higher_order_call(_, _, _, _, _)).
code_aux__goal_is_flat_2(call(_, _, _, _, _, _)).
code_aux__goal_is_flat_2(unify(_, _, _, _, _)).
-code_aux__goal_is_flat_2(pragma_c_code(_, _, _, _, _, _, _)).
+code_aux__goal_is_flat_2(pragma_c_code(_, _, _, _, _, _, _, _)).
%-----------------------------------------------------------------------------%
Index: code_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_gen.m,v
retrieving revision 1.23
diff -u -r1.23 code_gen.m
--- code_gen.m 1997/04/04 04:41:11 1.23
+++ code_gen.m 1997/05/05 04:50:10
@@ -739,12 +739,13 @@
).
code_gen__generate_det_goal_2(pragma_c_code(C_Code, MayCallMercury,
- PredId, ModeId, Args, ArgNames, Extra), GoalInfo, Instr) -->
+ PredId, ModeId, Args, ArgNames, OrigArgTypes, Extra),
+ GoalInfo, Instr) -->
(
{ Extra = none },
pragma_c_gen__generate_pragma_c_code(model_det, C_Code,
MayCallMercury, PredId, ModeId, Args, ArgNames,
- GoalInfo, Instr)
+ OrigArgTypes, GoalInfo, Instr)
;
{ Extra = extra_pragma_info(_, _) },
{ error("det pragma has non-empty extras field") }
@@ -823,12 +824,13 @@
).
code_gen__generate_semi_goal_2(pragma_c_code(C_Code, MayCallMercury,
- PredId, ModeId, Args, ArgNameMap, Extra), GoalInfo, Instr) -->
+ PredId, ModeId, Args, ArgNameMap, OrigArgTypes, Extra),
+ GoalInfo, Instr) -->
(
{ Extra = none },
pragma_c_gen__generate_pragma_c_code(model_semi, C_Code,
MayCallMercury, PredId, ModeId, Args, ArgNameMap,
- GoalInfo, Instr)
+ OrigArgTypes, GoalInfo, Instr)
;
{ Extra = extra_pragma_info(_, _) },
{ error("semidet pragma has non-empty extras field") }
@@ -999,7 +1001,8 @@
_GoalInfo, _Code) -->
{ error("Cannot have a nondet unification.") }.
code_gen__generate_non_goal_2(pragma_c_code(C_Code, MayCallMercury,
- PredId, ModeId, Args, ArgNameMap, Extra), GoalInfo, Instr) -->
+ PredId, ModeId, Args, ArgNameMap, OrigArgTypes, Extra),
+ GoalInfo, Instr) -->
(
{ Extra = none },
% Error disabled for bootstrapping. string.m uses this form,
@@ -1009,12 +1012,13 @@
% { error("nondet pragma has empty extras field") }
pragma_c_gen__generate_pragma_c_code(model_semi, C_Code,
MayCallMercury, PredId, ModeId, Args, ArgNameMap,
- GoalInfo, Instr)
+ OrigArgTypes, GoalInfo, Instr)
;
{ Extra = extra_pragma_info(SavedVars, LabelNames) },
pragma_c_gen__generate_backtrack_pragma_c_code(model_semi,
C_Code, MayCallMercury, PredId, ModeId, Args,
- ArgNameMap, SavedVars, LabelNames, GoalInfo, Instr)
+ ArgNameMap, OrigArgTypes, SavedVars, LabelNames,
+ GoalInfo, Instr)
).
%---------------------------------------------------------------------------%
Index: code_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_util.m,v
retrieving revision 1.84
diff -u -r1.84 code_util.m
--- code_util.m 1997/03/21 10:25:39 1.84
+++ code_util.m 1997/05/05 04:50:18
@@ -775,7 +775,8 @@
code_util__count_recursive_calls(Goal, PredId, ProcId, Min, Max).
code_util__count_recursive_calls_2(unify(_, _, _, _, _), _, _, 0, 0).
code_util__count_recursive_calls_2(higher_order_call(_,_, _, _, _), _, _, 0, 0).
-code_util__count_recursive_calls_2(pragma_c_code(_,_,_,_, _, _, _), _, _, 0, 0).
+code_util__count_recursive_calls_2(pragma_c_code(_,_,_,_, _, _, _, _), _, _,
+ 0, 0).
code_util__count_recursive_calls_2(call(CallPredId, CallProcId, _, _, _, _),
PredId, ProcId, Count, Count) :-
(
Index: constraint.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/constraint.m,v
retrieving revision 1.31
diff -u -r1.31 constraint.m
--- constraint.m 1997/02/23 06:05:41 1.31
+++ constraint.m 1997/05/05 04:50:26
@@ -189,8 +189,8 @@
mode_checkpoint(exit, "unify").
constraint__propagate_goal_2(
- pragma_c_code(A, B, C, D, E, F, G),
- pragma_c_code(A, B, C, D, E, F, G)) -->
+ pragma_c_code(A, B, C, D, E, F, G, H),
+ pragma_c_code(A, B, C, D, E, F, G, H)) -->
mode_checkpoint(enter, "pragma_c_code"),
mode_checkpoint(exit, "pragma_c_code").
Index: cse_detection.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/cse_detection.m,v
retrieving revision 1.41
diff -u -r1.41 cse_detection.m
--- cse_detection.m 1997/04/07 05:39:10 1.41
+++ cse_detection.m 1997/05/05 04:50:52
@@ -200,8 +200,8 @@
cse_info, cse_info, bool, hlds_goal_expr).
:- mode detect_cse_in_goal_2(in, in, in, in, out, out, out) is det.
-detect_cse_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _, _, CseInfo, CseInfo, no,
- pragma_c_code(A,B,C,D,E,F,G)).
+detect_cse_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), _, _, CseInfo, CseInfo,
+ no, pragma_c_code(A,B,C,D,E,F,G,H)).
detect_cse_in_goal_2(higher_order_call(A,B,C,D,E), _, _, CseInfo, CseInfo, no,
higher_order_call(A,B,C,D,E)).
Index: dead_proc_elim.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.26
diff -u -r1.26 dead_proc_elim.m
--- dead_proc_elim.m 1997/04/07 05:39:11 1.26
+++ dead_proc_elim.m 1997/05/05 04:51:01
@@ -387,7 +387,7 @@
NewNotation = yes(1),
map__set(Needed0, proc(PredId, ProcId), NewNotation, Needed)
).
-dead_proc_elim__examine_expr(pragma_c_code(_, _, PredId, ProcId, _, _, _),
+dead_proc_elim__examine_expr(pragma_c_code(_, _, PredId, ProcId, _, _, _, _),
_CurrProc, Queue0, Queue, Needed0, Needed) :-
queue__put(Queue0, proc(PredId, ProcId), Queue),
map__set(Needed0, proc(PredId, ProcId), no, Needed).
Index: dependency_graph.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dependency_graph.m,v
retrieving revision 1.27
diff -u -r1.27 dependency_graph.m
--- dependency_graph.m 1997/02/23 06:05:52 1.27
+++ dependency_graph.m 1997/05/05 04:51:07
@@ -256,7 +256,7 @@
).
% There can be no dependencies within a pragma_c_code
-dependency_graph__add_arcs_in_goal_2(pragma_c_code(_, _, _, _, _, _, _), _,
+dependency_graph__add_arcs_in_goal_2(pragma_c_code(_, _, _, _, _, _, _, _), _,
DepGraph, DepGraph).
%-----------------------------------------------------------------------------%
Index: det_analysis.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/det_analysis.m,v
retrieving revision 1.113
diff -u -r1.113 det_analysis.m
--- det_analysis.m 1997/04/07 05:39:13 1.113
+++ det_analysis.m 1997/05/05 04:51:28
@@ -556,10 +556,10 @@
% pragma c_codes are handled in the same way as predicate calls
det_infer_goal_2(pragma_c_code(C_Code, IsRecursive, PredId, ProcId, Args,
- ArgNameMap, Extra),
+ ArgNameMap, OrigArgTypes, Extra),
GoalInfo, _, SolnContext, DetInfo, _, _,
pragma_c_code(C_Code, IsRecursive, PredId, ProcId, Args,
- ArgNameMap, Extra),
+ ArgNameMap, OrigArgTypes, Extra),
Detism, Msgs) :-
det_lookup_detism(DetInfo, PredId, ProcId, Detism0),
determinism_components(Detism0, CanFail, NumSolns0),
Index: det_report.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/det_report.m,v
retrieving revision 1.32
diff -u -r1.32 det_report.m
--- det_report.m 1997/02/23 06:06:00 1.32
+++ det_report.m 1997/05/05 04:51:34
@@ -524,7 +524,7 @@
det_diagnose_goal(Goal, InternalDesired, SwitchContext, DetInfo,
Diagnosed).
-det_diagnose_goal_2(pragma_c_code(_, _, _, _, _, _, _), GoalInfo, Desired,
+det_diagnose_goal_2(pragma_c_code(_, _, _, _, _, _, _, _), GoalInfo, Desired,
_, _, _, yes) -->
{ goal_info_get_context(GoalInfo, Context) },
prog_out__write_context(Context),
Index: dnf.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/dnf.m,v
retrieving revision 1.18
diff -u -r1.18 dnf.m
--- dnf.m 1997/04/07 05:39:15 1.18
+++ dnf.m 1997/05/05 04:51:49
@@ -230,7 +230,7 @@
NewPredIds = NewPredIds0,
Goal = Goal0
;
- GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _),
+ GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _, _),
ModuleInfo = ModuleInfo0,
NewPredIds = NewPredIds0,
Goal = Goal0
@@ -450,7 +450,7 @@
dnf__is_atomic_expr(some(_, GoalExpr - _), IsAtomic) :-
dnf__is_atomic_expr(GoalExpr, IsAtomic).
dnf__is_atomic_expr(if_then_else(_, _, _, _, _), no).
-dnf__is_atomic_expr(pragma_c_code(_, _, _, _, _, _, _), yes).
+dnf__is_atomic_expr(pragma_c_code(_, _, _, _, _, _, _, _), yes).
:- pred dnf__expr_free_of_nonatomic(hlds_goal_expr::in,
set(pred_proc_id)::in) is semidet.
@@ -472,7 +472,7 @@
dnf__goal_free_of_nonatomic(Cond, NonAtomic),
dnf__goal_free_of_nonatomic(Then, NonAtomic),
dnf__goal_free_of_nonatomic(Else, NonAtomic).
-dnf__expr_free_of_nonatomic(pragma_c_code(_, _, _, _, _, _, _), _NonAtomic).
+dnf__expr_free_of_nonatomic(pragma_c_code(_, _, _, _, _, _, _, _), _NonAtomic).
:- pred dnf__goal_free_of_nonatomic(hlds_goal::in,
set(pred_proc_id)::in) is semidet.
Index: excess.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/excess.m,v
retrieving revision 1.20
diff -u -r1.20 excess.m
--- excess.m 1997/04/07 05:39:16 1.20
+++ excess.m 1997/05/05 04:51:57
@@ -128,7 +128,7 @@
Goal = GoalExpr0 - GoalInfo0,
ElimVars = ElimVars0
;
- GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _),
+ GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _, _),
Goal = GoalExpr0 - GoalInfo0,
ElimVars = ElimVars0
),
Index: follow_code.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/follow_code.m,v
retrieving revision 1.38
diff -u -r1.38 follow_code.m
--- follow_code.m 1997/02/23 06:06:19 1.38
+++ follow_code.m 1997/05/05 04:52:08
@@ -114,8 +114,8 @@
move_follow_code_in_goal_2(unify(A,B,C,D,E), unify(A,B,C,D,E), _, R, R).
-move_follow_code_in_goal_2(pragma_c_code(A,B,C,D,E,F,G),
- pragma_c_code(A,B,C,D,E,F,G), _, R, R).
+move_follow_code_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H),
+ pragma_c_code(A,B,C,D,E,F,G,H), _, R, R).
%-----------------------------------------------------------------------------%
Index: follow_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/follow_vars.m,v
retrieving revision 1.40
diff -u -r1.40 follow_vars.m
--- follow_vars.m 1997/04/07 05:39:19 1.40
+++ follow_vars.m 1997/05/05 04:52:26
@@ -194,8 +194,9 @@
FollowVars = FollowVars0
).
-find_follow_vars_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _ArgInfo, _ModuleInfo,
- FollowVars, pragma_c_code(A,B,C,D,E,F,G), FollowVars).
+find_follow_vars_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), _ArgInfo,
+ _ModuleInfo, FollowVars,
+ pragma_c_code(A,B,C,D,E,F,G,H), FollowVars).
%-----------------------------------------------------------------------------%
Index: goal_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/goal_util.m,v
retrieving revision 1.35
diff -u -r1.35 goal_util.m
--- goal_util.m 1997/04/07 05:39:22 1.35
+++ goal_util.m 1997/05/05 04:52:52
@@ -235,8 +235,8 @@
goal_util__rename_unify_rhs(TermR0, Must, Subn, TermR),
goal_util__rename_unify(Unify0, Must, Subn, Unify).
-goal_util__name_apart_2(pragma_c_code(A,B,C,D,Vars0,F,Extra0), Must, Subn,
- pragma_c_code(A,B,C,D,Vars,F,Extra)) :-
+goal_util__name_apart_2(pragma_c_code(A,B,C,D,Vars0,F,G,Extra0), Must, Subn,
+ pragma_c_code(A,B,C,D,Vars,F,G,Extra)) :-
goal_util__rename_var_list(Vars0, Must, Subn, Vars),
(
Extra0 = none,
@@ -442,7 +442,7 @@
goal_util__goal_vars_2(B, Set2, Set3),
goal_util__goal_vars_2(C, Set3, Set).
-goal_util__goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, Extra),
+goal_util__goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, _, Extra),
Set0, Set) :-
set__insert_list(Set0, ArgVars, Set1),
(
@@ -536,7 +536,7 @@
goal_expr_size(call(_, _, _, _, _, _), 1).
goal_expr_size(higher_order_call(_, _, _, _, _), 1).
goal_expr_size(unify(_, _, _, _, _), 1).
-goal_expr_size(pragma_c_code(_, _, _, _, _, _, _), 1).
+goal_expr_size(pragma_c_code(_, _, _, _, _, _, _, _), 1).
%-----------------------------------------------------------------------------%
Index: higher_order.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/higher_order.m,v
retrieving revision 1.25
diff -u -r1.25 higher_order.m
--- higher_order.m 1997/04/07 05:39:24 1.25
+++ higher_order.m 1997/05/05 04:52:58
@@ -324,7 +324,7 @@
traverse_goal(Goal0, Goal, PredProcId, Changed, GoalSize).
traverse_goal(Goal, Goal, _, unchanged, 1) -->
- { Goal = pragma_c_code(_, _, _, _, _, _, _) - _ }.
+ { Goal = pragma_c_code(_, _, _, _, _, _, _, _) - _ }.
traverse_goal(Goal, Goal, _, unchanged, 1) -->
{ Goal = unify(_, _, _, Unify, _) - _ },
Index: hlds_goal.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_goal.m,v
retrieving revision 1.30
diff -u -r1.30 hlds_goal.m
--- hlds_goal.m 1997/03/24 06:02:21 1.30
+++ hlds_goal.m 1997/05/05 04:53:14
@@ -155,6 +155,9 @@
% type_info variables introduced by
% polymorphism.m might be represented
% in this way).
+ list(type), % The original types of the arguments.
+ % (With inlining, the actual types may
+ % be instances of the original types.)
extra_pragma_info
% Extra information for model_non
% pragma_c_codes; none for others.
@@ -817,7 +820,7 @@
goal_is_atomic(higher_order_call(_,_,_,_,_)).
goal_is_atomic(call(_,_,_,_,_,_)).
goal_is_atomic(unify(_,_,_,_,_)).
-goal_is_atomic(pragma_c_code(_,_,_,_,_,_,_)).
+goal_is_atomic(pragma_c_code(_,_,_,_,_,_,_,_)).
%-----------------------------------------------------------------------------%
Index: hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.158
diff -u -r1.158 hlds_out.m
--- hlds_out.m 1997/03/06 05:09:05 1.158
+++ hlds_out.m 1997/05/05 04:53:47
@@ -996,8 +996,8 @@
[]
).
-hlds_out__write_goal_2(pragma_c_code(C_Code, _, _, _, ArgVars, ArgNames, Extra),
- _, _, _, Indent, Follow, _) -->
+hlds_out__write_goal_2(pragma_c_code(C_Code, _, _, _, ArgVars, ArgNames, _,
+ Extra), _, _, _, Indent, Follow, _) -->
hlds_out__write_indent(Indent),
io__write_string("$pragma(c_code, ["),
hlds_out__write_varnum_list(ArgVars),
Index: inlining.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/inlining.m,v
retrieving revision 1.60
diff -u -r1.60 inlining.m
--- inlining.m 1997/04/07 05:39:28 1.60
+++ inlining.m 1997/05/05 04:54:12
@@ -226,7 +226,7 @@
% have to make sure it doesn't get inlined because that stops
% it from working.
\+ {
- CalledGoal = pragma_c_code(_,_,_,_,_,_,none) - _,
+ CalledGoal = pragma_c_code(_,_,_,_,_,_,_,none) - _,
proc_info_interface_code_model(ProcInfo, model_non)
}
->
@@ -473,8 +473,8 @@
inlining__inlining_in_goal_2(unify(A, B, C, D, E), Varset, VarTypes,
_, _, _, _, unify(A, B, C, D, E), Varset, VarTypes).
-inlining__inlining_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), Varset, VarTypes,
- _, _, _, _, pragma_c_code(A,B,C,D,E,F,G), Varset, VarTypes).
+inlining__inlining_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), Varset, VarTypes,
+ _, _, _, _, pragma_c_code(A,B,C,D,E,F,G,H), Varset, VarTypes).
%-----------------------------------------------------------------------------%
Index: intermod.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/intermod.m,v
retrieving revision 1.22
diff -u -r1.22 intermod.m
--- intermod.m 1997/04/08 02:26:17 1.22
+++ intermod.m 1997/05/05 04:55:56
@@ -399,8 +399,8 @@
% Inlineable exported pragma_c_code goals can't use any
% non-exported types, so we just write out the clauses.
-intermod__traverse_goal(pragma_c_code(A,B,C,D,E,F,G) - Info,
- pragma_c_code(A,B,C,D,E,F,G) - Info, yes) --> [].
+intermod__traverse_goal(pragma_c_code(A,B,C,D,E,F,G,H) - Info,
+ pragma_c_code(A,B,C,D,E,F,G,H) - Info, yes) --> [].
:- pred intermod__traverse_list_of_goals(hlds_goals::in, hlds_goals::out,
@@ -971,14 +971,14 @@
{ Goal = conj(Goals) - _ },
{ list__filter(
lambda([X::in] is semidet, (
- X = pragma_c_code(_,_,_,_,_,_,_) - _
+ X = pragma_c_code(_,_,_,_,_,_,_,_) - _
)),
Goals, [CCodeGoal]) },
{ CCodeGoal = pragma_c_code(CCode, MayCallMercury,
- _, _, Vars, _, _) - _ }
+ _, _, Vars, _, _, _) - _ }
;
{ Goal = pragma_c_code(CCode, MayCallMercury,
- _, _, Vars, _, _) - _ }
+ _, _, Vars, _, _, _) - _ }
)
->
intermod__write_c_clauses(Procs, ProcIds, PredOrFunc, CCode,
Index: lambda.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/lambda.m,v
retrieving revision 1.25
diff -u -r1.25 lambda.m
--- lambda.m 1997/04/07 05:39:31 1.25
+++ lambda.m 1997/05/05 04:56:07
@@ -182,8 +182,8 @@
lambda__process_goal_2(call(A,B,C,D,E,F), GoalInfo,
call(A,B,C,D,E,F) - GoalInfo) -->
[].
-lambda__process_goal_2(pragma_c_code(A,B,C,D,E,F,G), GoalInfo,
- pragma_c_code(A,B,C,D,E,F,G) - GoalInfo) -->
+lambda__process_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), GoalInfo,
+ pragma_c_code(A,B,C,D,E,F,G,H) - GoalInfo) -->
[].
:- pred lambda__process_goal_list(list(hlds_goal), list(hlds_goal),
Index: lco.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/lco.m,v
retrieving revision 1.4
diff -u -r1.4 lco.m
--- lco.m 1997/02/23 06:06:45 1.4
+++ lco.m 1997/05/05 04:56:19
@@ -87,7 +87,8 @@
lco_in_goal_2(unify(A,B,C,D,E), _ModuleInfo, unify(A,B,C,D,E)).
-lco_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _, pragma_c_code(A,B,C,D,E,F,G)).
+lco_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), _,
+ pragma_c_code(A,B,C,D,E,F,G,H)).
%-----------------------------------------------------------------------------%
Index: live_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/live_vars.m,v
retrieving revision 1.62
diff -u -r1.62 live_vars.m
--- live_vars.m 1997/04/07 05:39:32 1.62
+++ live_vars.m 1997/05/05 05:54:46
@@ -132,6 +132,7 @@
% Add extra interference for variables that become live
% and variables that be come dead in this goal.
(
+/*******
% goal_is_atomic(Goal0)
fail
% NB: `fail' is a conservative approximation
@@ -141,6 +142,7 @@
set__union(PreBirths, PostDeaths, ExtraInterference),
set__insert(LiveSets2, ExtraInterference, LiveSets)
;
+*******/
LiveSets = LiveSets2
).
@@ -302,7 +304,7 @@
).
build_live_sets_in_goal_2(pragma_c_code(_, MayCallMercury, PredId, ProcId,
- Args, _, Extra), Liveness, ResumeVars0, LiveSets0,
+ Args, _, _, Extra), Liveness, ResumeVars0, LiveSets0,
GoalInfo, ModuleInfo, ProcInfo,
Liveness, ResumeVars, LiveSets) :-
Index: liveness.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/liveness.m,v
retrieving revision 1.69
diff -u -r1.69 liveness.m
--- liveness.m 1997/02/23 06:06:49 1.69
+++ liveness.m 1997/05/05 04:57:11
@@ -214,7 +214,7 @@
detect_liveness_in_goal_2(unify(_,_,_,_,_), _, _, _, _, _) :-
error("unify in detect_liveness_in_goal_2").
-detect_liveness_in_goal_2(pragma_c_code(_,_,_,_,_,_,_), _, _, _, _, _) :-
+detect_liveness_in_goal_2(pragma_c_code(_,_,_,_,_,_,_,_), _, _, _, _, _) :-
error("pragma_c_code in detect_liveness_in_goal_2").
%-----------------------------------------------------------------------------%
@@ -389,7 +389,7 @@
detect_deadness_in_goal_2(unify(_,_,_,_,_), _, _, _, _, _) :-
error("unify in detect_deadness_in_goal_2").
-detect_deadness_in_goal_2(pragma_c_code(_,_,_,_,_,_,_), _, _, _, _, _) :-
+detect_deadness_in_goal_2(pragma_c_code(_,_,_,_,_,_,_,_), _, _, _, _, _) :-
error("pragma_c_code in detect_deadness_in_goal_2").
%-----------------------------------------------------------------------------%
@@ -606,8 +606,9 @@
detect_resume_points_in_goal_2(unify(A,B,C,D,E), _, Liveness, _, _,
unify(A,B,C,D,E), Liveness).
-detect_resume_points_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _, Liveness, _, _,
- pragma_c_code(A,B,C,D,E,F,G), Liveness).
+detect_resume_points_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), _, Liveness,
+ _, _,
+ pragma_c_code(A,B,C,D,E,F,G,H), Liveness).
:- pred detect_resume_points_in_conj(list(hlds_goal), set(var), live_info,
set(var), list(hlds_goal), set(var)).
Index: make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.228
diff -u -r1.228 make_hlds.m
--- make_hlds.m 1997/04/21 07:10:34 1.228
+++ make_hlds.m 1997/05/05 05:04:27
@@ -1673,9 +1673,10 @@
ModuleInfo0, ProcId) }
->
{ pred_info_clauses_info(PredInfo1, Clauses0) },
+ { pred_info_arg_types(PredInfo1, _TVarSet, ArgTypes) },
clauses_info_add_pragma_c_code(Clauses0,
MayCallMercury, PredId, ProcId, VarSet,
- PVars, C_Code, Context, ExtraInfo,
+ PVars, ArgTypes, C_Code, Context, ExtraInfo,
Clauses, Goal, Info0, Info),
{ pred_info_set_clauses_info(PredInfo1, Clauses,
PredInfo2) },
@@ -1949,7 +1950,7 @@
warn_singletons_in_unify(Var, RHS, GoalInfo, QuantVars, VarSet,
PredCallId).
-warn_singletons_in_goal_2(pragma_c_code(C_Code, _, _, _, _, ArgNames, _),
+warn_singletons_in_goal_2(pragma_c_code(C_Code, _, _, _, _, ArgNames, _, _),
GoalInfo, _QuantVars, _VarSet, PredCallId) -->
{ goal_info_get_context(GoalInfo, Context) },
warn_singletons_in_pragma_c_code(C_Code, ArgNames, Context,
@@ -2277,14 +2278,15 @@
% hlds_goal.
:- pred clauses_info_add_pragma_c_code(clauses_info, may_call_mercury,
- pred_id, proc_id, varset, list(pragma_var), string, term__context,
+ pred_id, proc_id, varset, list(pragma_var), list(type),
+ string, term__context,
maybe(pair(list(string))), clauses_info, hlds_goal,
qual_info, qual_info, io__state, io__state) is det.
-:- mode clauses_info_add_pragma_c_code(in, in, in, in, in, in, in, in, in,
+:- mode clauses_info_add_pragma_c_code(in, in, in, in, in, in, in, in, in, in,
out, out, in, out, di, uo) is det.
clauses_info_add_pragma_c_code(ClausesInfo0, MayCallMercury, PredId, ModeId,
- PVarSet, PVars, C_Code, Context, ExtraInfo,
+ PVarSet, PVars, OrigArgTypes, C_Code, Context, ExtraInfo,
ClausesInfo, HldsGoal, Info0, Info) -->
{
ClausesInfo0 = clauses_info(VarSet0, VarTypes, VarTypes1,
@@ -2312,7 +2314,7 @@
goal_info_init(GoalInfo0),
goal_info_set_context(GoalInfo0, Context, GoalInfo),
HldsGoal0 = pragma_c_code(C_Code, MayCallMercury, PredId, ModeId, Args,
- Names, ExtraPragmaInfo) - GoalInfo
+ Names, OrigArgTypes, ExtraPragmaInfo) - GoalInfo
},
% Insert unifications with the head args.
insert_arg_unifications(HeadVars, TermArgs, Context, head, HldsGoal0,
Index: mercury_to_c.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_c.m,v
retrieving revision 1.23
diff -u -r1.23 mercury_to_c.m
--- mercury_to_c.m 1997/03/06 05:09:26 1.23
+++ mercury_to_c.m 1997/05/05 05:04:32
@@ -670,7 +670,7 @@
c_gen_goal_2(unify(_A, _B, _, Unification, _), Indent, CGenInfo0, CGenInfo) -->
c_gen_unification(Unification, Indent, CGenInfo0, CGenInfo).
-c_gen_goal_2(pragma_c_code(C_Code, _, _, _, _, ArgNames, _), _, _, _) -->
+c_gen_goal_2(pragma_c_code(C_Code, _, _, _, _, ArgNames, _, _), _, _, _) -->
{ sorry(4) },
{ get_pragma_c_var_names(ArgNames, Names) },
io__write_string("$pragma(c_code, ["),
Index: mode_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mode_util.m,v
retrieving revision 1.85
diff -u -r1.85 mode_util.m
--- mode_util.m 1997/04/08 02:26:25 1.85
+++ mode_util.m 1997/05/05 05:05:59
@@ -1562,8 +1562,8 @@
recompute_instmap_delta_unify(Uni, UniMode0, UniMode,
GoalInfo, InstMap, InstMapDelta).
-recompute_instmap_delta_2(_, pragma_c_code(A, B, PredId, ProcId, Args, F, G), _,
- pragma_c_code(A, B, PredId, ProcId, Args, F, G),
+recompute_instmap_delta_2(_, pragma_c_code(A, B, PredId, ProcId, Args, F, G,
+ H), _, pragma_c_code(A, B, PredId, ProcId, Args, F, G, H),
InstMap, InstMapDelta) -->
recompute_instmap_delta_call(PredId, ProcId,
Args, InstMap, InstMapDelta).
Index: modes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/modes.m,v
retrieving revision 1.197
diff -u -r1.197 modes.m
--- modes.m 1997/04/21 13:40:05 1.197
+++ modes.m 1997/05/05 05:06:36
@@ -820,7 +820,7 @@
% to modecheck a pragma_c_code, we just modecheck the proc for
% which it is the goal.
modecheck_goal_expr(pragma_c_code(IsRecursive, C_Code, PredId, _ProcId0, Args0,
- ArgNameMap, ExtraPragmaInfo), GoalInfo, Goal) -->
+ ArgNameMap, OrigArgTypes, ExtraPragmaInfo), GoalInfo, Goal) -->
mode_checkpoint(enter, "pragma_c_code"),
mode_info_set_call_context(call(PredId)),
@@ -830,7 +830,7 @@
=(ModeInfo),
{ Pragma = pragma_c_code(IsRecursive, C_Code, PredId, ProcId, Args0,
- ArgNameMap, ExtraPragmaInfo) },
+ ArgNameMap, OrigArgTypes, ExtraPragmaInfo) },
{ handle_extra_goals(Pragma, ExtraGoals, GoalInfo, Args0, Args,
InstMap0, ModeInfo, Goal) },
Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.101
diff -u -r1.101 polymorphism.m
--- polymorphism.m 1997/04/07 05:39:41 1.101
+++ polymorphism.m 1997/05/05 05:55:12
@@ -573,7 +573,8 @@
polymorphism__process_goal(C0, C).
polymorphism__process_goal_expr(pragma_c_code(IsRecursive, C_Code, PredId,
- ProcId, ArgVars0, ArgNames0, ExtraInfo), GoalInfo, Goal) -->
+ ProcId, ArgVars0, ArgNames0, OrigArgTypes0, ExtraInfo),
+ GoalInfo, Goal) -->
polymorphism__process_call(PredId, ProcId, ArgVars0,
ArgVars, ExtraVars, ExtraGoals),
%
@@ -597,10 +598,20 @@
PredTypeVarSet, ArgNames0, ArgNames) },
%
+ % insert type_info types for all the inserted type_info vars
+ % into the arg-types list
+ %
+ { MakeType = lambda([TypeVar::in, TypeInfoType::out] is det,
+ construct_type(qualified("mercury_builtin", "type_info") - 1,
+ [term__variable(TypeVar)], TypeInfoType)) },
+ { list__map(MakeType, PredTypeVars, TypeInfoTypes) },
+ { list__append(TypeInfoTypes, OrigArgTypes0, OrigArgTypes) },
+
+ %
% plug it all back together
%
{ Call = pragma_c_code(IsRecursive, C_Code, PredId, ProcId, ArgVars,
- ArgNames, ExtraInfo) - CallGoalInfo },
+ ArgNames, OrigArgTypes, ExtraInfo) - CallGoalInfo },
{ list__append(ExtraGoals, [Call], GoalList) },
{ conj_list_to_goal(GoalList, GoalInfo, Goal) }.
Index: pragma_c_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.6
diff -u -r1.6 pragma_c_gen.m
--- pragma_c_gen.m 1997/02/23 06:07:39 1.6
+++ pragma_c_gen.m 1997/05/05 06:02:47
@@ -27,14 +27,14 @@
:- pred pragma_c_gen__generate_pragma_c_code(code_model::in, string::in,
may_call_mercury::in, pred_id::in, proc_id::in, list(var)::in,
- list(maybe(string))::in, hlds_goal_info::in, code_tree::out,
- code_info::in, code_info::out) is det.
+ list(maybe(string))::in, list(type)::in, hlds_goal_info::in,
+ code_tree::out, code_info::in, code_info::out) is det.
:- pred pragma_c_gen__generate_backtrack_pragma_c_code(code_model::in,
string::in, may_call_mercury::in, pred_id::in, proc_id::in,
- list(var)::in, list(maybe(string))::in, list(pair(var, string))::in,
- list(string)::in, hlds_goal_info::in, code_tree::out,
- code_info::in, code_info::out) is erroneous.
+ list(var)::in, list(maybe(string))::in, list(type)::in,
+ list(pair(var, string))::in, list(string)::in, hlds_goal_info::in,
+ code_tree::out, code_info::in, code_info::out) is erroneous.
%---------------------------------------------------------------------------%
@@ -88,7 +88,7 @@
% there is nothing that needs restoring.
pragma_c_gen__generate_pragma_c_code(CodeModel, C_Code, MayCallMercury,
- PredId, ProcId, Args, Names, _GoalInfo, Code) -->
+ PredId, ProcId, Args, Names, OrigArgTypes, _GoalInfo, Code) -->
% First we need to get a list of input and output arguments
code_info__get_pred_proc_arginfo(PredId, ProcId, ArgInfo),
{ make_c_arg_list(Args, Names, ArgNames) },
@@ -111,7 +111,7 @@
call_gen__save_variables(OutArgsSet, SaveVarsCode)
),
- make_pragma_decls(ArgNames, Decls),
+ { make_pragma_decls(ArgNames, OrigArgTypes, Decls) },
get_pragma_input_vars(InArgs, Inputs, InputVarsCode),
( { CodeModel = model_semi } ->
% We have to clear r1 for C code that gets inlined
@@ -265,21 +265,23 @@
% data structure in the llds. It is essentially a list of pairs of type and
% variable name, so that declarations of the form "Type Name;" can be made.
-:- pred make_pragma_decls(list(c_arg)::in, list(pragma_c_decl)::out,
- code_info::in, code_info::out) is det.
+:- pred make_pragma_decls(list(c_arg)::in, list(type)::in,
+ list(pragma_c_decl)::out) is det.
-make_pragma_decls([], []) --> [].
-make_pragma_decls([c_arg(Arg, ArgName) | ArgNames], Decls) -->
- ( { ArgName = yes(Name) } ->
- code_info__variable_type(Arg, Type),
- { Decl = pragma_c_decl(Type, Name) },
- { Decls = [Decl | Decls1] },
- make_pragma_decls(ArgNames, Decls1)
+make_pragma_decls([], [], []).
+make_pragma_decls([c_arg(_Arg, ArgName) | ArgNames], [OrigType | OrigTypes],
+ Decls) :-
+ ( ArgName = yes(Name) ->
+ Decl = pragma_c_decl(OrigType, Name),
+ Decls = [Decl | Decls1],
+ make_pragma_decls(ArgNames, OrigTypes, Decls1)
;
% if the variable doesn't occur in the ArgNames list,
% it can't be used, so we just ignore it
- make_pragma_decls(ArgNames, Decls)
+ make_pragma_decls(ArgNames, OrigTypes, Decls)
).
+make_pragma_decls([_|_], [], _) :- error("make_pragma_decls: length mismatch").
+make_pragma_decls([], [_|_], _) :- error("make_pragma_decls: length mismatch").
%---------------------------------------------------------------------------%
@@ -345,8 +347,8 @@
%---------------------------------------------------------------------------%
-pragma_c_gen__generate_backtrack_pragma_c_code(_, _, _, _, _, _, _, _, _,
+pragma_c_gen__generate_backtrack_pragma_c_code(_, _, _, _, _, _, _, _, _, _,
_, _) -->
- { error("nondet pragma_c_codes not yet implemented") }.
+ { error("Sorry, nondet pragma_c_codes not yet implemented") }.
%---------------------------------------------------------------------------%
Index: quantification.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/quantification.m,v
retrieving revision 1.47
diff -u -r1.47 quantification.m
--- quantification.m 1997/02/23 06:07:54 1.47
+++ quantification.m 1997/05/05 05:39:24
@@ -307,8 +307,8 @@
{ set__union(NonLocalVars1, NonLocalVars2, NonLocalVars) },
quantification__set_nonlocals(NonLocalVars).
-implicitly_quantify_goal_2(pragma_c_code(A,B,C,D,Vars,F,G), _,
- pragma_c_code(A,B,C,D,Vars,F,G)) -->
+implicitly_quantify_goal_2(pragma_c_code(A,B,C,D,Vars,F,G,H), _,
+ pragma_c_code(A,B,C,D,Vars,F,G,H)) -->
implicitly_quantify_atomic_goal(Vars).
:- pred implicitly_quantify_atomic_goal(list(var), quant_info, quant_info).
@@ -590,7 +590,7 @@
set__union(Set5, Set6, Set),
set__union(LambdaSet5, LambdaSet6, LambdaSet).
-quantification__goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, _),
+quantification__goal_vars_2(pragma_c_code(_, _, _, _, ArgVars, _, _, _),
Set0, LambdaSet, Set, LambdaSet) :-
set__insert_list(Set0, ArgVars, Set).
Index: saved_vars.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/saved_vars.m,v
retrieving revision 1.7
diff -u -r1.7 saved_vars.m
--- saved_vars.m 1997/03/26 08:47:00 1.7
+++ saved_vars.m 1997/05/05 05:39:34
@@ -118,7 +118,7 @@
Goal = GoalExpr0 - GoalInfo0,
SlotInfo = SlotInfo0
;
- GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _),
+ GoalExpr0 = pragma_c_code(_, _, _, _, _, _, _, _),
Goal = GoalExpr0 - GoalInfo0,
SlotInfo = SlotInfo0
),
@@ -274,7 +274,7 @@
IsNonLocal, SlotInfo1, Goals1, SlotInfo),
Goals = [NewConstruct, Goal1 | Goals1]
;
- Goal0Expr = pragma_c_code(_, _, _, _, _, _, _),
+ Goal0Expr = pragma_c_code(_, _, _, _, _, _, _, _),
rename_var(SlotInfo0, Var, _NewVar, Subst, SlotInfo1),
goal_util__rename_vars_in_goal(Construct, Subst,
NewConstruct),
Index: simplify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/simplify.m,v
retrieving revision 1.29
diff -u -r1.29 simplify.m
--- simplify.m 1997/04/08 02:26:34 1.29
+++ simplify.m 1997/05/05 05:40:39
@@ -558,7 +558,7 @@
Goal = some(Vars, Goal3).
simplify__goal_2(Goal0, GoalInfo, Goal, GoalInfo, Info0, Info) :-
- Goal0 = pragma_c_code(_, _, PredId, ProcId, Args, _, _),
+ Goal0 = pragma_c_code(_, _, PredId, ProcId, Args, _, _, _),
( simplify_do_calls(Info0) ->
common__optimise_call(PredId, ProcId, Args, Goal0,
GoalInfo, Goal, Info0, Info)
@@ -1325,7 +1325,7 @@
Goal = GoalExpr - _,
GoalExpr \= call(_, _, _, _, _, _),
GoalExpr \= higher_order_call(_, _, _, _, _),
- GoalExpr \= pragma_c_code(_, _, _, _, _, _, _)
+ GoalExpr \= pragma_c_code(_, _, _, _, _, _, _, _)
)
->
simplify_info_get_common_info(Info0, CommonInfo0),
Index: store_alloc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/store_alloc.m,v
retrieving revision 1.50
diff -u -r1.50 store_alloc.m
--- store_alloc.m 1997/04/07 05:39:46 1.50
+++ store_alloc.m 1997/05/05 05:40:43
@@ -173,8 +173,8 @@
store_alloc_in_goal_2(unify(A,B,C,D,E), Liveness, _, _,
unify(A,B,C,D,E), Liveness).
-store_alloc_in_goal_2(pragma_c_code(A, B, C, D, E, F, G), Liveness, _, _,
- pragma_c_code(A, B, C, D, E, F, G), Liveness).
+store_alloc_in_goal_2(pragma_c_code(A, B, C, D, E, F, G, H), Liveness, _, _,
+ pragma_c_code(A, B, C, D, E, F, G, H), Liveness).
%-----------------------------------------------------------------------------%
Index: stratify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/stratify.m,v
retrieving revision 1.6
diff -u -r1.6 stratify.m
--- stratify.m 1997/03/25 07:03:34 1.6
+++ stratify.m 1997/05/05 05:41:02
@@ -186,7 +186,7 @@
WholeScc, ThisPredProcId, Error, Module0, Module) -->
first_order_check_goal(Goal, GoalInfo, yes, WholeScc, ThisPredProcId,
Error, Module0, Module).
-first_order_check_goal(pragma_c_code(_, _IsRec, CPred, CProc, _, _, _),
+first_order_check_goal(pragma_c_code(_, _IsRec, CPred, CProc, _, _, _, _),
GoalInfo, Negated, WholeScc, ThisPredProcId,
Error, Module0, Module) -->
(
@@ -363,7 +363,7 @@
ThisPredProcId, HighOrderLoops, Error, Module0, Module) -->
higher_order_check_goal(Goal, GoalInfo, yes, WholeScc, ThisPredProcId,
HighOrderLoops, Error, Module0, Module).
-higher_order_check_goal(pragma_c_code(_, _IsRec, _, _, _, _, _), _GoalInfo,
+higher_order_check_goal(pragma_c_code(_, _IsRec, _, _, _, _, _, _), _GoalInfo,
_Negated, _WholeScc, _ThisPredProcId, _HighOrderLoops,
_, Module, Module) --> [].
higher_order_check_goal(unify(_Var, _RHS, _Mode, _Uni, _Context), _GoalInfo,
@@ -848,7 +848,7 @@
CallsHO) :-
check_goal1(Goal, Calls0, Calls, HasAT0, HasAT, CallsHO0, CallsHO).
-check_goal1(pragma_c_code(_, _IsRec, _CPred, _CProc, _, _, _), Calls, Calls,
+check_goal1(pragma_c_code(_, _IsRec, _CPred, _CProc, _, _, _, _), Calls, Calls,
HasAT, HasAT, CallsHO, CallsHO).
@@ -938,7 +938,7 @@
get_called_procs(Goal, Calls0, Calls).
get_called_procs(not(Goal - _GoalInfo), Calls0, Calls) :-
get_called_procs(Goal, Calls0, Calls).
-get_called_procs(pragma_c_code(_, _IsRec, _CPred, _CProc, _, _, _),
+get_called_procs(pragma_c_code(_, _IsRec, _CPred, _CProc, _, _, _, _),
Calls, Calls).
Index: switch_detection.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/switch_detection.m,v
retrieving revision 1.67
diff -u -r1.67 switch_detection.m
--- switch_detection.m 1997/04/07 05:39:48 1.67
+++ switch_detection.m 1997/05/05 08:52:51
@@ -183,8 +183,8 @@
VarTypes, ModuleInfo, switch(Var, CanFail, Cases, SM)) :-
detect_switches_in_cases(Cases0, InstMap, VarTypes, ModuleInfo, Cases).
-detect_switches_in_goal_2(pragma_c_code(A,B,C,D,E,F,G), _, _, _, _,
- pragma_c_code(A,B,C,D,E,F,G)).
+detect_switches_in_goal_2(pragma_c_code(A,B,C,D,E,F,G,H), _, _, _, _,
+ pragma_c_code(A,B,C,D,E,F,G,H)).
%-----------------------------------------------------------------------------%
Index: typecheck.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/typecheck.m,v
retrieving revision 1.201
diff -u -r1.201 typecheck.m
--- typecheck.m 1997/04/29 15:40:00 1.201
+++ typecheck.m 1997/05/05 05:41:35
@@ -751,7 +751,8 @@
typecheck_goal_2(switch(_, _, _, _), _) -->
{ error("unexpected switch") }.
% no need to typecheck pragmas
-typecheck_goal_2(pragma_c_code(A,B,C,D,E,F,G), pragma_c_code(A,B,C,D,E,F,G))
+typecheck_goal_2(pragma_c_code(A,B,C,D,E,F,G,H),
+ pragma_c_code(A,B,C,D,E,F,G,H))
--> [].
%-----------------------------------------------------------------------------%
Index: unique_modes.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unique_modes.m,v
retrieving revision 1.34
diff -u -r1.34 unique_modes.m
--- unique_modes.m 1997/04/08 02:26:43 1.34
+++ unique_modes.m 1997/05/05 05:42:10
@@ -552,12 +552,13 @@
% to modecheck a pragma_c_code, we just modecheck the proc for
% which it is the goal.
unique_modes__check_goal_2(pragma_c_code(IsRecursive, C_Code, PredId, ProcId,
- Args, ArgNameMap, ExtraPragmaInfo), _GoalInfo, Goal) -->
+ Args, ArgNameMap, OrigArgTypes, ExtraPragmaInfo),
+ _GoalInfo, Goal) -->
mode_checkpoint(enter, "pragma_c_code"),
mode_info_set_call_context(call(PredId)),
unique_modes__check_call(PredId, ProcId, Args),
{ Goal = pragma_c_code(IsRecursive, C_Code, PredId, ProcId, Args,
- ArgNameMap, ExtraPragmaInfo) },
+ ArgNameMap, OrigArgTypes, ExtraPragmaInfo) },
mode_info_unset_call_context,
mode_checkpoint(exit, "pragma_c_code").
Index: unused_args.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/unused_args.m,v
retrieving revision 1.28
diff -u -r1.28 unused_args.m
--- unused_args.m 1997/04/07 05:39:56 1.28
+++ unused_args.m 1997/05/05 05:42:23
@@ -395,7 +395,7 @@
set_list_vars_used(UseInf0, [PredVar|Args], UseInf).
% handle pragma(c_code, ...) - pragma_c_code uses all its args
-traverse_goal(_, pragma_c_code(_, _, _, _, Args, _, _), UseInf0, UseInf) :-
+traverse_goal(_, pragma_c_code(_, _, _, _, Args, _, _, _), UseInf0, UseInf) :-
set_list_vars_used(UseInf0, Args, UseInf).
% cases to handle all the different types of unification
@@ -1197,7 +1197,7 @@
fixup_goal_expr(_ModuleInfo, _UnusedVars, _ProcCallInfo, no,
GoalExpr - GoalInfo, GoalExpr - GoalInfo) :-
- GoalExpr = pragma_c_code(_, _, _, _, _, _, _).
+ GoalExpr = pragma_c_code(_, _, _, _, _, _, _, _).
% Remove useless unifications from a list of conjuncts.
:- pred fixup_conjuncts(module_info::in, list(var)::in, proc_call_info::in,
cvs diff: Diffing notes
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list