develooper Front page | perl.perl5.changes | Postings from September 2021

[Perl/perl5] 914bb5: Define a third kind of COW state; STATIC

From:
Paul Evans via perl5-changes
Date:
September 10, 2021 19:09
Subject:
[Perl/perl5] 914bb5: Define a third kind of COW state; STATIC
Message ID:
Perl/perl5/push/refs/heads/blead/170944-a155ce@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 914bb57489325d34ddbb7c0557c53df7baa84d86
      https://github.com/Perl/perl5/commit/914bb57489325d34ddbb7c0557c53df7baa84d86
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M MANIFEST
    M sv.c
    M sv.h
    A t/op/bool.t

  Log Message:
  -----------
  Define a third kind of COW state; STATIC

Previously, when IsCOW flag was set there were two cases:
  SvLEN()==0:
      PV is really a shared HEK

  SvLEN()!=0:
      PV is a COW structure with 1..256 refcount stored in its extra final byte

This change adds a third state:

  SvLEN()==0 && SvFLAGS() & SVppv_STATIC:
      PV is a shared static const pointer and must not be modified

sv_setsv_flags() and sv_setsv_cow() will preserve this state

sv_uncow() will copy it out to a regular string buffer

sv_dup() will preserve the static pointer into cloned threads


  Commit: 1d0d673f78c5c03a0f3c97ceeb7686e9388e0611
      https://github.com/Perl/perl5/commit/1d0d673f78c5c03a0f3c97ceeb7686e9388e0611
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M dump.c
    M ext/B/B.pm
    M ext/B/B.xs
    M ext/Devel-Peek/t/Peek.t
    M ext/attributes/attributes.pm
    M ext/attributes/attributes.xs
    M gv.c
    M inline.h
    M pp_hot.c
    M sv.h

  Log Message:
  -----------
  Add SvIsBOOL() macro to test for SVs being boolean-intent

These are identified as being static shared COW strings whose string
buffer points directly at PL_Yes / PL_No

Define sv_setbool() and sv_setbool_mg() macros

Use sv_setbool() where appropriate

Have sv_dump() annotate when an SV's PV buffer is one of the PL_(Yes|No) special booleans


  Commit: d0a5ecaa9789935767a78a79b7830ffff24f524c
      https://github.com/Perl/perl5/commit/d0a5ecaa9789935767a78a79b7830ffff24f524c
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M MANIFEST
    M cpan/Scalar-List-Utils/ListUtil.xs
    M cpan/Scalar-List-Utils/lib/List/Util.pm
    M cpan/Scalar-List-Utils/lib/List/Util/XS.pm
    M cpan/Scalar-List-Utils/lib/Scalar/Util.pm
    M cpan/Scalar-List-Utils/lib/Sub/Util.pm
    A cpan/Scalar-List-Utils/t/boolean-thr.t
    A cpan/Scalar-List-Utils/t/boolean.t

  Log Message:
  -----------
  Add a Scalar::Util::isbool()

Remember to SvGETMAGIC() before testing SvIsBOOL() (thanks @tonycoz)

Unit-test that booleaness is preserved on values passed in to, out of, or captured by threads


  Commit: a155cefb3ac068a46a847ed484efda109532cdb3
      https://github.com/Perl/perl5/commit/a155cefb3ac068a46a847ed484efda109532cdb3
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M pod/perldelta.pod

  Log Message:
  -----------
  Add perldelta for stable bool


Compare: https://github.com/Perl/perl5/compare/170944218d18...a155cefb3ac0



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About