From: Nicholas Clark Date: Mon, 7 May 2007 15:35:56 +0000 (+0000) Subject: bytecode.pl: Exterminate! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6c993494e4b729540ad72e7f1088e3dd0ee70221;p=p5sagit%2Fp5-mst-13.2.git bytecode.pl: Exterminate! ext/B/B/Asmdata.pm: Exterminate! p4raw-id: //depot/perl@31165 --- diff --git a/MANIFEST b/MANIFEST index 255c2a7..3510276 100644 --- a/MANIFEST +++ b/MANIFEST @@ -7,7 +7,6 @@ av.h Array value header beos/beos.c BeOS port beos/beosish.h BeOS port beos/nm.c BeOS port -bytecode.pl Produces ext/B/Asmdata.pm cc_runtime.h Macros need by runtime of compiler-generated code cflags.SH A script that emits C compilation flags per file Changes Differences from previous version @@ -69,7 +68,6 @@ ext/attrs/attrs.pm attrs extension Perl module ext/attrs/attrs.xs attrs extension external subroutines ext/attrs/Makefile.PL attrs extension makefile writer ext/attrs/t/attrs.t See if attrs works with C -ext/B/B/Asmdata.pm Compiler backend data for assembler ext/B/B/Concise.pm Compiler Concise backend ext/B/B/Debug.pm Compiler Debug backend ext/B/B/Deparse.pm Compiler Deparse backend diff --git a/bytecode.pl b/bytecode.pl deleted file mode 100644 index 6d09f8e..0000000 --- a/bytecode.pl +++ /dev/null @@ -1,346 +0,0 @@ -BEGIN { - push @INC, './lib'; - require 'regen_lib.pl'; -} -use strict; -my %alias_to = ( - U32 => [qw(line_t)], - PADOFFSET => [qw(STRLEN SSize_t)], - U16 => [qw(OPCODE short)], - U8 => [qw(char)], -); - -my (%alias_from, $from, $tos); -while (($from, $tos) = each %alias_to) { - map { $alias_from{$_} = $from } @$tos; -} - -my $c_header = <<'EOT'; -/* -*- buffer-read-only: t -*- - * - * Copyright (c) 1996-1999 Malcolm Beattie - * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file. - * - */ -/* - * This file is autogenerated from bytecode.pl. Changes made here will be lost. - */ -EOT - -my $perl_header; -($perl_header = $c_header) =~ s{[/ ]?\*/?}{#}g; - -safer_unlink "ext/B/B/Asmdata.pm"; - -# -# Start with boilerplate for Asmdata.pm -# -open(ASMDATA_PM, ">ext/B/B/Asmdata.pm") or die "ext/B/B/Asmdata.pm: $!"; -binmode ASMDATA_PM; -print ASMDATA_PM $perl_header, <<'EOT'; -package B::Asmdata; - -our $VERSION = '1.02'; - -use Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(%insn_data @insn_name @optype @specialsv_name); -our(%insn_data, @insn_name); - -use B qw(@optype @specialsv_name); -EOT -print ASMDATA_PM <<"EOT"; - -# XXX insn_data is initialised this way because with a large -# %insn_data = (foo => [...], bar => [...], ...) initialiser -# I get a hard-to-track-down stack underflow and segfault. -EOT - -my (@insn_name, $insn_num, $insn, $lvalue, $argtype, $flags, $fundtype); - -while () { - if (/^\s*#/) { - next; - } - chop; - next unless length; - if (/^%number\s+(.*)/) { - $insn_num = $1; - next; - } elsif (/%enum\s+(.*?)\s+(.*)/) { - create_enum($1, $2); # must come before instructions - next; - } - ($insn, $lvalue, $argtype, $flags) = split; - my $rvalcast = ''; - if ($argtype =~ m:(.+)/(.+):) { - ($rvalcast, $argtype) = ("($1)", $2); - } - $insn_name[$insn_num] = $insn; - $fundtype = $alias_from{$argtype} || $argtype; - - # - # Add the initialiser line for %insn_data in Asmdata.pm - # - print ASMDATA_PM <<"EOT"; -\$insn_data{$insn} = [$insn_num, \\&PUT_$fundtype, "GET_$fundtype"]; -EOT - - # Find the next unused instruction number - do { $insn_num++ } while $insn_name[$insn_num]; -} - -# -# Finish off insn_data and create array initialisers in Asmdata.pm -# -print ASMDATA_PM <<'EOT'; - -my ($insn_name, $insn_data); -while (($insn_name, $insn_data) = each %insn_data) { - $insn_name[$insn_data->[0]] = $insn_name; -} -# Fill in any gaps -@insn_name = map($_ || "unused", @insn_name); - -1; - -__END__ - -=head1 NAME - -B::Asmdata - Autogenerated data about Perl ops - -=head1 SYNOPSIS - - use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name); - -=head1 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. - -=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 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'). - -=back - -=head1 AUTHOR - -Malcolm Beattie, C - -=cut - -# ex: set ro: -EOT - - -close ASMDATA_PM or die "Error closing ASMDATA_PM: $!"; - -__END__ -# First set instruction ord("#") to read comment to end-of-line (sneaky) -%number 35 -comment arg comment_t -# Then make ord("\n") into a no-op -%number 10 -nop none none - -# Now for the rest of the ordinary ones, beginning with \0 which is -# ret so that \0-terminated strings can be read properly as bytecode. -%number 0 -# -# The argtype is either a single type or "rightvaluecast/argtype". -# -#opcode lvalue argtype flags -# -ret none none x -ldsv bstate->bs_sv svindex -ldop PL_op opindex -stsv bstate->bs_sv U32 s -stop PL_op U32 s -stpv bstate->bs_pv.pvx U32 x -ldspecsv bstate->bs_sv U8 x -ldspecsvx bstate->bs_sv U8 x -newsv bstate->bs_sv svtype x -newsvx bstate->bs_sv svtype x -newop PL_op U8 x -newopx PL_op U16 x -newopn PL_op U8 x -newpv none PV -pv_cur bstate->bs_pv.xpv.xpv_cur STRLEN -pv_free bstate->bs_pv.pvx none x -sv_upgrade bstate->bs_sv svtype x -sv_refcnt SvREFCNT(bstate->bs_sv) U32 -sv_refcnt_add SvREFCNT(bstate->bs_sv) I32 x -sv_flags SvFLAGS(bstate->bs_sv) U32 -xrv bstate->bs_sv svindex x -xpv bstate->bs_sv none x -xpv_cur bstate->bs_sv STRLEN x -xpv_len bstate->bs_sv STRLEN x -xiv bstate->bs_sv IV x -xnv bstate->bs_sv NV x -xlv_targoff LvTARGOFF(bstate->bs_sv) STRLEN -xlv_targlen LvTARGLEN(bstate->bs_sv) STRLEN -xlv_targ LvTARG(bstate->bs_sv) svindex -xlv_type LvTYPE(bstate->bs_sv) char -xbm_useful BmUSEFUL(bstate->bs_sv) I32 -xbm_previous BmPREVIOUS(bstate->bs_sv) U16 -xbm_rare BmRARE(bstate->bs_sv) U8 -xfm_lines FmLINES(bstate->bs_sv) IV -xio_lines IoLINES(bstate->bs_sv) IV -xio_page IoPAGE(bstate->bs_sv) IV -xio_page_len IoPAGE_LEN(bstate->bs_sv) IV -xio_lines_left IoLINES_LEFT(bstate->bs_sv) IV -xio_top_name IoTOP_NAME(bstate->bs_sv) pvindex -xio_top_gv *(SV**)&IoTOP_GV(bstate->bs_sv) svindex -xio_fmt_name IoFMT_NAME(bstate->bs_sv) pvindex -xio_fmt_gv *(SV**)&IoFMT_GV(bstate->bs_sv) svindex -xio_bottom_name IoBOTTOM_NAME(bstate->bs_sv) pvindex -xio_bottom_gv *(SV**)&IoBOTTOM_GV(bstate->bs_sv) svindex -xio_subprocess IoSUBPROCESS(bstate->bs_sv) short -xio_type IoTYPE(bstate->bs_sv) char -xio_flags IoFLAGS(bstate->bs_sv) char -xcv_xsubany *(SV**)&CvXSUBANY(bstate->bs_sv).any_ptr svindex -xcv_stash *(SV**)&CvSTASH(bstate->bs_sv) svindex -xcv_start CvSTART(bstate->bs_sv) opindex -xcv_root CvROOT(bstate->bs_sv) opindex -xcv_gv *(SV**)&CvGV(bstate->bs_sv) svindex -xcv_file CvFILE(bstate->bs_sv) pvindex -xcv_depth CvDEPTH(bstate->bs_sv) long -xcv_padlist *(SV**)&CvPADLIST(bstate->bs_sv) svindex -xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex -xcv_outside_seq CvOUTSIDE_SEQ(bstate->bs_sv) U32 -xcv_flags CvFLAGS(bstate->bs_sv) U16 -av_extend bstate->bs_sv SSize_t x -av_pushx bstate->bs_sv svindex x -av_push bstate->bs_sv svindex x -xav_fill AvFILLp(bstate->bs_sv) SSize_t -xav_max AvMAX(bstate->bs_sv) SSize_t -xhv_riter HvRITER(bstate->bs_sv) I32 -xhv_name bstate->bs_sv pvindex x -hv_store bstate->bs_sv svindex x -sv_magic bstate->bs_sv char x -mg_obj SvMAGIC(bstate->bs_sv)->mg_obj svindex -mg_private SvMAGIC(bstate->bs_sv)->mg_private U16 -mg_flags SvMAGIC(bstate->bs_sv)->mg_flags U8 -mg_name SvMAGIC(bstate->bs_sv) pvcontents x -mg_namex SvMAGIC(bstate->bs_sv) svindex x -xmg_stash bstate->bs_sv svindex x -gv_fetchpv bstate->bs_sv strconst x -gv_fetchpvx bstate->bs_sv strconst x -gv_stashpv bstate->bs_sv strconst x -gv_stashpvx bstate->bs_sv strconst x -gp_sv GvSV(bstate->bs_sv) svindex -gp_refcnt GvREFCNT(bstate->bs_sv) U32 -gp_refcnt_add GvREFCNT(bstate->bs_sv) I32 x -gp_av *(SV**)&GvAV(bstate->bs_sv) svindex -gp_hv *(SV**)&GvHV(bstate->bs_sv) svindex -gp_cv *(SV**)&GvCV(bstate->bs_sv) svindex -gp_file bstate->bs_sv pvindex x -gp_io *(SV**)&GvIOp(bstate->bs_sv) svindex -gp_form *(SV**)&GvFORM(bstate->bs_sv) svindex -gp_cvgen GvCVGEN(bstate->bs_sv) U32 -gp_line GvLINE(bstate->bs_sv) line_t -gp_share bstate->bs_sv svindex x -xgv_flags GvFLAGS(bstate->bs_sv) U8 -op_next PL_op->op_next opindex -op_sibling PL_op->op_sibling opindex -op_ppaddr PL_op->op_ppaddr strconst x -op_targ PL_op->op_targ PADOFFSET -op_type PL_op OPCODE x -op_opt PL_op->op_opt U8 -op_static PL_op->op_static U8 -op_flags PL_op->op_flags U8 -op_private PL_op->op_private U8 -op_first cUNOP->op_first opindex -op_last cBINOP->op_last opindex -op_other cLOGOP->op_other opindex -op_pmreplroot cPMOP->op_pmreplroot opindex -op_pmreplstart cPMOP->op_pmreplstart opindex -op_pmnext *(OP**)&cPMOP->op_pmnext opindex -#ifdef USE_ITHREADS -op_pmstashpv cPMOP pvindex x -op_pmreplrootpo cPMOP->op_pmreplroot OP*/PADOFFSET -#else -op_pmstash *(SV**)&cPMOP->op_pmstash svindex -op_pmreplrootgv *(SV**)&cPMOP->op_pmreplroot svindex -#endif -pregcomp PL_op pvcontents x -op_pmflags cPMOP->op_pmflags U16 -op_sv cSVOP->op_sv svindex -op_padix cPADOP->op_padix PADOFFSET -op_pv cPVOP->op_pv pvcontents -op_pv_tr cPVOP->op_pv op_tr_array -op_redoop cLOOP->op_redoop opindex -op_nextop cLOOP->op_nextop opindex -op_lastop cLOOP->op_lastop opindex -cop_label cCOP->cop_label pvindex -#ifdef USE_ITHREADS -cop_stashpv cCOP pvindex x -cop_file cCOP pvindex x -#else -cop_stash cCOP svindex x -cop_filegv cCOP svindex x -#endif -cop_seq cCOP->cop_seq U32 -cop_arybase cCOP I32 x -cop_line cCOP->cop_line line_t -cop_warnings cCOP svindex x -main_start PL_main_start opindex -main_root PL_main_root opindex -main_cv *(SV**)&PL_main_cv svindex -curpad PL_curpad svindex x -push_begin PL_beginav svindex x -push_init PL_initav svindex x -push_end PL_endav svindex x -curstash *(SV**)&PL_curstash svindex -defstash *(SV**)&PL_defstash svindex -data none U8 x -incav *(SV**)&GvAV(PL_incgv) svindex -load_glob none svindex x -#ifdef USE_ITHREADS -regex_padav *(SV**)&PL_regex_padav svindex -#endif -dowarn PL_dowarn U8 -comppad_name *(SV**)&PL_comppad_name svindex -xgv_stash *(SV**)&GvSTASH(bstate->bs_sv) svindex -signal bstate->bs_sv strconst x -# to be removed -formfeed PL_formfeed svindex diff --git a/ext/B/B/Asmdata.pm b/ext/B/B/Asmdata.pm deleted file mode 100644 index bbea25f..0000000 --- a/ext/B/B/Asmdata.pm +++ /dev/null @@ -1,245 +0,0 @@ -# -#- buffer-read-only: t -#- -# -# Copyright (c) 1996-1999 Malcolm Beattie -# -# You may distribute under the terms of either the GNU General Public -# License or the Artistic License, as specified in the README file. -# -# -# -# This file is autogenerated from bytecode.pl. Changes made here will be lost. -# -package B::Asmdata; - -our $VERSION = '1.02'; - -use Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(%insn_data @insn_name @optype @specialsv_name); -our(%insn_data, @insn_name); - -use B qw(@optype @specialsv_name); - -# XXX insn_data is initialised this way because with a large -# %insn_data = (foo => [...], bar => [...], ...) initialiser -# I get a hard-to-track-down stack underflow and segfault. -$insn_data{comment} = [35, \&PUT_comment_t, "GET_comment_t"]; -$insn_data{nop} = [10, \&PUT_none, "GET_none"]; -$insn_data{ret} = [0, \&PUT_none, "GET_none"]; -$insn_data{ldsv} = [1, \&PUT_svindex, "GET_svindex"]; -$insn_data{ldop} = [2, \&PUT_opindex, "GET_opindex"]; -$insn_data{stsv} = [3, \&PUT_U32, "GET_U32"]; -$insn_data{stop} = [4, \&PUT_U32, "GET_U32"]; -$insn_data{stpv} = [5, \&PUT_U32, "GET_U32"]; -$insn_data{ldspecsv} = [6, \&PUT_U8, "GET_U8"]; -$insn_data{ldspecsvx} = [7, \&PUT_U8, "GET_U8"]; -$insn_data{newsv} = [8, \&PUT_svtype, "GET_svtype"]; -$insn_data{newsvx} = [9, \&PUT_svtype, "GET_svtype"]; -$insn_data{newop} = [11, \&PUT_U8, "GET_U8"]; -$insn_data{newopx} = [12, \&PUT_U16, "GET_U16"]; -$insn_data{newopn} = [13, \&PUT_U8, "GET_U8"]; -$insn_data{newpv} = [14, \&PUT_PV, "GET_PV"]; -$insn_data{pv_cur} = [15, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{pv_free} = [16, \&PUT_none, "GET_none"]; -$insn_data{sv_upgrade} = [17, \&PUT_svtype, "GET_svtype"]; -$insn_data{sv_refcnt} = [18, \&PUT_U32, "GET_U32"]; -$insn_data{sv_refcnt_add} = [19, \&PUT_I32, "GET_I32"]; -$insn_data{sv_flags} = [20, \&PUT_U32, "GET_U32"]; -$insn_data{xrv} = [21, \&PUT_svindex, "GET_svindex"]; -$insn_data{xpv} = [22, \&PUT_none, "GET_none"]; -$insn_data{xpv_cur} = [23, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xpv_len} = [24, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xiv} = [25, \&PUT_IV, "GET_IV"]; -$insn_data{xnv} = [26, \&PUT_NV, "GET_NV"]; -$insn_data{xlv_targoff} = [27, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xlv_targlen} = [28, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xlv_targ} = [29, \&PUT_svindex, "GET_svindex"]; -$insn_data{xlv_type} = [30, \&PUT_U8, "GET_U8"]; -$insn_data{xbm_useful} = [31, \&PUT_I32, "GET_I32"]; -$insn_data{xbm_previous} = [32, \&PUT_U16, "GET_U16"]; -$insn_data{xbm_rare} = [33, \&PUT_U8, "GET_U8"]; -$insn_data{xfm_lines} = [34, \&PUT_IV, "GET_IV"]; -$insn_data{xio_lines} = [36, \&PUT_IV, "GET_IV"]; -$insn_data{xio_page} = [37, \&PUT_IV, "GET_IV"]; -$insn_data{xio_page_len} = [38, \&PUT_IV, "GET_IV"]; -$insn_data{xio_lines_left} = [39, \&PUT_IV, "GET_IV"]; -$insn_data{xio_top_name} = [40, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{xio_top_gv} = [41, \&PUT_svindex, "GET_svindex"]; -$insn_data{xio_fmt_name} = [42, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{xio_fmt_gv} = [43, \&PUT_svindex, "GET_svindex"]; -$insn_data{xio_bottom_name} = [44, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{xio_bottom_gv} = [45, \&PUT_svindex, "GET_svindex"]; -$insn_data{xio_subprocess} = [46, \&PUT_U16, "GET_U16"]; -$insn_data{xio_type} = [47, \&PUT_U8, "GET_U8"]; -$insn_data{xio_flags} = [48, \&PUT_U8, "GET_U8"]; -$insn_data{xcv_xsubany} = [49, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_stash} = [50, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_start} = [51, \&PUT_opindex, "GET_opindex"]; -$insn_data{xcv_root} = [52, \&PUT_opindex, "GET_opindex"]; -$insn_data{xcv_gv} = [53, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_file} = [54, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{xcv_depth} = [55, \&PUT_long, "GET_long"]; -$insn_data{xcv_padlist} = [56, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_outside} = [57, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_outside_seq} = [58, \&PUT_U32, "GET_U32"]; -$insn_data{xcv_flags} = [59, \&PUT_U16, "GET_U16"]; -$insn_data{av_extend} = [60, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{av_pushx} = [61, \&PUT_svindex, "GET_svindex"]; -$insn_data{av_push} = [62, \&PUT_svindex, "GET_svindex"]; -$insn_data{xav_fill} = [63, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xav_max} = [64, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{xhv_riter} = [65, \&PUT_I32, "GET_I32"]; -$insn_data{xhv_name} = [66, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{hv_store} = [67, \&PUT_svindex, "GET_svindex"]; -$insn_data{sv_magic} = [68, \&PUT_U8, "GET_U8"]; -$insn_data{mg_obj} = [69, \&PUT_svindex, "GET_svindex"]; -$insn_data{mg_private} = [70, \&PUT_U16, "GET_U16"]; -$insn_data{mg_flags} = [71, \&PUT_U8, "GET_U8"]; -$insn_data{mg_name} = [72, \&PUT_pvcontents, "GET_pvcontents"]; -$insn_data{mg_namex} = [73, \&PUT_svindex, "GET_svindex"]; -$insn_data{xmg_stash} = [74, \&PUT_svindex, "GET_svindex"]; -$insn_data{gv_fetchpv} = [75, \&PUT_strconst, "GET_strconst"]; -$insn_data{gv_fetchpvx} = [76, \&PUT_strconst, "GET_strconst"]; -$insn_data{gv_stashpv} = [77, \&PUT_strconst, "GET_strconst"]; -$insn_data{gv_stashpvx} = [78, \&PUT_strconst, "GET_strconst"]; -$insn_data{gp_sv} = [79, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_refcnt} = [80, \&PUT_U32, "GET_U32"]; -$insn_data{gp_refcnt_add} = [81, \&PUT_I32, "GET_I32"]; -$insn_data{gp_av} = [82, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_hv} = [83, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_cv} = [84, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_file} = [85, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{gp_io} = [86, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_form} = [87, \&PUT_svindex, "GET_svindex"]; -$insn_data{gp_cvgen} = [88, \&PUT_U32, "GET_U32"]; -$insn_data{gp_line} = [89, \&PUT_U32, "GET_U32"]; -$insn_data{gp_share} = [90, \&PUT_svindex, "GET_svindex"]; -$insn_data{xgv_flags} = [91, \&PUT_U8, "GET_U8"]; -$insn_data{op_next} = [92, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_sibling} = [93, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_ppaddr} = [94, \&PUT_strconst, "GET_strconst"]; -$insn_data{op_targ} = [95, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{op_type} = [96, \&PUT_U16, "GET_U16"]; -$insn_data{op_opt} = [97, \&PUT_U8, "GET_U8"]; -$insn_data{op_static} = [98, \&PUT_U8, "GET_U8"]; -$insn_data{op_flags} = [99, \&PUT_U8, "GET_U8"]; -$insn_data{op_private} = [100, \&PUT_U8, "GET_U8"]; -$insn_data{op_first} = [101, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_last} = [102, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_other} = [103, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_pmreplroot} = [104, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_pmreplstart} = [105, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_pmnext} = [106, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_pmstashpv} = [107, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{op_pmreplrootpo} = [108, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{op_pmstash} = [109, \&PUT_svindex, "GET_svindex"]; -$insn_data{op_pmreplrootgv} = [110, \&PUT_svindex, "GET_svindex"]; -$insn_data{pregcomp} = [111, \&PUT_pvcontents, "GET_pvcontents"]; -$insn_data{op_pmflags} = [112, \&PUT_U16, "GET_U16"]; -$insn_data{op_sv} = [113, \&PUT_svindex, "GET_svindex"]; -$insn_data{op_padix} = [114, \&PUT_PADOFFSET, "GET_PADOFFSET"]; -$insn_data{op_pv} = [115, \&PUT_pvcontents, "GET_pvcontents"]; -$insn_data{op_pv_tr} = [116, \&PUT_op_tr_array, "GET_op_tr_array"]; -$insn_data{op_redoop} = [117, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_nextop} = [118, \&PUT_opindex, "GET_opindex"]; -$insn_data{op_lastop} = [119, \&PUT_opindex, "GET_opindex"]; -$insn_data{cop_label} = [120, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{cop_stashpv} = [121, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{cop_file} = [122, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{cop_stash} = [123, \&PUT_svindex, "GET_svindex"]; -$insn_data{cop_filegv} = [124, \&PUT_svindex, "GET_svindex"]; -$insn_data{cop_seq} = [125, \&PUT_U32, "GET_U32"]; -$insn_data{cop_arybase} = [126, \&PUT_I32, "GET_I32"]; -$insn_data{cop_line} = [127, \&PUT_U32, "GET_U32"]; -$insn_data{cop_warnings} = [128, \&PUT_svindex, "GET_svindex"]; -$insn_data{main_start} = [129, \&PUT_opindex, "GET_opindex"]; -$insn_data{main_root} = [130, \&PUT_opindex, "GET_opindex"]; -$insn_data{main_cv} = [131, \&PUT_svindex, "GET_svindex"]; -$insn_data{curpad} = [132, \&PUT_svindex, "GET_svindex"]; -$insn_data{push_begin} = [133, \&PUT_svindex, "GET_svindex"]; -$insn_data{push_init} = [134, \&PUT_svindex, "GET_svindex"]; -$insn_data{push_end} = [135, \&PUT_svindex, "GET_svindex"]; -$insn_data{curstash} = [136, \&PUT_svindex, "GET_svindex"]; -$insn_data{defstash} = [137, \&PUT_svindex, "GET_svindex"]; -$insn_data{data} = [138, \&PUT_U8, "GET_U8"]; -$insn_data{incav} = [139, \&PUT_svindex, "GET_svindex"]; -$insn_data{load_glob} = [140, \&PUT_svindex, "GET_svindex"]; -$insn_data{regex_padav} = [141, \&PUT_svindex, "GET_svindex"]; -$insn_data{dowarn} = [142, \&PUT_U8, "GET_U8"]; -$insn_data{comppad_name} = [143, \&PUT_svindex, "GET_svindex"]; -$insn_data{xgv_stash} = [144, \&PUT_svindex, "GET_svindex"]; -$insn_data{signal} = [145, \&PUT_strconst, "GET_strconst"]; -$insn_data{formfeed} = [146, \&PUT_svindex, "GET_svindex"]; - -my ($insn_name, $insn_data); -while (($insn_name, $insn_data) = each %insn_data) { - $insn_name[$insn_data->[0]] = $insn_name; -} -# Fill in any gaps -@insn_name = map($_ || "unused", @insn_name); - -1; - -__END__ - -=head1 NAME - -B::Asmdata - Autogenerated data about Perl ops - -=head1 SYNOPSIS - - use B::Asmdata qw(%insn_data @insn_name @optype @specialsv_name); - -=head1 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. - -=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 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'). - -=back - -=head1 AUTHOR - -Malcolm Beattie, C - -=cut - -# ex: set ro: diff --git a/regen.pl b/regen.pl index 7b0f8e3..a1f1ab8 100644 --- a/regen.pl +++ b/regen.pl @@ -18,7 +18,6 @@ safer_unlink ("warnings.h", "lib/warnings.pm"); my %gen = ( 'autodoc.pl' => [qw[pod/perlapi.pod pod/perlintern.pod]], - 'bytecode.pl' => [qw[ext/B/B/Asmdata.pm]], 'embed.pl' => [qw[proto.h embed.h embedvar.h global.sym perlapi.h perlapi.c]], 'keywords.pl' => [qw[keywords.h]], @@ -45,7 +44,7 @@ sub do_cksum { return %cksum; } -foreach my $pl (qw (keywords.pl opcode.pl embed.pl bytecode.pl +foreach my $pl (qw (keywords.pl opcode.pl embed.pl regcomp.pl warnings.pl autodoc.pl reentr.pl)) { print "$^X $pl\n"; my %cksum0; diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index d6c740e..70f4102 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -1370,9 +1370,6 @@ $(SOCKH) : [.vms]$(SOCKH) # pp.sym: opcode.pl # embed.h: embed.pl [* needs pp.sym generated by opcode.pl! *] # embedvar.h: embed.pl [* needs pp.sym generated by opcode.pl! *] -# ext/ByteLoader/byterun.h: bytecode.pl -# ext/ByteLoader/byterun.c: bytecode.pl -# ext/B/Asmdata.pm: bytecode.pl # global.sym: embed.pl # regnodes.h: regcomp.pl # warnings.h lib/warnings.pm: warnings.pl @@ -1385,7 +1382,6 @@ regen_headers : $(INSTPERL) opcode.pl $(INSTPERL) overload.pl $(INSTPERL) embed.pl - $(INSTPERL) bytecode.pl $(INSTPERL) regcomp.pl $(INSTPERL) warnings.pl