X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bytecode.pl;h=fc16f176157eb75d61f37554906f5e0cc70c36c3;hb=47c8db80932508b6333745f2c283d5a98bf9cccb;hp=0d0468846eae25a6cb2472329c77fe799a9c882f;hpb=11a7ac70a867da65019c2c04f8677bdcf4c9693e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/bytecode.pl b/bytecode.pl index 0d04688..fc16f17 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -257,11 +257,53 @@ B::Asmdata - Autogenerated data about Perl ops, used to generate bytecode =head1 SYNOPSIS - use Asmdata; + use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name); =head1 DESCRIPTION -See F. +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. + +=over 4 + +=item %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', and the name of the method +used to 'GET'. + +=for _private +Add more detail about what $put_sub and $get_meth are and how to use them. + +=item @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]}; + +=item @optype + + my $op_type = $optype[$op_type_num]; + +A simple mapping of the op type number to its type (like 'COP' or 'BINOP'). + +=item @specialsv_name + + my $sv_name = $specialsv_name[$sv_index]; + +Certain SV types are considered 'special'. They're represented by +B::SPECIAL and are refered 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'). + +=back =head1 AUTHOR @@ -296,7 +338,7 @@ newopn PL_op U8 x newpv none PV pv_cur bstate->bs_pv.xpv_cur STRLEN pv_free bstate->bs_pv none x -sv_upgrade bstate->bs_sv char x +sv_upgrade bstate->bs_sv U8 x sv_refcnt SvREFCNT(bstate->bs_sv) U32 sv_refcnt_add SvREFCNT(bstate->bs_sv) I32 x sv_flags SvFLAGS(bstate->bs_sv) U32