NAME
B::Asmdata - Autogenerated data about Perl ops, used to generate bytecode
SYNOPSIS
use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name);
DESCRIPTION
Provides information about Perl ops in order to generate bytecode via a bunch of exported variables. Its mostly used by B::Assembler and B::Disassembler.
- %insn_data
-
my($bytecode_num, $put_sub, $get_meth) = @$insn_data{$op_name};
For a given $op_name (for example, 'cop_label', 'sv_flags', etc...) you get an array ref containing the bytecode number of the op, a reference to the subroutine used to 'PUT' the op argument to the bytecode stream, and the name of the method used to 'GET' op argument from the bytecode stream.
Most ops require one arg, in fact all ops without the PUT/GET_none methods, and the GET and PUT methods are used to en-/decode the arg to binary bytecode. The names are constructed from the GET/PUT prefix and the argument type, such as U8, U16, U32, svindex, opindex, pvindex, ...
The PUT method is used in the B::Bytecode compiler within B::Assembler, the GET method just for the B::Disassembler. The GET method is not used by the binary ByteLoader module.
A full
insn
table with version, opcode, name, lvalue, argtype and flags is located as DATA in bytecode.pl. - @insn_name
-
my $op_name = $insn_name[$bytecode_num];
A simple mapping of the bytecode number to the name of the op. Suitable for using with %insn_data like so:
my $op_info = $insn_data{$insn_name[$bytecode_num]};
- @optype
-
my $op_type = $optype[$op_type_num];
A simple mapping of the op type number to its type (like 'COP' or 'BINOP').
Since Perl version 5.10 defined in B.
- @specialsv_name
-
my $sv_name = $specialsv_name[$sv_index];
Certain SV types are considered 'special'. They're represented by B::SPECIAL and are referred to by a number from the specialsv_list. This array maps that number back to the name of the SV (like 'Nullsv' or '&PL_sv_undef').
Since Perl version 5.10 defined in B.
AUTHOR
Malcolm Beattie, mbeattie@sable.ox.ac.uk
Reini Urban added the version logic and 5.10 support.