Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

DESTROY not triggered on upgraded lexvar #48

Open
atoomic opened this issue Jul 17, 2017 · 0 comments
Open

DESTROY not triggered on upgraded lexvar #48

atoomic opened this issue Jul 17, 2017 · 0 comments

Comments

@atoomic
Copy link
Collaborator

atoomic commented Jul 17, 2017

Extract from tests 163

my $destroyed = 0;
sub  X::DESTROY { $destroyed = 1 }
{
	my $x;
	BEGIN {$x = sub { }  }
	$x = bless {}, X;
}
print qq{ok\n} if $destroyed == 1;

When adding some extra Devel::Peek warnings there we can notice two issues

sub  X::DESTROY { $destroyed = 1 }
{
	my $x;  
	BEGIN {$x = sub { }  }
  eval q{use Devel::Peek; warn "==== 1\n"; Dump($x)};
	$x = bless {}, X;
  eval q{use Devel::Peek; warn "==== 2\n"; Dump($x)};
}
print qq{DESTROYed $X::destroyed\n};# if $destroyed == 1;
  1. The CV Outside is NULL whereas it should point to the main one
  2. the refcnt for the cv entry ( in sv_list is set to 2 whereas we should expect one )
  3. WEAKOUTSIDE is enabled whereas this was not set at save time, something is enabling it ( op.c or pad.c ? )

Compiled version

==== 1
SV = IV(0x61a378) at 0x61a380
  REFCNT = 3
  FLAGS = (ROK)
  RV = 0x61a398
  SV = PVCV(0x617628) at 0x61a398
    REFCNT = 2
    FLAGS = (PADSTALE,ANON,WEAKOUTSIDE,CVGV_RC)
    COMP_STASH = 0x619af8	"main"
    START = 0x6257e0 ===> 1
    ROOT = 0x632370
    GVGV::GV = 0x61d480	"main" :: "__ANON__"
    FILE = "test.pl"
    DEPTH = 0
    FLAGS = 0x490
    OUTSIDE_SEQ = 511
    PADLIST = 0x615d40
    PADNAME = 0x615ee0(0x189fb70) PAD = 0x61a3c8(0x189fb90)
    OUTSIDE = 0x0 (null)
==== 2
SV = IV(0x61a370) at 0x61a380
  REFCNT = 3
  FLAGS = (ROK)
  RV = 0x18b7fc0
  SV = PVHV(0x189b320) at 0x18b7fc0
    REFCNT = 1
    FLAGS = (OBJECT,SHAREKEYS)
    STASH = 0x61a308	"X"
    ARRAY = 0x0
    KEYS = 0
    FILL = 0
    MAX = 7
DESTROYed 0

Uncompiled version

==== 1
SV = IV(0xe3ba38) at 0xe3ba48
  REFCNT = 2
  FLAGS = (ROK)
  RV = 0xe3bb98
  SV = PVCV(0xe2fd88) at 0xe3bb98
    REFCNT = 1
    FLAGS = (PADSTALE,ANON,CVGV_RC)
    COMP_STASH = 0xe1bff8	"main"
    START = 0xe21650 ===> 1
    ROOT = 0xe21610
    GVGV::GV = 0xe3bbc8	"main" :: "__ANON__"
    FILE = "test.pl"
    DEPTH = 0
    FLAGS = 0x480
    OUTSIDE_SEQ = 6
    PADLIST = 0xe21420
    PADNAME = 0xe21470(0xe214a0) PAD = 0xe3bbb0(0xe21440)
    OUTSIDE = 0xe1c3a0 (MAIN)
==== 2
SV = IV(0xe3ba38) at 0xe3ba48
  REFCNT = 2
  FLAGS = (ROK)
  RV = 0xe3b988
  SV = PVHV(0xe230c0) at 0xe3b988
    REFCNT = 1
    FLAGS = (OBJECT,SHAREKEYS)
    STASH = 0xe3b9b8	"X"
    ARRAY = 0x0
    KEYS = 0
    FILL = 0
    MAX = 7
DESTROYed 1
atoomic added a commit that referenced this issue Jul 17, 2017
@atoomic atoomic changed the title DESTROY not triggered when changing the type of a scalar DESTROY not triggered on upgraded lexvar Jul 18, 2017
atoomic added a commit that referenced this issue Jul 18, 2017
DESTROY on upgraded lexvar not triggered
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants