Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst

Issue 164413005: PNaCl documentation: add undefined behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 The memory model offered by PNaCl relies on the same coding guidelines 42 The memory model offered by PNaCl relies on the same coding guidelines
43 as the C11/C++11 one: concurrent accesses must always occur through 43 as the C11/C++11 one: concurrent accesses must always occur through
44 atomic primitives (offered by `atomic intrinsics 44 atomic primitives (offered by `atomic intrinsics
45 <PNaClLangRef.html#atomicintrinsics>`_), and these accesses must always 45 <PNaClLangRef.html#atomicintrinsics>`_), and these accesses must always
46 occur with the same size for the same memory location. Visibility of 46 occur with the same size for the same memory location. Visibility of
47 stores is provided on a happens-before basis that relates memory 47 stores is provided on a happens-before basis that relates memory
48 locations to each other as the C11/C++11 standards do. 48 locations to each other as the C11/C++11 standards do.
49 49
50 Non-atomic memory accesses may be reordered, separated, elided or fused 50 Non-atomic memory accesses may be reordered, separated, elided or fused
51 according to C and C++'s memory model before the pexe is created as well 51 according to C and C++'s memory model before the pexe is created as well
52 as after its creation. 52 as after its creation. Accessing atomic memory location through
53 non-atomic primitives is `Undefined Behavior <undefined_behavior>`.
53 54
54 As in C11/C++11 some atomic accesses may be implemented with locks on 55 As in C11/C++11 some atomic accesses may be implemented with locks on
55 certain platforms. The ``ATOMIC_*_LOCK_FREE`` macros will always be 56 certain platforms. The ``ATOMIC_*_LOCK_FREE`` macros will always be
56 ``1``, signifying that all types are sometimes lock-free. The 57 ``1``, signifying that all types are sometimes lock-free. The
57 ``is_lock_free`` methods and ``atomic_is_lock_free`` will return the 58 ``is_lock_free`` methods and ``atomic_is_lock_free`` will return the
58 current platform's implementation at translation time. These macros, 59 current platform's implementation at translation time. These macros,
59 methods and functions are in the C11 header ``<stdatomic.h>`` and the 60 methods and functions are in the C11 header ``<stdatomic.h>`` and the
60 C++11 header ``<atomic>``. 61 C++11 header ``<atomic>``.
61 62
62 The PNaCl toolchain supports concurrent memory accesses through legacy 63 The PNaCl toolchain supports concurrent memory accesses through legacy
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ``asm("":::"memory")``, which gets transformed to a sequentially 182 ``asm("":::"memory")``, which gets transformed to a sequentially
182 consistent memory barrier (equivalent to ``__sync_synchronize()``). In 183 consistent memory barrier (equivalent to ``__sync_synchronize()``). In
183 PNaCl this barrier is only guaranteed to order ``volatile`` and atomic 184 PNaCl this barrier is only guaranteed to order ``volatile`` and atomic
184 memory accesses, though in practice the implementation attempts to also 185 memory accesses, though in practice the implementation attempts to also
185 prevent reordering of memory accesses to objects which may escape. 186 prevent reordering of memory accesses to objects which may escape.
186 187
187 NaCl supports a fairly wide subset of inline assembly through GCC's 188 NaCl supports a fairly wide subset of inline assembly through GCC's
188 inline assembly syntax, with the restriction that the sandboxing model 189 inline assembly syntax, with the restriction that the sandboxing model
189 for the target architecture has to be respected. 190 for the target architecture has to be respected.
190 191
192 Undefined Behavior
193 ==================
194
195 The C and C++ languages expose some undefined behavior which is
196 discussed in `PNaCl Undefined Behavior <undefined_behavior>`.
197
191 Future Directions 198 Future Directions
192 ================= 199 =================
193 200
194 SIMD 201 SIMD
195 ---- 202 ----
196 203
197 PNaCl currently doesn't support SIMD. We plan to add SIMD support in the 204 PNaCl currently doesn't support SIMD. We plan to add SIMD support in the
198 very near future. 205 very near future.
199 206
200 NaCl supports SIMD. 207 NaCl supports SIMD.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ``volatile`` and atomics with same-thread signal handling would need 244 ``volatile`` and atomics with same-thread signal handling would need
238 to be carefully detailed. 245 to be carefully detailed.
239 246
240 Computed ``goto`` 247 Computed ``goto``
241 ----------------- 248 -----------------
242 249
243 PNaCl currently doesn't support computed ``goto``, a non-standard 250 PNaCl currently doesn't support computed ``goto``, a non-standard
244 extension to C used by some interpreters. 251 extension to C used by some interpreters.
245 252
246 NaCl supports computed ``goto``. 253 NaCl supports computed ``goto``.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698