This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: regpiece() Don't match 0 length more than once
[perl5.git] / dump.c
diff --git a/dump.c b/dump.c
index 1628ca3..e395790 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -21,7 +21,7 @@
  *
  * It also holds the debugging version of the  runops function.
 
-=head1 Display and Dump functions
+=for apidoc_section Display and Dump functions
  */
 
 #include "EXTERN.h"
@@ -132,6 +132,23 @@ sequences, whereas C<"%"> is not a particularly common character in patterns.
 
 Returns a pointer to the escaped text as held by C<dsv>.
 
+=for apidoc Amnh||PERL_PV_ESCAPE_ALL
+=for apidoc Amnh||PERL_PV_ESCAPE_FIRSTCHAR
+=for apidoc Amnh||PERL_PV_ESCAPE_NOBACKSLASH
+=for apidoc Amnh||PERL_PV_ESCAPE_NOCLEAR
+=for apidoc Amnh||PERL_PV_ESCAPE_NONASCII
+=for apidoc Amnh||PERL_PV_ESCAPE_QUOTE
+=for apidoc Amnh||PERL_PV_ESCAPE_RE
+=for apidoc Amnh||PERL_PV_ESCAPE_UNI
+=for apidoc Amnh||PERL_PV_ESCAPE_UNI_DETECT
+
+=cut
+
+Unused or not for public use
+=for apidoc Cmnh||PERL_PV_PRETTY_REGPROP
+=for apidoc Cmnh||PERL_PV_PRETTY_DUMP
+=for apidoc Cmnh||PERL_PV_PRETTY_NOCLEAR
+
 =cut
 */
 #define PV_ESCAPE_OCTBUFSIZE 32
@@ -267,6 +284,10 @@ any quotes or ellipses.
 
 Returns a pointer to the prettified text as held by C<dsv>.
 
+=for apidoc Amnh||PERL_PV_PRETTY_QUOTE
+=for apidoc Amnh||PERL_PV_PRETTY_LTGT
+=for apidoc Amnh||PERL_PV_PRETTY_ELLIPSES
+
 =cut           
 */
 
@@ -353,7 +374,6 @@ Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pv
 char *
 Perl_sv_peek(pTHX_ SV *sv)
 {
-    dVAR;
     SV * const t = sv_newmortal();
     int unref = 0;
     U32 type;
@@ -361,26 +381,26 @@ Perl_sv_peek(pTHX_ SV *sv)
     SvPVCLEAR(t);
   retry:
     if (!sv) {
-       sv_catpv(t, "VOID");
+       sv_catpvs(t, "VOID");
        goto finish;
     }
     else if (sv == (const SV *)0x55555555 || ((char)SvTYPE(sv)) == 'U') {
         /* detect data corruption under memory poisoning */
-       sv_catpv(t, "WILD");
+       sv_catpvs(t, "WILD");
        goto finish;
     }
     else if (  sv == &PL_sv_undef || sv == &PL_sv_no || sv == &PL_sv_yes
             || sv == &PL_sv_zero || sv == &PL_sv_placeholder)
     {
        if (sv == &PL_sv_undef) {
-           sv_catpv(t, "SV_UNDEF");
+           sv_catpvs(t, "SV_UNDEF");
            if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
                                 SVs_GMG|SVs_SMG|SVs_RMG)) &&
                SvREADONLY(sv))
                goto finish;
        }
        else if (sv == &PL_sv_no) {
-           sv_catpv(t, "SV_NO");
+           sv_catpvs(t, "SV_NO");
            if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
                                 SVs_GMG|SVs_SMG|SVs_RMG)) &&
                !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
@@ -390,7 +410,7 @@ Perl_sv_peek(pTHX_ SV *sv)
                goto finish;
        }
        else if (sv == &PL_sv_yes) {
-           sv_catpv(t, "SV_YES");
+           sv_catpvs(t, "SV_YES");
            if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
                                 SVs_GMG|SVs_SMG|SVs_RMG)) &&
                !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
