Files
mercury/compiler/goal_path.m
Thomas Conway a70b59e83c Add a test to find the number of words needed to represent a
configure.in:
        Add a test to find the number of words needed to represent a
        synchronization term.

boehm_gc/gc.h:
        fix a declaration by replacing the args () with (void).
boehm_gc/solaris_pthreads.c:
        add a missing include
        check the return values of pthread calls.

compiler/*.m:
        Add handling for the new HLDS goal type par_conj.
        Add handling for the four new LLDS instructions:
                init_sync_term
                fork
                join_and_terminate
                join_and_continue

compiler/code_info.m:
        add a new alternative for slot_contents - sync_term.

compiler/handle_options.m:
        add .par as part of the grade

compiler/hlds_goal.m:
        add the new goal type par_conj.

compiler/instmap.m:
        add instmap__unify which takes a list of instmaps
                and abstractly unifies them.
        add unify_instmap_delta which tajes two instmap deltas
                and abstractly unifies them.

compiler/llds.m:
        add the new llds instructions.

compiler/mode_info.m:
        add par_conj as a lock reason.

library/Makefile:
        work around a bug in the solaris version pthread.h

library/benchmarking.m:
        reference the stack zones from the engine structure
        rather than from global variables.

library/{nc,sp}_builtin.nl:
        add an op declaration for &.

library/std_util.m:
        change references to global variables to references inside
        the engine structure.

runtime/Mmakefile:
        add mercury_thread.{c,h}
        add THREADLIBS to the libraries

runtime/*.{c,h}
        Remove some old junk from the previous processes/shrd-mem
        changes that found their way into the repository.
        Add MR_ prefixes to lots of names.

runtime/mercury_context.c:
        Add init_thread_stuff for creating and initializing a
        context structure for the current thread.

runtime/mercury_context.h:
        add a field to the mercury context which stores the thread id
        of the thread where this context originated.
        add various macros for implementing the new llds instructions.

runtime/mercury_engine.c:
        initialize the engine structure, rather than a bunch of globals.

runtime/mercury_engine.h:
        declare the mercury_engine structure.

runtime/mercury_regorder.h:
        if MR_THREAD_SAFE, and there is at least one global register
        then use mr0 as a pointer to the mercury engine structure.

scripts/init_grade_options.sh-subr
        add thread_safe

scripts/mgnuc.in
        add THREAD_OPTS

scripts/ml.in:
        add THREAD_LIBS
1998-06-09 02:16:31 +00:00

94 lines
3.4 KiB
Mathematica

%-----------------------------------------------------------------------------%
% Copyright (C) 1997-1998 University of Melbourne.
% This file may only be copied under the terms of the GNU General
% Public License - see the file COPYING in the Mercury distribution.
%-----------------------------------------------------------------------------%
% This module looks after goal paths, which associate each goal
% with its position in a procedure definition,
% Main author: zs.
:- module goal_path.
:- interface.
:- import_module hlds_pred, hlds_module.
:- pred goal_path__fill_slots(proc_info::in, module_info::in, proc_info::out)
is det.
:- implementation.
:- import_module hlds_goal.
:- import_module int, list, std_util.
goal_path__fill_slots(Proc0, _ModuleInfo, Proc) :-
% The ModuleInfo argument is there just for passes_aux
proc_info_goal(Proc0, Goal0),
fill_goal_slots(Goal0, [], Goal),
proc_info_set_goal(Proc0, Goal, Proc).
:- pred fill_goal_slots(hlds_goal::in, goal_path::in, hlds_goal::out) is det.
fill_goal_slots(Expr0 - Info0, Path0, Expr - Info) :-
goal_info_set_goal_path(Info0, Path0, Info),
fill_expr_slots(Expr0, Path0, Expr).
:- pred fill_expr_slots(hlds_goal_expr::in, goal_path::in,
hlds_goal_expr::out) is det.
fill_expr_slots(conj(Goals0), Path0, conj(Goals)) :-
fill_conj_slots(Goals0, Path0, 0, Goals).
fill_expr_slots(par_conj(Goals0, SM), Path0, par_conj(Goals, SM)) :-
fill_conj_slots(Goals0, Path0, 0, Goals).
fill_expr_slots(disj(Goals0, B), Path0, disj(Goals, B)) :-
fill_disj_slots(Goals0, Path0, 0, Goals).
fill_expr_slots(switch(A, B, Cases0, D), Path0, switch(A, B, Cases, D)) :-
fill_switch_slots(Cases0, Path0, 0, Cases).
fill_expr_slots(not(Goal0), Path0, not(Goal)) :-
fill_goal_slots(Goal0, [neg | Path0], Goal).
fill_expr_slots(some(A, Goal0), Path0, some(A, Goal)) :-
fill_goal_slots(Goal0, [exist | Path0], Goal).
fill_expr_slots(if_then_else(A, Cond0, Then0, Else0, E), Path0,
if_then_else(A, Cond, Then, Else, E)) :-
fill_goal_slots(Cond0, [ite_cond | Path0], Cond),
fill_goal_slots(Then0, [ite_then | Path0], Then),
fill_goal_slots(Else0, [ite_else | Path0], Else).
fill_expr_slots(call(A,B,C,D,E,F), _Path0, call(A,B,C,D,E,F)).
fill_expr_slots(higher_order_call(A,B,C,D,E,F), _Path0,
higher_order_call(A,B,C,D,E,F)).
fill_expr_slots(class_method_call(A,B,C,D,E,F), _Path0,
class_method_call(A,B,C,D,E,F)).
fill_expr_slots(unify(A,B,C,D,E), _Path0, unify(A,B,C,D,E)).
fill_expr_slots(pragma_c_code(A,B,C,D,E,F,G), _Path0,
pragma_c_code(A,B,C,D,E,F,G)).
:- pred fill_conj_slots(list(hlds_goal)::in, goal_path::in, int::in,
list(hlds_goal)::out) is det.
fill_conj_slots([], _, _, []).
fill_conj_slots([Goal0 | Goals0], Path0, N0, [Goal | Goals]) :-
N1 is N0 + 1,
fill_goal_slots(Goal0, [conj(N1) | Path0], Goal),
fill_conj_slots(Goals0, Path0, N1, Goals).
:- pred fill_disj_slots(list(hlds_goal)::in, goal_path::in, int::in,
list(hlds_goal)::out) is det.
fill_disj_slots([], _, _, []).
fill_disj_slots([Goal0 | Goals0], Path0, N0, [Goal | Goals]) :-
N1 is N0 + 1,
fill_goal_slots(Goal0, [disj(N1) | Path0], Goal),
fill_disj_slots(Goals0, Path0, N1, Goals).
:- pred fill_switch_slots(list(case)::in, goal_path::in, int::in,
list(case)::out) is det.
fill_switch_slots([], _, _, []).
fill_switch_slots([case(A, Goal0) | Cases0], Path0, N0,
[case(A, Goal) | Cases]) :-
N1 is N0 + 1,
fill_goal_slots(Goal0, [switch(N1) | Path0], Goal),
fill_switch_slots(Cases0, Path0, N1, Cases).