1# -#- buffer-read-only: t -#- 2# 3# Copyright (c) 1996-1999 Malcolm Beattie 4# Copyright (c) 2008,2009 Reini Urban 5# 6# You may distribute under the terms of either the GNU General Public 7# License or the Artistic License, as specified in the README file. 8# 9# 10# 11# This file is autogenerated from bytecode.pl. Changes made here will be lost. 12# It is specific for Perl 5.013004 only. 13# 14package B::Asm5_013004; 15 16our $VERSION = '1.03'; 17 18use Exporter; 19@ISA = qw(Exporter); 20@EXPORT_OK = qw(%insn_data @insn_name @optype @specialsv_name); 21our(%insn_data, @insn_name); 22 23use B qw(@optype @specialsv_name); 24 25# XXX insn_data is initialised this way because with a large 26# %insn_data = (foo => [...], bar => [...], ...) initialiser 27# I get a hard-to-track-down stack underflow and segfault. 28$insn_data{comment} = [35, \&PUT_comment_t, "GET_comment_t"]; 29$insn_data{nop} = [10, \&PUT_none, "GET_none"]; 30$insn_data{ret} = [0, \&PUT_none, "GET_none"]; 31$insn_data{ldsv} = [1, \&PUT_svindex, "GET_svindex"]; 32$insn_data{ldop} = [2, \&PUT_opindex, "GET_opindex"]; 33$insn_data{stsv} = [3, \&PUT_U32, "GET_U32"]; 34$insn_data{stop} = [4, \&PUT_U32, "GET_U32"]; 35$insn_data{stpv} = [5, \&PUT_U32, "GET_U32"]; 36$insn_data{ldspecsv} = [6, \&PUT_U8, "GET_U8"]; 37$insn_data{ldspecsvx} = [7, \&PUT_U8, "GET_U8"]; 38$insn_data{newsv} = [8, \&PUT_U8, "GET_U8"]; 39$insn_data{newsvx} = [9, \&PUT_U32, "GET_U32"]; 40$insn_data{newop} = [11, \&PUT_U8, "GET_U8"]; 41$insn_data{newopx} = [12, \&PUT_U16, "GET_U16"]; 42$insn_data{newopn} = [13, \&PUT_U8, "GET_U8"]; 43$insn_data{newpv} = [14, \&PUT_PV, "GET_PV"]; 44$insn_data{pv_cur} = [15, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 45$insn_data{pv_free} = [16, \&PUT_none, "GET_none"]; 46$insn_data{sv_upgrade} = [17, \&PUT_U8, "GET_U8"]; 47$insn_data{sv_refcnt} = [18, \&PUT_U32, "GET_U32"]; 48$insn_data{sv_refcnt_add} = [19, \&PUT_I32, "GET_I32"]; 49$insn_data{sv_flags} = [20, \&PUT_U32, "GET_U32"]; 50$insn_data{xrv} = [21, \&PUT_svindex, "GET_svindex"]; 51$insn_data{xpv} = [22, \&PUT_none, "GET_none"]; 52$insn_data{xpv_cur} = [23, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 53$insn_data{xpv_len} = [24, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 54$insn_data{xiv} = [25, \&PUT_IV, "GET_IV"]; 55$insn_data{xnv} = [26, \&PUT_NV, "GET_NV"]; 56$insn_data{xlv_targoff} = [27, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 57$insn_data{xlv_targlen} = [28, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 58$insn_data{xlv_targ} = [29, \&PUT_svindex, "GET_svindex"]; 59$insn_data{xlv_type} = [30, \&PUT_U8, "GET_U8"]; 60$insn_data{xbm_useful} = [31, \&PUT_I32, "GET_I32"]; 61$insn_data{xbm_previous} = [32, \&PUT_U16, "GET_U16"]; 62$insn_data{xbm_rare} = [33, \&PUT_U8, "GET_U8"]; 63$insn_data{xfm_lines} = [34, \&PUT_IV, "GET_IV"]; 64$insn_data{xio_lines} = [36, \&PUT_IV, "GET_IV"]; 65$insn_data{xio_page} = [37, \&PUT_IV, "GET_IV"]; 66$insn_data{xio_page_len} = [38, \&PUT_IV, "GET_IV"]; 67$insn_data{xio_lines_left} = [39, \&PUT_IV, "GET_IV"]; 68$insn_data{xio_top_name} = [40, \&PUT_pvindex, "GET_pvindex"]; 69$insn_data{xio_top_gv} = [41, \&PUT_svindex, "GET_svindex"]; 70$insn_data{xio_fmt_name} = [42, \&PUT_pvindex, "GET_pvindex"]; 71$insn_data{xio_fmt_gv} = [43, \&PUT_svindex, "GET_svindex"]; 72$insn_data{xio_bottom_name} = [44, \&PUT_pvindex, "GET_pvindex"]; 73$insn_data{xio_bottom_gv} = [45, \&PUT_svindex, "GET_svindex"]; 74$insn_data{xio_subprocess} = [46, 0, "GET_U16"]; 75$insn_data{xio_type} = [47, \&PUT_U8, "GET_U8"]; 76$insn_data{xio_flags} = [48, \&PUT_U8, "GET_U8"]; 77$insn_data{xcv_xsubany} = [49, \&PUT_svindex, "GET_svindex"]; 78$insn_data{xcv_stash} = [50, \&PUT_svindex, "GET_svindex"]; 79$insn_data{xcv_start} = [51, \&PUT_opindex, "GET_opindex"]; 80$insn_data{xcv_root} = [52, \&PUT_opindex, "GET_opindex"]; 81$insn_data{xcv_gv} = [53, \&PUT_svindex, "GET_svindex"]; 82$insn_data{xcv_file} = [54, \&PUT_pvindex, "GET_pvindex"]; 83$insn_data{xcv_depth} = [55, \&PUT_long, "GET_long"]; 84$insn_data{xcv_padlist} = [56, \&PUT_svindex, "GET_svindex"]; 85$insn_data{xcv_outside} = [57, \&PUT_svindex, "GET_svindex"]; 86$insn_data{xcv_outside_seq} = [58, \&PUT_U32, "GET_U32"]; 87$insn_data{xcv_flags} = [59, \&PUT_U16, "GET_U16"]; 88$insn_data{av_extend} = [60, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 89$insn_data{av_pushx} = [61, \&PUT_svindex, "GET_svindex"]; 90$insn_data{av_push} = [62, 0, "GET_svindex"]; 91$insn_data{xav_fill} = [63, 0, "GET_PADOFFSET"]; 92$insn_data{xav_max} = [64, 0, "GET_PADOFFSET"]; 93$insn_data{xhv_riter} = [66, 0, "GET_I32"]; 94$insn_data{xhv_name} = [67, \&PUT_pvindex, "GET_pvindex"]; 95$insn_data{xhv_pmroot} = [68, 0, "GET_opindex"]; 96$insn_data{hv_store} = [69, \&PUT_svindex, "GET_svindex"]; 97$insn_data{sv_magic} = [70, \&PUT_U8, "GET_U8"]; 98$insn_data{mg_obj} = [71, \&PUT_svindex, "GET_svindex"]; 99$insn_data{mg_private} = [72, \&PUT_U16, "GET_U16"]; 100$insn_data{mg_flags} = [73, \&PUT_U8, "GET_U8"]; 101$insn_data{mg_name} = [74, \&PUT_pvcontents, "GET_pvcontents"]; 102$insn_data{mg_namex} = [75, \&PUT_svindex, "GET_svindex"]; 103$insn_data{xmg_stash} = [76, \&PUT_svindex, "GET_svindex"]; 104$insn_data{gv_fetchpv} = [77, \&PUT_strconst, "GET_strconst"]; 105$insn_data{gv_fetchpvx} = [78, \&PUT_strconst, "GET_strconst"]; 106$insn_data{gv_stashpv} = [79, \&PUT_strconst, "GET_strconst"]; 107$insn_data{gv_stashpvx} = [80, \&PUT_strconst, "GET_strconst"]; 108$insn_data{gp_sv} = [81, \&PUT_svindex, "GET_svindex"]; 109$insn_data{gp_refcnt} = [82, \&PUT_U32, "GET_U32"]; 110$insn_data{gp_refcnt_add} = [83, \&PUT_I32, "GET_I32"]; 111$insn_data{gp_av} = [84, \&PUT_svindex, "GET_svindex"]; 112$insn_data{gp_hv} = [85, \&PUT_svindex, "GET_svindex"]; 113$insn_data{gp_cv} = [86, \&PUT_svindex, "GET_svindex"]; 114$insn_data{gp_file} = [87, \&PUT_pvindex, "GET_pvindex"]; 115$insn_data{gp_io} = [88, \&PUT_svindex, "GET_svindex"]; 116$insn_data{gp_form} = [89, \&PUT_svindex, "GET_svindex"]; 117$insn_data{gp_cvgen} = [90, \&PUT_U32, "GET_U32"]; 118$insn_data{gp_line} = [91, \&PUT_U32, "GET_U32"]; 119$insn_data{gp_share} = [92, \&PUT_svindex, "GET_svindex"]; 120$insn_data{xgv_flags} = [93, \&PUT_U8, "GET_U8"]; 121$insn_data{op_next} = [94, \&PUT_opindex, "GET_opindex"]; 122$insn_data{op_sibling} = [95, \&PUT_opindex, "GET_opindex"]; 123$insn_data{op_ppaddr} = [96, \&PUT_strconst, "GET_strconst"]; 124$insn_data{op_targ} = [97, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 125$insn_data{op_type} = [98, \&PUT_U16, "GET_U16"]; 126$insn_data{op_opt} = [99, \&PUT_U8, "GET_U8"]; 127$insn_data{op_flags} = [100, \&PUT_U8, "GET_U8"]; 128$insn_data{op_private} = [101, \&PUT_U8, "GET_U8"]; 129$insn_data{op_first} = [102, \&PUT_opindex, "GET_opindex"]; 130$insn_data{op_last} = [103, \&PUT_opindex, "GET_opindex"]; 131$insn_data{op_other} = [104, \&PUT_opindex, "GET_opindex"]; 132$insn_data{op_pmreplroot} = [105, \&PUT_opindex, "GET_opindex"]; 133$insn_data{op_pmreplstart} = [106, \&PUT_opindex, "GET_opindex"]; 134$insn_data{op_pmstashpv} = [108, \&PUT_pvindex, "GET_pvindex"]; 135$insn_data{op_pmreplrootpo} = [109, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 136$insn_data{pregcomp} = [112, \&PUT_pvcontents, "GET_pvcontents"]; 137$insn_data{op_pmflags} = [113, \&PUT_U16, "GET_U16"]; 138$insn_data{op_pmpermflags} = [114, 0, "GET_U16"]; 139$insn_data{op_pmdynflags} = [115, 0, "GET_U8"]; 140$insn_data{op_sv} = [116, \&PUT_svindex, "GET_svindex"]; 141$insn_data{op_padix} = [117, \&PUT_PADOFFSET, "GET_PADOFFSET"]; 142$insn_data{op_pv} = [118, \&PUT_pvcontents, "GET_pvcontents"]; 143$insn_data{op_pv_tr} = [119, \&PUT_op_tr_array, "GET_op_tr_array"]; 144$insn_data{op_redoop} = [120, \&PUT_opindex, "GET_opindex"]; 145$insn_data{op_nextop} = [121, \&PUT_opindex, "GET_opindex"]; 146$insn_data{op_lastop} = [122, \&PUT_opindex, "GET_opindex"]; 147$insn_data{cop_label} = [123, \&PUT_pvindex, "GET_pvindex"]; 148$insn_data{cop_stashpv} = [124, \&PUT_pvindex, "GET_pvindex"]; 149$insn_data{cop_file} = [125, \&PUT_pvindex, "GET_pvindex"]; 150$insn_data{cop_stash} = [126, 0, "GET_svindex"]; 151$insn_data{cop_filegv} = [127, 0, "GET_svindex"]; 152$insn_data{cop_seq} = [128, \&PUT_U32, "GET_U32"]; 153$insn_data{cop_arybase} = [129, 0, "GET_I32"]; 154$insn_data{cop_line} = [130, \&PUT_U32, "GET_U32"]; 155$insn_data{cop_io} = [131, 0, "GET_svindex"]; 156$insn_data{cop_warnings} = [132, \&PUT_svindex, "GET_svindex"]; 157$insn_data{main_start} = [133, \&PUT_opindex, "GET_opindex"]; 158$insn_data{main_root} = [134, \&PUT_opindex, "GET_opindex"]; 159$insn_data{main_cv} = [135, \&PUT_svindex, "GET_svindex"]; 160$insn_data{curpad} = [136, \&PUT_svindex, "GET_svindex"]; 161$insn_data{push_begin} = [137, \&PUT_svindex, "GET_svindex"]; 162$insn_data{push_init} = [138, \&PUT_svindex, "GET_svindex"]; 163$insn_data{push_end} = [139, \&PUT_svindex, "GET_svindex"]; 164$insn_data{curstash} = [140, \&PUT_svindex, "GET_svindex"]; 165$insn_data{defstash} = [141, \&PUT_svindex, "GET_svindex"]; 166$insn_data{data} = [142, \&PUT_U8, "GET_U8"]; 167$insn_data{incav} = [143, \&PUT_svindex, "GET_svindex"]; 168$insn_data{load_glob} = [144, \&PUT_svindex, "GET_svindex"]; 169$insn_data{regex_padav} = [145, \&PUT_svindex, "GET_svindex"]; 170$insn_data{dowarn} = [146, \&PUT_U8, "GET_U8"]; 171$insn_data{comppad_name} = [147, \&PUT_svindex, "GET_svindex"]; 172$insn_data{xgv_stash} = [148, \&PUT_svindex, "GET_svindex"]; 173$insn_data{signal} = [149, \&PUT_strconst, "GET_strconst"]; 174$insn_data{formfeed} = [150, \&PUT_svindex, "GET_svindex"]; 175$insn_data{op_latefree} = [151, \&PUT_U8, "GET_U8"]; 176$insn_data{op_latefreed} = [152, \&PUT_U8, "GET_U8"]; 177$insn_data{op_attached} = [153, \&PUT_U8, "GET_U8"]; 178$insn_data{op_reflags} = [154, \&PUT_U32, "GET_U32"]; 179$insn_data{cop_seq_low} = [155, \&PUT_U32, "GET_U32"]; 180$insn_data{cop_seq_high} = [156, \&PUT_U32, "GET_U32"]; 181 182my ($insn_name, $insn_data); 183while (($insn_name, $insn_data) = each %insn_data) { 184 $insn_name[$insn_data->[0]] = $insn_name; 185} 186# Fill in any gaps 187@insn_name = map($_ || "unused", @insn_name); 188 1891; 190 191__END__ 192 193=head1 NAME 194 195B::Asmdata - Autogenerated data about Perl ops, used to generate bytecode 196 197=head1 SYNOPSIS 198 199 use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name); 200 201=head1 DESCRIPTION 202 203Provides information about Perl ops in order to generate bytecode via 204a bunch of exported variables. Its mostly used by B::Assembler and 205B::Disassembler. 206 207=over 4 208 209=item %insn_data 210 211 my($bytecode_num, $put_sub, $get_meth) = @$insn_data{$op_name}; 212 213For a given $op_name (for example, 'cop_label', 'sv_flags', etc...) 214you get an array ref containing the bytecode number of the op, a 215reference to the subroutine used to 'PUT' the op argument to the bytecode stream, 216and the name of the method used to 'GET' op argument from the bytecode stream. 217 218Most ops require one arg, in fact all ops without the PUT/GET_none methods, 219and the GET and PUT methods are used to en-/decode the arg to binary bytecode. 220The names are constructed from the GET/PUT prefix and the argument type, 221such as U8, U16, U32, svindex, opindex, pvindex, ... 222 223The PUT method is used in the L<B::Bytecode> compiler within L<B::Assembler>, 224the GET method just for the L<B::Disassembler>. 225The GET method is not used by the binary L<ByteLoader> module. 226 227A full C<insn> table with version, opcode, name, lvalue, argtype and flags 228is located as DATA in F<bytecode.pl>. 229 230An empty PUT method, the number 0, denotes an unsupported bytecode for this perl. 231It is there to support disassembling older perl bytecode. This was added with 1.02_02. 232 233=item @insn_name 234 235 my $op_name = $insn_name[$bytecode_num]; 236 237A simple mapping of the bytecode number to the name of the op. 238Suitable for using with %insn_data like so: 239 240 my $op_info = $insn_data{$insn_name[$bytecode_num]}; 241 242=item @optype 243 244 my $op_type = $optype[$op_type_num]; 245 246A simple mapping of the op type number to its type (like 'COP' or 'BINOP'). 247 248Since Perl version 5.10 defined in L<B>. 249 250=item @specialsv_name 251 252 my $sv_name = $specialsv_name[$sv_index]; 253 254Certain SV types are considered 'special'. They're represented by 255B::SPECIAL and are referred to by a number from the specialsv_list. 256This array maps that number back to the name of the SV (like 'Nullsv' 257or '&PL_sv_undef'). 258 259Since Perl version 5.10 defined in L<B>. 260 261=back 262 263=head1 PORTABILITY 264 265All bytecode values are already portable. 266Cross-platform portability is implemented, cross-version not yet. 267 268Cross-version portability will be very limited, cross-platform only 269for the same threading model. 270 271=head2 CROSS-PLATFORM PORTABILITY 272 273For different endian-ness there are ByteLoader converters in effect. 274Header entry: byteorder. 275 27664int - 64all - 32int is portable. Header entry: ivsize 277 278ITHREADS are unportable. 279Header entry: archflag - bitflag 1. 280 281TODO For cross-version portability we will try to translate older 282bytecode ops to the current perl op via L<ByteLoader::Translate>. 283Asmdata already contains the old ops, all with the PUT method 0. 284Header entry: perlversion 285 286=head2 CROSS-VERSION PORTABILITY (TODO - HARD) 287 288Bytecode ops: 289We can only reliably load bytecode from previous versions and promise 290that from 5.10.0 on future versions will only add new op numbers at 291the end, but will never replace old opcodes with incompatible arguments. 292Unsupported insn's are supported by disassemble, and if C<force> in the 293ByteLoader is set, it is tried to load/set them also, with probably fatal 294consequences. 295On the first unknown bytecode op from a future version - added to the end 296- we will die. 297 298L<ByteLoader::BcVersions> contains logic to translate previous errors 299from this bytecode policy. E.g. 5.8 violated the 5.6 bytecode order policy 300and began to juggle it around (similar to parrot), in detail removed 301various bytecodes, like ldspecsvx:7, xpv_cur, xpv_len, xiv64:26. 302So in theory it would have been possible to load 5.6 into 5.8 bytecode 303as the underlying perl pp_code ops didn't change that much, but it is risky. 304 305We have unused tables of all bytecode ops for all version-specific changes 306to the bytecode table. This only changed with 307the ByteLoader version, ithreads and major Perl versions. 308 309Also special replacements in the byteloader for all the unsupported 310ops, like xiv64, cop_arybase. 311 312=head1 AUTHOR 313 314Malcolm Beattie C<MICB at cpan.org> I<(retired)>, 315Reini Urban added the version logic, support >= 5.10, portability. 316 317=cut 318 319# ex: set ro: 320