# HG changeset patch # User Tatsuki IHA # Date 1517076294 -32400 # Node ID cea271f8aa67c968d76cdba637e32d9c4956e3d4 # Parent d7797b811a41ae7527299367c12b44ceea78be38 Add interface chapter diff -r d7797b811a41 -r cea271f8aa67 paper/interface.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/interface.tex Sun Jan 28 03:04:54 2018 +0900 @@ -0,0 +1,20 @@ +% Todo +% interface の前には何か軽い説明が必要 +% interface 用の章を作る + % なぜ, interface が必要になったのか? + % Code と Data が全てフラットに展開すると, 記述が煩雑になるので モジュール化して扱いたい + % java の interface のようなものがほしい + % どうしてもグローバルな Data Gear にアクセスしたくなっちゃう + % ここでいうグローバルな変数は Context + % interface は Data Gear + % interface を使うことで Gear OS のモジュール化ができるようになった + % interface は Meta Data Gear で、 引数の Data Gear 群, Code Gear の引数のパターンの集合, Code Gear の引数のパターンは全部 interface に記述されている必要がある。 + % interface 内部の Code Gearは 自由に 引数の Data Gear, 実装のData Gear にアクセス出来る。 + % inteface の実装の際は Code Gear に代入して書く + % C++ で言うとCode Gearは virtual + +\chapter{Interface} +\section{Context を経由しての継続の問題点} +\section{Interface の定義} +\section{Interface の実装} +\section{Interface を利用した Code Gear の継続} diff -r d7797b811a41 -r cea271f8aa67 paper/master_paper.pdf Binary file paper/master_paper.pdf has changed diff -r d7797b811a41 -r cea271f8aa67 paper/master_paper.tex --- a/paper/master_paper.tex Sat Jan 27 18:23:17 2018 +0900 +++ b/paper/master_paper.tex Sun Jan 28 03:04:54 2018 +0900 @@ -1,18 +1,4 @@ % Todo -% interface の前には何か軽い説明が必要 -% interface 用の章を作る - % なぜ, interface が必要になったのか? - % Code と Data が全てフラットに展開すると, 記述が煩雑になるので モジュール化して扱いたい - % java の interface のようなものがほしい - % どうしてもグローバルな Data Gear にアクセスしたくなっちゃう - % ここでいうグローバルな変数は Context - % interface は Data Gear - % interface を使うことで Gear OS のモジュール化ができるようになった - % interface は Meta Data Gear で、 引数の Data Gear 群, Code Gear の引数のパターンの集合, Code Gear の引数のパターンは全部 interface に記述されている必要がある。 - % interface 内部の Code Gearは 自由に 引数の Data Gear, 実装のData Gear にアクセス出来る。 - % inteface の実装の際は Code Gear に代入して書く - % C++ で言うと全部 virtual - \documentclass[a4j,12pt]{jreport} \usepackage{master_paper} \usepackage{ascmac} @@ -108,6 +94,7 @@ %chapters \input{introduction.tex} \input{gearsOS.tex} +\input{interface.tex} \input{parallelism_gears.tex} \input{gpu.tex} \input{evaluation.tex} diff -r d7797b811a41 -r cea271f8aa67 paper/src/codeGearExample.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/src/codeGearExample.cbc Sun Jan 28 03:04:54 2018 +0900 @@ -0,0 +1,5 @@ +__code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { + output->value = input1->value + input2->value; + printf("%d + %d = %d\n", input1->value, input2->value, output->value); + goto next(output, ...); +} diff -r d7797b811a41 -r cea271f8aa67 paper/src/metaCreateTask.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/src/metaCreateTask.cbc Sun Jan 28 03:04:54 2018 +0900 @@ -0,0 +1,42 @@ +__code code1(struct Context *context, Integer *integer1, Integer *integer2, Integer *output) { + // create context + context->task = NEW(struct Context); + initContext(context->task); + + // set task parameter + context->task->next = C_add; + context->task->idgCount = 2; + context->task->idg = context->task->dataNum; + context->task->maxIdg = context->task->idg + 2; + context->task->odg = context->task->maxIdg; + context->task->maxOdg = context->task->odg + 1; + + // create Data Gear Queue + GET_META(integer1)->wait = createSynchronizedQueue(context); + GET_META(integer2)->wait = createSynchronizedQueue(context); + GET_META(integer3)->wait = createSynchronizedQueue(context); + + // set Input Data Gear + context->task->data[context->task->idg+0] = (union Data*)integer1; + context->task->data[context->task->idg+1] = (union Data*)integer2; + + // set Output Data Gear + context->task->data[context->task->odg+0] = (union Data*)integer3; + + // add taskList Element + struct Element* element; + element = &ALLOCATE(context, Element)->Element; + element->data = (union Data*)context->task; + element->next = context->taskList; + context->taskList = element; + + // set TaskManager->spawns parameter + Gearef(context, TaskManager)->taskList = context->taskList; + Gearef(context, TaskManager)->next1 = C_createTask1; + goto meta(context, C_code2); +} + +// code gear +__code add(Integer *integer1, Integer *integer2, next(Integer *output, ...)) { + .... +} diff -r d7797b811a41 -r cea271f8aa67 paper/src/parGotoCreateTask.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/src/parGotoCreateTask.cbc Sun Jan 28 03:04:54 2018 +0900 @@ -0,0 +1,4 @@ +__code createTask(Integer *integer1, Integer * integer2, Integer *output, __code next(...)) { + par goto add(integer1, integer2, output, __exit); + goto next(...); +}