re_intuit_start(): don't set ml_anch on BOL

re_intuit_start() decided that a pattern was capable of being anchored
after *any* \n in the string for a //m pattern that contains a BOL
(rather than an MBOL). This can happen by embedding one regex in another
for example.

This is an incorrect assumption, and means that intuit() might try
against every \n position in the string rather than just trying at the
beginning. With this commit, the following code on my machine reduces in
execution time from 7000ms to 5ms:

    my $r = qr/^abcd/;
    my $s = "abcd-xyz\n" x 500_000;
    $s =~ /$r\d{1,2}xyz/m for 1..200;
re_intuit_start(): change !ml_anch debugging msg

When MBOL (/^.../m) matching is skipped, the debugging output looks like:

    Starting position does not contradict /^/m...

which sounds a bit like the \n test *was* done and passed, rather than
the test being skipped. Change the message to:

    (multiline anchor test skipped)
re_intuit_start(): reduce scope of /^...$/m test

Intuit has a quick reject test for a fixed pattern that is anchored at
both ends. For example, with the pattern /^abcd$/, only the exact strings
"abcd" or "abcd\n" will match; anything else, and the match immediately
fails.

A fix for [perl #115242] correctly made intuit skip the test in the
presence of //m, since in this case the $ doesn't necessarily correspond
to the end of the string.

However, the fix was too wide in scope; it caused //m patterns to skip
searching for a known string anchored just at the start, as well as one
anchored at both ends.

With this commit, the following code now runs in a few milliseconds rather
than a few seconds on my machine:

    $s = "abcdefg" x 1_000_000;
    $s =~ /(?-m:^)abcX?fg/m for 1..100;
re_intuit_start(): do 'not at start' check on BOL

The quick reject test that says "if a pattern has an absolute anchor,
then immediately reject if strpos != strbeg", currently skips that test
if PREGf_ANCH_GPOS is present. Instead, skip unless BOL or SBOL is present.

This means that something like /^abc\G/ will still do the quick reject
test.

I can't think of any example that will actually give a measurable
performance boost, and this is a fairly unlikely scenario, but the code is
more logical this way, and makes it more robust against future changes
(it's less likely to suddenly skip the quick test where it used to do it).

I've also updated the commentary on why we don't do a quick /\G/ test
akin to the /^/ test, and added some more info about why we test for the
PREGf_IMPLICIT flag.

And I've added an assert about PREGf_IMPLICIT too.
re_intuit_start(): use better limit on anch float

The 'check' block of code has special handling for if the pattern is
anchored; in this case, it allows us to set an upper bound on where a
floating substring might match; e.g. in

    /^..\d?abc/

the floating string can't be more than 3 chars from the absolute beginning
of the string. Similarly with /..\G\d?abc/, it can't be more than 3 chars
from the start position (assuming that position been calculated correctly
by the caller).

However, the current code used rx_origin as the base for the offset
calculation, rather than strbeg/strpos as appropriate. This meant that

a) the first time round the loop, if strpos > strbeg, then the upper bound
would be set higher than needed;
b) if we ever go back to restart: with an incremented rx_origin, then the
upper limit is recalculated with more wasted slack at the latter end.

This commit changes the limit calculation, which reduces the following
from second to milliseconds:

    $s = "abcdefg" x 1_000_000;
    $s =~ /^XX\d{1,10}cde/ for 1..100;

It also adds a quick test to skip hopping when the result is likely to
leave end_point unchanged, and adds an explicit test for !PREGf_IMPLICIT.
This latter test isn't strictly necessary, as if PREGf_IMPLICIT were set,
it implies that the pattern starts with '.*', which implies that
prog->check_offset_max == SSize_t_MAX, which is already tested for.
However, it makes the overall condition more comprehensible, and makes it
more robust in the face of future changes.
re_intuit_start(): check for IMPLICIT in stclass

In the stclass block of code, there are various checks for anchored-ness.
Add !(prog->intflags & PREGf_IMPLICIT) to these conditions, since
from the perspective of these tests, we can only quit early etc if these
are real rather than fake anchors.

As it happens, this currently makes no logical difference, since an
PREGf_IMPLICIT pattern starts with .*, and so more or less by definition
can't have an stclass.

So this commit is really only for logical completeness, and to allow us to
change the definition of ml_anch shortly.
re_intuit_start(): check for IMPLICIT in abs anch

The block of code that deals with absolute anchors looks like:

    if (...) {
        if (.... && !PREGf_IMPLICIT) ...;
        if (FOO) {
            assert(!PREGf_IMPLICIT);
            ....
        }
    }

where the constraints of FOO imply PREGf_IMPLICIT, as shown by the
assertion. Simplify this to:

    if (... && !PREGf_IMPLICIT) {
        if (....) ...;
        if (FOO) {
            ....
        }
    }
re_intuit_start(): change definition of ml_anch

The ml_anch variable is supposed to indicate that a multi-line match is
possible, i.e. that the regex is anchored to a \n.

Currently we just do

    ml_anch = (prog->intflags & PREGf_ANCH_MBOL);

However, MBOL is also set on /.*..../; the two cases are distinguished by
adding the PREGf_IMPLICIT flag too.

So at the moment we have lots of tests along the lines of

    if (ml_anch && !(prog->intflags & PREGf_IMPLICIT))

Simplify this by adding the IMPLICIT condition when initially calculating
ml_anch, so there's no need to keep testing for it later. This also means
that ml_anch actually means what it says now.
re_intuit_start(): don't unset MBOL on uselessness

When BmUSEFUL() for a pattern goes negative, we unset ~RXf_USE_INTUIT.

A bug fix in 2010 (c941595168) made this part of the code also remove
the RXf_ANCH_MBOL at the same time, if PREGf_IMPLICIT was set.

However, this was really just working round a bug in regexec_flags().
Once intuit was disabled, regexec_flags() would then start taking the
buggy code path.

This buggy code path was separately fixed in 2012 by 21eede782, so there's
no longer any need to remove this flag. So don't.
re_intuit_start(): move comments abut IMPLICIT

After the previous reworking of the PREGf_IMPLICIT tests, move commentary
about PREGf_IMPLICIT closer to where its now relevant.
[MERGE] audit anchoring in re_intuit_start()

This series of commits audits all the code in re_intuit_start()
that handles anchoring, e.g. /^.../, /^.../m, /\G.../.

It fixes a couple of potential performance issues, and makes the code a
lot safer with with \G. (Until recently, intuit was skipped altogether
under \G, so its \G handling isn't well developed and tested.)