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