xcv_depth into the IV union saves 4(ish) bytes per CV and format.
"ish" because it was a long, but has been changed to I32 (along with
the corresponding field in struct block_sub) so as not to enlarge the
IV union on platforms where sizeof(long) > sizeof(IV), or struct
block_sub where sizeof(long) > sizeof(I32)
p4raw-id: //depot/perl@27247
GV * dfoutgv;
AV * savearray;
AV * argarray;
- long olddepth;
+ I32 olddepth;
U8 hasargs;
U8 lval; /* XXX merge lval and hasargs? */
PAD *oldcomppad;
STRLEN xpv_cur; /* length of xp_pv as a C string */
STRLEN xpv_len; /* allocated size */
union {
- IV xivu_iv; /* integer value or pv offset */
+ IV xivu_iv;
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32; /* depth, >= 2 indicates recursive call */
} xiv_u;
MAGIC* xmg_magic; /* magic for scalar array */
HV* xmg_stash; /* class package */
} xcv_root_u;
GV * xcv_gv;
char * xcv_file;
- long xcv_depth; /* >= 2 indicates recursive call */
+ long xcv_depth;
PADLIST * xcv_padlist;
CV * xcv_outside;
- cv_flags_t xcv_flags;
U32 xcv_outside_seq; /* the COP sequence (at the point of our
* compilation) in the lexically enclosing
* sub */
+ cv_flags_t xcv_flags;
};
/*
# define CvFILE_set_from_cop(sv, cop) (CvFILE(sv) = CopFILE(cop))
#endif
#define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv)))
-#define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xcv_depth
+#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+# define CvDEPTH(sv) (*({const CV *_cv = (CV *)sv; \
+ assert(SvTYPE(_cv) == SVt_PVCV); \
+ &((XPVCV*)SvANY(_cv))->xiv_u.xivu_i32; \
+ }))
+#else
+# define CvDEPTH(sv) ((XPVCV*)SvANY(sv))->xiv_u.xivu_i32
+#endif
#define CvPADLIST(sv) ((XPVCV*)SvANY(sv))->xcv_padlist
#define CvOUTSIDE(sv) ((XPVCV*)SvANY(sv))->xcv_outside
#define CvFLAGS(sv) ((XPVCV*)SvANY(sv))->xcv_flags
SvREFCNT_dec(d);
return;
}
- if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV)
- || type == SVt_IV) {
+ if (type == SVt_IV || (type >= SVt_PVIV && type != SVt_PVAV
+ && type != SVt_PVHV && type != SVt_PVCV)) {
if (SvIsUV(sv)
#ifdef PERL_OLD_COPY_ON_WRITE
|| SvIsCOW(sv)
package B::Bytecode;
-our $VERSION = '1.01';
+our $VERSION = '1.02';
use strict;
use Config;
# See note below in B::PVNV::bsave
return if $sv->isa('B::AV');
return if $sv->isa('B::HV');
+ return if $sv->isa('B::CV');
}
asm "xiv", !ITHREADS && $sv->FLAGS & (SVf_FAKE|SVf_READONLY) ?
"0 but true" : $sv->IVX;
SV = PVCV\\($ADDR\\) at $ADDR
REFCNT = 2
FLAGS = \\(PADMY,POK,pPOK,ANON,WEAKOUTSIDE\\)
- IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = $ADDR\\t"main"
SV = PVCV\\($ADDR\\) at $ADDR
REFCNT = (3|4)
FLAGS = \\(\\)
- IV = 0
NV = 0
COMP_STASH = $ADDR\\t"main"
START = $ADDR ===> \\d+
SV = PVCV\\($ADDR\\) at $ADDR
REFCNT = (2)
FLAGS = \\(POK,pPOK,CONST\\)
- IV = 0
NV = 0
PROTOTYPE = ""
COMP_STASH = 0x0
#endif
if (!CvISXSUB(cv) && CvROOT(cv)) {
- if (CvDEPTH(cv))
+ if (SvTYPE(cv) == SVt_PVCV && CvDEPTH(cv))
Perl_croak(aTHX_ "Can't undef active subroutine");
ENTER;
av_push(param->stashes, dstr);
}
break;
- case SVt_PVFM:
case SVt_PVCV:
+ if (!(param->flags & CLONEf_COPY_STACKS)) {
+ CvDEPTH(dstr) = 0;
+ }
+ case SVt_PVFM:
/* NOTE: not refcounted */
CvSTASH(dstr) = hv_dup(CvSTASH(dstr), param);
OP_REFCNT_LOCK;
* duped GV may never be freed. A bit of a hack! DAPM */
CvGV(dstr) = (param->flags & CLONEf_JOIN_IN) ?
NULL : gv_dup(CvGV(dstr), param) ;
- if (!(param->flags & CLONEf_COPY_STACKS)) {
- CvDEPTH(dstr) = 0;
- }
PAD_DUP(CvPADLIST(dstr), CvPADLIST(sstr), param);
CvOUTSIDE(dstr) =
CvWEAKOUTSIDE(sstr)
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
};
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
} xpviv_allocated;
#endif
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
};
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
STRLEN xpv_cur; /* length of svu_pv as a C string */
STRLEN xpv_len; /* allocated size */
union {
- IV xivu_iv; /* integer value or pv offset */
+ IV xivu_iv; /* PVFMs use the pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
} xcv_root_u;
GV * xcv_gv;
char * xcv_file;
- long xcv_depth; /* >= 2 indicates recursive call */
AV * xcv_padlist;
CV * xcv_outside;
- cv_flags_t xcv_flags;
U32 xcv_outside_seq; /* the COP sequence (at the point of our
* compilation) in the lexically enclosing
* sub */
+ cv_flags_t xcv_flags;
IV xfm_lines;
};
STRLEN xpv_cur; /* length of svu_pv as a C string */
STRLEN xpv_len; /* allocated size */
union {
- IV xivu_iv; /* integer value or pv offset */
+ IV xivu_iv; /* PVFMs use the pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
} xcv_root_u;
GV * xcv_gv;
char * xcv_file;
- long xcv_depth; /* >= 2 indicates recursive call */
AV * xcv_padlist;
CV * xcv_outside;
- cv_flags_t xcv_flags;
U32 xcv_outside_seq; /* the COP sequence (at the point of our
* compilation) in the lexically enclosing
* sub */
+ cv_flags_t xcv_flags;
IV xfm_lines;
} xpvfm_allocated;
IV xivu_iv; /* integer value or pv offset */
UV xivu_uv;
void * xivu_p1;
+ I32 xivu_i32;
} xiv_u;
MAGIC* xmg_magic; /* linked list of magicalness */
HV* xmg_stash; /* class package */
assert(SvTYPE(_svi) == SVt_IV || SvTYPE(_svi) >= SVt_PVIV); \
assert(SvTYPE(_svi) != SVt_PVAV); \
assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
&(((XPVIV*) SvANY(_svi))->xiv_iv); \
}))
# define SvUVX(sv) \
assert(SvTYPE(_svi) == SVt_IV || SvTYPE(_svi) >= SVt_PVIV); \
assert(SvTYPE(_svi) != SVt_PVAV); \
assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
&(((XPVUV*) SvANY(_svi))->xuv_uv); \
}))
# define SvNVX(sv) \