mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 04:13:46 +00:00
Estimated hours taken: .5 branches: main. Remove the binary flag used as fourth argument of filter and make filter a semidet predicate instead. If filter succeeds, it means that the monitoring process can continue (the flag was set to `continue'); if it fails, it it means that the monitoring process should stop (the flag was set to `stop'). extras/morphine/source/collect.in: Remove the fourth argument of filter and make it semidet. extras/morphine/source/collect.op: Compile monitors with --no-warn-det-decls-too-lax to avoid warnings when filter is det (since it is declared semidet). extras/morphine/source/collect__dynamic_call_graph: extras/morphine/source/collect__control_flow_graph: extras/morphine/source/collect__proof_tree: extras/morphine/non-regression-tests/test_ln: Remove the fourth argument of filter.
35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
%------------------------------------------------------------------------------%
|
|
% Copyright (C) 1999-2001 INRIA/INSA/IFSIC.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file License in the Morphine distribution.
|
|
%
|
|
% Author : Erwan Jahier <jahier@irisa.fr>
|
|
%
|
|
% Computes the control flow graph of an execution.
|
|
|
|
:- import_module set.
|
|
|
|
:- type predicate ---> proc_name/arity.
|
|
:- type arc ---> arc(predicate, predicate).
|
|
:- type graph == set(arc).
|
|
|
|
:- type accumulator_type ---> ct(predicate, graph).
|
|
:- type collected_type ---> collected_type(graph).
|
|
|
|
initialize(ct("user"/0, set__init)).
|
|
|
|
filter(Event, Acc0, Acc) :-
|
|
Port = port(Event),
|
|
(
|
|
(Port = call ; Port = exit ; Port = fail ; Port = redo)
|
|
->
|
|
Acc0 = ct(PreviousPred, Graph0),
|
|
CurrentPred = proc_name(Event) / proc_arity(Event),
|
|
Arc = arc(PreviousPred, CurrentPred),
|
|
set__insert(Graph0, Arc, Graph),
|
|
Acc = ct(CurrentPred, Graph)
|
|
;
|
|
Acc = Acc0
|
|
).
|
|
|
|
post_process(ct(_, Graph), collected_type(Graph)). |