S_mergesortsv is naughty

[email protected] (Mattia Barbon) Sat, 21 Aug 2004 19:11:25 +0200 (ora legale Europa occidentale)
Newsgroups perl.ponie.dev
Message-ID <[email protected]>
  Hello,
while implementing mark() for Perl5PVAV I noticed that mergesortsv
uses the array it is sorting to store things that are not PMCs
causing segafaults if a DOD run is started during a Perl_sortsv
call, when marking the array/stack live. The workaround I used
is: create a temp array and copy the sorted region in this array
(to keep them live), add MAGIC to the array (which might be the
Perl stack) t record which region should not be scanned, and push
two destructor functions in the savstack to clean up the temporary
array and remove the magic from the sorted array.

  Amazingly, all tests pass; this however llooks like a very hackish
solution. The alternative is to revert to a plain mergesort implementation.
Or someone that understands the current implementation could fix the
current implementation not to use the array to store internal data.

Regards
Mattia