annotate presen/slide.pdf.html @ 104:bc2c556987de

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 19 Feb 2019 17:20:34 +0900
parents 66688fe44eb1
children 1a0210c2814b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 <!DOCTYPE html>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 <html>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 <head>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 <meta http-equiv="content-type" content="text/html;charset=utf-8">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 <title>CbCによるPerl6処理系</title>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 <meta name="generator" content="Slide Show (S9) v4.0.1 on Ruby 2.5.1 (2018-03-29) [x86_64-darwin17]">
100
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
13 <meta name="author" content="清水隆博" >
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 <!-- style sheet links -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 <link rel="stylesheet" href="s6/themes/screen.css" media="screen">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 <link rel="stylesheet" href="s6/themes/print.css" media="print">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <link rel="stylesheet" href="s6/themes/blank.css" media="screen,projection">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 <!-- JS -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <script src="s6/js/jquery-1.11.3.min.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 <script src="s6/js/jquery.slideshow.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 <script src="s6/js/jquery.slideshow.counter.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 <script src="s6/js/jquery.slideshow.controls.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 <script src="s6/js/jquery.slideshow.footer.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 <script src="s6/js/jquery.slideshow.autoplay.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 <!-- prettify -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 <link rel="stylesheet" href="scripts/prettify.css">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 <script src="scripts/prettify.js"></script>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 <style>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 .slide {page-break-after: always;}
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 </style>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 </head>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 <body>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 <div class="layout">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 <div id="header"></div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 <div id="footer">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 <div align="right">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 <img src="s6/images/logo.svg" width="200px">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 <div class="presentation">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 <div class='slide cover'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 <table width="90%" height="90%" border="0" align="center">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 <tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 <td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 <div align="center">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 <h1><font color="#808db5">CbCによるPerl6処理系</font></h1>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 </td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 <tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 <td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 <div align="left">
100
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
65 清水隆博
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
66 並列信頼研
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 <hr style="color:#ffcc00;background-color:#ffcc00;text-align:left;border:none;width:100%;height:0.2em;">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 </td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 </table>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 <h2 id="研究目的">研究目的</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 <li>現在開発されているPerl6の実装にRakudoがあり, RakudoはNQP(Perl6のサブセット)で記述されたPerl6, NQPで記述されたNQPコンパイラ, NQPを解釈するVMで構成されている</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
81 <li>NQPコンパイラはRakudoのVMであるMoarVM用のバイトコードを生成する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
82 <li>MoarVMはこのバイトコードを解釈, 実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
83 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
84
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
85 <p><img src="fig/perl6nqp.svg" alt="" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
86
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
87
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
88
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
89 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
90
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
91 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
92 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
93 <h2 id="研究目的-1">研究目的</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
94 <ul>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 <li>Continuation based C (CbC)という言語は継続を基本とするC言語であり, 言語処理系に応用出来ると考えられる</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
96 <li>スクリプト言語などは, バイトコードを扱うが, この実行にcae文や, ラベルgotoなどを利用している。
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
97 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
98 <li>この部分はCbCの機能で書き換える事が可能である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
99 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
100 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
101 <li>命令実行処理部分をモジュール化することで、各命令ごとの最適化や、 命令ディスパッチ部分の最適化を行う事が可能であると考える。</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
102 <li>従って, CbC一部用いてPerl6にC処理系であるMoarVMの書き換えを行い, 処理を検討する.</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 <h2 id="continuation-based-c-cbc">Continuation Based C (CbC)</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 <li>Continuation Based C (CbC) はCodeGearを単位として用いたプログラミング言語である.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 <li>CodeGearはCの通常の関数呼び出しとは異なり,スタックに値を積まず, 次のCodeGearにgoto文によって遷移する.</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
115 <li>CodeGear同士の移動は、 状態遷移として捉える事が出来る</li>
85
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
116 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
117
100
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
118 <p><img src="fig/cbc_sample.svg" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
119
85
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
120
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
121
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
122 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
123
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
124 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
125 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
126 <h2 id="continuation-based-c-cbc-1">Continuation Based C (CbC)</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
127
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
128 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
129 <li>CodeGearはCの関数宣言の型名の代わりに<code>__code</code>と書く事で宣言出来る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 81
diff changeset
130 <li>CodeGearの引数は, 各CodeGearの入出力として利用する</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
131 <li>gotoしてしまうと、元のCodeGearに戻る事が出来ない</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
134 <pre><code>__code cg1(TEST testin){
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 TEST testout;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 testout.number = testin.number + 1;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 testout.string = "Hello";
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 goto cg2(testout);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 __code cg2(TEST testin){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 printf("number = %d\t string= %s\n",testin.number,testin.string);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 int main(){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 TEST test = {0,0};
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 goto cg1(test);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 <h2 id="言語処理系の応用">言語処理系の応用</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 <ul>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
159 <li>スクリプト言語は入力として与えられたソースコードを、 直接評価せずにバイトコードにコンパイルする形式が主流となっている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
160 <li>その為スクリプト言語の実装は大きく2つで構成されている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
161 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
162 <li>バイトコードに変換するフロントエンド部分</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
163 <li>バイトコードを解釈する仮想機械</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
164 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
165 </li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
100
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
168 <p><img src="fig/bytecode_sample_generally_lang.svg" width="80%" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
169
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 <h2 id="rakudo">Rakudo</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 <li>Rakudoとは現在のPerl6の主力な実装である.</li>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
179 <li>Rakudoは次の構成になっている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
180 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
181 <li>実行環境のVM</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
182 <li>Perl6のサブセットであるNQP(NotQuitPerl)</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
183 <li>NQPで記述されたPerl6(Rakudo)</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
184 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
185 </li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 <h2 id="moarvm">MoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 <li>Perl6専用のVMであり, Cで記述されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 <li>レジスタマシンとして実装されている.</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
199 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
200
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
201
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
202
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
203 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
204
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
205 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
206 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
207 <h2 id="moarvmのバイトコード">MoarVMのバイトコード</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
208
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
209 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
210 <li>MoarVMは16ビットのバイナリを命令バイトコードとして利用している</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
211 <li>命令にはその後に16ビットごとにオペランド(引数)を取るものがある</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
212 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
213
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
214 <pre><code>add_i loc_3_int, loc_0_int, loc_1_int
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
215 set loc_2_obj, loc_3_obj
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
216 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
217
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
218
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
219
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
220 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
221
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
222 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
223 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
224 <h2 id="moarvmのバイトコードインタプリタ">MoarVMのバイトコードインタプリタ</h2>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
225 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
226 <li>バイトコードは連続したメモリに確保されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
227 <li>その為次の処理を繰り返す必要がある
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
228 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
229 <li>16ビットごとで読み込み</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
230 <li>読み込んだビットから、命令に対応する処理を呼び出し</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
231 <li>その処理を実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
232 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
233 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
234 <li>この処理をバイトコードディスパッチと呼び、 実行する部分をバイトコードインタプリタと呼ぶ</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
235 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
236
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
237
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
238
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
239 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
240
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
241 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
242 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
243 <h2 id="moarvmのバイトコードインタプリタ-1">MoarVMのバイトコードインタプリタ</h2>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
244
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
245 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
246 <li>MoarVMは関数 <code>MVM_interp_run</code> でバイトコードに応じた処理を実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
247 <li>マクロDISPATCHで, ラベルgotoかcase文に変換が行われる
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
249 <li>バイトコードは数値として見る事が出来る為、 case文に対応する事が出来る</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 <li>この中の <code>OP</code> で宣言されたブロックがそれぞれバイトコードに対応する処理となっている.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 <li><code>cur_op</code>は次のバイトコード列が登録されており, マクロ <code>NEXT</code> で決められた方法で次のバイトコードに対応した処理に遷移する.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 <pre><code>DISPATCH(NEXT_OP) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 OP(const_i64):
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 GET_REG(cur_op, 0).i64 = MVM_BC_get_I64(cur_op, 2);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 cur_op += 10;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 goto NEXT;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 <h2 id="mvm_interp_runで使用されているマクロ">MVM_interp_runで使用されているマクロ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 <pre><code>DISPATCH(NEXT_OP) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 OP(const_i64):
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
278 <li>マクロ <code>OP</code> 及び <code>NEXT</code> は次の様に定義している</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 <pre><code> #define OP(name) OP_ ## name
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 #define NEXT *LABELS[NEXT_OP]
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 <li>マクロ<code>DISPATCH</code>は, ラベルgotoが利用できる場合は無視される</li>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
287 <li>マクロ <code>OP</code> が, バイトコードの名前をC言語のラベルに変換する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 <pre><code> OP_const_i16:
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
291 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
292
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
293 <pre><code> #OP_const_i16
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 <h2 id="mvm_interp_runで使用されているマクロ-1">MVM_interp_runで使用されているマクロ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
305 <li><code>NEXT</code>自体はラベルテーブルにアクセスし, ラベルを取り出す
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
306 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
307 <li>取り出したNEXTはラベルなので、 ラベルgotoの拡張が実装されている場合はgoto文でジャンプ出来る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
308 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
309 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
310 <li>次の命令を計算する処理は, <code>NEXT_OP</code> というマクロが担っている</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 <pre><code>#define NEXT_OP (op = *(MVMuint16 *)(cur_op), cur_op += 2, op)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 #define NEXT *LABELS[NEXT_OP]
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 <li>マクロ <code>NEXT</code> は次の様に展開される</li>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
319 <li>これは現在のバイトコードを指すポインタをインクリメントし、 命令に対応する変数に代入をする</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 <pre><code>goto *LABELS[(op = *(MVMuint16 *)(cur_op), cur_op += 2, op)];
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 <h2 id="mvm_interp_runのラベルテーブル">MVM_interp_runのラベルテーブル</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
334 <li>利用するCコンパイラが、ラベルgotoをサポートしている場合に実行される</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
335 <li>配列<code>LABELS</code>にアクセスし, ラベル情報を取得する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
336 <li>ラベル情報を取得出来ると、 そのラベルに対してラベルgotoを利用する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 <pre><code>static const void * const LABELS[] = {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340 &amp;&amp;OP_no_op,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 &amp;&amp;OP_const_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 &amp;&amp;OP_const_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 &amp;&amp;OP_const_i32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 &amp;&amp;OP_const_i64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 &amp;&amp;OP_const_n32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 &amp;&amp;OP_const_n64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 &amp;&amp;OP_const_s,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 &amp;&amp;OP_set,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 &amp;&amp;OP_extend_u8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 &amp;&amp;OP_extend_u16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 &amp;&amp;OP_extend_u32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 &amp;&amp;OP_extend_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 &amp;&amp;OP_extend_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 <h2 id="mvm_interp_run">MVM_interp_run</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
365 <li>Cの実装の場合, switch文に展開される可能性がある
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
367 <li>命令ディスパッチが書かれているCソースファイルの指定の場所にのみ処理を記述せざるを得ない</li>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
368 <li>1ファイルあたりの記述量が膨大になり, 命令のモジュール化ができない</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 </li>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
371 <li>高速化手法の、 Threaded Codeの実装を考えた場合, この命令に対応して大幅に処理系の実装を変更する必要がある.</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 <li>デバッグ時には今どの命令を実行しているか, ラベルテーブルを利用して参照せざるを得ず, 手間がかかる.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 <!-- _S9SLIDE_ -->
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
381 <h2 id="cbcでの変換">CbCでの変換</h2>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
384 <li>CbCのCodeGearは関数よりも小さな単位である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
385 <li>その為、 従来は関数化出来なかった単位をCodeGearに変換する事が出来る</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 <li>CbCをMoarVMに適応すると, ラベルなどで制御していた命令に対応する処理をCodeGearで記述する事が可能である</li>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
387 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
388
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
389
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
390
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
391 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
392
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
393 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
394 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
395 <h2 id="cbcmoarvmのバイトコードディスパッチ">CbCMoarVMのバイトコードディスパッチ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
396
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
397 <ul>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 <li>オリジナルでは, マクロ <code>NEXT</code> が担当していた, 次のバイトコードへの移動は, NEXT相当のCodeGear <code>cbc_next</code>で処理を行う</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 <li>CodeGearの入出力として, MoarVMなどの情報をまとめた構造体を利用する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
401
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 <pre><code>__code cbc_next(INTERP i){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 __code (*c)(INTERP)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 c = CODES[(i-&gt;op = *(MVMuint16 *)(i-&gt;cur_op), i-&gt;cur_op += 2, i-&gt;op)]; // c = NEXT(i)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 goto c(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
407
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 __code cbc_const_i64(INTERP i){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 GET_REG(i-&gt;cur_op, 0,i).i64 = MVM_BC_get_I64(i-&gt;cur_op, 2);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 i-&gt;cur_op += 10;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 goto cbc_next(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 <h2 id="codegearの入出力インターフェイス">CodeGearの入出力インターフェイス</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 <li>MoarVMではレジスタの集合や命令列などをMVM_interp_runのローカル変数として利用し, 各命令実行箇所で参照している</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 <li>CodeGearに書き換えた場合, このローカル変数にはアクセスする事が不可能となる.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 <li>その為, 入出力としてMoarVMの情報をまとめた構造体interpのポインタであるINTERPを受け渡し, これを利用してアクセスする</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 <pre><code>typedef struct interp {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 MVMuint16 op;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 MVMuint8 *cur_op;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 MVMuint8 *bytecode_start;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 MVMRegister *reg_base;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 /* Points to the current compilation unit
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 . */
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 MVMCompUnit *cu;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 /* The current call site we’re
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 constructing. */
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 MVMCallsite *cur_callsite;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 MVMThreadContext *tc;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 } INTER,*INTERP;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 <h2 id="cbcmoarvmのcodegearテーブル">CbCMoarVMのCodeGearテーブル</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 <li>CodeGearテーブルは引数としてINTERを受け取るCodeGearの配列として定義する</li>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
455 <li>テーブルとして宣言することで、 バイトコードの値をそのままテーブルに反映させる事が可能である</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 <pre><code>__code (* CODES[])(INTERP) = {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 cbc_no_op,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 cbc_const_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 cbc_const_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 cbc_const_i32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 cbc_const_i64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 cbc_const_n32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 cbc_const_n64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 cbc_const_s,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 cbc_set,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 cbc_extend_u8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 cbc_extend_u16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 <!-- _S9SLIDE_ -->
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
478 <h2 id="moarvmとcbcmoarvmのトレース">MoarVMとCbCMoarVMのトレース</h2>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 <ul>
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
481 <li>MoarVMのデバッグ時には、 次の命令が何であるかは直接は判断出来なかった</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 <pre><code>Breakpoint 1, dummy () at src/core/interp.c:46
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 46 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 #1 0x00007ffff75689da in MVM_interp_run (tc=0x604a20,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487 initial_invoke=0x7ffff76c7168 &lt;toplevel_initial_invoke&gt;, invoke_data=0x67ff10)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 at src/core/interp.c:1169
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 1169 goto NEXT;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 $2 = 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 </code></pre>
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
492 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
493 <li>CbCMoarVMの場合は、 次に実行する命令名を確認する事が出来る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
494 </ul>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 <pre><code>Breakpoint 2, cbc_next (i=0x7fffffffdc30) at src/core/cbc-interp.cbc:61
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 61 goto NEXT(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 $1 = (void (*)(INTERP)) 0x7ffff7566f53 &lt;cbc_takeclosure&gt;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 $2 = 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 <h2 id="moarvmのデバッグ">MoarVMのデバッグ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 <li>cur_opのみをPerlスクリプトなどを用いて抜き出し, 並列にログを取得したオリジナルと差分を図る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 <li>この際に差異が発生したバイトコードを確認し, その前の状態で確認していく</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 <pre><code>25 : 25 : cbc_unless_i
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 247 : 247 : cbc_null
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517 54 : 54 : cbc_return_o
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 140 : 140 : cbc_checkarity
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 558 : 558 : cbc_paramnamesused
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 159 : 159 : cbc_getcode
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 391 : 391 : cbc_decont
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 127 : 127 : cbc_prepargs
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 *139 : 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 cbc_invoke_o:cbc_takeclosure
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 <h2 id="現在のcbcmoarvm">現在のCbCMoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 <ul>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
536 <li>現在はNQP, Rakudoのセルフビルドが達成でき, オリジナルと同等のテスト達成率を持っている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
537 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
538 <li>その為、 NQP, Rakudoの実行コマンドであるnqp perl6が起動する様になった</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
539 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
540 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
541 <li>moarの起動時のオプションとして <code>--cbc</code> を与えることによりCbCかオリジナルを選択可能である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
542 <li>Perl6の実行バイナリperl6, NQPの実行バイナリnqp は, それぞれmoarを起動するシェルスクリプトである</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
543 <li><code>--cbc</code> オプションをシェルスクリプト内に書き加えることで, Perl6, NQPがそれぞれCbCで起動する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 <pre><code>#!/bin/sh
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 exec /mnt/dalmore-home/one/src/Perl6/Optimize/llvm/build_perl6/bin/moar --cbc \
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 --libpath=/mnt/dalmore-home/one/src/Perl6/Optimize/llvm/build_perl6/share/nqp/lib \
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 /mnt/dalmore-home/one/src/Perl6/Optimize/llvm/build_perl6/share/nqp/lib/nqp.moarvm "$@"
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 <h2 id="threadedcodeの実装">ThreadedCodeの実装</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
561 <li>MoarVM内のバイトコードに対応する処理が分離出来たことにより, バイトコードに該当するCodeGearを書き連ねることによってThreadedCodeが実装可能となる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
565
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 <h2 id="cbcmoarvmと通常のmoarvmの比較">CbCMoarVMと通常のMoarVMの比較</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
571
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 <li>CbCMoarVMと通常のMoarVMの速度比較を行った</li>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
574 <li>NQPで実装した2種類の例題を用いた
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
575 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
576 <li>単純なループで数値をインクリメントする例題</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
577 <li>再帰呼び出しを用いてフィボナッチ数列を求める例題</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
578 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
579 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
580 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
581
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
582
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
583
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
584 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
585
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
586 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
587 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
588 <h2 id="フィボナッチの例題">フィボナッチの例題</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
589
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
590 <pre><code>#! nqp
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
591
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
592 sub fib($n) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
593 $n &lt; 2 ?? $n !! fib($n-1) + fib($n - 2);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
594 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
595
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
596 my $N := 30;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
597 my $z := fib($N);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
598 say("fib($N) = " ~ fib($N));
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
599 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
600
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
601 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
602 <li>フィボナッチの例題ではCbCMoarVMが劣る結果となった</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
605 <table style="border: 2px solid #595959;">
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
606 <tbody>
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
607 <tr style="border: 2px solid #595959;">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
608 <td style="border: 2px solid #595959;">[単位 sec]</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
609 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
610 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
611 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
612 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
613 <tr style="border: 2px solid #595959;">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
614 <td style="border: 2px solid #595959;">MoarVM</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
615 <td style="border: 2px solid #595959;">1.379</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
616 <td style="border: 2px solid #595959;">1.350</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
617 <td style="border: 2px solid #595959;">1.346</td>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
618 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
619 <tr>
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
620 <td style="border: 2px solid #595959;">CbCMoarVM</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
621 <td style="border: 2px solid #595959;">1.636</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
622 <td style="border: 2px solid #595959;">1.804</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
623 <td style="border: 2px solid #595959;">1.787</td>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
624 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
625 </tbody>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
626 </table>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
627
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
628 <style type="text/css">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
629 table , td, th {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
630 border-collapse: collapse;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
631 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
632 td, th {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
633 padding: 12px;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
634 width: 120px;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
635 height: 40px;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
636 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
637 th {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
638 background: #f0e6cc;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
639 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
640 .even {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
641 background: #fbf8f0;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
642 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
643 .odd {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
644 background: #fefcf9;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
645 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
646 </style>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
647
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
648
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
649
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
650 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
651
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
652 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
653 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
654 <h2 id="単純ループ">単純ループ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
655
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656 <pre><code>#! nqp
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
657
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 my $count := 100_000_000;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
659
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
660 my $i := 0;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
662 while ++$i &lt;= $count {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
663 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
664 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
665
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
666 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
667 <li>単純ループの場合は1.5secほど高速化した</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
668 <li>これは実行する命令コードが、 CPUのキャッシュに収まった為であると考えられる</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
669 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
671 <table style="border: 2px solid #595959;">
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
672 <tbody>
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
673 <tr style="border: 2px solid #595959;">
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
674 <td style="border: 2px solid #595959;">[単位 sec]</td>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
675 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
676 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
677 <td></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
678 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
679 <tr>
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
680 <td style="border: 2px solid #595959;">MoarVM</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
681 <td style="border: 2px solid #595959;">7.499</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
682 <td style="border: 2px solid #595959;">7.844</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
683 <td style="border: 2px solid #595959;">7.822</td>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
684 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
685 <tr>
104
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
686 <td style="border: 2px solid #595959;">CbCMoarVM</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
687 <td style="border: 2px solid #595959;">6.135</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
688 <td style="border: 2px solid #595959;">6.362</td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
689 <td style="border: 2px solid #595959;">6.074</td>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
690 </tr>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
691 </tbody>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
692 </table>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
693
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
694
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
696 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
697
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 <!-- _S9SLIDE_ -->
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
700 <h2 id="cbcmoarvmの利点">CbCMoarVMの利点</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
701 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
702 <li>バイトコードインタプリタの箇所をモジュール化する事が可能となった
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
703 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
704 <li>CodeGearの再利用性や記述生が高まる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
705 <li>CodeGearは関数の様に扱える為、 命令ディスパッチの最適化につながる実装が可能となった</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
706 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
707 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
708 <li>デバッグ時にラベルではなくCodeGearにbreakpointを設定可能となった
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
709 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
710 <li>デバッグが安易となる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
711 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
712 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
713 <li>CPUがキャッシュに収まる範囲の命令の場合、 通常のMoarVMよりも高速に動作する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
714 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
715
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
716
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
717
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
718 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
719
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
720 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
721 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
722 <h2 id="cbcmoarvmの欠点">CbCMoarVMの欠点</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
723
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
724 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
725 <li>MoarVMのオリジナルの更新頻度が高い為, 追従していく必要がある</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
726 <li>CodeGear側からCに戻る際に手順が複雑となる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
727 <li>CodeGearを単位として用いる事で複雑なプログラミングが要求される.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
728 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
729
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
730
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
731
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
732 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
733
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
734 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
735 <!-- _S9SLIDE_ -->
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
736 <h2 id="まとめ">まとめ</h2>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
738 <li>継続と基本としたC言語 Continuation Based Cを用いてPerl6の処理系の一部を書き直した
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
739 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
740 <li>Cの持つCodeGearによって, 本来はモジュール化出来ない箇所をモジュール化が可能となった</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
741 <li>CPUキャッシュに収まるループなどの命令の場合は、 通常のMoarVMよりも高速に動作する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
742 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
743 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
744 <li>今後はCodeGearの特性を活用し、 直接次の命令を実行する処理を実装する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
745 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 </div><!-- presentation -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 </body>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 </html>