From: Steve Peters Date: Thu, 21 Apr 2005 18:55:47 +0000 (-0500) Subject: bytecode.pl, bytecode.h, and sv.h fixes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=03687789a91f025434d009c94c44b46adf44f605;p=p5sagit%2Fp5-mst-13.2.git bytecode.pl, bytecode.h, and sv.h fixes Message-ID: <20050421235547.GA12149@mccoy.peters.homeunix.org> p4raw-id: //depot/perl@24277 --- diff --git a/bytecode.pl b/bytecode.pl index 59069b3..aa0e027 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -423,7 +423,7 @@ mg_private SvMAGIC(bstate->bs_sv)->mg_private U16 mg_flags SvMAGIC(bstate->bs_sv)->mg_flags U8 mg_name SvMAGIC(bstate->bs_sv) pvcontents x mg_namex SvMAGIC(bstate->bs_sv) svindex x -xmg_stash bstate->bs_sv svindex X +xmg_stash bstate->bs_sv svindex x gv_fetchpv bstate->bs_sv strconst x gv_fetchpvx bstate->bs_sv strconst x gv_stashpv bstate->bs_sv strconst x diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index 11e7f5f..40c1e99 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -126,7 +126,7 @@ typedef char *pvindex; #define BSET_mg_namex(mg, arg) \ (mg->mg_ptr = (char*)SvREFCNT_inc((SV*)arg), \ mg->mg_len = HEf_SVKEY) -#define BSET_xmg_stash(sv, arg) SvSTASH_set(sv, arg) +#define BSET_xmg_stash(sv, arg) *(SV**)&(((XPVMG*)SvANY(sv))->xmg_stash) = (arg) #define BSET_sv_upgrade(sv, arg) (void)SvUPGRADE(sv, arg) #define BSET_xrv(sv, arg) SvRV_set(sv, arg) #define BSET_xpv(sv) do { \ diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c index bdc9555..a30a6e4 100644 --- a/ext/ByteLoader/byterun.c +++ b/ext/ByteLoader/byterun.c @@ -593,7 +593,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) { svindex arg; BGET_svindex(arg); - bstate->bs_sv = arg; + BSET_xmg_stash(bstate->bs_sv, arg); break; } case INSN_GV_FETCHPV: /* 77 */ diff --git a/sv.h b/sv.h index 940355e..cf71f03 100644 --- a/sv.h +++ b/sv.h @@ -750,14 +750,22 @@ in gv.h: */ #define SvLEN(sv) (0 + ((XPV*) SvANY(sv))->xpv_len) #define SvEND(sv) (((XPV*) SvANY(sv))->xpv_pv + ((XPV*)SvANY(sv))->xpv_cur) -#ifdef PERL_IN_SV_C +#ifdef DEBUGGING +# ifdef PERL_IN_SV_C /* Can't make this RVALUE because of Perl_sv_unmagic. */ -#define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) +# define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) +# else +# define SvMAGIC(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) +# endif +#define SvSTASH(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_stash)) #else -#define SvMAGIC(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) +# ifdef PERL_IN_SV_C +# define SvMAGIC(sv) ((XPVMG*) SvANY(sv))->xmg_magic +# else +# define SvMAGIC(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_magic) +# endif +#define SvSTASH(sv) (0 + ((XPVMG*) SvANY(sv))->xmg_stash) #endif -#define SvSTASH(sv) (0 + *(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_stash)) - #else #define SvIVX(sv) ((XPVIV*) SvANY(sv))->xiv_iv #define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv