develooper Front page | perl.perl5.porters | Postings from October 2012

[perl #79824] hash value sharing breakage

Thread Previous | Thread Next
Father Chrysostomos via RT
October 5, 2012 15:58
[perl #79824] hash value sharing breakage
Message ID:
On Fri Jan 06 23:54:01 2012, sprout wrote:
> On Fri Nov 26 08:20:26 2010, wrote:
> > Now, another complication.  My real code behind this actually isn't
> > calling Encode::_utf8_on().  It's XS code, and it's doing SvUTF8_on()
> > on an sv_mortalcopy() of the original key.  If I change
> >    sv_mortalcopy()
> > to sv_2mortal(newSVsv()) then the problem goes away.  This seems
> >    strange,
> > since both sv_mortalcopy() and newSVsv() claim (in perlapi(1)) to
> >    perform
> > their copying via sv_setsv().
> I can tell you what the code is actually doing:
> sv_setsv is a macro wrapper around sv_setsv_flags, which will allow
> COWing if PERL_CORE is defined, but not otherwise.
> sv_mortalcopy is in core, so it COWs.
> newSVsv calls sv_setsv_flags, but without the SV_DO_COW_SVSETSV flag. 
> It seems like an omission to me.  But putting the flag there would break
> XS code.
> Maybe sv_mortalcopy should be modified not to trigger COWing.  Maybe we
> need to make it a macro around sv_mortalcopy_flags or some such, that
> does the same conditional flag application based on PERL_CORE.

Done with commit 108cb98.


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About