comparison regexParser/cerium/ppe/Exec.cc @ 281:b74e3b4b11d7

parallel search done
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Sun, 31 Jan 2016 18:28:58 +0900
parents 6cc1d9779f45
children 87a801c14117
comparison
equal deleted inserted replaced
280:6bbd1cbf90d0 281:b74e3b4b11d7
18 tsv.current = tg->stateList->tState; 18 tsv.current = tg->stateList->tState;
19 } else { 19 } else {
20 tsv.current = tg->anyState->tState; 20 tsv.current = tg->anyState->tState;
21 } 21 }
22 tsv.result = NULL; 22 tsv.result = NULL;
23 tsv.resultEnd = &tsv.result; 23 ResultPtr result = NULL;
24 unsigned char *end = buff.buffend; 24 tsv.resultEnd = &result;
25 buff.buffend = buff.buff+1; 25 unsigned char *end = tsv.buff.buffend;
26 tSearch(tsv); 26 tsv.buff.buffend = tsv.buff.buff+1;
27 tsv = tSearch(tsv);
27 tsv.blockBegin = tsv.current; 28 tsv.blockBegin = tsv.current;
28 buff.buffend = end; 29 tsv.buff.buffend = end;
29 tSearch(tsv); 30 tsv = tSearch(tsv);
30 tsv.blockEnd = tsv.current; 31 tsv.blockEnd = tsv.current;
31 if (tsv.blockEnd->state->bitState.bitContainer != 1) { 32 if (tsv.blockEnd->state->bitState.bitContainer != 1) {
33 // partial match case at block end.
32 ResultPtr r = NEW(Result); 34 ResultPtr r = NEW(Result);
35 r->continued = true;
33 r->begin = tsv.buff.matchBegin; 36 r->begin = tsv.buff.matchBegin;
34 r->end = NULL; 37 r->end = tsv.buff.buffptr-1;
35 *tsv.resultEnd = r; 38 *tsv.resultEnd = r;
36 r->next = NULL; 39 r->next = NULL;
37 tsv.resultEnd = &r->next; 40 tsv.resultEnd = &r->next;
41 // printf("Exec %lx r->begin : %p r->end : %p\n",tsv.blockEnd->state->bitState.bitContainer, r->begin,r->end);
38 } 42 }
43 tsv.result = result;
39 return tsv; 44 return tsv;
40 } 45 }
41 46
42 static int 47 static int
43 blockedGrep(SchedTask *s, void *rbuf, void *wbuf) 48 blockedGrep(SchedTask *s, void *rbuf, void *wbuf)
60 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global; 65 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global;
61 Buffer buff; 66 Buffer buff;
62 buff.buff = buff.buffptr = buff.matchBegin = i_data; 67 buff.buff = buff.buffptr = buff.matchBegin = i_data;
63 buff.buffend = buff.buff + length; 68 buff.buffend = buff.buff + length;
64 TSValue tsv = blockSearch(tg,buff,task_spawned); 69 TSValue tsv = blockSearch(tg,buff,task_spawned);
65 resultPrint(tsv.result,"Exec"); 70 // resultPrint(tsv.result,"Exec");
66 o_data[0] = (unsigned long)tsv.result; 71 o_data[0] = (unsigned long)tsv.result;
67 o_data[1] = (unsigned long)tsv.blockBegin->state; 72 o_data[1] = (unsigned long)tsv.blockBegin->state;
68 o_data[2] = (unsigned long)tsv.blockEnd->state; 73 o_data[2] = (unsigned long)tsv.blockEnd->state;
69 return 0; 74 return 0;
70 } 75 }