Maintaining Perl 5 Core (Dave Mitchell): December 2022
Wed, 04-Jan-2023 by
alh
edit post
Dave writes:
This is my monthly report on work done during December covered by my TPF
perl core maintenance grant.
This month I continued work on making the stack reference counted.
A couple of weeks ago I reached a major milestone: the point where I
actually enabled reference-counting of SVs on the stack for the first
time. Since then I have reached the point where the perl build actually
completes (including the make runs in each dist/ and cpan/ subdir) and
'make minitest' only has a couple of failures. A full 'make test' seems to
have a lot of passing test files but currently hangs in some of the
threads tests - so I haven't been able to run 'make test' to completion
yet.
These preliminary results give me encouragement that my approach is sound,
and that it is just a case of fixing up all individual issues as they are
revealed by the test suite.
As a trivial example, this code was failing: ($ref + 1), because the
addition (like other numeric ops) uses the address of a plain reference as
the value to add, and pp_add() does this by replacing the ref SV on the
stack with an SV containing the int value of the ref. This simple
replacement, without adjusting reference counts, leaked the ref SV and
caused the temporary integer SV to be prematurely freed. Because this was
hidden away in a separate function dedicated to handling possible
overloading, I didn't spot it before enabling reference counting.
I have no idea how much further effort it will require to get the main
test suite to pass. After that, it is then a case of removing the wrapping
of performance-critical functions, then I'll be able to measure how much
slowdown there is. At that point it may become a candidate to be merged
into bleed (but enabled by default), then I can continue (at a more
leisurely pace) to unwrap further ops, add in optimisations, and work out
how new XS code be written to take direct advantage of a ref-counted
stack.
SUMMARY:
* 1:01 #6543 $1 dynamic scoping breaks with recursion
* 78:03 make stack reference counted
* 7:22 process p5p mailbox
TOTAL:
* 86:26 (HH::MM)
Comments (0)