In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b4d257e2d408f0f1c6686dcdc112f3ebfec68f44?hp=92c15a4926e73f5173fda2ca3f08cf8fff3b49ab>
- Log ----------------------------------------------------------------- commit b4d257e2d408f0f1c6686dcdc112f3ebfec68f44 Author: Yves Orton <[email protected]> Date: Tue Jun 27 10:22:23 2017 +0200 File::Glob - tweak rt131211.t to be less sensitive on wonky boxes make the test less senstive and avoid divide by zero errors, also we skip the test if either elapsed_match or elapsed_fail is true, as we can not rely on the timings then. For the operations we are doing we should get a non-zero timing from Time::HiRes. This should mean that running this test on boxes with heavy load, etc, will no longer result in false positives. M ext/File-Glob/t/rt131211.t commit 3a61151187ec2eaba17315536fd6b4886b365319 Author: Yves Orton <[email protected]> Date: Tue Jun 27 10:28:05 2017 +0200 regcomp.c: correct the regdata which paratermers under DEBUG this worked because 'a' and 'o' are treated the same for all intents and purposes, but it is confusing as 'a' stands for array, and 'o' for hash, and the DEBUG mode code here adds two arrays not hashes. M regcomp.c commit 98b61a5858be6e46fbcdef7efc525b2d8f52ae64 Author: Yves Orton <[email protected]> Date: Tue Jun 27 10:27:37 2017 +0200 regcomp.c: document reg_data types better in reg_dup M regcomp.c ----------------------------------------------------------------------- Summary of changes: ext/File-Glob/t/rt131211.t | 9 +++++++-- regcomp.c | 35 ++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ext/File-Glob/t/rt131211.t b/ext/File-Glob/t/rt131211.t index c1bcbe04e8..b29cd043ed 100644 --- a/ext/File-Glob/t/rt131211.t +++ b/ext/File-Glob/t/rt131211.t @@ -49,8 +49,13 @@ while (++$count < 10) { is $count,10, "tried all the patterns without bailing out"; -cmp_ok $elapsed_fail/$elapsed_match,"<",2, - "time to fail less than twice the time to match"; +SKIP: { + skip "unstable timing", 1 unless $elapsed_match && $elapsed_fail; + ok $elapsed_fail <= 10 * $elapsed_match, + "time to fail less than 10x the time to match" + or diag("elapsed_match=$elapsed_match elapsed_fail=$elapsed_fail"); +} + is "@got_files", catfile($path, $files[0]), "only got the expected file for xa*..b"; is "@no_files", "", "shouldnt have files for xa*..c"; diff --git a/regcomp.c b/regcomp.c index 3f81daa136..e2bdacc394 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2462,8 +2462,11 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, /* we just use folder as a flag in utf8 */ const U8 * folder = NULL; + /* in the below add_data call we are storing either 'tu' or 'tuaa' + * which stands for one trie structure, one hash, optionally followed + * by two arrays */ #ifdef DEBUGGING - const U32 data_slot = add_data( pRExC_state, STR_WITH_LEN("tuuu")); + const U32 data_slot = add_data( pRExC_state, STR_WITH_LEN("tuaa")); AV *trie_words = NULL; /* along with revcharmap, this only used during construction but both are * useful during debugging so we store them in the struct when debugging. @@ -19869,33 +19872,47 @@ Perl_regdupe_internal(pTHX_ REGEXP * const rx, CLONE_PARAMS *param) d->what[i] = ri->data->what[i]; switch (d->what[i]) { /* see also regcomp.h and regfree_internal() */ - case 'a': /* actually an AV, but the dup function is identical. */ - case 'r': - case 's': - case 'S': - case 'u': /* actually an HV, but the dup function is identical. */ + case 'a': /* actually an AV, but the dup function is identical. + values seem to be "plain sv's" generally. */ + case 'r': /* a compiled regex (but still just another SV) */ + case 's': /* an RV (currently only used for an RV to an AV by the ANYOF code) + this use case should go away, the code could have used + 'a' instead - see S_set_ANYOF_arg() for array contents. */ + case 'S': /* actually an SV, but the dup function is identical. */ + case 'u': /* actually an HV, but the dup function is identical. + values are "plain sv's" */ d->data[i] = sv_dup_inc((const SV *)ri->data->data[i], param); break; case 'f': + /* Synthetic Start Class - "Fake" charclass we generate to optimize + * patterns which could start with several different things. Pre-TRIE + * this was more important than it is now, however this still helps + * in some places, for instance /x?a+/ might produce a SSC equivalent + * to [xa]. This is used by Perl_re_intuit_start() and S_find_byclass() + * in regexec.c + */ /* This is cheating. */ Newx(d->data[i], 1, regnode_ssc); StructCopy(ri->data->data[i], d->data[i], regnode_ssc); reti->regstclass = (regnode*)d->data[i]; break; case 'T': - /* Trie stclasses are readonly and can thus be shared + /* AHO-CORASICK fail table */ + /* Trie stclasses are readonly and can thus be shared * without duplication. We free the stclass in pregfree * when the corresponding reg_ac_data struct is freed. */ reti->regstclass= ri->regstclass; /* FALLTHROUGH */ case 't': + /* TRIE transition table */ OP_REFCNT_LOCK; ((reg_trie_data*)ri->data->data[i])->refcount++; OP_REFCNT_UNLOCK; /* FALLTHROUGH */ - case 'l': - case 'L': + case 'l': /* (?{...}) or (??{ ... }) code (cb->block) */ + case 'L': /* same when RExC_pm_flags & PMf_HAS_CV and code + is not from another regexp */ d->data[i] = ri->data->data[i]; break; default: -- Perl5 Master Repository
