Discussion:
Change 29876: Move the flag checking for isGV_with_GP() into the call to visit()
(too old to reply)
nwc10+ (Nicholas Clark)
2007-01-18 23:45:02 UTC
Permalink
Change 29876 by ***@entropy on 2007/01/18 23:36:57

Move the flag checking for isGV_with_GP() into the call to visit()

Affected files ...

... //depot/perl/sv.c#1357 edit

Differences ...

==== //depot/perl/sv.c#1357 (text) ====
Index: perl/sv.c
--- perl/sv.c#1356~29872~ 2007-01-18 07:48:13.000000000 -0800
+++ perl/sv.c 2007-01-18 15:36:57.000000000 -0800
@@ -471,7 +471,8 @@
{
dVAR;
assert(SvTYPE(sv) == SVt_PVGV);
- if (isGV_with_GP(sv) && GvGP(sv)) {
+ assert(isGV_with_GP(sv));
+ if (GvGP(sv)) {
if ((
#ifdef PERL_DONT_CREATE_GVSV
GvSV(sv) &&
@@ -506,7 +507,7 @@
visit(do_clean_objs, SVf_ROK, SVf_ROK);
#ifndef DISABLE_DESTRUCTOR_KLUDGE
/* some barnacles may yet remain, clinging to typeglobs */
- visit(do_clean_named_objs, SVt_PVGV, SVTYPEMASK);
+ visit(do_clean_named_objs, SVt_PVGV|SVpgv_GP, SVTYPEMASK|SVp_POK|SVpgv_GP);
#endif
PL_in_clean_objs = FALSE;
}
End of Patch.
Rafael Garcia-Suarez
2007-01-20 08:05:27 UTC
Permalink
Post by nwc10+ (Nicholas Clark)
Move the flag checking for isGV_with_GP() into the call to visit()
Affected files ...
... //depot/perl/sv.c#1357 edit
Differences ...
==== //depot/perl/sv.c#1357 (text) ====
Index: perl/sv.c
--- perl/sv.c#1356~29872~ 2007-01-18 07:48:13.000000000 -0800
+++ perl/sv.c 2007-01-18 15:36:57.000000000 -0800
@@ -471,7 +471,8 @@
{
dVAR;
assert(SvTYPE(sv) == SVt_PVGV);
- if (isGV_with_GP(sv) && GvGP(sv)) {
+ assert(isGV_with_GP(sv));
+ if (GvGP(sv)) {
Is that really equivalent without DEBUGGING ?

--
Nicholas Clark
2007-01-20 11:15:13 UTC
Permalink
Post by Rafael Garcia-Suarez
Post by nwc10+ (Nicholas Clark)
Move the flag checking for isGV_with_GP() into the call to visit()
Affected files ...
... //depot/perl/sv.c#1357 edit
Differences ...
==== //depot/perl/sv.c#1357 (text) ====
Index: perl/sv.c
--- perl/sv.c#1356~29872~ 2007-01-18 07:48:13.000000000 -0800
+++ perl/sv.c 2007-01-18 15:36:57.000000000 -0800
@@ -471,7 +471,8 @@
{
dVAR;
assert(SvTYPE(sv) == SVt_PVGV);
- if (isGV_with_GP(sv) && GvGP(sv)) {
+ assert(isGV_with_GP(sv));
+ if (GvGP(sv)) {
Is that really equivalent without DEBUGGING ?
It (alone) isn't even equivalent with DEBUGGING - failing the assert() will
croak.
Post by Rafael Garcia-Suarez
==== //depot/perl/sv.c#1357 (text) ====
Index: perl/sv.c
--- perl/sv.c#1356~29872~ 2007-01-18 07:48:13.000000000 -0800
+++ perl/sv.c 2007-01-18 15:36:57.000000000 -0800
@@ -471,7 +471,8 @@
{
dVAR;
assert(SvTYPE(sv) == SVt_PVGV);
- if (isGV_with_GP(sv) && GvGP(sv)) {
+ assert(isGV_with_GP(sv));
+ if (GvGP(sv)) {
if ((
#ifdef PERL_DONT_CREATE_GVSV
GvSV(sv) &&
@@ -506,7 +507,7 @@
visit(do_clean_objs, SVf_ROK, SVf_ROK);
#ifndef DISABLE_DESTRUCTOR_KLUDGE
/* some barnacles may yet remain, clinging to typeglobs */
- visit(do_clean_named_objs, SVt_PVGV, SVTYPEMASK);
+ visit(do_clean_named_objs, SVt_PVGV|SVpgv_GP, SVTYPEMASK|SVp_POK|SVpgv_GP);
It should be that you now can't even get to the assertion, because the same
flags check is done one function further out, and if it fails,
do_clean_named_objs isn't even called.

Nicholas Clark

Loading...