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

Re: [perl.git] branch blead, updated. v5.13.1-59-g0824d66

From:
Nicholas Clark
Date:
May 25, 2010 15:08
Subject:
Re: [perl.git] branch blead, updated. v5.13.1-59-g0824d66
Message ID:
20100525220800.GC17934@plum.flirble.org
On Tue, May 25, 2010 at 01:45:17PM +0200, Dave Mitchell wrote:

>         Note that RV2GV probably needs this flag too, but there weren't any
>         spare private flag bits left for that op (I think).

Not sure if all the games that RV2CV uses might work here. op.c

	    o->op_type = OP_RV2CV;		/* entersub => rv2cv */
	    /* The default is to set op_private to the number of children,
	       which for a UNOP such as RV2CV is always 1. And w're using
	       the bit for a flag in RV2CV, so we need it clear.  */
	    o->op_private &= ~1;

so, clear that also for OP_RV2GV, then change OPpDONT_INIT_GV from 4 to 1:

  /* OP_RV2GV only */
#define OPpDONT_INIT_GV		4	/* Call gv_fetchpv with GV_NOINIT */
/* (Therefore will return whatever is currently in the symbol table, not
   guaranteed to be a PVGV)  */

  /* OP_RV2CV only */
#define OPpMAY_RETURN_CONSTANT	1	/* If a constant sub, return the constant */


> diff --git a/op.h b/op.h
> index b9327bb..b66c4a1 100644
> --- a/op.h
> +++ b/op.h
> @@ -191,6 +191,8 @@ Deprecated.  Use C<GIMME_V> instead.
>  #define OPpDEREF_AV		32	/*   Want ref to AV. */
>  #define OPpDEREF_HV		64	/*   Want ref to HV. */
>  #define OPpDEREF_SV		(32|64)	/*   Want ref to SV. */
> +/* Private for OP_RV2SV, OP_RV2AV, OP_RV2AV */
> +#define OPpDEREFed		4	/* prev op was OPpDEREF */

and then 4 is free to also be used on RV2GV.

[I think. There are quite a few more C<& ~1>s in op.c to clear that bit on
RV2CV, so it isn't a pretty solution.]

Nicholas Clark



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