Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Storable.xs, simplify and inline the macro STORE_HASH_SORT.
For 5.6.x and earlier, the interpreter context saving/restoring is not needed prior to calling qsort(), as within the thread there is only one interpreter in play. Moreover, the SAVESPTR(orig_perl); in the removed code is not just pointless, it's technically undefined behaviour. All that the SAVESPTR() macro will do is ensure that the value of *(&orig_perl) is restored at scope exit. It won't actually restore the interpreter context - that would need a call to PERL_SET_CONTEXT with the value of origperl. The undefined behaviour is because the LEAVE; which causes the scope pop action happens outside the block, hence orig_perl has gone out of scope, and the address &orig_perl (saved on the scope stack, written to by LEAVE), now points to invalid memory. It is, however, quite hard to even get gcc's ASAN to trap this. This code is likely unreachable anyway. It's only compiled in for 5.6.x and earlier with USE_ITHREADS. ithreads was not useful until 5.8.0.
- Loading branch information