mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
81 lines
34 KiB
HTML
81 lines
34 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `FuncEnvironment` trait in crate `wasmer_clif_fork_wasm`."><meta name="keywords" content="rust, rustlang, rust-lang, FuncEnvironment"><title>wasmer_clif_fork_wasm::FuncEnvironment - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../wasmer_clif_fork_wasm/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Trait FuncEnvironment</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.make_direct_func">make_direct_func</a><a href="#tymethod.make_global">make_global</a><a href="#tymethod.make_heap">make_heap</a><a href="#tymethod.make_indirect_sig">make_indirect_sig</a><a href="#tymethod.make_table">make_table</a><a href="#tymethod.target_config">target_config</a><a href="#tymethod.translate_call_indirect">translate_call_indirect</a><a href="#tymethod.translate_memory_grow">translate_memory_grow</a><a href="#tymethod.translate_memory_size">translate_memory_size</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.pointer_bytes">pointer_bytes</a><a href="#method.pointer_type">pointer_type</a><a href="#method.return_mode">return_mode</a><a href="#method.translate_call">translate_call</a><a href="#method.translate_loop_header">translate_loop_header</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>wasmer_clif_fork_wasm</a></p><script>window.sidebarCurrent = {name: 'FuncEnvironment', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/wasmer_clif_fork_wasm/environ/spec.rs.html#101-256' title='goto source code'>[src]</a></span><span class='in-band'>Trait <a href='index.html'>wasmer_clif_fork_wasm</a>::<wbr><a class="trait" href=''>FuncEnvironment</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust trait'>pub trait FuncEnvironment {
|
||
fn <a href='#tymethod.target_config' class='fnname'>target_config</a>(&self) -> <a class="struct" href="../cranelift_codegen/isa/struct.TargetFrontendConfig.html" title="struct cranelift_codegen::isa::TargetFrontendConfig">TargetFrontendConfig</a>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_global' class='fnname'>make_global</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.GlobalIndex.html" title="struct wasmer_clif_fork_wasm::GlobalIndex">GlobalIndex</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="enum" href="../wasmer_clif_fork_wasm/enum.GlobalVariable.html" title="enum wasmer_clif_fork_wasm::GlobalVariable">GlobalVariable</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_heap' class='fnname'>make_heap</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_table' class='fnname'>make_table</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.TableIndex.html" title="struct wasmer_clif_fork_wasm::TableIndex">TableIndex</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Table.html" title="struct cranelift_codegen::ir::entities::Table">Table</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_indirect_sig' class='fnname'>make_indirect_sig</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.SignatureIndex.html" title="struct wasmer_clif_fork_wasm::SignatureIndex">SignatureIndex</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.SigRef.html" title="struct cranelift_codegen::ir::entities::SigRef">SigRef</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.make_direct_func' class='fnname'>make_direct_func</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.FuncIndex.html" title="struct wasmer_clif_fork_wasm::FuncIndex">FuncIndex</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.FuncRef.html" title="struct cranelift_codegen::ir::entities::FuncRef">FuncRef</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.translate_call_indirect' class='fnname'>translate_call_indirect</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> table_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.TableIndex.html" title="struct wasmer_clif_fork_wasm::TableIndex">TableIndex</a>, <br> table: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Table.html" title="struct cranelift_codegen::ir::entities::Table">Table</a>, <br> sig_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.SignatureIndex.html" title="struct wasmer_clif_fork_wasm::SignatureIndex">SignatureIndex</a>, <br> sig_ref: <a class="struct" href="../cranelift_codegen/ir/entities/struct.SigRef.html" title="struct cranelift_codegen::ir::entities::SigRef">SigRef</a>, <br> callee: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>, <br> call_args: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.translate_memory_grow' class='fnname'>translate_memory_grow</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a>, <br> heap: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a>, <br> val: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>>;
|
||
<div class='item-spacer'></div> fn <a href='#tymethod.translate_memory_size' class='fnname'>translate_memory_size</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a>, <br> heap: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>>;
|
||
|
||
fn <a href='#method.pointer_type' class='fnname'>pointer_type</a>(&self) -> <a class="struct" href="../cranelift_codegen/ir/types/struct.Type.html" title="struct cranelift_codegen::ir::types::Type">Type</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.pointer_bytes' class='fnname'>pointer_bytes</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.return_mode' class='fnname'>return_mode</a>(&self) -> <a class="enum" href="../wasmer_clif_fork_wasm/enum.ReturnMode.html" title="enum wasmer_clif_fork_wasm::ReturnMode">ReturnMode</a> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.translate_call' class='fnname'>translate_call</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> _callee_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.FuncIndex.html" title="struct wasmer_clif_fork_wasm::FuncIndex">FuncIndex</a>, <br> callee: <a class="struct" href="../cranelift_codegen/ir/entities/struct.FuncRef.html" title="struct cranelift_codegen::ir::entities::FuncRef">FuncRef</a>, <br> call_args: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br> ) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>> { ... }
|
||
<div class='item-spacer'></div> fn <a href='#method.translate_loop_header' class='fnname'>translate_loop_header</a>(&mut self, _pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>> { ... }
|
||
}</pre></div><div class='docblock'><p>Environment affecting the translation of a single WebAssembly function.</p>
|
||
<p>A <code>FuncEnvironment</code> trait object is required to translate a WebAssembly function to Cranelift
|
||
IR. The function environment provides information about the WebAssembly module as well as the
|
||
runtime environment.</p>
|
||
</div>
|
||
<h2 id='required-methods' class='small-section-header'>Required methods<a href='#required-methods' class='anchor'></a></h2><div class='methods'><h3 id='tymethod.target_config' class='method'><code id='target_config.v'>fn <a href='#tymethod.target_config' class='fnname'>target_config</a>(&self) -> <a class="struct" href="../cranelift_codegen/isa/struct.TargetFrontendConfig.html" title="struct cranelift_codegen::isa::TargetFrontendConfig">TargetFrontendConfig</a></code></h3><div class='docblock'><p>Get the information needed to produce Cranelift IR for the given target.</p>
|
||
</div><h3 id='tymethod.make_global' class='method'><code id='make_global.v'>fn <a href='#tymethod.make_global' class='fnname'>make_global</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.GlobalIndex.html" title="struct wasmer_clif_fork_wasm::GlobalIndex">GlobalIndex</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="enum" href="../wasmer_clif_fork_wasm/enum.GlobalVariable.html" title="enum wasmer_clif_fork_wasm::GlobalVariable">GlobalVariable</a>></code></h3><div class='docblock'><p>Set up the necessary preamble definitions in <code>func</code> to access the global variable
|
||
identified by <code>index</code>.</p>
|
||
<p>The index space covers both imported globals and globals defined by the module.</p>
|
||
<p>Return the global variable reference that should be used to access the global and the
|
||
WebAssembly type of the global.</p>
|
||
</div><h3 id='tymethod.make_heap' class='method'><code id='make_heap.v'>fn <a href='#tymethod.make_heap' class='fnname'>make_heap</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a>></code></h3><div class='docblock'><p>Set up the necessary preamble definitions in <code>func</code> to access the linear memory identified
|
||
by <code>index</code>.</p>
|
||
<p>The index space covers both imported and locally declared memories.</p>
|
||
</div><h3 id='tymethod.make_table' class='method'><code id='make_table.v'>fn <a href='#tymethod.make_table' class='fnname'>make_table</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.TableIndex.html" title="struct wasmer_clif_fork_wasm::TableIndex">TableIndex</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Table.html" title="struct cranelift_codegen::ir::entities::Table">Table</a>></code></h3><div class='docblock'><p>Set up the necessary preamble definitions in <code>func</code> to access the table identified
|
||
by <code>index</code>.</p>
|
||
<p>The index space covers both imported and locally declared tables.</p>
|
||
</div><h3 id='tymethod.make_indirect_sig' class='method'><code id='make_indirect_sig.v'>fn <a href='#tymethod.make_indirect_sig' class='fnname'>make_indirect_sig</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.SignatureIndex.html" title="struct wasmer_clif_fork_wasm::SignatureIndex">SignatureIndex</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.SigRef.html" title="struct cranelift_codegen::ir::entities::SigRef">SigRef</a>></code></h3><div class='docblock'><p>Set up a signature definition in the preamble of <code>func</code> that can be used for an indirect
|
||
call with signature <code>index</code>.</p>
|
||
<p>The signature may contain additional arguments needed for an indirect call, but the
|
||
arguments marked as <code>ArgumentPurpose::Normal</code> must correspond to the WebAssembly signature
|
||
arguments.</p>
|
||
<p>The signature will only be used for indirect calls, even if the module has direct function
|
||
calls with the same WebAssembly type.</p>
|
||
</div><h3 id='tymethod.make_direct_func' class='method'><code id='make_direct_func.v'>fn <a href='#tymethod.make_direct_func' class='fnname'>make_direct_func</a>(<br> &mut self, <br> func: &mut <a class="struct" href="../cranelift_codegen/ir/function/struct.Function.html" title="struct cranelift_codegen::ir::function::Function">Function</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.FuncIndex.html" title="struct wasmer_clif_fork_wasm::FuncIndex">FuncIndex</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.FuncRef.html" title="struct cranelift_codegen::ir::entities::FuncRef">FuncRef</a>></code></h3><div class='docblock'><p>Set up an external function definition in the preamble of <code>func</code> that can be used to
|
||
directly call the function <code>index</code>.</p>
|
||
<p>The index space covers both imported functions and functions defined in the current module.</p>
|
||
<p>The function's signature may contain additional arguments needed for a direct call, but the
|
||
arguments marked as <code>ArgumentPurpose::Normal</code> must correspond to the WebAssembly signature
|
||
arguments.</p>
|
||
<p>The function's signature will only be used for direct calls, even if the module has
|
||
indirect calls with the same WebAssembly type.</p>
|
||
</div><h3 id='tymethod.translate_call_indirect' class='method'><code id='translate_call_indirect.v'>fn <a href='#tymethod.translate_call_indirect' class='fnname'>translate_call_indirect</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> table_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.TableIndex.html" title="struct wasmer_clif_fork_wasm::TableIndex">TableIndex</a>, <br> table: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Table.html" title="struct cranelift_codegen::ir::entities::Table">Table</a>, <br> sig_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.SignatureIndex.html" title="struct wasmer_clif_fork_wasm::SignatureIndex">SignatureIndex</a>, <br> sig_ref: <a class="struct" href="../cranelift_codegen/ir/entities/struct.SigRef.html" title="struct cranelift_codegen::ir::entities::SigRef">SigRef</a>, <br> callee: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>, <br> call_args: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>></code></h3><div class='docblock'><p>Translate a <code>call_indirect</code> WebAssembly instruction at <code>pos</code>.</p>
|
||
<p>Insert instructions at <code>pos</code> for an indirect call to the function <code>callee</code> in the table
|
||
<code>table_index</code> with WebAssembly signature <code>sig_index</code>. The <code>callee</code> value will have type
|
||
<code>i32</code>.</p>
|
||
<p>The signature <code>sig_ref</code> was previously created by <code>make_indirect_sig()</code>.</p>
|
||
<p>Return the call instruction whose results are the WebAssembly return values.</p>
|
||
</div><h3 id='tymethod.translate_memory_grow' class='method'><code id='translate_memory_grow.v'>fn <a href='#tymethod.translate_memory_grow' class='fnname'>translate_memory_grow</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a>, <br> heap: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a>, <br> val: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>></code></h3><div class='docblock'><p>Translate a <code>memory.grow</code> WebAssembly instruction.</p>
|
||
<p>The <code>index</code> provided identifies the linear memory to grow, and <code>heap</code> is the heap reference
|
||
returned by <code>make_heap</code> for the same index.</p>
|
||
<p>The <code>val</code> value is the requested memory size in pages.</p>
|
||
<p>Returns the old size (in pages) of the memory.</p>
|
||
</div><h3 id='tymethod.translate_memory_size' class='method'><code id='translate_memory_size.v'>fn <a href='#tymethod.translate_memory_size' class='fnname'>translate_memory_size</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.MemoryIndex.html" title="struct wasmer_clif_fork_wasm::MemoryIndex">MemoryIndex</a>, <br> heap: <a class="struct" href="../cranelift_codegen/ir/entities/struct.Heap.html" title="struct cranelift_codegen::ir::entities::Heap">Heap</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a>></code></h3><div class='docblock'><p>Translates a <code>memory.size</code> WebAssembly instruction.</p>
|
||
<p>The <code>index</code> provided identifies the linear memory to query, and <code>heap</code> is the heap reference
|
||
returned by <code>make_heap</code> for the same index.</p>
|
||
<p>Returns the size in pages of the memory.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='provided-methods' class='small-section-header'>Provided methods<a href='#provided-methods' class='anchor'></a></h2><div class='methods'><h3 id='method.pointer_type' class='method'><code id='pointer_type.v'>fn <a href='#method.pointer_type' class='fnname'>pointer_type</a>(&self) -> <a class="struct" href="../cranelift_codegen/ir/types/struct.Type.html" title="struct cranelift_codegen::ir::types::Type">Type</a></code></h3><div class='docblock'><p>Get the Cranelift integer type to use for native pointers.</p>
|
||
<p>This returns <code>I64</code> for 64-bit architectures and <code>I32</code> for 32-bit architectures.</p>
|
||
</div><h3 id='method.pointer_bytes' class='method'><code id='pointer_bytes.v'>fn <a href='#method.pointer_bytes' class='fnname'>pointer_bytes</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a></code></h3><div class='docblock'><p>Get the size of a native pointer, in bytes.</p>
|
||
</div><h3 id='method.return_mode' class='method'><code id='return_mode.v'>fn <a href='#method.return_mode' class='fnname'>return_mode</a>(&self) -> <a class="enum" href="../wasmer_clif_fork_wasm/enum.ReturnMode.html" title="enum wasmer_clif_fork_wasm::ReturnMode">ReturnMode</a></code></h3><div class='docblock'><p>Should the code be structured to use a single <code>fallthrough_return</code> instruction at the end
|
||
of the function body, rather than <code>return</code> instructions as needed? This is used by VMs
|
||
to append custom epilogues.</p>
|
||
</div><h3 id='method.translate_call' class='method'><code id='translate_call.v'>fn <a href='#method.translate_call' class='fnname'>translate_call</a>(<br> &mut self, <br> pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>, <br> _callee_index: <a class="struct" href="../wasmer_clif_fork_wasm/struct.FuncIndex.html" title="struct wasmer_clif_fork_wasm::FuncIndex">FuncIndex</a>, <br> callee: <a class="struct" href="../cranelift_codegen/ir/entities/struct.FuncRef.html" title="struct cranelift_codegen::ir::entities::FuncRef">FuncRef</a>, <br> call_args: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&[</a><a class="struct" href="../cranelift_codegen/ir/entities/struct.Value.html" title="struct cranelift_codegen::ir::entities::Value">Value</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="struct" href="../cranelift_codegen/ir/entities/struct.Inst.html" title="struct cranelift_codegen::ir::entities::Inst">Inst</a>></code></h3><div class='docblock'><p>Translate a <code>call</code> WebAssembly instruction at <code>pos</code>.</p>
|
||
<p>Insert instructions at <code>pos</code> for a direct call to the function <code>callee_index</code>.</p>
|
||
<p>The function reference <code>callee</code> was previously created by <code>make_direct_func()</code>.</p>
|
||
<p>Return the call instruction whose results are the WebAssembly return values.</p>
|
||
</div><h3 id='method.translate_loop_header' class='method'><code id='translate_loop_header.v'>fn <a href='#method.translate_loop_header' class='fnname'>translate_loop_header</a>(&mut self, _pos: <a class="struct" href="../cranelift_codegen/cursor/struct.FuncCursor.html" title="struct cranelift_codegen::cursor::FuncCursor">FuncCursor</a>) -> <a class="type" href="../wasmer_clif_fork_wasm/type.WasmResult.html" title="type wasmer_clif_fork_wasm::WasmResult">WasmResult</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></code></h3><div class='docblock'><p>Emit code at the beginning of every wasm loop.</p>
|
||
<p>This can be used to insert explicit interrupt or safepoint checking at
|
||
the beginnings of loops.</p>
|
||
</div></div><span class='loading-content'>Loading content...</span>
|
||
<h2 id='implementors' class='small-section-header'>Implementors<a href='#implementors' class='anchor'></a></h2><div class='item-list' id='implementors-list'></div><span class='loading-content'>Loading content...</span><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
||
src="../implementors/wasmer_clif_fork_wasm/trait.FuncEnvironment.js">
|
||
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "wasmer_clif_fork_wasm";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |