From: Nicholas Clark Date: Mon, 11 Apr 2005 14:53:38 +0000 (+0000) Subject: Avoid taking a reference to SvIVX and putting that address on the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f398eb67d321bfe2b4dd05cb57fa3c94a3337abc;p=p5sagit%2Fp5-mst-13.2.git Avoid taking a reference to SvIVX and putting that address on the save stack p4raw-id: //depot/perl@24228 --- diff --git a/perl.c b/perl.c index 6d948e7..6967c8c 100644 --- a/perl.c +++ b/perl.c @@ -3906,7 +3906,6 @@ Perl_init_debugger(pTHX) PL_DBgv = gv_fetchpv("DB::DB", GV_ADDMULTI, SVt_PVGV); PL_DBline = gv_fetchpv("DB::dbline", GV_ADDMULTI, SVt_PVAV); PL_DBsub = gv_HVadd(gv_fetchpv("DB::sub", GV_ADDMULTI, SVt_PVHV)); - sv_upgrade(GvSV(PL_DBsub), SVt_IV); /* IVX accessed if PERLDB_SUB_NN */ PL_DBsingle = GvSV((gv_fetchpv("DB::single", GV_ADDMULTI, SVt_PV))); sv_setiv(PL_DBsingle, 0); PL_DBtrace = GvSV((gv_fetchpv("DB::trace", GV_ADDMULTI, SVt_PV))); diff --git a/pp_ctl.c b/pp_ctl.c index 71634fb..933fb3f 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2426,13 +2426,14 @@ PP(pp_goto) SV *sv = GvSV(PL_DBsub); CV *gotocv; + save_item(sv); if (PERLDB_SUB_NN) { - (void)SvUPGRADE(sv, SVt_PVIV); + int type = SvTYPE(sv); + if (type < SVt_PVIV && type != SVt_IV) + sv_upgrade(sv, SVt_PVIV); (void)SvIOK_on(sv); - SAVEIV(SvIVX(sv)); SvIV_set(sv, PTR2IV(cv)); /* Do it the quickest way */ } else { - save_item(sv); gv_efullname3(sv, CvGV(cv), Nullch); } if ( PERLDB_GOTO diff --git a/pp_hot.c b/pp_hot.c index 85b42aa..b486586 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2560,10 +2560,10 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv) { SV *dbsv = GvSV(PL_DBsub); + save_item(dbsv); if (!PERLDB_SUB_NN) { GV *gv = CvGV(cv); - save_item(dbsv); if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED)) || strEQ(GvNAME(gv), "END") || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */ @@ -2580,9 +2580,10 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv) } } else { - (void)SvUPGRADE(dbsv, SVt_PVIV); + int type = SvTYPE(dbsv); + if (type < SVt_PVIV && type != SVt_IV) + sv_upgrade(dbsv, SVt_PVIV); (void)SvIOK_on(dbsv); - SAVEIV(SvIVX(dbsv)); SvIV_set(dbsv, PTR2IV(cv)); /* Do it the quickest way */ }