Mercurial > hg > Gears > Gears
changeset 899:d24f24e942de
add_memory_range
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 27 Jan 2021 13:44:47 +0900 |
parents | 04edc3e392bc |
children | 600340b6c03b |
files | src/parallel_execution/MCWorker.h src/parallel_execution/ModelChecking/MCWorker.cbc src/parallel_execution/examples/DPPMC/PhilsImpl.cbc src/parallel_execution/generate_stub.pl src/parallel_execution/lib/Gears/Template/Context.pm |
diffstat | 5 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/MCWorker.h Tue Jan 26 17:32:42 2021 +0900 +++ b/src/parallel_execution/MCWorker.h Wed Jan 27 13:44:47 2021 +0900 @@ -1,4 +1,5 @@ #include "ModelChecking/state_db.h" +#include "ModelChecking/memory.h" typedef struct MCWorker <> { pthread_mutex_t mutex;
--- a/src/parallel_execution/ModelChecking/MCWorker.cbc Tue Jan 26 17:32:42 2021 +0900 +++ b/src/parallel_execution/ModelChecking/MCWorker.cbc Wed Jan 27 13:44:47 2021 +0900 @@ -57,6 +57,11 @@ elem = getElementByIdx(mcQueue, idx); struct Context* ncontext = (struct Context*)elem->data; worker->mcContext = ncontext; + for (int i = 0; i <= length; i++) { + struct Element* tmpElem = getElementByIdx(mcQueue, i); + struct Context* tmpContext = (struct Context*)tmpElem->data; + worker->st.memory = add_memory(&tmpContext->next, sizeof(enum Code), &context->mem); + } goto meta(ncontext, ncontext->next); }
--- a/src/parallel_execution/examples/DPPMC/PhilsImpl.cbc Tue Jan 26 17:32:42 2021 +0900 +++ b/src/parallel_execution/examples/DPPMC/PhilsImpl.cbc Wed Jan 27 13:44:47 2021 +0900 @@ -33,6 +33,13 @@ return phils; } +MemoryPtr addMemoryPhilsImpl(struct Context* context, struct PhilsImpl* phils) { + struct AtomicT_intImpl_int* right = (struct AtomicT_intImpl_int*)phils->Rightfork->atomicT_int; + struct AtomicT_intImpl_int* left = (struct AtomicT_intImpl_int*)phils->Leftfork->atomicT_int; + add_memory(&right->atomic, sizeof(int), &context->mem); + add_memory(&left->atomic, sizeof(int), &context->mem); +} + __code putdown_rfork(struct PhilsImpl* phils, __code next(...)) { struct AtomicT_int* right_fork = phils->Rightfork; @@ -66,3 +73,4 @@ goto putdown_rfork(); } +
--- a/src/parallel_execution/generate_stub.pl Tue Jan 26 17:32:42 2021 +0900 +++ b/src/parallel_execution/generate_stub.pl Wed Jan 27 13:44:47 2021 +0900 @@ -8,8 +8,8 @@ use Module::Load qw/load/; #use DDP { deparse => 1}; -use FindBin; -use lib "$FindBin::Bin/lib"; +use FindBin; #FindBin::Bin is directory with generate_stub.pl +use lib "$FindBin::Bin/lib"; #load Gears modules use Gears::Interface; use Gears::Util; @@ -1354,7 +1354,7 @@ my @replaceMeta = meta->replaceMeta(); return sub { my ($currentCodeGearName, $context, $next) = @_; - my $generator = shift @{[ map { $_->[1] } grep { $currentCodeGearName =~ $_->[0] } @replaceMeta ] }; + my $generator = shift @{[ map { $_->[1] } grep { $currentCodeGearName =~ $_->[0] } @replaceMeta ]}; unless ($generator) { return generateDefaultgotoMeta(undef, $context, $next); }
--- a/src/parallel_execution/lib/Gears/Template/Context.pm Tue Jan 26 17:32:42 2021 +0900 +++ b/src/parallel_execution/lib/Gears/Template/Context.pm Wed Jan 27 13:44:47 2021 +0900 @@ -108,6 +108,7 @@ #define GearImpl(context, intf, name) (Gearef(context, intf)->name->intf.name) #include "c/enumCode.h" +#include "ModelChecking/memory.h" enum Relational { EQ, @@ -154,6 +155,7 @@ /* multi dimension parameter */ int iterate; struct Iterator* iterator; + MemoryPtr mem; }; typedef int Int;