develooper Front page | perl.perl5.porters | Postings from May 2015

Re: 5.22 breaks Coro-6.42

Thread Previous | Thread Next
From:
bulk88
Date:
May 31, 2015 20:13
Subject:
Re: 5.22 breaks Coro-6.42
Message ID:
BLU436-SMTP294BD6F722A49A57C28715DFB70@phx.gbl
Max Maischein wrote:
> I did some spelunking in git history and some comparing between 5.20 and 
> 5.22-RC2, and here are my findings (as on irc):
> 
> There are two errors. One can be easily fixed by reverting the patch 
> c910fead7893fe9700031ee59de6b904260b5d69 :
> 
> State.xs:3472:9: error: assignment of member 'svt_get' in read-only object
>          orig_sigelem_get = PL_vtbl_sigelem.svt_get; 
> PL_vtbl_sigelem.svt_get
>  = coro_sigelem_get;
>          ^
> State.xs:3473:9: error: assignment of member 'svt_set' in read-only object
>          orig_sigelem_set = PL_vtbl_sigelem.svt_set; 
> PL_vtbl_sigelem.svt_set
>  = coro_sigelem_set;
>          ^
> State.xs:3474:9: error: assignment of member 'svt_clear' in read-only 
> object
>          orig_sigelem_clr = PL_vtbl_sigelem.svt_clear; 
> PL_vtbl_sigelem.svt_clear
>  = coro_sigelem_clr;
>          ^

Since I wrote that patch the solution is make your own magic vtable 
(struct mgvtbl), copy the function pointers you want from the core's 
vtable RO vtable to your RW vtable in your XS module. Then call 
mg_findext to get the core created MG *, and assign your vtable to 
mg->mg_virtual replacing the core one.

Another question, does core actually use or call anything in 
PL_vtbl_sigelem? I cant grep up where 's' magic is created or the vtable 
is used. I see

-------------------------------------------------------------------
	    case 'S':
		if (strEQ(name2, "IG")) {
		    HV *hv;
		    I32 i;
		    if (!PL_psig_name) {
			Newxz(PL_psig_name, 2 * SIG_SIZE, SV*);
			Newxz(PL_psig_pend, SIG_SIZE, int);
			PL_psig_ptr = PL_psig_name + SIG_SIZE;
		    } else {
			/* I think that the only way to get here is to re-use an
			   embedded perl interpreter, where the previous
			   use didn't clean up fully because
			   PL_perl_destruct_level was 0. I'm not sure that we
			   "support" that, in that I suspect in that scenario
			   there are sufficient other garbage values left in the
			   interpreter structure that something else will crash
			   before we get here. I suspect that this is one of
			   those "doctor, it hurts when I do this" bugs.  */
			Zero(PL_psig_name, 2 * SIG_SIZE, SV*);
			Zero(PL_psig_pend, SIG_SIZE, int);
		    }
		    GvMULTI_on(gv);
		    hv = GvHVn(gv);
		    hv_magic(hv, NULL, PERL_MAGIC_sig);
		    for (i = 1; i < SIG_SIZE; i++) {
			SV * const * const init = hv_fetch(hv, PL_sig_name[i], 
strlen(PL_sig_name[i]), 1);
			if (init)
			    sv_setsv(*init, &PL_sv_undef);
		    }
		}
		break;
-------------------------------------------------------------------
in gv.g but that is only PERL_MAGIC_sig not PERL_MAGIC_sigelem.

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