This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #127743) fix two problems with large object ids
authorTony Cook <tony@develop-help.com>
Wed, 1 Nov 2017 22:31:39 +0000 (23:31 +0100)
committerTony Cook <tony@develop-help.com>
Thu, 8 Feb 2018 02:58:09 +0000 (13:58 +1100)
commita12eb729ab5229a4abf0bec23ea5dd5186281b48
treef0426a64773f687898fae358477f64b536923744
parent6767be4f6a369834d13aee6cfc3b5fa7f4d6c883
(perl #127743) fix two problems with large object ids

Storable assigns an object id to every scalar it freezes, including to
unused elements in arrays.

There were two problems here:

a) in retrieve(), object ids over 2**31-1 but less than 2**32 were
   treated as signed, so the wrong object was produced in the resulting
   data structure.  Two changes we made to fix this:

  i)  retrieve() now treats object ids in the problem range as
      unsigned, so data written by older Storables is now treated
      correctly.

  ii) store() now writes object ids in the problem range as 64-bit
      ids, so that older Storables will fail rather than producing an
      incorrect result data structure.

b) once over 2**32 scalars had been output, the code still produced
   32-bit object ids when referring to previous scalars.  Fixed by
   adding support for 64-bit object ids.

There's still an issue with object ids in hook produced data.

Testing these changes requires ridiculous amounts of memory - ~32GB
for a) and ~66GB for b), and the tests take a long time to run, hence
for those tests to run you need the following in the environment;

  PERL_TEST_MEMORY >= 70
  PERL_RUN_SLOW_TESTS != 0
MANIFEST
dist/Storable/Storable.xs
dist/Storable/t/hugeids.t [new file with mode: 0644]