OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="pnacl-c-c-language-support"> | 3 <section id="pnacl-c-c-language-support"> |
4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> | 4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> | 7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> |
8 <ul class="small-gap"> | 8 <ul class="small-gap"> |
9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> | 9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> |
10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> | 10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 <p>PNaCl and NaCl support <code>setjmp</code> and <code>longjmp</code> without a
ny | 155 <p>PNaCl and NaCl support <code>setjmp</code> and <code>longjmp</code> without a
ny |
156 restrictions beyond C’s.</p> | 156 restrictions beyond C’s.</p> |
157 <h2 id="c-exception-handling"><span id="exception-handling"></span>C++ Exception
Handling</h2> | 157 <h2 id="c-exception-handling"><span id="exception-handling"></span>C++ Exception
Handling</h2> |
158 <p>PNaCl currently supports C++ exception handling through <code>setjmp()</code>
and | 158 <p>PNaCl currently supports C++ exception handling through <code>setjmp()</code>
and |
159 <code>longjmp()</code>, which can be enabled with the <code>--pnacl-exceptions=s
jlj</code> | 159 <code>longjmp()</code>, which can be enabled with the <code>--pnacl-exceptions=s
jlj</code> |
160 linker flag. Exceptions are disabled by default so that faster and | 160 linker flag. Exceptions are disabled by default so that faster and |
161 smaller code is generated, and <code>throw</code> statements are replaced with | 161 smaller code is generated, and <code>throw</code> statements are replaced with |
162 calls to <code>abort()</code>. The usual <code>-fno-exceptions</code> flag is al
so | 162 calls to <code>abort()</code>. The usual <code>-fno-exceptions</code> flag is al
so |
163 supported. PNaCl will support full zero-cost exception handling in the | 163 supported. PNaCl will support full zero-cost exception handling in the |
164 future.</p> | 164 future.</p> |
| 165 <aside> |
| 166 When using <a class="reference external" href="https://code.google.com/p/naclpor
ts">naclports</a> or other prebuilt static libraries, you’ll want |
| 167 to make sure you rebuild these libraries with exception handling |
| 168 enabled. For naclports, you’ll want to modify the port’s <code>build
.sh</code>. |
| 169 </aside> |
165 <p>NaCl supports full zero-cost C++ exception handling.</p> | 170 <p>NaCl supports full zero-cost C++ exception handling.</p> |
166 <h2 id="inline-assembly">Inline Assembly</h2> | 171 <h2 id="inline-assembly">Inline Assembly</h2> |
167 <p>Inline assembly isn’t supported by PNaCl because it isn’t portabl
e. The | 172 <p>Inline assembly isn’t supported by PNaCl because it isn’t portabl
e. The |
168 one current exception is the common compiler barrier idiom | 173 one current exception is the common compiler barrier idiom |
169 <code>asm("":::"memory")</code>, which gets transformed to a
sequentially | 174 <code>asm("":::"memory")</code>, which gets transformed to a
sequentially |
170 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In | 175 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In |
171 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic | 176 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic |
172 memory accesses, though in practice the implementation attempts to also | 177 memory accesses, though in practice the implementation attempts to also |
173 prevent reordering of memory accesses to objects which may escape.</p> | 178 prevent reordering of memory accesses to objects which may escape.</p> |
174 <p>PNaCl supports <a class="reference internal" href="#portable-simd-vectors"><e
m>Portable SIMD Vectors</em></a>, | 179 <p>PNaCl supports <a class="reference internal" href="#portable-simd-vectors"><e
m>Portable SIMD Vectors</em></a>, |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 <p>Neither PNaCl nor NaCl currently support asynchronous interruption | 437 <p>Neither PNaCl nor NaCl currently support asynchronous interruption |
433 or suspension of threads.</p> | 438 or suspension of threads.</p> |
434 </li> | 439 </li> |
435 </ul> | 440 </ul> |
436 <p>If PNaCl were to support either of these, the interaction of | 441 <p>If PNaCl were to support either of these, the interaction of |
437 <code>volatile</code> and atomics with same-thread signal handling would need | 442 <code>volatile</code> and atomics with same-thread signal handling would need |
438 to be carefully detailed.</p> | 443 to be carefully detailed.</p> |
439 </section> | 444 </section> |
440 | 445 |
441 {{/partials.standard_nacl_article}} | 446 {{/partials.standard_nacl_article}} |
OLD | NEW |