summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-04 23:12:01 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-04 23:12:01 +0000
commit7a4bba223aa750dd886fe6a2fddef224e59c717f (patch)
treea62d2cfd06d6f0b3dcac09e795b2cb7a34fdb104 /dump.c
parent7f605079929e971ed43dc83cf99bc51154965c26 (diff)
downloadperl-7a4bba223aa750dd886fe6a2fddef224e59c717f.tar.gz
Re-implement the SvOOK() hack to store the offset as a BER encoded
number in the part of the PVX that is being released. (It will always fit, as chopping off 1 byte gives just enough space for recording a delta of up to 127). This allows SvOOK() to co-exist with SvIOK_on(), which means all the calls to SvOOK_off() [with the possibility of a call to sv_backoff()] in SvIOK_on() can be removed. This ought to make a lot of straight line code a little bit simpler. OOK()d scalars can now be SVt_PV, as the IVX isn't needed. p4raw-id: //depot/perl@32836
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dump.c b/dump.c
index 90f44ee81b..9312bf4607 100644
--- a/dump.c
+++ b/dump.c
@@ -1539,8 +1539,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " UV = %"UVuf, (UV)SvUVX(sv));
else
Perl_dump_indent(aTHX_ level, file, " IV = %"IVdf, (IV)SvIVX(sv));
- if (SvOOK(sv))
- PerlIO_printf(file, " (OFFSET)");
#ifdef PERL_OLD_COPY_ON_WRITE
if (SvIsCOW_shared_hash(sv))
PerlIO_printf(file, " (HASH)");
@@ -1578,9 +1576,17 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
}
if (type <= SVt_PVLV && !isGV_with_GP(sv)) {
if (SvPVX_const(sv)) {
+ UV delta = SvOOK(sv) ? sv_read_offset(sv) : 0;
+ if (SvOOK(sv)) {
+ Perl_dump_indent(aTHX_ level, file," OFFSET = %"UVuf"\n",
+ delta);
+ }
Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX_const(sv)));
- if (SvOOK(sv))
- PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
+ if (SvOOK(sv)) {
+ PerlIO_printf(file, "( %s . ) ",
+ pv_display(d, SvPVX_const(sv) - delta, delta, 0,
+ pvlim));
+ }
PerlIO_printf(file, "%s", pv_display(d, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), pvlim));
if (SvUTF8(sv)) /* the 6? \x{....} */
PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 6 * SvCUR(sv), UNI_DISPLAY_QQ));