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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 as the C11/C++11 one: concurrent accesses must always occur through | 52 as the C11/C++11 one: concurrent accesses must always occur through |
53 atomic primitives (offered by `atomic intrinsics | 53 atomic primitives (offered by `atomic intrinsics |
54 <PNaClLangRef.html#atomicintrinsics>`_), and these accesses must always | 54 <PNaClLangRef.html#atomicintrinsics>`_), and these accesses must always |
55 occur with the same size for the same memory location. Visibility of | 55 occur with the same size for the same memory location. Visibility of |
56 stores is provided on a happens-before basis that relates memory | 56 stores is provided on a happens-before basis that relates memory |
57 locations to each other as the C11/C++11 standards do. | 57 locations to each other as the C11/C++11 standards do. |
58 | 58 |
59 Non-atomic memory accesses may be reordered, separated, elided or fused | 59 Non-atomic memory accesses may be reordered, separated, elided or fused |
60 according to C and C++'s memory model before the pexe is created as well | 60 according to C and C++'s memory model before the pexe is created as well |
61 as after its creation. Accessing atomic memory location through | 61 as after its creation. Accessing atomic memory location through |
62 non-atomic primitives is `Undefined Behavior <undefined_behavior>`. | 62 non-atomic primitives is :ref:`Undefined Behavior <undefined_behavior>`. |
63 | 63 |
64 As in C11/C++11 some atomic accesses may be implemented with locks on | 64 As in C11/C++11 some atomic accesses may be implemented with locks on |
65 certain platforms. The ``ATOMIC_*_LOCK_FREE`` macros will always be | 65 certain platforms. The ``ATOMIC_*_LOCK_FREE`` macros will always be |
66 ``1``, signifying that all types are sometimes lock-free. The | 66 ``1``, signifying that all types are sometimes lock-free. The |
67 ``is_lock_free`` methods and ``atomic_is_lock_free`` will return the | 67 ``is_lock_free`` methods and ``atomic_is_lock_free`` will return the |
68 current platform's implementation at translation time. These macros, | 68 current platform's implementation at translation time. These macros, |
69 methods and functions are in the C11 header ``<stdatomic.h>`` and the | 69 methods and functions are in the C11 header ``<stdatomic.h>`` and the |
70 C++11 header ``<atomic>``. | 70 C++11 header ``<atomic>``. |
71 | 71 |
72 The PNaCl toolchain supports concurrent memory accesses through legacy | 72 The PNaCl toolchain supports concurrent memory accesses through legacy |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 prevent reordering of memory accesses to objects which may escape. | 195 prevent reordering of memory accesses to objects which may escape. |
196 | 196 |
197 NaCl supports a fairly wide subset of inline assembly through GCC's | 197 NaCl supports a fairly wide subset of inline assembly through GCC's |
198 inline assembly syntax, with the restriction that the sandboxing model | 198 inline assembly syntax, with the restriction that the sandboxing model |
199 for the target architecture has to be respected. | 199 for the target architecture has to be respected. |
200 | 200 |
201 Undefined Behavior | 201 Undefined Behavior |
202 ================== | 202 ================== |
203 | 203 |
204 The C and C++ languages expose some undefined behavior which is | 204 The C and C++ languages expose some undefined behavior which is |
205 discussed in `PNaCl Undefined Behavior <undefined_behavior>`. | 205 discussed in :ref:`PNaCl Undefined Behavior <undefined_behavior>`. |
206 | 206 |
207 Floating-Point | 207 Floating-Point |
208 ============== | 208 ============== |
209 | 209 |
210 PNaCl exposes 32-bit and 64-bit floating point operations which are | 210 PNaCl exposes 32-bit and 64-bit floating point operations which are |
211 mostly IEEE-754 compliant. There are a few caveats: | 211 mostly IEEE-754 compliant. There are a few caveats: |
212 | 212 |
213 * Some :ref:`floating-point behavior is currently left as undefined | 213 * Some :ref:`floating-point behavior is currently left as undefined |
214 <undefined_behavior_fp>`. | 214 <undefined_behavior_fp>`. |
215 * The default rounding mode is round-to-nearest and other rounding modes | 215 * The default rounding mode is round-to-nearest and other rounding modes |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 A similar feature is **thread suspension**: The ability to | 288 A similar feature is **thread suspension**: The ability to |
289 asynchronously suspend and resume a thread and inspect or modify its | 289 asynchronously suspend and resume a thread and inspect or modify its |
290 execution state (such as register state). | 290 execution state (such as register state). |
291 | 291 |
292 Neither PNaCl nor NaCl currently support asynchronous interruption | 292 Neither PNaCl nor NaCl currently support asynchronous interruption |
293 or suspension of threads. | 293 or suspension of threads. |
294 | 294 |
295 If PNaCl were to support either of these, the interaction of | 295 If PNaCl were to support either of these, the interaction of |
296 ``volatile`` and atomics with same-thread signal handling would need | 296 ``volatile`` and atomics with same-thread signal handling would need |
297 to be carefully detailed. | 297 to be carefully detailed. |
OLD | NEW |