This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_match(): combine intuit and regexec branches
authorDavid Mitchell <davem@iabyn.com>
Sun, 16 Jun 2013 15:01:22 +0000 (16:01 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 28 Jul 2013 09:33:35 +0000 (10:33 +0100)
commit88ab22af59dbf74d9b6cb70f7d317be3b8ca8ced
tree4b4a5b2299fbf54340498218830987202c676b55
parentbe09e22d0f77d10c521bf791cab949087840932a
pp_match(): combine intuit and regexec branches

There was some code that looked roughly like:

    if (can_match_on_intuit_only) {
        ....
        goto yup;
    }
    if (!regexec())
        goto ret_no;

  gotcha:
    A; B;
    if (simple)
        RETURNYES;
    X; Y;
    RETURN;

  yup:
    A;
    if (!simple)
        goto gotcha;
    B;
    RETURNYES

Refactor it to look like

    if (can_match_on_intuit_only) {
        ....
        goto gotcha;
    }
    if (!regexec())
        goto ret_no;

  gotcha:
    A; B;
    if (simple)
        RETURNYES;
    X; Y;
    RETURN;

As well as simplifying the code, it also avoids duplicating some work
(the 'A' above was done twice sometimes) - harmless but less efficient.
pp_hot.c