perlperlapi

Where I can find the types of op that are filtered by PL_check?


PL_check is a variable exposed by the Perl public API:

Array, indexed by opcode, of functions that will be called for the "check" phase of optree building during compilation of Perl code. For most (but not all) types of op, once the op has been initially built and populated with child ops it will be filtered through the check function referenced by the appropriate element of this array.

Where in the source code can I see which types of opcode will be filtered?


Solution

  • You can check all types of op. Like the above says, it's an array indexed by opcode.

    If you want to know what ops have a checker, that can vary based on what modules you have loaded. For example, autovivification adds checkers for OP_PADANY, OP_PADSV, OP_AELEM, OP_HELEM, OP_RV2SV, OP_RV2AV, OP_RV2HV, OP_ASLICE, OP_HSLICE, OP_EXISTS, OP_DELETE, OP_KEYS and OP_VALUES. (Some of those may already have checkers, in which case autovivifaction's new checker will call the old checker.)

    You can find which ops have a built-in checker by looking at the definition of PL_check in opcode.h (which is generated by opcode.pl).