Allow COW with magical and blessed scalars (among others)
Under PERL_NEW_COPY_ON_WRITE (and I suspect under
PERL_OLD_COPY_ON_WRITE, too, but have not confirmed) it is harmless to
do copy-on-write with a magical or blessed scalar.
Also, under PERL_NEW_COPY_ON_WRITE, it is safe to do copy-on-write
with scalars that have numbers in them as well as strings (though not
under PERL_OLD_COPY_ON_WRITE).
So redefine CAN_COW_MASK under PERL_NEW_COPY_ON_WRITE to be less
restrictive. We still can’t do it when the SvOOK hack is in place,
and I don’t feel comfortable doing it with regexps, even if it could
be proven feasible (regexps are SVf_FAKE, so that covers them).
Anything SvROK cannot be SvPOK, so obviously we can’t COW with that,
but I left SVf_ROK in for good measure.
This change to CAN_COW_MASK affects whether non-cow scalars will be
turned into cows in sv_setsv_flags. It is already possible for exist-
ing cows to become magical, blessed or numeric elsewhere.
Also, we don’t need to check the flags on the lhs in sv_setsv_flags,
except for SVf_BREAK. This is similar to
ecd5fa70f3, but applies to
another branch just below it.
pp_subst needs a little bit of adjustment, as it is not expecting a
vstring to turn into a cow.