
rurban at x-ray
Jun 5, 2012, 11:07 AM
Post #6 of 14
(186 views)
Permalink
|
|
Re: [perl #78742] eval '__PACKAGE__' works differently with threads than without
[In reply to]
|
|
On Tue, Jun 5, 2012 at 11:48 AM, Father Chrysostomos via RT <perlbug-comment [at] perl> wrote: > On Tue Jun 05 09:33:15 2012, rurban wrote: >> On Tue, Jun 5, 2012 at 11:16 AM, Father Chrysostomos via RT >> <perlbug-comment [at] perl> wrote: >> > On Tue Jun 05 08:52:54 2012, reini [at] cpanel wrote: >> >> On 06/04/2012 01:25 AM, Father Chrysostomos via RT wrote: >> >> > On Sun Oct 31 17:16:43 2010, sprout wrote: >> >> >> Threaded: >> >> >> $ perl -le' package bar; *foo:: = *bar::; *bar:: = *baz::; print > eval >> >> >> "__PACKAGE__"' >> >> >> baz >> >> >> >> >> >> Unthreaded: >> >> >> $ perl -le' package bar; *foo:: = *bar::; *bar:: = *baz::; print > eval >> >> >> "__PACKAGE__"' >> >> >> bar >> >> >> >> >> >> I think the latter is correct. >> >> > >> >> > I have a partially-written fix (I’m still getting assertion failures) >> >> > for this on the smoke-me/copstash branch. >> >> > >> >> > It replaces cop->cop_stashpv and cop_stashlen with cop_stashoff, that >> >> > points to an offset in the newly-added PL_stashpad array. >> >> > >> >> > In order to get B to compile, I had to comment out the stashpv > method. >> >> > >> >> > How low-level is B supposed to be? Should I replace stashpv with >> >> > stashoff? Or should I simply provide B::COP::stash for both threaded >> >> > and non-threaded perls, and not expose the fact that it uses an > offset >> >> > in PL_stashpad? >> >> >> >> Ad B: >> >> Since I have to recreate the new PL_stashpad in B::C, Byteloader and >> >> friends I need B::COP::stashoff exposed. >> >> >> >> Having reliable public readers and writers for B::COP::stash would also >> >> help, but I don't trust p5p's reliability on such low-level APIs. >> >> Now the string API is gone and we have hashes again. >> >> I rather do it by myself, as p5p tends to break the low-level APIs very >> >> often and refuse to fix it later. >> > >> > You are being awfully vague. I’m perfectly willing to accommodate the >> > needs of B::C, but I don’t understand what you need. >> > >> > Does B::C need access to all of perl’s innards, such that we can’t even >> > fix bugs? >> >> I never said that. On the contrary I would like to get bug fixed, >> but they are typically warnocked for about two major releases until >> they get fixed. >> >> I said that I need either a reliable public API to read+write new data, >> or expose the innards so that I can do it by myself. >> There's also no need for a deprecation cycle for those innards. > > If I add stashoff to B::COP, is that sufficient for your needs? > It can simply return 0 for non-threaded perls. Yes. I already check threaded, so no need. I closely follow cop.h. All the struct cop fields must be exposed. cop_stashoff is threaded only. BTW: the comment for PADOFFSET cop_stashoff; /* package line was compiled in */ is wrong. PL_stashpad offset it should be. > And we can backport to 5.16.1 your patch that added B::COP::stashlen, in > which case we should add it back to bleadperl, even if it is no longer > necessary. If it's not needed I don't need it either. I have now added the exception that CopSTASHPV_set threaded needs 3 args on 5.16.0 only, all other versions need the old and new 2 args. -- Reini Urban http://cpanel.net/ http://www.perl-compiler.org/
|