Mercurial > hg > Papers > 2015 > kaito-lola
annotate presentation/presen.html @ 16:c3d20ec1ec4b
spell check
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 04 Jul 2015 23:36:52 +0900 |
parents | bbbeecda034d |
children | 889696aa5018 |
rev | line source |
---|---|
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 <!DOCTYPE html> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 <html> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 <head> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 <meta charset='utf-8'> |
14 | 5 <title>Presentation</title> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 <!-- style sheet links --> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 <link rel="stylesheet/less" href="themes/blank/projection.css.less" media="screen,projection"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 <link rel="stylesheet/less" href="themes/blank/screen.css.less" media="screen"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 <link rel="stylesheet/less" href="themes/blank/print.css.less" media="print"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 <link rel="stylesheet/less" href="blank.css.less" media="screen,projection"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 <!-- add js libs (less, jquery) --> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 <script src="js/less-1.1.4.min.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 <script src="js/jquery-1.7.min.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 <!-- S6 JS --> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 <script src="js/jquery.slideshow.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 <script src="js/jquery.slideshow.counter.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 <script src="js/jquery.slideshow.controls.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 <script src="js/jquery.slideshow.footer.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 <script src="js/jquery.slideshow.autoplay.js"></script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 <script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 $(document).ready( function() { |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 Slideshow.init(); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 // Example 2: Start Off in Outline Mode |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 // Slideshow.init( { mode: 'outline' } ); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 // Example 3: Use Custom Transition |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 // Slideshow.transition = transitionScrollUp; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 // Slideshow.init(); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 // Example 4: Start Off in Autoplay Mode with Custom Transition |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 // Slideshow.transition = transitionScrollUp; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 // Slideshow.init( { mode: 'autoplay' } ); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 } ); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 </script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 </head> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 <body> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 <div class="layout"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 <div id="header"></div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 <div id="footer"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 <div align="right"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 <img src="images/concurrency.png" width="200"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 <div class="presentation"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 <div class='slide cover'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 <table width="90%" height="90%" border="0" align="center"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 <tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 <td><div align="center"> |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
57 <h1><font color="#808db5">Implementating Continuation based language in Clang and LLVM</font></h1> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 </div></td> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 </tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 <tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 <td><div align="left"> |
13 | 62 Kaito Tokumori, Shinji Kono <br> |
15 | 63 University of the Ryukyus |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 <script> |
13 | 65 document.write("<br>July 5, 2015"); |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 </script> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:300%;height:0.2em;"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 </div></td> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 </tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 </table> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 <h2>Objective</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 <ul> |
14 | 76 <li>Achieve Reliable computation |
13 | 77 <li>Extract Concurrent Execution Automatically |
78 <li>Modify and Improve software in a Reliable way | |
79 <li>Get more Reusablity | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 <h3>Introducing new units of programming</h3> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 <h2>Traditional units of programming</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 <li>Machine instruction |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 <li>Statements of programming language |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 <li>Function call / Method |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 <li>Module / Class / Interface |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 <li>Thread / Process |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 <li>Object |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 <li>Record / Table |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 <h2>What we want to do with programming units?</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 <li>Divide large functions into small parts. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 <li>Add hidden arguments without code modification. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 <li>Add meta computation. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104 <li>Extract concurrency from programming units. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 </ul> |
13 | 106 <h3>It is not easy to do this in the traditional units.</h3> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 <div class='slide'> |
14 | 110 <h2>New programming units</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 <li>Units of programming: code segments, data segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 <li>Code segments are units of calculation. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 <li>Data segments are sets of typed data. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 <h2>Code segments</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 <li>Function from input data segments to output data segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 <li>Code segments have no states. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 <li>Access in typed data in the data segments by name. |
14 | 124 <li>Specify code segments to be executed using goto. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 <h3>It is easy to divide or combine.</h3> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
130 <h2>Data segments</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
132 <li>Set of typed data. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
133 <li>Type signatures are in meta data segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
134 <li>Variable and extendable data structure. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135 <li>Data segments are dominated by connected code segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
136 <li>Code segments atomically access connected data segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138 <h3>It is easy to divide or combine.</h3> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
141 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
142 <h2>Meta code / data segments</h2> |
15 | 143 <p>A thread of code segments has a context as a meta data segment</p> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
144 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
145 <li>Execution contexts: Thread |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
146 <li>Type signatures of data segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
147 <li>Data segment linkages: Pointer |
13 | 148 <li>Machine code of code segments |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
149 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
150 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
151 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
152 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
153 <h2>Continuation based C (CbC)</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
154 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
155 <li>An implementation of code segments. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
156 <li>CbC stands for Continuation based C. |
13 | 157 <li>Basic syntax is the same as the C, except __code and goto. |
158 <li>__code is a type of code segment | |
159 <li>Code segments end with parameterized goto. | |
14 | 160 <li>Data segments are implemented as C structures. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
161 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
162 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
163 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
164 <div class='slide'> |
13 | 165 <h2>code segment syntax</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
166 <table border='1' align='center' width='80%'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
167 <tr><td width='50%'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
168 <pre class='small_code'> |
9 | 169 __code f() { |
170 goto g(); | |
171 } | |
172 | |
173 __code g() { | |
174 goto h(); | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
175 } |
9 | 176 </pre> |
177 </td><td valign='top'> | |
178 <ul> | |
13 | 179 <li>code segment transition is goto. |
180 <li>Code segments have no return statement. | |
9 | 181 <li>There are no return values. |
182 </ul> | |
183 </td></tr> | |
184 </table> | |
185 </div> | |
186 | |
187 <div class='slide'> | |
13 | 188 <h2>code segment syntax with data segments</h2> |
9 | 189 <table border='1' align='center' width='80%'> |
190 <tr><td width='50%'> | |
191 <pre class='small_code'> | |
13 | 192 __code code1(struct Allocate* allocate, |
10 | 193 struct Element* element) { |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
194 element ->value = 10; |
13 | 195 struct List* list = (struct List *)malloc(sizeof( struct List)); |
196 goto append(allocate,list, element); | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
197 } |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
198 |
13 | 199 __code append(struct Allocate* allocate, struct List* list, struct Element* element) { |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
200 if(list->head) { |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
201 list->tail->next = element; |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
202 } else { |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
203 list->head = element; |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
204 } |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
205 list->tail = element; |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
206 list->tail->next = 0; |
13 | 207 goto code2(allocate,list, element); |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
208 } |
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
209 </pre> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
210 </td><td valign='top'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
211 <ul> |
13 | 212 <li>data segments are arguments of a code segment and a goto statement. |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
213 </ul> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
214 </td></tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
215 </table> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
216 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
217 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
218 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
219 <h2>CbC compilers</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
220 <ul> |
13 | 221 <li>Micro-C(one pass standalone compiler) 2001 |
222 <li>on GCC(GNU Compiler Collection) 2008 | |
223 <li>on LLVM and Clang (Compiler framework) 2014 | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
224 <ul> |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
225 <li><font color='red'>The latest!</font> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
226 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
227 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
228 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
229 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
230 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
231 <h2>LLVM and Clang's compilation flow</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
232 <ul> |
13 | 233 <li>AST : Abstract Syntax Tree (C++ object) |
234 <li>LLVM IR is Intermediate Representation (bit code). | |
4
20257f618ddd
slide: llvm structure
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
235 <li>Clang translate C/C++/Obj-C into LLVM IR. |
14 | 236 <li>SelectionDAG : Code generator internal |
13 | 237 <li>Machine Code : LLVM Machine code |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
238 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
239 <div align="center"><img src="fig/clang_llvm_structure.svg" width="45%"></div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
240 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
241 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
242 <div class='slide'> |
13 | 243 <h2>Advantage of LLVM implementation</h2> |
9 | 244 <ul> |
13 | 245 <li>Apple supported (working on OS X). |
246 <li>OS X default compiler. | |
247 <li>LLVM IR is well documented. | |
248 <li>better than GCC | |
9 | 249 </ul> |
250 </div> | |
251 | |
252 <div class='slide'> | |
13 | 253 <h2>CbC implementation strategy</h2> |
9 | 254 <ul> |
14 | 255 <li>define special type __code for code segments |
256 <li>no code segment prototyping (otherwise it becomes quite messy ) | |
13 | 257 <li>code segments are implemented as tail call force functions |
14 | 258 <li>Do not modify IR (Intermediate representations ) |
259 <li>goto statement is actually a function call with following return statement <br> | |
13 | 260 goto f() --> { f() ; return; } |
261 <li>allow mixing code segments and normal function calls ( goto with environment ) | |
9 | 262 </ul> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
263 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
264 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
265 <div class='slide'> |
9 | 266 <h2>LLVM IR</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
267 <ul> |
13 | 268 <li>Intermediate Representation (bit code). |
269 <li>Three forms: in-memory IR, bitcode stream, human readable language. | |
270 <li>it has precise type, data size, alignment | |
14 | 271 <li>function call flags : tail, fastcc, cc10, cc11, Erlang, ghc |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
272 </ul> |
9 | 273 <table width='100%'> |
274 <tr> | |
275 <td style="border: double;"> | |
276 <pre class='code'> | |
277 define fastcc void @factorial(i32 %x) #0 { | |
278 entry: | |
279 tail call fastcc void @factorial0(i32 1, i32 %x) | |
280 ret void | |
281 } | |
282 </pre> | |
283 </td> | |
284 </tr> | |
285 </table> | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
286 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
287 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
288 <div class='slide'> |
13 | 289 <h2>CbC implementation strategy</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
290 <ul> |
13 | 291 <li>Code segments are implemented by C functions with return-type __code. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
292 <li>Data segments are implemented by C structs. |
14 | 293 <li>Goto statement is implemented by setting tail call flag. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
294 <li>Goto with environment is implemented by setjmp and longjmp. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
295 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
296 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
297 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
298 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
299 <div class='slide'> |
9 | 300 <h2>Prototype declaration generating</h2> |
301 <ul> | |
302 <li>In CbC, programmer write a lot of code segments. | |
12 | 303 <li>Automatically prototype declarator support it. |
304 <!-- <li>When parser meet a code segment call, it stop current parsing and search called code segment declaration.--> | |
14 | 305 <li>If the declaration was not found, search definition and generate declaration. |
9 | 306 <ul> |
307 <li>Of course you can write declaration yourself too. | |
308 </ul> | |
309 </ul> | |
310 <table border='1' width='80%' align='center'> | |
311 <tr> | |
312 <td>original input code | |
14 | 313 <td>Clang generates it internally |
9 | 314 </tr> |
315 <tr> | |
316 <td><pre class='small_code'> | |
317 __code code1(int a, int b) { | |
318 : | |
319 goto code2(a,b); | |
320 } | |
321 | |
322 __code code2(int a, int b){ | |
323 : | |
324 } | |
325 </pre> | |
326 <td><pre class='small_code'> | |
327 <font color='red'>__code code2(int a, int b);</font> | |
328 __code code1(int a, int b) { | |
329 : | |
330 goto code2(a,b); | |
331 } | |
332 | |
333 __code code2(int a, int b){ | |
334 : | |
335 } | |
336 </pre> | |
337 </tr> | |
338 </table> | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
339 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
340 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
341 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
342 <h2>goto syntax for transition</h2> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
343 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
344 <li>Add return statement after goto transition. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
345 <li>It is one the requirement force to tail call elimination. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
346 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
347 <table border='1' width='80%' align='center'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
348 <tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
349 <td>original input code |
14 | 350 <td>Clang generates it |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
351 </tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
352 <tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
353 <td><pre class='small_code'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
354 __code code1() { |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
355 : |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
356 goto code2(); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
357 } |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
358 </pre> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
359 <td><pre class='small_code'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
360 void code1() { |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
361 : |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
362 code2(); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
363 <font color='red'>return;</font> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
364 } |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
365 </pre> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
366 </tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
367 </table> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
368 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
369 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
370 <div class='slide'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
371 <h2>Forcing Tail Call Elimination</h2> |
14 | 372 <p>Tail call flag is set in CodeGen.</p> |
13 | 373 <p>Ensure TCE in SelectionDAGISel.</p> |
11 | 374 <div align='center'><img src="fig/clang_llvm_slide_cg_DAG.svg" width="60%"></div> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
375 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
376 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
377 <div class='slide'> |
11 | 378 <!-- <h2>Jmp instruction based transition</h2> --> |
379 <h2>What is tail call elimination?</h2> | |
9 | 380 <ul> |
13 | 381 <li>Tail call is a function call immediately followed by return. |
382 <li>If stack frame have to be unchanged, | |
9 | 383 <li>Tail call elimination replace tail call's call instructions with jmp instructions. |
13 | 384 <li>that is tail call function should have the same arguments and the same return type |
9 | 385 </ul> |
386 <div align='center'><img src="fig/TCE.svg" width="40%"></div> | |
387 </div> | |
388 | |
389 | |
390 <div class='slide'> | |
13 | 391 <h2>Tail Call Elimination requirements</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
392 <ul> |
9 | 393 <li>Set tail flag at the code segments call. |
13 | 394 <li>Tailcallopt path is enabled in the compiler. |
14 | 395 <li>The caller and callee's calling conventions must be the same and their types should be cc10, cc11 or fastcc. |
9 | 396 <li>Return value type has to be the same as the caller's. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
397 </ul> |
5 | 398 </div> |
399 | |
400 <div class='slide'> | |
401 <h2>Forcing Tail Call Elimination</h2> | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
402 <ul> |
9 | 403 <li>Always add tail call elimination pass. |
404 <li>Tailcallopt is enabled in CbC. | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
405 <li>Fast cc is used consistently in code segments call. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
406 <li>All the code segments return value type is void. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
407 </ul> |
15 | 408 <p>This is the reason why we need __code type for code segments.</p> |
13 | 409 </div> |
410 | |
411 <div class='slide'> | |
412 <h2>goto a code segment from a normal C function</h2> | |
413 <ul> | |
14 | 414 <li>Assume we have code segment g and normal function f |
13 | 415 <li>simply goto g() in C function f() |
416 <li>goto g() never returns to function f | |
417 </ul> | |
15 | 418 <p>How to return to C from a code segment?</p> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
419 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
420 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
421 <div class='slide'> |
12 | 422 <h2>Goto with environment</h2> |
13 | 423 <p> |
16 | 424 We want provide continuation of function f.<br> |
425 The continuation is not a simple code segment,<br> | |
426 because code segment has not state.<br> | |
427 We represent the continuation with a code segment (__return) and a meta data segment (__environment).<br> | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
428 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
429 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
430 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
431 <div class='slide'> |
13 | 432 <h2>Syntax of Goto with environment</h2> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
433 <table width='100%'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
434 <tr><td valign='top'> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
435 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
436 <li>Use new keywords __return and __environment. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
437 <li>__return is a code segment pointer for C functions. |
14 | 438 <li>__environment is a environment for C functions. |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
439 <li>Code1 use a continuation with environments to return main function. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
440 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
441 <td style="border: double;"> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
442 <pre class='small_code'><div class='highlight'>__code code1(int n,__code(*exit_code)(int,void *),void *exit_env){ |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
443 printf("code1 : code entry1\n"); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
444 goto exit_code(n,exit_env); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
445 } |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
446 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
447 int caller(){ |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
448 printf("caller : main1 entry\n"); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
449 __code (*__ret)(int, void *) = <font color='red'>__return</font>; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
450 struct __CbC_env *__env = <font color='red'>__environment</font>; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
451 goto code1(1, __ret, __env); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
452 return 0; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
453 } |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
454 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
455 int main(){ |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
456 int n; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
457 n = caller(); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
458 printf("return = %d\n",n); |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
459 return 0; |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
460 } </div></pre> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
461 </tr> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
462 </table> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
463 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
464 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
465 <div class='slide'> |
13 | 466 <h2>Implementation of goto with environment</h2> |
15 | 467 <p>Several ways to implementation</p> |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
468 <ul> |
14 | 469 <li>setjmp/longjmp (LLVM) |
13 | 470 <li>nested function closure with thread safe variable (GCC) |
471 <li>direct manipulation of frame pointer and return value (Micro-C) | |
472 </ul> | |
473 </div> | |
474 | |
475 <div class='slide'> | |
476 <h2>LLVM Implementation of goto with environment</h2> | |
477 <ul> | |
478 <li>Include setjmp.h internally. | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
479 <li>Generate C struct for saving environment. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
480 <ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
481 <li>This struct is __environment. |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
482 </ul> |
16 | 483 <li>Insert setjmp in C function, when __return is used. |
484 <li>Generate longjmp code segment as __return. | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
485 </ul> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
486 </div> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
487 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
488 |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
489 <div class='slide'> |
5 | 490 <h2>Compiling result</h2> |
491 <table width='100%' align='center' border='1'> | |
492 <tr> | |
493 <td valign='top'> | |
494 <pre class='small_code'> | |
495 | |
496 __code caller(int x) | |
497 { | |
498 goto code1(1, x); // should be jmp | |
499 } | |
500 </pre> | |
501 <td> | |
502 <pre class='small_code'> | |
503 _caller: ## @factorial | |
504 .cfi_startproc | |
505 ## BB#0: ## %entry | |
506 subq $24, %rsp | |
507 Ltmp5: | |
508 .cfi_def_cfa_offset 32 | |
509 movl $1, %eax | |
510 movl %edi, 20(%rsp) ## 4-byte Spill | |
511 movl %eax, %edi | |
512 movl 20(%rsp), %esi ## 4-byte Reload | |
513 addq $24, %rsp | |
514 <font color='red'>jmp</font> _code1 ## TAILCALL | |
515 .cfi_endproc | |
516 </pre> | |
517 </tr> | |
518 </table> | |
519 <ul> | |
520 <li>Code1 should called by jmp instruction. | |
521 <li>In assembly code, code1 called by jmp instruction. | |
522 <li>Tail call elimination was forced. | |
523 <li>If tail call elimination was failed, compiler output error messages. | |
524 </ul> | |
525 </div> | |
16 | 526 |
527 <div class='slide'> | |
528 <h2>Usage of CbC : as an instruction description</h2> | |
529 <p>CbC can be used as a hardware description language (RTL level)</p> | |
530 <ul> | |
531 <li>VU (Vector unit) in PS2 | |
532 <li>SPU in PS3 | |
533 </ul> | |
534 </div> | |
535 | |
536 <div class='slide'> | |
537 <h2>Usage of CbC : Parallel Task representation</h2> | |
538 <p>CbC can be used as a parallel programming language</p> | |
539 <ul> | |
540 <li>run on GPU or Many Core | |
541 <li>a code segment is a kernel in Open CL | |
542 <li>a code segment execution is atomic | |
543 <li>during an execution of code, data segments are owned by the code | |
544 <li>task structure is a meta data segment | |
545 <li>task manager is a meta code segment | |
546 </ul> | |
547 </div> | |
548 | |
549 <div class='slide'> | |
550 <h2>Usage of CbC : OS API description</h2> | |
551 <ul> | |
552 <li>detailed description of open/read/write/select | |
553 <li>we can implement kernel in CbC | |
554 </ul> | |
555 </div> | |
556 | |
557 <div class='slide'> | |
558 <h2>Usage of CbC : meta computation</h2> | |
559 <ul> | |
560 <li>call meta code segment during goto | |
561 <li>thread context is a meta data segment | |
562 <li>it can be seen as a monadic meta computation | |
563 </ul> | |
564 </div> | |
565 | |
566 <div class='slide'> | |
567 <h2>Usage of CbC : Model checking</h2> | |
568 <ul> | |
569 <li>call meta code segment during goto | |
570 <li>try all possible non deterministic computation | |
571 <li>keep track data segment state | |
572 <li>Do the model checking without modifying the code | |
573 <li>cf. Java Pathfinder (Model checking by replacing JVM) | |
574 </ul> | |
575 </div> | |
576 | |
577 <div class='slide'> | |
578 <h2>Conclusion</h2> | |
579 <ul> | |
580 <li>CbC compiler on LLVM and Clang is implemented. | |
581 <li>LLVM IR is not modified. | |
582 <li>goto with environment is implemented by setjmp and longjmp. | |
583 <li>Automatic prototype generating. | |
584 <li>Various application of CbC. | |
585 </ul> | |
586 </div> | |
587 | |
588 <div class='slide'> | |
589 <h2>Future works</h2> | |
590 <ul> | |
591 <li>Write operating system in CbC. | |
592 <ul> | |
593 <li>Gears OS | |
594 </ul> | |
595 <li>Meta computation syntax. | |
596 <li>More user friendly syntax. | |
597 <li>Automatic data segment generator. | |
598 <li>Signature for data segment. | |
599 <li>Dependent type and implicit parameter | |
600 </ul> | |
601 </div> | |
602 | |
603 <div class='slide'> | |
604 <h2>LLVM and Clang's intermediate representations</h2> | |
605 <table border='1' align='center' width='80%'> | |
606 <tr><td width='25%'> | |
607 Name | |
608 </td><td> | |
609 Description | |
610 </td></tr> | |
611 <tr><td> | |
612 clang AST | |
613 </td><td> | |
614 Abstract Syntax Tree. It is a representation of the structure source codes. | |
615 </td></tr> | |
616 <tr><td> | |
617 LLVM IR | |
618 </td><td> | |
619 The main intermediate representation of LLVM. It has three different forms: as an in-memory compiler IR, as an on-disk bitcode representation, and as a human readable assembly language representation. | |
620 </td></tr> | |
621 <tr><td> | |
622 SelectionDAG | |
623 </td><td> | |
624 Directed Acyclic Graph. Its nodes indicate what operation the node performs and the operands to the operation. | |
625 </td></tr> | |
626 <tr><td> | |
627 Machine Code | |
628 </td><td> | |
629 This representation is designed to support both an SSA representation for machine code, as well as register allocated, non-SSA form. | |
630 </td></tr> | |
631 <tr><td> | |
632 MC Layer | |
633 </td><td> | |
634 It is used to represent and process code at the raw machine code level. User can some kinds of file (.s, .o, .ll, a.out) by same API. | |
635 </td></tr> | |
636 </table> | |
637 </div> | |
638 | |
639 </div> <!-- presentation --> | |
5 | 640 <div class='slide'> |
6 | 641 <h2>Execution Result</h2> |
642 <ul> | |
643 <li>Conv1 program. | |
644 <ul> | |
645 <li>Repeat calculation program. | |
646 <li>Stack is defined in the program. | |
647 </ul> | |
648 <li>Select execution code by arguments. | |
649 <ul> | |
650 <li>1: not optimized. | |
651 <li>2,3: optimized stack operation. | |
652 </ul> | |
653 <li>Inline optimization is omitted. | |
654 </ul> | |
655 <table width='80%' align='center' border='1'> | |
656 <tr> | |
657 <td width='30%'> | |
658 <td>Argument 1 | |
659 <td>Argument 2 | |
660 <td>Argument 3 | |
661 </tr> | |
662 <tr> | |
663 <td>Micro-C | |
664 <td>6.875 | |
665 <td>2.4562 | |
666 <td>3.105 | |
667 </tr> | |
668 <tr> | |
669 <td>GCC -O2 | |
670 <td>2.9438 | |
671 <td>0.955 | |
672 <td>1.265 | |
673 </tr> | |
674 <tr> | |
675 <td>LLVM and Clang -O0 | |
676 <td>5.835 | |
677 <td>4.1887 | |
678 <td>5.0625 | |
679 </tr> | |
680 <tr> | |
681 <td>LLVM and Clang -O2 | |
682 <td>3.3875 | |
683 <td>2.29 | |
684 <td>2.5087 | |
685 </tr> | |
686 </table> | |
687 <table width='80%' align='center' border='0'> | |
688 <tr><td align='right'>unit : seconds</tr> | |
689 </table> | |
690 <ul> | |
691 <li>LLVM and Clang compilers are faster than Micro-C when optimize is enabled. | |
692 <li>CbC gets benefits from LLVM optimizations. | |
693 <li>LLVM can compile CbC examples. | |
694 </ul> | |
695 </div> | |
3
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
696 </body> |
c50a033e6635
create presentation slide
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
697 </html> |