changeset 303:cc770cd8d000

parallel retrying seach worked
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 08 Feb 2016 11:56:13 +0900
parents 27414e6fb33c
children c48a8671ce34
files regexParser/cerium/CeriumMain.cc regexParser/cerium/ppe/Exec.cc regexParser/cerium/ppe/Print.cc
diffstat 3 files changed, 18 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/regexParser/cerium/CeriumMain.cc	Mon Feb 08 08:59:38 2016 +0900
+++ b/regexParser/cerium/CeriumMain.cc	Mon Feb 08 11:56:13 2016 +0900
@@ -26,13 +26,13 @@
 }
 
 void addResult(TSValue tsv,bool cont, unsigned char *begin, unsigned char *end) {
-        ResultPtr r = NEW(Result);
-        r->continued = cont;
-        r->begin = begin;
-        r->end = end;
-        *tsv.blk->resultEnd = r;
-        r->next = NULL;
-        tsv.blk->resultEnd = &r->next;
+    ResultPtr r = NEW(Result);
+    r->continued = cont;
+    r->begin = begin;
+    r->end = end;
+    *tsv.blk->resultEnd = r;
+    r->next = NULL;
+    tsv.blk->resultEnd = &r->next;
 }
 
 
@@ -46,6 +46,7 @@
     tsv.current = tsv.tg->stateStart->tState;
     if (tsv.matchEnd) {
         addResult(tsv,false,tsv.matchBegin,tsv.matchEnd);
+        tsv.matchEnd = NULL;
     }
     tsv.matchBegin = tsv.buff.buffptr;  // next char may be matchBegin
     return tsv;
--- a/regexParser/cerium/ppe/Exec.cc	Mon Feb 08 08:59:38 2016 +0900
+++ b/regexParser/cerium/ppe/Exec.cc	Mon Feb 08 11:56:13 2016 +0900
@@ -10,16 +10,12 @@
 /* これは必須 */
 SchedDefineTask1(Exec,blockedGrep);
 
-TSValue blockSearch(TransitionGeneratorPtr tg,Buffer buff,int task_spawned) {
-    TSValue tsv = createTSValue(tg,buff);
-    BlockOutput blk;
-    tsv.blk = &blk;
-    tsv.current = tg->stateStart->tState;
+TSValue blockSearch(TSValue tsv,Buffer buff,int task_spawned) {
+    tsv.current = tsv.tg->stateStart->tState;
     tsv.blk->result = NULL;
     ResultPtr result = NULL;
     tsv.blk->resultEnd = &result;
-    unsigned char *end = tsv.buff.buffend;
-    tsv.buff.buffend = end;
+    tsv.blk->blockBegin = tsv.current;
     tsv = tSearch(tsv);
     tsv.blk->blockEnd = tsv.current;
     addResult(tsv,true,buff.buff,buff.buffend);  // entire buffer
@@ -56,10 +52,13 @@
     Buffer buff;
     buff.buff = buff.buffptr = i_data;
     buff.buffend = buff.buff + length;
-    TSValue tsv = blockSearch(tg,buff,task_spawned);
+    BlockOutput blk;
+    TSValue tsv = createTSValue(tg,buff);
+    tsv.blk = &blk;
+    tsv = blockSearch(tsv,buff,task_spawned);
 //    resultPrint(tsv.result,"Exec");
     o_data[0] = (unsigned long)tsv.blk->result;
-    o_data[1] = (unsigned long)tsv.blk->blockBegin->state;
+    o_data[1] = (unsigned long)tsv.blk->blockBegin->state;  // never used now
     o_data[2] = (unsigned long)tsv.blk->blockEnd->state;
     return 0;
 }
--- a/regexParser/cerium/ppe/Print.cc	Mon Feb 08 08:59:38 2016 +0900
+++ b/regexParser/cerium/ppe/Print.cc	Mon Feb 08 11:56:13 2016 +0900
@@ -39,7 +39,7 @@
             prev = NULL;
             continue;
         }
-        StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+1];
+        // StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+1];
         if (prev) {
             if (i >= out_task_num) break; 
             // 最後のブロックでなく、前の prevBlockEnd が state 1 でない場合)
@@ -68,12 +68,10 @@
                 tsv.matchEnd = prev->end;
                 tsv = tSearch(tsv);
                 if (result) {
-                    resultPrint(prev->next,"Print");
+                    resultPrint(result,"Print");
                 }
             }
 // printf("%p\n",r);
-        } else {
-            if ((blockBegin->bitState.bitContainer & 1)!=1) r = r->next;
         }
         prev = resultPrint(r,"Print");
     }