Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  B::ASMDATA (3)

.ds Aq ’


B::Asmdata - Autogenerated data about Perl ops, used to generate bytecode



        use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name);


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.

  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

An empty PUT method, the number 0, denotes an unsupported bytecode for this perl. It is there to support disassembling older perl bytecode. This was added with 1.02_02.


  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]};


  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.


  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.


All bytecode values are already portable. Cross-platform portability is implemented, cross-version not yet.

Cross-version portability will be very limited, cross-platform only for the same threading model.


For different endian-ness there are ByteLoader converters in effect. Header entry: byteorder.

64int - 64all - 32int is portable. Header entry: ivsize

ITHREADS are unportable; header entry: archflag - bitflag 1. MULTIPLICITY is also unportable; header entry: archflag - bitflag 2

TODO For cross-version portability we will try to translate older bytecode ops to the current perl op via ByteLoader::Translate. Asmdata already contains the old ops, all with the PUT method 0. Header entry: perlversion


Bytecode ops: We can only reliably load bytecode from previous versions and promise that from 5.10.0 on future versions will only add new op numbers at the end, but will never replace old opcodes with incompatible arguments. Unsupported insn’s are supported by disassemble, and if force in the ByteLoader is set, it is tried to load/set them also, with probably fatal consequences. On the first unknown bytecode op from a future version - added to the end - we will die.

ByteLoader::BcVersions contains logic to translate previous errors from this bytecode policy. E.g. 5.8 violated the 5.6 bytecode order policy and began to juggle it around (similar to parrot), in detail removed various bytecodes, like ldspecsvx:7, xpv_cur, xpv_len, xiv64:26. So in theory it would have been possible to load 5.6 into 5.8 bytecode as the underlying perl pp_code ops didn’t change that much, but it is risky.

We have unused tables of all bytecode ops for all version-specific changes to the bytecode table. This only changed with the ByteLoader version, ithreads and major Perl versions.

Also special replacements in the byteloader for all the unsupported ops, like xiv64, cop_arybase.


Malcolm Beattie MICB at (retired), Reini Urban added the version logic, support >= 5.10, portability.
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 B::ASMDATA (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.