OLD | NEW |
1 ============================ | 1 ============================ |
2 PNaCl C/C++ Language Support | 2 PNaCl C/C++ Language Support |
3 ============================ | 3 ============================ |
4 | 4 |
5 .. contents:: | 5 .. contents:: |
6 :local: | 6 :local: |
7 :backlinks: none | 7 :backlinks: none |
8 :depth: 3 | 8 :depth: 3 |
9 | 9 |
10 Source language support | 10 Source language support |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 PNaCl and NaCl support ``setjmp`` and ``longjmp`` without any | 170 PNaCl and NaCl support ``setjmp`` and ``longjmp`` without any |
171 restrictions beyond C's. | 171 restrictions beyond C's. |
172 | 172 |
173 .. _exception_handling: | 173 .. _exception_handling: |
174 | 174 |
175 C++ Exception Handling | 175 C++ Exception Handling |
176 ====================== | 176 ====================== |
177 | 177 |
178 PNaCl currently supports C++ exception handling through ``setjmp()`` and | 178 PNaCl currently supports C++ exception handling through ``setjmp()`` and |
179 ``longjmp()``, which can be enabled with the ``--pnacl-exceptions=sjlj`` | 179 ``longjmp()``, which can be enabled with the ``--pnacl-exceptions=sjlj`` linker |
180 linker flag. Exceptions are disabled by default so that faster and | 180 flag (set with ``LDFLAGS`` when using Make). Exceptions are disabled by default |
181 smaller code is generated, and ``throw`` statements are replaced with | 181 so that faster and smaller code is generated, and ``throw`` statements are |
182 calls to ``abort()``. The usual ``-fno-exceptions`` flag is also | 182 replaced with calls to ``abort()``. The usual ``-fno-exceptions`` flag is also |
183 supported. PNaCl will support full zero-cost exception handling in the | 183 supported, though the default is ``-fexceptions``. PNaCl will support full |
184 future. | 184 zero-cost exception handling in the future. |
| 185 |
| 186 .. note:: When using naclports_ or other prebuilt static libraries, you don't |
| 187 need to recompile because the exception handling support is |
| 188 implemented at link time (when all the static libraries are put |
| 189 together with your application). |
| 190 |
| 191 .. _naclports: https://code.google.com/p/naclports |
185 | 192 |
186 NaCl supports full zero-cost C++ exception handling. | 193 NaCl supports full zero-cost C++ exception handling. |
187 | 194 |
188 Inline Assembly | 195 Inline Assembly |
189 =============== | 196 =============== |
190 | 197 |
191 Inline assembly isn't supported by PNaCl because it isn't portable. The | 198 Inline assembly isn't supported by PNaCl because it isn't portable. The |
192 one current exception is the common compiler barrier idiom | 199 one current exception is the common compiler barrier idiom |
193 ``asm("":::"memory")``, which gets transformed to a sequentially | 200 ``asm("":::"memory")``, which gets transformed to a sequentially |
194 consistent memory barrier (equivalent to ``__sync_synchronize()``). In | 201 consistent memory barrier (equivalent to ``__sync_synchronize()``). In |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 A similar feature is **thread suspension**: The ability to | 476 A similar feature is **thread suspension**: The ability to |
470 asynchronously suspend and resume a thread and inspect or modify its | 477 asynchronously suspend and resume a thread and inspect or modify its |
471 execution state (such as register state). | 478 execution state (such as register state). |
472 | 479 |
473 Neither PNaCl nor NaCl currently support asynchronous interruption | 480 Neither PNaCl nor NaCl currently support asynchronous interruption |
474 or suspension of threads. | 481 or suspension of threads. |
475 | 482 |
476 If PNaCl were to support either of these, the interaction of | 483 If PNaCl were to support either of these, the interaction of |
477 ``volatile`` and atomics with same-thread signal handling would need | 484 ``volatile`` and atomics with same-thread signal handling would need |
478 to be carefully detailed. | 485 to be carefully detailed. |
OLD | NEW |