From: Jarkko Hietaniemi Date: Thu, 21 Aug 2003 04:30:54 +0000 (+0000) Subject: Byteloader patching from Enache continues; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca337316984db69ef8c629fa7228a5d8e486f363;p=p5sagit%2Fp5-mst-13.2.git Byteloader patching from Enache continues; PADOFFSET handling was wrong. p4raw-id: //depot/perl@20792 --- diff --git a/bytecode.pl b/bytecode.pl index e3104af..73accab 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -4,7 +4,7 @@ BEGIN { } use strict; my %alias_to = ( - U32 => [qw(PADOFFSET STRLEN line_t)], + U32 => [qw(STRLEN line_t)], I32 => [qw(SSize_t long)], U16 => [qw(OPCODE short)], U8 => [qw(char)], diff --git a/ext/B/B/Asmdata.pm b/ext/B/B/Asmdata.pm index 12646fc..6492970 100644 --- a/ext/B/B/Asmdata.pm +++ b/ext/B/B/Asmdata.pm @@ -120,7 +120,7 @@ $insn_data{xgv_flags} = [93, \&PUT_U8, "GET_U8"]; $insn_data{op_next} = [94, \&PUT_opindex, "GET_opindex"]; $insn_data{op_sibling} = [95, \&PUT_opindex, "GET_opindex"]; $insn_data{op_ppaddr} = [96, \&PUT_strconst, "GET_strconst"]; -$insn_data{op_targ} = [97, \&PUT_U32, "GET_U32"]; +$insn_data{op_targ} = [97, \&PUT_PADOFFSET, "GET_PADOFFSET"]; $insn_data{op_type} = [98, \&PUT_U16, "GET_U16"]; $insn_data{op_seq} = [99, \&PUT_U16, "GET_U16"]; $insn_data{op_flags} = [100, \&PUT_U8, "GET_U8"]; @@ -132,7 +132,7 @@ $insn_data{op_pmreplroot} = [105, \&PUT_opindex, "GET_opindex"]; $insn_data{op_pmreplstart} = [106, \&PUT_opindex, "GET_opindex"]; $insn_data{op_pmnext} = [107, \&PUT_opindex, "GET_opindex"]; $insn_data{op_pmstashpv} = [108, \&PUT_pvindex, "GET_pvindex"]; -$insn_data{op_pmreplrootpo} = [109, \&PUT_U32, "GET_U32"]; +$insn_data{op_pmreplrootpo} = [109, \&PUT_PADOFFSET, "GET_PADOFFSET"]; $insn_data{op_pmstash} = [110, \&PUT_svindex, "GET_svindex"]; $insn_data{op_pmreplrootgv} = [111, \&PUT_svindex, "GET_svindex"]; $insn_data{pregcomp} = [112, \&PUT_pvcontents, "GET_pvcontents"]; @@ -140,7 +140,7 @@ $insn_data{op_pmflags} = [113, \&PUT_U16, "GET_U16"]; $insn_data{op_pmpermflags} = [114, \&PUT_U16, "GET_U16"]; $insn_data{op_pmdynflags} = [115, \&PUT_U8, "GET_U8"]; $insn_data{op_sv} = [116, \&PUT_svindex, "GET_svindex"]; -$insn_data{op_padix} = [117, \&PUT_U32, "GET_U32"]; +$insn_data{op_padix} = [117, \&PUT_PADOFFSET, "GET_PADOFFSET"]; $insn_data{op_pv} = [118, \&PUT_pvcontents, "GET_pvcontents"]; $insn_data{op_pv_tr} = [119, \&PUT_op_tr_array, "GET_op_tr_array"]; $insn_data{op_redoop} = [120, \&PUT_opindex, "GET_opindex"]; diff --git a/ext/B/B/Assembler.pm b/ext/B/B/Assembler.pm index a9f896a..989e1e1 100644 --- a/ext/B/B/Assembler.pm +++ b/ext/B/B/Assembler.pm @@ -142,6 +142,10 @@ sub B::Asmdata::PUT_IV { $Config{ivsize} == 4 ? &B::Asmdata::PUT_I32 : &B::Asmdata::PUT_IV64; } +sub B::Asmdata::PUT_PADOFFSET { + $Config{ptrsize} == 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/t/assembler.t b/ext/B/t/assembler.t index 5e83f86..f92ebd7 100644 --- a/ext/B/t/assembler.t +++ b/ext/B/t/assembler.t @@ -248,6 +248,7 @@ U16 => [ 0xffff, 0 ], pvcontents => [], strconst => [ '""', '"another string"' ], # no NUL op_tr_array => [ join( ',', 256, 0..255 ) ], +PADOFFSET => undef, ); # Erronous operand values @@ -270,6 +271,7 @@ NV => undef, # PUT_NV accepts anything - it shouldn't, real-ly pvcontents => [ '"spurious arg"' ], strconst => [ 'no quote"', '"with NUL '."\0".' char"' ], # no NUL op_tr_array => undef, # op_pv_tr is no longer exactly 256 shorts +PADOFFSET => undef, ); diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index 8ca9382..c0093a5 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -20,6 +20,8 @@ typedef char *pvindex; BGET_FREAD(&arg, sizeof(U32), 1) #define BGET_UV(arg) \ BGET_FREAD(&arg, sizeof(UV), 1) +#define BGET_PADOFFSET(arg) \ + BGET_FREAD(&arg, sizeof(PADOFFSET), 1) #define BGET_I32(arg) BGET_U32(arg) #define BGET_IV(arg) BGET_UV(arg) diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c index 0a8afc6..abf8fec 100644 --- a/ext/ByteLoader/byterun.c +++ b/ext/ByteLoader/byterun.c @@ -738,7 +738,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) case INSN_OP_TARG: /* 97 */ { PADOFFSET arg; - BGET_U32(arg); + BGET_PADOFFSET(arg); PL_op->op_targ = arg; break; } @@ -823,7 +823,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) case INSN_OP_PMREPLROOTPO: /* 109 */ { PADOFFSET arg; - BGET_U32(arg); + BGET_PADOFFSET(arg); cPMOP->op_pmreplroot = (OP*)arg; break; } @@ -881,7 +881,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) case INSN_OP_PADIX: /* 117 */ { PADOFFSET arg; - BGET_U32(arg); + BGET_PADOFFSET(arg); cPADOP->op_padix = arg; break; }