develooper Front page | perl.perl5.porters | Postings from October 2014

Inlining sub(){ return 4 } etc.

Thread Next
From:
Father Chrysostomos
Date:
October 30, 2014 15:44
Subject:
Inlining sub(){ return 4 } etc.
Message ID:
20141030154359.20116.qmail@lists-nntp.develooper.com
At one point, subroutines like sub(){die if 0; 4} and sub(){return 5}
were inlined.  See the pp_const argument to print in the output below.

That was broken in fe5e78ed in 1998, which checked the values of con-
stants in determining whether to emit warnings about constant sub
redefinitions.

Is it worth restoring this behaviour?

[sprout@dromedary-001 ~]$ /home/tux/perls/bin/perl5.00504 -MO=Terse -e 'sub foo(){die if 0;4} print foo'
-e syntax OK
LISTOP (0x8c464b8) pp_leave
    OP (0x8c3f868) pp_enter
    COP (0x8cd1e88) pp_nextstate
    LISTOP (0x8c46558) pp_print
        OP (0x8c46748) pp_pushmark
        SVOP (0x8c46618) pp_const  IV (0x8c43050) 4
[sprout@dromedary-001 ~]$ /home/tux/perls/bin/perl5.00504 -MO=Terse -e 'sub foo(){return 5} print foo'
-e syntax OK
LISTOP (0x9614898) pp_leave
    OP (0x9614868) pp_enter
    COP (0x967ba08) pp_nextstate
    LISTOP (0x961b4c0) pp_print
        OP (0x961b750) pp_pushmark
        SVOP (0x961b620) pp_const  IV (0x9618034) 5


Thread Next


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