diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-04 23:12:01 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2009-03-19 11:52:02 +0000 |
commit | 0dd1a9749ac502e8f2a908316f20bb86c496ba03 (patch) | |
tree | 769a3697bb2ff40d7af2a85222d6b8486cc7b641 /dump.c | |
parent | 7e20f6b640c6e7cd33348abf039f3f85e1e8b474 (diff) | |
download | perl-0dd1a9749ac502e8f2a908316f20bb86c496ba03.tar.gz |
revert the SvOOK re-implementation:
------------
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
(cherry-picked from commit 7a4bba223aa750dd886fe6a2fddef224e59c717f)
------------
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -1535,6 +1535,8 @@ 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)"); @@ -1572,17 +1574,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo } if ((type <= SVt_PVLV && !isGV_with_GP(sv)) || type == SVt_PVFM) { 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", - (UV) 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) - delta, delta, 0, - pvlim)); - } + if (SvOOK(sv)) + PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 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)); |