summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2013-11-01 17:50:39 -0400
committerFather Chrysostomos <sprout@cpan.org>2013-11-02 05:39:00 -0700
commitcaa674f3cc1c9e05da7c41f3dffbea4b2640af3c (patch)
tree167ea4dfd31450a20a1f6200957a3e4bd4d4780d /cop.h
parentb82e68e8acf012df784511a23ba8b2dfbc3853b8 (diff)
downloadperl-caa674f3cc1c9e05da7c41f3dffbea4b2640af3c.tar.gz
remove redundant Zero() from JMPENV_BOOTSTRAP
In commit 14dd3ad8c9 , a 3 NULL assigns were converted to a Zero() for what I guess was an optimization. This also caused the large je_buf to be zeroed even though je_buf was uninit before. At that time, JMPENV had 2 extra members that don't exist anymore. The 2 extra members in JMPENV were removed in commit 766f891612 . The comment about je_throw was made obsolete in commit 766f891612 so rework it. One function call free NULL assign is faster than a memset() call. je_buf is 0x40 bytes long on 32 bit VC2003 Win32 Perl. No need to zero it since je_buf is never read unless je_prev is not NULL. Also there is no need to zero the last 2 members je_ret and je_mustcatch since they are immediatley assigned to. Move PL_top_env assignment to near je_prev so compiler tries to optimize better since je_prev is the start of the struct and hopefully will calculate the pointer once. Also put some poisoning in case JMPENV gets new members in the future. To conditionally poison in a macro, PERL_POISON_EXPR is being introduced instead of 2 different definitions of JMPENV_BOOTSTRAP.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/cop.h b/cop.h
index 2a976adee2..6950814613 100644
--- a/cop.h
+++ b/cop.h
@@ -31,7 +31,7 @@
struct jmpenv {
struct jmpenv * je_prev;
- Sigjmp_buf je_buf; /* only for use if !je_throw */
+ Sigjmp_buf je_buf; /* uninit if je_prev is NULL */
int je_ret; /* last exception thrown */
bool je_mustcatch; /* need to call longjmp()? */
};
@@ -50,10 +50,11 @@ typedef struct jmpenv JMPENV;
#define JMPENV_BOOTSTRAP \
STMT_START { \
- Zero(&PL_start_env, 1, JMPENV); \
+ PERL_POISON_EXPR(PoisonNew(&PL_start_env, 1, JMPENV));\
+ PL_top_env = &PL_start_env; \
+ PL_start_env.je_prev = NULL; \
PL_start_env.je_ret = -1; \
PL_start_env.je_mustcatch = TRUE; \
- PL_top_env = &PL_start_env; \
} STMT_END
/*