# HG changeset patch # User mir3636 # Date 1492760819 -32400 # Node ID 00f95e081a85093ac61ddab09b929ebdf0b876ac # Parent 846e85189f3380bc8ba7b95c4bcad84d18ee0078 add diff -r 846e85189f33 -r 00f95e081a85 paper/pic/codesegment.pdf Binary file paper/pic/codesegment.pdf has changed diff -r 846e85189f33 -r 00f95e081a85 paper/pic/gears_structure.pdf Binary file paper/pic/gears_structure.pdf has changed diff -r 846e85189f33 -r 00f95e081a85 paper/pic/gearsos.pdf Binary file paper/pic/gearsos.pdf has changed diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.aux --- a/paper/sigos.aux Thu Apr 20 20:52:25 2017 +0900 +++ b/paper/sigos.aux Fri Apr 21 16:46:59 2017 +0900 @@ -1,22 +1,28 @@ \relax -\newlabel{fig:cs}{{1}{1}} +\citation{cbc} +\citation{gears} +\newlabel{fig:cs}{{1}{2}} \newlabel{fig:gearsos}{{2}{2}} -\newlabel{src:interface}{{1}{2}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}interface}{2}} -\newlabel{gearef1}{{2}{2}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}Gearef1}{2}} -\newlabel{gearef2}{{3}{2}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Gearef2}{2}} -\newlabel{src:stack_c}{{4}{3}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}stub}{3}} -\newlabel{src:context}{{5}{3}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}context}{3}} +\newlabel{excbc}{{1}{2}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}cbccode}{2}} +\newlabel{interface}{{2}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}interface}{3}} +\newlabel{gearef1}{{3}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Gearef1}{3}} +\newlabel{gearef2}{{4}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}Gearef2}{3}} +\newlabel{stack_cbc}{{5}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}exampleCG}{3}} +\newlabel{stack_c}{{6}{3}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}stub}{3}} +\newlabel{context}{{7}{4}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {7}context}{4}} +\newlabel{init_context}{{8}{4}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {8}initcontext}{4}} \citation{*} \bibstyle{ipsjunsrt} \bibdata{sigos} -\bibcite{segment}{1} -\bibcite{gears}{2} +\bibcite{gears}{1} +\bibcite{segment}{2} \bibcite{cbc-lola}{3} -\newlabel{src:init_context}{{6}{4}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}initcontext}{4}} -\gdef\ipsj@lastpage{4} +\gdef\ipsj@lastpage{5} diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.bbl --- a/paper/sigos.bbl Thu Apr 20 20:52:25 2017 +0900 +++ b/paper/sigos.bbl Fri Apr 21 16:46:59 2017 +0900 @@ -1,14 +1,14 @@ \begin{thebibliography}{1} -\bibitem{segment} -河野真治,杉本 優\:Code Segment と Data Segment - によるプログラミング手法,第54回プログラミング・シンポジウム (2013). - \bibitem{gears} 小久保翔平,伊波立樹,河野真治\:Monad に基づくメタ計算を基本とする Gears OS の設計,情報処理学会システムソフトウェアとオペレーティング・システム研究会(OS) (2015). +\bibitem{segment} +河野真治,杉本 優\:Code Segment と Data Segment + によるプログラミング手法,第54回プログラミング・シンポジウム (2013). + \bibitem{cbc-lola} TOKKMORI, K. and KONO, S.: Implementing Continuation based language in LLVM and Clang, {\em LOLA 2015} (2015). diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.blg --- a/paper/sigos.blg Thu Apr 20 20:52:25 2017 +0900 +++ b/paper/sigos.blg Fri Apr 21 16:46:59 2017 +0900 @@ -3,15 +3,16 @@ The top-level auxiliary file: sigos.aux The style file: ipsjunsrt.bst Database file #1: sigos.bib +Warning--I didn't find a database entry for "cbc" +Warning--there's no number and/or volumegears +Warning--Missing required argument pages in gears Warning--there's no number and/or volumesegment Warning--Missing required argument pages in segment -Warning--there's no number and/or volumegears -Warning--Missing required argument pages in gears Warning--there's no number and/or volumecbc-lola Warning--Missing required argument pages in cbc-lola You've used 3 entries, 2207 wiz_defined-function locations, - 546 strings with 4497 characters, + 547 strings with 4500 characters, and the built_in function-call counts, 580 in all, are: = -- 30 > -- 29 @@ -51,4 +52,4 @@ width$ -- 4 write$ -- 23 is.kanji.str$ -- 20 -(There were 6 warnings) +(There were 7 warnings) diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.dvi Binary file paper/sigos.dvi has changed diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.log --- a/paper/sigos.log Thu Apr 20 20:52:25 2017 +0900 +++ b/paper/sigos.log Fri Apr 21 16:46:59 2017 +0900 @@ -1,4 +1,4 @@ -This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4) 19 APR 2017 22:11 +This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4) 21 APR 2017 14:53 entering extended mode restricted \write18 enabled. %&-line parsing enabled. @@ -186,70 +186,76 @@ (Font) Font shape `JY1/gt/m/n' tried instead on input line 87. LaTeX Font Info: External font `cmex10' loaded for size (Font) <7> on input line 87. +LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <6> not available +(Font) Font shape `JT1/gt/m/n' tried instead on input line 113. +LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <6> not available +(Font) Font shape `JY1/gt/m/n' tried instead on input line 113. + + +LaTeX Warning: Citation `cbc' on page 1 undefined on input line 113. + File: ./pic/codesegment.pdf Graphic file (type pdf) - <./pic/codesegment.pdf> +<./pic/codesegment.pdf> LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <7> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 110. +(Font) Font shape `JT1/gt/m/n' tried instead on input line 137. LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <7> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 110. +(Font) Font shape `JY1/gt/m/n' tried instead on input line 137. [1 ] File: ./pic/gears_structure.pdf Graphic file (type pdf) - -<./pic/gears_structure.pdf> + <./pic/gears_structure.pdf> LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <7> not available -(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 175. +(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 199. -Overfull \hbox (71.64214pt too wide) in paragraph at lines 175--175 +Overfull \hbox (69.04842pt too wide) in paragraph at lines 199--199 +[]\OT1/cmr/m/n/9 cbccode + [] + +[2] +Overfull \hbox (71.64214pt too wide) in paragraph at lines 233--233 []\OT1/cmr/m/n/9 interface [] -Overfull \hbox (68.36577pt too wide) in paragraph at lines 186--186 +Overfull \hbox (68.36577pt too wide) in paragraph at lines 249--249 []\OT1/cmr/m/n/9 Gearef1 [] -[2] -Overfull \hbox (68.36577pt too wide) in paragraph at lines 187--187 + +Overfull \hbox (68.36577pt too wide) in paragraph at lines 250--250 []\OT1/cmr/m/n/9 Gearef2 [] -LaTeX Font Info: Font shape `JT1/mc/bx/n' in size <9> not available -(Font) Font shape `JT1/gt/m/n' tried instead on input line 208. -LaTeX Font Info: Font shape `JY1/mc/bx/n' in size <9> not available -(Font) Font shape `JY1/gt/m/n' tried instead on input line 208. -LaTeX Warning: Reference `stack_c' on page 3 undefined on input line 208. - - -Overfull \hbox (54.70755pt too wide) in paragraph at lines 210--210 -[]\OT1/cmr/m/n/9 stub +Overfull \hbox (84.27539pt too wide) in paragraph at lines 273--273 +[]\OT1/cmr/m/n/9 exampleCG [] [3] -Overfull \hbox (66.99287pt too wide) in paragraph at lines 216--216 +Overfull \hbox (54.70755pt too wide) in paragraph at lines 274--274 +[]\OT1/cmr/m/n/9 stub + [] + + +Overfull \hbox (66.99287pt too wide) in paragraph at lines 280--280 []\OT1/cmr/m/n/9 context [] - -Overfull \hbox (80.86778pt too wide) in paragraph at lines 232--232 +[4] +Overfull \hbox (80.86778pt too wide) in paragraph at lines 296--296 []\OT1/cmr/m/n/9 initcontext [] -(./sigos.bbl) [4] (./sigos.aux) - -LaTeX Warning: There were undefined references. - - ) +(./sigos.bbl) [5] (./sigos.aux) ) Here is how much of TeX's memory you used: - 3171 strings out of 493683 - 43607 string characters out of 6149654 - 311711 words of memory out of 5000000 - 6729 multiletter control sequences out of 15000+600000 - 17521 words of font info for 68 fonts, out of 8000000 for 9000 + 3187 strings out of 493683 + 43727 string characters out of 6149654 + 372711 words of memory out of 5000000 + 6739 multiletter control sequences out of 15000+600000 + 18451 words of font info for 72 fonts, out of 8000000 for 9000 929 hyphenation exceptions out of 8191 - 30i,10n,49p,213b,1569s stack positions out of 5000i,500n,10000p,200000b,80000s + 30i,10n,49p,213b,1567s stack positions out of 5000i,500n,10000p,200000b,80000s -Output written on sigos.dvi (4 pages, 40964 bytes). +Output written on sigos.dvi (5 pages, 47052 bytes). diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.pdf Binary file paper/sigos.pdf has changed diff -r 846e85189f33 -r 00f95e081a85 paper/sigos.tex --- a/paper/sigos.tex Thu Apr 20 20:52:25 2017 +0900 +++ b/paper/sigos.tex Fri Apr 21 16:46:59 2017 +0900 @@ -97,6 +97,27 @@ % これをアセンブラにしていろいろなアプリケーションを作る % きょだいなCDGの上で動かすと既存のアプリケーションを動かすことができる +\section{メタ計算の重要性} + +プログラムを記述する際、ノーマルレベルの処理の他に、メモリ管理、スレッド管理、CPU や GPU の資源管理等、記述しなければならない処理が存在する。 +これらの計算をメタ計算と呼ぶ。 + +メタ計算を通常の計算から切り離して記述するためには処理を細かく分割する必要がある。しかし、関数やクラスなどの単位は容易に分割できない。 + +そこで当研究室ではメタ計算を柔軟に記述するためのプログラミング言語の単位として Code Gear、Data Gear という単位を提案している。 + +Code Gear は処理の単位である。 +関数に比べて細かく分割されているのでメタ計算をより柔軟に記述できる。 +Code Gear、Data Gear にはそれぞれメタレベルの単位である Meta Code Gear、Meta Data Gear が存在し、これらを用いてメタ計算を実現する。 + +Continuation based C (CbC)\cite{cbc} はこの Code Gear 単位を用いたプログラミング言語として開発している。 + +CbCは軽量継続による遷移を行うので、継続前の Code Gear に戻ることはなく、状態遷移ベースのプログラミングに適している。 + +また、当研究室で開発している Gears OS\cite{gears} は Code Gear、 Data Gear の単位を用いて開発されており、CbC で記述されている。 + +本研究では CbC を用いての Gears OS の実装と Gears OS におけるメタ計算の自動生成を行なう。 + \section{Continuation based C (CbC)} CbC は Code Gear という処理の単位を用いて記述するプログラミング言語である。 Code Gear は CbC における最も基本的な処理単位である。 @@ -167,23 +188,36 @@ Gears OS における Task Queue は Synchronized Queue で実現される。 Worker は TaskQueue から Task である Context を取得し、 Input/Output Data Gear の依存関係が解決されたものから並列実行される。 + + +\section{cbc のコードの例} + +リスト\ref{excbc}は CbC で記述された stack のコードの一部である。 +Code Gear は \_\_code Code Gear で始まり、次の Code Gear へ goto で遷移する。 + +%,,,の説明 +%codegearの説明もっとする? + +\lstinputlisting[label=excbc, caption=cbccode]{./src/ex_stack.cbc} + +これがユーザーレベルでの Code Gear の記述である。 \section{CbC による Gears OS 記述の問題} +%メタの話 Gears OS を CbC で実装する上でメタ計算の記述が煩雑であることがわかった。 これらのメタ計算を自動生成することにより Gears OS を記述する上においてより良い構文をユーザーに提供することにした。 -最初にインターフェースを使う使用例を書く \section{interface の記述} % union data はジェネラルなデータセグメントこれには % goto のひきすうとしてつかう フレームを表している -関数呼び出しのabi -ひきすうで呼び出されるcg ひきすうはぜんぶ定義されていなければならない -メタデータセグメント -名前付きの変数が現れる -書き込みは**読み込みは* -いんたーふぇーすなので実装がいる +%関数呼び出しのabi +%ひきすうで呼び出されるcg ひきすうはぜんぶ定義されていなければならない +%メタデータセグメント +%名前付きの変数が現れる +%書き込みは**読み込みは* +%いんたーふぇーすなので実装がいる @@ -197,7 +231,7 @@ %create は関数呼び出しで呼び出され、interface と impliment の初期化と Code Gear のポインタの設定を行う。 %return で interface を返し、その先で Code Gear や Data Gear へ継続できるようになる。 -\lstinputlisting[label=src:interface, caption=interface]{./src/Stack.cbc} +\lstinputlisting[label=interface, caption=interface]{./src/Stack.cbc} \section{Gearef、GearImpl} @@ -233,23 +267,24 @@ stub を生成するために generate\_stub は指定された cbc ファイルの \_\_code型である Code Gear を取得し、引数から必要な Data Gear を選択する。 generate\_stub は引数と interface を照らし合わせ、Gearef または GearImpl を決定する。 -この時既に stub Code Gear が記述されている Code Gear は無視される。 +また、この時既に stub Code Gear が記述されている Code Gear は無視される。 cbc ファイルから、生成した stub Code Gear を加えて stub を加えたコードに変換を行う。(\ref{stack_c}) -\lstinputlisting[label=src:stack_c, caption=stub]{./src/ex_stub} +\lstinputlisting[label=stack_cbc, caption=exampleCG]{./src/ex_cbc} +\lstinputlisting[label=stack_c, caption=stub]{./src/ex_stub} \section{Context の生成} Context は Meta Data Gear に相当し、Code Gear や Data Gear を管理している。 -Data Gear を取得するために generate context は context の定義を読み宣言されている Data Gear を取得する。 +Data Gear を取得するために generate context は context の定義 (リスト\ref{context}) を読み宣言されている Data Gear を取得する。 -\lstinputlisting[label=src:context, caption=context]{./src/context1.c} +\lstinputlisting[label=context, caption=context]{./src/context1.c} -Code Gear の取得は指定された stub を加えたコードから \_\_code 型を見て行う。 -取得した Code/Data Gear の enum の定義は enumCode.h、enumData.h に生成される。 +Code Gear の取得は指定された generate\_stub で生成されたコードから \_\_code 型を見て行う。 +取得した Code Gear、Data Gear の enum の定義は enumCode.h、enumData.h に生成される。 Code/Data Gear の名前とポインタの対応は generate\_context によって生成される enum Code、enum Data を指定することで接続を行う。 -また、generate context は取得した Code/Data Gear から Context の生成を行うコードも生成する。 +また、generate context は取得した Code/Data Gear から Context の生成を行うコード (リスト\ref{init_context}) も生成する。 Context には Allocation 等で生成した Data Gear へのポインタが格納されている。 Code Gear は Context を通して Data Gear へアクセスする。 @@ -259,7 +294,7 @@ Context には Data Gear の Data Type の情報が格納されている。 この情報から確保される Data Gear のサイズなどを決定する。 -\lstinputlisting[label=src:init_context, caption=initcontext]{./src/context2.c} +\lstinputlisting[label=init_context, caption=initcontext]{./src/context2.c} \section{今後の課題} 本研究では LLVM/Clang のデバッグ、interface の記述、CbC ファイルから Gears OS の記述に必要な Context と stub の生成を行う perl スクリプトの生成を行なった。