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.

2 lines
10 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.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>JContext (infer.JavaFrontend.JContext)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">infer</a> &#x00BB; <a href="../index.html">JavaFrontend</a> &#x00BB; JContext</nav><h1>Module <code>JavaFrontend.JContext</code></h1></header><dl><dt class="spec type" id="type-jump_kind"><a href="#type-jump_kind" class="anchor"></a><code><span class="keyword">type</span> jump_kind</code><code> = </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>| </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>| </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>| </code><code><span class="constructor">Exit</span></code></td></tr></table></dt><dd><p>data structure for representing whether an instruction is a goto, a return or a standard instruction.</p></dd></dl><dl><dt class="spec module" id="module-NodeTbl"><a href="#module-NodeTbl" class="anchor"></a><code><span class="keyword">module</span> NodeTbl : <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Caml.Hashtbl.S <span class="keyword">with</span> <span class="keyword">type</span> <a href="index.html#module-NodeTbl">NodeTbl</a>.key = <a href="../../IR/Procdesc/Node/index.html#type-t">IR.Procdesc.Node.t</a></code></dt><dd><p>Hastable for storing nodes that correspond to if-instructions. These are used when adding the edges in the contrl flow graph.</p></dd></dl><dl><dt class="spec type" id="type-icfg"><a href="#type-icfg" class="anchor"></a><code><span class="keyword">type</span> icfg</code><code> = </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="../../IR/Tenv/index.html#type-t">IR.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="../../IR/Cfg/index.html#type-t">IR.Cfg.t</a>;</code></td></tr></table><code>}</code></dt><dd><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></dd></dl><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code><code> = <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="../../IR/Procdesc/index.html#type-t">IR.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 : <span><span>(<a href="../../IR/Pvar/index.html#type-t">IR.Pvar.t</a> * <a href="../../IR/Typ/index.html#type-t">IR.Typ.t</a> * <a href="../../IR/Typ/index.html#type-t">IR.Typ.t</a>)</span> Sawja_pack.JBir.VarMap.t</span>;</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 : <span>int <a href="index.html#module-NodeTbl">NodeTbl</a>.t</span>;</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 : <span><span>(int, <a href="index.html#type-jump_kind">jump_kind</a>)</span> <a href="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.Caml.Hashtbl.t</span>;</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="../../IBase/SourceFile/index.html#type-t">IBase.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="../JProgramDesc/index.html#type-t">JProgramDesc.t</a>;</code></td></tr></table><code>}</code></dt><dd><p>data structure for storing the context elements.</p></dd></dl><dl><dt class="spec value" id="val-create_context"><a href="#val-create_context" class="anchor"></a><code><span class="keyword">val</span> create_context : <a href="index.html#type-icfg">icfg</a> <span>&#45;&gt;</span> <a href="../../IR/Procdesc/index.html#type-t">IR.Procdesc.t</a> <span>&#45;&gt;</span> Sawja_pack.JBir.t <span>&#45;&gt;</span> Javalib_pack.JBasics.class_name <span>&#45;&gt;</span> <a href="../../IBase/SourceFile/index.html#type-t">IBase.SourceFile.t</a> <span>&#45;&gt;</span> <a href="../JProgramDesc/index.html#type-t">JProgramDesc.t</a> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>cretes a context for a given method.</p></dd></dl><dl><dt class="spec value" id="val-get_tenv"><a href="#val-get_tenv" class="anchor"></a><code><span class="keyword">val</span> get_tenv : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../IR/Tenv/index.html#type-t">IR.Tenv.t</a></code></dt><dd><p>returns the type environment that corresponds to the current file.</p></dd></dl><dl><dt class="spec value" id="val-add_if_jump"><a href="#val-add_if_jump" class="anchor"></a><code><span class="keyword">val</span> add_if_jump : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../IR/Procdesc/Node/index.html#type-t">IR.Procdesc.Node.t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> unit</code></dt><dd><p>adds to the context the line that an if-node will jump to</p></dd></dl><dl><dt class="spec value" id="val-get_if_jump"><a href="#val-get_if_jump" class="anchor"></a><code><span class="keyword">val</span> get_if_jump : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../IR/Procdesc/Node/index.html#type-t">IR.Procdesc.Node.t</a> <span>&#45;&gt;</span> <span>int option</span></code></dt><dd><p>returns whether the given node corresponds to an if-instruction</p></dd></dl><dl><dt class="spec value" id="val-add_goto_jump"><a href="#val-add_goto_jump" class="anchor"></a><code><span class="keyword">val</span> add_goto_jump : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-jump_kind">jump_kind</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>adds to the context the line that the node in the given line will jump to.</p></dd></dl><dl><dt class="spec value" id="val-get_goto_jump"><a href="#val-get_goto_jump" class="anchor"></a><code><span class="keyword">val</span> get_goto_jump : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-jump_kind">jump_kind</a></code></dt><dd><p>if the given line corresponds to a goto instruction, then returns the line where it jumps to, otherwise returns the next line.</p></dd></dl><dl><dt class="spec value" id="val-is_goto_jump"><a href="#val-is_goto_jump" class="anchor"></a><code><span class="keyword">val</span> is_goto_jump : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> bool</code></dt><dd><p>returns whether the given line corresponds to a goto instruction.</p></dd></dl><dl><dt class="spec value" id="val-set_pvar"><a href="#val-set_pvar" class="anchor"></a><code><span class="keyword">val</span> set_pvar : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> Sawja_pack.JBir.var <span>&#45;&gt;</span> <a href="../../IR/Typ/index.html#type-t">IR.Typ.t</a> <span>&#45;&gt;</span> <a href="../../IR/Pvar/index.html#type-t">IR.Pvar.t</a></code></dt><dd><p><code>set_pvar context var type</code> adds a variable with a type to the context</p></dd></dl><dl><dt class="spec value" id="val-get_var_type"><a href="#val-get_var_type" class="anchor"></a><code><span class="keyword">val</span> get_var_type : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> Sawja_pack.JBir.var <span>&#45;&gt;</span> <span><a href="../../IR/Typ/index.html#type-t">IR.Typ.t</a> option</span></code></dt><dd><p><code>get_var_type context var</code> returns the type of the variable, if the variable is in the context</p></dd></dl><dl><dt class="spec value" id="val-reset_pvar_type"><a href="#val-reset_pvar_type" class="anchor"></a><code><span class="keyword">val</span> reset_pvar_type : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>resets the dynamic type of the variables in the context.</p></dd></dl><dl><dt class="spec value" id="val-reset_exn_node_table"><a href="#val-reset_exn_node_table" class="anchor"></a><code><span class="keyword">val</span> reset_exn_node_table : unit <span>&#45;&gt;</span> unit</code></dt><dd><p>resets the hashtable mapping methods to their exception nodes</p></dd></dl><dl><dt class="spec value" id="val-add_exn_node"><a href="#val-add_exn_node" class="anchor"></a><code><span class="keyword">val</span> add_exn_node : <a href="../../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>&#45;&gt;</span> <a href="../../IR/Procdesc/Node/index.html#type-t">IR.Procdesc.Node.t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>adds the exception node for a given method</p></dd></dl></div></body></html>