# HG changeset patch # User mir3636 # Date 1511526185 -32400 # Node ID 845b7c1fb066cdfce1c56abbade65702435732c0 # Parent e9b59ddf626dcf9ad7c3b042e49b66ec24b817f0 fix diff -r e9b59ddf626d -r 845b7c1fb066 Paper/main.tex --- a/Paper/main.tex Fri Nov 24 19:36:53 2017 +0900 +++ b/Paper/main.tex Fri Nov 24 21:23:05 2017 +0900 @@ -184,8 +184,10 @@ Gears OS には Context と呼ばれる接続可能な Code Gear、Data Gear のリスト、Temporal Data Gear のためのメモリ空間等を持っている Meta Data Gear を持つ。 Gears OS は必要な Code Gear、Data Gear に参照したい場合、この Context を通す必要がある。 +Code\ref{context} は Context の定義で Code\ref{initcontext} は Context の生成である。 \lstinputlisting[label=context, caption=Context]{./src/context1.c} +\lstinputlisting[label=initcontext, caption=initContext]{./src/initcontext.c} Data Gear は union と struct によって表現される。 Context には Data Gear の Data Type の情報が格納されている。 @@ -204,7 +206,7 @@ %...の説明 %codegearの説明もっとする? -\lstinputlisting[label=excbc, caption=excs.cbc]{./src/excbc.cbc} +\lstinputlisting[label=excbc, caption=exStack]{./src/ex_stack.cbc} \section{interface と impliment} interface は呼び出しの引数になる Data Gear の集合であり、そこで呼び出される Code Gear のエントリである。 @@ -289,7 +291,7 @@ Context には Data Gear の Data Type の情報が格納されている。 この情報から確保される Data Gear のサイズなどを決定する。 -\lstinputlisting[label=init_context, caption=initContext]{./src/context2.c} +\lstinputlisting[label=init_context, caption=initContext]{./src/gencontext.c} \section{今後の課題} 本研究では LLVM/Clang のデバッグ、interface の記述、CbC ファイルから Gears OS の記述に必要な Context と stub の生成を行う Perl スクリプトの生成を行なった。 diff -r e9b59ddf626d -r 845b7c1fb066 Paper/prosym.bib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/prosym.bib Fri Nov 24 21:23:05 2017 +0900 @@ -0,0 +1,24 @@ +@article{ + gears, + author = "河野 真治 and 伊波 立樹 and 東恩納 琢偉", + title = "Code Gear、Data Gear に基づく OS のプロトタイプ", + journal = "情報処理学会システムソフトウェアとオペレーティング・システム研究会(OS)", + month = "May", + year = 2016 +} + +@article{ + cbc, + author = "Kaito TOKKMORI and Shinji KONO", + title = "Implementing Continuation based language in LLVM and Clang", + journal = "LOLA 2015", + month = "July", + year = 2015 +} + +@article{ + llvm, + title = "LLVM documentation.", + howpublished = "{http://llvm.org/docs/index.html}" +} + diff -r e9b59ddf626d -r 845b7c1fb066 Paper/src/context1.c --- a/Paper/src/context1.c Fri Nov 24 19:36:53 2017 +0900 +++ b/Paper/src/context1.c Fri Nov 24 21:23:05 2017 +0900 @@ -1,3 +1,12 @@ +enum Code { + C_cs1, + C_cs2, +}; +enum DataType { + D_Meta, + D_TaskManager, + ... +}; struct Context { enum Code next; struct Worker* worker; @@ -19,7 +28,6 @@ struct Queue* tasks; union Data **data; }; - union Data { struct Meta { enum DataType type; @@ -31,11 +39,5 @@ struct Queue* dataGears; int idsCount; } Task; - ... - - struct Element { - union Data* data; - struct Element* next; - } Element; }; diff -r e9b59ddf626d -r 845b7c1fb066 Paper/src/context2.c --- a/Paper/src/context2.c Fri Nov 24 19:36:53 2017 +0900 +++ b/Paper/src/context2.c Fri Nov 24 21:23:05 2017 +0900 @@ -16,27 +16,22 @@ #include "dataGearInit.c" } - __code meta(struct Context* context, enum Code next) { // printf("meta %d\n",next); goto (context->code[next])(context); } - __code start_code(struct Context* context) { goto meta(context, context->next); } - __code start_code_stub(struct Context* context) { goto start_code(context); } - __code exit_code(struct Context* context) { free(context->code); free(context->data); free(context->heapStart); goto exit(0); } - __code exit_code_stub(struct Context* context) { goto exit_code(context); } diff -r e9b59ddf626d -r 845b7c1fb066 Paper/src/gencontext.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/gencontext.c Fri Nov 24 21:23:05 2017 +0900 @@ -0,0 +1,34 @@ +#include +#include "../context.h" +void initContext(struct Context* context) { + context->heapLimit = sizeof(union Data)* ALLOCATE_SIZE; + context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*); + context->data = NEWN(ALLOCATE_SIZE, union Data*); + context->heapStart = NEWN(context->heapLimit, char); + context->heap = context->heapStart; + context->code[C_cs1] = cs1_stub; + context->code[C_cs2] = cs2_stub; + context->code[C_exit_code] = exit_code_stub; + context->code[C_start_code] = start_code_stub; +#include "dataGearInit.c" +} +__code meta(struct Context* context, enum Code next) { + // printf("meta %d\n",next); + goto (context->code[next])(context); +} +__code start_code(struct Context* context) { + goto meta(context, context->next); +} +__code start_code_stub(struct Context* + context) { + goto start_code(context); +} +__code exit_code(struct Context* context) { + free(context->code); + free(context->data); + free(context->heapStart); + goto exit(0); +} +__code exit_code_stub(struct Context* context ){ + goto exit_code(context); +} diff -r e9b59ddf626d -r 845b7c1fb066 Paper/src/initcontext.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/initcontext.c Fri Nov 24 21:23:05 2017 +0900 @@ -0,0 +1,15 @@ +void initContext(struct Context* context) { + context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; + context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*); + context->data = NEWN(ALLOCATE_SIZE, union Data*); + context->heapStart = NEWN(context->heapLimit, char); + context->heap = context->heapStart; + + context->code[C_cs1] = cs1_stub; + context->code[C_cs2] = cs2_stub; + context->code[C_exit_code] = exit_code_stub; + context->code[C_start_code] = start_code_stub; + + ALLOC_DATA(context, Context); + ... +}