diff options
author | Nicolas R <nicolas@atoomic.org> | 2022-04-08 10:21:37 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-05-27 21:33:02 -0600 |
commit | 99df0210877da2cf8a8c220fc9cbe2d07ca989d7 (patch) | |
tree | cbe054dc0efb7f0855dbdaa1f48e42d9e91fbd08 /ext | |
parent | 2af2513acebd4252429a3df47ef0ddde748b7ae5 (diff) | |
download | perl-99df0210877da2cf8a8c220fc9cbe2d07ca989d7.tar.gz |
Extra B::PADNAME helpers: GEN and IsUndef
This commit adds two new helpers to B::PADNAME.
- IsUndef to check if the PADNAME is PL_padname_undef
- GEN to access to the xpadn_gen slot of the pad.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B.pm | 6 | ||||
-rw-r--r-- | ext/B/B.xs | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm index baf06acbd1..4047c13567 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -1351,6 +1351,8 @@ pointers and B::PADNAME objects otherwise. =item REFCNT +=item GEN + =item FLAGS For backward-compatibility, if the PADNAMEt_OUTER flag is set, the FLAGS @@ -1387,6 +1389,10 @@ Only meaningful if PADNAMEt_OUTER is set. Only meaningful if PADNAMEt_OUTER is set. +=item IsUndef + +Returns a boolean value to check if the padname is PL_padname_undef. + =back =head2 $B::overlay diff --git a/ext/B/B.xs b/ext/B/B.xs index b786f0fb0b..90424213a8 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -2264,6 +2264,8 @@ MODULE = B PACKAGE = B::PADNAME PREFIX = Padname sv_U32p | STRUCT_OFFSET(struct padname, xpadn_low) #define PN_cop_seq_range_high_ix \ sv_U32p | STRUCT_OFFSET(struct padname, xpadn_high) +#define PN_xpadn_gen_ix \ + sv_I32p | STRUCT_OFFSET(struct padname, xpadn_gen) #define PNL_refcnt_ix \ sv_U32p | STRUCT_OFFSET(struct padnamelist, xpadnl_refcnt) #define PL_id_ix \ @@ -2271,7 +2273,6 @@ MODULE = B PACKAGE = B::PADNAME PREFIX = Padname #define PL_outid_ix \ sv_U32p | STRUCT_OFFSET(struct padlist, xpadl_outid) - void PadnameTYPE(pn) B::PADNAME pn @@ -2282,6 +2283,7 @@ PadnameTYPE(pn) B::PADNAME::REFCNT = PN_refcnt_ix B::PADNAME::COP_SEQ_RANGE_LOW = PN_cop_seq_range_low_ix B::PADNAME::COP_SEQ_RANGE_HIGH = PN_cop_seq_range_high_ix + B::PADNAME::GEN = PN_xpadn_gen_ix B::PADNAMELIST::REFCNT = PNL_refcnt_ix B::PADLIST::id = PL_id_ix B::PADLIST::outid = PL_outid_ix @@ -2317,6 +2319,14 @@ PadnamePV(pn) SvUTF8_on(TARG); XPUSHTARG; +bool +PadnameIsUndef(padn) + B::PADNAME padn + CODE: + RETVAL = padn == &PL_padname_undef; + OUTPUT: + RETVAL + BOOT: { /* Uses less memory than an ALIAS. */ |