Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: B::Xref buggy?

by dave_the_m (Monsignor)
on Nov 15, 2018 at 15:52 UTC ( [id://1225864]=note: print w/replies, xml ) Need Help??


in reply to Re^4: B::Xref buggy?
in thread B::Xref buggy?

I'm no expert on OP-Codes but that doesn't seem to be always the case.
Nothing you've shown me contradicts what I think is the problem.
So probably B::Xref is better implemented by extending B::Concise ?
That doesn't really make any sense. Both are implemented on top of of B.pm, which presents an op tree as a a connected collection of perl node objects which can be interrogated by suitable perl code. Concise does minimal work, just dumping the nodes in depth-first or execution order. Xref scans the same structure but does more clever things, which involves trying to keep track of the current line number.

Xref needs fixing by being smarter when scanning sub-nodes associated with nodes which have multiple execution paths.

Dave.

Replies are listed 'Best First'.
Re^6: B::Xref buggy?
by LanX (Saint) on Nov 15, 2018 at 15:57 UTC
    > That doesn't really make any sense.

    Let me elaborate:

    It's possible to apply a callback to Concise to handle the logic with B::Concise::add_callback

    This would make debugging much easier and more intuitive.

    I'll try as soon as I have closed other projects in the pipeline.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      It's possible to apply a callback to Concise to handle the logic with B::Concise::add_callback
      That still doesn't make any sense. That just allows a per-node callback to affect how Concise dumps nodes. It doesn't help with scanning the op tree in the correct order to keep track of line numbers. Concise doesn't track line numbers, nor does it allow you to customise the order in which nodes are scanned.

      Xref has all the logic to do that, it just needs tweaking.

      Dave.

        > Concise doesn't track line numbers,

        I'm confused ...did you look at the output I provided?

        This looks pretty much like the lexical order in the source which is needed to track variables and subs.

        and the line numbers are available:

        # 6: print "@row"; #: +line 6 - <;> ex-nextstate(main 7 tst_b_xref2.pl:6) v:*,&,x +*,x&,x$,$

        The -src option dumps the original source line just before every nextstate OP and the line number is available in tst_b_xref2.pl:6

        Could you please provide an example code where this behaviour is broken in the B::Concise output and information is lost?

        Probably I'm unaware of some Perl temporal magic ? ? ?

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1225864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-26 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found