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

What is PADMY for?

Thread Next
From:
Father Chrysostomos
Date:
September 22, 2014 00:41
Subject:
What is PADMY for?
Message ID:
20140922004130.22675.qmail@lists-nntp.develooper.com
If I write code like this:

    sub new {
        my($class,%args) = @_;
        return bless \my %args, shift
    }

then the object will have the PADMY flag on, and it will no longer
live in any pad.  (The originating pad will abandon it on sub exit.)
That does not cause any problems.

Since PADMY items are not necessarily in pads, what is PADMY for?

Currently the sole purpose of turning the flag on and off seems to
be to appease assertions here and there that expect the flag to be a
certain way.

Currently PADTMP and PADSTALE share a bit, and the setting of the
PADMY bit determines the meaning.

Since it is clear that the PADMY is harmless on random SVs, we could
assume that all SVs not marked PADTMP are implicitly PADMY, no?
(I.e., eliminate PADMY altogether

If we could eliminate PADMY and make PADSTALE use the PADMY bit,
we should be able to shrink the binary size and reduce internal
complexity.

For me, with ithreads and no debugging, pad.o is 26176 octets
currently, but 25632 if I eliminate PADMY and make SvPADTMP and
SvPADSTALE into simpler macros.

Further, it would save me from having to do inane things like:

    if (PL_op->op_private & OPpLVAL_INTRO) {
        SvPADMY_on(PAD_SV(ARGTARG));
        SAVECLEARSV(PAD_SVl(ARGTARG));
    }

where SvPADMY_on exists solely for the sake of assertions.


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