Skip to content

Commit 64412a7

Browse files
Minor changes
1 parent 964c9da commit 64412a7

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

faster.regex.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ sub dispatch_file_scope_stm {
44
$lastcurpos = $currpos;
55
#CORE::print ( $currpos . "__" .$lastpos . "\n" );
66
if ($nqueues++ == $minlen) {
7-
$q->enqueue([scalar($lastntypedfs), scalar($lastpos), scalar($currpos), scalar($nqueues) + 1]);
8-
$lastpos = $currpos;
7+
$q->enqueue([scalar($lastntypedfs), scalar($lastpos_dispatch), scalar($currpos) - 1]);
8+
$lastpos_dispatch = $currpos;
99
if ($typedefs_changed) {
1010
# eval {#use Data::Dumper;
1111
#CORE::print ("sending\n");
@@ -24,6 +24,7 @@ sub register_taggable {
2424
}
2525

2626
sub register_normal_decl {
27+
#my $poslast = pos();
2728
my $ident = $_[0];
2829
$matches[-1]{'ident'} = $ident;
2930
register_decl($matches[-1]);

parse.pl

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
@flags = ();
5858

59+
$maxtimoeut = $ENV{'TIMEOUTWAIT'} // 2;
5960
$minlen = $ENV{'MINQUEUECOUNT'};
6061
$debug = $ENV{'DEBUG'};
6162
$silent = $ENV{'SILENT'};
@@ -635,7 +636,7 @@ sub waitforid {
635636
lock @{$identstoidmap->{$ident}};
636637

637638

638-
CORE::print("$currpos waitin : " . Dumper2(\@{$identstoidmap->{$ident}}));
639+
#CORE::print("$currpos waitin : $ident, " . Dumper2(\@{$identstoidmap->{$ident}}));
639640

640641
foreach my $ind (@{$identstoidmap->{$ident}}) {
641642
lock @{$ind};
@@ -650,9 +651,12 @@ sub waitforid {
650651

651652
#CORE::print ("waitin on " . $ident . "\n");
652653

653-
cond_wait(@{$identstoidmap->{$ident}});
654+
if(!cond_timedwait(@{$identstoidmap->{$ident}}, time() + $maxtimoeut)) {
654655

655-
CORE::print ("end wait on " . $ident . "\n");
656+
CORE::print("$currpos waitin timed out on : $ident, \n");
657+
Dumper2(\@{$identstoidmap->{$ident}});
658+
sleep(10000)
659+
}
656660
}
657661
}
658662

@@ -761,7 +765,7 @@ sub waitforid {
761765
$silent = 1;
762766
$nextpos = scalar($item[2]);
763767
my $ntyps = scalar($item[0]);
764-
my $ntomatch = scalar($item[3]);
768+
#my $ntomatch = scalar($item[3]);
765769
#lock $typedefidentifiersvector;
766770
$typedefidentifiersvector = [$ntyps ? {%{$qtypdfs->peek($ntyps - 1)}} : {}]; #[{}];
767771
#CORE::print (Dumper(\@{$typedefidentifiersvector}));
@@ -863,27 +867,22 @@ sub waitforid {
863867
my $lastvalid = $start;
864868
my $tryingagainlocal;
865869
my $lasrtypedefobj = {%{$typedefidentifiersvector->[0]}};
866-
my $i = 1;
870+
my $i = 0;
867871
my $entertryagain = 0;
868872
while(1){
869-
if ($i++ >= $ntomatch) {
870-
if($+[0] < $nextpos) {
871-
CORE::print "less than nextpos\n";
872-
CORE::print ( "fail" . pos($subject) . "__" .$nextpos . "\n" );
873-
$entertryagain = 1;
874-
goto tryagain
875-
}
876-
last
877-
}
873+
#if ($i++ >= $ntomatch) {
874+
last if($lastvalid >= $nextpos);
875+
#}
878876
tryagain: #[{}];
879877
#pos($subject) = $currposlast;
880878
@flags = ();
881879
@matches = ();
882880
@savedcallouts = ();
883881
$recording = 0;
884882
#CORE::print ("matchin...");
885-
if($entertryagain || !($subject =~ m{$regex}gxxs)) {
886-
#CORE::print ( "fail" . $+[0] . "__" .$nextpos . "\n" );
883+
if(!($subject =~ m{$regex}gxxs) || $+[0] == $lastvalid) {
884+
CORE::print ( "fail" . $+[0] . "__" .$nextpos . "\n" );
885+
eval{reset_state()};
887886
pos($subject) = $lastvalid;
888887
$typedefidentifiersvector = [{%{$lasrtypedefobj}}];
889888
if ($tryingagainlocal) {
@@ -912,7 +911,7 @@ sub waitforid {
912911
$tryingagainlocal = 0;
913912
$lasrtypedefobj = {%{$typedefidentifiersvector->[0]}};
914913
#}
915-
#CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n");
914+
CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n");
916915
#pos($subject) = $+[0]
917916
#CORE::print ("pos is to pos " . $+[0] . "\n");
918917
#$currposlast = $+[0];
@@ -1061,7 +1060,7 @@ sub waitforid {
10611060
#}
10621061

10631062
if ($nqueues) {
1064-
$q->enqueue(([scalar($lastntypedfs), scalar($lastpos), scalar(length $subject), scalar($nqueues) + 1]));
1063+
$q->enqueue(([scalar($lastntypedfs), scalar($lastpos), scalar(length $subject) - 1]));
10651064
}
10661065

10671066
CORE::print ("joinning for real $lastqueuepoint\n");

0 commit comments

Comments
 (0)