Change 34829 by [EMAIL PROTECTED] on 2008/11/13 05:47:34
Subject: Re: [perl #60360] [PATCH] UPDATED: local $SIG{FOO} = sub
{...}; sets signal handler to SIG_DFL
From: Chip Salzenberg <[EMAIL PROTECTED]>
Date: Wed, 12 Nov 2008 15:45:04 -0800
Message-ID: <[EMAIL PROTECTED]>
Updated patch to retain source compatibility.
Plus using the correct PERL_ARGS_ASSERT_SAVE_HELEM_FLAGS
macro and running make regen.
Affected files ...
... //depot/perl/embed.fnc#630 edit
... //depot/perl/embed.h#767 edit
... //depot/perl/global.sym#358 edit
... //depot/perl/mg.c#542 edit
... //depot/perl/pod/perlintern.pod#77 edit
... //depot/perl/pp.c#643 edit
... //depot/perl/pp_hot.c#590 edit
... //depot/perl/proto.h#965 edit
... //depot/perl/scope.c#234 edit
... //depot/perl/scope.h#94 edit
Differences ...
==== //depot/perl/embed.fnc#630 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#629~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/embed.fnc 2008-11-12 21:47:34.000000000 -0800
@@ -518,7 +518,7 @@
Apd |int |mg_clear |NN SV* sv
Apd |int |mg_copy |NN SV *sv|NN SV *nsv|NULLOK const char *key \
|I32 klen
-pd |void |mg_localize |NN SV* sv|NN SV* nsv|I32 empty
+pd |void |mg_localize |NN SV* sv|NN SV* nsv|bool setmagic
ApdR |MAGIC* |mg_find |NULLOK const SV* sv|int type
Apd |int |mg_free |NN SV* sv
Apd |int |mg_get |NN SV* sv
@@ -790,7 +790,8 @@
Ap |void |save_shared_pvref|NN char** str
Ap |void |save_gp |NN GV* gv|I32 empty
Ap |HV* |save_hash |NN GV* gv
-Ap |void |save_helem |NN HV *hv|NN SV *key|NN SV **sptr|I32 empty
+Amp |void |save_helem |NN HV *hv|NN SV *key|NN SV **sptr
+Ap |void |save_helem_flags|NN HV *hv|NN SV *key|NN SV **sptr|const U32
flags
Ap |void |save_hptr |NN HV** hptr
Ap |void |save_I16 |NN I16* intp
Ap |void |save_I32 |NN I32* intp
@@ -1550,7 +1551,7 @@
#endif
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
-s |SV* |save_scalar_at |NN SV **sptr|I32 empty
+s |SV* |save_scalar_at |NN SV **sptr|const U32 flags
#endif
#if defined(PERL_IN_GV_C) || defined(PERL_IN_SV_C) || defined(PERL_IN_PAD_C)
|| defined(PERL_DECL_PROT)
==== //depot/perl/embed.h#767 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#766~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/embed.h 2008-11-12 21:47:34.000000000 -0800
@@ -770,7 +770,7 @@
#define save_shared_pvref Perl_save_shared_pvref
#define save_gp Perl_save_gp
#define save_hash Perl_save_hash
-#define save_helem Perl_save_helem
+#define save_helem_flags Perl_save_helem_flags
#define save_hptr Perl_save_hptr
#define save_I16 Perl_save_I16
#define save_I32 Perl_save_I32
@@ -3086,7 +3086,7 @@
#define save_shared_pvref(a) Perl_save_shared_pvref(aTHX_ a)
#define save_gp(a,b) Perl_save_gp(aTHX_ a,b)
#define save_hash(a) Perl_save_hash(aTHX_ a)
-#define save_helem(a,b,c,d) Perl_save_helem(aTHX_ a,b,c,d)
+#define save_helem_flags(a,b,c,d) Perl_save_helem_flags(aTHX_ a,b,c,d)
#define save_hptr(a) Perl_save_hptr(aTHX_ a)
#define save_I16(a) Perl_save_I16(aTHX_ a)
#define save_I32(a) Perl_save_I32(aTHX_ a)
==== //depot/perl/global.sym#358 (text+w) ====
Index: perl/global.sym
--- perl/global.sym#357~34586~ 2008-10-25 05:47:01.000000000 -0700
+++ perl/global.sym 2008-11-12 21:47:34.000000000 -0800
@@ -450,7 +450,7 @@
Perl_save_shared_pvref
Perl_save_gp
Perl_save_hash
-Perl_save_helem
+Perl_save_helem_flags
Perl_save_hptr
Perl_save_I16
Perl_save_I32
==== //depot/perl/mg.c#542 (text) ====
Index: perl/mg.c
--- perl/mg.c#541~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/mg.c 2008-11-12 21:47:34.000000000 -0800
@@ -467,7 +467,7 @@
SV. Container magic (eg %ENV, $1, tie) gets copied, value magic doesn't (eg
taint, pos).
-If empty is false then no set magic will be called on the new (empty) SV.
+If setmagic is false then no set magic will be called on the new (empty) SV.
This typically means that assignment will soon follow (e.g. 'local $x = $y'),
and that will handle the magic.
@@ -475,7 +475,7 @@
*/
void
-Perl_mg_localize(pTHX_ SV *sv, SV *nsv, I32 empty)
+Perl_mg_localize(pTHX_ SV *sv, SV *nsv, bool setmagic)
{
dVAR;
MAGIC *mg;
@@ -499,7 +499,7 @@
if (SvTYPE(nsv) >= SVt_PVMG && SvMAGIC(nsv)) {
SvFLAGS(nsv) |= SvMAGICAL(sv);
- if (empty) {
+ if (setmagic) {
PL_localizing = 1;
SvSETMAGIC(nsv);
PL_localizing = 0;
==== //depot/perl/pod/perlintern.pod#77 (text+w) ====
Index: perl/pod/perlintern.pod
--- perl/pod/perlintern.pod#76~34820~ 2008-11-12 02:42:21.000000000 -0800
+++ perl/pod/perlintern.pod 2008-11-12 21:47:34.000000000 -0800
@@ -464,11 +464,11 @@
SV. Container magic (eg %ENV, $1, tie) gets copied, value magic doesn't (eg
taint, pos).
-If empty is false then no set magic will be called on the new (empty) SV.
+If setmagic is false then no set magic will be called on the new (empty) SV.
This typically means that assignment will soon follow (e.g. 'local $x = $y'),
and that will handle the magic.
- void mg_localize(SV* sv, SV* nsv, I32 empty)
+ void mg_localize(SV* sv, SV* nsv, bool setmagic)
=for hackers
Found in file mg.c
==== //depot/perl/pp.c#643 (text) ====
Index: perl/pp.c
--- perl/pp.c#642~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/pp.c 2008-11-12 21:47:34.000000000 -0800
@@ -4185,7 +4185,8 @@
save_gp(MUTABLE_GV(*svp), !(PL_op->op_flags & OPf_SPECIAL));
else {
if (preeminent)
- save_helem(hv, keysv, svp, !(PL_op->op_flags &
OPf_SPECIAL));
+ save_helem_flags(hv, keysv, svp,
+ (PL_op->op_flags & OPf_SPECIAL) ? 0 :
SAVEf_SETMAGIC);
else {
STRLEN keylen;
const char * const key = SvPV_const(keysv, keylen);
==== //depot/perl/pp_hot.c#590 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#589~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/pp_hot.c 2008-11-12 21:47:34.000000000 -0800
@@ -1828,7 +1828,8 @@
SAVEDELETE(hv, savepvn(key,keylen),
SvUTF8(keysv) ? -(I32)keylen : (I32)keylen);
} else
- save_helem(hv, keysv, svp, !(PL_op->op_flags &
OPf_SPECIAL));
+ save_helem_flags(hv, keysv, svp,
+ (PL_op->op_flags & OPf_SPECIAL) ? 0 :
SAVEf_SETMAGIC);
}
}
else if (PL_op->op_private & OPpDEREF)
==== //depot/perl/proto.h#965 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#964~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/proto.h 2008-11-12 21:47:34.000000000 -0800
@@ -1848,7 +1848,7 @@
#define PERL_ARGS_ASSERT_MG_COPY \
assert(sv); assert(nsv)
-PERL_CALLCONV void Perl_mg_localize(pTHX_ SV* sv, SV* nsv, I32 empty)
+PERL_CALLCONV void Perl_mg_localize(pTHX_ SV* sv, SV* nsv, bool setmagic)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_MG_LOCALIZE \
@@ -2830,13 +2830,20 @@
#define PERL_ARGS_ASSERT_SAVE_HASH \
assert(gv)
-PERL_CALLCONV void Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr, I32
empty)
+/* PERL_CALLCONV void Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
- __attribute__nonnull__(pTHX_3);
+ __attribute__nonnull__(pTHX_3); */
#define PERL_ARGS_ASSERT_SAVE_HELEM \
assert(hv); assert(key); assert(sptr)
+PERL_CALLCONV void Perl_save_helem_flags(pTHX_ HV *hv, SV *key, SV **sptr,
const U32 flags)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_SAVE_HELEM_FLAGS \
+ assert(hv); assert(key); assert(sptr)
+
PERL_CALLCONV void Perl_save_hptr(pTHX_ HV** hptr)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SAVE_HPTR \
@@ -5498,7 +5505,7 @@
#endif
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
-STATIC SV* S_save_scalar_at(pTHX_ SV **sptr, I32 empty)
+STATIC SV* S_save_scalar_at(pTHX_ SV **sptr, const U32 flags)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_SAVE_SCALAR_AT \
assert(sptr)
==== //depot/perl/scope.c#234 (text) ====
Index: perl/scope.c
--- perl/scope.c#233~34819~ 2008-11-12 02:37:46.000000000 -0800
+++ perl/scope.c 2008-11-12 21:47:34.000000000 -0800
@@ -164,7 +164,7 @@
}
STATIC SV *
-S_save_scalar_at(pTHX_ SV **sptr, I32 empty)
+S_save_scalar_at(pTHX_ SV **sptr, const U32 flags)
{
dVAR;
SV * const osv = *sptr;
@@ -179,7 +179,7 @@
(SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
PL_tainted = oldtainted;
}
- mg_localize(osv, sv, empty);
+ mg_localize(osv, sv, (flags & SAVEf_SETMAGIC) != 0);
}
return sv;
}
@@ -199,7 +199,7 @@
SSPUSHPTR(SvREFCNT_inc_simple(gv));
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_SV);
- return save_scalar_at(sptr, TRUE); /* XXX - FIXME - see #60360 */
+ return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}
/* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
@@ -611,7 +611,7 @@
/* if it gets reified later, the restore will have the wrong refcnt */
if (!AvREAL(av) && AvREIFY(av))
SvREFCNT_inc_void(*sptr);
- save_scalar_at(sptr, TRUE); /* XXX - FIXME - see #60360 */
+ save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
sv = *sptr;
/* If we're localizing a tied array element, this new sv
* won't actually be stored in the array - so it won't get
@@ -622,12 +622,12 @@
}
void
-Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr, I32 empty)
+Perl_save_helem_flags(pTHX_ HV *hv, SV *key, SV **sptr, const U32 flags)
{
dVAR;
SV *sv;
- PERL_ARGS_ASSERT_SAVE_HELEM;
+ PERL_ARGS_ASSERT_SAVE_HELEM_FLAGS;
SvGETMAGIC(*sptr);
SSCHECK(4);
@@ -635,7 +635,7 @@
SSPUSHPTR(newSVsv(key));
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_HELEM);
- save_scalar_at(sptr, empty);
+ save_scalar_at(sptr, flags);
sv = *sptr;
/* If we're localizing a tied hash element, this new sv
* won't actually be stored in the hash - so it won't get
@@ -657,7 +657,7 @@
SSPUSHPTR(sptr);
SSPUSHPTR(SvREFCNT_inc(*sptr));
SSPUSHINT(SAVEt_SVREF);
- return save_scalar_at(sptr, TRUE); /* XXX - FIXME - see #60360 */
+ return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */
}
void
==== //depot/perl/scope.h#94 (text) ====
Index: perl/scope.h
--- perl/scope.h#93~34619~ 2008-10-28 11:30:54.000000000 -0700
+++ perl/scope.h 2008-11-12 21:47:34.000000000 -0800
@@ -55,6 +55,10 @@
#define SAVEt_STACK_CXPOS 44
#define SAVEt_PARSER 45
+#define SAVEf_SETMAGIC 1
+
+#define save_helem(hv,key,sptr)
save_helem_flags(hv,key,sptr,SAVEf_SETMAGIC)
+
#ifndef SCOPE_SAVES_SIGNAL_MASK
#define SCOPE_SAVES_SIGNAL_MASK 0
#endif
End of Patch.