From: Nicholas Clark Date: Mon, 13 Jun 2005 16:24:57 +0000 (+0000) Subject: With shared hash key scalars now accessing the hash via the PVX, you X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=427d62a407a31445bc7585263d1b781552e27ce5;p=p5sagit%2Fp5-mst-13.2.git With shared hash key scalars now accessing the hash via the PVX, you can't fake them with regular PVIVs. So fake method calls have to use real shared hask key scalars. p4raw-id: //depot/perl@24824 --- diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t index 2bead37..ba91dda 100644 --- a/ext/B/t/optree_specials.t +++ b/ext/B/t/optree_specials.t @@ -66,7 +66,7 @@ checkOptree ( name => 'BEGIN', # 6 <0> pushmark s ->7 # 7 <$> const[PV "warnings"] sM ->8 # 8 <$> const[PV "qw"] sM ->9 -# 9 <$> method_named[PVIV 1520340202] ->a +# 9 <$> method_named[PV "import"] ->a # BEGIN 2: # f <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->f @@ -88,7 +88,7 @@ EOT_EOT # 6 <0> pushmark s ->7 # 7 <$> const(PV "warnings") sM ->8 # 8 <$> const(PV "qw") sM ->9 -# 9 <$> method_named(PVIV 1520340202) ->a +# 9 <$> method_named(PV "import") ->a # BEGIN 2: # f <1> leavesub[1 ref] K/REFC,1 ->(end) # - <@> lineseq KP ->f @@ -180,7 +180,7 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK -exec', # 6 <0> pushmark s # 7 <$> const[PV "warnings"] sM # 8 <$> const[PV "qw"] sM -# 9 <$> method_named[PVIV 1520340202] +# 9 <$> method_named[PV "unimport"] # a <1> entersub[t1] KS*/TARG,2 # b <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: @@ -213,7 +213,7 @@ EOT_EOT # 6 <0> pushmark s # 7 <$> const(PV "warnings") sM # 8 <$> const(PV "qw") sM -# 9 <$> method_named(PVIV 1520340202) +# 9 <$> method_named(PV "unimport") # a <1> entersub[t1] KS*/TARG,2 # b <1> leavesub[1 ref] K/REFC,1 # BEGIN 2: diff --git a/op.c b/op.c index f165c25..bfdd1aa 100644 --- a/op.c +++ b/op.c @@ -1595,14 +1595,7 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp) dup_attrlist(attrs))); /* Fake up a method call to import */ - meth = newSVpvn("import", 6); - SvUPGRADE(meth, SVt_PVIV); - (void)SvIOK_on(meth); - { - U32 hash; - PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth)); - SvUV_set(meth, hash); - } + meth = newSVpvn_share("import", 6, 0); imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL|OPf_WANT_VOID, append_elem(OP_LIST, prepend_elem(OP_LIST, pack, list(arg)), @@ -3050,14 +3043,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)idop)->op_sv)); /* Fake up a method call to VERSION */ - meth = newSVpvn("VERSION",7); - sv_upgrade(meth, SVt_PVIV); - (void)SvIOK_on(meth); - { - U32 hash; - PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth)); - SvUV_set(meth, hash); - } + meth = newSVpvn_share("VERSION", 7, 0); veop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL, append_elem(OP_LIST, prepend_elem(OP_LIST, pack, list(version)), @@ -3078,14 +3064,8 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)idop)->op_sv)); /* Fake up a method call to import/unimport */ - meth = aver ? newSVpvn("import",6) : newSVpvn("unimport", 8); - SvUPGRADE(meth, SVt_PVIV); - (void)SvIOK_on(meth); - { - U32 hash; - PERL_HASH(hash, SvPVX_const(meth), SvCUR(meth)); - SvUV_set(meth, hash); - } + meth = aver + ? newSVpvn_share("import",6, 0) : newSVpvn_share("unimport", 8, 0); imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL, append_elem(OP_LIST, prepend_elem(OP_LIST, pack, list(arg)), @@ -3094,7 +3074,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) /* Fake up the BEGIN {}, which does its thing immediately. */ newATTRSUB(floor, - newSVOP(OP_CONST, 0, newSVpvn("BEGIN", 5)), + newSVOP(OP_CONST, 0, newSVpvn_share("BEGIN", 5, 0)), Nullop, Nullop, append_elem(OP_LINESEQ,