@@ -401,7 +421,7 @@ Perl_sv_peek(pTHX_ SV *sv)
                goto finish;
        }
        else if (sv == &PL_sv_zero) {
-           sv_catpv(t, "SV_ZERO");
+           sv_catpvs(t, "SV_ZERO");
            if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
                                 SVs_GMG|SVs_SMG|SVs_RMG)) &&
                !(~SvFLAGS(sv) & (SVf_POK|SVf_NOK|SVf_READONLY|
@@ -412,16 +432,16 @@ Perl_sv_peek(pTHX_ SV *sv)
                goto finish;
        }
        else {
-           sv_catpv(t, "SV_PLACEHOLDER");
+           sv_catpvs(t, "SV_PLACEHOLDER");
            if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
                                 SVs_GMG|SVs_SMG|SVs_RMG)) &&
                SvREADONLY(sv))
                goto finish;
        }
-       sv_catpv(t, ":");
+       sv_catpvs(t, ":");
     }
     else if (SvREFCNT(sv) == 0) {
-       sv_catpv(t, "(");
+       sv_catpvs(t, "(");
        unref++;
     }
     else if (DEBUG_R_TEST_) {
@@ -445,11 +465,11 @@ Perl_sv_peek(pTHX_ SV *sv)
     }
 
     if (SvROK(sv)) {
-       sv_catpv(t, "\\");
+       sv_catpvs(t, "\\");
        if (SvCUR(t) + unref > 10) {
            SvCUR_set(t, unref + 3);
            *SvEND(t) = '\0';
-           sv_catpv(t, "...");
+           sv_catpvs(t, "...");
            goto finish;
        }
        sv = SvRV(sv);
@@ -469,16 +489,16 @@ Perl_sv_peek(pTHX_ SV *sv)
        if (type == SVt_NULL)
            goto finish;
     } else {
-       sv_catpv(t, "FREED");
+       sv_catpvs(t, "FREED");
        goto finish;
     }
 
     if (SvPOKp(sv)) {
        if (!SvPVX_const(sv))
-           sv_catpv(t, "(null)");
+           sv_catpvs(t, "(null)");
        else {
            SV * const tmp = newSVpvs("");
-           sv_catpv(t, "(");
+           sv_catpvs(t, "(");
            if (SvOOK(sv)) {
                STRLEN delta;
                SvOOK_offset(sv, delta);
@@ -493,9 +513,10 @@ Perl_sv_peek(pTHX_ SV *sv)
        }
     }
     else if (SvNOKp(sv)) {
-       STORE_LC_NUMERIC_UNDERLYING_SET_STANDARD();
+        DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
+        STORE_LC_NUMERIC_SET_STANDARD();
        Perl_sv_catpvf(aTHX_ t, "(%" NVgf ")",SvNVX(sv));
-       RESTORE_LC_NUMERIC_UNDERLYING();
+        RESTORE_LC_NUMERIC();
     }
     else if (SvIOKp(sv)) {
        if (SvIsUV(sv))
@@ -504,20 +525,16 @@ Perl_sv_peek(pTHX_ SV *sv)
             Perl_sv_catpvf(aTHX_ t, "(%" IVdf ")", (IV)SvIVX(sv));
     }
     else
-       sv_catpv(t, "()");
+       sv_catpvs(t, "()");
 
   finish:
     while (unref--)
-       sv_catpv(t, ")");
+       sv_catpvs(t, ")");
     if (TAINTING_get && sv && SvTAINTED(sv))
-       sv_catpv(t, " [tainted]");
+       sv_catpvs(t, " [tainted]");
     return SvPV_nolen(t);
 }
 
