Commit c277df4

Ilya Zakharevich
Malcolm Beattie
1 parent 5d5aaa5 commit c277df4
File tree
26 files changed
+3166
-1127
lines changed- pod
- t/op
26 files changed
+3166-1127lines changed+5-6Original file line number Diff line number Diff line change @@ -359,18 +359,17 @@ dump_pm(PMOP *pm)359
359
dump("PMf_REPL = ");360
360
dump_op(pm->op_pmreplroot);361
361
}362
-
if (pm->op_pmshort) {363
-
dump("PMf_SHORT = %s\n",SvPEEK(pm->op_pmshort));364
-
}365
-
if (pm->op_pmflags) {362
+
if (pm->op_pmflags || (pm->op_pmregexp && pm->op_pmregexp->check_substr)) {366
363
SV *tmpsv = newSVpv("", 0);367
364
if (pm->op_pmflags & PMf_USED)368
365
sv_catpv(tmpsv, ",USED");369
366
if (pm->op_pmflags & PMf_ONCE)370
367
sv_catpv(tmpsv, ",ONCE");371
-
if (pm->op_pmflags & PMf_SCANFIRST)368
+
if (pm->op_pmregexp && pm->op_pmregexp->check_substr369
+
&& !(pm->op_pmregexp->reganch & ROPT_NOSCAN))372
370
sv_catpv(tmpsv, ",SCANFIRST");373
-
if (pm->op_pmflags & PMf_ALL)371
+
if (pm->op_pmregexp && pm->op_pmregexp->check_substr372
+
&& pm->op_pmregexp->reganch & ROPT_CHECK_ALL)374
373
sv_catpv(tmpsv, ",ALL");375
374
if (pm->op_pmflags & PMf_SKIPWHITE)376
375
sv_catpv(tmpsv, ",SKIPWHITE");+3-24Original file line number Diff line number Diff line change @@ -185,7 +185,6 @@185
185
#define do_trans Perl_do_trans186
186
#define do_vecset Perl_do_vecset187
187
#define do_vop Perl_do_vop188
-
#define doeval Perl_doeval189
188
#define dofindlabel Perl_dofindlabel190
189
#define dopoptoeval Perl_dopoptoeval191
190
#define dounwind Perl_dounwind@@ -331,6 +330,7 @@331
330
#define magic_clearsig Perl_magic_clearsig332
331
#define magic_existspack Perl_magic_existspack333
332
#define magic_freedefelem Perl_magic_freedefelem333
+
#define magic_freeregexp Perl_magic_freeregexp334
334
#define magic_get Perl_magic_get335
335
#define magic_getarylen Perl_magic_getarylen336
336
#define magic_getdefelem Perl_magic_getdefelem@@ -890,32 +890,11 @@890
890
#define reall_srchlen Perl_reall_srchlen891
891
#define ref Perl_ref892
892
#define refkids Perl_refkids893
-
#define regarglen Perl_regarglen894
-
#define regbol Perl_regbol895
-
#define regcode Perl_regcode896
-
#define regdummy Perl_regdummy897
893
#define regdump Perl_regdump898
-
#define regendp Perl_regendp899
-
#define regeol Perl_regeol900
-
#define reginput Perl_reginput894
+
#define regexec_flags Perl_regexec_flags901
895
#define regkind Perl_regkind902
-
#define reglastparen Perl_reglastparen903
-
#define regmyendp Perl_regmyendp904
-
#define regmyp_size Perl_regmyp_size905
-
#define regmystartp Perl_regmystartp906
-
#define regnarrate Perl_regnarrate907
-
#define regnaughty Perl_regnaughty908
896
#define regnext Perl_regnext909
-
#define regnpar Perl_regnpar910
-
#define regparse Perl_regparse911
-
#define regprecomp Perl_regprecomp912
-
#define regprev Perl_regprev913
897
#define regprop Perl_regprop914
-
#define regsawback Perl_regsawback915
-
#define regsize Perl_regsize916
-
#define regstartp Perl_regstartp917
-
#define regtill Perl_regtill918
-
#define regxend Perl_regxend919
898
#define repeat_amg Perl_repeat_amg920
899
#define repeat_ass_amg Perl_repeat_ass_amg921
900
#define repeatcpy Perl_repeatcpy@@ -1046,6 +1025,7 @@1046
1025
#define sv_cmp Perl_sv_cmp1047
1026
#define sv_cmp_locale Perl_sv_cmp_locale1048
1027
#define sv_collxfrm Perl_sv_collxfrm1028
+
#define sv_compile_2op Perl_sv_compile_2op1049
1029
#define sv_dec Perl_sv_dec1050
1030
#define sv_derived_from Perl_sv_derived_from1051
1031
#define sv_dump Perl_sv_dump@@ -1197,7 +1177,6 @@1197
1177
#define no_wrongref Perl_no_wrongref1198
1178
#define pad_reset_pending Perl_pad_reset_pending1199
1179
#define padix_floor Perl_padix_floor1200
-
#define regflags Perl_regflags1201
1180
#define safecalloc Perl_safecalloc1202
1181
#define safefree Perl_safefree1203
1182
#define safemalloc Perl_safemalloc+7-24Original file line number Diff line number Diff line change @@ -173,30 +173,11 @@ psig_name173
173
psig_ptr174
174
rcsid175
175
reall_srchlen176
-
regarglen177
-
regbol178
-
regcode179
-
regdummy180
-
regendp181
-
regeol182
-
regflags183
-
reginput176
+
regdump177
+
regexec_flags184
178
regkind185
-
reglastparen186
-
regmyendp187
-
regmyp_size188
-
regmystartp189
-
regnarrate190
-
regnaughty191
-
regnpar192
-
regparse193
-
regprecomp194
-
regprev195
-
regsawback196
-
regsize197
-
regstartp198
-
regtill199
-
regxend179
+
regnext180
+
regprop200
181
repeat_amg201
182
repeat_ass_amg202
183
retstack@@ -429,7 +410,6 @@ do_tell429
410
do_trans430
411
do_vecset431
412
do_vop432
-
doeval433
413
dofindlabel434
414
dopoptoeval435
415
dounwind@@ -526,6 +506,7 @@ magic_clearpack526
506
magic_clearsig527
507
magic_existspack528
508
magic_freedefelem509
+
magic_freeregexp529
510
magic_get530
511
magic_getarylen531
512
magic_getdefelem@@ -1021,6 +1002,7 @@ q1021
1002
ref1022
1003
refkids1023
1004
regdump1005
+
regexec_flags1024
1006
regnext1025
1007
regprop1026
1008
repeatcpy@@ -1120,6 +1102,7 @@ sv_clean_objs1120
1102
sv_clear1121
1103
sv_cmp1122
1104
sv_cmp_locale1105
+
sv_compile_2op1123
1106
sv_collxfrm1124
1107
sv_dec1125
1108
sv_derived_from+9-1Original file line number Diff line number Diff line change @@ -418,7 +418,7 @@ magic_get(SV *sv, MAGIC *mg)418
418
}419
419
sv_setpvn(sv,s,i);420
420
if (tainting)421
-
tainted = was_tainted || rx->exec_tainted;421
+
tainted = was_tainted || RX_MATCH_TAINTED(rx);422
422
break;423
423
}424
424
}@@ -1305,6 +1305,14 @@ magic_setuvar(SV *sv, MAGIC *mg)1305
1305
return 0;1306
1306
}1307
1307
1308
+
int1309
+
magic_freeregexp(SV *sv, MAGIC *mg)1310
+
{1311
+
regexp *re = (regexp *)mg->mg_obj;1312
+
ReREFCNT_dec(re);1313
+
return 0;1314
+
}1315
+
1308
1316
#ifdef USE_LOCALE_COLLATE1309
1317
int1310
1318
magic_setcollxfrm(SV *sv, MAGIC *mg)+13-10Original file line number Diff line number Diff line change @@ -522,6 +522,12 @@ find_thread_magical(char *name)522
522
case ';':523
523
sv_setpv(sv, "\034");524
524
break;525
+
case '&':526
+
case '`':527
+
case '\'':528
+
sawampersand = TRUE;529
+
SvREADONLY_on(sv);530
+
break;525
531
}526
532
sv_magic(sv, 0, name, 1);527
533
DEBUG_L(PerlIO_printf(PerlIO_stderr(),@@ -594,8 +600,7 @@ op_free(OP *o)594
600
/* FALL THROUGH */595
601
case OP_PUSHRE:596
602
case OP_MATCH:597
-
pregfree(cPMOPo->op_pmregexp);598
-
SvREFCNT_dec(cPMOPo->op_pmshort);603
+
ReREFCNT_dec(cPMOPo->op_pmregexp);599
604
break;600
605
}601
606
@@ -1914,7 +1919,12 @@ newUNOP(I32 type, I32 flags, OP *first)1914
1919
unop->op_first = first;1915
1920
unop->op_flags = flags | OPf_KIDS;1916
1921
unop->op_private = 1 | (flags >> 8);1917
-
1922
+
#if 11923
+
if(type == OP_STUDY && first->op_type == OP_MATCH) {1924
+
first->op_type = OP_PUSHRE;1925
+
first->op_ppaddr = ppaddr[OP_PUSHRE];1926
+
}1927
+
#endif1918
1928
unop = (UNOP*) CHECKOP(type, unop);1919
1929
if (unop->op_next)1920
1930
return (OP*)unop;@@ -2065,7 +2075,6 @@ pmruntime(OP *o, OP *expr, OP *repl)2065
2075
pm->op_pmregexp = pregcomp(p, p + plen, pm);2066
2076
if (strEQ("\\s+", pm->op_pmregexp->precomp))2067
2077
pm->op_pmflags |= PMf_WHITE;2068
-
hoistmust(pm);2069
2078
op_free(expr);2070
2079
}2071
2080
else {@@ -4446,7 +4455,6 @@ OP *4446
4455
ck_split(OP *o)4447
4456
{4448
4457
register OP *kid;4449
-
PMOP* pm;4450
4458
4451
4459
if (o->op_flags & OPf_STACKED)4452
4460
return no_fh_allowed(o);@@ -4471,11 +4479,6 @@ ck_split(OP *o)4471
4479
cLISTOPo->op_first = kid;4472
4480
kid->op_sibling = sibl;4473
4481
}4474
-
pm = (PMOP*)kid;4475
-
if (pm->op_pmshort && !(pm->op_pmflags & PMf_ALL)) {4476
-
SvREFCNT_dec(pm->op_pmshort); /* can't use substring to optimize */4477
-
pm->op_pmshort = 0;4478
-
}4479
4482
4480
4483
kid->op_type = OP_PUSHRE;4481
4484
kid->op_ppaddr = ppaddr[OP_PUSHRE];+2-4Original file line number Diff line number Diff line change @@ -177,16 +177,14 @@ struct pmop {177
177
OP * op_pmreplstart;178
178
PMOP * op_pmnext; /* list of all scanpats */179
179
REGEXP * op_pmregexp; /* compiled expression */180
-
SV * op_pmshort; /* for a fast bypass of execute() */181
180
U16 op_pmflags;182
181
U16 op_pmpermflags;183
-
char op_pmslen;184
182
};185
183
186
184
#define PMf_USED 0x0001 /* pm has been used once already */187
185
#define PMf_ONCE 0x0002 /* use pattern only once per reset */188
-
#define PMf_SCANFIRST 0x0004 /* initial constant not anchored */189
-
#define PMf_ALL 0x0008 /* initial constant is whole pat */186
+
#define PMf_REVERSED 0x0004 /* Should be matched right->left */187
+
/*#define PMf_ALL 0x0008*/ /* initial constant is whole pat */190
188
#define PMf_SKIPWHITE 0x0010 /* skip leading whitespace for split */191
189
#define PMf_FOLD 0x0020 /* case insensitivity */192
190
#define PMf_CONST 0x0040 /* subst replacement is constant */-30Original file line number Diff line number Diff line change @@ -418,36 +418,6 @@ perl_destruct(register PerlInterpreter *sv_interp)418
418
419
419
/* defgv, aka *_ should be taken care of elsewhere */420
420
421
-
#if 0 /* just about all regexp stuff, seems to be ok */422
-
423
-
/* shortcuts to regexp stuff */424
-
leftgv = Nullgv;425
-
ampergv = Nullgv;426
-
427
-
SAVEFREEOP(curpm);428
-
SAVEFREEOP(oldlastpm); /* for saving regexp context during debugger */429
-
430
-
regprecomp = NULL; /* uncompiled string. */431
-
regparse = NULL; /* Input-scan pointer. */432
-
regxend = NULL; /* End of input for compile */433
-
regnpar = 0; /* () count. */434
-
regcode = NULL; /* Code-emit pointer; ®dummy = don't. */435
-
regsize = 0; /* Code size. */436
-
regnaughty = 0; /* How bad is this pattern? */437
-
regsawback = 0; /* Did we see \1, ...? */438
-
439
-
reginput = NULL; /* String-input pointer. */440
-
regbol = NULL; /* Beginning of input, for ^ check. */441
-
regeol = NULL; /* End of input, for $ check. */442
-
regstartp = (char **)NULL; /* Pointer to startp array. */443
-
regendp = (char **)NULL; /* Ditto for endp. */444
-
reglastparen = 0; /* Similarly for lastparen. */445
-
regtill = NULL; /* How far we are required to go. */446
-
regflags = 0; /* are we folding, multilining? */447
-
regprev = (char)NULL; /* char before regbol, \n if none */448
-
449
-
#endif /* if 0 */450
-
451
421
/* clean up after study() */452
422
SvREFCNT_dec(lastscream);453
423
lastscream = Nullsv;+3-23Original file line number Diff line number Diff line change @@ -1748,29 +1748,6 @@ EXT U32 hints; /* various compilation flags */1748
1748
#define HINT_STRICT_VARS 0x000004001749
1749
#define HINT_LOCALE 0x000008001750
1750
1751
-
/**************************************************************************/1752
-
/* This regexp stuff is global since it always happens within 1 expr eval */1753
-
/**************************************************************************/1754
-
1755
-
EXT char * regprecomp; /* uncompiled string. */1756
-
EXT char * regparse; /* Input-scan pointer. */1757
-
EXT char * regxend; /* End of input for compile */1758
-
EXT I32 regnpar; /* () count. */1759
-
EXT char * regcode; /* Code-emit pointer; ®dummy = don't. */1760
-
EXT I32 regsize; /* Code size. */1761
-
EXT I32 regnaughty; /* How bad is this pattern? */1762
-
EXT I32 regsawback; /* Did we see \1, ...? */1763
-
1764
-
EXT char * reginput; /* String-input pointer. */1765
-
EXT char * regbol; /* Beginning of input, for ^ check. */1766
-
EXT char * regeol; /* End of input, for $ check. */1767
-
EXT char ** regstartp; /* Pointer to startp array. */1768
-
EXT char ** regendp; /* Ditto for endp. */1769
-
EXT U32 * reglastparen; /* Similarly for lastparen. */1770
-
EXT char * regtill; /* How far we are required to go. */1771
-
EXT U16 regflags; /* are we folding, multilining? */1772
-
EXT char regprev; /* char before regbol, \n if none */1773
-
1774
1751
EXT bool do_undump; /* -u or dump seen? */1775
1752
EXT VOL U32 debug;1776
1753
@@ -2072,6 +2049,8 @@ EXT MGVTBL vtbl_mutex = {0, 0, 0, 0, magic_mutexfree};2072
2049
EXT MGVTBL vtbl_defelem = {magic_getdefelem,magic_setdefelem,2073
2050
0, 0, magic_freedefelem};2074
2051
2052
+
EXT MGVTBL vtbl_regexp = {0,0, magic_freeregexp};2053
+
2075
2054
#ifdef USE_LOCALE_COLLATE2076
2055
EXT MGVTBL vtbl_collxfrm = {0,2077
2056
magic_setcollxfrm,@@ -2114,6 +2093,7 @@ EXT MGVTBL vtbl_mutex;2114
2093
#endif /* USE_THREADS */2115
2094
2116
2095
EXT MGVTBL vtbl_defelem;2096
+
EXT MGVTBL vtbl_regexp;2117
2097
2118
2098
#ifdef USE_LOCALE_COLLATE2119
2099
EXT MGVTBL vtbl_collxfrm;
0 commit comments