From: Jarkko Hietaniemi Date: Fri, 22 Aug 2003 05:15:30 +0000 (+0000) Subject: More bytecode patching from Enache. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=113d5bd98de2c46b2e852e15b8eb1becf60dddc4;p=p5sagit%2Fp5-mst-13.2.git More bytecode patching from Enache. p4raw-id: //depot/perl@20816 --- diff --git a/bytecode.pl b/bytecode.pl index 73accab..bfe7502 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -4,8 +4,8 @@ BEGIN { } use strict; my %alias_to = ( - U32 => [qw(STRLEN line_t)], - I32 => [qw(SSize_t long)], + U32 => [qw(line_t)], + PADOFFSET => [qw(STRLEN SSize_t)], U16 => [qw(OPCODE short)], U8 => [qw(char)], ); diff --git a/ext/B/B/Asmdata.pm b/ext/B/B/Asmdata.pm index 6492970..6bf75ae 100644 --- a/ext/B/B/Asmdata.pm +++ b/ext/B/B/Asmdata.pm @@ -39,7 +39,7 @@ $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_U32, "GET_U32"]; +$insn_data{pv_cur} = [15, \&PUT_PADOFFSET, "GET_PADOFFSET"]; $insn_data{pv_free} = [16, \&PUT_none, "GET_none"]; $insn_data{sv_upgrade} = [17, \&PUT_U8, "GET_U8"]; $insn_data{sv_refcnt} = [18, \&PUT_U32, "GET_U32"]; @@ -47,12 +47,12 @@ $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_U32, "GET_U32"]; -$insn_data{xpv_len} = [24, \&PUT_U32, "GET_U32"]; +$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_U32, "GET_U32"]; -$insn_data{xlv_targlen} = [28, \&PUT_U32, "GET_U32"]; +$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"]; @@ -78,16 +78,16 @@ $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_I32, "GET_I32"]; +$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_I32, "GET_I32"]; +$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_I32, "GET_I32"]; -$insn_data{xav_max} = [64, \&PUT_I32, "GET_I32"]; +$insn_data{xav_fill} = [63, \&PUT_PADOFFSET, "GET_PADOFFSET"]; +$insn_data{xav_max} = [64, \&PUT_PADOFFSET, "GET_PADOFFSET"]; $insn_data{xav_flags} = [65, \&PUT_U8, "GET_U8"]; $insn_data{xhv_riter} = [66, \&PUT_I32, "GET_I32"]; $insn_data{xhv_name} = [67, \&PUT_pvindex, "GET_pvindex"]; diff --git a/ext/B/B/Assembler.pm b/ext/B/B/Assembler.pm index 989e1e1..dc24d66 100644 --- a/ext/B/B/Assembler.pm +++ b/ext/B/B/Assembler.pm @@ -146,6 +146,10 @@ sub B::Asmdata::PUT_PADOFFSET { $Config{ptrsize} == 8 ? &B::Asmdata::PUT_IV64 : &B::Asmdata::PUT_U32; } +sub B::Asmdata::PUT_long { + $Config{longsize} == 8 ? &B::Asmdata::PUT_IV64 : &B::Asmdata::PUT_U32; +} + my %unesc = (n => "\n", r => "\r", t => "\t", a => "\a", b => "\b", f => "\f", v => "\013"); diff --git a/ext/B/B/Disassembler.pm b/ext/B/B/Disassembler.pm index 0d28ed8..a565e5d 100644 --- a/ext/B/B/Disassembler.pm +++ b/ext/B/B/Disassembler.pm @@ -153,6 +153,15 @@ sub GET_IV { $Config{ivsize} == 4 ? &GET_I32 : &GET_IV64; } +sub B::::GET_PADOFFSET { + $Config{ptrsize} == 8 ? &B::GET_IV64 : &B::GET_U32; +} + +sub B::::GET_long { + $Config{longsize} == 8 ? &B::GET_IV64 : &B::GET_U32; +} + + package B::Disassembler; use Exporter; @ISA = qw(Exporter); diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index c0093a5..7fb91da 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -22,6 +22,8 @@ typedef char *pvindex; BGET_FREAD(&arg, sizeof(UV), 1) #define BGET_PADOFFSET(arg) \ BGET_FREAD(&arg, sizeof(PADOFFSET), 1) +#define BGET_long(arg) \ + BGET_FREAD(&arg, sizeof(long), 1) #define BGET_I32(arg) BGET_U32(arg) #define BGET_IV(arg) BGET_UV(arg)