diff options
-rw-r--r-- | av.c | 4 | ||||
-rw-r--r-- | mg.c | 4 | ||||
-rw-r--r-- | mro.c | 10 | ||||
-rw-r--r-- | perl.c | 2 | ||||
-rw-r--r-- | pp.c | 8 | ||||
-rw-r--r-- | pp.h | 12 | ||||
-rw-r--r-- | pp_ctl.c | 28 | ||||
-rw-r--r-- | pp_hot.c | 6 | ||||
-rw-r--r-- | pp_pack.c | 64 | ||||
-rw-r--r-- | pp_sys.c | 161 | ||||
-rw-r--r-- | sv.c | 9 | ||||
-rw-r--r-- | universal.c | 20 | ||||
-rw-r--r-- | utf8.c | 8 | ||||
-rw-r--r-- | util.c | 2 |
14 files changed, 175 insertions, 163 deletions
@@ -77,7 +77,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) PUSHMARK(SP); EXTEND(SP,2); PUSHs(SvTIED_obj((SV*)av, mg)); - PUSHs(sv_2mortal(newSViv(key+1))); + mPUSHi(key + 1); PUTBACK; call_method("EXTEND", G_SCALAR|G_DISCARD); POPSTACK; @@ -762,7 +762,7 @@ Perl_av_fill(pTHX_ register AV *av, I32 fill) PUSHMARK(SP); EXTEND(SP,2); PUSHs(SvTIED_obj((SV*)av, mg)); - PUSHs(sv_2mortal(newSViv(fill+1))); + mPUSHi(fill + 1); PUTBACK; call_method("STORESIZE", G_SCALAR|G_DISCARD); POPSTACK; @@ -1607,12 +1607,12 @@ S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags, int if (n > 1) { if (mg->mg_ptr) { if (mg->mg_len >= 0) - PUSHs(newSVpvn_flags(mg->mg_ptr, mg->mg_len, SVs_TEMP)); + mPUSHp(mg->mg_ptr, mg->mg_len); else if (mg->mg_len == HEf_SVKEY) PUSHs((SV*)mg->mg_ptr); } else if (mg->mg_type == PERL_MAGIC_tiedelem) { - PUSHs(sv_2mortal(newSViv(mg->mg_len))); + mPUSHi(mg->mg_len); } } if (n > 2) { @@ -822,7 +822,7 @@ XS(XS_mro_get_isarev) while((iter = hv_iternext(isarev))) av_push(ret_array, newSVsv(hv_iterkeysv(iter))); } - XPUSHs(sv_2mortal(newRV_noinc((SV*)ret_array))); + mXPUSHs(newRV_noinc((SV*)ret_array)); PUTBACK; return; @@ -912,9 +912,7 @@ XS(XS_mro_get_pkg_gen) SP -= items; - XPUSHs(sv_2mortal(newSViv( - class_stash ? HvMROMETA(class_stash)->pkg_gen : 0 - ))); + mXPUSHi(class_stash ? HvMROMETA(class_stash)->pkg_gen : 0); PUTBACK; return; @@ -1041,7 +1039,7 @@ XS(XS_mro_nextcan) Perl_croak(aTHX_ "No next::method '%s' found for %s", subname, hvname); XSRETURN_EMPTY; } - XPUSHs(sv_2mortal(newRV_inc(val))); + mXPUSHs(newRV_inc(val)); XSRETURN(1); } } @@ -1102,7 +1100,7 @@ XS(XS_mro_nextcan) if (SvTYPE(candidate) == SVt_PVGV && (cand_cv = GvCV(candidate)) && !GvCVGEN(candidate)) { SvREFCNT_inc_simple_void_NN((SV*)cand_cv); (void)hv_store_ent(nmcache, newSVsv(sv), (SV*)cand_cv, 0); - XPUSHs(sv_2mortal(newRV_inc((SV*)cand_cv))); + mXPUSHs(newRV_inc((SV*)cand_cv)); XSRETURN(1); } } @@ -2522,7 +2522,7 @@ Perl_call_argv(pTHX_ const char *sub_name, I32 flags, register char **argv) PUSHMARK(SP); if (argv) { while (*argv) { - XPUSHs(sv_2mortal(newSVpv(*argv,0))); + mXPUSHs(newSVpv(*argv,0)); argv++; } PUTBACK; @@ -4251,8 +4251,8 @@ PP(pp_anonlist) const I32 items = SP - MARK; SV * const av = (SV *) av_make(items, MARK+1); SP = ORIGMARK; /* av_make() might realloc stack_sp */ - XPUSHs(sv_2mortal((PL_op->op_flags & OPf_SPECIAL) - ? newRV_noinc(av) : av)); + mXPUSHs((PL_op->op_flags & OPf_SPECIAL) + ? newRV_noinc(av) : av); RETURN; } @@ -4271,8 +4271,8 @@ PP(pp_anonhash) (void)hv_store_ent(hv,key,val,0); } SP = ORIGMARK; - XPUSHs(sv_2mortal((PL_op->op_flags & OPf_SPECIAL) - ? newRV_noinc((SV*) hv) : (SV*)hv)); + mXPUSHs((PL_op->op_flags & OPf_SPECIAL) + ? newRV_noinc((SV*) hv) : (SV*) hv); RETURN; } @@ -224,6 +224,11 @@ called to declare it. Do not call multiple C<TARG>-oriented macros to return lists from XSUB's - see C<mXPUSHu> instead. See also C<PUSHu> and C<mPUSHu>. +=for apidoc Am|void|mPUSHs|SV* sv +Push an SV onto the stack and mortalizes the SV. The stack must have room +for this element. Does not handle 'set' magic. Does not use C<TARG>. +See also C<PUSHs> and C<mXPUSHs>. + =for apidoc Am|void|PUSHmortal Push a new mortal SV onto the stack. The stack must have room for this element. Does not handle 'set' magic. Does not use C<TARG>. See also @@ -249,6 +254,11 @@ Push an unsigned integer onto the stack. The stack must have room for this element. Handles 'set' magic. Does not use C<TARG>. See also C<PUSHu>, C<mXPUSHu> and C<XPUSHu>. +=for apidoc Am|void|mXPUSHs|SV* sv +Push an SV onto the stack, extending the stack if necessary and mortalizes +the SV. Does not handle 'set' magic. Does not use C<TARG>. See also +C<XPUSHs> and C<mPUSHs>. + =for apidoc Am|void|XPUSHmortal Push a new mortal SV onto the stack, extending the stack if necessary. Does not handle 'set' magic. Does not use C<TARG>. See also C<XPUSHs>, @@ -303,12 +313,14 @@ and C<PUSHu>. #define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END #define XPUSHundef STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END +#define mPUSHs(s) PUSHs(sv_2mortal(s)) #define PUSHmortal PUSHs(sv_newmortal()) #define mPUSHp(p,l) sv_setpvn_mg(PUSHmortal, (p), (l)) #define mPUSHn(n) sv_setnv_mg(PUSHmortal, (NV)(n)) #define mPUSHi(i) sv_setiv_mg(PUSHmortal, (IV)(i)) #define mPUSHu(u) sv_setuv_mg(PUSHmortal, (UV)(u)) +#define mXPUSHs(s) XPUSHs(sv_2mortal(s)) #define XPUSHmortal XPUSHs(sv_newmortal()) #define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END #define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END @@ -253,7 +253,7 @@ PP(pp_substcont) SvPV_set(dstr, NULL); TAINT_IF(cx->sb_rxtainted & 1); - PUSHs(sv_2mortal(newSViv(saviters - 1))); + mPUSHi(saviters - 1); (void)SvPOK_only_UTF8(targ); TAINT_IF(cx->sb_rxtainted); @@ -925,7 +925,7 @@ PP(pp_grepstart) if (PL_stack_base + *PL_markstack_ptr == SP) { (void)POPMARK; if (GIMME_V == G_SCALAR) - XPUSHs(sv_2mortal(newSViv(0))); + mXPUSHi(0); RETURNOP(PL_op->op_next->op_next); } PL_stack_sp = PL_stack_base + *PL_markstack_ptr + 1; @@ -1628,9 +1628,9 @@ PP(pp_caller) if (!stashname) PUSHs(&PL_sv_undef); else - PUSHs(sv_2mortal(newSVpv(stashname, 0))); - PUSHs(sv_2mortal(newSVpv(OutCopFILE(cx->blk_oldcop), 0))); - PUSHs(sv_2mortal(newSViv((I32)CopLINE(cx->blk_oldcop)))); + mPUSHs(newSVpv(stashname, 0)); + mPUSHs(newSVpv(OutCopFILE(cx->blk_oldcop), 0)); + mPUSHi((I32)CopLINE(cx->blk_oldcop)); if (!MAXARG) RETURN; if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) { @@ -1639,23 +1639,23 @@ PP(pp_caller) if (isGV(cvgv)) { SV * const sv = newSV(0); gv_efullname3(sv, cvgv, NULL); - PUSHs(sv_2mortal(sv)); - PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); + mPUSHs(sv); + mPUSHi((I32)cx->blk_sub.hasargs); } else { PUSHs(newSVpvs_flags("(unknown)", SVs_TEMP)); - PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); + mPUSHi((I32)cx->blk_sub.hasargs); } } else { PUSHs(newSVpvs_flags("(eval)", SVs_TEMP)); - PUSHs(sv_2mortal(newSViv(0))); + mPUSHi(0); } gimme = (I32)cx->blk_gimme; if (gimme == G_VOID) PUSHs(&PL_sv_undef); else - PUSHs(sv_2mortal(newSViv(gimme & G_ARRAY))); + mPUSHi(gimme & G_ARRAY); if (CxTYPE(cx) == CXt_EVAL) { /* eval STRING */ if (cx->blk_eval.old_op_type == OP_ENTEREVAL) { @@ -1664,7 +1664,7 @@ PP(pp_caller) } /* require */ else if (cx->blk_eval.old_namesv) { - PUSHs(sv_2mortal(newSVsv(cx->blk_eval.old_namesv))); + mPUSHs(newSVsv(cx->blk_eval.old_namesv)); PUSHs(&PL_sv_yes); } /* eval BLOCK (try blocks have old_namesv == 0) */ @@ -1698,7 +1698,7 @@ PP(pp_caller) /* XXX only hints propagated via op_private are currently * visible (others are not easily accessible, since they * use the global PL_hints) */ - PUSHs(sv_2mortal(newSViv(CopHINTS_get(cx->blk_oldcop)))); + mPUSHi(CopHINTS_get(cx->blk_oldcop)); { SV * mask ; STRLEN * const old_warnings = cx->blk_oldcop->cop_warnings ; @@ -1721,7 +1721,7 @@ PP(pp_caller) } else mask = newSVpvn((char *) (old_warnings + 1), old_warnings[0]); - PUSHs(sv_2mortal(mask)); + mPUSHs(mask); } PUSHs(cx->blk_oldcop->cop_hints_hash ? @@ -4682,7 +4682,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) DEFSV = upstream; PUSHMARK(SP); - PUSHs(sv_2mortal(newSViv(0))); + mPUSHi(0); if (filter_state) { PUSHs(filter_state); } @@ -43,7 +43,7 @@ PP(pp_const) /* This is a const op added to hold the hints hash for pp_entereval. The hash can be modified by the code being eval'ed, so we return a copy instead. */ - XPUSHs(sv_2mortal((SV*)Perl_hv_copy_hints_hv(aTHX_ (HV*)cSVOP_sv))); + mXPUSHs((SV*)Perl_hv_copy_hints_hv(aTHX_ (HV*)cSVOP_sv)); else /* Normal const. */ XPUSHs(cSVOP_sv); @@ -2251,7 +2251,7 @@ PP(pp_subst) } TAINT_IF(rxtainted & 1); SPAGAIN; - PUSHs(sv_2mortal(newSViv((I32)iters))); + mPUSHi((I32)iters); } (void)SvPOK_only_UTF8(TARG); TAINT_IF(rxtainted); @@ -2337,7 +2337,7 @@ PP(pp_subst) TAINT_IF(rxtainted & 1); SPAGAIN; - PUSHs(sv_2mortal(newSViv((I32)iters))); + mPUSHi((I32)iters); (void)SvPOK_only(TARG); if (doutf8) @@ -1293,7 +1293,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c sv = from <= s ? newSVuv( u8 ? (UV) utf8_length((const U8*)from, (const U8*)s) : (UV) (s-from)) : newSViv(-(u8 ? (IV) utf8_length((const U8*)s, (const U8*)from) : (IV) (from-s))); - XPUSHs(sv_2mortal(sv)); + mXPUSHs(sv); break; } #ifdef PERL_PACK_CAN_SHRIEKSIGN @@ -1443,7 +1443,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c if (!(symptr->flags & FLAG_WAS_UTF8)) sv_utf8_downgrade(sv, 0); } - XPUSHs(sv_2mortal(sv)); + mXPUSHs(sv); s += len; break; case 'B': @@ -1586,7 +1586,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c if (aint >= 128 && datumtype != 'C') /* fake up signed chars */ aint -= 256; if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)aint))); + mPUSHi(aint); else if (checksum > bits_in_uv) cdouble += (NV)aint; else @@ -1604,7 +1604,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c Perl_croak(aTHX_ "Malformed UTF-8 string in unpack"); s += retlen; if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV) val))); + mPUSHu(val); else if (checksum > bits_in_uv) cdouble += (NV) val; else @@ -1613,7 +1613,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c } else if (!checksum) while (len-- > 0) { const U8 ch = *(U8 *) s++; - PUSHs(sv_2mortal(newSVuv((UV) ch))); + mPUSHu(ch); } else if (checksum > bits_in_uv) while (len-- > 0) cdouble += (NV) *(U8 *) s++; @@ -1661,7 +1661,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c s += retlen; } if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV) auv))); + mPUSHu(auv); else if (checksum > bits_in_uv) cdouble += (NV) auv; else @@ -1675,7 +1675,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, ashort, datumtype); DO_BO_UNPACK(ashort, s); if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)ashort))); + mPUSHi(ashort); else if (checksum > bits_in_uv) cdouble += (NV)ashort; else @@ -1699,7 +1699,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c ai16 -= 65536; #endif if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)ai16))); + mPUSHi(ai16); else if (checksum > bits_in_uv) cdouble += (NV)ai16; else @@ -1713,7 +1713,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aushort, datumtype); DO_BO_UNPACK(aushort, s); if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV) aushort))); + mPUSHu(aushort); else if (checksum > bits_in_uv) cdouble += (NV)aushort; else @@ -1742,7 +1742,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c au16 = vtohs(au16); #endif if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV)au16))); + mPUSHu(au16); else if (checksum > bits_in_uv) cdouble += (NV) au16; else @@ -1767,7 +1767,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c ai16 = (I16) vtohs((U16) ai16); # endif /* HAS_VTOHS */ if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)ai16))); + mPUSHi(ai16); else if (checksum > bits_in_uv) cdouble += (NV) ai16; else @@ -1782,7 +1782,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aint, datumtype); DO_BO_UNPACK(aint, i); if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)aint))); + mPUSHi(aint); else if (checksum > bits_in_uv) cdouble += (NV)aint; else @@ -1796,7 +1796,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, auint, datumtype); DO_BO_UNPACK(auint, i); if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV)auint))); + mPUSHu(auint); else if (checksum > bits_in_uv) cdouble += (NV)auint; else @@ -1817,7 +1817,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c Perl_croak(aTHX_ "'j' not supported on this platform"); #endif if (!checksum) - PUSHs(sv_2mortal(newSViv(aiv))); + mPUSHi(aiv); else if (checksum > bits_in_uv) cdouble += (NV)aiv; else @@ -1838,7 +1838,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c Perl_croak(aTHX_ "'J' not supported on this platform"); #endif if (!checksum) - PUSHs(sv_2mortal(newSVuv(auv))); + mPUSHu(auv); else if (checksum > bits_in_uv) cdouble += (NV)auv; else @@ -1852,7 +1852,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, along, datumtype); DO_BO_UNPACK(along, l); if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)along))); + mPUSHi(along); else if (checksum > bits_in_uv) cdouble += (NV)along; else @@ -1874,7 +1874,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c if (ai32 > 2147483647) ai32 -= 4294967296; #endif if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)ai32))); + mPUSHi(ai32); else if (checksum > bits_in_uv) cdouble += (NV)ai32; else @@ -1888,7 +1888,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aulong, datumtype); DO_BO_UNPACK(aulong, l); if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV)aulong))); + mPUSHu(aulong); else if (checksum > bits_in_uv) cdouble += (NV)aulong; else @@ -1917,7 +1917,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c au32 = vtohl(au32); #endif if (!checksum) - PUSHs(sv_2mortal(newSVuv((UV)au32))); + mPUSHu(au32); else if (checksum > bits_in_uv) cdouble += (NV)au32; else @@ -1942,7 +1942,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c ai32 = (I32)vtohl((U32)ai32); # endif if (!checksum) - PUSHs(sv_2mortal(newSViv((IV)ai32))); + mPUSHi(ai32); else if (checksum > bits_in_uv) cdouble += (NV)ai32; else @@ -1956,7 +1956,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aptr, datumtype); DO_BO_UNPACK_PC(aptr); /* newSVpv generates undef if aptr is NULL */ - PUSHs(sv_2mortal(newSVpv(aptr, 0))); + mPUSHs(newSVpv(aptr, 0)); } break; case 'w': @@ -1971,7 +1971,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c /* UTF8_IS_XXXXX not right here - using constant 0x80 */ if (ch < 0x80) { bytes = 0; - PUSHs(sv_2mortal(newSVuv(auv))); + mPUSHu(auv); len--; auv = 0; continue; @@ -1992,7 +1992,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c while (*t == '0') t++; sv_chop(sv, t); - PUSHs(sv_2mortal(sv)); + mPUSHs(sv); len--; auv = 0; } @@ -2020,8 +2020,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aquad, datumtype); DO_BO_UNPACK(aquad, 64); if (!checksum) - PUSHs(sv_2mortal(aquad >= IV_MIN && aquad <= IV_MAX ? - newSViv((IV)aquad) : newSVnv((NV)aquad))); + mPUSHs(aquad >= IV_MIN && aquad <= IV_MAX ? + newSViv((IV)aquad) : newSVnv((NV)aquad)); else if (checksum > bits_in_uv) cdouble += (NV)aquad; else @@ -2034,8 +2034,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, auquad, datumtype); DO_BO_UNPACK(auquad, 64); if (!checksum) - PUSHs(sv_2mortal(auquad <= UV_MAX ? - newSVuv((UV)auquad):newSVnv((NV)auquad))); + mPUSHs(auquad <= UV_MAX ? + newSVuv((UV)auquad) : newSVnv((NV)auquad)); else if (checksum > bits_in_uv) cdouble += (NV)auquad; else @@ -2050,7 +2050,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, afloat, datumtype); DO_BO_UNPACK_N(afloat, float); if (!checksum) - PUSHs(sv_2mortal(newSVnv((NV)afloat))); + mPUSHn(afloat); else cdouble += afloat; } @@ -2061,7 +2061,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, adouble, datumtype); DO_BO_UNPACK_N(adouble, double); if (!checksum) - PUSHs(sv_2mortal(newSVnv((NV)adouble))); + mPUSHn(adouble); else cdouble += adouble; } @@ -2072,7 +2072,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, anv, datumtype); DO_BO_UNPACK_N(anv, NV); if (!checksum) - PUSHs(sv_2mortal(newSVnv(anv))); + mPUSHn(anv); else cdouble += anv; } @@ -2084,7 +2084,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c SHIFT_VAR(utf8, s, strend, aldouble, datumtype); DO_BO_UNPACK_N(aldouble, long double); if (!checksum) - PUSHs(sv_2mortal(newSVnv((NV)aldouble))); + mPUSHn(aldouble); else cdouble += aldouble; } @@ -2187,7 +2187,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c } sv = newSVuv(cuv); } - XPUSHs(sv_2mortal(sv)); + mXPUSHs(sv); checksum = 0; } @@ -342,7 +342,7 @@ PP(pp_backtick) SvREFCNT_dec(sv); break; } - XPUSHs(sv_2mortal(sv)); + mXPUSHs(sv); if (SvLEN(sv) - SvCUR(sv) > 20) { SvPV_shrink_to_cur(sv); } @@ -888,7 +888,7 @@ PP(pp_untie) if (gv && isGV(gv) && (cv = GvCV(gv))) { PUSHMARK(SP); XPUSHs(SvTIED_obj((SV*)gv, mg)); - XPUSHs(sv_2mortal(newSViv(SvREFCNT(obj)-1))); + mXPUSHi(SvREFCNT(obj) - 1); PUTBACK; ENTER; call_sv((SV *)cv, G_VOID); @@ -953,9 +953,9 @@ PP(pp_dbmopen) PUSHs(sv); PUSHs(left); if (SvIV(right)) - PUSHs(sv_2mortal(newSVuv(O_RDWR|O_CREAT))); + mPUSHu(O_RDWR|O_CREAT); else - PUSHs(sv_2mortal(newSVuv(O_RDWR))); + mPUSHu(O_RDWR); PUSHs(right); PUTBACK; call_sv((SV*)GvCV(gv), G_SCALAR); @@ -966,7 +966,7 @@ PP(pp_dbmopen) PUSHMARK(SP); PUSHs(sv); PUSHs(left); - PUSHs(sv_2mortal(newSVuv(O_RDONLY))); + mPUSHu(O_RDONLY); PUSHs(right); PUTBACK; call_sv((SV*)GvCV(gv), G_SCALAR); @@ -1137,7 +1137,7 @@ PP(pp_sselect) if (GIMME == G_ARRAY && tbuf) { value = (NV)(timebuf.tv_sec) + (NV)(timebuf.tv_usec) / 1000000.0; - PUSHs(sv_2mortal(newSVnv(value))); + mPUSHn(value); } RETURN; #else @@ -1174,7 +1174,7 @@ PP(pp_select) XPUSHTARG; } else { - XPUSHs(sv_2mortal(newRV((SV*)egv))); + mXPUSHs(newRV((SV*)egv)); } } @@ -2100,11 +2100,11 @@ PP(pp_sysseek) PUSHMARK(SP); XPUSHs(SvTIED_obj((SV*)io, mg)); #if LSEEKSIZE > IVSIZE - XPUSHs(sv_2mortal(newSVnv((NV) offset))); + mXPUSHn((NV) offset); #else - XPUSHs(sv_2mortal(newSViv(offset))); + mXPUSHi(offset); #endif - XPUSHs(sv_2mortal(newSViv(whence))); + mXPUSHi(whence); PUTBACK; ENTER; call_method("SEEK", G_SCALAR); @@ -2128,7 +2128,7 @@ PP(pp_sysseek) newSViv(sought) #endif : newSVpvn(zero_but_true, ZBTLEN); - PUSHs(sv_2mortal(sv)); + mPUSHs(sv); } } RETURN; @@ -2873,50 +2873,50 @@ PP(pp_stat) if (max) { EXTEND(SP, max); EXTEND_MORTAL(max); - PUSHs(sv_2mortal(newSViv(PL_statcache.st_dev))); - PUSHs(sv_2mortal(newSViv(PL_statcache.st_ino))); - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_mode))); - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_nlink))); + mPUSHi(PL_statcache.st_dev); + mPUSHi(PL_statcache.st_ino); + mPUSHu(PL_statcache.st_mode); + mPUSHu(PL_statcache.st_nlink); #if Uid_t_size > IVSIZE - PUSHs(sv_2mortal(newSVnv(PL_statcache.st_uid))); + mPUSHn(PL_statcache.st_uid); #else # if Uid_t_sign <= 0 - PUSHs(sv_2mortal(newSViv(PL_statcache.st_uid))); + mPUSHi(PL_statcache.st_uid); # else - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_uid))); + mPUSHu(PL_statcache.st_uid); # endif #endif #if Gid_t_size > IVSIZE - PUSHs(sv_2mortal(newSVnv(PL_statcache.st_gid))); + mPUSHn(PL_statcache.st_gid); #else # if Gid_t_sign <= 0 - PUSHs(sv_2mortal(newSViv(PL_statcache.st_gid))); + mPUSHi(PL_statcache.st_gid); # else - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_gid))); + mPUSHu(PL_statcache.st_gid); # endif #endif #ifdef USE_STAT_RDEV - PUSHs(sv_2mortal(newSViv(PL_statcache.st_rdev))); + mPUSHi(PL_statcache.st_rdev); #else PUSHs(newSVpvs_flags("", SVs_TEMP)); #endif #if Off_t_size > IVSIZE - PUSHs(sv_2mortal(newSVnv((NV)PL_statcache.st_size))); + mPUSHn(PL_statcache.st_size); #else - PUSHs(sv_2mortal(newSViv(PL_statcache.st_size))); + mPUSHi(PL_statcache.st_size); #endif #ifdef BIG_TIME - PUSHs(sv_2mortal(newSVnv(PL_statcache.st_atime))); - PUSHs(sv_2mortal(newSVnv(PL_statcache.st_mtime))); - PUSHs(sv_2mortal(newSVnv(PL_statcache.st_ctime))); + mPUSHn(PL_statcache.st_atime); + mPUSHn(PL_statcache.st_mtime); + mPUSHn(PL_statcache.st_ctime); #else - PUSHs(sv_2mortal(newSViv((IV)PL_statcache.st_atime))); - PUSHs(sv_2mortal(newSViv((IV)PL_statcache.st_mtime))); - PUSHs(sv_2mortal(newSViv((IV)PL_statcache.st_ctime))); + mPUSHi(PL_statcache.st_atime); + mPUSHi(PL_statcache.st_mtime); + mPUSHi(PL_statcache.st_ctime); #endif #ifdef USE_STAT_BLOCKS - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_blksize))); - PUSHs(sv_2mortal(newSVuv(PL_statcache.st_blocks))); + mPUSHu(PL_statcache.st_blksize); + mPUSHu(PL_statcache.st_blocks); #else PUSHs(newSVpvs_flags("", SVs_TEMP)); PUSHs(newSVpvs_flags("", SVs_TEMP)); @@ -3812,7 +3812,7 @@ PP(pp_readdir) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); #endif - XPUSHs(sv_2mortal(sv)); + mXPUSHs(sv); } while (gimme == G_ARRAY); if (!dp && gimme != G_ARRAY) @@ -4367,22 +4367,22 @@ PP(pp_tms) /* is returned. */ #endif - PUSHs(sv_2mortal(newSVnv(((NV)PL_timesbuf.tms_utime)/(NV)PL_clocktick))); + mPUSHn(((NV)PL_timesbuf.tms_utime)/(NV)PL_clocktick); if (GIMME == G_ARRAY) { - PUSHs(sv_2mortal(newSVnv(((NV)PL_timesbuf.tms_stime)/(NV)PL_clocktick))); - PUSHs(sv_2mortal(newSVnv(((NV)PL_timesbuf.tms_cutime)/(NV)PL_clocktick))); - PUSHs(sv_2mortal(newSVnv(((NV)PL_timesbuf.tms_cstime)/(NV)PL_clocktick))); + mPUSHn(((NV)PL_timesbuf.tms_stime)/(NV)PL_clocktick); + mPUSHn(((NV)PL_timesbuf.tms_cutime)/(NV)PL_clocktick); + mPUSHn(((NV)PL_timesbuf.tms_cstime)/(NV)PL_clocktick); } RETURN; #else # ifdef PERL_MICRO dSP; - PUSHs(sv_2mortal(newSVnv((NV)0.0))); + mPUSHn(0.0); EXTEND(SP, 4); if (GIMME == G_ARRAY) { - PUSHs(sv_2mortal(newSVnv((NV)0.0))); - PUSHs(sv_2mortal(newSVnv((NV)0.0))); - PUSHs(sv_2mortal(newSVnv((NV)0.0))); + mPUSHn(0.0); + mPUSHn(0.0); + mPUSHn(0.0); } RETURN; # else @@ -4475,20 +4475,20 @@ PP(pp_gmtime) tmbuf->tm_min, tmbuf->tm_sec, tmbuf->tm_year + 1900); - PUSHs(sv_2mortal(tsv)); + mPUSHs(tsv); } else if (tmbuf) { EXTEND(SP, 9); EXTEND_MORTAL(9); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_sec))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_min))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_hour))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_mday))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_mon))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_year))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_wday))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_yday))); - PUSHs(sv_2mortal(newSViv(tmbuf->tm_isdst))); + mPUSHi(tmbuf->tm_sec); + mPUSHi(tmbuf->tm_min); + mPUSHi(tmbuf->tm_hour); + mPUSHi(tmbuf->tm_mday); + mPUSHi(tmbuf->tm_mon); + mPUSHi(tmbuf->tm_year); + mPUSHi(tmbuf->tm_wday); + mPUSHi(tmbuf->tm_yday); + mPUSHi(tmbuf->tm_isdst); } RETURN; } @@ -4690,14 +4690,14 @@ PP(pp_ghostent) } if (hent) { - PUSHs(sv_2mortal(newSVpv((char*)hent->h_name, 0))); + mPUSHs(newSVpv((char*)hent->h_name, 0)); PUSHs(space_join_names_mortal(hent->h_aliases)); - PUSHs(sv_2mortal(newSViv((IV)hent->h_addrtype))); + mPUSHi(hent->h_addrtype); len = hent->h_length; - PUSHs(sv_2mortal(newSViv((IV)len))); + mPUSHi(len); #ifdef h_addr for (elem = hent->h_addr_list; elem && *elem; elem++) { - XPUSHs(newSVpvn_flags(*elem, len, SVs_TEMP)); + mXPUSHp(*elem, len); } #else if (hent->h_addr) @@ -4773,10 +4773,10 @@ PP(pp_gnetent) } if (nent) { - PUSHs(sv_2mortal(newSVpv(nent->n_name, 0))); + mPUSHs(newSVpv(nent->n_name, 0)); PUSHs(space_join_names_mortal(nent->n_aliases)); - PUSHs(sv_2mortal(newSViv((IV)nent->n_addrtype))); - PUSHs(sv_2mortal(newSViv((IV)nent->n_net))); + mPUSHi(nent->n_addrtype); + mPUSHi(nent->n_net); } RETURN; @@ -4834,9 +4834,9 @@ PP(pp_gprotoent) } if (pent) { - PUSHs(sv_2mortal(newSVpv(pent->p_name, 0))); + mPUSHs(newSVpv(pent->p_name, 0)); PUSHs(space_join_names_mortal(pent->p_aliases)); - PUSHs(sv_2mortal(newSViv((IV)pent->p_proto))); + mPUSHi(pent->p_proto); } RETURN; @@ -4904,14 +4904,14 @@ PP(pp_gservent) } if (sent) { - PUSHs(sv_2mortal(newSVpv(sent->s_name, 0))); + mPUSHs(newSVpv(sent->s_name, 0)); PUSHs(space_join_names_mortal(sent->s_aliases)); #ifdef HAS_NTOHS - PUSHs(sv_2mortal(newSViv((IV)PerlSock_ntohs(sent->s_port)))); + mPUSHi(PerlSock_ntohs(sent->s_port)); #else - PUSHs(sv_2mortal(newSViv((IV)(sent->s_port)))); + mPUSHi(sent->s_port); #endif - PUSHs(sv_2mortal(newSVpv(sent->s_proto, 0))); + mPUSHs(newSVpv(sent->s_proto, 0)); } RETURN; @@ -5127,9 +5127,10 @@ PP(pp_gpwent) } if (pwent) { - PUSHs(sv_2mortal(newSVpv(pwent->pw_name, 0))); + mPUSHs(newSVpv(pwent->pw_name, 0)); - PUSHs(sv = sv_2mortal(newSViv(0))); + sv = newSViv(0); + mPUSHs(sv); /* If we have getspnam(), we try to dig up the shadow * password. If we are underprivileged, the shadow * interface will set the errno to EACCES or similar, @@ -5173,15 +5174,15 @@ PP(pp_gpwent) # endif # if Uid_t_sign <= 0 - PUSHs(sv_2mortal(newSViv((IV)pwent->pw_uid))); + mPUSHi(pwent->pw_uid); # else - PUSHs(sv_2mortal(newSVuv((UV)pwent->pw_uid))); + mPUSHu(pwent->pw_uid); # endif # if Uid_t_sign <= 0 - PUSHs(sv_2mortal(newSViv((IV)pwent->pw_gid))); + mPUSHi(pwent->pw_gid); # else - PUSHs(sv_2mortal(newSVuv((UV)pwent->pw_gid))); + mPUSHu(pwent->pw_gid); # endif /* pw_change, pw_quota, and pw_age are mutually exclusive-- * because of the poor interface of the Perl getpw*(), @@ -5189,13 +5190,13 @@ PP(pp_gpwent) * A better interface would have been to return a hash, * but we are accursed by our history, alas. --jhi. */ # ifdef PWCHANGE - PUSHs(sv_2mortal(newSViv((IV)pwent->pw_change))); + mPUSHi(pwent->pw_change); # else # ifdef PWQUOTA - PUSHs(sv_2mortal(newSViv((IV)pwent->pw_quota))); + mPUSHi(pwent->pw_quota); # else # ifdef PWAGE - PUSHs(sv_2mortal(newSVpv(pwent->pw_age, 0))); + mPUSHs(newSVpv(pwent->pw_age, 0)); # else /* I think that you can never get this compiled, but just in case. */ PUSHs(sv_mortalcopy(&PL_sv_no)); @@ -5206,10 +5207,10 @@ PP(pp_gpwent) /* pw_class and pw_comment are mutually exclusive--. * see the above note for pw_change, pw_quota, and pw_age. */ # ifdef PWCLASS - PUSHs(sv_2mortal(newSVpv(pwent->pw_class, 0))); + mPUSHs(newSVpv(pwent->pw_class, 0)); # else # ifdef PWCOMMENT - PUSHs(sv_2mortal(newSVpv(pwent->pw_comment, 0))); + mPUSHs(newSVpv(pwent->pw_comment, 0)); # else /* I think that you can never get this compiled, but just in case. */ PUSHs(sv_mortalcopy(&PL_sv_no)); @@ -5226,7 +5227,7 @@ PP(pp_gpwent) SvTAINTED_on(sv); # endif - PUSHs(sv_2mortal(newSVpv(pwent->pw_dir, 0))); + mPUSHs(newSVpv(pwent->pw_dir, 0)); PUSHs(sv = sv_2mortal(newSVpv(pwent->pw_shell, 0))); # ifndef INCOMPLETE_TAINTS @@ -5235,7 +5236,7 @@ PP(pp_gpwent) # endif # ifdef PWEXPIRE - PUSHs(sv_2mortal(newSViv((IV)pwent->pw_expire))); + mPUSHi(pwent->pw_expire); # endif } RETURN; @@ -5303,15 +5304,15 @@ PP(pp_ggrent) } if (grent) { - PUSHs(sv_2mortal(newSVpv(grent->gr_name, 0))); + mPUSHs(newSVpv(grent->gr_name, 0)); #ifdef GRPASSWD - PUSHs(sv_2mortal(newSVpv(grent->gr_passwd, 0))); + mPUSHs(newSVpv(grent->gr_passwd, 0)); #else PUSHs(sv_mortalcopy(&PL_sv_no)); #endif - PUSHs(sv_2mortal(newSViv((IV)grent->gr_gid))); + mPUSHi(grent->gr_gid); #if !(defined(_CRAYMPP) && defined(USE_REENTRANT_API)) /* In UNICOS/mk (_CRAYMPP) the multithreading @@ -10912,7 +10912,7 @@ do_mark_cloneable_stash(pTHX_ SV *sv) ENTER; SAVETMPS; PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVhek(hvname))); + mXPUSHs(newSVhek(hvname)); PUTBACK; call_sv((SV*)GvCV(cloner), G_SCALAR); SPAGAIN; @@ -11667,7 +11667,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, ENTER; SAVETMPS; PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVhek(HvNAME_HEK(stash)))); + mXPUSHs(newSVhek(HvNAME_HEK(stash))); PUTBACK; call_sv((SV*)GvCV(cloner), G_DISCARD); FREETMPS; @@ -11783,8 +11783,9 @@ Perl_sv_cat_decode(pTHX_ SV *dsv, SV *encoding, XPUSHs(encoding); XPUSHs(dsv); XPUSHs(ssv); - XPUSHs(offsv = sv_2mortal(newSViv(*offset))); - XPUSHs(newSVpvn_flags(tstr, tlen, SVs_TEMP)); + offsv = newSViv(*offset); + mXPUSHs(offsv); + mXPUSHp(tstr, tlen); PUTBACK; call_method("cat_decode", G_SCALAR); SPAGAIN; diff --git a/universal.c b/universal.c index 50a76d6e8c..7d1bd559dd 100644 --- a/universal.c +++ b/universal.c @@ -158,7 +158,7 @@ Perl_sv_does(pTHX_ SV *sv, const char *name) PUSHMARK(SP); XPUSHs(sv); - XPUSHs(sv_2mortal(newSVpv(name, 0))); + mXPUSHs(newSVpv(name, 0)); PUTBACK; methodname = newSVpvs_flags("isa", SVs_TEMP); @@ -487,7 +487,7 @@ XS(XS_version_new) if ( strcmp(classname,"version") != 0 ) /* inherited new() */ sv_bless(rv, gv_stashpv(classname, GV_ADD)); - PUSHs(sv_2mortal(rv)); + mPUSHs(rv); PUTBACK; return; } @@ -510,7 +510,7 @@ XS(XS_version_stringify) else Perl_croak(aTHX_ "lobj is not of type version"); - PUSHs(sv_2mortal(vstringify(lobj))); + mPUSHs(vstringify(lobj)); PUTBACK; return; @@ -534,7 +534,7 @@ XS(XS_version_numify) else Perl_croak(aTHX_ "lobj is not of type version"); - PUSHs(sv_2mortal(vnumify(lobj))); + mPUSHs(vnumify(lobj)); PUTBACK; return; @@ -558,7 +558,7 @@ XS(XS_version_normal) else Perl_croak(aTHX_ "lobj is not of type version"); - PUSHs(sv_2mortal(vnormal(lobj))); + mPUSHs(vnormal(lobj)); PUTBACK; return; @@ -603,7 +603,7 @@ XS(XS_version_vcmp) rs = newSViv(vcmp(lobj,rvs)); } - PUSHs(sv_2mortal(rs)); + mPUSHs(rs); } PUTBACK; @@ -622,7 +622,7 @@ XS(XS_version_boolean) if (sv_derived_from(ST(0), "version")) { SV * const lobj = SvRV(ST(0)); SV * const rs = newSViv( vcmp(lobj,new_version(newSVpvs("0"))) ); - PUSHs(sv_2mortal(rs)); + mPUSHs(rs); PUTBACK; return; } @@ -685,7 +685,7 @@ XS(XS_version_qv) } else { - PUSHs(sv_2mortal(new_version(ver))); + mPUSHs(new_version(ver)); } PUTBACK; @@ -1418,8 +1418,8 @@ XS(XS_Tie_Hash_NamedCapture_flags) if (items != 0) Perl_croak(aTHX_ "Usage: Tie::Hash::NamedCapture::flags()"); - XPUSHs(sv_2mortal(newSVuv(RXapif_ONE))); - XPUSHs(sv_2mortal(newSVuv(RXapif_ALL))); + mXPUSHu(RXapif_ONE); + mXPUSHu(RXapif_ALL); PUTBACK; return; } @@ -1587,11 +1587,11 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits SPAGAIN; PUSHMARK(SP); EXTEND(SP,5); - PUSHs(newSVpvn_flags(pkg, pkg_len, SVs_TEMP)); - PUSHs(newSVpvn_flags(name, name_len, SVs_TEMP)); + mPUSHp(pkg, pkg_len); + mPUSHp(name, name_len); PUSHs(listsv); - PUSHs(sv_2mortal(newSViv(minbits))); - PUSHs(sv_2mortal(newSViv(none))); + mPUSHi(minbits); + mPUSHi(none); PUTBACK; errsv_save = newSVsv(ERRSV); if (call_method("SWASHNEW", G_SCALAR)) @@ -1216,7 +1216,7 @@ Perl_write_to_stderr(pTHX_ const char* message, int msglen) PUSHMARK(SP); EXTEND(SP,2); PUSHs(SvTIED_obj((SV*)io, mg)); - PUSHs(newSVpvn_flags(message, msglen, SVs_TEMP)); + mPUSHp(message, msglen); PUTBACK; call_method("PRINT", G_SCALAR); |