diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-08-21 08:10:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-08-23 08:28:32 +0000 |
commit | ded520dc1b4f4e452d606f7acda4700ae023932a (patch) | |
tree | 671a0604d8df0b9a7ff2673dda0dc3290316f2c8 /ext/mro | |
parent | 451833e4ed7d46edb45cd2a0b82551a05ce68ede (diff) | |
download | perl-ded520dc1b4f4e452d606f7acda4700ae023932a.tar.gz |
S_mro_get_linear_isa_c3() now uses sv_inc_nomg().
Previously it was coding the increment "longhand", to avoid bugs in 5.6.x.
However, this XS code is now exclusively in the core, and 5.6.x is long
dead, so there's no need to work around it.
The "longhand" code might *seem* to be more efficient (due to inlining some
logic) but it still required at least one call to a function in sv.c
(so no real change in generated code size) and that call was for the
increment 0 => 1, so likely called a lot, so no significant change in total
calls made.
Diffstat (limited to 'ext/mro')
-rw-r--r-- | ext/mro/mro.pm | 2 | ||||
-rw-r--r-- | ext/mro/mro.xs | 11 |
2 files changed, 2 insertions, 11 deletions
diff --git a/ext/mro/mro.pm b/ext/mro/mro.pm index 1889bd67f6..39ade22efe 100644 --- a/ext/mro/mro.pm +++ b/ext/mro/mro.pm @@ -12,7 +12,7 @@ use warnings; # mro.pm versions < 1.00 reserved for MRO::Compat # for partial back-compat to 5.[68].x -our $VERSION = '1.25_001'; +our $VERSION = '1.26'; require XSLoader; XSLoader::load('mro'); diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs index 180378a831..6bedd039a1 100644 --- a/ext/mro/mro.xs +++ b/ext/mro/mro.xs @@ -163,16 +163,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level) */ HE* const he = hv_fetch_ent(tails, seqitem, 1, 0); if(he) { - SV* const val = HeVAL(he); - /* For 5.8.0 and later, sv_inc() with increment undef to - an IV of 1, which is what we want for a newly created - entry. However, for 5.6.x it will become an NV of - 1.0, which confuses the SvIVX() checks above. */ - if(SvIOK(val)) { - SvIV_set(val, SvIVX(val) + 1); - } else { - sv_setiv(val, 1); - } + sv_inc_nomg(HeVAL(he)); } } } |