summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-08-21 04:30:54 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-21 04:30:54 +0000
commitca337316984db69ef8c629fa7228a5d8e486f363 (patch)
tree6c35bbbf307e2e13e22170f9e4677e6f8487f7a7
parent75d1b5dfc310050618a644104f03818db57b4915 (diff)
downloadperl-ca337316984db69ef8c629fa7228a5d8e486f363.tar.gz
Byteloader patching from Enache continues;
PADOFFSET handling was wrong. p4raw-id: //depot/perl@20792
-rw-r--r--bytecode.pl2
-rw-r--r--ext/B/B/Asmdata.pm6
-rw-r--r--ext/B/B/Assembler.pm4
-rw-r--r--ext/B/t/assembler.t2
-rw-r--r--ext/ByteLoader/bytecode.h2
-rw-r--r--ext/ByteLoader/byterun.c6
6 files changed, 15 insertions, 7 deletions
diff --git a/bytecode.pl b/bytecode.pl
index e3104af731..73accabc39 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 12646fc9c1..64929706d0 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 a9f896ae01..989e1e1b9b 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 5e83f864be..f92ebd7798 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 8ca9382fa6..c0093a5b62 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 0a8afc627a..abf8fecefd 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;
}