develooper Front page | perl.perl5.changes | Postings from March 2018

[perl.git] branch blead updated. v5.27.9-118-g49ea76a70e

From:
Dave Mitchell
Date:
March 6, 2018 15:30
Subject:
[perl.git] branch blead updated. v5.27.9-118-g49ea76a70e
Message ID:
E1etEY6-0002RD-Pv@git.dc.perl.space
In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/49ea76a70e8a4984b7d555bfbac872c0624b858c?hp=3f515a2edaad4fe95e69a30dcc8823e4d7353d43>

- Log -----------------------------------------------------------------
commit 49ea76a70e8a4984b7d555bfbac872c0624b858c
Author: David Mitchell <davem@iabyn.com>
Date:   Tue Mar 6 15:24:38 2018 +0000

    op_dump(): display op_next to self as [SELF]
    
    Normally op_next (and similar) fields of an op are displayed with the
    address and basic details of the op they point to, e.g.
    
        5    gvsv PADOP(0x1b7ac48) ===> 5 [sassign 0x1b7ab80]
    
    This commit enhances that so that if the field points back to the op
    containing the field (as is often the case during the early phases of
    building an op tree), instead display it as just:
    
        5    gvsv PADOP(0x1b7ac48) ===> [SELF]

-----------------------------------------------------------------------

Summary of changes:
 dump.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/dump.c b/dump.c
index 41b5f377b5..aeb9955688 100644
--- a/dump.c
+++ b/dump.c
@@ -610,10 +610,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
@@ -994,7 +996,7 @@ 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 */
 
@@ -1202,11 +1204,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:
@@ -1227,7 +1229,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:

-- 
Perl5 Master Repository



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