From: Nicholas Clark Date: Wed, 9 Nov 2005 17:29:44 +0000 (+0000) Subject: Make the Bytecode changes conditional on perl version. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1f6360abe530a1c45783befa26b356d0a4edb63;p=p5sagit%2Fp5-mst-13.2.git Make the Bytecode changes conditional on perl version. p4raw-id: //depot/perl@26063 --- diff --git a/ext/B/B/Bytecode.pm b/ext/B/B/Bytecode.pm index 2d78d73..78cabcc 100644 --- a/ext/B/B/Bytecode.pm +++ b/ext/B/B/Bytecode.pm @@ -172,6 +172,9 @@ sub B::HV::ix { asm "ldsv", $varix = $ix unless $ix == $varix; ($i = not $i) ? asm ("newpv", pvstring $_) : asm("hv_store", $_) for @array; + if (VERSION >= 5.009) { + asm "xnv", $hv->NVX; + } asm "xmg_stash", $stashix; asm "xhv_riter", $hv->RITER; } @@ -233,9 +236,11 @@ sub B::PVIV::bsave { $sv->ROK ? $sv->B::RV::bsave($ix): $sv->B::NULL::bsave($ix); - # See note below in B::PVNV::bsave - return if $sv->isa('B::AV'); - return if $sv->isa('B::HV'); + if (VERSION >= 5.009) { + # See note below in B::PVNV::bsave + return if $sv->isa('B::AV'); + return if $sv->isa('B::HV'); + } asm "xiv", !ITHREADS && $sv->FLAGS & (SVf_FAKE|SVf_READONLY) ? "0 but true" : $sv->IVX; } @@ -243,13 +248,15 @@ sub B::PVIV::bsave { sub B::PVNV::bsave { my ($sv,$ix) = @_; $sv->B::PVIV::bsave($ix); - # Magical AVs end up here, but AVs now don't have an NV slot actually - # allocated. Hence don't write out assembly to store the NV slot if we're - # actually an array. - return if $sv->isa('B::AV'); - # Likewise HVs have no NV slot actually allocated. - # I don't think that they can get here, but better safe than sorry - return if $sv->isa('B::HV'); + if (VERSION >= 5.009) { + # Magical AVs end up here, but AVs now don't have an NV slot actually + # allocated. Hence don't write out assembly to store the NV slot if + # we're actually an array. + return if $sv->isa('B::AV'); + # Likewise HVs have no NV slot actually allocated. + # I don't think that they can get here, but better safe than sorry + return if $sv->isa('B::HV'); + } asm "xnv", sprintf "%.40g", $sv->NVX; } @@ -370,6 +377,9 @@ sub B::AV::bsave { asm "av_extend", $av->MAX if $av->MAX >= 0; asm "av_pushx", $_ for @array; asm "sv_refcnt", $av->REFCNT; + if (VERSION < 5.009) { + asm "xav_flags", $av->AvFLAGS; + } asm "xmg_stash", $stashix; }