-/*
-=head1 Debugging Utilities
-*/
-
 void
 Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
 {
@@ -609,10 +626,12 @@ S_opdump_indent(pTHX_ const OP *o, I32 level, UV bar, PerlIO *file,
  */
 
 static void
-S_opdump_link(pTHX_ const OP *o, PerlIO *file)
+S_opdump_link(pTHX_ const OP *base, const OP *o, PerlIO *file)
 {
     PerlIO_puts(file, " ===> ");
-    if (o)
+    if (o == base)
+        PerlIO_puts(file, "[SELF]\n");
+    else if (o)
         PerlIO_printf(file, "%" UVuf " [%s 0x%" UVxf "]\n",
             sequence_num(o), OP_NAME(o), PTR2UV(o));
     else
@@ -872,26 +891,26 @@ S_pm_description(pTHX_ const PMOP *pm)
     PERL_ARGS_ASSERT_PM_DESCRIPTION;
 
     if (pmflags & PMf_ONCE)
-       sv_catpv(desc, ",ONCE");
+       sv_catpvs(desc, ",ONCE");
 #ifdef USE_ITHREADS
     if (SvREADONLY(PL_regex_pad[pm->op_pmoffset]))
-        sv_catpv(desc, ":USED");
+        sv_catpvs(desc, ":USED");
 #else
     if (pmflags & PMf_USED)
-        sv_catpv(desc, ":USED");
+        sv_catpvs(desc, ":USED");
 #endif
 
     if (regex) {
         if (RX_ISTAINTED(regex))
-            sv_catpv(desc, ",TAINTED");
+            sv_catpvs(desc, ",TAINTED");
         if (RX_CHECK_SUBSTR(regex)) {
             if (!(RX_INTFLAGS(regex) & PREGf_NOSCAN))
-                sv_catpv(desc, ",SCANFIRST");
+                sv_catpvs(desc, ",SCANFIRST");
             if (RX_EXTFLAGS(regex) & RXf_CHECK_ALL)
-                sv_catpv(desc, ",ALL");
+                sv_catpvs(desc, ",ALL");
         }
         if (RX_EXTFLAGS(regex) & RXf_SKIPWHITE)
-            sv_catpv(desc, ",SKIPWHITE");
+            sv_catpvs(desc, ",SKIPWHITE");
     }
 
     append_flags(desc, pmflags, pmflags_flags_names);
@@ -912,7 +931,6 @@ Perl_pmop_dump(pTHX_ PMOP *pm)
 STATIC UV
 S_sequence_num(pTHX_ const OP *o)
 {
-    dVAR;
     SV     *op,
           **seq;
     const char *key;
@@ -993,10 +1011,35 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
 
     PerlIO_printf(file, " %s(0x%" UVxf ")",
                     op_class_names[op_class(o)], PTR2UV(o));
-    S_opdump_link(aTHX_ o->op_next, file);
+    S_opdump_link(aTHX_ o, o->op_next, file);
 
     /* print op common fields */
 
+    if (level == 0) {
+        S_opdump_indent(aTHX_ o, level, bar, file, "PARENT");
+        S_opdump_link(aTHX_ o, op_parent((OP*)o), file);
+    }
+    else if (!OpHAS_SIBLING(o)) {
+        bool ok = TRUE;
+        OP *p = o->op_sibparent;
+        if (!p || !(p->op_flags & OPf_KIDS))
+            ok = FALSE;
+        else {
+            OP *kid = cUNOPx(p)->op_first;
+            while (kid != o) {
+                kid = OpSIBLING(kid);
+                if (!kid) {
+                    ok = FALSE;
+                    break;
+                }
+            }
+        }
+        if (!ok) {
+            S_opdump_indent(aTHX_ o, level, bar, file,
+                            "*** WILD PARENT 0x%p\n", p);
+        }
+    }
+
     if (o->op_targ && optype != OP_NULL)
            S_opdump_indent(aTHX_ o, level, bar, file, "TARG = %ld\n",
                 (long)o->op_targ);
@@ -1005,16 +1048,16 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
         SV * const tmpsv = newSVpvs("");
         switch (o->op_flags & OPf_WANT) {
         case OPf_WANT_VOID:
-            sv_catpv(tmpsv, ",VOID");
+            sv_catpvs(tmpsv, ",VOID");
             break;
         case OPf_WANT_SCALAR:
-            sv_catpv(tmpsv, ",SCALAR");
+            sv_catpvs(tmpsv, ",SCALAR");
             break;
         case OPf_WANT_LIST:
-            sv_catpv(tmpsv, ",LIST");
+            sv_catpvs(tmpsv, ",LIST");
             break;
         default:
-            sv_catpv(tmpsv, ",UNKNOWN");
+            sv_catpvs(tmpsv, ",UNKNOWN");
             break;
         }
         append_flags(tmpsv, o->op_flags, op_flags_names);
@@ -1078,10 +1121,10 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
                         /* don't display anonymous zero values */
                         continue;
 
-                    sv_catpv(tmpsv, ",");
+                    sv_catpvs(tmpsv, ",");
                     if (label != -1) {
                         sv_catpv(tmpsv, &PL_op_private_labels[label]);
-                        sv_catpv(tmpsv, "=");
+                        sv_catpvs(tmpsv, "=");
                     }
                     if (enum_label == -1)
                         Perl_sv_catpvf(aTHX_ tmpsv, "0x%" UVxf, (UV)val);
@@ -1096,13 +1139,13 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
                              && PL_op_private_labels[ix+1] == '\0'))
                     {
                         oppriv -= (1<<bit);
-                        sv_catpv(tmpsv, ",");
+                        sv_catpvs(tmpsv, ",");
                         sv_catpv(tmpsv, &PL_op_private_labels[ix]);
                     }
                 }
             }
             if (oppriv) {
-                sv_catpv(tmpsv, ",");
+                sv_catpvs(tmpsv, ",");
                 Perl_sv_catpvf(aTHX_ tmpsv, "0x%" UVxf, (UV)oppriv);
             }
         }
