develooper Front page | perl.perl5.porters | Postings from November 2003

Re: 5.8.2 coredump: tied hashes implemented as XSUB methods

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 14, 2003 15:46
Subject:
Re: 5.8.2 coredump: tied hashes implemented as XSUB methods
Message ID:
20031114234606.GS6287@plum.flirble.org
On Fri, Nov 14, 2003 at 11:31:22PM +0000, Alan Burlison wrote:
> I have a module (Solaris::Kstat) which implements a tied hash entirely from 
> XSUB code.  This works fine in 5.6.1, but cores in 5.8.2.  I've added some 

Could you try 5.8.0 and 5.8.1 easily? The hv_clear code seems to have
changed very little between 5.6.1 and 5.8.0, but 5.8.1 and 5.8.2 add
progressively more.

> debug code, and whilst all the other XSUB tied hash methods are being 
> called correctly, CLEAR isn't - it looks like Perl_hv_clear() is being 
> called rather than the tied CLEAR method.  The stack trace looks like this:
> 
> Perl_hv_clear
> Perl_pp_aassign
> Perl_runops_standard
> S_run_body
> perl_run
> main
> 
> i.e. no sign of the XSUB CLEAR method.  I haven't had time to nail this 
> down yet, but being lazy I wondered if anyone else had seem the same 
> problem?

I guess that the CLEAR gets invoked by hv_clear, as this:

    if (SvRMAGICAL(hv))
	mg_clear((SV*)hv);

but I don't actually know how hash magic works here.

[IIRC fetch and store magic works by returning a scalar with magic
linking back to the hash, which runs a sort-of callback if that scalar
is accessed]

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About