In perl.git, the branch smoke-me/davem/op_private has been created
<http://perl5.git.perl.org/perl.git/commitdiff/a43cb0eb813952f4142b83a9cd3ebec98c8a9070?hp=0000000000000000000000000000000000000000>
at a43cb0eb813952f4142b83a9cd3ebec98c8a9070 (commit)
- Log -----------------------------------------------------------------
commit a43cb0eb813952f4142b83a9cd3ebec98c8a9070
Author: David Mitchell <[email protected]>
Date: Fri Sep 5 17:40:07 2014 +0100
add missing op_private labels to Concise etc
Concise wasn't decoding a few op_private bits. I spotted this during my
jumbo regen/op_private commit, but deferred fixing them up to a separate
commit since they change the output expected in a bunch of Concise tests.
Specifically, these have now been added:
OPpHINT_STRICT_REFS => STRICT
OPpITER_DEF => DEF
OPpEVAL_RE_REPARSING => REPARSE
M ext/B/t/f_map.t
M ext/B/t/optree_samples.t
M ext/B/t/optree_specials.t
M lib/B/Op_private.pm
M opcode.h
M regen/op_private
commit 14608c3a2f1fa27a05ba1881231018871c11b1ed
Author: David Mitchell <[email protected]>
Date: Fri Sep 5 17:12:27 2014 +0100
Assert valid op_private bits in op_free()
On debugging builds, when freeing an op, check that that there are
no bits set in op_private that we're not aware of (as defined by
PL_op_private_valid[[]).
If breakage is bisected to this commit, it either means that something
should be added to regen/op_private (if the op having that bit set is in
fact legitimate), or fixing the op generation code if not.
M op.c
commit 3f4940e5d0b30ed4ff0c023368c9f1b91af632ef
Author: David Mitchell <[email protected]>
Date: Fri Sep 5 17:06:47 2014 +0100
mask VMS hints bits in COPs
A couple of VMS-specific hints bits are stored in op_private on COPs.
Currently these are added using NATIVE_HINTS, which is defined as
PL_hints >> 24.
Since other hints have started using the top byte of PL_hints, this
has the possibility of inadvertently setting other bits in cop->op_private.
So mask out the bits we don't want. We need this before the next commit,
which will assert valid bits on debugging builds.
(This is VMS-specific, and has been applied blind)
M op.h
M vms/vmsish.h
commit 5b4e8d510ca65fe629db8aa386827be1ea685874
Author: David Mitchell <[email protected]>
Date: Tue Sep 2 17:11:42 2014 +0100
Automate processing of op_private flags
Add a new config file, regen/op_private, which contains all the
information about the flags and descriptions for the OP op_private field.
Previously, the flags themselves were defined in op.h, accompanied by
textual descriptions (sometimes inaccurate or incomplete).
For display purposes, there were short labels for each flag found in
Concise.pm, and another set of labels for Perl_do_op_dump() in dump.c.
These two sets of labels differed from each other in spelling (e.g.
REFC verses REFCOUNT), and differed in completeness and accuracy.
With this commit, all the data to generate the defines and the labels is
derived from a single source, and are generated automatically by 'make
regen'. It also contains complete data on which bits are used for what by
each op. So any attempt to add a new flag for a particular op where that
bit is already in use, will raise an error in make regen. This compares
to the previous practice of reading the descriptions in op.h and hoping
for the best.
It also makes use of data in regen/opcodes: for example, regen/op_private
specifies that all ops flagged as 'T' get the OPpTARGET_MY flag.
Since the set of labels used by Concise and Perl_do_op_dump() differed,
I've standardised on the Concise version. Thus this commit changes the
output produced by Concise only marginally, while Perl_do_op_dump() is
considerably different. As well as the change in labels (and missing
labels), Perl_do_op_dump() formerly had a bug whereby any unrecognised
bits would not be shown if there was at least one recognised bit.
So while Concise displayed (and still does) "LVINTRO,2", Perl_do_op_dump()
has changed:
- PRIVATE = (INTRO)
+ PRIVATE = (LVINTRO,0x2)
Concise has mainly changed in that a few op/bit combinations weren't being
shown symbolically, and now are. I've avoiding fixing the ones that would
break tests; they'll be fixed up in the next few commits.
A few new OPp* flags have been added:
OPpARG1_MASK
OPpARG2_MASK
OPpARG3_MASK
OPpARG4_MASK
OPpHINT_M_VMSISH_STATUS
OPpHINT_M_VMSISH_TIME
OPpHINT_STRICT_REFS
The last three are analogues for existing HINT_* flags. The former four
reflect that many ops some of the lower few bits of op_private to indicate
how many args the op expects. While (for now) this is still displayed as,
e.g. "LVINTRO,2", the definitions in regen/op_private now fully account
for which ops use which bits for the arg count.
There is a new module, B::Op_private, which allows this new data to be
accessed from Perl. For example,
use B::Op_private;
my $name = $B::Op_private::bits{aelem}{7}; # OPpLVAL_INTRO
my $value = $B::Op_private::defines{$name}; # 128
my $label = $B::Op_private::labels{$name}; # LVINTRO
There are several new constant PL_* tables. PL_op_private_valid[]
specifies for each op number, which bits are valid for that op. In a
couple of commits' time, op_free() will use this on debugging builds to
assert that no ops gained any private flags which we don't know about.
In fact it was by using such a temporary assert repeatedly against the
test suite, that I tracked down most of the inconsistencies and errors in
the current flag data.
The other PL_op_private_* tables contain a compact representation of all
the ops/bits/labels in a format suitable for Perl_do_op_dump() to decode
Op_private. Overall, the perl binary is about 500 bytes smaller on my
system.
M MANIFEST
M Porting/Maintainers.pl
M dump.c
M ext/B/B/Concise.pm
M ext/B/Makefile.PL
M ext/Devel-Peek/t/Peek.t
M globvar.sym
A lib/B/Op_private.pm
M op.h
M opcode.h
M pp.h
M pp_sys.c
A regen/op_private
M regen/opcode.pl
M t/porting/regen.t
commit 91cd531ace16783ee83df633e0c339e3082bc278
Author: David Mitchell <[email protected]>
Date: Thu Aug 21 20:16:48 2014 +0100
better document OA_ flags
Its a bit confusing which bits in PL_opargs are used for what,
and which flags in regen/opcodes map to which OA_* value
M op.h
M regen/opcodes
-----------------------------------------------------------------------
--
Perl5 Master Repository