Mercurial > hg > Applications > Grep
changeset 271:6640b0d5bf13
remove anystate processing in sequential seqrch
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Jan 2016 19:37:11 +0900 |
parents | c82f7e7f66f7 |
children | 5aa9d01926f1 |
files | regexParser/Makefile regexParser/cerium/CeriumMain.cc regexParser/cerium/ppe/Exec.cc regexParser/main.cc regexParser/regexParser.h regexParser/subsetConstruction.cc |
diffstat | 6 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/Makefile Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/Makefile Fri Jan 29 19:37:11 2016 +0900 @@ -28,6 +28,7 @@ ./regexParser -seq -subset -regex $(REGEX) $(CC) $(CFLAGS) -c sequentialSearch.cc $(CC) $(CFLAGS) sequentialSearch.o fileread.o -o $@ + ./$@ -file sequentialSearch.cc parallelSearch: parallelSearch.o taskInit.o searchTask.o $(CC) $(CFLAGS) $< -L$(CERIUM)/TaskManager -lFifoManager `sdl-config --libs`
--- a/regexParser/cerium/CeriumMain.cc Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/cerium/CeriumMain.cc Fri Jan 29 19:37:11 2016 +0900 @@ -23,7 +23,10 @@ TMmain(TaskManager *manager, int argc, char *argv[]) { char *filename = 0; + st_time = getTime(); Search s = grep(argc,argv,true); + createAnyState(s.tg); + generateTsate(s.tg->anySatete,s.tg); FileMapReduce *fmp = new FileMapReduce(manager,TASK_EXEC,TASK_EXEC_DATA_PARALLEL,TASK_PRINT); filename = fmp->init(argc, argv); @@ -33,7 +36,6 @@ } fmp->division_out_size = sizeof(void*)*3; // *Result,*blockBegin,*blockEnd task_init(); - st_time = getTime(); fmp->run_start(manager, filename); manager->set_TMend(TMend); return 0;
--- a/regexParser/cerium/ppe/Exec.cc Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/cerium/ppe/Exec.cc Fri Jan 29 19:37:11 2016 +0900 @@ -34,7 +34,7 @@ tsv.tg = tg; tsv.result = NULL; tsv.resultEnd = &tsv.result; - tsv.current = generateTState(tg->anyState); + tsv.current = tg->anyState->tState; tsv.tg->stateSkip = stateSkip; tsv.tg->stateMatch = stateMatch; tsv.tg->stateNothing = stateNothing;
--- a/regexParser/main.cc Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/main.cc Fri Jan 29 19:37:11 2016 +0900 @@ -2,6 +2,6 @@ int main(int argc, char **argv) { - Search s = grep(argc,argv,false); + grep(argc,argv,false); return 0; }
--- a/regexParser/regexParser.h Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/regexParser.h Fri Jan 29 19:37:11 2016 +0900 @@ -90,6 +90,7 @@ typedef struct transitionGenerator { long totalStateCount; + long totalBasicState; StateStackPtr stack; StatePtr stateEnd; StatePtr *stateArray;
--- a/regexParser/subsetConstruction.cc Fri Jan 29 18:13:04 2016 +0900 +++ b/regexParser/subsetConstruction.cc Fri Jan 29 19:37:11 2016 +0900 @@ -336,10 +336,11 @@ TGValue generateTransitionList(NodePtr n) { TGValue tgv = createTGValue(); + TransitionGeneratorPtr tg = tgv.tg; State dummy; - tgv.tg->stateEnd = &dummy; + tg->stateEnd = &dummy; StatePtr startState = tgv.startState = createState(tgv,n); - tgv.tg->stateList = startState; + tg->stateList = startState; NodePtr eof = createNode(NULL,'e',NULL,NULL,NULL); StatePtr endState = tgv.endState = createState(tgv,eof); endState->accept = true; @@ -347,22 +348,27 @@ tgv.endState = endState; tgv = generateTransition(n,tgv,1); printTree(n); - if (tgv.tg->totalStateCount > BITBLOCK) { + if (tg->totalStateCount > BITBLOCK) { errorMassege("StateMax > BITBLOCK",__LINE__,__FILE__); } - BitVector bi = createBitVector(tgv.tg->totalStateCount); - tgv.tg->stateArray = (StatePtr*)calloc(bi.bitContainer*2,sizeof(StatePtr*)); - tgv.tg->stateArray[startState->bitState.bitContainer] = startState; - tgv.tg->stateArray[endState->bitState.bitContainer] = endState; - BitVector anyBi; - anyBi.bitContainer = bi.bitContainer * 2 - 1; // all bit 1 state - tgv.tg->anyState = createState(tgv.tg,anyBi); + BitVector bi = createBitVector(tg->totalStateCount); + tg->stateArray = (StatePtr*)calloc(bi.bitContainer*2,sizeof(StatePtr*)); + tg->stateArray[startState->bitState.bitContainer] = startState; + tg->stateArray[endState->bitState.bitContainer] = endState; + tg->totalBasicState = tg->totalStateCount; tgv.startState = startState; tgv.endState = endState; tgv = generateTransition(n,tgv,2); return tgv; } +void createAnyState(TransitionGeneratorPtr tg) { + BitVector anyBi = createBitVector(tg->totalBasicState); + anyBi.bitContainer = anyBi.bitContainer * 2 - 1; // all bit 1 state + tg->anyState = createState(tg,anyBi); + tg->stateArray[tg->anyState->bitState.bitContainer] = tg->anyState; +} + void printState(StatePtr state) { printf("state : %lx\n",state->bitState.bitContainer); long nodeNumber = 0;