@@ -1141,6 +1184,15 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
        break;
     }
 
+    case OP_MULTICONCAT:
+       S_opdump_indent(aTHX_ o, level, bar, file, "NARGS = %" IVdf "\n",
+            (IV)cUNOP_AUXo->op_aux[PERL_MULTICONCAT_IX_NARGS].ssize);
+        /* XXX really ought to dump each field individually,
+         * but that's too much like hard work */
+       S_opdump_indent(aTHX_ o, level, bar, file, "CONSTS = (%" SVf ")\n",
+            SVfARG(multiconcat_stringify(o)));
+       break;
+
     case OP_CONST:
     case OP_HINTSEVAL:
     case OP_METHOD_NAMED:
@@ -1192,11 +1244,11 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
     case OP_ENTERITER:
     case OP_ENTERLOOP:
        S_opdump_indent(aTHX_ o, level, bar, file, "REDO");
-        S_opdump_link(aTHX_ cLOOPo->op_redoop, file);
+        S_opdump_link(aTHX_ o, cLOOPo->op_redoop, file);
        S_opdump_indent(aTHX_ o, level, bar, file, "NEXT");
-        S_opdump_link(aTHX_ cLOOPo->op_nextop, file);
+        S_opdump_link(aTHX_ o, cLOOPo->op_nextop, file);
        S_opdump_indent(aTHX_ o, level, bar, file, "LAST");
-        S_opdump_link(aTHX_ cLOOPo->op_lastop, file);
+        S_opdump_link(aTHX_ o, cLOOPo->op_lastop, file);
        break;
 
     case OP_REGCOMP:
@@ -1217,7 +1269,7 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
     case OP_ENTERTRY:
     case OP_ONCE:
        S_opdump_indent(aTHX_ o, level, bar, file, "OTHER");
-        S_opdump_link(aTHX_ cLOGOPo->op_other, file);
+        S_opdump_link(aTHX_ o, cLOGOPo->op_other, file);
        break;
     case OP_SPLIT:
     case OP_MATCH:
@@ -1254,10 +1306,42 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
 
     case OP_TRANS:
     case OP_TRANSR:
+        if (o->op_private & OPpTRANS_USE_SVOP) {
+            /* utf8: table stored as an inversion map */
+#ifndef USE_ITHREADS
+       /* with ITHREADS, it is stored in the pad, and the right pad
+        * may not be active here, so skip */
             S_opdump_indent(aTHX_ o, level, bar, file,
-                            "PV = 0x%" UVxf "\n",
-                            PTR2UV(cPVOPo->op_pv));
-            break;
+                            "INVMAP = 0x%" UVxf "\n",
+                            PTR2UV(MUTABLE_SV(cSVOPo->op_sv)));
+#endif
+        }
+        else {
+            const OPtrans_map * const tbl = (OPtrans_map*)cPVOPo->op_pv;
+            SSize_t i, size = tbl->size;
+
+            S_opdump_indent(aTHX_ o, level, bar, file,
+                            "TABLE = 0x%" UVxf "\n",
+                            PTR2UV(tbl));
+            S_opdump_indent(aTHX_ o, level, bar, file,
+                "  SIZE: 0x%" UVxf "\n", (UV)size);
+
+            /* dump size+1 values, to include the extra slot at the end */
+            for (i = 0; i <= size; i++) {
+                short val = tbl->map[i];
+                if ((i & 0xf) == 0)
+                    S_opdump_indent(aTHX_ o, level, bar, file,
+                        " %4" UVxf ":", (UV)i);
+                if (val < 0)
+                    PerlIO_printf(file, " %2"  IVdf, (IV)val);
+                else
+                    PerlIO_printf(file, " %02" UVxf, (UV)val);
+
+                if ( i == size || (i & 0xf) == 0xf)
+                    PerlIO_printf(file, "\n");
+            }
+        }
+        break;
 
 
     default:
