# HG changeset patch # User e165727 # Date 1572936394 -32400 # Node ID 1923d7d994335cd70b4df81e1ab2107bebd4e7ae # Parent 5e53003f8f1f516ef76dcb70b1e7cfd9032848d3 add mindmap diff -r 5e53003f8f1f -r 1923d7d99433 .DS_Store Binary file .DS_Store has changed diff -r 5e53003f8f1f -r 1923d7d99433 Paper/.DS_Store Binary file Paper/.DS_Store has changed diff -r 5e53003f8f1f -r 1923d7d99433 Paper/koo.aux --- a/Paper/koo.aux Fri Nov 01 15:14:53 2019 +0900 +++ b/Paper/koo.aux Tue Nov 05 15:46:34 2019 +0900 @@ -5,10 +5,14 @@ \@writefile{toc}{\contentsline {subsection}{\numberline {2.1}{Rakuの構想}}{1}} \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} \newlabel{fig:perl6cbcinter}{{1}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {3}\hskip 1zw{MoarVM}}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {4}\hskip 1zw{NQP}}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {5}\hskip 1zw{なぜRakuは遅いのか}}{2}} -\@writefile{toc}{\contentsline {section}{\numberline {6}\hskip 1zw{Abyssサーバー}}{2}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}{MoarVM}}{2}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}{NQP}}{2}} +\newlabel{fig:nqpbuild}{{2}{3}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}{なぜRakuは遅いのか}}{3}} +\@writefile{toc}{\contentsline {section}{\numberline {3}\hskip 1zw{Abyssサーバー}}{3}} +\newlabel{fig:perl6cbcinter}{{3}{3}} +\newlabel{codeseg}{{1}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}Abyssサーバーのsource code}{3}} \bibcite{キー1}{1} \bibcite{キー2}{2} \bibcite{キー3}{3} @@ -16,10 +20,7 @@ \citation{*} \bibstyle{ipsjsort} \bibdata{reference} -\newlabel{fig:perl6cbcinter}{{2}{3}} -\newlabel{codeseg}{{1}{3}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}Abyssサーバーのsource code}{3}} -\newlabel{codeseg}{{2}{3}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}クライアント側のsource code}{3}} -\@writefile{toc}{\contentsline {section}{\numberline {7}\hskip 1zw{まとめ}}{3}} -\newlabel{ipsj@lastpage}{{}{3}} +\newlabel{codeseg}{{2}{4}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}クライアント側のsource code}{4}} +\@writefile{toc}{\contentsline {section}{\numberline {4}\hskip 1zw{まとめ}}{4}} +\newlabel{ipsj@lastpage}{{}{4}} diff -r 5e53003f8f1f -r 1923d7d99433 Paper/koo.log --- a/Paper/koo.log Fri Nov 01 15:14:53 2019 +0900 +++ b/Paper/koo.log Tue Nov 05 15:46:34 2019 +0900 @@ -1,4 +1,4 @@ -This is e-pTeX, Version 3.14159265-p3.6-141210-2.6 (utf8.euc) (TeX Live 2015) (preloaded format=platex 2016.4.14) 1 NOV 2019 14:58 +This is e-pTeX, Version 3.14159265-p3.6-141210-2.6 (utf8.euc) (TeX Live 2015) (preloaded format=platex 2016.4.14) 5 NOV 2019 15:42 entering extended mode restricted \write18 enabled. file:line:error style messages enabled. @@ -253,59 +253,61 @@ (Font) Font shape `JT1/gt/m/n' tried instead on input line 48. LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <8.8711> not available (Font) Font shape `JY1/gt/m/n' tried instead on input line 48. -Excluding 'comment' comment. LaTeX Font Info: Font shape `JT1/gt/bx/n' in size <19.2207> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 70. +(Font) Font shape `JT1/gt/m/n' tried instead on input line 68. LaTeX Font Info: Font shape `JY1/gt/bx/n' in size <19.2207> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 70. -LaTeX Font Info: Calculating math sizes for size <9.61035> on input line 70. +(Font) Font shape `JY1/gt/m/n' tried instead on input line 68. +LaTeX Font Info: Calculating math sizes for size <9.61035> on input line 68. -LaTeX Font Info: Calculating math sizes for size <11.82813> on input line 70 +LaTeX Font Info: Calculating math sizes for size <11.82813> on input line 68 . -LaTeX Font Info: Calculating math sizes for size <8.13184> on input line 70. +LaTeX Font Info: Calculating math sizes for size <8.13184> on input line 68. LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <11.82813> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 73. +(Font) Font shape `JT1/gt/m/n' tried instead on input line 71. LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <11.82813> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 73. +(Font) Font shape `JY1/gt/m/n' tried instead on input line 71. LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <9.61035> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 84. +(Font) Font shape `JT1/gt/m/n' tried instead on input line 82. LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <9.61035> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 84. - [1 +(Font) Font shape `JY1/gt/m/n' tried instead on input line 82. +[1 ] File: images/Rakudo.pdf Graphic file (type pdf) - + Excluding 'comment' comment. +Excluding 'comment' comment. [2] +File: fig/tgraph.pdf Graphic file (type pdf) + File: images/abyss.pdf Graphic file (type pdf) -Overfull \hbox (21.64644pt too wide) in paragraph at lines 137--138 +Overfull \hbox (21.64644pt too wide) in paragraph at lines 181--182 [] [] -[2] (./code/abyss.p6 +(./code/abyss.p6 [3] Overfull \hbox (4.58815pt too wide) in paragraph at lines 6--7 [][] [] ) (./code/client.p6) -LaTeX Font Info: Calculating math sizes for size <8.8711> on input line 169. +LaTeX Font Info: Calculating math sizes for size <8.8711> on input line 213. No file koo.bbl. -[3] (./koo.aux) +[4] (./koo.aux) LaTeX Warning: There were multiply-defined labels. ) Here is how much of TeX's memory you used: - 4098 strings out of 493777 - 61755 string characters out of 6151334 - 207664 words of memory out of 5000000 - 7560 multiletter control sequences out of 15000+600000 + 4103 strings out of 493777 + 61817 string characters out of 6151334 + 218664 words of memory out of 5000000 + 7562 multiletter control sequences out of 15000+600000 28364 words of font info for 125 fonts, out of 8000000 for 9000 929 hyphenation exceptions out of 8191 - 36i,7n,49p,590b,1450s stack positions out of 5000i,500n,10000p,200000b,80000s + 36i,7n,49p,590b,1657s stack positions out of 5000i,500n,10000p,200000b,80000s -Output written on koo.dvi (3 pages, 18524 bytes). +Output written on koo.dvi (4 pages, 23220 bytes). diff -r 5e53003f8f1f -r 1923d7d99433 Paper/koo.pdf Binary file Paper/koo.pdf has changed diff -r 5e53003f8f1f -r 1923d7d99433 Paper/koo.synctex.gz Binary file Paper/koo.synctex.gz has changed diff -r 5e53003f8f1f -r 1923d7d99433 Paper/koo.tex --- a/Paper/koo.tex Fri Nov 01 15:14:53 2019 +0900 +++ b/Paper/koo.tex Tue Nov 05 15:46:34 2019 +0900 @@ -47,7 +47,6 @@ %概要 \begin{abstract} -\begin{comment} スクリプト言語であるPerl5の後継言語としてPerl6が現在開発されている. Perl6は設計と実装が区分されており様々な処理系が開発されている. 現在主流なPerl6はRakudoと言われるプロジェクトである. @@ -58,7 +57,6 @@ CbCはCよりも細かな単位で記述が可能である為, 言語処理系の実装に適していると考えられる. CbCに関する今までの研究においては, 言語処理系にCbCを利用した事例が少ない. その為, 本稿ではCbCを言語処理系に用いた場合の利点やデバッグ手法などについても述べる. -\end{comment} \end{abstract} @@ -106,10 +104,14 @@ \label{fig:perl6cbcinter} \end{figure} -\section{MoarVM} +\subsection{MoarVM} + +\begin{comment} MoarVM は Raku に特化した VM である.C言語で実装されている. JITコンパイルなどが現在導入されているが,起動時間などが低速である問題がある. MoarVM 独自の ByteCode があり, NQP からこれを出力する機能などが存在している. +\end{comment} -\section{NQP} +\subsection{NQP} +\begin{comment} NQPとはRakuのサブセットである. その為基本的な文法などはRakuに準拠しているが,変数を束縛で宣言するなどの違いが見られる. @@ -117,8 +119,50 @@ このMoarVMByteCodeの状態をStage0と言う. Rakuの一部はNQPを拡張したもので書かれている為,Rakudoを動作させる為にはMoarVMなどのVM,VMに対応させる様にビルドしたNQPがそれぞれ必要となる. NQPは与えられたStage0を使いStage1をビルドし,そのStage1を利用しStage2をビルドする事で生成できる. +\end{comment} -\section{なぜRakuは遅いのか} +RakudoにおけるNQPは現在MoarVM, JVM上で動作する. +NQPはPerl6のサブセットであるため, 主な文法などはPerl6に準拠しているが幾つか異なる点が存在する. +NQPは最終的にはNQP自身でブートストラップする言語であるが, ビルドの最初にはすでに書かれたMoarVMのバイトコードを必要とする. +このMoarVMのバイトコードの状態をStage0と言う.%い, バイトコードが付随するソースディレクトリ内のディレクトリ名として設定されている. +Perl6の一部はNQPを拡張したもので書かれている為, Rakudoを動作させる為にはMoarVMなどのVM, VMに対応させる様にビルドしたNQPがそれぞれ必要となる. +現在のNQPではMoarVM, JVMに対応するStage0はそれぞれMoarVMのバイトコード, jarファイルが用意されている. +MoarVMのModuleLoaderはStage0にあるMoarVMのバイトコードで書かれた一連のファイルが該当する. + + +Stage0にあるファイルをMoarVMに与えることで, NQPのインタプリタが実行される様になっている. +これはStage0の一連のファイルは, MoarVMのバイトコードなどで記述されたNQPコンパイラのモジュールである為である. +NQPのインタプリタはセルフビルドが完了すると, nqpというシェルスクリプトとして提供される. +このシェルスクリプトは, ライブラリパスなどを設定してMoarVMの実行バイナリであるmoarを起動するものである. +%NQPは6modelと呼ばれるオブジェクトモデルを採用としている.%が, これを構築する為に必要なNQPCORE,正規表現系のQRegex,MoarVMのModuleLoaderなどがMoarVMBytecodeで記述されている.これらMoarVMBytecodeの拡張子は.MoarVMである. +%MoarVMに対してStage0のディレクトリにライブラリパスを設定し, nqp.MoarVMを実行させることでnqpの対話型環境が起動する. + +\begin{figure}[ht] + \begin{center} + \includegraphics[width=70mm]{fig/tgraph.pdf} + \end{center} + \caption{NQPのビルドフロー} + \label{fig:nqpbuild} +\end{figure} + +NQPのビルドフローを図\ref{fig:nqpbuild}に示す. +RakudoによるPerl6に処理系はNQPにおけるnqpと同様に, moarにライブラリパスなどを設定したperl6というシェルスクリプトである. +このperl6を動かすためにはself buildしたNQPコンパイラが必要となる. +その為にStage0を利用してStage1をビルドしNQPコンパイラを作成する. +Stage1は中間的な出力であり, 生成されたNQPファイルはStage2と同一であるが, MoarVMのバイトコードが異なる. +Perl6では完全なセルフコンパイルを実行したNQPが要求される為, Stage1を利用してもう一度ビルドを行いStage2を作成する. + +Perl6のテストスイートであるRoastやドキュメントなどによって設計が定まっているPerl6とは異なりNQP自身の設計は今後も変更になる可能性が開発者から公表されている. +現在の公表されているNQPのオペコードはNQPのリポジトリに記述されているものである. + + +%\subsection{Rakudo Perl6} +%Rakudo実装上におけるPerl6はRakudo Perl6と呼ばれているGitリポジトリで管理されているプログラムのことである. +%前述した通りRakudo Perl6はPerl6のサブセットであるNQPを用いて記述されている. +%従ってyaccやlexと言ったPerl5の文字解析, 構文解析に利用していたプログラムは利用せず, NQP側で構文定義などを行っている. +%NQPはNQP自身でBootstrappingされている為, Rakudo Perl6のbuild時にはNQPの実行環境として要したVM, それに基づいてbuildしたNQPがそれぞれ必要となる. + +\subsection{なぜRakuは遅いのか} 通常Rubyのようなスクリプト言語ではまずrubyVMが起動し,その後スクリプトをByte code に変換して実行という手順を踏む. Rakudo はインタプリタの起動時間及び、 全体的な処理時間が他のスクリプト言語と比較して非常に低速である。 これはRakudo自体がRakuで書かれているため,MoarVMを起動し,RakudoとNQP をコンパイルし,その後スクリプトのByte code変換というような手順で進むためである。 diff -r 5e53003f8f1f -r 1923d7d99433 mindmap.png Binary file mindmap.png has changed