annotate presen/slide.pdf.html @ 107:eaa12816b3e3

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 19 Feb 2019 17:45:30 +0900
parents e3c459b29e98
children 793ee68da7fa
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>
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
80 <li>Continuation based C (CbC)という言語は継続を基本とするC言語であり, 言語処理系に応用出来ると考えられる</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
81 <li>スクリプト言語などは, バイトコードを扱うが, この実行にcae文や, ラベルgotoなどを利用している。
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
82 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
83 <li>この部分はCbCの機能で書き換える事が可能である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
84 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
85 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
86 <li>命令実行処理部分をモジュール化することで、各命令ごとの最適化や、 命令ディスパッチ部分の最適化を行う事が可能であると考える。</li>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
87 </ul>
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
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>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
93 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
94 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
95 <h2 id="研究目的-1">研究目的</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
96 <ul>
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
97 <li>現在開発されているPerl6の実装にRakudoがあり, RakudoはNQP(Perl6のサブセット)で記述されたPerl6, NQPで記述されたNQPコンパイラ, NQPを解釈するVMで構成されている</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
98 <li>NQPコンパイラはRakudoのVMであるMoarVM用のバイトコードを生成する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
99 <li>MoarVMはこのバイトコードを解釈, 実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
100 <li>本研究では, CbC用いてPerl6にC処理系であるMoarVMの一部書き換えを行い, 命令のモジュール化を検討する.</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
103 <p><img src="fig/perl6nqp.svg" alt="" /></p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
104
81
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_ -->
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
157 <h2 id="スクリプト言語処理系">スクリプト言語処理系</h2>
81
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_ -->
106
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
243 <h2 id="mvm_interp_runの内部処理">MVM_interp_runの内部処理</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
244
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
245 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
246 <li>MoarVMは関数 <code>MVM_interp_run</code> でバイトコードに応じた処理を実行する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
247 <li>gccやclangを利用してコンパイルした場合、 ラベルgotoで命令ディスパッチが実行される</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
248 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
249
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
250 <p>&lt;img src=”fig/origin_label_goto.svg” width=”30%” text-align:center;padding-left: 300px;&gt;</p>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
251
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
252
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
253
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
254 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
255
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
256 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 105
diff changeset
257 <!-- _S9SLIDE_ -->
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
258 <h2 id="moarvmのバイトコードインタプリタ-1">MoarVMのバイトコードインタプリタ</h2>
92
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
259
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
260 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
261 <li>マクロDISPATCHで, ラベルgotoかcase文に変換が行われる
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
263 <li>バイトコードは数値として見る事が出来る為、 case文に対応する事が出来る</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 <li>この中の <code>OP</code> で宣言されたブロックがそれぞれバイトコードに対応する処理となっている.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 <li><code>cur_op</code>は次のバイトコード列が登録されており, マクロ <code>NEXT</code> で決められた方法で次のバイトコードに対応した処理に遷移する.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 <pre><code>DISPATCH(NEXT_OP) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 OP(const_i64):
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 GET_REG(cur_op, 0).i64 = MVM_BC_get_I64(cur_op, 2);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 cur_op += 10;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 goto NEXT;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 <h2 id="mvm_interp_runで使用されているマクロ">MVM_interp_runで使用されているマクロ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 <pre><code>DISPATCH(NEXT_OP) {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 OP(const_i64):
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 <ul>
107
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
292 <li>マクロ <code>OP</code> は次の様に定義している</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 <pre><code> #define OP(name) OP_ ## name
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
299 <li>マクロ <code>OP</code> が, バイトコードの名前をC言語のラベルに変換する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 <pre><code> OP_const_i16:
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
303 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
304
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
305 <pre><code> #OP_const_i16
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
308
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 <h2 id="mvm_interp_runで使用されているマクロ-1">MVM_interp_runで使用されているマクロ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 <ul>
107
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
317 <li>次の命令に移動する <code>NEXT</code>はラベルテーブルにアクセスし, ラベルを取り出す
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
318 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
319 <li>取り出したNEXTはラベルなので、 ラベルgotoの拡張が実装されている場合はgoto文でジャンプ出来る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
320 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
321 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
322 <li>次の命令を計算する処理は, <code>NEXT_OP</code> というマクロが担っている</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 <pre><code>#define NEXT_OP (op = *(MVMuint16 *)(cur_op), cur_op += 2, op)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 #define NEXT *LABELS[NEXT_OP]
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 <li>マクロ <code>NEXT</code> は次の様に展開される</li>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
331 <li>これは現在のバイトコードを指すポインタをインクリメントし、 命令に対応する変数に代入をする</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 <pre><code>goto *LABELS[(op = *(MVMuint16 *)(cur_op), cur_op += 2, op)];
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
340
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
343 <h2 id="mvm_interp_runのラベルテーブル">MVM_interp_runのラベルテーブル</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
346 <li>利用するCコンパイラが、ラベルgotoをサポートしている場合に実行される</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
347 <li>配列<code>LABELS</code>にアクセスし, ラベル情報を取得する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
348 <li>ラベル情報を取得出来ると、 そのラベルに対してラベルgotoを利用する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 <pre><code>static const void * const LABELS[] = {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 &amp;&amp;OP_no_op,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
353 &amp;&amp;OP_const_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 &amp;&amp;OP_const_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 &amp;&amp;OP_const_i32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
356 &amp;&amp;OP_const_i64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 &amp;&amp;OP_const_n32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 &amp;&amp;OP_const_n64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 &amp;&amp;OP_const_s,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 &amp;&amp;OP_set,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361 &amp;&amp;OP_extend_u8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 &amp;&amp;OP_extend_u16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 &amp;&amp;OP_extend_u32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 &amp;&amp;OP_extend_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 &amp;&amp;OP_extend_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
369
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 <h2 id="mvm_interp_run">MVM_interp_run</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
377 <li>Cの実装の場合, switch文に展開される可能性がある
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 <ul>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
379 <li>命令ディスパッチが書かれているCソースファイルの指定の場所にのみ処理を記述せざるを得ない</li>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
380 <li>1ファイルあたりの記述量が膨大になり, 命令のモジュール化ができない</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 </li>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
383 <li>高速化手法の、 Threaded Codeの実装を考えた場合, この命令に対応して大幅に処理系の実装を変更する必要がある.</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 <li>デバッグ時には今どの命令を実行しているか, ラベルテーブルを利用して参照せざるを得ず, 手間がかかる.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
386
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
392 <!-- _S9SLIDE_ -->
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
393 <h2 id="cbcでの変換">CbCでの変換</h2>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 <ul>
93
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
396 <li>CbCのCodeGearは関数よりも小さな単位である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 92
diff changeset
397 <li>その為、 従来は関数化出来なかった単位をCodeGearに変換する事が出来る</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 <li>CbCをMoarVMに適応すると, ラベルなどで制御していた命令に対応する処理をCodeGearで記述する事が可能である</li>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
399 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
400
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
401
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
402
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
403 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
404
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
405 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
406 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
407 <h2 id="cbcmoarvmのバイトコードディスパッチ">CbCMoarVMのバイトコードディスパッチ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
408
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
409 <ul>
107
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
410 <li>オリジナルでは, マクロ <code>NEXT</code> が担当していた、 次のバイトコードへの移動は, NEXT相当のCodeGear <code>cbc_next</code>で処理を行う</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 <li>CodeGearの入出力として, MoarVMなどの情報をまとめた構造体を利用する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 <pre><code>__code cbc_next(INTERP i){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 __code (*c)(INTERP)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 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
417 goto c(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420 __code cbc_const_i64(INTERP i){
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 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
422 i-&gt;cur_op += 10;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
423 goto cbc_next(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
433 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 <h2 id="codegearの入出力インターフェイス">CodeGearの入出力インターフェイス</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
435
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 <li>MoarVMではレジスタの集合や命令列などをMVM_interp_runのローカル変数として利用し, 各命令実行箇所で参照している</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 <li>CodeGearに書き換えた場合, このローカル変数にはアクセスする事が不可能となる.</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 <li>その為, 入出力としてMoarVMの情報をまとめた構造体interpのポインタであるINTERPを受け渡し, これを利用してアクセスする</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 <pre><code>typedef struct interp {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 MVMuint16 op;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
444 MVMuint8 *cur_op;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 MVMuint8 *bytecode_start;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
446 MVMRegister *reg_base;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 /* Points to the current compilation unit
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448 . */
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 MVMCompUnit *cu;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 /* The current call site we’re
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
451 constructing. */
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 MVMCallsite *cur_callsite;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 MVMThreadContext *tc;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 } INTER,*INTERP;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
458
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
459 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
461 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
462 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 <h2 id="cbcmoarvmのcodegearテーブル">CbCMoarVMのCodeGearテーブル</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 <li>CodeGearテーブルは引数としてINTERを受け取るCodeGearの配列として定義する</li>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
467 <li>テーブルとして宣言することで、 バイトコードの値をそのままテーブルに反映させる事が可能である</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 <pre><code>__code (* CODES[])(INTERP) = {
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471 cbc_no_op,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 cbc_const_i8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 cbc_const_i16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 cbc_const_i32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 cbc_const_i64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 cbc_const_n32,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 cbc_const_n64,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 cbc_const_s,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 cbc_set,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 cbc_extend_u8,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 cbc_extend_u16,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 <!-- _S9SLIDE_ -->
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
490 <h2 id="moarvmとcbcmoarvmのトレース">MoarVMとCbCMoarVMのトレース</h2>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 <ul>
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
493 <li>MoarVMのデバッグ時には、 次の命令が何であるかは直接は判断出来なかった</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 </ul>
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 1, dummy () at src/core/interp.c:46
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 46 }
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 #1 0x00007ffff75689da in MVM_interp_run (tc=0x604a20,
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
499 initial_invoke=0x7ffff76c7168 &lt;toplevel_initial_invoke&gt;, invoke_data=0x67ff10)
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 at src/core/interp.c:1169
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
501 1169 goto NEXT;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
502 $2 = 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 </code></pre>
96
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
504 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
505 <li>CbCMoarVMの場合は、 次に実行する命令名を確認する事が出来る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
506 </ul>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 <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
509 61 goto NEXT(i);
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 $1 = (void (*)(INTERP)) 0x7ffff7566f53 &lt;cbc_takeclosure&gt;
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 $2 = 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 <h2 id="moarvmのデバッグ">MoarVMのデバッグ</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 <li>cur_opのみをPerlスクリプトなどを用いて抜き出し, 並列にログを取得したオリジナルと差分を図る</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 <li>この際に差異が発生したバイトコードを確認し, その前の状態で確認していく</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 <pre><code>25 : 25 : cbc_unless_i
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 247 : 247 : cbc_null
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 54 : 54 : cbc_return_o
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 140 : 140 : cbc_checkarity
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 558 : 558 : cbc_paramnamesused
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 159 : 159 : cbc_getcode
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 391 : 391 : cbc_decont
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 127 : 127 : cbc_prepargs
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 *139 : 162
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 cbc_invoke_o:cbc_takeclosure
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 </code></pre>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 <div class='slide'>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 <!-- _S9SLIDE_ -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 <h2 id="現在のcbcmoarvm">現在のCbCMoarVM</h2>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 <ul>
95
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
548 <li>現在はNQP, Rakudoのセルフビルドが達成でき, オリジナルと同等のテスト達成率を持っている
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
549 <ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
550 <li>その為、 NQP, Rakudoの実行コマンドであるnqp perl6が起動する様になった</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
551 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
552 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
553 <li>moarの起動時のオプションとして <code>--cbc</code> を与えることによりCbCかオリジナルを選択可能である</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
554 <li>Perl6の実行バイナリperl6, NQPの実行バイナリnqp は, それぞれmoarを起動するシェルスクリプトである</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 94
diff changeset
555 <li><code>--cbc</code> オプションをシェルスクリプト内に書き加えることで, Perl6, NQPがそれぞれCbCで起動する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
557
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
558 <pre><code>#!/bin/sh
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 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
560 --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
561 /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
562 </code></pre>
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>
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
609 <td style="border: 2px solid #595959;"></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
610 <td style="border: 2px solid #595959;"></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
611 <td style="border: 2px solid #595959;"></td>
104
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>
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
675 <td style="border: 2px solid #595959;"></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
676 <td style="border: 2px solid #595959;"></td>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
677 <td style="border: 2px solid #595959;"></td>
102
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>
105
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
740 <li>CodeGearによって, 本来はモジュール化出来ない箇所をモジュール化が可能となった</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
741 <li>デバッグが通常のディスパッチと比較して安易になった</li>
102
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
742 <li>CPUキャッシュに収まるループなどの命令の場合は、 通常のMoarVMよりも高速に動作する</li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
743 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
744 </li>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 100
diff changeset
745 <li>今後はCodeGearの特性を活用し、 直接次の命令を実行する処理を実装する</li>
81
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 </ul>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
747
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 </div>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 </div><!-- presentation -->
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752 </body>
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 </html>