Mercurial > hg > Members > masakoha > testcode
changeset 275:8879eb8c64a8
remove segmentation fault
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jan 2016 19:06:41 +0900 |
parents | bc704a31e842 |
children | 0faa561ac9ff |
files | regexParser/Makefile regexParser/cerium/ppe/Exec.cc regexParser/cerium/ppe/Print.cc regexParser/threadedSearch.cc |
diffstat | 4 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/Makefile Fri Jan 29 20:41:34 2016 +0900 +++ b/regexParser/Makefile Sat Jan 30 19:06:41 2016 +0900 @@ -5,7 +5,7 @@ AR= libCeriumGrep.a SRCS_TMP = $(wildcard *.cc) -SRCS_EXCLUDE = sequentialSearch.cc state.cc parallelSearch.cc taskInit.cc searchTask.cc +SRCS_EXCLUDE = sequentialSearch.cc state.cc parallelSearch.cc taskInit.cc searchTask.cc main.cc SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) @@ -16,8 +16,8 @@ all: $(TARGET) -regexParser: $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) +regexParser: $(OBJS) main.o + $(CC) $(CFLAGS) -o $@ $(OBJS) main.o test/searchBit: test/searchBit.cc $(CC) $(CFLAGS) $< bitVector.cc -o $@
--- a/regexParser/cerium/ppe/Exec.cc Fri Jan 29 20:41:34 2016 +0900 +++ b/regexParser/cerium/ppe/Exec.cc Sat Jan 30 19:06:41 2016 +0900 @@ -41,6 +41,8 @@ tsv.result = NULL; tsv.resultEnd = &tsv.result; tsv.current = tg->anyState->tState; + tsv.current->stateSkip = stateSkip; + tsv.current->stateContinue = stateNothing; tsv.tg->stateSkip = stateSkip; tsv.tg->stateMatch = stateMatch; tsv.tg->stateNothing = stateNothing; @@ -67,7 +69,7 @@ { long task_spwaned = (long)s->get_param(0); long division_size = (long)s->get_param(1); - // long length = (long)s->get_param(2); + long length = (long)s->get_param(2); long out_size = (long)s->get_param(3); MapReduce *w = (MapReduce*)s->get_param(4); long allocation = task_spwaned + (long)s->x; @@ -83,10 +85,10 @@ TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global; Buffer buff; buff.buff = buff.buffptr = buff.matchBegin = i_data; - buff.buffend = buff.buff + division_size; + buff.buffend = buff.buff + length; TSValue tsv = blockSearch(tg,buff); o_data[0] = (unsigned long)tsv.result; - o_data[1] = (unsigned long)tsv.blockBegin; - o_data[2] = (unsigned long)tsv.blockEnd; + o_data[1] = (unsigned long)tsv.blockBegin->state; + o_data[2] = (unsigned long)tsv.blockEnd->state; return 0; }
--- a/regexParser/cerium/ppe/Print.cc Fri Jan 29 20:41:34 2016 +0900 +++ b/regexParser/cerium/ppe/Print.cc Sat Jan 30 19:06:41 2016 +0900 @@ -18,10 +18,9 @@ int out_task_num = w->task_num; ResultPtr prev = NULL; for (int i = 0; i < out_task_num ; i++) { - ResultPtr *idata = (ResultPtr*)w->o_data[i*3+0]; - StatePtr blockEnd = (StatePtr)w->o_data[i*3+2]; - StatePtr blockBegin = (StatePtr)w->o_data[i*3+4]; // next Block's blockBegin. - ResultPtr r = idata[i*out_size]; + ResultPtr r = (ResultPtr)w->o_data[i*out_size+0]; + StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; + StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. if (prev && i != out_task_num-1) { // 最後のブロックでなく、前の blockEnd が state 1 でない場合) if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) {
--- a/regexParser/threadedSearch.cc Fri Jan 29 20:41:34 2016 +0900 +++ b/regexParser/threadedSearch.cc Sat Jan 30 19:06:41 2016 +0900 @@ -39,6 +39,13 @@ ccvSize++; } tState->ccvSize = ccvSize; + if (state->accept) { + tState->stateSkip = tg->stateMatch; + tState->stateContinue = tg->stateNothing; + } else { + tState->stateSkip = tg->stateSkip; + tState->stateContinue = tg->stateNothing; + } if (ccvSize == 0) return tState; else tState->ccv = (ccv*)malloc(sizeof(ccv)*ccvSize); ccw = createCharClassWalker(state->cc); @@ -55,13 +62,6 @@ ccv->w = cc->cond.w; } free(ccw); - if (state->accept) { - tState->stateSkip = tg->stateMatch; - tState->stateContinue = tg->stateNothing; - } else { - tState->stateSkip = tg->stateSkip; - tState->stateContinue = tg->stateNothing; - } return tState; }