diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-10-10 13:29:33 -0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 14:30:21 -0700 |
commit | a953aca586d48d6f0b2c4db3572de328ed6d85e8 (patch) | |
tree | 244c1608b1f36a40c1c0b27105586d1d19949f65 /embed.fnc | |
parent | de183bbb2f50be045697c1759931907c5e7bdf28 (diff) | |
download | perl-a953aca586d48d6f0b2c4db3572de328ed6d85e8.tar.gz |
optimize & rmv from public API Perl_tmps_grow and related code
Previously in PUSH_EXTEND_MORTAL__SV_C, "PL_tmps_ix + 1" would execute
twice, once for the nonmutable if(>=), then again after the potential
tmps_grow call. tmps_grow has an unused return register/void proto, put it
to use by returning ix. Also change tmps_grow to take the result of
"PL_tmps_ix + the constant (usually 1) or non-constant (EXTEND_MORTAL)".
This avoid having to put the constant twice in machine code, once for the
if test, 2nd time for extend length param for tmps_grow call. For
non-constant/EXTEND_MORTAL usage, it allows the C optimizer to have the
length var to go out of liveness sooner if possible. Also the var used for
the if(>=) test is more likely to be in a register than length var.
So "if test variable" is closer on hand to the CPU than length var. In some
cases, if non-const len var isn't used again, it becomes the "ix" variable
by having PL_tmps_ix added to it. Change sv_2mortal to return sv instead
of NULL to remove a unique branch/block of machine code that assigns 0 to
return variable (Visual C didn't figure out return sv == returned NULL,
not sv). See also [perl #121845].
Diffstat (limited to 'embed.fnc')
-rw-r--r-- | embed.fnc | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1787,7 +1787,7 @@ Apd |void |sv_utf8_encode |NN SV *const sv ApdM |bool |sv_utf8_decode |NN SV *const sv Apdmb |void |sv_force_normal|NN SV *sv Apd |void |sv_force_normal_flags|NN SV *const sv|const U32 flags -Ap |void |tmps_grow |SSize_t n +pX |SSize_t|tmps_grow_p |SSize_t ix Apd |SV* |sv_rvweaken |NN SV *const sv : This is indirectly referenced by globals.c. This is somewhat annoying. p |int |magic_killbackrefs|NN SV *sv|NN MAGIC *mg |