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

Side by Side Diff: native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html

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 {{+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="id2">Source language support</a></p> 7 <li><p class="first"><a class="reference internal" href="#source-language-suppor t" id="id2">Source language support</a></p>
8 <ul class="small-gap"> 8 <ul class="small-gap">
9 <li><a class="reference internal" href="#preprocessor-definitions" id="id3">Prep rocessor definitions</a></li> 9 <li><a class="reference internal" href="#preprocessor-definitions" id="id3">Prep rocessor definitions</a></li>
10 </ul> 10 </ul>
11 </li> 11 </li>
12 <li><p class="first"><a class="reference internal" href="#memory-model-and-atomi cs" id="id4">Memory Model and Atomics</a></p> 12 <li><p class="first"><a class="reference internal" href="#memory-model-and-atomi cs" id="id4">Memory Model and Atomics</a></p>
13 <ul class="small-gap"> 13 <ul class="small-gap">
14 <li><a class="reference internal" href="#memory-model-for-concurrent-operations" id="id5">Memory Model for Concurrent Operations</a></li> 14 <li><a class="reference internal" href="#memory-model-for-concurrent-operations" id="id5">Memory Model for Concurrent Operations</a></li>
15 <li><a class="reference internal" href="#atomic-memory-ordering-constraints" id= "id6">Atomic Memory Ordering Constraints</a></li> 15 <li><a class="reference internal" href="#atomic-memory-ordering-constraints" id= "id6">Atomic Memory Ordering Constraints</a></li>
16 <li><a class="reference internal" href="#volatile-memory-accesses" id="id7">Vola tile Memory Accesses</a></li> 16 <li><a class="reference internal" href="#volatile-memory-accesses" id="id7">Vola tile Memory Accesses</a></li>
17 </ul> 17 </ul>
18 </li> 18 </li>
19 <li><a class="reference internal" href="#threading" id="id8">Threading</a></li> 19 <li><a class="reference internal" href="#threading" id="id8">Threading</a></li>
20 <li><a class="reference internal" href="#setjmp-and-longjmp" id="id9"><code>setj mp</code> and <code>longjmp</code></a></li> 20 <li><a class="reference internal" href="#setjmp-and-longjmp" id="id9"><code>setj mp</code> and <code>longjmp</code></a></li>
21 <li><a class="reference internal" href="#c-exception-handling" id="id10">C++ Exc eption Handling</a></li> 21 <li><a class="reference internal" href="#c-exception-handling" id="id10">C++ Exc eption Handling</a></li>
22 <li><a class="reference internal" href="#inline-assembly" id="id11">Inline Assem bly</a></li> 22 <li><a class="reference internal" href="#inline-assembly" id="id11">Inline Assem bly</a></li>
23 <li><p class="first"><a class="reference internal" href="#future-directions" id= "id12">Future Directions</a></p> 23 <li><a class="reference internal" href="#undefined-behavior" id="id12">Undefined Behavior</a></li>
24 <li><p class="first"><a class="reference internal" href="#future-directions" id= "id13">Future Directions</a></p>
24 <ul class="small-gap"> 25 <ul class="small-gap">
25 <li><a class="reference internal" href="#simd" id="id13">SIMD</a></li> 26 <li><a class="reference internal" href="#simd" id="id14">SIMD</a></li>
26 <li><a class="reference internal" href="#inter-process-communication" id="id14"> Inter-Process Communication</a></li> 27 <li><a class="reference internal" href="#inter-process-communication" id="id15"> Inter-Process Communication</a></li>
27 <li><a class="reference internal" href="#posix-style-signal-handling" id="id15"> POSIX-style Signal Handling</a></li> 28 <li><a class="reference internal" href="#posix-style-signal-handling" id="id16"> POSIX-style Signal Handling</a></li>
28 <li><a class="reference internal" href="#computed-goto" id="id16">Computed <code >goto</code></a></li> 29 <li><a class="reference internal" href="#computed-goto" id="id17">Computed <code >goto</code></a></li>
29 </ul> 30 </ul>
30 </li> 31 </li>
31 </ul> 32 </ul>
32 33
33 </div><section id="source-language-support"> 34 </div><section id="source-language-support">
34 <h2 id="source-language-support">Source language support</h2> 35 <h2 id="source-language-support">Source language support</h2>
35 <p>The currently supported languages are C and C++. The PNaCl toolchain is 36 <p>The currently supported languages are C and C++. The PNaCl toolchain is
36 based on Clang 3.3, which fully supports C++11 and most of C11. A 37 based on Clang 3.3, which fully supports C++11 and most of C11. A
37 detailed status of the language support is available <a class="reference externa l" href="http://clang.llvm.org/cxx_status.html">here</a>.</p> 38 detailed status of the language support is available <a class="reference externa l" href="http://clang.llvm.org/cxx_status.html">here</a>.</p>
38 <p>For information on using languages other than C/C++, see the <a class="refere nce internal" href="/native-client/faq.html#other-languages"><em>FAQ 39 <p>For information on using languages other than C/C++, see the <a class="refere nce internal" href="/native-client/faq.html#other-languages"><em>FAQ
(...skipping 13 matching lines...) Expand all
52 <section id="memory-model-for-concurrent-operations"> 53 <section id="memory-model-for-concurrent-operations">
53 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper ations</h3> 54 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper ations</h3>
54 <p>The memory model offered by PNaCl relies on the same coding guidelines 55 <p>The memory model offered by PNaCl relies on the same coding guidelines
55 as the C11/C++11 one: concurrent accesses must always occur through 56 as the C11/C++11 one: concurrent accesses must always occur through
56 atomic primitives (offered by <a class="reference external" href="PNaClLangRef.h tml#atomicintrinsics">atomic intrinsics</a>), and these accesses must always 57 atomic primitives (offered by <a class="reference external" href="PNaClLangRef.h tml#atomicintrinsics">atomic intrinsics</a>), and these accesses must always
57 occur with the same size for the same memory location. Visibility of 58 occur with the same size for the same memory location. Visibility of
58 stores is provided on a happens-before basis that relates memory 59 stores is provided on a happens-before basis that relates memory
59 locations to each other as the C11/C++11 standards do.</p> 60 locations to each other as the C11/C++11 standards do.</p>
60 <p>Non-atomic memory accesses may be reordered, separated, elided or fused 61 <p>Non-atomic memory accesses may be reordered, separated, elided or fused
61 according to C and C++&#8217;s memory model before the pexe is created as well 62 according to C and C++&#8217;s memory model before the pexe is created as well
62 as after its creation.</p> 63 as after its creation. Accessing atomic memory location through
64 non-atomic primitives is <cite>Undefined Behavior &lt;undefined_behavior&gt;</ci te>.</p>
63 <p>As in C11/C++11 some atomic accesses may be implemented with locks on 65 <p>As in C11/C++11 some atomic accesses may be implemented with locks on
64 certain platforms. The <code>ATOMIC_*_LOCK_FREE</code> macros will always be 66 certain platforms. The <code>ATOMIC_*_LOCK_FREE</code> macros will always be
65 <code>1</code>, signifying that all types are sometimes lock-free. The 67 <code>1</code>, signifying that all types are sometimes lock-free. The
66 <code>is_lock_free</code> methods and <code>atomic_is_lock_free</code> will retu rn the 68 <code>is_lock_free</code> methods and <code>atomic_is_lock_free</code> will retu rn the
67 current platform&#8217;s implementation at translation time. These macros, 69 current platform&#8217;s implementation at translation time. These macros,
68 methods and functions are in the C11 header <code>&lt;stdatomic.h&gt;</code> and the 70 methods and functions are in the C11 header <code>&lt;stdatomic.h&gt;</code> and the
69 C++11 header <code>&lt;atomic&gt;</code>.</p> 71 C++11 header <code>&lt;atomic&gt;</code>.</p>
70 <p>The PNaCl toolchain supports concurrent memory accesses through legacy 72 <p>The PNaCl toolchain supports concurrent memory accesses through legacy
71 GCC-style <code>__sync_*</code> builtins, as well as through C11/C++11 atomic 73 GCC-style <code>__sync_*</code> builtins, as well as through C11/C++11 atomic
72 primitives and the underlying <a class="reference external" href="http://gcc.gnu .org/wiki/Atomic/GCCMM">GCCMM</a> <code>__atomic_*</code> 74 primitives and the underlying <a class="reference external" href="http://gcc.gnu .org/wiki/Atomic/GCCMM">GCCMM</a> <code>__atomic_*</code>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 <p>Inline assembly isn&#8217;t supported by PNaCl because it isn&#8217;t portabl e. The 163 <p>Inline assembly isn&#8217;t supported by PNaCl because it isn&#8217;t portabl e. The
162 one current exception is the common compiler barrier idiom 164 one current exception is the common compiler barrier idiom
163 <code>asm(&quot;&quot;:::&quot;memory&quot;)</code>, which gets transformed to a sequentially 165 <code>asm(&quot;&quot;:::&quot;memory&quot;)</code>, which gets transformed to a sequentially
164 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In 166 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In
165 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic 167 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic
166 memory accesses, though in practice the implementation attempts to also 168 memory accesses, though in practice the implementation attempts to also
167 prevent reordering of memory accesses to objects which may escape.</p> 169 prevent reordering of memory accesses to objects which may escape.</p>
168 <p>NaCl supports a fairly wide subset of inline assembly through GCC&#8217;s 170 <p>NaCl supports a fairly wide subset of inline assembly through GCC&#8217;s
169 inline assembly syntax, with the restriction that the sandboxing model 171 inline assembly syntax, with the restriction that the sandboxing model
170 for the target architecture has to be respected.</p> 172 for the target architecture has to be respected.</p>
173 </section><section id="undefined-behavior">
174 <h2 id="undefined-behavior">Undefined Behavior</h2>
175 <p>The C and C++ languages expose some undefined behavior which is
176 discussed in <cite>PNaCl Undefined Behavior &lt;undefined_behavior&gt;</cite>.</ p>
171 </section><section id="future-directions"> 177 </section><section id="future-directions">
172 <h2 id="future-directions">Future Directions</h2> 178 <h2 id="future-directions">Future Directions</h2>
173 <section id="simd"> 179 <section id="simd">
174 <h3 id="simd">SIMD</h3> 180 <h3 id="simd">SIMD</h3>
175 <p>PNaCl currently doesn&#8217;t support SIMD. We plan to add SIMD support in th e 181 <p>PNaCl currently doesn&#8217;t support SIMD. We plan to add SIMD support in th e
176 very near future.</p> 182 very near future.</p>
177 <p>NaCl supports SIMD.</p> 183 <p>NaCl supports SIMD.</p>
178 </section><section id="inter-process-communication"> 184 </section><section id="inter-process-communication">
179 <h3 id="inter-process-communication">Inter-Process Communication</h3> 185 <h3 id="inter-process-communication">Inter-Process Communication</h3>
180 <p>Inter-process communication through shared memory is currently not 186 <p>Inter-process communication through shared memory is currently not
(...skipping 26 matching lines...) Expand all
207 <code>volatile</code> and atomics with same-thread signal handling would need 213 <code>volatile</code> and atomics with same-thread signal handling would need
208 to be carefully detailed.</p> 214 to be carefully detailed.</p>
209 </section><section id="computed-goto"> 215 </section><section id="computed-goto">
210 <h3 id="computed-goto">Computed <code>goto</code></h3> 216 <h3 id="computed-goto">Computed <code>goto</code></h3>
211 <p>PNaCl currently doesn&#8217;t support computed <code>goto</code>, a non-stand ard 217 <p>PNaCl currently doesn&#8217;t support computed <code>goto</code>, a non-stand ard
212 extension to C used by some interpreters.</p> 218 extension to C used by some interpreters.</p>
213 <p>NaCl supports computed <code>goto</code>.</p> 219 <p>NaCl supports computed <code>goto</code>.</p>
214 </section></section></section> 220 </section></section></section>
215 221
216 {{/partials.standard_nacl_article}} 222 {{/partials.standard_nacl_article}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698