develooper Front page | perl.perl5.porters | Postings from November 2010

Re: [perl #78656] [PATCH] Allow push/pop/keys/etc to act on references

Thread Previous
From:
demerphq
Date:
November 1, 2010 02:41
Subject:
Re: [perl #78656] [PATCH] Allow push/pop/keys/etc to act on references
Message ID:
AANLkTim=anQu9Bo1djeT0RC9eo0ByT27NXyZdmGO82SX@mail.gmail.com
On 1 November 2010 00:18, Father Chrysostomos via RT
<perlbug-comment@perl.org> wrote:
> On Thu Oct 28 09:50:54 2010, demerphq wrote:
>>
>> /me goes back to sleep
>>
>> yves
>
> Wait! could you look at bugs 68564, 70998 and 78356 first? Or am I too
> late? :-)

68564: Your patch doesn't *feel* right to me, like its addressing the
symptom and not the cause. I need to poke deeper later.
70998: Similar story. As far as i remember

 /\xab|\xa9/

should be handled by the trie optimisation, and then converted into a
charclass (ANYOF). So the question is why doesnt this problem also
occur with

 /[\xab\xa9]/

? Im not saying the patch is wrong, just it doesnt clarify this aspect
of things.

78356: Ihis is an interesting case. IMO there are a few things at play
here. First is that we go through a phase during optimisation where we
join consequtive EXACT nodes together. The original code used to
produce one EXACT node per character, later it was realized that
merging them made a big difference. However it seems the case of
NOTHING EXACT doesnt get reduced (properly) to EXACT alone.

IIRC that is what this output is:
                |  13|            tail~ BRANCH (9) -> TAIL
                |    |            tsdy~ NOTHING (3) -> PSEUDO
                |    |                ~ EXACT <foo> (4) -> EXACT
                |    |                ~ attach to TAIL (12) offset to 8
                |    |            tsdy~ EXACT <bar> (7) -> EXACT
                |    |                ~ attach to TAIL (12) offset to 5
                |    |            tsdy~ EXACT <zot> (10) -> EXACT
                |    |                ~ attach to TAIL (12) offset to 2

Next, it appears that the jump trie code isnt working for the case of
NOTHING. which is a separate problem.

We see this in action here:

Final program:
   1: SBOL (2)
   2: TRIE-EXACT<S:1/7 W:3 L:0/3 C:6/6>[bz] (13)
      <> (4)
   4:   EXACT <foo> (13)
      <bar> (13)
      <zot> (13)
  13: EOS (14)
  14: END (0)
anchored ""$ at 3 anchored(SBOL) minlen 3
r->extflags: ANCH_SBOL
Matching REx "\A(?:(?:)foo|bar|zot)\z" against "foo"
  Setting an EVAL scope, savestack=3
regmatch start
   0 <> <foo>                |  1:SBOL(2)
   0 <> <foo>                |  2:TRIE-EXACT<S:1/7 W:3 L:0/3 C:6/6>[bz](13)
                                  matched empty string...
   0 <> <foo>                | 13:EOS(14)
                                  failed...


Where we expect to execute node 4 after the "matched empty string",
yet we did not. For some reason we didnt "jump" but execute a "normal"
trie.

Ill try to dig further later on when I have more time. I hope this is
helpful to you.

cheers,
Yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About