Mercurial > hg > Events > OSC2019
annotate slide.html @ 10:4b1eb4d69695
update
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 19 Apr 2019 18:53:12 +0900 |
parents | 642787982a80 |
children | 58cd4dd86896 |
rev | line source |
---|---|
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
1 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
2 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
3 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
4 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
5 |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 <!DOCTYPE html> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 <html> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 <head> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 <meta http-equiv="content-type" content="text/html;charset=utf-8"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 <title>Perl6の内部表現</title> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
12 <meta name="generator" content="Slide Show (S9) v4.1.0 on Ruby 2.6.3 (2019-04-16) [x86_64-darwin17]"> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
13 <meta name="author" content="Takahiro Shimizu" > |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 <!-- style sheet links --> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 <link rel="stylesheet" href="s6/themes/projection.css" media="screen,projection"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 <link rel="stylesheet" href="s6/themes/screen.css" media="screen"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 <link rel="stylesheet" href="s6/themes/print.css" media="print"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 <link rel="stylesheet" href="s6/themes/blank.css" media="screen,projection"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 <!-- JS --> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 <script src="s6/js/jquery-1.11.3.min.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 <script src="s6/js/jquery.slideshow.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 <script src="s6/js/jquery.slideshow.counter.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 <script src="s6/js/jquery.slideshow.controls.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 <script src="s6/js/jquery.slideshow.footer.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 <script src="s6/js/jquery.slideshow.autoplay.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 <!-- prettify --> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 <link rel="stylesheet" href="scripts/prettify.css"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 <script src="scripts/prettify.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 <script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 $(document).ready( function() { |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 Slideshow.init(); |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 $('code').each(function(_, el) { |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 if (!el.classList.contains('noprettyprint')) { |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 el.classList.add('prettyprint'); |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 }); |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 prettyPrint(); |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 } ); |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 </script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 <!-- Better Browser Banner for Microsoft Internet Explorer (IE) --> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 <!--[if IE]> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 <script src="s6/js/jquery.microsoft.js"></script> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 <![endif]--> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
52 |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 </head> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 <body> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 <div class="layout"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 <div id="header"></div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 <div id="footer"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 <div align="right"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 <img src="s6/images/logo.svg" width="200px"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 <div class="presentation"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 <div class='slide cover'> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 <table width="90%" height="90%" border="0" align="center"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 <tr> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 <td> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 <div align="center"> |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
73 <h1><font color="#808db5">Perl6の内部表現</font></h1> |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 </td> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76 </tr> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 <tr> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78 <td> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
79 <div align="left"> |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
80 Takahiro Shimizu |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
81 |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82 <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:100%;height:0.2em;"> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 </td> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 </tr> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86 </table> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
89 |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
91 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
92 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
93 <!-- _S9SLIDE_ --> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
94 <h2 id="このセッションの内容">このセッションの内容</h2> |
1 | 95 |
96 <ul> | |
97 <li>Perl6の主要な実装であるRakudoの内部構造を探ります</li> | |
98 <li>Rakudoの内部で利用されているVMや, Perl6のサブセットなどについて探索します</li> | |
3 | 99 <li>スクリプト言語で主に使われているバイトコードインタプリタの気持ちになります</li> |
1 | 100 </ul> |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
102 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
103 |
1 | 104 </div> |
105 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
106 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
107 <!-- _S9SLIDE_ --> |
9 | 108 <h2 id="内容">内容</h2> |
109 <ul> | |
110 <li>Perl6とは?</li> | |
111 <li>スクリプト言語処理系の動き</li> | |
112 <li>Perl6の内部構造 | |
113 <ul> | |
114 <li>NQP</li> | |
115 <li>MoarVM</li> | |
116 </ul> | |
117 </li> | |
118 <li>MoarVMのバイトコード実行</li> | |
119 <li>まとめ</li> | |
120 </ul> | |
121 | |
122 | |
123 | |
124 </div> | |
125 | |
126 <div class='slide'> | |
127 <!-- _S9SLIDE_ --> | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
128 <h2 id="perl6とは">Perl6とは</h2> |
1 | 129 <ul> |
9 | 130 <li>当初Perl5の時期バージョンとして開発されていたプログラミング言語 |
131 <ul> | |
132 <li>現在は別の言語として開発がそれぞれ進んでいる</li> | |
133 </ul> | |
134 </li> | |
1 | 135 <li>仕様と実装が分離しており, 現在はテストが仕様となっている</li> |
9 | 136 <li>実装は歴史上複数存在しているが,主流な実装はRakudo</li> |
137 <li>言語的にはスクリプト言語であり, 漸進的型付き言語</li> | |
138 <li>動作環境は、独自のVMのMoarVM, JVM、一部JavaScript上で動作する</li> | |
1 | 139 </ul> |
140 | |
2 | 141 <p><img src="2000px-Camelia.svg.png" alt="" style="width: 31%; height: auto;" /></p> |
142 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
143 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
144 |
1 | 145 </div> |
146 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
147 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
148 <!-- _S9SLIDE_ --> |
9 | 149 <h2 id="現在のperl6">現在のPerl6</h2> |
150 | |
151 <ul> | |
152 <li>現在のバージョンは <code>6.d</code></li> | |
153 <li><a href="https://perl6.github.io/6pad/">ブラウザ上で実行可能な環境</a>が存在する</li> | |
154 <li><a href="https://commaide.com/">IDE</a>が開発されている</li> | |
155 <li>WebApplicationFrameworkなども開発されており、 Perl5のモジュールを移行したものがいくつか存在する</li> | |
156 <li>日本では趣味のプロダクト以外社会では使用されていない | |
157 <ul> | |
158 <li>海外では実際に使われているケースも存在する</li> | |
159 </ul> | |
160 </li> | |
161 <li>処理速度では一部Perl5に勝っているが、それでも大分遅い</li> | |
162 </ul> | |
163 | |
164 | |
165 | |
166 </div> | |
167 | |
168 <div class='slide'> | |
169 <!-- _S9SLIDE_ --> | |
170 <h2 id="参考perl5のソースコード">[参考]Perl5のソースコード</h2> | |
171 | |
172 <ul> | |
173 <li>Perl5時代 | |
174 <ul> | |
175 <li>スカラ、配列、ハッシュの3種類</li> | |
176 <li>それぞれの変数への参照であるリファレンスが使用可能</li> | |
177 </ul> | |
178 </li> | |
179 </ul> | |
180 | |
181 <pre><code class="language-perl">use ustrict; | |
182 use warnings; | |
183 | |
184 my $scalar_value = "hello!"; | |
185 print "$scalar_value\n"; | |
186 | |
187 my @array = (1..10); | |
188 print "$array[0]\n"; | |
189 | |
190 my %hash = ( this_is_key => "this_is_value"); | |
191 print "$hash{this_is_key}\n"; | |
192 | |
193 my $hash_ref = \%hash; | |
194 print "$hash_ref->{this_is_key}\n"; | |
195 </code></pre> | |
196 | |
197 | |
198 | |
199 </div> | |
200 | |
201 <div class='slide'> | |
202 <!-- _S9SLIDE_ --> | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
203 <h2 id="perl6のソースコード概要">Perl6のソースコード概要</h2> |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
204 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
205 <ul> |
9 | 206 <li>Perl5の文法とは比較的変更が多い |
207 <ul> | |
208 <li>雰囲気は似ている</li> | |
209 </ul> | |
210 </li> | |
1 | 211 <li>変数がオブジェクトと化した事により, 変数からsayメソッドを呼ぶことが可能</li> |
212 </ul> | |
213 | |
214 <pre><code>my $str_value = 'hello world!'; | |
215 $str_value.say; # hello world! | |
216 </code></pre> | |
217 | |
218 <ul> | |
219 <li>Perl5と同様に,変数にはデフォルトでは型がないような振る舞いをする</li> | |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
220 </ul> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
221 |
1 | 222 <pre><code>my $sample_value = 'hello world!'; |
223 $sample_value.say; # hello world! | |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
224 |
1 | 225 $sample_value = '31'; |
226 $sample_value.say; # 31 | |
227 | |
228 say($sample_value * 3); | |
229 </code></pre> | |
230 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
231 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
232 |
1 | 233 </div> |
234 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
235 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
236 <!-- _S9SLIDE_ --> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
237 <h2 id="perl6の言語的な特徴">Perl6の言語的な特徴</h2> |
1 | 238 |
239 <ul> | |
240 <li>漸進的型付き言語である為, 型を強制することも可能となる</li> | |
241 </ul> | |
242 | |
243 <pre><code>my Int $int_value = 31; | |
244 $int_value = "hello"; # Compile error! | |
245 </code></pre> | |
2 | 246 |
7 | 247 <pre><code>$ perl6 type_invalid.p6 |
248 Type check failed in assignment to $int_value; expected Int but got Str ("hello") | |
249 in block <unit> at type_invalid.p6 line 4 | |
250 </code></pre> | |
251 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
252 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
253 |
2 | 254 </div> |
255 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
256 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
257 <!-- _S9SLIDE_ --> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
258 <h2 id="perl6の言語的な特徴-1">Perl6の言語的な特徴</h2> |
4 | 259 |
260 <ul> | |
261 <li>型を独自に定義することも可能</li> | |
262 <li>入力の型によって実行する関数を変える事などができる</li> | |
263 </ul> | |
264 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
265 <pre><code class="language-perl6">my subset Fizz of Int where * %% 3; |
4 | 266 my subset Buzz of Int where * %% 5; |
267 my subset FizzBuzz of Int where Fizz&Buzz; | |
268 my subset Number of Int where none Fizz|Buzz; | |
269 | |
270 proto sub fizzbuzz ($) { * } | |
271 multi sub fizzbuzz (FizzBuzz) { "FuzzBuzz" } | |
272 multi sub fizzbuzz (Fizz) { "Fizz" } | |
273 multi sub fizzbuzz (Buzz) { "Buzz" } | |
274 multi sub fizzbuzz (Number $number) { $number } | |
275 | |
276 fizzbuzz($_).say for 1..15; | |
277 </code></pre> | |
278 | |
9 | 279 <ul> |
280 <li>型を利用したFizzBuzz</li> | |
281 </ul> | |
282 | |
283 | |
284 | |
285 </div> | |
286 | |
287 <div class='slide'> | |
288 <!-- _S9SLIDE_ --> | |
289 <h2 id="スクリプト言語">スクリプト言語</h2> | |
290 <ul> | |
291 <li>Perl6は現状コンパイルすることはできない | |
292 <ul> | |
293 <li>スクリプト言語の分類</li> | |
294 </ul> | |
295 </li> | |
296 <li>現在広く使われているスクリプト言語(Perl,Python,Ruby…)などとPerl6の構成は類似している</li> | |
297 <li>今回はPerl6の実装を追いながら、最近のスクリプト言語処理系の大まかな実装を理解する</li> | |
298 </ul> | |
299 | |
300 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
301 |
7 | 302 </div> |
303 | |
304 <div class='slide'> | |
305 <!-- _S9SLIDE_ --> | |
306 <h2 id="スクリプト言語処理系">スクリプト言語処理系</h2> | |
307 <ul> | |
308 <li>スクリプト言語は入力として与えられたソースコードを、 直接評価せずにバイトコードにコンパイルする形式が主流となっている</li> | |
309 <li>その為スクリプト言語の実装は大きく2つで構成されている | |
310 <ul> | |
311 <li>バイトコードに変換するフロントエンド部分</li> | |
312 <li>バイトコードを解釈する仮想機械</li> | |
313 </ul> | |
314 </li> | |
315 </ul> | |
316 | |
317 <p><img src="fig/bytecode_sample_generally_lang.svg" width="80%" /></p> | |
318 | |
319 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
320 |
4 | 321 </div> |
322 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
323 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
324 <!-- _S9SLIDE_ --> |
9 | 325 <h2 id="perl6以外のスクリプト言語">Perl6以外のスクリプト言語</h2> |
326 | |
327 <ul> | |
328 <li>現在使われているプロセスVMは言語に組み込まれているものが多い</li> | |
329 <li>JVMやElixirなどのVMは複数の言語で使用されている</li> | |
330 <li>Java | |
331 <ul> | |
332 <li>JVM</li> | |
333 </ul> | |
334 </li> | |
335 <li>Ruby | |
336 <ul> | |
337 <li>YARV</li> | |
338 </ul> | |
339 </li> | |
340 <li>Python | |
341 <ul> | |
342 <li>PythonVM</li> | |
343 </ul> | |
344 </li> | |
345 <li>Elixir | |
346 <ul> | |
347 <li>BEAM</li> | |
348 </ul> | |
349 </li> | |
350 </ul> | |
351 | |
352 | |
353 | |
354 </div> | |
355 | |
356 <div class='slide'> | |
357 <!-- _S9SLIDE_ --> | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
358 <h2 id="perl6の処理系の構成">Perl6の処理系の構成</h2> |
2 | 359 |
360 <ul> | |
9 | 361 <li>Perl6の処理系で現在主流なものはRakudoと呼ばれる実装である(歴史上複数存在する)</li> |
2 | 362 <li>Rakudoは3つのレイヤーから構成されている |
363 <ul> | |
364 <li>Perl6インタプリタ</li> | |
365 <li>Perl6インタプリタを記述するPerl6のサブセットNQP</li> | |
366 <li>Perl6のバイトコードを解釈するMoarVM</li> | |
367 </ul> | |
368 </li> | |
9 | 369 <li>Perl6/NQPがフロントエンドに相当し、MoarVMがバックエンドに相当する</li> |
2 | 370 </ul> |
371 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
372 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
373 |
2 | 374 </div> |
375 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
376 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
377 <!-- _S9SLIDE_ --> |
9 | 378 <h2 id="rakudoの構成図">Rakudoの構成図</h2> |
379 | |
380 <p><img src="fig/Rakudo_System_overview.png" alt="" /></p> | |
381 | |
382 <p>(http://brrt-to-the-future.blogspot.com/2015/03/advancing-jit-compiler.html)</p> | |
383 | |
384 | |
385 | |
386 </div> | |
387 | |
388 <div class='slide'> | |
389 <!-- _S9SLIDE_ --> | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
390 <h2 id="perl6とnqp">Perl6とNQP</h2> |
2 | 391 |
392 <ul> | |
9 | 393 <li>NQP(NotQuitPerl Perl) |
394 <ul> | |
395 <li>Perl6のサブセット。Perl6っぽい言語</li> | |
396 </ul> | |
397 </li> | |
398 <li>Perl6、 NQP自体がNQPで記述されている</li> | |
2 | 399 <li>NQPもNQPで記述されている為、 セルフビルド(自分自身で自分自身をコンパイルする)を行う</li> |
400 <li>NQPはPerl6の文法をベースにしているが、 制約がいくつか存在する</li> | |
9 | 401 <li>元々はPerl6の主力実装がParrotだった時代に登場 |
402 <ul> | |
403 <li>文法がアップデートされており、当時の資料は古くなっている</li> | |
404 </ul> | |
405 </li> | |
406 </ul> | |
407 | |
408 <pre><code>my $value := "hello!"; | |
409 say($value); | |
410 </code></pre> | |
411 | |
412 | |
413 | |
414 </div> | |
415 | |
416 <div class='slide'> | |
417 <!-- _S9SLIDE_ --> | |
418 <h2 id="nqpスクリプト">NQPスクリプト</h2> | |
419 | |
420 <ul> | |
421 <li>変数は束縛 <code>:=</code> を使う</li> | |
422 <li>関数の間に空白を入れてはいけない</li> | |
423 <li>再帰呼び出しを使うフィボナッチ数列</li> | |
2 | 424 </ul> |
425 | |
4 | 426 <pre><code>#! nqp |
427 sub fib($n) { | |
428 $n < 2 ?? $n !! fib($n-1) + fib($n - 2); | |
429 } | |
430 | |
431 my $N := 29; | |
432 | |
433 my $z := fib($N); | |
434 | |
435 nqp::say("fib($N) = " ~ fib($N)); | |
436 </code></pre> | |
437 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
438 |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
439 |
2 | 440 </div> |
441 | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
442 <div class='slide'> |
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
443 <!-- _S9SLIDE_ --> |
9 | 444 <h2 id="nqpスクリプトnまでの整数の和">NQPスクリプト(nまでの整数の和)</h2> |
445 | |
446 <pre><code class="language-perl6">sub add_test($n){ | |
10 | 447 my $sum := 0; |
9 | 448 while ( $n > 1) { |
449 $sum := $sum + $n; | |
450 --$n; | |
451 } | |
452 return $sum; | |
453 } | |
454 | |
455 say(add_test(10000)); | |
456 </code></pre> | |
457 | |
458 | |
459 | |
460 </div> | |
461 | |
462 <div class='slide'> | |
463 <!-- _S9SLIDE_ --> | |
10 | 464 <h2 id="nqp">NQP</h2> |
9 | 465 |
2 | 466 <ul> |
9 | 467 <li>NQPはPerl6の中で一番レイヤーが低い言語</li> |
468 <li>その為、 実行するVMのオペコード(処理単位)を使用することができる</li> | |
10 | 469 <li>NQPオペコードは、 Perl6の内部の抽象構文木でも使用されている</li> |
470 <li>また、 Perl6と同様に型を指定することが可能</li> | |
9 | 471 </ul> |
472 | |
10 | 473 <pre><code class="language-perl6">sub add_test(int $n){ |
474 mu $sum := 0; | |
475 while nqp::isgt_i($n,1) { | |
476 $sum := nqp::add_i($sum,$n); | |
477 $n := nqp::sub_i($n,1); | |
478 } | |
479 return $sum; | |
480 } | |
481 </code></pre> | |
482 | |
9 | 483 |
484 | |
485 </div> | |
486 | |
487 <div class='slide'> | |
488 <!-- _S9SLIDE_ --> | |
489 <h2 id="nqpとmoarvm">NQPとMoarVM</h2> | |
490 <ul> | |
491 <li>NQPそのものは実行することはできない</li> | |
492 <li>NQPの実行にはMoarVM/JVMが必要となる | |
5 | 493 <ul> |
9 | 494 <li>NQPコンパイラが各VMに対応したバイトコードに変換する</li> |
3 | 495 </ul> |
496 </li> | |
7 | 497 </ul> |
498 | |
499 | |
500 | |
501 </div> | |
502 | |
503 <div class='slide'> | |
504 <!-- _S9SLIDE_ --> | |
9 | 505 <h2 id="perl6のvm">Perl6のVM</h2> |
7 | 506 <ul> |
9 | 507 <li>MoarVM, JVM , JavaScriptが選択可能 |
508 <ul> | |
509 <li>メインで開発されているのはMoarVMであり、 他のVMは機能が実装されていないものが存在する</li> | |
510 </ul> | |
511 </li> | |
512 <li><code>rakudo-star</code> というPerl6のパッケージ環境では、 MoarVMがデフォルトでインストールされる</li> | |
513 </ul> | |
514 | |
515 | |
516 | |
517 </div> | |
518 | |
519 <div class='slide'> | |
520 <!-- _S9SLIDE_ --> | |
521 <h2 id="moarvm">MoarVM</h2> | |
522 <ul> | |
523 <li>C言語で記述されているPerl6専用の仮想機械</li> | |
7 | 524 <li>レジスタマシン |
525 <ul> | |
526 <li>型情報を持つレジスタに対しての演算として処理される</li> | |
9 | 527 <li>Rubyなどはスタックマシンとして実装されている</li> |
7 | 528 </ul> |
529 </li> | |
530 <li>LuaJITなどを利用したJITコンパイルなども可能</li> | |
531 <li>Perl6やNQPは、MoarVMに対してライブラリなどを設定して起動する</li> | |
532 </ul> | |
533 | |
534 | |
535 | |
536 </div> | |
537 | |
538 <div class='slide'> | |
539 <!-- _S9SLIDE_ --> | |
540 <h2 id="バイトコード">バイトコード</h2> | |
541 <ul> | |
3 | 542 <li>Perl6も、Rakudo/NQPはバイトコードに変換され、 バイトコードをVMが実行する</li> |
10 | 543 <li>Perl6/NQPはバイトコードにコンパイルすることが可能 |
544 <ul> | |
545 <li>直接実行することはできない</li> | |
546 </ul> | |
547 </li> | |
548 </ul> | |
549 | |
550 <pre><code>$nqp --target=mbc --output=fib.moarvm fib.nqp | |
551 </code></pre> | |
552 | |
553 | |
554 | |
555 </div> | |
556 | |
557 <div class='slide'> | |
558 <!-- _S9SLIDE_ --> | |
559 <h2 id="バイトコードとmoarvm">バイトコードとMoarVM</h2> | |
560 | |
561 <ul> | |
562 <li>MoarVMバイトコードはMoarVMの実行バイナリ <code>moar</code> でディスアセンブルすることが可能</li> | |
2 | 563 </ul> |
564 | |
10 | 565 <pre><code> annotation: add_test.nqp:1 |
566 00003 const_i64_16 loc_2_int, 0 | |
567 00004 hllboxtype_i loc_3_obj | |
568 00005 box_i loc_3_obj, loc_2_int, loc_3_obj | |
569 00006 set loc_1_obj, loc_3_obj | |
570 label_1: | |
571 00007 decont loc_3_obj, loc_0_obj | |
572 00008 smrt_numify loc_4_num, loc_3_obj | |
573 00009 const_i64_16 loc_2_int, 1 | |
574 00010 coerce_in loc_5_num, loc_2_int | |
575 00011 gt_n loc_2_int, loc_4_num, loc_5_num | |
576 00012 unless_i loc_2_int, label_2(00031) | |
577 00013 osrpoint | |
578 annotation: add_test.nqp:3 | |
579 00014 decont loc_3_obj, loc_1_obj | |
580 00015 smrt_numify loc_5_num, loc_3_obj | |
581 00016 decont loc_3_obj, loc_0_obj | |
582 00017 smrt_numify loc_4_num, loc_3_obj | |
583 00018 add_n loc_4_num, loc_5_num, loc_4_num | |
584 00019 hllboxtype_n loc_3_obj | |
585 00020 box_n loc_3_obj, loc_4_num, loc_3_obj | |
586 00021 set loc_1_obj, loc_3_obj | |
587 00022 decont loc_3_obj, loc_0_obj | |
588 00023 smrt_numify loc_4_num, loc_3_obj | |
589 00024 coerce_ni loc_6_int, loc_4_num | |
590 00025 const_i64_16 loc_7_int, 1 | |
591 00026 sub_i loc_7_int, loc_6_int, loc_7_int | |
592 00027 hllboxtype_i loc_3_obj | |
593 00028 box_i loc_3_obj, loc_7_int, loc_3_obj | |
594 00029 set loc_0_obj, loc_3_obj | |
595 00030 goto label_1(00007) | |
596 </code></pre> | |
597 | |
598 | |
599 | |
600 </div> | |
601 | |
602 <div class='slide'> | |
603 <!-- _S9SLIDE_ --> | |
604 <h2 id="nqpとバイトコードの対応">NQPとバイトコードの対応</h2> | |
605 | |
606 <pre><code>say(add_test(10000)); | |
607 </code></pre> | |
608 | |
609 <pre><code> annotation: add_test.nqp:1 | |
610 label_1: | |
611 00020 getlex_no loc_7_obj, '&say' | |
612 00021 decont loc_7_obj, loc_7_obj | |
613 00022 const_s loc_3_str, '&add_test' | |
614 00023 getlexstatic_o loc_8_obj, loc_3_str | |
615 00024 decont loc_8_obj, loc_8_obj | |
616 00025 const_i64_16 loc_5_int, 10000 | |
617 00026 prepargs Callsite_1 | |
618 00027 arg_i 0, loc_5_int | |
619 00028 invoke_o loc_8_obj, loc_8_obj | |
620 00029 prepargs Callsite_0 | |
621 00030 arg_o 0, loc_8_obj | |
622 00031 invoke_v loc_7_obj | |
623 00032 null loc_7_obj | |
624 00033 return_o loc_7_obj | |
625 </code></pre> | |
626 | |
627 <ul> | |
628 <li>Perl6の変数は直接実態を参照せず、中身が入っているコンテナを参照するようになっている。</li> | |
629 <li>その為 <code>decont</code> 命令で、コンテナの中身をレジスタに設定する必要がある</li> | |
630 <li><code>const_i64_16</code> などは64bitの数という意味で、 <code>int</code> 型としてレジスタに登録している</li> | |
631 <li><code>prepargs</code> で引数の確認を行い, <code>invoke_o</code> で実際にサブルーチンに移行する</li> | |
632 </ul> | |
633 | |
634 | |
635 | |
636 </div> | |
637 | |
638 <div class='slide'> | |
639 <!-- _S9SLIDE_ --> | |
640 <h2 id="nqpとバイトコードの対応-1">NQPとバイトコードの対応</h2> | |
641 | |
642 <pre><code>my $sum := 0; | |
643 </code></pre> | |
644 | |
645 <pre><code> annotation: add_test.nqp:1 | |
646 00003 const_i64_16 loc_2_int, 0 | |
647 00004 hllboxtype_i loc_3_obj | |
648 00005 box_i loc_3_obj, loc_2_int, loc_3_obj | |
649 00006 set loc_1_obj, loc_3_obj | |
650 </code></pre> | |
651 | |
652 <ul> | |
653 <li>まず <code>loc_2</code> レジスタをint型の整数0で初期化する</li> | |
654 <li>変数 <code>$sum</code> はint型の指定がないので、 obj型で登録しなければならない</li> | |
655 <li>その為, 整数として登録された <code>loc_2</code> から、 obj型に一旦キャストし、 <code>loc_3</code> レジスタに設定したものを、 <code>loc_1</code> レジスタに設定する</li> | |
656 </ul> | |
657 | |
658 | |
659 | |
660 </div> | |
661 | |
662 <div class='slide'> | |
663 <!-- _S9SLIDE_ --> | |
664 <h2 id="nqpとバイトコードの対応-2">NQPとバイトコードの対応</h2> | |
665 | |
666 <pre><code> while ( $n > 1) { | |
667 </code></pre> | |
668 | |
669 <pre><code> label_1: | |
670 00007 decont loc_3_obj, loc_0_obj | |
671 00008 smrt_numify loc_4_num, loc_3_obj | |
672 00009 const_i64_16 loc_2_int, 1 | |
673 00010 coerce_in loc_5_num, loc_2_int | |
674 00011 gt_n loc_2_int, loc_4_num, loc_5_num | |
675 00012 unless_i loc_2_int, label_2(00031) | |
676 00013 osrpoint | |
677 </code></pre> | |
678 | |
679 <ul> | |
680 <li>変数 <code>$n</code> と 整数 <code>1</code> を大小比較する為、 まず <code>$n</code> から値を取り出す</li> | |
681 <li>比較にもint型の指定がない為、 <code>num</code> 型にキャストし、 <code>num</code> 型のレジスタでの大小を比較する</li> | |
682 <li>比較命令は <code>gt_n</code> であり、 結果により <code>unless_i</code> 命令で、別のラベルにジャンプする</li> | |
683 </ul> | |
6
f8f9af788fa7
remove !#SLIDE for use slideshow latest version
Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
684 |
0
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
685 </div> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
686 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
687 |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
688 </div><!-- presentation --> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
689 </body> |
19155754a586
create OSC2019 slide template
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
690 </html> |