You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
12 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>JContext (infer.InferModules.JContext)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="generator" content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><nav id="top"><a href="../index.html">Up</a> &mdash; <span class="package">package <a href="../../index.html">infer</a></span></nav><header><h1><span class="keyword">Module</span> <span class="module-path">InferModules.JContext</span></h1></header><div class="spec type" id="type-jump_kind"><a href="#type-jump_kind" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>jump_kind</code><code></code><code><span class="keyword"> = </span></code><table class="variant"><tr id="type-jump_kind.Next" class="anchored"><td class="def constructor"><a href="#type-jump_kind.Next" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Next</span></code></td></tr><tr id="type-jump_kind.Jump" class="anchored"><td class="def constructor"><a href="#type-jump_kind.Jump" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Jump</span><span class="keyword"> of </span>int</code></td></tr><tr id="type-jump_kind.Exit" class="anchored"><td class="def constructor"><a href="#type-jump_kind.Exit" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Exit</span></code></td></tr></table><code></code></div><div class="doc"><p>data structure for representing whether an instruction is a goto, a return or a standard instruction.</p></div></div><div class="spec module" id="module-NodeTbl"><a href="#module-NodeTbl" class="anchor"></a><div class="def module"><code><span class="keyword">module </span>NodeTbl : <a href="../../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.Caml.Hashtbl.S<span class="keyword"> with </span><span class="keyword">type </span><a href="index.html#module-NodeTbl">NodeTbl</a>.key<span class="keyword"> = </span><a href="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a></code></div><div class="doc"><p>Hastable for storing nodes that correspond to if-instructions. These are
used when adding the edges in the contrl flow graph.</p></div></div><div class="spec type" id="type-icfg"><a href="#type-icfg" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>icfg</code><code></code><code><span class="keyword"> = </span></code><code>{</code><table class="record"><tr id="type-icfg.tenv" class="anchored"><td class="def field"><a href="#type-icfg.tenv" class="anchor"></a><code>tenv : <a href="../../../InferIR/InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a>;</code></td></tr><tr id="type-icfg.cfg" class="anchored"><td class="def field"><a href="#type-icfg.cfg" class="anchor"></a><code>cfg : <a href="../../../InferIR/InferIR/Cfg/index.html#type-t">InferIR.Cfg.t</a>;</code></td></tr></table><code>}</code><code></code></div><div class="doc"><p>data structure for saving the three structures tht contain the intermediate
representation of a file: the type environment, the control graph and the control
flow graph</p></div></div><div class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>t</code><code></code><code><span class="keyword"> = </span><span class="keyword">private </span></code><code>{</code><table class="record"><tr id="type-t.icfg" class="anchored"><td class="def field"><a href="#type-t.icfg" class="anchor"></a><code>icfg : <a href="index.html#type-icfg">icfg</a>;</code></td></tr><tr id="type-t.procdesc" class="anchored"><td class="def field"><a href="#type-t.procdesc" class="anchor"></a><code>procdesc : <a href="../../../InferIR/InferIR/Procdesc/index.html#type-t">InferIR.Procdesc.t</a>;</code></td></tr><tr id="type-t.impl" class="anchored"><td class="def field"><a href="#type-t.impl" class="anchor"></a><code>impl : Sawja_pack.JBir.t;</code></td></tr><tr id="type-t.var_map" class="anchored"><td class="def field"><a href="#type-t.var_map" class="anchor"></a><code><span class="keyword">mutable </span>var_map : (<a href="../../../InferIR/InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a><span class="keyword"> * </span><a href="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a><span class="keyword"> * </span><a href="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a>) Sawja_pack.JBir.VarMap.t;</code></td></tr><tr id="type-t.if_jumps" class="anchored"><td class="def field"><a href="#type-t.if_jumps" class="anchor"></a><code>if_jumps : int <a href="index.html#module-NodeTbl">NodeTbl</a>.t;</code></td></tr><tr id="type-t.goto_jumps" class="anchored"><td class="def field"><a href="#type-t.goto_jumps" class="anchor"></a><code>goto_jumps : (int, <a href="index.html#type-jump_kind">jump_kind</a>) <a href="../../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.Caml.Hashtbl.t;</code></td></tr><tr id="type-t.cn" class="anchored"><td class="def field"><a href="#type-t.cn" class="anchor"></a><code>cn : Javalib_pack.JBasics.class_name;</code></td></tr><tr id="type-t.source_file" class="anchored"><td class="def field"><a href="#type-t.source_file" class="anchor"></a><code>source_file : <a href="../../../InferBase/InferBase/SourceFile/index.html#type-t">InferBase.SourceFile.t</a>;</code></td></tr><tr id="type-t.program" class="anchored"><td class="def field"><a href="#type-t.program" class="anchor"></a><code>program : <a href="../JClasspath/index.html#type-program">JClasspath.program</a>;</code></td></tr></table><code>}</code><code></code></div><div class="doc"><p>data structure for storing the context elements.</p></div></div><div class="spec val" id="val-create_context"><a href="#val-create_context" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>create_context : <a href="index.html#type-icfg">icfg</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Procdesc/index.html#type-t">InferIR.Procdesc.t</a> <span class="keyword">&#8209;&gt;</span> Sawja_pack.JBir.t <span class="keyword">&#8209;&gt;</span> Javalib_pack.JBasics.class_name <span class="keyword">&#8209;&gt;</span> <a href="../../../InferBase/InferBase/SourceFile/index.html#type-t">InferBase.SourceFile.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../JClasspath/index.html#type-program">JClasspath.program</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>cretes a context for a given method.</p></div></div><div class="spec val" id="val-get_tenv"><a href="#val-get_tenv" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_tenv : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Tenv/index.html#type-t">InferIR.Tenv.t</a></code></div><div class="doc"><p>returns the type environment that corresponds to the current file.</p></div></div><div class="spec val" id="val-add_if_jump"><a href="#val-add_if_jump" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>add_if_jump : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a> <span class="keyword">&#8209;&gt;</span> int <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"><p>adds to the context the line that an if-node will jump to</p></div></div><div class="spec val" id="val-get_if_jump"><a href="#val-get_if_jump" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_if_jump : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a> <span class="keyword">&#8209;&gt;</span> int option</code></div><div class="doc"><p>returns whether the given node corresponds to an if-instruction</p></div></div><div class="spec val" id="val-add_goto_jump"><a href="#val-add_goto_jump" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>add_goto_jump : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> int <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-jump_kind">jump_kind</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"><p>adds to the context the line that the node in the given line will jump to.</p></div></div><div class="spec val" id="val-get_goto_jump"><a href="#val-get_goto_jump" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_goto_jump : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> int <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-jump_kind">jump_kind</a></code></div><div class="doc"><p>if the given line corresponds to a goto instruction, then returns the
line where it jumps to, otherwise returns the next line.</p></div></div><div class="spec val" id="val-is_goto_jump"><a href="#val-is_goto_jump" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>is_goto_jump : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> int <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"><p>returns whether the given line corresponds to a goto instruction.</p></div></div><div class="spec val" id="val-set_pvar"><a href="#val-set_pvar" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>set_pvar : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> Sawja_pack.JBir.var <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a></code></div><div class="doc"><p><code class="code">set_pvar context var type</code> adds a variable with a type to the context</p></div></div><div class="spec val" id="val-get_var_type"><a href="#val-get_var_type" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_var_type : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> Sawja_pack.JBir.var <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> option</code></div><div class="doc"><p><code class="code">get_var_type context var</code> returns the type of the variable, if the variable is in the context</p></div></div><div class="spec val" id="val-reset_pvar_type"><a href="#val-reset_pvar_type" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>reset_pvar_type : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"><p>resets the dynamic type of the variables in the context.</p></div></div><div class="spec val" id="val-reset_exn_node_table"><a href="#val-reset_exn_node_table" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>reset_exn_node_table : unit <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"><p>resets the hashtable mapping methods to their exception nodes</p></div></div><div class="spec val" id="val-add_exn_node"><a href="#val-add_exn_node" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>add_exn_node : <a href="../../../InferIR/InferIR/Typ/Procname/index.html#type-t">InferIR.Typ.Procname.t</a> <span class="keyword">&#8209;&gt;</span> <a href="../../../InferIR/InferIR/Procdesc/Node/index.html#type-t">InferIR.Procdesc.Node.t</a> <span class="keyword">&#8209;&gt;</span> unit</code></div><div class="doc"><p>adds the exception node for a given method</p></div></div></body></html>