@@ -1341,9 +1425,9 @@ Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest, I32
     PERL_ARGS_ASSERT_DO_MAGIC_DUMP;
 
     for (; mg; mg = mg->mg_moremagic) {
-       Perl_dump_indent(aTHX_ level, file,
+        Perl_dump_indent(aTHX_ level, file,
                         "  MAGIC = 0x%" UVxf "\n", PTR2UV(mg));
-       if (mg->mg_virtual) {
+        if (mg->mg_virtual) {
             const MGVTBL * const v = mg->mg_virtual;
            if (v >= PL_magic_vtables
                && v < PL_magic_vtables + magic_vtable_max) {
@@ -1674,22 +1758,22 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
                   (int)(PL_dumpindent*level), "");
 
     if ((flags & SVs_PADSTALE))
-           sv_catpv(d, "PADSTALE,");
+           sv_catpvs(d, "PADSTALE,");
     if ((flags & SVs_PADTMP))
-           sv_catpv(d, "PADTMP,");
+           sv_catpvs(d, "PADTMP,");
     append_flags(d, flags, first_sv_flags_names);
     if (flags & SVf_ROK)  {    
-                               sv_catpv(d, "ROK,");
-       if (SvWEAKREF(sv))      sv_catpv(d, "WEAKREF,");
+                                sv_catpvs(d, "ROK,");
+       if (SvWEAKREF(sv))      sv_catpvs(d, "WEAKREF,");
     }
     if (flags & SVf_IsCOW && type != SVt_PVHV) sv_catpvs(d, "IsCOW,");
     append_flags(d, flags, second_sv_flags_names);
     if (flags & SVp_SCREAM && type != SVt_PVHV && !isGV_with_GP(sv)
                           && type != SVt_PVAV) {
        if (SvPCS_IMPORTED(sv))
-                               sv_catpv(d, "PCS_IMPORTED,");
+                               sv_catpvs(d, "PCS_IMPORTED,");
        else
-                               sv_catpv(d, "SCREAM,");
+                               sv_catpvs(d, "SCREAM,");
     }
 
     /* process type-specific SV flags */
@@ -1708,19 +1792,19 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
            append_flags(d, GvFLAGS(sv), gp_flags_names);
        }
        if (isGV_with_GP(sv) && GvIMPORTED(sv)) {
-           sv_catpv(d, "IMPORT");
+           sv_catpvs(d, "IMPORT");
            if (GvIMPORTED(sv) == GVf_IMPORTED)
-               sv_catpv(d, "ALL,");
+               sv_catpvs(d, "ALL,");
            else {
-               sv_catpv(d, "(");
+               sv_catpvs(d, "(");
                append_flags(d, GvFLAGS(sv), gp_flags_imported_names);
-               sv_catpv(d, " ),");
+               sv_catpvs(d, " ),");
            }
        }
        /* FALLTHROUGH */
     case SVt_PVMG:
     default:
-       if (SvIsUV(sv) && !(flags & SVf_ROK))   sv_catpv(d, "IsUV,");
+       if (SvIsUV(sv) && !(flags & SVf_ROK))   sv_catpvs(d, "IsUV,");
        break;
 
     case SVt_PVAV:
@@ -1728,13 +1812,13 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
     }
     /* SVphv_SHAREKEYS is also 0x20000000 */
     if ((type != SVt_PVHV) && SvUTF8(sv))
-        sv_catpv(d, "UTF8");
+        sv_catpvs(d, "UTF8");
 
     if (*(SvEND(d) - 1) == ',') {
         SvCUR_set(d, SvCUR(d) - 1);
        SvPVX(d)[SvCUR(d)] = '\0';
     }
-    sv_catpv(d, ")");
+    sv_catpvs(d, ")");
     s = SvPVX_const(d);
 
     /* dump initial SV details */
@@ -1785,9 +1869,10 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
                && type != SVt_PVCV && type != SVt_PVFM  && type != SVt_REGEXP
                && type != SVt_PVIO && !isGV_with_GP(sv) && !SvVALID(sv))
               || type == SVt_NV) {
-       STORE_LC_NUMERIC_UNDERLYING_SET_STANDARD();
+        DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
+        STORE_LC_NUMERIC_SET_STANDARD();
        Perl_dump_indent(aTHX_ level, file, "  NV = %.*" NVgf "\n", NV_DIG, SvNVX(sv));
-       RESTORE_LC_NUMERIC_UNDERLYING();
+        RESTORE_LC_NUMERIC();
     }
 
     if (SvROK(sv)) {
@@ -1840,7 +1925,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
             }
            Perl_dump_indent(aTHX_ level, file, "  CUR = %" IVdf "\n", (IV)SvCUR(sv));
            if (re && type == SVt_PVLV)
