This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't write bytecode to load the NVX of AVs and HVs
authorNicholas Clark <nick@ccl4.org>
Wed, 15 Jun 2005 22:32:14 +0000 (22:32 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 15 Jun 2005 22:32:14 +0000 (22:32 +0000)
p4raw-id: //depot/perl@24859

ext/B/B/Bytecode.pm

index a6cf550..b60651a 100644 (file)
@@ -240,6 +240,13 @@ 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');
     asm "xnv", sprintf "%.40g", $sv->NVX;
 }