diff options
Diffstat (limited to 'native_client_sdk/doc_generated/nacl-and-pnacl.html')
-rw-r--r-- | native_client_sdk/doc_generated/nacl-and-pnacl.html | 139 |
1 files changed, 65 insertions, 74 deletions
diff --git a/native_client_sdk/doc_generated/nacl-and-pnacl.html b/native_client_sdk/doc_generated/nacl-and-pnacl.html index 3b5336c..b884cc7 100644 --- a/native_client_sdk/doc_generated/nacl-and-pnacl.html +++ b/native_client_sdk/doc_generated/nacl-and-pnacl.html @@ -6,93 +6,84 @@ <strong>Portable Native Client</strong>, and provides recommendations for when to use each.</p> <div class="contents local" id="contents" style="display: none"> <ul class="small-gap"> -<li><a class="reference internal" href="#native-client-nacl" id="id3">Native Client (NaCl)</a></li> -<li><a class="reference internal" href="#portable-native-client-pnacl" id="id4">Portable Native Client (PNaCl)</a></li> -<li><a class="reference internal" href="#when-to-use-pnacl" id="id5">When to use PNaCl</a></li> -<li><a class="reference internal" href="#when-to-use-nacl" id="id6">When to use NaCl</a></li> +<li><a class="reference internal" href="#native-client-nacl" id="id6">Native Client (NaCl)</a></li> +<li><a class="reference internal" href="#portable-native-client-pnacl" id="id7">Portable Native Client (PNaCl)</a></li> +<li><a class="reference internal" href="#when-to-use-pnacl" id="id8">When to use PNaCl</a></li> +<li><a class="reference internal" href="#when-to-use-nacl" id="id9">When to use NaCl</a></li> </ul> -</div><h2 id="native-client-nacl">Native Client (NaCl)</h2> +</div><h2 id="native-client-nacl"><span id="id2"></span>Native Client (NaCl)</h2> <p>Native Client enables the execution of native code securely inside web applications through the use of advanced <a class="reference external" href="http://research.google.com/pubs/pub35649.html">Software Fault Isolation (SFI) -techniques</a>. Since its launch in -2011, Native Client has provided developers with the ability to harness a -client machine’s computational power to a much fuller extent than traditional -web technologies, by running compiled C and C++ code at near-native speeds and -taking advantage of multiple cores with shared memory.</p> -<p>While Native Client provides operating system independence, it requires -developers to generate architecture-specific executable -(<strong>nexe</strong>) modules for each hardware platform. This is not only inconvenient -for developers, but architecture-specific machine code is not portable and thus -not well-suited for the open web. The traditional method of application -distribution on the web is through a self-contained bundle of HTML, CSS, -JavaScript, and other resources (images, etc.) that can be hosted on a server -and run inside a web browser. With this type of distribution, a website -created today should still work years later, on all platforms. -Architecture-specific executables are clearly not a good fit for distribution -on the web. As a consequence, Native Client has been restricted to -applications and browser extensions that are installed through the +techniques</a>. Native Client +allows you to harness a client machine’s computational power to a fuller extent +than traditional web technologies. It does this by running compiled C and C++ +code at near-native speeds, and exposing a CPU’s full capabilities, including +SIMD vectors and multiple-core processing with shared memory.</p> +<p>While Native Client provides operating system independence, it requires you to +generate architecture-specific executables (<strong>nexe</strong>) for each hardware +platform. This is neither portable nor convenient, making it ill-suited for the +open web.</p> +<p>The traditional method of application distribution on the web is through self- +contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.) +that can be hosted on a server and run inside a web browser. With this type of +distribution, a website created today should still work years later, on all +platforms. Architecture-specific executables are clearly not a good fit for +distribution on the web. Consequently, Native Client has been until recently +restricted to applications and browser extensions that are installed through the Chrome Web Store.</p> -<h2 id="portable-native-client-pnacl">Portable Native Client (PNaCl)</h2> +<h2 id="portable-native-client-pnacl"><span id="id3"></span>Portable Native Client (PNaCl)</h2> <p>PNaCl solves the portability problem by splitting the compilation process into two parts:</p> <ol class="arabic simple"> -<li>compiling the source code to a portable bitcode format, and</li> -<li>translating the bitcode to a host-specific executable just before execution.</li> +<li>compiling the source code to a bitcode executable (pexe), and</li> +<li>translating the bitcode to a host-specific executable as soon as the module +loads in the browser but before any code execution.</li> </ol> -<p>PNaCl enables developers to distribute <strong>portable executables</strong> (<strong>pexe</strong>) -modules that the hosting environment (in other words, the Chrome browser) can -translate to native code before executing. This portability aligns Native Client -with existing open web technologies such as JavaScript. A developer can -distribute a <strong>pexe</strong> as part of an application (along with HTML, CSS, and -JavaScript), and the user’s machine is simply able to run it.</p> -<p>With PNaCl, a developer generates a single <strong>pexe</strong> from source code, -rather than multiple platform-specific nexes. The <strong>pexe</strong> provides both -architecture- and OS-independence. Since the <strong>pexe</strong> uses an abstract, -architecture-independent format, it does not suffer from the portability -problem described above. Future versions of hosting environments should -have no problem executing the <strong>pexe</strong>, even on new architectures. -Moreover, if an existing architecture is subsequently enhanced, the -<strong>pexe</strong> doesn’t even have to be recompiled. In some cases the -client-side translation will automatically be able to take advantage of -the new capabilities. A <strong>pexe</strong> module can be part of any web -application. It does not have to be distributed through the Chrome Web -Store. In short, PNaCl combines the portability of existing web technologies -with the performance and security benefits of Native Client.</p> +<p>This portability aligns Native Client with existing open web technologies such +as JavaScript. You can distribute a pexe as part of an application (along with +HTML, CSS, and JavaScript), and the user’s machine is simply able to run it.</p> +<p>With PNaCl, you’ll generate a single pexe, rather than multiple platform- +specific nexes. Since the pexe uses an abstract, architecture- and OS- +independent format, it does not suffer from the portability problem described +above. Although, PNaCl can be more efficient on some operating systems than on +others. PNaCl boasts the same level of security as NaCl. Future versions of +hosting environments should have no problem executing the pexe, even on new +architectures. Moreover, if an existing architecture is enhanced, the pexe +doesn’t need to be recompiled. In some cases the client-side translation will +automatically take advantage of new capabilities. A pexe can be part of any web +application. It does not have to be distributed through the Chrome Web Store. In +short, PNaCl combines the portability of existing web technologies with the +performance and security benefits of Native Client.</p> <p>PNaCl is a new technology, and as such it still has a few limitations as compared to NaCl. These limitations are described below.</p> -<h2 id="when-to-use-pnacl">When to use PNaCl</h2> +<h2 id="when-to-use-pnacl"><span id="id4"></span>When to use PNaCl</h2> <p>PNaCl is the preferred toolchain for Native Client, and the only way to deploy -Native Client modules on the open web. Unless your project is subject to one -of the narrow limitations described below -(see <a class="reference internal" href="#when-to-use-nacl"><em>When to use NaCl</em></a>), you should use PNaCl.</p> -<p>Beginning with version 31, the Chrome browser supports translation of -<strong>pexe</strong> modules and their use in web applications, without requiring -any installation (either of a browser plugin or of the applications -themselves). Native Client and PNaCl are open-source technologies, and -our hope is that they will be added to other hosting platforms in the -future.</p> -<p>If controlled distribution through the Chrome Web Store is an important part -of your product plan, the benefits of PNaCl are less critical for you. But -you can still use the PNaCl toolchain and distribute your application -through the Chrome Web Store, and thereby take advantage of the -conveniences of PNaCl, such as not having to explicitly compile your application -for all supported architectures.</p> -<h2 id="when-to-use-nacl"><span id="id2"></span>When to use NaCl</h2> -<p>The limitations below apply to the current release of PNaCl. If any of -these limitations are critical for your application, you should use -non-portable NaCl:</p> +Native Client modules without the Google Web Store. Unless your project is +subject to one of the narrow limitations described under “<a class="reference internal" href="#when-to-use-nacl"><em>When to use +NaCl</em></a>”, you should use PNaCl.</p> +<p>Since version 31, Chrome supports translation of pexe +modules and their use in web applications without requiring installation either +of a browser plug-in or of the applications themselves. Native Client and PNaCl +are open-source technologies, and our hope is that they will be added to other +hosting platforms in the future.</p> +<p>If controlled distribution through the Chrome Web Store is an important part of +your product plan, the benefits of PNaCl are less critical for you. But you can +still use the PNaCl toolchain and distribute your application through the Chrome +Web Store, and thereby take advantage of the conveniences of PNaCl, such as not +having to explicitly compile your application for all supported architectures.</p> +<h2 id="when-to-use-nacl"><span id="id5"></span>When to use NaCl</h2> +<p>Use NaCl if any of the following apply to your application:</p> <ul class="small-gap"> -<li>PNaCl does not support architecture-specific -instructions in an application (i.e., inline assembly), but tries to -offer high-performance portable equivalents. One such example is -PNaCl’s <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</li> -<li>PNaCl only supports static linking with the <code>newlib</code> -C standard library (the Native Client SDK provides a PNaCl port of -<code>newlib</code>). Dynamic linking and <code>glibc</code> are not yet supported. -Work is under way to enable dynamic linking in future versions of PNaCl.</li> -<li>PNaCl does not support some GNU extensions -like taking the address of a label for computed <code>goto</code>, or nested +<li>Your application requires architecture-specific instructions such as, for +example, inline assembly. PNaCl tries to offer high-performance portable +equivalents. One such example is PNaCl’s <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</li> +<li>Your application uses dynamic linking. PNaCl only supports static linking +with a PNaCl port of the <code>newlib</code> C standard library. Dynamic linking and +<code>glibc</code> are not yet supported in PNaCl. Work is under way to enable dynamic +linking in future versions of PNaCl.</li> +<li>Your application uses certain GNU extensions not supported by PNaCl’s LLVM +toolchain, like taking the address of a label for computed <code>goto</code>, or nested functions.</li> </ul> </section> |