Mercurial > hg > Document > Growi
view user/anatofuz/note/2021/01/21.md @ 31:38ca0355d32c
backup 2021-01-24
author | autobackup |
---|---|
date | Sun, 24 Jan 2021 00:10:03 +0900 |
parents | 0bd2a99a349e |
children |
line wrap: on
line source
```shell $ rg '^#' examples/DPP2 | grep -v '<' | perl -nle 'print $1 if /"(\w+\.h)"/' | sort -n | uniq Atomic.h AtomicT.h Fork.h Phils.h TaskManager.h Worker.h ``` ```text +kajika+anatofuz$ perl generate_stub.pl --debug examples/DPP2/PhilsImpl.cbc [getDataGear] match 175 : #interface "Phils.h" [getDataGear] match 137 : typedef struct Phils <> { [getDataGear] match 338 : __code putdown_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code putdown_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code thinking(Impl* phils,, __code next(...)); [getDataGear] match 338 : __code pickup_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code pickup_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code eating(Impl* phils, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Phils; [getCodeGear] match 393 : typedef struct Phils <> { [getCodeGear] match 398 : __code putdown_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code putdown_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code thinking(Impl* phils,, __code next(...)); [getCodeGear] match 398 : __code pickup_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code pickup_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code eating(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "Fork.h" [getDataGear] match 137 : typedef struct Fork <> { [getDataGear] match 315 : union Data* fork; [getDataGear] match 315 : int id; [getDataGear] match 315 : struct Phils* owner; [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Fork; [getCodeGear] match 393 : typedef struct Fork <> { [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "Worker.h" [getDataGear] match 137 : typedef struct Worker<>{ [getDataGear] match 315 : union Data* worker; [getDataGear] match 315 : struct Queue* tasks; [getDataGear] match 315 : struct Context* task; [getDataGear] match 315 : pthread_t thread; [getDataGear] match 315 : struct TaskManager* taskManager; [getDataGear] match 338 : __code taskReceive(Impl* worker, struct Queue* tasks); [getDataGear] match 338 : __code shutdown(Impl* worker); [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Worker; [getCodeGear] match 393 : typedef struct Worker<>{ [getCodeGear] match 398 : __code taskReceive(Impl* worker, struct Queue* tasks); [getCodeGear] match 398 : __code shutdown(Impl* worker); [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "AtomicT_int.h" [getDataGear] match 137 : typedef struct AtomicT_int <>{ [getDataGear] match 338 : __code checkAndSet(Impl* atomic_t,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getDataGear] match 338 : __code set(Impl* atomic_t,int* ptr ,int newData, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code fail(...); [getDataGear] match 315 : } AtomicT_int; [getCodeGear] match 393 : typedef struct AtomicT_int <>{ [getCodeGear] match 398 : __code checkAndSet(Impl* atomic_t,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getCodeGear] match 398 : __code set(Impl* atomic_t,int* ptr ,int newData, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code fail(...); [getDataGear] match 175 : #interface "TaskManager.h" [getDataGear] match 137 : typedef struct TaskManager<>{ [getDataGear] match 338 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getDataGear] match 338 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getDataGear] match 338 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getDataGear] match 338 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code next1(...); [getDataGear] match 315 : } TaskManager; [getCodeGear] match 393 : typedef struct TaskManager<>{ [getCodeGear] match 398 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getCodeGear] match 398 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code next1(...); [getDataGear] match 153 : Phils* createPhilsImpl(struct Context* context, int id, AtomicT_int* right, AtomicT_int* left) { [getDataGear] match 206 : __code putdown_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 206 : __code putdown_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 206 : __code thinking_PhilsImpl(struct PhilsImpl* phils, struct Fork* fork, __code next(...)) { [getDataGear] match 206 : __code pickup_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 206 : __code pickup_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 206 : __code eating_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 668 : #include "../../../context.h" [generateDataGear] match 797 : #include <stdio.h> [generateDataGear] match 663 : #interface "Phils.h" [generateDataGear] match 663 : #interface "Fork.h" [generateDataGear] match 663 : #interface "Worker.h" [generateDataGear] match 663 : #interface "AtomicT_int.h" [generateDataGear] match 663 : #interface "TaskManager.h" [generateDataGear] match 797 : [generateDataGear] match 797 : [generateDataGear] match 797 : // ---- [generateDataGear] match 797 : // typedef struct PhilsImpl <Self, Isa> impl Phils { [generateDataGear] match 797 : // __code next(...); [generateDataGear] match 797 : // atomic Leftfork; [generateDataGear] match 797 : // atomic Rightfork; [generateDataGear] match 797 : // int self; [generateDataGear] match 797 : // } PhilsImpl; [generateDataGear] match 797 : // ---- [generateDataGear] match 797 : [generateDataGear] match 797 : Phils* createPhilsImpl(struct Context* context, int id, AtomicT_int* right, AtomicT_int* left) { [generateDataGear] match 797 : struct Phils* phils = new Phils(); [generateDataGear] match 797 : struct PhilsImpl* phils_impl = new PhilsImpl(); [generateDataGear] match 797 : phils->phils = (union Data*)phils_impl; [generateDataGear] match 797 : phils_impl->Leftfork = left; [generateDataGear] match 797 : phils_impl->Rightfork = right; [generateDataGear] match 797 : phils_impl->self = 0; [generateDataGear] match 797 : phils->putdown_lfork = C_putdown_lfork_PhilsImpl; [generateDataGear] match 797 : phils->putdown_rfork = C_putdown_rfork_PhilsImpl; [generateDataGear] match 797 : phils->eating = C_eating_PhilsImpl; [generateDataGear] match 797 : phils->pickup_rfork = C_pickup_rfork_PhilsImpl; [generateDataGear] match 797 : phils->pickup_lfork = C_pickup_lfork_PhilsImpl; [generateDataGear] match 797 : phils->thinking = C_thinking_PhilsImpl; [generateDataGear] match 797 : return phils; [generateDataGear] match 797 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code putdown_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : goto phils->Leftfork->set(-1, putdown_rfork_PhilsImpl); [generateDataGear] match 1051 : [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code putdown_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : goto phils->Rightfork->set(-1, putdown_lfork_PhilsImpl); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code thinking_PhilsImpl(struct PhilsImpl* phils, struct Fork* fork, __code next(...)) { [generateDataGear] match 1051 : printf("%d: thinking\n", phils->phils->id); [generateDataGear] match 985 : goto pickup_lfork(phils_impl->self); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code pickup_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : goto phils->Rightfork->checkAndSet(id, -1, pickup_lfork, pickup_rfork); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code pickup_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : goto phils->Leftfork->checkAndSet(id, -1, pickup_rfork, eating); [generateDataGear] match 1051 : [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code eating_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : printf("%d: eating\n", phils_impl->self->id); [generateDataGear] match 985 : goto putdown_rfork(); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : ``` ``` +kajika+anatofuz$ perl generate_stub.pl --debug examples/DPP2/PhilsImpl.cbc [getDataGear] match 175 : #interface "Phils.h" [getDataGear] match 137 : typedef struct Phils <> { [getDataGear] match 338 : __code putdown_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code putdown_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code thinking(Impl* phils,, __code next(...)); [getDataGear] match 338 : __code pickup_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code pickup_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code eating(Impl* phils, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Phils; [getCodeGear] match 393 : typedef struct Phils <> { [getCodeGear] match 398 : __code putdown_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code putdown_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code thinking(Impl* phils,, __code next(...)); [getCodeGear] match 398 : __code pickup_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code pickup_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code eating(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "Fork.h" [getDataGear] match 137 : typedef struct Fork <> { [getDataGear] match 315 : union Data* fork; [getDataGear] match 315 : int id; [getDataGear] match 315 : struct Phils* owner; [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Fork; [getCodeGear] match 393 : typedef struct Fork <> { [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "Worker.h" [getDataGear] match 137 : typedef struct Worker<>{ [getDataGear] match 315 : union Data* worker; [getDataGear] match 315 : struct Queue* tasks; [getDataGear] match 315 : struct Context* task; [getDataGear] match 315 : pthread_t thread; [getDataGear] match 315 : struct TaskManager* taskManager; [getDataGear] match 338 : __code taskReceive(Impl* worker, struct Queue* tasks); [getDataGear] match 338 : __code shutdown(Impl* worker); [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Worker; [getCodeGear] match 393 : typedef struct Worker<>{ [getCodeGear] match 398 : __code taskReceive(Impl* worker, struct Queue* tasks); [getCodeGear] match 398 : __code shutdown(Impl* worker); [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "AtomicT_int.h" [getDataGear] match 137 : typedef struct AtomicT_int <>{ [getDataGear] match 338 : __code checkAndSet(Impl* atomic_t_int,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getDataGear] match 338 : __code set(Impl* atomic_t_int,int* ptr ,int newData, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code fail(...); [getDataGear] match 315 : } AtomicT_int; [getCodeGear] match 393 : typedef struct AtomicT_int <>{ [getCodeGear] match 398 : __code checkAndSet(Impl* atomic_t_int,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getCodeGear] match 398 : __code set(Impl* atomic_t_int,int* ptr ,int newData, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code fail(...); [getDataGear] match 175 : #interface "TaskManager.h" [getDataGear] match 137 : typedef struct TaskManager<>{ [getDataGear] match 338 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getDataGear] match 338 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getDataGear] match 338 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getDataGear] match 338 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code next1(...); [getDataGear] match 315 : } TaskManager; [getCodeGear] match 393 : typedef struct TaskManager<>{ [getCodeGear] match 398 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getCodeGear] match 398 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code next1(...); [getDataGear] match 153 : Phils* createPhilsImpl(struct Context* context, int id, AtomicT_int* right, AtomicT_int* left) { [getDataGear] match 206 : __code putdown_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 240 : struct AtomicT_int* left_fork = phils->Leftfork; [getDataGear] match 250 : goto left_fork->set(&phils->self, -1, putdown_rfork_PhilsImpl); [getDataGear] match 206 : __code putdown_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 240 : struct AtomicT_int* right_fork = phils->Rightfork; [getDataGear] match 250 : goto right_fork->set(&phils->self, -1, putdown_lfork_PhilsImpl); [getDataGear] match 206 : __code thinking_PhilsImpl(struct PhilsImpl* phils, struct Fork* fork, __code next(...)) { [getDataGear] match 206 : __code pickup_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 240 : struct AtomicT_int* right_fork = phils->Rightfork; [getDataGear] match 250 : goto right_fork->checkAndSet(&phils->self, -1, 0, pickup_lfork, pickup_rfork); [getDataGear] match 206 : __code pickup_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [getDataGear] match 240 : struct AtomicT_int* left_fork = phils->Leftfork; [getDataGear] match 250 : goto left_fork->checkAndSet(&phils->self, -1, 0, pickup_rfork, eating); [getDataGear] match 206 : __code eating_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 668 : #include "../../../context.h" [generateDataGear] match 797 : #include <stdio.h> [generateDataGear] match 663 : #interface "Phils.h" [generateDataGear] match 663 : #interface "Fork.h" [generateDataGear] match 663 : #interface "Worker.h" [generateDataGear] match 663 : #interface "AtomicT_int.h" [generateDataGear] match 663 : #interface "TaskManager.h" [generateDataGear] match 797 : [generateDataGear] match 797 : [generateDataGear] match 797 : // ---- [generateDataGear] match 797 : // typedef struct PhilsImpl <Self, Isa> impl Phils { [generateDataGear] match 797 : // __code next(...); [generateDataGear] match 797 : // atomic Leftfork; [generateDataGear] match 797 : // atomic Rightfork; [generateDataGear] match 797 : // int self; [generateDataGear] match 797 : // } PhilsImpl; [generateDataGear] match 797 : // ---- [generateDataGear] match 797 : [generateDataGear] match 797 : Phils* createPhilsImpl(struct Context* context, int id, AtomicT_int* right, AtomicT_int* left) { [generateDataGear] match 797 : struct Phils* phils = new Phils(); [generateDataGear] match 797 : struct PhilsImpl* phils_impl = new PhilsImpl(); [generateDataGear] match 797 : phils->phils = (union Data*)phils_impl; [generateDataGear] match 797 : phils_impl->Leftfork = left; [generateDataGear] match 797 : phils_impl->Rightfork = right; [generateDataGear] match 797 : phils_impl->self = id; [generateDataGear] match 797 : phils->putdown_lfork = C_putdown_lfork_PhilsImpl; [generateDataGear] match 797 : phils->putdown_rfork = C_putdown_rfork_PhilsImpl; [generateDataGear] match 797 : phils->eating = C_eating_PhilsImpl; [generateDataGear] match 797 : phils->pickup_rfork = C_pickup_rfork_PhilsImpl; [generateDataGear] match 797 : phils->pickup_lfork = C_pickup_lfork_PhilsImpl; [generateDataGear] match 797 : phils->thinking = C_thinking_PhilsImpl; [generateDataGear] match 797 : return phils; [generateDataGear] match 797 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code putdown_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1039 : struct AtomicT_int* left_fork = phils->Leftfork; [generateDataGear] match 802 : goto left_fork->set(&phils->self, -1, putdown_rfork_PhilsImpl); [generateDataGear] match 1051 : [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code putdown_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1039 : struct AtomicT_int* right_fork = phils->Rightfork; [generateDataGear] match 802 : goto right_fork->set(&phils->self, -1, putdown_lfork_PhilsImpl); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code thinking_PhilsImpl(struct PhilsImpl* phils, struct Fork* fork, __code next(...)) { [generateDataGear] match 1051 : printf("%d: thinking\n", phils->self); [generateDataGear] match 985 : goto pickup_lfork(phils->self); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code pickup_rfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1039 : struct AtomicT_int* right_fork = phils->Rightfork; [generateDataGear] match 802 : goto right_fork->checkAndSet(&phils->self, -1, 0, pickup_lfork, pickup_rfork); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code pickup_lfork_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1039 : struct AtomicT_int* left_fork = phils->Leftfork; [generateDataGear] match 802 : goto left_fork->checkAndSet(&phils->self, -1, 0, pickup_rfork, eating); [generateDataGear] match 1051 : [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code eating_PhilsImpl(struct PhilsImpl* phils, __code next(...)) { [generateDataGear] match 1051 : printf("%d: eating\n", phils->self); [generateDataGear] match 985 : goto putdown_rfork(); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : ``` ``` +kajika+anatofuz$ perl generate_stub.pl --debug examples/DPP2/main.cbc [getDataGear] match 175 : #interface "TaskManager.h" [getDataGear] match 137 : typedef struct TaskManager<>{ [getDataGear] match 338 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getDataGear] match 338 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getDataGear] match 338 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getDataGear] match 338 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code next1(...); [getDataGear] match 315 : } TaskManager; [getCodeGear] match 393 : typedef struct TaskManager<>{ [getCodeGear] match 398 : __code spawn(Impl* taskManager, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); [getCodeGear] match 398 : __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); [getCodeGear] match 398 : __code shutdown(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code incrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code decrementTaskCount(Impl* taskManagerImpl, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code next1(...); [getDataGear] match 175 : #interface "Phils.h" [getDataGear] match 137 : typedef struct Phils <> { [getDataGear] match 338 : __code putdown_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code putdown_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code thinking(Impl* phils,, __code next(...)); [getDataGear] match 338 : __code pickup_rfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code pickup_lfork(Impl* phils, __code next(...)); [getDataGear] match 338 : __code eating(Impl* phils, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Phils; [getCodeGear] match 393 : typedef struct Phils <> { [getCodeGear] match 398 : __code putdown_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code putdown_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code thinking(Impl* phils,, __code next(...)); [getCodeGear] match 398 : __code pickup_rfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code pickup_lfork(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code eating(Impl* phils, __code next(...)); [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "Fork.h" [getDataGear] match 137 : typedef struct Fork <> { [getDataGear] match 315 : union Data* fork; [getDataGear] match 315 : int id; [getDataGear] match 315 : struct Phils* owner; [getDataGear] match 338 : __code next(...); [getDataGear] match 315 : } Fork; [getCodeGear] match 393 : typedef struct Fork <> { [getCodeGear] match 398 : __code next(...); [getDataGear] match 175 : #interface "AtomicT_int.h" [getDataGear] match 137 : typedef struct AtomicT_int <>{ [getDataGear] match 338 : __code checkAndSet(Impl* atomicT_int,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getDataGear] match 338 : __code set(Impl* atomicT_int,int* ptr ,int newData, __code next(...)); [getDataGear] match 338 : __code next(...); [getDataGear] match 338 : __code fail(...); [getDataGear] match 315 : } AtomicT_int; [getCodeGear] match 393 : typedef struct AtomicT_int <>{ [getCodeGear] match 398 : __code checkAndSet(Impl* atomicT_int,int* ptr ,int init, int newData, __code next(...), __code fail(...)); [getCodeGear] match 398 : __code set(Impl* atomicT_int,int* ptr ,int newData, __code next(...)); [getCodeGear] match 398 : __code next(...); [getCodeGear] match 398 : __code fail(...); [getDataGear] match 206 : __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { [getDataGear] match 206 : __code code1(struct LoopCounter* loopCounter) { [getDataGear] match 206 : __code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { [getDataGear] match 240 : AtomicT_int* fork0 = createAtomicT_intImpl_int(context,-1); // model checking : fork0 [getDataGear] match 240 : AtomicT_int* fork1 = createAtomicT_intImpl_int(context,-1); // model checking : fork1 [getDataGear] match 240 : AtomicT_int* fork2 = createAtomicT_intImpl_int(context,-1); // model checking : fork2 [getDataGear] match 240 : AtomicT_int* fork3 = createAtomicT_intImpl_int(context,-1); // model checking : fork3 [getDataGear] match 240 : AtomicT_int* fork4 = createAtomicT_intImpl_int(context,-1); // model checking : fork4 [getDataGear] match 240 : Phils* phils0 = createPhilsImpl(context,0,fork0,fork1); // model checking : phils0 [getDataGear] match 240 : Phils* phils1 = createPhilsImpl(context,1,fork1,fork2); // model checking : phils1 [getDataGear] match 240 : Phils* phils2 = createPhilsImpl(context,2,fork2,fork3); // model checking : phils2 [getDataGear] match 240 : Phils* phils3 = createPhilsImpl(context,3,fork3,fork4); // model checking : phils3 [getDataGear] match 240 : Phils* phils4 = createPhilsImpl(context,4,fork4,fork0); // model checking : phils4 [getDataGear] match 250 : par goto phils0->thinking(exit_code); [getDataGear] match 250 : par goto phils1->thinking(exit_code); [getDataGear] match 250 : par goto phils2->thinking(exit_code); [getDataGear] match 250 : par goto phils3->thinking(exit_code); [getDataGear] match 250 : par goto phils4->thinking(exit_code); [getDataGear] match 206 : __code code2(struct TaskManager* taskManager) { [getDataGear] match 250 : goto taskManager->shutdown(exit_code); [getDataGear] match 206 : __code code2_stub(struct Context* contextt) { [generateDataGear] match 797 : #include <stdio.h> [generateDataGear] match 797 : #include <string.h> [generateDataGear] match 797 : #include <stdlib.h> [generateDataGear] match 797 : #include <unistd.h> [generateDataGear] match 797 : [generateDataGear] match 797 : [generateDataGear] match 668 : #include "../../../context.h" [generateDataGear] match 663 : #interface "TaskManager.h" [generateDataGear] match 663 : #interface "Phils.h" [generateDataGear] match 663 : #interface "Fork.h" [generateDataGear] match 663 : #interface "AtomicT_int.h" [generateDataGear] match 797 : [generateDataGear] match 797 : int cpu_num = 1; [generateDataGear] match 797 : int length = 102400; [generateDataGear] match 797 : int split = 8; [generateDataGear] match 797 : int* array_ptr; [generateDataGear] match 797 : int gpu_num = 0; [generateDataGear] match 797 : int CPU_ANY = -1; [generateDataGear] match 797 : int CPU_CUDA = -1; [generateDataGear] match 797 : [generateDataGear] match 687 : __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { [generateDataGear] match 1051 : // loopCounter->tree = createRedBlackTree(context); [generateDataGear] match 1051 : loopCounter->i = 0; [generateDataGear] match 1051 : taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); [generateDataGear] match 985 : goto code1(); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code code1(struct LoopCounter* loopCounter) { [generateDataGear] match 1051 : printf("cpus:\t\t%d\n", cpu_num); [generateDataGear] match 1051 : printf("gpus:\t\t%d\n", gpu_num); [generateDataGear] match 1051 : printf("length:\t\t%d\n", length); [generateDataGear] match 1051 : printf("length/task:\t%d\n", length/split); [generateDataGear] match 1051 : /* puts("queue"); */ [generateDataGear] match 1051 : /* print_queue(context->data[ActiveQueue]->queue.first); */ [generateDataGear] match 1051 : /* puts("tree"); */ [generateDataGear] match 1051 : /* print_tree(context->data[Tree]->tree.root); */ [generateDataGear] match 1051 : /* puts("result"); */ [generateDataGear] match 985 : goto createTask1(); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 797 : [generateDataGear] match 687 : __code createTask1(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { [generateDataGear] match 1039 : AtomicT_int* fork0 = createAtomicT_intImpl_int(context,-1); // model checking : fork0 [generateDataGear] match 1039 : AtomicT_int* fork1 = createAtomicT_intImpl_int(context,-1); // model checking : fork1 [generateDataGear] match 1039 : AtomicT_int* fork2 = createAtomicT_intImpl_int(context,-1); // model checking : fork2 [generateDataGear] match 1039 : AtomicT_int* fork3 = createAtomicT_intImpl_int(context,-1); // model checking : fork3 [generateDataGear] match 1039 : AtomicT_int* fork4 = createAtomicT_intImpl_int(context,-1); // model checking : fork4 [generateDataGear] match 1051 : [generateDataGear] match 1039 : Phils* phils0 = createPhilsImpl(context,0,fork0,fork1); // model checking : phils0 [generateDataGear] match 1039 : Phils* phils1 = createPhilsImpl(context,1,fork1,fork2); // model checking : phils1 [generateDataGear] match 1039 : Phils* phils2 = createPhilsImpl(context,2,fork2,fork3); // model checking : phils2 [generateDataGear] match 1039 : Phils* phils3 = createPhilsImpl(context,3,fork3,fork4); // model checking : phils3 [generateDataGear] match 1039 : Phils* phils4 = createPhilsImpl(context,4,fork4,fork0); // model checking : phils4 [generateDataGear] match 1051 : [generateDataGear] match 802 : par goto phils0->thinking(exit_code); [generateDataGear] match 802 : par goto phils1->thinking(exit_code); [generateDataGear] match 802 : par goto phils2->thinking(exit_code); [generateDataGear] match 802 : par goto phils3->thinking(exit_code); [generateDataGear] match 802 : par goto phils4->thinking(exit_code); [generateDataGear] match 1051 : [generateDataGear] match 985 : goto code2(); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code code2(struct TaskManager* taskManager) { [generateDataGear] match 802 : goto taskManager->shutdown(exit_code); [generateDataGear] match 1048 : } [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 687 : __code code2_stub(struct Context* contextt) { [generateDataGear] match 1072 : } [generateDataGear] match 797 : [generateDataGear] match 797 : void init(int argc, char** argv) { [generateDataGear] match 797 : for (int i = 1; argv[i]; ++i) { [generateDataGear] match 797 : if (strcmp(argv[i], "-cpu") == 0) [generateDataGear] match 797 : cpu_num = (int)atoi(argv[i+1]); [generateDataGear] match 797 : else if (strcmp(argv[i], "-l") == 0) [generateDataGear] match 797 : length = (int)atoi(argv[i+1]); [generateDataGear] match 797 : else if (strcmp(argv[i], "-s") == 0) [generateDataGear] match 797 : split = (int)atoi(argv[i+1]); [generateDataGear] match 797 : else if (strcmp(argv[i], "-cuda") == 0) { [generateDataGear] match 797 : gpu_num = 1; [generateDataGear] match 797 : CPU_CUDA = 0; [generateDataGear] match 797 : } [generateDataGear] match 797 : } [generateDataGear] match 797 : } [generateDataGear] match 797 : [generateDataGear] match 637 : int main(int argc, char** argv) { [generateDataGear] match 1061 : goto initDataGears(); [generateDataGear] match 1072 : } ```