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

[Perl/perl5] 07a620: add OPpUSEINT op_private flag bit

From:
iabyn via perl5-changes
Date:
October 7, 2021 17:34
Subject:
[Perl/perl5] 07a620: add OPpUSEINT op_private flag bit
Message ID:
Perl/perl5/push/refs/heads/blead/2b0c7a-07a620@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 07a6208729c01c230010594c3e08a946ab0ccbef
      https://github.com/Perl/perl5/commit/07a6208729c01c230010594c3e08a946ab0ccbef
  Author: David Mitchell <davem@iabyn.com>
  Date:   2021-10-07 (Thu, 07 Oct 2021)

  Changed paths:
    M lib/B/Op_private.pm
    M op.c
    M opcode.h
    M perl.h
    M pp.c
    M regen/op_private

  Log Message:
  -----------
  add OPpUSEINT op_private flag bit

The bitwise ops, such as a '<<', have an op_private flag that is set
when compiled within the scope of 'use integer;'.

Unfortunately, due to historical reasons, the defined flag that
indicates this bit (bit 0) is HINT_INTEGER rather than an OPpfoo define.
But HINT_INTEGER is supposed to represent a bit within PL_hints, not a bit
within op_private. If someone reorganised the flags in PL_hints at some
point, it would mess up bitwise ops.

So this commit:

1) adds a new flag, OPpUSEINT, to indicate the bit within op_private.
2) Changes this flag's value from 0x1 to 0x4 to force it to be different
   than HINT_INTEGER - thus potentially flushing out any misuse of this
   flag anywhere (in core or XS code).
3) tells regen/op_private that the lower two bits of op_private in bitwise
   ops don't contain the argument count. They never did, but not
   specifying that in regen/op_private meant that the debugging code in
   op_free() never spotted the unknown bit 0 sometimes being set.
4) Also tell that debugging code to skip the test if the op is banned.
   This fixes a new fail in dist/Safe/t/safeops.t which was croaking
   about a banned op having an unrecognised op_private flag bit set
   before ck_bitop() had a chance to delete the arg count in op_private.





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