aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/webassembly
diff options
context:
space:
mode:
authorRyan Johnson <rjohnson@mozilla.com>2021-04-29 16:16:42 -0700
committerGitHub <noreply@github.com>2021-04-29 16:16:42 -0700
commit95aca4b4d8fa62815d4bd412fff1a364f842814a (patch)
tree5e57661720fe9058d5c7db637e764800b50f9060 /files/pt-pt/webassembly
parentee3b1c87e3c8e72ca130943eed260ad642246581 (diff)
downloadtranslated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.gz
translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.tar.bz2
translated-content-95aca4b4d8fa62815d4bd412fff1a364f842814a.zip
remove retired locales (#699)
Diffstat (limited to 'files/pt-pt/webassembly')
-rw-r--r--files/pt-pt/webassembly/index.html115
-rw-r--r--files/pt-pt/webassembly/using_the_javascript_api/index.html258
2 files changed, 0 insertions, 373 deletions
diff --git a/files/pt-pt/webassembly/index.html b/files/pt-pt/webassembly/index.html
deleted file mode 100644
index 0f6ead1b6b..0000000000
--- a/files/pt-pt/webassembly/index.html
+++ /dev/null
@@ -1,115 +0,0 @@
----
-title: WebAssembly
-slug: WebAssembly
-tags:
- - Landing
- - WebAssembly
- - wasm
-translation_of: WebAssembly
----
-<div>{{WebAssemblySidebar}}</div>
-
-<p class="summary" dir="ltr" id="docs-internal-guid-22bb55aa-d69e-e8ef-cbc6-aafea272f684">WebAssembly é um novo tipo de código que pode ser executado nos navegadores da Web modernos — é uma linguagem de montagem de baixo nível com um formato binário compacto que é executado com desempenho quase nativo e fornece linguagens como C/C++ com um destino de compilação para que possam ser executadas na Web. Este também é projetado para funcionar com JavaScript, permitindo que ambos trabalhem juntos.</p>
-
-<h2 dir="ltr" id="In_a_Nutshell">In a Nutshell</h2>
-
-<p dir="ltr">WebAssembly has huge implications for the web platform — it provides a way to run code written in multiple languages on the web at near native speed, with client apps running on the web that previously couldn’t have done so.</p>
-
-<p dir="ltr">WebAssembly is designed to complement and run alongside JavaScript — using the WebAssembly JavaScript APIs, you can load WebAssembly modules into a JavaScript app and share functionality between the two. This allows you to take advantage of WebAssembly's performance and power and JavaScript's expressiveness and flexibility in the same apps, even if you don't know how to write WebAssembly code.</p>
-
-<p dir="ltr">And what's even better is that it is being developed as a web standard via the <a href="https://www.w3.org/wasm/">W3C WebAssembly Working Group</a> and <a href="https://www.w3.org/community/webassembly/">Community Group</a> with active participation from all major browser vendors.</p>
-
-<div class="row topicpage-table">
-<div class="section">
-<h2 dir="ltr" id="Guias">Guias</h2>
-
-<dl>
- <dt><a href="/en-US/docs/WebAssembly/Concepts">WebAssembly concepts</a></dt>
- <dd>Get started by reading the high-level concepts behind WebAssembly — what it is, why it is so useful, how it fits into the web platform (and beyond), and how to use it.</dd>
- <dt><a href="/en-US/docs/WebAssembly/C_to_wasm">Compiling a New C/C++ Module to WebAssembly</a></dt>
- <dd>When you’ve written code in C/C++, you can then compile it into .wasm using a tool like <a href="/en-US/docs/Mozilla/Projects/Emscripten/">Emscripten</a>. Let’s look at how it works.</dd>
- <dt><a href="https://developer.mozilla.org/en-US/docs/WebAssembly/existing_C_to_wasm">Compiling an Existing C Module to WebAssembly</a></dt>
- <dd>A core use-case for WebAssembly is to take the existing ecosystem of C libraries and allow developers to use them on the web.</dd>
- <dt><a href="/en-US/docs/WebAssembly/Loading_and_running">Loading and running WebAssembly code</a></dt>
- <dd>After you have a .wasm, this article covers how to fetch, compile and instantiate it, combining the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly">WebAssembly JavaScript</a> API with the <a href="/en-US/docs/Web/API/Fetch_API">Fetch</a> or <a href="/en-US/docs/Web/API/XMLHttpRequest">XHR</a> APIs.</dd>
- <dt><a href="/en-US/docs/WebAssembly/Using_the_JavaScript_API">Using the WebAssembly JavaScript API</a></dt>
- <dd>Once you've loaded a .wasm module, you'll want to use it. In this article we show you how to use WebAssembly via the WebAssembly JavaScript API.</dd>
- <dt><a href="/en-US/docs/WebAssembly/Exported_functions">Exported WebAssembly functions</a></dt>
- <dd>Exported WebAssembly functions are the JavaScript reflections of WebAssembly functions which allow calling WebAssembly code from JavaScript. This article describes what they are.</dd>
- <dt><a href="/en-US/docs/WebAssembly/Understanding_the_text_format">Understanding WebAssembly text format</a></dt>
- <dd>This article explains the wasm text format. This is the low-level textual representation of a .wasm module shown in browser developer tools when debugging.</dd>
- <dt><a href="/en-US/docs/WebAssembly/Text_format_to_wasm">Converting WebAssembly text format to wasm</a></dt>
- <dd>This article provides a guide on how to convert a WebAssembly module written in the text format into a .wasm binary.</dd>
-</dl>
-</div>
-
-<div class="section">
-<h2 dir="ltr" id="Referência_de_API">Referência de API</h2>
-
-<dl>
- <dt>{{jsxref("Global_objects/WebAssembly", "WebAssembly")}}</dt>
- <dd>This object acts as the namespace for all WebAssembly related functionality.</dd>
- <dt>{{jsxref("Global_objects/WebAssembly/Module", "WebAssembly.Module()")}}</dt>
- <dd>A <code>WebAssembly.Module</code> object contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently <a href="/en-US/docs/Web/API/Worker/postMessage">shared with Workers</a>, and instantiated multiple times.</dd>
- <dt>{{jsxref("Global_objects/WebAssembly/Instance", "WebAssembly.Instance()")}}</dt>
- <dd>A <code>WebAssembly.Instance</code> object is a stateful, executable instance of a <code>Module</code>.  <code>Instance</code> objects contain all the <a href="/en-US/docs/WebAssembly/Exported_functions">Exported WebAssembly functions</a> that allow calling into WebAssembly code from JavaScript.</dd>
- <dt>{{jsxref("Global_objects/WebAssembly/instantiateStreaming", "WebAssembly.instantiateStreaming()")}}</dt>
- <dd>The <code>WebAssembly.instantiateStreaming()</code> function is the primary API for compiling and instantiating WebAssembly code, returning both a <code>Module</code> and its first <code>Instance</code>.</dd>
- <dt>{{jsxref("Global_objects/WebAssembly/Memory", "WebAssembly.Memory()")}}</dt>
- <dd>A <code>WebAssembly.</code><code>Memory</code> object is a resizable {{jsxref("Global_objects/ArrayBuffer", "ArrayBuffer")}} that holds the raw bytes of memory accessed by an <code>Instance</code>.</dd>
- <dt>{{jsxref("Global_objects/WebAssembly/Table", "WebAssembly.Table()")}}</dt>
- <dd>A <code>WebAssembly.</code><code>Table</code> object is a resizable typed array of opaque values, like function references, that are accessed by an <code>Instance</code>.</dd>
- <dt>{{jsxref("WebAssembly.CompileError()")}}</dt>
- <dd>Creates a new WebAssembly <code>CompileError</code> object.</dd>
- <dt>{{jsxref("WebAssembly.LinkError()")}}</dt>
- <dd>Creates a new WebAssembly <code>LinkError</code> object.</dd>
- <dt>{{jsxref("WebAssembly.RuntimeError()")}}</dt>
- <dd>Creates a new WebAssembly <code>RuntimeError</code> object.</dd>
-</dl>
-</div>
-</div>
-
-<h2 dir="ltr" id="Exemplos">Exemplos</h2>
-
-<ul dir="ltr">
- <li><a href="https://github.com/JasonWeathersby/WASMSobel">WASMSobel</a></li>
- <li>See our <a href="https://github.com/mdn/webassembly-examples/">webassembly-examples</a> repo for a number of other examples.</li>
-</ul>
-
-<h2 id="Especificações">Especificações</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Especificação</th>
- <th scope="col">Estado</th>
- <th scope="col">Comentário</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName('WebAssembly JS')}}</td>
- <td>{{Spec2('WebAssembly JS')}}</td>
- <td>Initial draft definition of the JavaScript API.</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilidade de navegador</h2>
-
-<div>
-
-
-<p>{{Compat("javascript.builtins.WebAssembly")}}</p>
-</div>
-
-<h2 id="Consultar_também">Consultar também</h2>
-
-<ul dir="ltr">
- <li><a href="https://research.mozilla.org/webassembly/">WebAssembly on Mozilla Research</a></li>
- <li><a href="http://webassembly.org/">webassembly.org</a></li>
- <li><a href="https://hacks.mozilla.org/category/webassembly/">WebAssembly articles on Mozilla Hacks blog</a></li>
- <li><a href="https://www.w3.org/community/webassembly/">W3C WebAssembly Community Group</a></li>
- <li><a href="/en-US/docs/Web/HTTP/Headers/Large-Allocation">Large-Allocation HTTP header</a></li>
- <li><a href="https://developers.google.com/web/updates/2018/03/emscripting-a-c-library">Emscripting a C Library to Wasm</a></li>
-</ul>
diff --git a/files/pt-pt/webassembly/using_the_javascript_api/index.html b/files/pt-pt/webassembly/using_the_javascript_api/index.html
deleted file mode 100644
index 691ddd443c..0000000000
--- a/files/pt-pt/webassembly/using_the_javascript_api/index.html
+++ /dev/null
@@ -1,258 +0,0 @@
----
-title: Utilizar a WebAssembly JavaScript API
-slug: WebAssembly/Using_the_JavaScript_API
-tags:
- - API
- - Ferramentas de Desenvolvimento
- - JavaScript
- - WebAssembley
- - compilar
- - instantiate
- - memoria
- - tabela
-translation_of: WebAssembly/Using_the_JavaScript_API
-original_slug: WebAssembly/Utilizar_API_JavaScript_WebAssembly
----
-<div>{{WebAssemblySidebar}}</div>
-
-<p class="summary">Se já <a href="/pt-PT/docs/WebAssembly/C_para_wasm">compilou um módulo a partir de outra linguagem utilziando as ferramentas, tal como Emscripten</a>, ou <a href="/pt-PT/docs/WebAssembly/Carregar_executar_codigo_WebAssembly">carregou e executou o código por si mesmo</a>, o passo seguinte é saber mais sobre como utilizar as outras funcionaldiades da WebAssembly JavaScript API. Este artigo ensina-lhe o que precisa de saber.</p>
-
-<div class="note">
-<p><strong>Nota</strong>: If you are unfamiliar with the basic concepts mentioned in this article and need more explanation, read <a href="/en-US/docs/WebAssembly/Concepts">WebAssembly concepts</a> first, then come back.</p>
-</div>
-
-<h2 id="Alguns_exemplos_simples">Alguns exemplos simples</h2>
-
-<p>Let’s run through some examples that explain how to use the WebAssembly JavaScript API, and how to use it to load a wasm module in a web page.</p>
-
-<div class="note">
-<p><strong>Nota</strong>: You can find the sample code in our <a href="https://github.com/mdn/webassembly-examples">webassembly-examples</a> GitHub repo.</p>
-</div>
-
-<h3 id="Preparar_o_exemplo">Preparar o exemplo</h3>
-
-<ol>
- <li>First we need a wasm module! Grab our <a href="https://github.com/mdn/webassembly-examples/raw/master/js-api-examples/simple.wasm">simple.wasm</a> file and save a copy in a new directory on your local machine.</li>
- <li>Next, let’s create a simple HTML file called <code>index.html</code> in the same directory as your wasm file (can use our <a href="https://github.com/mdn/webassembly-examples/blob/master/template/template.html">simple template</a> if you haven’t got one easily available).</li>
- <li>Now, to help us understand what is going on here, let’s look at the text representation of our wasm module (which we also meet in <a href="/en-US/docs/WebAssembly/Text_format_to_wasm#A_first_look_at_the_text_format">Converting WebAssembly format to wasm</a>):
- <pre>(module
- (func $i (import "imports" "imported_func") (param i32))
- (func (export "exported_func")
- i32.const 42
- call $i))</pre>
- </li>
- <li>In the second line, you will see that the import has a two-level namespace — the internal function <code>$i</code> is imported from <code>imports.imported_func</code>. We need to reflect this two-level namespace in JavaScript when writing the object to be imported into the wasm module. Create a <code>&lt;script&gt;&lt;/script&gt;</code> element in your HTML file, and add the following code to it:
- <pre class="brush: js">var importObject = {
- imports: { imported_func: arg =&gt; console.log(arg) }
-};</pre>
- </li>
-</ol>
-
-<h3 id="Transmitir_o_módulo_WebAssembly">Transmitir o módulo WebAssembly</h3>
-
-<p>New in Firefox 58 is the ability to compile and instantiate WebAssembly modules directly from underlying sources. This is achieved using the {{jsxref("WebAssembly.compileStreaming()")}} and {{jsxref("WebAssembly.instantiateStreaming()")}} methods. These methods are easier than their non-streaming counterparts, because they can turn the byte code directly into <code>Module</code>/<code>Instance</code> instances, cutting out the need to separately put the {{domxref("Response")}} into an {{domxref("ArrayBuffer")}}.</p>
-
-<p>This example (see our <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/instantiate-streaming.html">instantiate-streaming.html</a> demo on GitHub, and <a href="https://mdn.github.io/webassembly-examples/js-api-examples/instantiate-streaming.html">view it live</a> also) shows how to use <code>instantiateStreaming()</code> to fetch a wasm module, import a JavaScript function into it, compile and instantiate it, and access its exported function — all in one step.</p>
-
-<p>Add the following to your script, below the first block:</p>
-
-<pre class="brush: js">WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject)
-.then(obj =&gt; obj.instance.exports.exported_func());</pre>
-
-<p>The net result of this is that we call our exported WebAssembly function <code>exported_func</code>, which in turn calls our imported JavaScript function <code>imported_func</code>, which logs the value provided inside the WebAssembly instance (42) to the console. If you save your example code now and load it a browser that supports WebAssembly, you’ll see this in action!</p>
-
-<div class="note">
-<p><strong>Nota</strong>: This is a convoluted, longwinded example that achieves very little, but it does serve to illustrate what is possible — using WebAssembly code alongside JavaScript in your web applications. As we’ve said elsewhere, WebAssembly doesn’t aim to replace JavaScript; the two instead can work together, drawing on each other’s strengths.</p>
-</div>
-
-<h3 id="Carregar_o_nosso_módulo_wasm_sem_transmitir">Carregar o nosso módulo <em>wasm</em> sem transmitir</h3>
-
-<p>If you can't or don't want to use the streaming methods as described above, you can use the non-streaming methods {{jsxref("WebAssembly.compile")}} / {{jsxref("WebAssembly.instantiate")}} instead.</p>
-
-<p>These methods don't directly access the byte code, so require an extra step to turn the response into an {{domxref("ArrayBuffer")}} before compiling/instantiating the wasm module.</p>
-
-<p>The equivalent code would look like this:</p>
-
-<pre class="brush: js">fetch('simple.wasm').then(response =&gt;
- response.arrayBuffer()
-).then(bytes =&gt;
- WebAssembly.instantiate(bytes, importObject)
-).then(results =&gt; {
- results.instance.exports.exported_func();
-});</pre>
-
-<h3 id="Visualização_de_wasm_nas_ferramentas_do_programador">Visualização de <em>wasm</em> nas ferramentas do programador</h3>
-
-<p>In Firefox 54+, the Developer Tool Debugger Panel has functionality to expose the text representation of any wasm code included in a web page. To view it, you can go to the Debugger Panel and click on the “wasm://” entry.</p>
-
-<p><img alt="" src="https://mdn.mozillademos.org/files/15823/wasm-debug.png" style="display: block; height: 317px; margin: 0px auto; width: 1019px;"></p>
-
-<p>Starting soon in Firefox, in addition to viewing WebAssembly as text, developers will be able to debug (place breakpoints, inspect the callstack, single-step, etc.) WebAssembly using the text format. See <span class="watch-title" dir="ltr" id="eow-title" title="WebAssembly debugging with Firefox DevTools"><a href="https://www.youtube.com/watch?v=R1WtBkMeGds">WebAssembly debugging with Firefox DevTools</a> </span>for a video preview.</p>
-
-<h2 id="Memória">Memória</h2>
-
-<p>In the low-level memory model of WebAssembly, memory is represented as a contiguous range of untyped bytes called <a href="http://webassembly.org/docs/semantics/#linear-memory">Linear Memory</a> that are read and written by <a href="http://webassembly.org/docs/semantics/#linear-memory-accesses">load and store instructions</a> inside the module.  In this memory model, any load or store can access any byte in the entire linear memory, which is necessary to faithfully represent C/C++ concepts like pointers.</p>
-
-<p>Unlike a native C/C++ program, however, where the available memory range spans the entire process, the memory accessible by a particular WebAssembly Instance is confined to one specific — potentially very small — range contained by a WebAssembly Memory object.  This allows a single web app to use multiple independent libraries — each of which are using WebAssembly internally — to have separate memories that are fully isolated from each other.</p>
-
-<p>In JavaScript, a Memory instance can be thought of as a resizable ArrayBuffer and, just as with ArrayBuffers, a single web app can create many independent Memory objects.  You can create one using the {{jsxref("WebAssembly.Memory()")}} constructor, which takes as arguments an initial size and (optionally) a maximum size.</p>
-
-<p>Let’s start exploring this by looking at a quick example.</p>
-
-<ol>
- <li>
- <p>Create another new simple HTML page (copy our <a href="https://github.com/mdn/webassembly-examples/blob/master/template/template.html">simple template</a>) and call it <code>memory.html</code>. Add a <code>&lt;script&gt;&lt;/script&gt;</code> element to the page.</p>
- </li>
- <li>
- <p>Now add the following line to the top of your script, to create a memory instance:</p>
-
- <pre class="brush: js">var memory = new WebAssembly.Memory({initial:10, maximum:100});</pre>
-
- <p>The unit of <code>initial</code> and <code>maximum</code> is WebAssembly pages — these are fixed to 64KB in size. This means that the above memory instance has an initial size of 640KB, and a maximum size of 6.4MB.</p>
-
- <p>WebAssembly memory exposes its bytes by simply providing a buffer getter/setter that returns an ArrayBuffer. For example, to write 42 directly into the first word of linear memory, you can do this:</p>
-
- <pre class="brush: js">new Uint32Array(memory.buffer)[0] = 42;</pre>
-
- <p>You can then return the same value using:</p>
-
- <pre class="brush: js">new Uint32Array(memory.buffer)[0]</pre>
- </li>
- <li>
- <p>Try this now in your demo — save what you’ve added so far, load it in your browser, then try entering the above two lines in your JavaScript console.</p>
- </li>
-</ol>
-
-<h3 id="Aumento_de_memória">Aumento de memória</h3>
-
-<p>A memory instance can be grown by calls to {{jsxref("Memory.prototype.grow()")}}, where again the argument is specified in units of WebAssembly pages:</p>
-
-<pre class="brush: js">memory.grow(1);</pre>
-
-<p>If a maximum value was supplied upon creation of the memory instance, attempts to grow past this maximum will throw a {{jsxref("WebAssembly.RangeError")}} exception. The engine takes advantage of this supplied upper-bounds to reserve memory ahead of time, which can make resizing more efficient.</p>
-
-<p>Note: Since an {{domxref("ArrayBuffer")}}’s byteLength is immutable, after a successful {{jsxref("Memory.prototype.grow()")}} operation the buffer getter will return a new ArrayBuffer object (with the new byteLength) and any previous ArrayBuffer objects become “detached”, or disconnected from the underlying memory they previously pointed to.</p>
-
-<p>Just like functions, linear memories can be defined inside a module or imported. Similarly, a module may also optionally export its memory. This means that JavaScript can get access to the memory of a WebAssembly instance either by creating a new <code>WebAssembly.Memory</code> and passing it in as an import or by receiving a Memory export (via <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance/exports">Instance.prototype.exports</a></code>).</p>
-
-<h3 id="Exemplo_de_memória_mais_envolvida">Exemplo de memória mais envolvida</h3>
-
-<p>Let’s make the above assertions clearer by looking at a more involved memory example — a WebAssembly module that imports the memory instance we defined earlier, populates it with an array of integers, then sums them. You can find this at <a href="https://github.com/mdn/webassembly-examples/raw/master/js-api-examples/memory.wasm">memory.wasm.</a></p>
-
-<ol>
- <li>
- <p>make a local copy of <code>memory.wasm</code> in the same directory as before.</p>
-
- <div class="note">
- <p><strong>Nota</strong>: You can see the module’s text representation at <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/memory.wat">memory.wat</a>.</p>
- </div>
- </li>
- <li>
- <p>Go back to your <code>memory.html</code> sample file, and fetch, compile, and instantiate your wasm module as before — add the following to the bottom of your script:</p>
-
- <pre class="brush: js">WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js: { mem: memory } })
-.then(obj =&gt; {
-  // add code here
-});</pre>
- </li>
- <li>
- <p>Since this module exports its memory, given an Instance of this module called instance we can use an exported function <code>accumulate()</code> to create and populate an input array directly in the module instance’s linear memory (<code>mem</code>). Add the following into your code, where indicated:</p>
-
- <pre class="brush: js">var i32 = new Uint32Array(memory.buffer);
-
-for (var i = 0; i &lt; 10; i++) {
- i32[i] = i;
-}
-
-var sum = results.instance.exports.accumulate(0, 10);
-console.log(sum);</pre>
- </li>
-</ol>
-
-<p>Note how we create the {{domxref("Uint32Array")}} view on the Memory object’s buffer (<code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory/buffer">Memory.prototype.buffer</a></code>), not on the Memory itself.</p>
-
-<p>Memory imports work just like function imports, only Memory objects are passed as values instead of JavaScript functions. Memory imports are useful for two reasons:</p>
-
-<ul>
- <li>They allow JavaScript to fetch and create the initial contents of memory before or concurrently with module compilation.</li>
- <li>They allow a single Memory object to be imported by multiple module instances, which is a critical building block for implementing dynamic linking in WebAssembly.</li>
-</ul>
-
-<div class="note">
-<p><strong>Nota</strong>: You can find our complete demo at <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/memory.html">memory.html</a> (<a href="https://mdn.github.io/webassembly-examples/js-api-examples/memory.html">see it live also</a>) — this version uses the <code><a href="https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js">fetchAndInstantiate()</a></code> function.</p>
-</div>
-
-<h2 id="Tabelas">Tabelas</h2>
-
-<p>A WebAssembly Table is a resizable typed array of <a href="https://en.wikipedia.org/wiki/Reference_(computer_science)">references</a> that can be accessed by both JavaScript and WebAssembly code.  While Memory provides a resizable typed array of raw bytes, it is unsafe for references to be stored in a Memory since a reference is an engine-trusted value whose bytes must not be read or written directly by content for safety, portability, and stability reasons.</p>
-
-<p>Tables have an element type, which limits the types of reference that can be stored in the table.  In the current iteration of WebAssembly, there is only one type of reference needed by WebAssembly code — functions — and thus only one valid element type.  In future iterations, more element types will be added.</p>
-
-<p>Function references are necessary to compile languages like C/C++ that have function pointers.  In a native implementation of C/C++, a function pointer is represented by the raw address of the function’s code in the process’s virtual address space and so, for the safety reasons mentioned above, cannot be stored directly in linear memory.  Instead, function references are stored in a table and their indexes, which are integers and can be stored in linear memory, are passed around instead.</p>
-
-<p>When the time comes to call a function pointer, the WebAssembly caller supplies the index, which can then be safety bounds checked against the table before indexing and calling the indexed function reference.  Thus, tables are currently a rather low-level primitive used to compile low-level programming language features safely and portably.</p>
-
-<p>Tables can be mutated via <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/set">Table.prototype.set()</a></code>, which updates one of the values in a table, and <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/grow">Table.prototype.grow()</a></code>, which increases the number of values that can be stored in a table.  This allows the indirectly-callable set of functions to change over time, which is necessary for <a href="http://webassembly.org/docs/dynamic-linking/">dynamic linking techniques</a>.  The mutations are immediately accessible via <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/get">Table.prototype.get()</a></code> in JavaScript, and to wasm modules.</p>
-
-<h3 id="Um_exemplo_de_tabela">Um exemplo de tabela</h3>
-
-<p>Let’s looking at an simple table example — a WebAssembly module that creates and exports a table with two elements: element 0 returns 13 and element 1 returns 42. You can find this at <a href="https://github.com/mdn/webassembly-examples/raw/master/js-api-examples/table.wasm">table.wasm</a>.</p>
-
-<ol>
- <li>
- <p>Make a local copy of <code>table.wasm</code> in a new directory.</p>
-
- <div class="note">
- <p><strong>Nota</strong>: You can see the module’s text representation at <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/table.wat">table.wat</a>.</p>
- </div>
- </li>
- <li>
- <p>Create a new copy of our <a href="https://github.com/mdn/webassembly-examples/blob/master/template/template.html">HTML template</a> in the same directory and call it <code>table.html</code>.</p>
- </li>
- <li>
- <p>As before, fetch, compile, and instantiate your wasm module — add the following into a {{htmlelement("script")}} element at the bottom of your HTML body:</p>
-
- <pre class="brush: js">WebAssembly.instantiateStreaming(fetch('table.wasm'))
-.then(function(obj) {
-  // add code here
-});</pre>
- </li>
- <li>
- <p>Now let’s access the data in the tables — add the following lines to your code in the indicated place:</p>
-
- <pre class="brush: js">var tbl = results.instance.exports.tbl;
-console.log(tbl.get(0)());  // 13
-console.log(tbl.get(1)());  // 42</pre>
- </li>
-</ol>
-
-<p>This code accesses each function reference stored in the table in turn, and instantiates them to print the values they hold to the console — note how each function reference is retrieved with a <code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/get">Table.prototype.get()</a></code> call, then we add an extra set of parentheses on the end to actually invoke the function.</p>
-
-<div class="note">
-<p><strong>Nota</strong>: You can find our complete demo at <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/table.html">table.html</a> (<a href="https://mdn.github.io/webassembly-examples/js-api-examples/table.html">see it live also</a>) — this version uses the <code><a href="https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js">fetchAndInstantiate()</a></code> function.</p>
-</div>
-
-<h2 id="Multiplicidade">Multiplicidade</h2>
-
-<p>Now we’ve demonstrated usage of the main key WebAssembly building blocks, this is a good place to mention the concept of multiplicity. This provides WebAssembly with a multitude of advances in terms of architectural efficiency:</p>
-
-<ul>
- <li>One module can have N Instances, in the same way that one function literal can produce N closure values.</li>
- <li>One module instance can use 0–1 memory instances, which provide the "address space" of the instance. Future versions of WebAssembly may allow 0–N memory instances per module instance (see <a href="http://webassembly.org/docs/future-features/#multiple-tables-and-memories">Multiple Tables and Memories</a>).</li>
- <li>One module instance can use 0–1 table instances — this is the "function address space" of the instance, used to implement C function pointers. Future versions of WebAssembly may allow 0–N table instances per module instance in the future.</li>
- <li>One memory or table instance can be used by 0–N module instances — these instances all share the same address space, allowing <a href="http://webassembly.org/docs/dynamic-linking">dynamic linking</a>.</li>
-</ul>
-
-<p>You can see multiplicity in action in our Understanding text format article — see the <a href="/en-US/docs/WebAssembly/Understanding_the_text_format#Mutating_tables_and_dynamic_linking">Mutating tables and dynamic linking section</a>.</p>
-
-<h2 id="Resumo">Resumo</h2>
-
-<p>This article has taken you through the basics of using the WebAssembly JavaScript API to include a WebAssembly module in a JavaScript context and make use of its functions, and how to use WebAssembly memory and tables in JavaScript. We also touched on the concept of multiplicity.</p>
-
-<h2 id="Consultar_também">Consultar também</h2>
-
-<ul>
- <li><a href="http://webassembly.org/">webassembly.org</a></li>
- <li><a href="/pt-PT/docs/WebAssembly/Conceitos">Conceitos de WebAssembly</a></li>
- <li><a href="https://research.mozilla.org/webassembly/">WebAssembly na Mozilla Research</a></li>
-</ul>