-                /* LV-as-REGEXP usurps len field to store poiunter to
+                /* LV-as-REGEXP usurps len field to store pointer to
                  * regexp struct */
                Perl_dump_indent(aTHX_ level, file, "  REGEXP = 0x%" UVxf "\n",
                    PTR2UV(((XPV*)SvANY(sv))->xpv_len_u.xpvlenu_rx));
@@ -1888,8 +1973,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
        Perl_dump_indent(aTHX_ level, file, "  MAX = %" IVdf "\n",
                                (IV)AvMAX(sv));
         SvPVCLEAR(d);
-       if (AvREAL(sv)) sv_catpv(d, ",REAL");
-       if (AvREIFY(sv))        sv_catpv(d, ",REIFY");
+       if (AvREAL(sv)) sv_catpvs(d, ",REAL");
+       if (AvREIFY(sv))        sv_catpvs(d, ",REIFY");
        Perl_dump_indent(aTHX_ level, file, "  FLAGS = (%s)\n",
                         SvCUR(d) ? SvPVX_const(d) + 1 : "");
        if (nest < maxnest && AvARRAY(MUTABLE_AV(sv))) {
@@ -2728,6 +2813,47 @@ Perl_multideref_stringify(pTHX_ const OP *o, CV *cv)
 }
 
 
+/* Return a temporary SV containing a stringified representation of
+ * the op_aux field of a MULTICONCAT op. Note that if the aux contains
+ * both plain and utf8 versions of the const string and indices, only
+ * the first is displayed.
+ */
+
+SV*
+Perl_multiconcat_stringify(pTHX_ const OP *o)
+{
+    UNOP_AUX_item *aux = cUNOP_AUXo->op_aux;
+    UNOP_AUX_item *lens;
+    STRLEN len;
+    SSize_t nargs;
+    char *s;
+    SV *out = newSVpvn_flags("", 0, SVs_TEMP);
+
+    PERL_ARGS_ASSERT_MULTICONCAT_STRINGIFY;
+
+    nargs = aux[PERL_MULTICONCAT_IX_NARGS].ssize;
+    s   = aux[PERL_MULTICONCAT_IX_PLAIN_PV].pv;
+    len = aux[PERL_MULTICONCAT_IX_PLAIN_LEN].ssize;
+    if (!s) {
+        s   = aux[PERL_MULTICONCAT_IX_UTF8_PV].pv;
+        len = aux[PERL_MULTICONCAT_IX_UTF8_LEN].ssize;
+        sv_catpvs(out, "UTF8 ");
+    }
+    pv_pretty(out, s, len, 50,
+                NULL, NULL,
+                (PERL_PV_PRETTY_NOCLEAR
+                |PERL_PV_PRETTY_QUOTE
+                |PERL_PV_PRETTY_ELLIPSES));
+
+    lens = aux + PERL_MULTICONCAT_IX_LENGTHS;
+    while (nargs-- >= 0) {
+        Perl_sv_catpvf(aTHX_ out, ",%" IVdf, (IV)lens->ssize);
+        lens++;
+    }
+    return out;
+}
+
+
 I32
 Perl_debop(pTHX_ const OP *o)
 {
@@ -2772,6 +2898,11 @@ Perl_debop(pTHX_ const OP *o)
             SVfARG(multideref_stringify(o, deb_curcv(cxstack_ix))));
         break;
 
+    case OP_MULTICONCAT:
+        PerlIO_printf(Perl_debug_log, "(%" SVf ")",
+            SVfARG(multiconcat_stringify(o)));
+        break;
+
     default:
        break;
     }
@@ -2855,11 +2986,10 @@ Perl_op_class(pTHX_ const OP *o)
          * pointer to a table of shorts used to look up translations.
          * Under utf8, however, a simple table isn't practical; instead,
          * the OP is an SVOP (or, under threads, a PADOP),
-         * and the SV is a reference to a swash
-         * (i.e., an RV pointing to an HV).
+         * and the SV is an AV.
          */
        return (!custom &&
-                  (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
+                  (o->op_private & OPpTRANS_USE_SVOP)
               )
 #if  defined(USE_ITHREADS)
                ? OPclass_PADOP : OPclass_PVOP;