34
34
# my $condinput : shared;
35
35
my $condexit : shared;
36
36
my $scopevarsdone : shared;
37
- my $identstoidmap : shared = shared_clone({});
37
+ $identstoidmap = shared_clone({});
38
38
my $identsdone : shared = shared_clone({});
39
39
my $identwaiters : shared = shared_clone({});
40
40
56
56
57
57
@flags = ();
58
58
59
- $minlen = $ENV {' MINLEN ' };
59
+ $minlen = $ENV {' MINQUEUECOUNT ' };
60
60
$debug = $ENV {' DEBUG' };
61
61
$silent = $ENV {' SILENT' };
62
62
$lineonly = $ENV {' LINEONLY' };
67
67
my sub print {CORE::print (@_ ) if ( 0 )}
68
68
my sub print2 {CORE::print (@_ ) if (0)}
69
69
sub print3 {CORE::print (@_ ) if ( 0)}
70
- my sub Dumper2 {use Data::Dumper; CORE::print (Dumper(@_ )) }
70
+ sub Dumper2 {use Data::Dumper; CORE::print (Dumper(@_ )) }
71
71
my sub Dumper {use Data::Dumper; Dumper(@_ ) if ( 0 )}
72
72
my sub strftime {use POSIX; strftime(@_ ) if ( 0 )}
73
73
@@ -365,7 +365,7 @@ sub dec {
365
365
366
366
parseregexfile((substr $mainregexfilecontent , length $& ), 1);
367
367
368
- $mainregexdefs = " $mainregexfinal " ;
368
+ $mainregexdefs = $mainregexfinal ;
369
369
370
370
$mainregexfinal =~s /\s |\n // g if (not $matchinperl );
371
371
@@ -635,7 +635,7 @@ sub waitforid {
635
635
lock @{$identstoidmap -> {$ident }};
636
636
637
637
638
- # CORE::print("$currpos waitin : " . Dumper2(\@{$identstoidmap->{$ident}}));
638
+ CORE::print (" $currpos waitin : " . Dumper2(\@{$identstoidmap -> {$ident }}));
639
639
640
640
foreach my $ind (@{$identstoidmap -> {$ident }}) {
641
641
lock @{$ind };
@@ -652,7 +652,7 @@ sub waitforid {
652
652
653
653
cond_wait(@{$identstoidmap -> {$ident }});
654
654
655
- # CORE::print ("end wait on " . $ident . "\n");
655
+ CORE::print (" end wait on " . $ident . " \n " );
656
656
}
657
657
}
658
658
@@ -661,8 +661,8 @@ sub waitforid {
661
661
662
662
my $tryingagain : shared = 0;
663
663
664
- if (not $isnested )
665
- {
664
+ # if(not $isnested)
665
+ # {
666
666
667
667
# my $i = 2;
668
668
# use re qw(Debug EXECUTE);
@@ -672,12 +672,13 @@ sub waitforid {
672
672
@typedefidentifiersvector = eval { require $ENV {' REPLAY' } . " .txt" };
673
673
}
674
674
my $flind = 1;
675
- my $execmainregshared = eval { # use re qw(Debug EXECUTE);
676
- " (?(DEFINE)$mainregexdefs )\\ G(?&cprogram)" };
675
+ my $execmainregshared = $mainregexdefs ; # eval { #use re qw(Debug EXECUTE);
676
+ # "(?(DEFINE)$mainregexdefs)\\G(?&cprogram)" };
677
677
sub execmain {
678
678
# use re qw(Debug EXECUTE);
679
+ # CORE::print("here1\n");
679
680
$regexstr = $_ [0];
680
- $regex = qr {$_ [0] } sxx ;
681
+ $regex = qr {(?(DEFINE) $regexstr ) \G (?&cprogram) } sxx ;
681
682
$subject = $_ [1];
682
683
$fasterregex = $_ [2];
683
684
$threadid = $_ [3];
@@ -698,6 +699,8 @@ sub waitforid {
698
699
699
700
my $tryingagainlocal ;
700
701
702
+ # CORE::print("here\n");
703
+
701
704
while (1) {
702
705
if (not $tryingagainlocal )
703
706
{
@@ -732,6 +735,7 @@ sub waitforid {
732
735
733
736
# cond_signal ($q)
734
737
}
738
+ # CORE::print("here\n");
735
739
736
740
# $silent = 0;
737
741
@@ -757,9 +761,10 @@ sub waitforid {
757
761
$silent = 1;
758
762
$nextpos = scalar ($item [2]);
759
763
my $ntyps = scalar ($item [0]);
764
+ my $ntomatch = scalar ($item [3]);
760
765
# lock $typedefidentifiersvector;
761
766
$typedefidentifiersvector = [$ntyps ? {%{$qtypdfs -> peek($ntyps - 1)}} : {}]; # [{}];
762
- CORE::print (Dumper(\@{$typedefidentifiersvector }));
767
+ # CORE::print (Dumper(\@{$typedefidentifiersvector}));
763
768
# CORE::print ("$start\n");
764
769
=begin
765
770
for my $i (0..$ntyps) {
@@ -854,14 +859,33 @@ sub waitforid {
854
859
goto tryagain_begin
855
860
}
856
861
=cut
857
- tryagain:
858
- pos ($subject ) = $currposlast ;
862
+ pos ($subject ) = $start ;
863
+ my $lastvalid = $start ;
864
+ my $tryingagainlocal ;
865
+ my $lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
866
+ my $i = 1;
867
+ my $entertryagain = 0;
868
+ 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
+ }
878
+ tryagain: # [{}];
879
+ # pos($subject) = $currposlast;
859
880
@flags = ();
860
881
@matches = ();
861
882
@savedcallouts = ();
862
883
$recording = 0;
863
- if (!($subject =~ $regex ) || $+ [0] < $nextpos ) {
864
- CORE::print ( " fail" . $+ [0] . " __" .$nextpos . " \n " );
884
+ # CORE::print ("matchin...");
885
+ if ($entertryagain || !($subject =~ m {$regex } gxxs )) {
886
+ # CORE::print ( "fail" . $+[0] . "__" .$nextpos . "\n" );
887
+ pos ($subject ) = $lastvalid ;
888
+ $typedefidentifiersvector = [{%{$lasrtypedefobj }}];
865
889
if ($tryingagainlocal ) {
866
890
lock ($tryingagain );
867
891
if ($tryingagain ) {
@@ -870,22 +894,29 @@ sub waitforid {
870
894
CORE::print (" 4 failed near " . pos ($subject ) . " - start - $start \n " );
871
895
872
896
$tryingagainlocal = $tryingagain = 1;
873
- $silent = 0;
897
+ # $silent = 0;
874
898
# CORE::print (Dump(\@{$typedefidentifiersvector}));
875
- CORE::print (Dumper (\@{$typedefidentifiersvector }));
876
- $silent = 1;
899
+ # CORE::print (Dumper2 (\@{$typedefidentifiersvector}));
900
+ # $silent = 1;
877
901
CORE::print (" retrying..." );
878
902
879
- $regex = eval { use re qw( Debug EXECUTE) ; qr {$regexstr } sxx ; };
903
+ $regex = eval { use re qw( Debug EXECUTE) ; qr {(?(DEFINE) $regexstr ) \G (?&cprogram) } sxx ; };
880
904
}
881
905
$tryingagainlocal = 1;
906
+ $entertryagain = 0;
882
907
# CORE::print("currposlast" . $currposlast . "\n");
883
908
goto tryagain
884
909
}
910
+ # else {
911
+ $lastvalid = $+ [0];
912
+ $tryingagainlocal = 0;
913
+ $lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
914
+ # }
885
915
# CORE::print("$threadid -- $i ==========succes=============\n $&\n==========endsuccess=============\n");
886
916
# pos($subject) = $+[0]
887
917
# CORE::print ("pos is to pos " . $+[0] . "\n");
888
- $currposlast = $+ [0];
918
+ # $currposlast = $+[0];
919
+ }
889
920
# }
890
921
# $currposlast = $+[0]
891
922
# CORE::print (Dumper(\@{$typedefidentifiersvector}));
@@ -988,12 +1019,49 @@ sub waitforid {
988
1019
push2 \@matches , {};
989
1020
push2 \@flags , {" outter" => undef ," opt" => undef , " nonbitfl" => undef };
990
1021
991
- while ($subject =~ m {$initseqlight
992
- (;|^)(?{dispatch_file_scope_stm()})\s *+(?&fasterdecls)|(?&parens)(\s *+(?&brackets)\s *+(?{dispatch_file_scope_stm()})(?&fasterdecls))?+|(?&brackets)|(?&strunus)} sxxg ) {
993
- }
1022
+ my $tryagain = 2;
1023
+ my $lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
1024
+ my $lastposcurrlast = 0;
1025
+ my $compreg = qr {$initseqlight \G\s *+(?&fasterdecls)} sxx ;
994
1026
995
- if (!($subject =~ m {\s *+$} sxxg )) {
996
- exit -1
1027
+ # while(1) {
1028
+ {
1029
+ tryagain_main:
1030
+ while ($subject =~ m {$compreg } gxxs ) {
1031
+ # CORE::print($lastposcurrlast . "\n");
1032
+ $lasrtypedefobj = {%{$typedefidentifiersvector -> [0]}};
1033
+ $lastposcurrlast = $+ [0];
1034
+ }
1035
+
1036
+ if (!($subject =~ m { $} sxxg )) {
1037
+ @flags = ();
1038
+ @matches = ();
1039
+ @savedcallouts = ();
1040
+ $recording = 0;
1041
+ push2 \@matches , {};
1042
+ push2 \@flags , {" outter" => undef ," opt" => undef , " nonbitfl" => undef };
1043
+ $typedefidentifiersvector = [{%{$lasrtypedefobj }}];
1044
+ if (!$tryagain ) {
1045
+
1046
+ $tryagain = 1;
1047
+ pos ($subject ) = $lastposcurrlast ;
1048
+ goto tryagain_main
1049
+ }
1050
+ elsif ($tryagain ++ == 1) {
1051
+ use re qw( Debug EXECUTE) ;
1052
+ $compreg = qr { (?(DEFINE)$fasterregexfilecontent$fasterlightregexfilecontent )\G\s *+(?&fasterdecls)} sxx ;
1053
+ # CORE::print("trying again with debug\n" . $initseqlight );
1054
+ pos ($subject ) = $lastposcurrlast ;
1055
+ goto tryagain_main
1056
+ }
1057
+ CORE::print ( " test failed" . $lastposcurrlast . " __" .length $subject . " \n " );
1058
+ exit -1;
1059
+ }
1060
+ }
1061
+ # }
1062
+
1063
+ if ($nqueues ) {
1064
+ $q -> enqueue(([scalar ($lastntypedfs ), scalar ($lastpos ), scalar (length $subject ), scalar ($nqueues ) + 1]));
997
1065
}
998
1066
999
1067
CORE::print (" joinning for real $lastqueuepoint \n " );
@@ -1398,7 +1466,7 @@ sub waitforid {
1398
1466
=cut
1399
1467
# }
1400
1468
exit ;
1401
- }
1469
+ # }
1402
1470
1403
1471
# }
1404
1472
0 commit comments