| OLD | NEW |
| 1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
| 2 | 2 |
| 3 <section id="nacl-and-pnacl"> | 3 <section id="nacl-and-pnacl"> |
| 4 <span id="id1"></span><h1 id="nacl-and-pnacl"><span id="id1"></span>NaCl and PNa
Cl</h1> | 4 <span id="id1"></span><h1 id="nacl-and-pnacl"><span id="id1"></span>NaCl and PNa
Cl</h1> |
| 5 <p>This document describes the differences between <strong>Native Client</strong
> and | 5 <p>This document describes the differences between <strong>Native Client</strong
> and |
| 6 <strong>Portable Native Client</strong>, and provides recommendations for when t
o use each.</p> | 6 <strong>Portable Native Client</strong>, and provides recommendations for when t
o use each.</p> |
| 7 <div class="contents local" id="contents" style="display: none"> | 7 <div class="contents local" id="contents" style="display: none"> |
| 8 <ul class="small-gap"> | 8 <ul class="small-gap"> |
| 9 <li><a class="reference internal" href="#native-client-nacl" id="id3">Native Cli
ent (NaCl)</a></li> | 9 <li><a class="reference internal" href="#native-client-nacl" id="id3">Native Cli
ent (NaCl)</a></li> |
| 10 <li><a class="reference internal" href="#portable-native-client-pnacl" id="id4">
Portable Native Client (PNaCl)</a></li> | 10 <li><a class="reference internal" href="#portable-native-client-pnacl" id="id4">
Portable Native Client (PNaCl)</a></li> |
| 11 <li><a class="reference internal" href="#when-to-use-pnacl" id="id5">When to use
PNaCl</a></li> | 11 <li><a class="reference internal" href="#when-to-use-pnacl" id="id5">When to use
PNaCl</a></li> |
| 12 <li><a class="reference internal" href="#when-to-use-nacl" id="id6">When to use
NaCl</a></li> | 12 <li><a class="reference internal" href="#when-to-use-nacl" id="id6">When to use
NaCl</a></li> |
| 13 </ul> | 13 </ul> |
| 14 | 14 |
| 15 </div><h2 id="native-client-nacl">Native Client (NaCl)</h2> | 15 </div><h2 id="native-client-nacl">Native Client (NaCl)</h2> |
| 16 <p>Native Client enables the execution of native code securely inside web | 16 <p>Native Client enables the execution of native code securely inside web |
| 17 applications through the use of advanced <a class="reference external" href="/na
tive-client/community/talks#research">Software Fault Isolation (SFI) | 17 applications through the use of advanced <a class="reference external" href="/na
tive-client/community/talks#research">Software Fault Isolation (SFI) |
| 18 techniques</a>. Since its launch in | 18 techniques</a>. Since its launch in |
| 19 2011, Native Client has provided developers with the ability to harness a | 19 2011, Native Client has provided developers with the ability to harness a |
| 20 client machine’s computational power to a much fuller extent than traditio
nal | 20 client machine’s computational power to a much fuller extent than traditio
nal |
| 21 web technologies, by running compiled C and C++ code at near-native speeds and | 21 web technologies, by running compiled C and C++ code at near-native speeds and |
| 22 taking advantage of multiple cores with shared memory.</p> | 22 taking advantage of multiple cores with shared memory.</p> |
| 23 <p>While Native Client provides operating system independence, it requires | 23 <p>While Native Client provides operating system independence, it requires |
| 24 developers to generate architecture-specific executable modules | 24 developers to generate architecture-specific executable |
| 25 (<strong>nexe</strong> modules) for each hardware platform. This is not only inc
onvenient | 25 (<strong>nexe</strong>) modules for each hardware platform. This is not only inc
onvenient |
| 26 for developers, but architecture-specific machine code is not portable and thus | 26 for developers, but architecture-specific machine code is not portable and thus |
| 27 not well-suited for the open web. The traditional method of application | 27 not well-suited for the open web. The traditional method of application |
| 28 distribution on the web is through a self-contained bundle of HTML, CSS, | 28 distribution on the web is through a self-contained bundle of HTML, CSS, |
| 29 JavaScript, and other resources (images, etc.) that can be hosted on a server | 29 JavaScript, and other resources (images, etc.) that can be hosted on a server |
| 30 and run inside a web browser. With this type of distribution, a website | 30 and run inside a web browser. With this type of distribution, a website |
| 31 created today should still work years later, on all platforms. | 31 created today should still work years later, on all platforms. |
| 32 Architecture-specific executables are clearly not a good fit for distribution | 32 Architecture-specific executables are clearly not a good fit for distribution |
| 33 on the web. As a consequence, Native Client has been restricted to | 33 on the web. As a consequence, Native Client has been restricted to |
| 34 applications and browser extensions that are installed through the | 34 applications and browser extensions that are installed through the |
| 35 Chrome Web Store.</p> | 35 Chrome Web Store.</p> |
| 36 <h2 id="portable-native-client-pnacl">Portable Native Client (PNaCl)</h2> | 36 <h2 id="portable-native-client-pnacl">Portable Native Client (PNaCl)</h2> |
| 37 <p>PNaCl solves the portability problem by splitting the compilation process | 37 <p>PNaCl solves the portability problem by splitting the compilation process |
| 38 into two parts:</p> | 38 into two parts:</p> |
| 39 <ol class="arabic simple"> | 39 <ol class="arabic simple"> |
| 40 <li>compiling the source code to a portable bitcode format, and</li> | 40 <li>compiling the source code to a portable bitcode format, and</li> |
| 41 <li>translating the bitcode to a host-specific executable.</li> | 41 <li>translating the bitcode to a host-specific executable just before execution.
</li> |
| 42 </ol> | 42 </ol> |
| 43 <p>PNaCl enables developers | 43 <p>PNaCl enables developers to distribute <strong>portable executables</strong>
(<strong>pexe</strong>) |
| 44 to distribute <strong>portable executables</strong> (<strong>pexe</strong> modul
es) that the hosting | 44 modules that the hosting environment (in other words, the Chrome browser) can |
| 45 environment (e.g., the Chrome browser) can translate to native code before | 45 translate to native code before executing. This portability aligns Native Client |
| 46 executing. This portability aligns Native Client with existing open web | 46 with existing open web technologies such as JavaScript. A developer can |
| 47 technologies such as JavaScript: A developer can distribute a <strong>pexe</stro
ng> | 47 distribute a <strong>pexe</strong> as part of an application (along with HTML, C
SS, and |
| 48 as part of an application (along with HTML, CSS, and JavaScript), | 48 JavaScript), and the user’s machine is simply able to run it.</p> |
| 49 and the user’s machine is simply able to run it.</p> | |
| 50 <p>With PNaCl, a developer generates a single <strong>pexe</strong> from source
code, | 49 <p>With PNaCl, a developer generates a single <strong>pexe</strong> from source
code, |
| 51 rather than multiple platform-specific nexes. The <strong>pexe</strong> provides
both | 50 rather than multiple platform-specific nexes. The <strong>pexe</strong> provides
both |
| 52 architecture- and OS-independence. Since the <strong>pexe</strong> uses an abstr
act, | 51 architecture- and OS-independence. Since the <strong>pexe</strong> uses an abstr
act, |
| 53 architecture-independent format, it does not suffer from the portability | 52 architecture-independent format, it does not suffer from the portability |
| 54 problem described above. Future versions of hosting environments should | 53 problem described above. Future versions of hosting environments should |
| 55 have no problem executing the <strong>pexe</strong>, even on new architectures. | 54 have no problem executing the <strong>pexe</strong>, even on new architectures. |
| 56 Moreover, if an existing architecture is subsequently enhanced, the | 55 Moreover, if an existing architecture is subsequently enhanced, the |
| 57 <strong>pexe</strong> doesn’t even have to be recompiled—in some cas
es the | 56 <strong>pexe</strong> doesn’t even have to be recompiled. In some cases th
e |
| 58 client-side translation will automatically be able to take advantage of | 57 client-side translation will automatically be able to take advantage of |
| 59 the new capabilities.</p> | 58 the new capabilities. A <strong>pexe</strong> module can be part of any web |
| 60 <p><strong>In short, PNaCl combines the portability of existing web technologies
with | 59 application. It does not have to be distributed through the Chrome Web |
| 61 the performance and security benefits of Native Client.</strong></p> | 60 Store. In short, PNaCl combines the portability of existing web technologies |
| 62 <p>With the advent of PNaCl, the distribution restriction of Native Client | 61 with the performance and security benefits of Native Client.</p> |
| 63 can be lifted. Specifically, a <strong>pexe</strong> module can be part of any w
eb | |
| 64 application—it does not have to be distributed through the Chrome Web | |
| 65 Store.</p> | |
| 66 <p>PNaCl is a new technology, and as such it still has a few limitations | 62 <p>PNaCl is a new technology, and as such it still has a few limitations |
| 67 as compared to NaCl. These limitations are described below.</p> | 63 as compared to NaCl. These limitations are described below.</p> |
| 68 <h2 id="when-to-use-pnacl">When to use PNaCl</h2> | 64 <h2 id="when-to-use-pnacl">When to use PNaCl</h2> |
| 69 <p>PNaCl is the preferred toolchain for Native Client, and the only way to deplo
y | 65 <p>PNaCl is the preferred toolchain for Native Client, and the only way to deplo
y |
| 70 Native Client modules on the open web. Unless your project is subject to one | 66 Native Client modules on the open web. Unless your project is subject to one |
| 71 of the narrow limitations described below | 67 of the narrow limitations described below |
| 72 (see <a class="reference internal" href="#when-to-use-nacl"><em>When to use NaCl
</em></a>), you should use PNaCl.</p> | 68 (see <a class="reference internal" href="#when-to-use-nacl"><em>When to use NaCl
</em></a>), you should use PNaCl.</p> |
| 73 <p>Beginning with version 31, the Chrome browser supports translation of | 69 <p>Beginning with version 31, the Chrome browser supports translation of |
| 74 <strong>pexe</strong> modules and their use in web applications, without requiri
ng | 70 <strong>pexe</strong> modules and their use in web applications, without requiri
ng |
| 75 any installation (either of a browser plugin or of the applications | 71 any installation (either of a browser plugin or of the applications |
| 76 themselves). Native Client and PNaCl are open-source technologies, and | 72 themselves). Native Client and PNaCl are open-source technologies, and |
| 77 our hope is that they will be added to other hosting platforms in the | 73 our hope is that they will be added to other hosting platforms in the |
| 78 future.</p> | 74 future.</p> |
| 79 <p>If controlled distribution through the Chrome Web Store is an important part | 75 <p>If controlled distribution through the Chrome Web Store is an important part |
| 80 of your product plan, the benefits of PNaCl are less critical for you. But | 76 of your product plan, the benefits of PNaCl are less critical for you. But |
| 81 you can still use the PNaCl toolchain and distribute your application | 77 you can still use the PNaCl toolchain and distribute your application |
| 82 through the Chrome Web Store, and thereby take advantage of the | 78 through the Chrome Web Store, and thereby take advantage of the |
| 83 conveniences of PNaCl, such as not having to explicitly compile your application | 79 conveniences of PNaCl, such as not having to explicitly compile your application |
| 84 for all supported architectures.</p> | 80 for all supported architectures.</p> |
| 85 <h2 id="when-to-use-nacl"><span id="id2"></span>When to use NaCl</h2> | 81 <h2 id="when-to-use-nacl"><span id="id2"></span>When to use NaCl</h2> |
| 86 <p>The limitations below apply to the current release of PNaCl. If any of | 82 <p>The limitations below apply to the current release of PNaCl. If any of |
| 87 these limitations are critical for your application, you should use | 83 these limitations are critical for your application, you should use |
| 88 non-portable NaCl:</p> | 84 non-portable NaCl:</p> |
| 89 <ul class="small-gap"> | 85 <ul class="small-gap"> |
| 90 <li>By its nature, PNaCl does not support architecture-specific | 86 <li>PNaCl does not support architecture-specific |
| 91 instructions in an application (i.e., inline assembly), but tries to | 87 instructions in an application (i.e., inline assembly), but tries to |
| 92 offer high-performance portable equivalents. One such example is | 88 offer high-performance portable equivalents. One such example is |
| 93 PNaCl’s <a class="reference internal" href="/native-client/reference/pnacl
-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</e
m></a>.</li> | 89 PNaCl’s <a class="reference internal" href="/native-client/reference/pnacl
-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</e
m></a>.</li> |
| 94 <li>Currently PNaCl only supports static linking with the <code>newlib</code> | 90 <li>PNaCl only supports static linking with the <code>newlib</code> |
| 95 C standard library (the Native Client SDK provides a PNaCl port of | 91 C standard library (the Native Client SDK provides a PNaCl port of |
| 96 <code>newlib</code>). Dynamic linking and <code>glibc</code> are not yet support
ed. | 92 <code>newlib</code>). Dynamic linking and <code>glibc</code> are not yet support
ed. |
| 97 Work is under way to enable dynamic linking in future versions of PNaCl.</li> | 93 Work is under way to enable dynamic linking in future versions of PNaCl.</li> |
| 98 <li>In the initial release, PNaCl does not support some GNU extensions | 94 <li>PNaCl does not support some GNU extensions |
| 99 like taking the address of a label for computed <code>goto</code>, or nested | 95 like taking the address of a label for computed <code>goto</code>, or nested |
| 100 functions.</li> | 96 functions.</li> |
| 101 </ul> | 97 </ul> |
| 102 </section> | 98 </section> |
| 103 | 99 |
| 104 {{/partials.standard_nacl_article}} | 100 {{/partials.standard_nacl_article}} |
| OLD | NEW |