@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
83 lines (71 loc) • 18.9 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Incremental analysis (high level) — The CiaoPP Program Processor v1.5</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">☰</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="part_internals.html">↑</a><a class="lpdoc-navbutton" href="Debug_plai.html">←</a><a class="lpdoc-navbutton" href="incanal_driver.html">→</a><a class="lpdoc-navbutton" href="ciaopp_ref_mansearch.html">🔍</a></span><span><a href="ciaopp_ref_manfulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciaopp_ref_man.html">The CiaoPP Program Processor</a> »<br/> </li><li><a href="part_internals.html">PART IV - CiaoPP Internals</a> »<br/> </li><li><a href=""><strong>Incremental analysis (high level)</strong></a> ▾<ul><li><a href="incanal_driver.html">Incremental analysis (low level)</a></li><li><a href="incanal_deletion.html">Update plai_db after clause deletion (incremental analysis)</a></li><li><a href="incanal_db.html">Database for incremental analysis</a></li><li><a href="incanal_persistent_db.html">Persistent database for incremental analysis</a></li><li><a href="tarjan_inc.html">Incremental computation of tarjan algorithm</a></li><li><a href="diff.html">Diff algorithm</a></li><li><a href="fixpo_dd.html">fixpo_dd (library)</a></li></ul></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage">Usage</a></li><li><a href="#Example">Example</a></li><li><a href="#Side effects">Side effects</a></li><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Incremental analysis (high level)</h1><a class="lpdoc-idx-anchor" href="ciaopp_ref_mansearch.html#incanal"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Isabel Garcia-Contreras" href="ciaopp_ref_mansearch.html#Isabel Garcia-Contreras">Isabel Garcia-Contreras</a>.<p>
<div class="lpdoc-alert"><strong>Stability: [</strong><strong>devel</strong><strong>] </strong>Currently the subject of active
development and/or research. Functionality may be limited and API
and/or functionality may change without warning or deprecation period. Not recommended yet for use in production.</div><p><br/>
This module implements a high level interface of incremental analysis (see <a class="lpdoc-idx-anchor" id="0" href="incanal_driver.html"><tt>incanal_driver</tt></a> for the low level interface).<p>Global compilation options of incremental analysis are available in <tt>incanal_options</tt>. Edit this file to activate tracing or run-time checks.<p><div class="lpdoc-alert"> <p>Incremental analysis only works with fixpoint dd, one abstract domain and multivariance on success off. The assertions of the predicates of this module reflect this.<p></div> <p><div id="Usage"><h2>Usage</h2> <p><strong>Important:</strong> For using incremental analysis some ciaopp flags have to be set:<p><pre class="lpdoc-codeblock">?- set_pp_flag(fixpoint, dd),
set_pp_flag(incremental, on),
set_pp_flag(del_strategy, top_down). %% select strategy for incremental deletion
</pre> <p><ol> <p><li >(Re)Load a list of modules to be analyzed with <a class="lpdoc-idx-anchor" id="1" href="#incremental_module/1"><tt>incremental_module/1</tt></a> (or <a class="lpdoc-idx-anchor" id="2" href="#incremental_module/2"><tt>incremental_module/2</tt></a> to get statistics). It can be done several times before reanalyzing.<p><li >(Re)Analyze the code with <a class="lpdoc-idx-anchor" id="3" href="#incremental_analyze/1"><tt>incremental_analyze/1</tt></a> (or <a class="lpdoc-idx-anchor" id="4" href="#incremental_analyze/2"><tt>incremental_analyze/2</tt></a> to get statistics). Internally, the changes will be automatically incrementally applied.<p>This predicate depends on the ciaopp flag <a class="lpdoc-idx-anchor" id="5" href="ciaopp_ref_mansearch.html#del_strategy"><tt>del_strategy</tt></a> for incremental deletion.<p></ol> <p><div class="lpdoc-note"> <strong>Note:</strong> If a module is not present in the reloading list, it is assumed that it has been removed from analysis so all modules must be in the input list although they may have not changed. </div> <p><div class="lpdoc-alert"> <strong>Tip (under construction!!):</strong> If you want to quickly display the information inferred by the analyzer between analyses you can: </div> <p><pre class="lpdoc-codeblock">?- use_module(ciaopp(raw_printer)).
?- show_analysis.
</pre> <p></div><div id="Example"><h2>Example</h2> <p>Example of incremental analysis for file <tt>foo.pl</tt> <p><pre class="lpdoc-codeblock">:- module(foo, [p/1], []).
p(1).
p(3).
</pre> <p>Incremental analysis from Ciao toplevel:<p><pre class="lpdoc-codeblock">?- use_module(ciaopp(plai/incanal)), use_module(ciaopp(preprocess_flags)).
yes
?- % incremental flags
set_pp_flag(fixpoint, dd),
set_pp_flag(incremental, on).
yes
?- incremental_module(foo, T).
T = [time(317.96,[])] ?
yes
?- incremental_analyze(eterms, T).
T = [proc_diff(0.244),add(2.281),delete(0.001)] ?
yes
% reload changes:
?- incremental_module(foo, T).
T = [time(299.822,[])] ?
yes
?- incremental_analyze(eterms, T).
{Incrementally analyzed with dd for eterms }
T = [proc_diff(0.314),add(2.148),delete(2.797)] ?
yes
</pre> <p></div><div id="Side effects"><h2>Side effects</h2> <p>As a result of the incremental analysis, auxiliary files are generated for each analyzed module:<p><ul> <li>When loaded a module: <tt>File.itf</tt>. <li>When analyzed a module: <tt>File.dump</tt>. </ul> <p>They are used to detect if changes were made in a module. To reset the incremental analysis these files have to be removed.<p><div class="lpdoc-alert"> <strong>WARNING</strong>: There might be problems with clause locators because Ids generated when transforming the code can be modified. </div> </div><br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(ciaopp(plai/incanal)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="6" href="#incremental_module/1"><tt>incremental_module/1</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#incremental_module/2"><tt>incremental_module/2</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#incremental_analyze/1"><tt>incremental_analyze/1</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#incremental_analyze/2"><tt>incremental_analyze/2</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#reset_incremental_analysis_info/0"><tt>reset_incremental_analysis_info/0</tt></a>, <a class="lpdoc-idx-anchor" id="11" href="#config_incremental_load/1"><tt>config_incremental_load/1</tt></a>, <a class="lpdoc-idx-anchor" id="12" href="#all_assertions_pred/4"><tt>all_assertions_pred/4</tt></a>.
</ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="incremental_module/1" href="ciaopp_ref_mansearch.html#incremental_module/1">incremental_module/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>incremental_module(Files)</tt>
</span><p>Loads and transforms the code of <span class="lpdoc-var">Files</span> to the ciaopp code database, computing the differences with the code previously present</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="basic_props.html#list/1"><tt>list/1</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="native_props_nfdet_doc.html#not_fails/1"><tt>not_fails/1</tt></a>)</span><span>All the calls of the form <span class="lpdoc-var">incremental_module(Files)</span> do not fail.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="incremental_module/2" href="ciaopp_ref_mansearch.html#incremental_module/2">incremental_module/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>incremental_module(Files,Stats)</tt>
</span><p>Same as <a class="lpdoc-idx-anchor" id="15" href="#incremental_module/1"><tt>incremental_module/1</tt></a> but returns runtime statistics in <span class="lpdoc-var">Stats</span>.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="16" href="basic_props.html#list/1"><tt>list/1</tt></a>)</span><span><span class="lpdoc-var">Files</span> is a list.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="basic_props.html#list/1"><tt>list/1</tt></a>)</span><span><span class="lpdoc-var">Stats</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="18" href="native_props_nfdet_doc.html#not_fails/1"><tt>not_fails/1</tt></a>)</span><span>All the calls of the form <span class="lpdoc-var">incremental_module(Files,Stats)</span> do not fail.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="incremental_analyze/1" href="ciaopp_ref_mansearch.html#incremental_analyze/1">incremental_analyze/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>incremental_analyze(AbsInt)</tt>
</span><p>Applies <span class="lpdoc-var">Diff</span> to the current analysis by performing all deletions according to the deletion strategy set the ciaopp flag (<tt>top_down</tt> or <tt>bottom_up</tt>), reanalyzing and adding all clauses and assertions after.</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="19" href="basic_props.html#atm/1"><tt>atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsInt</span> is an atom.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="incremental_analyze/2" href="ciaopp_ref_mansearch.html#incremental_analyze/2">incremental_analyze/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>incremental_analyze(AbsInt,Stats)</tt>
</span><p>Same as <a class="lpdoc-idx-anchor" id="20" href="#incremental_analyze/1"><tt>incremental_analyze/1</tt></a> but returns runtime statistics in <span class="lpdoc-var">Stats</span>. Statistics are divided in:<p><ul> <li><tt>proc_diff</tt>: Time needed to apply the differences to the incremental database. <li><tt>add</tt>: Time needed for performing the addition of clauses. <li><tt>delete</tt>: Time needed for performing the deletion of clauses according to the selected deletion strategy. </ul></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="21" href="basic_props.html#atm/1"><tt>atm/1</tt></a>)</span><span><span class="lpdoc-var">AbsInt</span> is an atom.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="22" href="basic_props.html#list/1"><tt>list/1</tt></a>)</span><span><span class="lpdoc-var">Stats</span> is a list.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="23" href="native_props_nfdet_doc.html#not_fails/1"><tt>not_fails/1</tt></a>)</span><span>All the calls of the form <span class="lpdoc-var">incremental_analyze(AbsInt,Stats)</span> do not fail.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="reset_incremental_analysis_info/0" href="ciaopp_ref_mansearch.html#reset_incremental_analysis_info/0">reset_incremental_analysis_info/0</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Resets incremental and regular ciaopp internal data structures.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="config_incremental_load/1" href="ciaopp_ref_mansearch.html#config_incremental_load/1">config_incremental_load/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>config_incremental_load(X)</tt>
</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="25" href="ciaopp_ref_mansearch.html#load_config/1"><tt>load_config/1</tt></a>)</span><span><a class="lpdoc-idx-anchor" id="24" href="ciaopp_ref_mansearch.html#load_config(X)"><tt>load_config(X)</tt></a>
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="all_assertions_pred/4" href="ciaopp_ref_mansearch.html#all_assertions_pred/4">all_assertions_pred/4</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p>
</div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>Application modules:</em><br/><a class="lpdoc-idx-anchor" id="26" href="frontend_driver.html"><tt>frontend_driver</tt></a>, <a class="lpdoc-idx-anchor" id="27" href="analyze_driver.html"><tt>analyze_driver</tt></a>, <a class="lpdoc-idx-anchor" id="28" href="preprocess_flags.html"><tt>preprocess_flags</tt></a>, <a class="lpdoc-idx-anchor" id="29" href="fixpo_dd.html"><tt>fixpo_dd</tt></a>, <a class="lpdoc-idx-anchor" id="30" href="incanal_driver.html"><tt>incanal_driver</tt></a>, <a class="lpdoc-idx-anchor" id="31" href="incanal_db.html"><tt>incanal_db</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="incanal_persistent_db.html"><tt>incanal_persistent_db</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="tarjan_inc.html"><tt>tarjan_inc</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="ciaopp_ref_mansearch.html#apply_assertions_inc"><tt>apply_assertions_inc</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="ciaopp_ref_mansearch.html#ciaopp_log"><tt>ciaopp_log</tt></a>, <a class="lpdoc-idx-anchor" id="36" href="ciaopp_ref_mansearch.html#analysis_stats"><tt>analysis_stats</tt></a>.
<li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="37" href="ciaopp_ref_mansearch.html#datafacts_rt"><tt>datafacts_rt</tt></a>, <a class="lpdoc-idx-anchor" id="38" href="ciaopp_ref_mansearch.html#native_props"><tt>native_props</tt></a>, <a class="lpdoc-idx-anchor" id="39" href="ciaopp_ref_mansearch.html#lists"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="40" href="ciaopp_ref_mansearch.html#aggregates"><tt>aggregates</tt></a>, <a class="lpdoc-idx-anchor" id="41" href="diff.html"><tt>diff</tt></a>, <a class="lpdoc-idx-anchor" id="42" href="ciaopp_ref_mansearch.html#pathnames"><tt>pathnames</tt></a>, <a class="lpdoc-idx-anchor" id="43" href="ciaopp_ref_mansearch.html#p_unit_db"><tt>p_unit_db</tt></a>, <a class="lpdoc-idx-anchor" id="44" href="program_keys.html"><tt>program_keys</tt></a>.
<li><em>Internal (engine) modules:</em><br/><a class="lpdoc-idx-anchor" id="45" href="ciaopp_ref_mansearch.html#term_basic"><tt>term_basic</tt></a>, <a class="lpdoc-idx-anchor" id="46" href="ciaopp_ref_mansearch.html#arithmetic"><tt>arithmetic</tt></a>, <a class="lpdoc-idx-anchor" id="47" href="ciaopp_ref_mansearch.html#atomic_basic"><tt>atomic_basic</tt></a>, <a class="lpdoc-idx-anchor" id="48" href="ciaopp_ref_mansearch.html#basiccontrol"><tt>basiccontrol</tt></a>, <a class="lpdoc-idx-anchor" id="49" href="ciaopp_ref_mansearch.html#exceptions"><tt>exceptions</tt></a>, <a class="lpdoc-idx-anchor" id="50" href="ciaopp_ref_mansearch.html#term_compare"><tt>term_compare</tt></a>, <a class="lpdoc-idx-anchor" id="51" href="ciaopp_ref_mansearch.html#term_typing"><tt>term_typing</tt></a>, <a class="lpdoc-idx-anchor" id="52" href="ciaopp_ref_mansearch.html#debugger_support"><tt>debugger_support</tt></a>, <a class="lpdoc-idx-anchor" id="53" href="basic_props.html"><tt>basic_props</tt></a>, <a class="lpdoc-idx-anchor" id="54" href="ciaopp_ref_mansearch.html#hiord_rt"><tt>hiord_rt</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="55" href="ciaopp_ref_mansearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="56" href="ciaopp_ref_mansearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="57" href="ciaopp_ref_mansearch.html#condcomp"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="58" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="59" href="ciaopp_ref_mansearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="60" href="regtypes_doc.html"><tt>regtypes</tt></a>, <a class="lpdoc-idx-anchor" id="61" href="ciaopp_ref_mansearch.html#modes"><tt>modes</tt></a>, <a class="lpdoc-idx-anchor" id="62" href="ciaopp_ref_mansearch.html#datafacts"><tt>datafacts</tt></a>, <a class="lpdoc-idx-anchor" id="63" href="ciaopp_ref_mansearch.html#nativeprops"><tt>nativeprops</tt></a>, <a class="lpdoc-idx-anchor" id="64" href="ciaopp_ref_mansearch.html#ciaopp(plai/notrace)"><tt>ciaopp(plai/notrace)</tt></a>.
</ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>