Mercurial > hg > Papers > 2012 > nobu-thesis
annotate presen/presentation.html @ 39:a6540714dda9 draft
modify presen
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 28 Feb 2012 20:01:28 +0900 |
parents | bbebd829c423 |
children | ad0ab1378ae6 |
rev | line source |
---|---|
27 | 1 <!DOCTYPE html> |
2 <!-- | |
3 Copyright 2010 Google Inc. | |
4 | |
5 Licensed under the Apache License, Version 2.0 (the "License"); | |
6 you may not use this file except in compliance with the License. | |
7 You may obtain a copy of the License at | |
8 | |
9 http://www.apache.org/licenses/LICENSE-2.0 | |
10 | |
11 Unless required by applicable law or agreed to in writing, software | |
12 distributed under the License is distributed on an "AS IS" BASIS, | |
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 See the License for the specific language governing permissions and | |
15 limitations under the License. | |
16 | |
17 Original slides: Marcin Wichary (mwichary@google.com) | |
18 Modifications: Ernest Delgado (ernestd@google.com) | |
19 Alex Russell (slightlyoff@chromium.org) | |
20 | |
21 landslide modifications: Adam Zapletal (adamzap@gmail.com) | |
22 Nicolas Perriault (nperriault@gmail.com) | |
23 --> | |
24 <html> | |
25 <head> | |
26 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
27 <meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
28 | 28 <title>Continuation based C の <br> GCC 4.6による実装</title> |
27 | 29 <!-- Styles --> |
30 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
31 <link rel="stylesheet" media="print" href="theme/css/print.css"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
32 <link rel="stylesheet" media="screen, projection" href="theme/css/screen.css"> |
27 | 33 |
34 | |
35 <!-- /Styles --> | |
36 <!-- Javascripts --> | |
37 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
38 <script type="text/javascript" src="theme/js/slides.js"></script> |
27 | 39 |
40 | |
41 <!-- /Javascripts --> | |
42 </head> | |
43 <body> | |
44 <div id="blank"></div> | |
45 <div class="presentation"> | |
46 <div id="current_presenter_notes"> | |
47 <div id="presenter_note"></div> | |
48 </div> | |
49 <div class="slides"> | |
50 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
51 <!-- slide source: cbc.md --> |
27 | 52 <div class="slide-wrapper"> |
53 <div class="slide"> | |
54 <div class="inner"> | |
55 | |
28 | 56 <header><h1>Continuation based C の <br> GCC 4.6による実装</h1></header> |
27 | 57 |
58 | |
59 </div> | |
60 <div class="presenter_notes"> | |
61 <header><h1>Presenter Notes</h1></header> | |
62 <section> | |
63 | |
64 </section> | |
65 </div> | |
66 <footer> | |
67 | |
68 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
69 Source: <a href="cbc.md">cbc.md</a> |
27 | 70 </aside> |
71 | |
72 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
73 1/24 |
27 | 74 </aside> |
75 </footer> | |
76 </div> | |
77 </div> | |
78 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
79 <!-- slide source: cbc.md --> |
27 | 80 <div class="slide-wrapper"> |
81 <div class="slide has_notes"> | |
82 <div class="inner"> | |
83 | |
37 | 84 <header><h2>研究目的</h2></header> |
27 | 85 |
86 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
87 <section><p class="notes"></p> |
37 | 88 <li><font color=red size=5em>状態遷移記述をベースとしたより細かい単位でのプログラミングを実現する</font></li> |
89 | |
27 | 90 <ul> |
37 | 91 <li>組込みソフト、Real-time処理、通信プロトコル記述、どれも状態遷移ベース</li> |
92 <li>現存する記述言語は状態遷移の記述に向いていない</li> | |
93 <li>スタックが状態を隠蔽するため、分割しにくい、検証が難しい</li> | |
38 | 94 <li>本研究室ではコードセグメント単位で記述するプログラミング言語Continuation based C (以下CbC)という言語を提案している。</li> |
95 <li>CbC のコンパイラは Micro-C 版 と GCC 版(以下 CbC-GCC) が開発されている。</li> | |
96 <li>しかし, CbC-GCC はいくつかのバグがあり機能に修正の余地があった。</li> | |
97 <li>また、GCC の最新の機能を利用するためにも CbC-GCC は GCC のアップデートに合わせていく必要がある。</li> | |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
98 </ul> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
99 <h2>本研究では CbC-GCC のアップデートを行い、より良いコードを生成する CbC の処理系を開発した。</h2></section> |
27 | 100 |
101 </div> | |
102 <div class="presenter_notes"> | |
103 <header><h1>Presenter Notes</h1></header> | |
104 <section> | |
105 | |
106 </section> | |
107 </div> | |
108 <footer> | |
109 | |
110 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
111 Source: <a href="cbc.md">cbc.md</a> |
27 | 112 </aside> |
113 | |
114 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
115 2/24 |
27 | 116 </aside> |
117 </footer> | |
118 </div> | |
119 </div> | |
120 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
121 <!-- slide source: cbc.md --> |
27 | 122 <div class="slide-wrapper"> |
123 <div class="slide"> | |
124 <div class="inner"> | |
125 | |
126 <header><h1>Continuation based C</h1></header> | |
127 | |
128 | |
129 <section><h2>コードセグメント単位での記述と継続を基本としたプログラミング言語</h2> | |
130 <li>コーセグメント:CbC におけるプログラムの基本単位</li> | |
131 | |
132 <ul> | |
133 <li>C の関数よりも細かな単位</li> | |
35 | 134 <li>構文は C と同じだが、C から関数コールとループ制御が取り除かれた形</li> |
27 | 135 <li>コードセグメントの末尾処理で別のコードセグメントへ継続(goto)することで CbC のプログラムは続いていく。</li> |
136 </ul> | |
137 | |
37 | 138 <table width=100% border=1> |
139 <tr> | |
140 <td style="margin-left:auto; margin-right: auto; text-align: center; width:50%" > | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
141 <img src="./pix/codesegment.png" style="width:100%"> |
27 | 142 </td> |
37 | 143 <td> |
144 <pre style="margin-left:5%"> | |
145 __code cs_a(int num) { | |
146 : | |
147 : | |
148 goto cs_b(); | |
149 } | |
150 </pre> | |
151 </td> | |
152 </tr> | |
27 | 153 </table></section> |
154 | |
155 </div> | |
156 <div class="presenter_notes"> | |
157 <header><h1>Presenter Notes</h1></header> | |
158 <section> | |
159 | |
160 </section> | |
161 </div> | |
162 <footer> | |
163 | |
164 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
165 Source: <a href="cbc.md">cbc.md</a> |
27 | 166 </aside> |
167 | |
168 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
169 3/24 |
27 | 170 </aside> |
171 </footer> | |
172 </div> | |
173 </div> | |
174 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
175 <!-- slide source: cbc.md --> |
27 | 176 <div class="slide-wrapper"> |
177 <div class="slide"> | |
178 <div class="inner"> | |
179 | |
180 <header><h1>Continuation based C</h1></header> | |
181 | |
182 | |
183 <section><h2>継続:現在の処理を実行していく為の情報</h2> | |
184 <p><table width=100% border=1> | |
185 <tr> | |
186 <td><h2>Cの継続</h2></td> | |
187 <td><h2>CbCの継続(軽量継続)</h2></td> | |
188 </tr> | |
189 <tr> | |
190 <td> | |
191 <ul> | |
192 <li>続く命令のアドレス</li> | |
193 <li>命令に必要なデータ</li> | |
194 <li>スタックに積まれている値(環境)</li> | |
195 </ul> | |
196 </td> | |
197 <td> | |
198 <ul> | |
199 <li>Cの継続から環境を除外</li> | |
200 <li>続く命令とその命令に必要なデータのみ</li> | |
201 </ul> | |
202 </td> | |
203 </tr> | |
204 <t> | |
205 <td style="margin-left:auto; margin-right: auto; text-align: center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
206 <img class="scale" src="./pix/func_call.png" style="height: 18em;"> |
27 | 207 </td> |
208 <td style="margin-left:auto; margin-right: auto; text-align: center;"> | |
209 <img class="scale" src="./pix/cs_stack.png" style="height: 18em;"> | |
210 </td> | |
211 </tr> | |
212 </table></p></section> | |
213 | |
214 </div> | |
215 <div class="presenter_notes"> | |
216 <header><h1>Presenter Notes</h1></header> | |
217 <section> | |
218 | |
219 </section> | |
220 </div> | |
221 <footer> | |
222 | |
223 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
224 Source: <a href="cbc.md">cbc.md</a> |
27 | 225 </aside> |
226 | |
227 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
228 4/24 |
27 | 229 </aside> |
230 </footer> | |
231 </div> | |
232 </div> | |
233 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
234 <!-- slide source: cbc.md --> |
27 | 235 <div class="slide-wrapper"> |
236 <div class="slide"> | |
237 <div class="inner"> | |
238 | |
239 <header><h1>Continuation based C</h1></header> | |
240 | |
241 | |
242 <section><p><table width=100% border=1> | |
243 <caption>階乗を求める CbC のプログラム</caption> | |
37 | 244 <td width=50%> |
245 <pre style="margin-left:5%"> | |
246 __code print_factorial(int prod) | |
247 { | |
248 printf("factorial = %d\n",prod); | |
249 exit(0); | |
250 } | |
251 __code factorial0(int prod, int x) | |
252 { | |
253 if ( x >= 1) { | |
254 goto factorial0(prod*x, x-1); | |
255 }else{ | |
256 goto print_factorial(prod); | |
257 } | |
258 } | |
259 __code factorial(int x) | |
260 { | |
261 goto factorial0(1, x); | |
262 } | |
263 int main(int argc, char **argv) | |
264 { | |
265 int i; | |
266 i = atoi(argv[1]); | |
267 goto factorial(i); | |
268 } | |
27 | 269 </pre> |
270 </td> | |
271 <td> | |
272 <li>__code によるコードセグメントの宣言</li> | |
37 | 273 <li>引数付きの goto でコードセグメントを呼び出すことができる</li> |
274 <li>内部では call ではなく jmp 命令でコードセグメントの処理が遷移している</li> | |
27 | 275 </td> |
276 </table></p></section> | |
277 | |
278 </div> | |
279 <div class="presenter_notes"> | |
280 <header><h1>Presenter Notes</h1></header> | |
281 <section> | |
282 | |
283 </section> | |
284 </div> | |
285 <footer> | |
286 | |
287 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
288 Source: <a href="cbc.md">cbc.md</a> |
27 | 289 </aside> |
290 | |
291 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
292 5/24 |
27 | 293 </aside> |
294 </footer> | |
295 </div> | |
296 </div> | |
297 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
298 <!-- slide source: cbc.md --> |
27 | 299 <div class="slide-wrapper"> |
300 <div class="slide"> | |
301 <div class="inner"> | |
302 | |
35 | 303 <header><h1>Gnu Compiler Collection (GCC)</h1></header> |
304 | |
305 | |
37 | 306 <section><p><li>GCC: オープンソースのコンパイラ群</li> |
35 | 307 <li>ここで扱う GCC はソースコードをアセンブラに変換する『cc1』のことを指す。</li> |
308 <li>GCC がソースコードを読み込みアセンブラ言語を出力するまでの流れは以下の図のようになる。</li> | |
309 <table width=100%> | |
310 <caption>GCC のアセンブラ言語出力までの流れ</caption> | |
311 <td style="margin:auto; text-align:center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
312 <img src="./pix/ir.png" style="height:15em"> |
35 | 313 </td> |
314 </table> | |
315 <li>ソースコードはアセンブラに変換される間に 4 つのデータ構造に変換される。</li> | |
316 <li>この中でも CbC の実装では Parser と RTL の生成部分に手が加えられている。</li></p></section> | |
317 | |
318 </div> | |
319 <div class="presenter_notes"> | |
320 <header><h1>Presenter Notes</h1></header> | |
321 <section> | |
322 | |
323 </section> | |
324 </div> | |
325 <footer> | |
326 | |
327 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
328 Source: <a href="cbc.md">cbc.md</a> |
35 | 329 </aside> |
330 | |
331 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
332 6/24 |
35 | 333 </aside> |
334 </footer> | |
335 </div> | |
336 </div> | |
337 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
338 <!-- slide source: cbc.md --> |
35 | 339 <div class="slide-wrapper"> |
340 <div class="slide"> | |
341 <div class="inner"> | |
342 | |
343 <header><h1>CbC の実装 : 軽量継続</h1></header> | |
27 | 344 |
345 | |
37 | 346 <section><p><li>CbC-GCC の軽量継続は最適化の1つ, <font color=red>Tail Call Elimination(末尾除去)</font>により実装されている.</li></p> |
27 | 347 <h2>Tail Call Elimination</h2> |
348 <p><li>関数呼び出しを call ではなく jmp 命令で行う最適化</li> | |
31 | 349 <li>例えば、以下の場合関数 g は jmp 命令で関数 f へと処理が移る</li></p> |
350 <table width=100% border=1> | |
27 | 351 <tr> |
352 <td width=50%> | |
353 <pre> | |
354 void f(int a, int b) { | |
355 printf("f: a=%d b=%d\n",a,b); | |
356 return ; | |
357 } | |
358 | |
359 void g(int a, int b){ | |
360 printf("g: a=%d b=%d\n",a,b); | |
361 f(a,b); | |
362 return; | |
363 } | |
364 | |
365 int main() { | |
366 g(3,4); | |
367 return 0; | |
37 | 368 }</pre> |
27 | 369 </td> |
370 <td> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
371 <img src="./pix/continuation.png" style="height:80%;"> |
27 | 372 </td> |
373 </tr> | |
374 </table></section> | |
375 | |
376 </div> | |
377 <div class="presenter_notes"> | |
378 <header><h1>Presenter Notes</h1></header> | |
379 <section> | |
380 | |
381 </section> | |
382 </div> | |
383 <footer> | |
384 | |
385 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
386 Source: <a href="cbc.md">cbc.md</a> |
27 | 387 </aside> |
388 | |
389 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
390 7/24 |
27 | 391 </aside> |
392 </footer> | |
393 </div> | |
394 </div> | |
395 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
396 <!-- slide source: cbc.md --> |
27 | 397 <div class="slide-wrapper"> |
398 <div class="slide"> | |
399 <div class="inner"> | |
400 | |
401 <header><h1>CbC の実装: Tail Call Elimination</h1></header> | |
402 | |
403 | |
404 <section><h2>Tail Call Elimination の条件</h2> | |
405 <p><ul> | |
37 | 406 <li>関数を呼び出す側(caller)と呼び出される側(callee)の戻値の型が一致している。</li> |
27 | 407 <li>関数呼び出しがリターン直前に行われている。</li> |
37 | 408 <li>呼び出される関数(callee)の引数に用いられるスタックサイズが呼出元(caller)のそれより少ない。</li> |
27 | 409 <li>引数の並びのコピーに上書きがない。</li> |
410 </ul></p> | |
411 <h2>条件回避の為の実装</h2> | |
412 <p><ul> | |
413 <li>コードセグメントの型はvoid型で統一する。</li> | |
414 <li>gotoの直後に自動で return を置く。</li> | |
415 <li>スタックサイズは固定にする。</li> | |
416 <li>引数は一旦、一時変数にコピーする。</li> | |
417 </ul></p></section> | |
418 | |
419 </div> | |
420 <div class="presenter_notes"> | |
421 <header><h1>Presenter Notes</h1></header> | |
422 <section> | |
423 | |
424 </section> | |
425 </div> | |
426 <footer> | |
427 | |
428 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
429 Source: <a href="cbc.md">cbc.md</a> |
27 | 430 </aside> |
431 | |
432 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
433 8/24 |
27 | 434 </aside> |
435 </footer> | |
436 </div> | |
437 </div> | |
438 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
439 <!-- slide source: cbc.md --> |
27 | 440 <div class="slide-wrapper"> |
441 <div class="slide"> | |
442 <div class="inner"> | |
443 | |
28 | 444 <header><h1>CbC の実装: Tail Call Elimination</h1></header> |
445 | |
27 | 446 |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
447 <section><h2>Tail Call Elimination の条件をチェックする関数</h2> |
28 | 448 <ul> |
449 <li>今までの実装では Tail Call Elimination の条件をクリアする為に専用の関数を用意していた。</li> | |
450 <li>この専用関数は元々ある GCC コードを元に作成している為, アップデートに合わせて修正していく | |
451 必要があった。</li> | |
35 | 452 </ul> |
37 | 453 <h2>実装の修正とその利点</h2> |
35 | 454 <ul> |
28 | 455 <li>しかし, 今回の実装でその関数を無くし, Tail Call Elimination のフラグを強制的に立たせる実装に変更。</li> |
35 | 456 <li>専用関数がなくなったことで、今後より楽なアップデートを行なっていくことができるようになった。</li> |
37 | 457 <li>また、コードセグメントへの継続が jmp ではなく call 命令で行われるバグがあったが修正できた。</li> |
28 | 458 </ul></section> |
27 | 459 |
460 </div> | |
461 <div class="presenter_notes"> | |
462 <header><h1>Presenter Notes</h1></header> | |
463 <section> | |
464 | |
465 </section> | |
466 </div> | |
467 <footer> | |
468 | |
469 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
470 Source: <a href="cbc.md">cbc.md</a> |
27 | 471 </aside> |
472 | |
473 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
474 9/24 |
27 | 475 </aside> |
476 </footer> | |
477 </div> | |
478 </div> | |
479 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
480 <!-- slide source: cbc.md --> |
27 | 481 <div class="slide-wrapper"> |
482 <div class="slide"> | |
483 <div class="inner"> | |
484 | |
37 | 485 <header><h1>GCC-4.5, GCC-4.6 の性能比較</h1></header> |
27 | 486 |
487 | |
35 | 488 <section><p><li><font color=red size=5em>本研究では GCC-4.5 から GCC-4.6 へのアップデートを行った。</font></li> |
489 <li>この 2 つのバージョンを用いて生成したプログラムの速度比較を行った。</li> | |
490 <li>conv1: 加算と継続を交互に繰り返すプログラム</li></p> | |
491 <table width=100% border=1> | |
492 <caption>各コンパイラにより生成されたプログラムの速度比較</caption> | |
493 <tr> | |
27 | 494 <td style="margin:auto; text-align:center;"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
495 <img src="./pix/conv1_for_resume.png" style="height:15em"> |
27 | 496 </td> |
497 <td> | |
498 <img src="./pix/conv1_mac_for_presen.png" style="height:15em"> | |
499 </td> | |
35 | 500 </tr> |
501 <tr> | |
502 <td style="text-align:center;">x86/Linux</td> | |
503 <td style="text-align:center;">x86/OS X (10.7)</td> | |
504 </tr> | |
27 | 505 </table> |
506 | |
35 | 507 <li>Mac の GCC-4.5 では動かなかった 32bit のプログラムが GCC-4.6 では問題なく動いている。</li> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
508 |
29 | 509 <li>引数 2、3 の結果はほぼ同じ</li> |
27 | 510 |
31 | 511 <li>引数 1 の結果では 32bit, 64bit 共に GCC-4.6 の方が 1.5倍以上早い</li></section> |
27 | 512 |
513 </div> | |
514 <div class="presenter_notes"> | |
515 <header><h1>Presenter Notes</h1></header> | |
516 <section> | |
517 | |
518 </section> | |
519 </div> | |
520 <footer> | |
521 | |
522 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
523 Source: <a href="cbc.md">cbc.md</a> |
27 | 524 </aside> |
525 | |
526 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
527 10/24 |
27 | 528 </aside> |
529 </footer> | |
530 </div> | |
531 </div> | |
532 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
533 <!-- slide source: cbc.md --> |
27 | 534 <div class="slide-wrapper"> |
535 <div class="slide"> | |
536 <div class="inner"> | |
537 | |
35 | 538 <header><h1>GCC-4.6 の最適化</h1></header> |
27 | 539 |
540 | |
35 | 541 <section><ul> |
542 <li>GCC-4.6 では最適化の 1つ『インライン展開』が強化されている。</li> | |
543 </ul> | |
544 <h2>インライン展開</h2> | |
545 <ul> | |
546 <li>関数の処理をそのまま関数呼び出し部に展開することで call を省略できる最適化</li> | |
547 </ul> | |
548 <table width=100% border=1> | |
549 <caption><h3>インライン展開の例</h3></caption> | |
550 <tr> | |
551 <td width=50%> | |
37 | 552 <pre style="margin-left:5%"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
553 void func_b(){ |
35 | 554 A; |
555 B; | |
556 } | |
557 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
558 void func_a() { |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
559 func_b(); |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
560 func_b(); |
35 | 561 } |
562 </pre> | |
563 </td> | |
564 <td> | |
37 | 565 <pre style="margin-left:5%"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
566 void func_a() { |
35 | 567 A; |
568 B; | |
569 A; | |
570 B; | |
571 } | |
572 </pre> | |
573 </td> | |
574 </tr> | |
575 </table> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
576 <li>func_b の呼び出しがなくなっている。</li></section> |
27 | 577 |
578 </div> | |
579 <div class="presenter_notes"> | |
580 <header><h1>Presenter Notes</h1></header> | |
581 <section> | |
582 | |
583 </section> | |
584 </div> | |
585 <footer> | |
586 | |
587 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
588 Source: <a href="cbc.md">cbc.md</a> |
27 | 589 </aside> |
590 | |
591 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
592 11/24 |
27 | 593 </aside> |
594 </footer> | |
595 </div> | |
596 </div> | |
597 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
598 <!-- slide source: cbc.md --> |
27 | 599 <div class="slide-wrapper"> |
600 <div class="slide"> | |
601 <div class="inner"> | |
602 | |
35 | 603 <header><h1>最適化の比較</h1></header> |
29 | 604 |
605 | |
35 | 606 <section><table width=100% border=1> |
607 <caption><h3>それぞれの最適化にかかった conv1プログラムの挙動(引数 1)</h3></caption> | |
608 <tr> | |
609 <td width=30%>最適化なし</td> | |
610 <td width=30%>GCC-4.5の最適化(-O2)</td> | |
611 <td width=30%>GCC-4.6の最適化(-O2)</td> | |
612 </tr> | |
613 <tr> | |
614 <td style="margin:auto; text-align:center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
615 <img src="./pix/state_conv1_noopt.png" style="width:65%;"> |
35 | 616 </td> |
617 <td style="margin:auto; text-align:center;"> | |
618 <img src="./pix/state_conv1_45.png" style="width:65%;"> | |
619 </td> | |
620 <td style="margin:auto; text-align:center;"> | |
621 <img src="./pix/state_conv1_46.png" style="width:65%;"> | |
622 </td> | |
623 </tr> | |
624 </table> | |
625 | |
626 <ul> | |
627 <li>最適化無しに比べると GCC-4.5、 GGC-4.6 共にコードセグメントの数が減っている。</li> | |
628 <li>GCC-4.5 でもインライン展開はされているが、GCC-4.6 はより良い最適化がかけられている。</li> | |
30 | 629 </ul></section> |
29 | 630 |
631 </div> | |
632 <div class="presenter_notes"> | |
633 <header><h1>Presenter Notes</h1></header> | |
634 <section> | |
635 | |
636 </section> | |
637 </div> | |
638 <footer> | |
639 | |
640 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
641 Source: <a href="cbc.md">cbc.md</a> |
29 | 642 </aside> |
643 | |
644 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
645 12/24 |
30 | 646 </aside> |
647 </footer> | |
648 </div> | |
649 </div> | |
650 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
651 <!-- slide source: cbc.md --> |
30 | 652 <div class="slide-wrapper"> |
653 <div class="slide"> | |
654 <div class="inner"> | |
655 | |
38 | 656 <header><h1>最新バージョンに合わせる有用性</h1></header> |
30 | 657 |
658 | |
659 <section><ul> | |
35 | 660 <li>今回の『インライン展開』のように GCC の最適化は日々改良されている。</li> |
30 | 661 <li>また、既存の最適化の改良だけでなく新たな最適化の追加等も行われていく。</li> |
662 <li>それらの恩恵を受ける為にも GCC のアップデートに合わせていく事は今後も重要である。</li> | |
663 </ul></section> | |
664 | |
665 </div> | |
666 <div class="presenter_notes"> | |
667 <header><h1>Presenter Notes</h1></header> | |
668 <section> | |
669 | |
670 </section> | |
671 </div> | |
672 <footer> | |
673 | |
674 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
675 Source: <a href="cbc.md">cbc.md</a> |
30 | 676 </aside> |
677 | |
678 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
679 13/24 |
29 | 680 </aside> |
681 </footer> | |
682 </div> | |
683 </div> | |
684 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
685 <!-- slide source: cbc.md --> |
29 | 686 <div class="slide-wrapper"> |
687 <div class="slide"> | |
688 <div class="inner"> | |
689 | |
690 <header><h1>まとめ</h1></header> | |
691 | |
692 | |
693 <section><ul> | |
30 | 694 <li>今回 CbC-GCC を GCC-4.6 へとアップデートを行った。</li> |
35 | 695 <li>アップデートにより、よりよいコードを生成する CbC のコンパイラを用意することができた。</li> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
696 <li>また、最適化の強制付与といった実装の修正も行えた。</li> |
35 | 697 <li>細かな実装を除けば, CbC-GCC は今後 GCC のアップデートに合わせていくだけとなる。</li> |
29 | 698 </ul> |
699 <h2>今後の課題</h2> | |
700 <ul> | |
701 <li>LLVM ベースの CbC コンパイラの開発</li> | |
702 <li>google Go 言語への実装の検討</li> | |
703 </ul></section> | |
704 | |
705 </div> | |
706 <div class="presenter_notes"> | |
707 <header><h1>Presenter Notes</h1></header> | |
708 <section> | |
709 | |
710 </section> | |
711 </div> | |
712 <footer> | |
713 | |
714 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
715 Source: <a href="cbc.md">cbc.md</a> |
29 | 716 </aside> |
717 | |
718 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
719 14/24 |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
720 </aside> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
721 </footer> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
722 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
723 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
724 |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
725 <!-- slide source: cbc.md --> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
726 <div class="slide-wrapper"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
727 <div class="slide"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
728 <div class="inner"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
729 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
730 <header><h1>jmp と call</h1></header> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
731 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
732 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
733 <section><p><table width=100%> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
734 <caption>インライン展開無しの conv1 プログラム実行結果</caption> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
735 <td style="text-align:center;"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
736 <img src="./pix/fno_inline.png"> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
737 </td> |
37 | 738 </table></p></section> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
739 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
740 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
741 <div class="presenter_notes"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
742 <header><h1>Presenter Notes</h1></header> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
743 <section> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
744 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
745 </section> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
746 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
747 <footer> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
748 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
749 <aside class="source"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
750 Source: <a href="cbc.md">cbc.md</a> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
751 </aside> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
752 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
753 <aside class="page_number"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
754 15/24 |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
755 </aside> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
756 </footer> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
757 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
758 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
759 |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
760 <!-- slide source: cbc.md --> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
761 <div class="slide-wrapper"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
762 <div class="slide"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
763 <div class="inner"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
764 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
765 <header><h1>conv1 プログラム</h1></header> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
766 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
767 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
768 <section><p><li>性能評価で用いた conv1 プログラムの C 版</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
769 <pre style="width:5%;" border=1> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
770 f0(int i) { |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
771 int k,j; |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
772 k = 3+i; |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
773 j = g0(i+3); |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
774 return k+4+j; |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
775 } |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
776 g0(int i) { |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
777 return h0(i+4)+i; |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
778 } |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
779 h0(int i) { |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
780 return i+4; |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
781 }</pre> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
782 <li>性能評価はこのプログラムを CbC へと書き換えて行なっている。</li></p></section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
783 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
784 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
785 <div class="presenter_notes"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
786 <header><h1>Presenter Notes</h1></header> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
787 <section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
788 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
789 </section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
790 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
791 <footer> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
792 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
793 <aside class="source"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
794 Source: <a href="cbc.md">cbc.md</a> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
795 </aside> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
796 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
797 <aside class="page_number"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
798 16/24 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
799 </aside> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
800 </footer> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
801 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
802 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
803 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
804 <!-- slide source: cbc.md --> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
805 <div class="slide-wrapper"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
806 <div class="slide"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
807 <div class="inner"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
808 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
809 <header><h1>CbC-GCC のアップデート手法</h1></header> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
810 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
811 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
812 <section><ol> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
813 <li>GCC のソースを入れるリポジトリを用意する。</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
814 <li>GCC のリポジトリの中身を全て消し、新しい GCC を入れて新しいファイルは追加、消えたファイルは削除する。</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
815 <li>コミット</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
816 </ol> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
817 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
818 <h2>CbC-GCC のリポジトリ</h2> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
819 <p><ol> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
820 <li>GCC のソースから pull</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
821 <li>merge を行う</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
822 <li>衝突のあったファイルを手動でマージする</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
823 <li>コミット</li> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
824 </ol></p></section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
825 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
826 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
827 <div class="presenter_notes"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
828 <header><h1>Presenter Notes</h1></header> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
829 <section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
830 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
831 </section> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
832 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
833 <footer> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
834 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
835 <aside class="source"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
836 Source: <a href="cbc.md">cbc.md</a> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
837 </aside> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
838 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
839 <aside class="page_number"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
840 17/24 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
841 </aside> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
842 </footer> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
843 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
844 </div> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
845 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
846 <!-- slide source: cbc.md --> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
847 <div class="slide-wrapper"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
848 <div class="slide"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
849 <div class="inner"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
850 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
851 <header><h1>構文の追加</h1></header> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
852 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
853 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
854 <section><h2>リカーシブタイプの宣言に使う"__rectype"</h2> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
855 <ul> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
856 <li>関数宣言時、以下のように引数に自分自身を指す型を入れたい。 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
857 <pre> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
858 __code func(int, func*); |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
859 <pre></li> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
860 <li>上記の宣言ではエラーがでる。その為、以下のような宣言になる。 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
861 <pre> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
862 __code func(int, __code (*)()); |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
863 </pre></li> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
864 <li>しかし、これでは正しい情報をコンパイラに渡せていない。関数ポインタの引数に型情報が入っていないからである。 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
865 <pre> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
866 __code func(int, __code (<em>)(int, __code(</em>)(int, __code(*)(int, ...)))) |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
867 </pre></li> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
868 <li>だが、正しい情報を渡そうとすると上記のように再帰してしまい、宣言できない。</li> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
869 <li>そこで __rectype という構文を追加して宣言中の関数自身を指すようにした。 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
870 <pre> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
871 __code func(int, rectype*); |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
872 </pre></li> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
873 </ul></section> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
874 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
875 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
876 <div class="presenter_notes"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
877 <header><h1>Presenter Notes</h1></header> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
878 <section> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
879 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
880 </section> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
881 </div> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
882 <footer> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
883 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
884 <aside class="source"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
885 Source: <a href="cbc.md">cbc.md</a> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
886 </aside> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
887 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
888 <aside class="page_number"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
889 18/24 |
30 | 890 </aside> |
891 </footer> | |
892 </div> | |
893 </div> | |
894 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
895 <!-- slide source: cbc.md --> |
30 | 896 <div class="slide-wrapper"> |
897 <div class="slide"> | |
898 <div class="inner"> | |
899 | |
900 <header><h1>conv1 プログラム</h1></header> | |
901 | |
902 | |
903 <section><ul> | |
904 <li>conv1 プログラムでは計算と継続を交互に繰り返し行なう。</li> | |
905 <li> | |
906 <p>しかし状態のいくつかへは関数ポインタとして保存させておき継続を行う。 | |
907 <pre> | |
908 __code g(int i,stack sp) { // Caller | |
909 struct f_g0_interface <em>c = | |
32 | 910 (struct f_g0_interface </em>)(sp -= sizeof(struct f_g0_interface)); |
911 c->ret = g_h1; | |
912 c->i_ = i; | |
913 goto h(i+3,sp); | |
914 } | |
915 __code h(int i,stack sp) { | |
30 | 916 struct f_g0_interface <em>c = (struct f_g0_interface </em>)sp; |
917 goto (c->ret)(i+4,sp); | |
918 } | |
919 </pre></p> | |
32 | 920 </li> |
921 <li> | |
922 <p>関数ポインタへの継続はインライン展開されない。</p> | |
923 </li> | |
30 | 924 </ul></section> |
925 | |
926 </div> | |
927 <div class="presenter_notes"> | |
928 <header><h1>Presenter Notes</h1></header> | |
929 <section> | |
930 | |
931 </section> | |
932 </div> | |
933 <footer> | |
934 | |
935 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
936 Source: <a href="cbc.md">cbc.md</a> |
30 | 937 </aside> |
938 | |
939 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
940 19/24 |
29 | 941 </aside> |
942 </footer> | |
943 </div> | |
944 </div> | |
945 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
946 <!-- slide source: cbc.md --> |
29 | 947 <div class="slide-wrapper"> |
948 <div class="slide"> | |
949 <div class="inner"> | |
950 | |
951 <header><h1>CbC の実装: 環境付き継続</h1></header> | |
952 | |
953 | |
954 <section><ul> | |
955 <li>環境付き継続: C との互換を取るための機能。継続を行った C の関数に戻ることができる。 </li> | |
956 <li>_CbC_return、 _CbC_environment キーワードを使うことで使える。</li> | |
957 <li> | |
958 <p>以下の使い方の場合、戻値 1 を返す。 | |
959 <pre> | |
960 <strong>code c1(</strong>code ret(int,void <em>),void </em>env) { | |
961 goto ret(1,env); | |
962 } | |
963 int main() { | |
964 goto c1(<strong>return, </strong>environment); | |
965 } | |
966 </pre></p> | |
967 </li> | |
968 <li> | |
969 <p>今回この環境付き継続をスレッドセーフの実装へと修正した。</p> | |
970 </li> | |
971 </ul></section> | |
972 | |
973 </div> | |
974 <div class="presenter_notes"> | |
975 <header><h1>Presenter Notes</h1></header> | |
976 <section> | |
977 | |
978 </section> | |
979 </div> | |
980 <footer> | |
981 | |
982 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
983 Source: <a href="cbc.md">cbc.md</a> |
29 | 984 </aside> |
985 | |
986 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
987 20/24 |
29 | 988 </aside> |
989 </footer> | |
990 </div> | |
991 </div> | |
992 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
993 <!-- slide source: cbc.md --> |
29 | 994 <div class="slide-wrapper"> |
995 <div class="slide"> | |
996 <div class="inner"> | |
997 | |
998 <header><h1>CbC 引数渡し</h1></header> | |
999 | |
1000 | |
1001 <section><p><li>CbC では引数渡しにできるだけレジスタを用いるようにしている.</li> | |
1002 <table border=1 width=100%> | |
1003 <caption><small>fastcall属性有・無の実行速度</small></caption> | |
1004 <tr> | |
1005 <td width=50% style="text-align:center;">fastcall無し</td> | |
1006 </tr> | |
1007 <tr> | |
1008 <td style="margin:auto; text-align:center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1009 <img src="./pix/linux_conv_nofastcall.png" style="height:15em;"> |
29 | 1010 </td> |
1011 </tr> | |
1012 <tr> | |
1013 <td width=50% style="text-align:center;">fastcall有り</td> | |
1014 <tr> | |
1015 <td> | |
1016 <img src="./pix/linux_conv_fastcall.png" style="height:15em;"> | |
1017 </td> | |
1018 </tr> | |
1019 </table></p></section> | |
1020 | |
1021 </div> | |
1022 <div class="presenter_notes"> | |
1023 <header><h1>Presenter Notes</h1></header> | |
1024 <section> | |
1025 | |
1026 </section> | |
1027 </div> | |
1028 <footer> | |
1029 | |
1030 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1031 Source: <a href="cbc.md">cbc.md</a> |
29 | 1032 </aside> |
1033 | |
1034 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1035 21/24 |
32 | 1036 </aside> |
1037 </footer> | |
1038 </div> | |
1039 </div> | |
1040 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1041 <!-- slide source: cbc.md --> |
32 | 1042 <div class="slide-wrapper"> |
1043 <div class="slide"> | |
1044 <div class="inner"> | |
1045 | |
1046 <header><h1>引数の並びに上書きコピー</h1></header> | |
1047 | |
1048 | |
1049 <section><p><li>以下の呼び出しを行うと、スタックの書き換えがおこる</li> | |
1050 <pre> | |
1051 void funcA(int a, int b) { | |
1052 funcB(b, a); | |
1053 } | |
1054 </pre></p> | |
1055 <table width=100%> | |
1056 <tr> | |
1057 <td style="margin:auto; text-align:center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1058 <img src="./pix/cs_prog.png"> |
32 | 1059 </td> |
1060 </tr> | |
1061 </table></section> | |
1062 | |
1063 </div> | |
1064 <div class="presenter_notes"> | |
1065 <header><h1>Presenter Notes</h1></header> | |
1066 <section> | |
1067 | |
1068 </section> | |
1069 </div> | |
1070 <footer> | |
1071 | |
1072 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1073 Source: <a href="cbc.md">cbc.md</a> |
32 | 1074 </aside> |
1075 | |
1076 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1077 22/24 |
35 | 1078 </aside> |
1079 </footer> | |
1080 </div> | |
1081 </div> | |
1082 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1083 <!-- slide source: cbc.md --> |
35 | 1084 <div class="slide-wrapper"> |
1085 <div class="slide"> | |
1086 <div class="inner"> | |
1087 | |
1088 <header><h1>最適化の比較</h1></header> | |
1089 | |
1090 | |
1091 <section><table width=100% border=1> | |
1092 <caption>各コンパイラにより生成されたコードの速度比較</caption> | |
1093 <tr> | |
1094 <td style="margin:auto; text-align:center;"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1095 <img src="./pix/O3_conv1_linux.png" style="height:15em"> |
35 | 1096 </td> |
1097 <td> | |
1098 <img src="./pix/O3_conv1_mac.png" style="height:15em"> | |
1099 </td> | |
1100 </tr> | |
1101 <tr> | |
1102 <td style="text-align:center;">x86/Linux</td> | |
1103 <td style="text-align:center;">x86/OS X (10.7)</td> | |
1104 </tr> | |
1105 </table></section> | |
1106 | |
1107 </div> | |
1108 <div class="presenter_notes"> | |
1109 <header><h1>Presenter Notes</h1></header> | |
1110 <section> | |
1111 | |
1112 </section> | |
1113 </div> | |
1114 <footer> | |
1115 | |
1116 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1117 Source: <a href="cbc.md">cbc.md</a> |
35 | 1118 </aside> |
1119 | |
1120 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1121 23/24 |
29 | 1122 </aside> |
1123 </footer> | |
1124 </div> | |
1125 </div> | |
1126 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1127 <!-- slide source: cbc.md --> |
29 | 1128 <div class="slide-wrapper"> |
1129 <div class="slide"> | |
1130 <div class="inner"> | |
1131 | |
27 | 1132 <header><h1>最適化の比較</h1></header> |
1133 | |
1134 | |
32 | 1135 <section><table width=100% border=1> |
27 | 1136 <caption>それぞれの最適化により吐かれたアセンブラコード</caption> |
1137 <tr> | |
1138 <td width=50% style="text-align:center;">CbC-GCC-4.5</td> | |
1139 <td width=50% style="text-align:center;">CbC-GCC-4.6</td> | |
32 | 1140 </tr> |
1141 | |
1142 <tr> | |
27 | 1143 <td> |
1144 <pre> | |
1145 main: | |
1146 call f | |
1147 : | |
1148 jmp f_g0 | |
1149 : | |
1150 movq $f_g1, -24(%rdx) | |
1151 addl $10, %edi | |
1152 movq $g_h1, -48(%rdx) | |
1153 jmp g_h1 | |
1154 : | |
1155 movq 24(%rsi), %rdx | |
1156 movq %rax, %rsi | |
1157 : | |
32 | 1158 jmp *%rdx |
27 | 1159 : |
1160 movq 24(%rsi), %rdx | |
1161 : | |
32 | 1162 jmp *%rdx |
27 | 1163 </pre> |
1164 </td> | |
1165 <td> | |
1166 <pre> | |
1167 main: | |
1168 movq $f_g1, main_stack+2000(%rip) | |
1169 : | |
1170 call g_h1 | |
1171 : | |
1172 movq 24(%rax), %rdx | |
1173 : | |
32 | 1174 jmp *%rdx |
27 | 1175 : |
1176 movq 24(%rax), %rdx | |
1177 : | |
32 | 1178 jmp *%rdx |
27 | 1179 </pre> |
1180 </td> | |
1181 </tr> | |
1182 <!-- | |
1183 <tr> | |
32 | 1184 <td></td> |
1185 <td></td> | |
1186 </tr> | |
1187 --> | |
1188 | |
1189 </table> | |
27 | 1190 <li>関数を展開してその場で計算する『インライン展開』がより強力になっているのが確認できる</li> |
1191 <!-- | |
1192 <li>保存していた関数ポインタへの継続はインライン展開は行われない</li> | |
32 | 1193 --> |
1194 | |
1195 ---</section> | |
27 | 1196 |
1197 </div> | |
1198 <div class="presenter_notes"> | |
1199 <header><h1>Presenter Notes</h1></header> | |
1200 <section> | |
1201 | |
1202 </section> | |
1203 </div> | |
1204 <footer> | |
1205 | |
1206 <aside class="source"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1207 Source: <a href="cbc.md">cbc.md</a> |
27 | 1208 </aside> |
1209 | |
1210 <aside class="page_number"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1211 24/24 |
27 | 1212 </aside> |
1213 </footer> | |
1214 </div> | |
1215 </div> | |
1216 | |
1217 </div> | |
1218 </div> | |
1219 | |
1220 <div id="toc" class="sidebar hidden"> | |
1221 <h2>Table of Contents</h2> | |
1222 <table> | |
1223 <caption>Table of Contents</caption> | |
1224 | |
1225 <tr id="toc-row-1"> | |
28 | 1226 <th><a href="#slide1">Continuation based C の <br> GCC 4.6による実装</a></th> |
27 | 1227 <td><a href="#slide1">1</a></td> |
1228 </tr> | |
1229 | |
1230 | |
1231 <tr id="toc-row-2" class="sub"> | |
37 | 1232 <th><a href="#slide2">研究目的</a></th> |
27 | 1233 <td><a href="#slide2">2</a></td> |
1234 </tr> | |
1235 | |
1236 | |
1237 | |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1238 <tr id="toc-row-3"> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1239 <th><a href="#slide3">Continuation based C</a></th> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1240 <td><a href="#slide3">3</a></td> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1241 </tr> |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1242 |
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1243 |
27 | 1244 <tr id="toc-row-4"> |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1245 <th><a href="#slide4">Continuation based C</a></th> |
27 | 1246 <td><a href="#slide4">4</a></td> |
1247 </tr> | |
1248 | |
1249 | |
1250 <tr id="toc-row-5"> | |
1251 <th><a href="#slide5">Continuation based C</a></th> | |
1252 <td><a href="#slide5">5</a></td> | |
1253 </tr> | |
1254 | |
1255 | |
1256 <tr id="toc-row-6"> | |
35 | 1257 <th><a href="#slide6">Gnu Compiler Collection (GCC)</a></th> |
27 | 1258 <td><a href="#slide6">6</a></td> |
1259 </tr> | |
1260 | |
1261 | |
1262 <tr id="toc-row-7"> | |
35 | 1263 <th><a href="#slide7">CbC の実装 : 軽量継続</a></th> |
27 | 1264 <td><a href="#slide7">7</a></td> |
1265 </tr> | |
1266 | |
1267 | |
1268 <tr id="toc-row-8"> | |
34
3922a95e99a8
commit presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
1269 <th><a href="#slide8">CbC の実装: Tail Call Elimination</a></th> |
27 | 1270 <td><a href="#slide8">8</a></td> |
1271 </tr> | |
1272 | |
1273 | |
1274 <tr id="toc-row-9"> | |
35 | 1275 <th><a href="#slide9">CbC の実装: Tail Call Elimination</a></th> |
27 | 1276 <td><a href="#slide9">9</a></td> |
1277 </tr> | |
1278 | |
1279 | |
1280 <tr id="toc-row-10"> | |
37 | 1281 <th><a href="#slide10">GCC-4.5, GCC-4.6 の性能比較</a></th> |
27 | 1282 <td><a href="#slide10">10</a></td> |
1283 </tr> | |
1284 | |
1285 | |
1286 <tr id="toc-row-11"> | |
35 | 1287 <th><a href="#slide11">GCC-4.6 の最適化</a></th> |
27 | 1288 <td><a href="#slide11">11</a></td> |
1289 </tr> | |
1290 | |
1291 | |
1292 <tr id="toc-row-12"> | |
35 | 1293 <th><a href="#slide12">最適化の比較</a></th> |
27 | 1294 <td><a href="#slide12">12</a></td> |
1295 </tr> | |
1296 | |
1297 | |
1298 <tr id="toc-row-13"> | |
38 | 1299 <th><a href="#slide13">最新バージョンに合わせる有用性</a></th> |
27 | 1300 <td><a href="#slide13">13</a></td> |
1301 </tr> | |
1302 | |
1303 | |
1304 <tr id="toc-row-14"> | |
35 | 1305 <th><a href="#slide14">まとめ</a></th> |
27 | 1306 <td><a href="#slide14">14</a></td> |
1307 </tr> | |
1308 | |
1309 | |
1310 <tr id="toc-row-15"> | |
35 | 1311 <th><a href="#slide15">jmp と call</a></th> |
27 | 1312 <td><a href="#slide15">15</a></td> |
1313 </tr> | |
1314 | |
1315 | |
1316 <tr id="toc-row-16"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1317 <th><a href="#slide16">conv1 プログラム</a></th> |
27 | 1318 <td><a href="#slide16">16</a></td> |
1319 </tr> | |
1320 | |
1321 | |
1322 <tr id="toc-row-17"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1323 <th><a href="#slide17">CbC-GCC のアップデート手法</a></th> |
27 | 1324 <td><a href="#slide17">17</a></td> |
1325 </tr> | |
1326 | |
1327 | |
1328 <tr id="toc-row-18"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1329 <th><a href="#slide18">構文の追加</a></th> |
27 | 1330 <td><a href="#slide18">18</a></td> |
1331 </tr> | |
1332 | |
1333 | |
28 | 1334 <tr id="toc-row-19"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1335 <th><a href="#slide19">conv1 プログラム</a></th> |
28 | 1336 <td><a href="#slide19">19</a></td> |
1337 </tr> | |
1338 | |
1339 | |
30 | 1340 <tr id="toc-row-20"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1341 <th><a href="#slide20">CbC の実装: 環境付き継続</a></th> |
30 | 1342 <td><a href="#slide20">20</a></td> |
1343 </tr> | |
1344 | |
1345 | |
1346 <tr id="toc-row-21"> | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1347 <th><a href="#slide21">CbC 引数渡し</a></th> |
30 | 1348 <td><a href="#slide21">21</a></td> |
1349 </tr> | |
1350 | |
1351 | |
35 | 1352 <tr id="toc-row-22"> |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1353 <th><a href="#slide22">引数の並びに上書きコピー</a></th> |
35 | 1354 <td><a href="#slide22">22</a></td> |
1355 </tr> | |
1356 | |
1357 | |
39
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1358 <tr id="toc-row-23"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1359 <th><a href="#slide23">最適化の比較</a></th> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1360 <td><a href="#slide23">23</a></td> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1361 </tr> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1362 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1363 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1364 <tr id="toc-row-24"> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1365 <th><a href="#slide24">最適化の比較</a></th> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1366 <td><a href="#slide24">24</a></td> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1367 </tr> |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1368 |
a6540714dda9
modify presen
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
38
diff
changeset
|
1369 |
27 | 1370 </table> |
1371 </div> | |
1372 | |
1373 <div id="help" class="sidebar hidden"> | |
1374 <h2>Help</h2> | |
1375 <table> | |
1376 <caption>Help</caption> | |
1377 <tr> | |
1378 <th>Table of Contents</th> | |
1379 <td>t</td> | |
1380 </tr> | |
1381 <tr> | |
1382 <th>Exposé</th> | |
1383 <td>ESC</td> | |
1384 </tr> | |
1385 <tr> | |
1386 <th>Full screen slides</th> | |
1387 <td>e</td> | |
1388 </tr> | |
1389 <tr> | |
1390 <th>Presenter View</th> | |
1391 <td>p</td> | |
1392 </tr> | |
1393 <tr> | |
1394 <th>Source Files</th> | |
1395 <td>s</td> | |
1396 </tr> | |
1397 <tr> | |
1398 <th>Slide Numbers</th> | |
1399 <td>n</td> | |
1400 </tr> | |
1401 <tr> | |
1402 <th>Toggle screen blanking</th> | |
1403 <td>b</td> | |
1404 </tr> | |
1405 <tr> | |
1406 <th>Show/hide slide context</th> | |
1407 <td>c</td> | |
1408 </tr> | |
1409 <tr> | |
1410 <th>Notes</th> | |
1411 <td>2</td> | |
1412 </tr> | |
1413 <tr> | |
1414 <th>Help</th> | |
1415 <td>h</td> | |
1416 </tr> | |
1417 </table> | |
1418 </div> | |
1419 <script>main()</script> | |
1420 </body> | |
1421 </html> |