cvs commit: ponie/perl mg.c pad.c pp.c pp_hot.c util.c

[email protected] (Nicholas Clark) 16 Oct 2004 07:59:38 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     04/10/16 00:59:38

  Modified:    perl     mg.c pad.c pp.c pp_hot.c util.c
  Log:
  Remove SvFLAGS() LVALUE access in magic, warnings code, pads and
  pre/post-increment ops.
  
  Revision  Changes    Path
  1.6       +29 -5     ponie/perl/mg.c
  
  Index: mg.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/mg.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- mg.c	19 Jun 2004 14:06:12 -0000	1.5
  +++ mg.c	16 Oct 2004 07:59:37 -0000	1.6
  @@ -87,7 +87,12 @@
   
       SvMAGICAL_off(sv);
       SvREADONLY_off(sv);
  -    SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
  +    /* SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
  +       becomes  */
  +    if (SvPOKp(sv))
  +      SvPOK_on(sv);
  +    if (SvNOKp(sv))
  +      SvNOK_on(sv);
   }
   
   /*
  @@ -2642,12 +2647,31 @@
   	    sv_force_normal(sv);
   #endif
   
  -	if (mgs->mgs_flags)
  -	    SvFLAGS(sv) |= mgs->mgs_flags;
  +	if (mgs->mgs_flags) {
  +	    /* SvFLAGS(sv) |= mgs->mgs_flags; */
  +	    if (mgs->mgs_flags & SVf_READONLY)
  +		SvREADONLY_on(sv);
  +	    if (mgs->mgs_flags & SVs_GMG)
  +		SvGMAGICAL_on(sv);
  +	    if (mgs->mgs_flags & SVs_RMG)
  +		SvRMAGICAL_on(sv);
  +	    if (mgs->mgs_flags & SVs_SMG)
  +		SvSMAGICAL_on(sv);
  +	    if (mgs->mgs_flags & ~(SVf_READONLY|SVs_GMG|SVs_RMG|SVs_SMG))
  +		Perl_croak(aTHX_ "panic: restore_magic flags %08X",
  +			   mgs->mgs_flags);
  +	}
   	else
   	    mg_magical(sv);
  -	if (SvGMAGICAL(sv))
  -	    SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|SVf_POK);
  +	if (SvGMAGICAL(sv)) {
  +	    /* SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|SVf_POK); */
  +	    Parrot_PMC_set_intval_intkey(PL_Parrot, MUMBLE(sv),
  +					 Ponie_I_SVf_IOK, 0);
  +	    Parrot_PMC_set_intval_intkey(PL_Parrot, MUMBLE(sv),
  +					 Ponie_I_SVf_NOK, 0);
  +	    Parrot_PMC_set_intval_intkey(PL_Parrot, MUMBLE(sv),
  +					 Ponie_I_SVf_POK, 0);
  +	}
       }
   
       mgs->mgs_sv = NULL;  /* mark the MGS structure as restored */
  
  
  
  1.3       +6 -2      ponie/perl/pad.c
  
  Index: pad.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/pad.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- pad.c	15 Oct 2004 23:04:41 -0000	1.2
  +++ pad.c	16 Oct 2004 07:59:37 -0000	1.3
  @@ -401,8 +401,9 @@
       if (tmptype & SVs_PADMY) {
   	sv = *av_fetch(PL_comppad, AvFILLp(PL_comppad) + 1, TRUE);
   	retval = AvFILLp(PL_comppad);
  +	SvPADMY_on(sv);
       }
  -    else {
  +    else if (tmptype & SVs_PADTMP) {
   	SV **names = AvARRAY(PL_comppad_name);
   	SSize_t names_fill = AvFILLp(PL_comppad_name);
   	for (;;) {
  @@ -421,8 +422,11 @@
   		break;
   	}
   	retval = PL_padix;
  +	SvPADTMP_on(sv);
  +    }
  +    else {
  +	Perl_croak(aTHX_ "panic: pad_alloc called with type %08X", tmptype);
       }
  -    SvFLAGS(sv) |= tmptype;
       PL_curpad = AvARRAY(PL_comppad);
   
       DEBUG_X(PerlIO_printf(Perl_debug_log,
  
  
  
  1.3       +9 -3      ponie/perl/pp.c
  
  Index: pp.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/pp.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- pp.c	23 Jun 2004 10:54:24 -0000	1.2
  +++ pp.c	16 Oct 2004 07:59:37 -0000	1.3
  @@ -836,7 +836,9 @@
           && SvIVX(TOPs) != IV_MIN)
       {
   	--SvIVX(TOPs);
  -	SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
  +	/* SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK); */
  +	SvPOK_off(TOPs);
  +	SvNOK_off(TOPs);
       }
       else
   	sv_dec(TOPs);
  @@ -854,7 +856,9 @@
           && SvIVX(TOPs) != IV_MAX)
       {
   	++SvIVX(TOPs);
  -	SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
  +	/* SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK); */
  +	SvPOK_off(TOPs);
  +	SvNOK_off(TOPs);
       }
       else
   	sv_inc(TOPs);
  @@ -876,7 +880,9 @@
           && SvIVX(TOPs) != IV_MIN)
       {
   	--SvIVX(TOPs);
  -	SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
  +	/* SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK); */
  +	SvPOK_off(TOPs);
  +	SvNOK_off(TOPs);
       }
       else
   	sv_dec(TOPs);
  
  
  
  1.7       +3 -1      ponie/perl/pp_hot.c
  
  Index: pp_hot.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/pp_hot.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- pp_hot.c	11 Oct 2004 16:26:14 -0000	1.6
  +++ pp_hot.c	16 Oct 2004 07:59:37 -0000	1.7
  @@ -303,7 +303,9 @@
           && SvIVX(TOPs) != IV_MAX)
       {
   	++SvIVX(TOPs);
  -	SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
  +	/*SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);*/
  +	SvPOK_off(TOPs);
  +	SvNOK_off(TOPs);
       }
       else /* Do all the PERL_PRESERVE_IVUV conditionals in sv_inc */
   	sv_inc(TOPs);
  
  
  
  1.7       +17 -9     ponie/perl/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /cvs/public/ponie/perl/util.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- util.c	21 Jun 2004 16:34:16 -0000	1.6
  +++ util.c	16 Oct 2004 07:59:37 -0000	1.7
  @@ -836,7 +836,7 @@
       sv = MUMBLE(pvpvmg);
   
       Newz(905, any, 1, XPVMG);
  -    SvFLAGS(sv) = SVt_PVMG;
  +    SvTYPE_set(sv, SVt_PVMG);
       SvANY(sv) = /*(void*)MUMBLE(pvpvmg);*/ any;
       SvREFCNT(sv) = 1 << 30; /* practically infinite */
       SvPMC_on(sv);
  @@ -1087,7 +1087,8 @@
   	    save_re_context();
   	    if (message) {
   		msg = newSVpvn(message, msglen);
  -		SvFLAGS(msg) |= utf8;
  +		if (utf8)
  +		  SvUTF8_on(msg);
   		SvREADONLY_on(msg);
   		SAVEFREESV(msg);
   	    }
  @@ -1106,7 +1107,8 @@
       }
   
       PL_restartop = die_where(message, msglen);
  -    SvFLAGS(ERRSV) |= utf8;
  +    if (utf8)
  +      SvUTF8_on(ERRSV);
       DEBUG_S(PerlIO_printf(Perl_debug_log,
   	  "%p: die: restartop = %p, was_in_eval = %d, top_env = %p\n",
   	  thr, PL_restartop, was_in_eval, PL_top_env));
  @@ -1186,7 +1188,8 @@
   	    save_re_context();
   	    if (message) {
   		msg = newSVpvn(message, msglen);
  -		SvFLAGS(msg) |= utf8;
  +		if (utf8)
  +		  SvUTF8_on(msg);
   		SvREADONLY_on(msg);
   		SAVEFREESV(msg);
   	    }
  @@ -1205,7 +1208,8 @@
       }
       if (PL_in_eval) {
   	PL_restartop = die_where(message, msglen);
  -	SvFLAGS(ERRSV) |= utf8;
  +	if (utf8)
  +	  SvUTF8_on(ERRSV);
   	JMPENV_JUMP(3);
       }
       else if (!message)
  @@ -1288,7 +1292,8 @@
   	    ENTER;
   	    save_re_context();
   	    msg = newSVpvn(message, msglen);
  -	    SvFLAGS(msg) |= utf8;
  +	    if (utf8)
  +		SvUTF8_on(msg);
   	    SvREADONLY_on(msg);
   	    SAVEFREESV(msg);
   
  @@ -1388,7 +1393,8 @@
   		ENTER;
   		save_re_context();
   		msg = newSVpvn(message, msglen);
  -		SvFLAGS(msg) |= utf8;
  +		if (utf8)
  +		    SvUTF8_on(msg);
   		SvREADONLY_on(msg);
   		SAVEFREESV(msg);
   
  @@ -1403,7 +1409,8 @@
   	}
   	if (PL_in_eval) {
   	    PL_restartop = die_where(message, msglen);
  -	    SvFLAGS(ERRSV) |= utf8;
  +	    if (utf8)
  +		SvUTF8_on(ERRSV);
   	    JMPENV_JUMP(3);
   	}
   	write_to_stderr(message, msglen);
  @@ -1425,7 +1432,8 @@
   		ENTER;
   		save_re_context();
   		msg = newSVpvn(message, msglen);
  -		SvFLAGS(msg) |= utf8;
  +		if (utf8)
  +		    SvUTF8_on(msg);
   		SvREADONLY_on(msg);
   		SAVEFREESV(msg);