Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2c94601f0901d6917656208a57091e83be9bf07a
      
https://github.com/Perl/perl5/commit/2c94601f0901d6917656208a57091e83be9bf07a
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M hv.c
    M sv.c

  Log Message:
  -----------
  Use each HEK's own flags to decide "shared or not", instead of the HV's

Previously it was assumed that a hash with HvSHAREKEYS() true could only
contain shared HEKs, and a hash with it false always contained only unshared
HEKs. As HEKs all contain a flag bit to indicated "shared or not", instead
use that to take decisions on how to dup or free them.


  Commit: 5983026606b07a11e381fbd9fca44a9e1fa7d497
      
https://github.com/Perl/perl5/commit/5983026606b07a11e381fbd9fca44a9e1fa7d497
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M hv.c
    M pp_sys.c
    M proto.h

  Log Message:
  -----------
  Drop the unused hv argument from S_hv_free_ent_ret()

In turn, this means that the hv argument to Perl_hv_free_ent() and
Perl_hv_delayfree_ent() is now clearly unused, so mark it as such. Both
functions are deemed to be API, so unlike the static function
S_hv_free_ent_ret we can't simply change their parameters.

However, change all the internal callers to pass NULL instead of the hv, as
this makes it obvious that the function does not read hv, and might cause
the compiler to generate better code.


  Commit: 1db404fc7d10badcbca1c0f589d382fc79c57813
      
https://github.com/Perl/perl5/commit/1db404fc7d10badcbca1c0f589d382fc79c57813
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M hv.c
    M hv.h
    M sv.c

  Log Message:
  -----------
  Rename HVhek_UNSHARED to HVhek_NOTSHARED

"HVhek_UNSHARED" marked unshared HEKs - allocated directly with malloc(),
rather then from the shared string table, and released with free().

But *shared* HEKs (in the shared string table) are released by calling
unshare_hek(), whilst unshared HEKs should never go near this.

So rename them to "not shared", to avoid this confusion. Change their flag
bit from 0x08 to 0x04 to remove a gap. 0x04 had previously been used to
flag "REHASH", which was removed before v5.18.0

Move the definition of the macro HVhek_MASK from hv.h to hv.c


  Commit: 38b26de3e6533205e460ba58f80593bea670a594
      
https://github.com/Perl/perl5/commit/38b26de3e6533205e460ba58f80593bea670a594
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M hv.c

  Log Message:
  -----------
  Eliminate "masked_flags" from functions in hv.c

This was confusing because there are (at least) 3 types of masking needed

*) the bits that we record (HVhek_UTF8 and HVhek_WASUTF8)
*) the bit that flags storage type (HVhek_NOTSHARED)
*) the bit that triggers key freeing (HVhek_FREEKEY)

and at different times we need to mask out different things.

So eliminate the ambiguous term "mask", and instead explicitly test or mask
the bits we need.


  Commit: abb96f57669d75094ef5ea182cffd3b0e5a7f8a6
      
https://github.com/Perl/perl5/commit/abb96f57669d75094ef5ea182cffd3b0e5a7f8a6
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M hv.c

  Log Message:
  -----------
  Explicitly clear the HVhek_NOTSHARED bit on entry to hv_common

Some callers to hv_common() pass the flags value from an existing HEK, and
if that HEK is not shared, then it has the relevant flag bit set, which
must not be passed into share_hek_flags().

There is an assertion that catches this in share_hek_flags() if assertions
are enabled.

Remove the analogous assertion in save_hek_flags() - to comply with this
assertion he_dup() and new_HVhv() would need to be changed to clear the
flag bit before every call, only for share_hek_flags() to add it right back.
This feels like makework.


  Commit: f9c625b21504a7594ef2a0192416187816155697
      
https://github.com/Perl/perl5/commit/f9c625b21504a7594ef2a0192416187816155697
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M hv.c
    M hv.h

  Log Message:
  -----------
  Heuristically turn off shared hash keys for larger hashes

The assumption is that large hashes (that are not objects or symbol tables)
have keys that are not repeated in other hashes, hence (also) storing those
keys in the shared string table is creating work without real benefit.


  Commit: fa92924b30d8d2d97964737d282ab408cd726caf
      
https://github.com/Perl/perl5/commit/fa92924b30d8d2d97964737d282ab408cd726caf
  Author: Nicholas Clark <[email protected]>
  Date:   2022-03-19 (Sat, 19 Mar 2022)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  perldelta entry for the new key behaviour for large hashes

Note that large hashes (that are neither objects nor symbol tables) no
longer used the shared string table, and what the performance implications
might be.

This commit and the related code commits incorporate several improvements
suggested by Hugo during review.


Compare: https://github.com/Perl/perl5/compare/36873e7c5517...fa92924b30d8

Reply via email to