diff options
author | Steffen Mueller <smueller@cpan.org> | 2014-11-28 18:05:34 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2014-11-30 12:06:04 +0100 |
commit | 7777302a0051987e602dfe05c34b52adf18cc9f0 (patch) | |
tree | c29986d82289757c9b40e71a60529b005618a186 /sv.c | |
parent | 4d55d9ac67bf8bc58f3fc9563b082459c6a3c22b (diff) | |
download | perl-7777302a0051987e602dfe05c34b52adf18cc9f0.tar.gz |
Attempt to bring newSViv/uv optimization to newRV
Cf. bd30fe8921c88e4677c2279b442a56a11ae037b4 for details.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -9453,13 +9453,25 @@ SV is B<not> incremented. SV * Perl_newRV_noinc(pTHX_ SV *const tmpRef) { - SV *sv = newSV_type(SVt_IV); + SV *sv; PERL_ARGS_ASSERT_NEWRV_NOINC; + new_SV(sv); + + /* We're starting from SVt_FIRST, so provided that's + * actual 0, we don't have to unset any SV type flags + * to promote to SVt_IV. */ + assert(SVt_FIRST == 0); + + SET_SVANY_FOR_BODYLESS_IV(sv); + SvFLAGS(sv) |= SVt_IV; + SvROK_on(sv); + SvIV_set(sv, 0); + SvTEMP_off(tmpRef); SvRV_set(sv, tmpRef); - SvROK_on(sv); + return sv; } |