line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ref::Store::Attribute; |
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
52
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
12
|
use Scalar::Util qw(weaken isweak); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
101
|
|
5
|
2
|
|
|
2
|
|
11
|
use Ref::Store::Common; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
195
|
|
6
|
2
|
|
|
2
|
|
10
|
use Data::Dumper; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
7
|
2
|
|
|
2
|
|
9
|
use Log::Fu; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
13
|
|
|
13
|
0
|
28
|
my ($cls,$scalar,$ref,$table) = @_; |
12
|
13
|
|
|
|
|
24
|
my $self = []; |
13
|
13
|
|
|
|
|
18
|
$#{$self} = HR_KFLD_ATTRHASH; |
|
13
|
|
|
|
|
37
|
|
14
|
|
|
|
|
|
|
|
15
|
13
|
|
|
|
|
25
|
bless $self, $cls; |
16
|
|
|
|
|
|
|
|
17
|
13
|
|
|
|
|
26
|
@{$self}[HR_KFLD_STRSCALAR, HR_KFLD_REFSCALAR, |
|
13
|
|
|
|
|
33
|
|
18
|
|
|
|
|
|
|
HR_KFLD_TABLEREF, HR_KFLD_ATTRHASH] = |
19
|
|
|
|
|
|
|
($scalar, $ref, $table, {}); |
20
|
|
|
|
|
|
|
|
21
|
13
|
|
|
|
|
30
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub link_value { |
25
|
37
|
|
|
37
|
0
|
59
|
my ($self,$value) = @_; |
26
|
|
|
|
|
|
|
|
27
|
37
|
|
|
|
|
90
|
$self->[HR_KFLD_TABLEREF]->dref_add_ptr( |
28
|
|
|
|
|
|
|
$value, |
29
|
|
|
|
|
|
|
$self->[HR_KFLD_ATTRHASH], |
30
|
|
|
|
|
|
|
$value + 0 |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub unlink_value { |
35
|
16
|
|
|
16
|
0
|
28
|
my ($self,$value) = @_; |
36
|
|
|
|
|
|
|
|
37
|
16
|
|
|
|
|
48
|
$self->[HR_KFLD_TABLEREF]->dref_del_ptr( |
38
|
|
|
|
|
|
|
$value, |
39
|
|
|
|
|
|
|
$self->[HR_KFLD_ATTRHASH], |
40
|
|
|
|
|
|
|
$value + 0 |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
16
|
|
|
|
|
49
|
delete $self->[HR_KFLD_ATTRHASH]->{$value+0}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
7
|
0
|
|
sub weaken_encapsulated { |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub store_weak { |
50
|
36
|
|
|
36
|
0
|
68
|
my ($self,$k,$v) = @_; |
51
|
36
|
|
|
|
|
119
|
weaken($self->[HR_KFLD_ATTRHASH]->{$k} = $v); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub store_strong { |
55
|
1
|
|
|
1
|
0
|
4
|
my ($self,$k,$v) = @_; |
56
|
1
|
|
|
|
|
3
|
$self->[HR_KFLD_ATTRHASH]->{$k} = $v; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_hash { |
60
|
51
|
|
|
51
|
0
|
154
|
$_[0]->[HR_KFLD_ATTRHASH]; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub kstring { |
64
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
65
|
0
|
|
|
|
|
0
|
$self->[HR_KFLD_STRSCALAR]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub dump { |
69
|
0
|
|
|
0
|
0
|
0
|
my ($self,$hrd) = @_; |
70
|
0
|
|
|
|
|
0
|
my $h = $self->[HR_KFLD_ATTRHASH]; |
71
|
0
|
|
|
|
|
0
|
foreach my $v (values %$h) { |
72
|
0
|
|
|
|
|
0
|
$hrd->iprint("V: %s", $hrd->fmt_ptr($v)); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
2
|
|
1260
|
use Ref::Store::ThreadUtil; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
559
|
|
77
|
|
|
|
0
|
0
|
|
sub ithread_predup { } |
78
|
|
|
|
|
|
|
sub ithread_postdup { |
79
|
0
|
|
|
0
|
0
|
0
|
my ($self,$newtable,$ptr_map,$old_taddr) = @_; |
80
|
0
|
|
|
|
|
0
|
my $attrhash = $self->[HR_KFLD_ATTRHASH]; |
81
|
0
|
|
|
|
|
0
|
my @old_keys = keys %$attrhash; |
82
|
0
|
|
|
|
|
0
|
foreach my $vaddr (@old_keys) { |
83
|
0
|
|
|
|
|
0
|
my $new_v = $ptr_map->{$vaddr}; |
84
|
0
|
|
|
|
|
0
|
$newtable->dref_del_ptr($new_v, $attrhash, $vaddr); |
85
|
0
|
|
|
|
|
0
|
$newtable->dref_add_str($new_v, $attrhash, $new_v + 0); |
86
|
0
|
|
|
|
|
0
|
my $was_weak = isweak($attrhash->{$vaddr}); |
87
|
0
|
|
|
|
|
0
|
$attrhash->{$new_v+0} = $new_v; |
88
|
0
|
0
|
|
|
|
0
|
if($was_weak) { |
89
|
0
|
|
|
|
|
0
|
weaken($attrhash->{$new_v+0}); |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
0
|
delete $attrhash->{$vaddr}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub DESTROY { |
96
|
16
|
|
|
16
|
|
24
|
my $self = shift; |
97
|
16
|
|
|
|
|
29
|
my $attrhash = $self->[HR_KFLD_ATTRHASH]; |
98
|
16
|
|
|
|
|
23
|
my $table = $self->[HR_KFLD_TABLEREF]; |
99
|
16
|
50
|
|
|
|
35
|
return unless $table; |
100
|
|
|
|
|
|
|
#log_err("Will iterate over contained values.."); |
101
|
16
|
|
|
|
|
36
|
foreach my $v (values %$attrhash) { |
102
|
7
|
100
|
|
|
|
16
|
next unless defined $v; |
103
|
6
|
|
|
|
|
22
|
$table->dref_del_ptr($v, $attrhash, $v+0); |
104
|
|
|
|
|
|
|
|
105
|
6
|
|
|
|
|
16
|
my $vhash = $table->reverse->{$v+0}; |
106
|
6
|
|
|
|
|
11
|
my $vaddr = $v+0; |
107
|
6
|
100
|
|
|
|
14
|
next unless defined $vhash; |
108
|
3
|
|
|
|
|
7
|
delete $vhash->{$self+0}; |
109
|
|
|
|
|
|
|
|
110
|
3
|
50
|
|
|
|
8
|
if(! %$vhash) { |
111
|
3
|
|
|
|
|
8
|
delete $table->reverse->{$vaddr}; |
112
|
3
|
50
|
|
|
|
8
|
if(defined $v) { |
113
|
3
|
|
|
|
|
8
|
$table->dref_del_ptr($v, $table->reverse, $vaddr); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
16
|
|
|
|
|
58
|
delete $table->attr_lookup->{ $self->[HR_KFLD_STRSCALAR] }; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package Ref::Store::Attribute::Encapsulating; |
122
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
123
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
51
|
|
124
|
2
|
|
|
2
|
|
8
|
use base qw(Ref::Store::Attribute); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
125
|
|
125
|
2
|
|
|
2
|
|
10
|
use Scalar::Util qw(weaken); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
67
|
|
126
|
2
|
|
|
2
|
|
13
|
use Ref::Store::Common; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
202
|
|
127
|
2
|
|
|
2
|
|
10
|
use Log::Fu; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
128
|
2
|
|
|
2
|
|
78
|
use Ref::Store::ThreadUtil; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
86
|
|
129
|
2
|
|
|
2
|
|
9
|
use Data::Dumper; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
130
|
2
|
|
|
2
|
|
775
|
use Devel::GlobalDestruction; |
|
2
|
|
|
|
|
3339
|
|
|
2
|
|
|
|
|
10
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub new { |
134
|
6
|
|
|
6
|
|
14
|
my ($cls,$astr,$encapsulated,$table) = @_; |
135
|
6
|
|
|
|
|
21
|
my $self = $cls->SUPER::new($astr, $encapsulated, $table); |
136
|
6
|
|
|
|
|
22
|
$table->dref_add($encapsulated, \&_encap_destroy_hook, $self); |
137
|
6
|
|
|
|
|
15
|
return $self; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub weaken_encapsulated { |
142
|
5
|
|
|
5
|
|
9
|
my $self = shift; |
143
|
5
|
|
|
|
|
15
|
weaken($self->[HR_KFLD_REFSCALAR]); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub dump { |
147
|
0
|
|
|
0
|
|
0
|
my ($self,$hrd) = @_; |
148
|
0
|
|
|
|
|
0
|
$hrd->iprint("ENCAP: %s", $self->[HR_KFLD_REFSCALAR]); |
149
|
0
|
|
|
|
|
0
|
$self->SUPER::dump($hrd); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub ithread_predup { |
153
|
0
|
|
|
0
|
|
0
|
my ($self,$table,$ptr_map) = @_; |
154
|
0
|
|
|
|
|
0
|
hr_thrutil_store_kinfo(HR_THR_AENCAP_PREFIX, $self->[HR_KFLD_STRSCALAR], |
155
|
|
|
|
|
|
|
$ptr_map, [ $self->[HR_KFLD_REFSCALAR]+0, $self + 0 ] ); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub ithread_postdup { |
159
|
0
|
|
|
0
|
|
0
|
my ($self,$table,$ptr_map,$old_taddr) = @_; |
160
|
0
|
|
|
|
|
0
|
my $old = hr_thrutil_get_kinfo(HR_THR_AENCAP_PREFIX, |
161
|
|
|
|
|
|
|
$self->[HR_KFLD_STRSCALAR], $ptr_map); |
162
|
0
|
|
|
|
|
0
|
my ($old_encap_addr,$old_self_addr) = @$old; |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
my $new_encap_addr = $self->[HR_KFLD_REFSCALAR]+0; |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
0
|
$self->[HR_KFLD_STRSCALAR] =~ s/\Q$old_encap_addr\E/$new_encap_addr/gi; |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
$table->dref_del_ptr($self->[HR_KFLD_REFSCALAR], |
169
|
|
|
|
|
|
|
$table->attr_lookup, $self->[HR_KFLD_STRSCALAR]); |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
my $attrhash = $self->[HR_KFLD_ATTRHASH]; |
172
|
0
|
|
|
|
|
0
|
foreach my $v (values %$attrhash) { |
173
|
0
|
|
|
|
|
0
|
my $vhash = $table->reverse->{$v+0}; |
174
|
0
|
|
|
|
|
0
|
$table->dref_del_ptr($self->[HR_KFLD_REFSCALAR], |
175
|
|
|
|
|
|
|
$vhash, $old_self_addr); |
176
|
0
|
|
|
|
|
0
|
$table->dref_add_str($self->[HR_KFLD_REFSCALAR], |
177
|
|
|
|
|
|
|
$vhash, $self + 0); |
178
|
|
|
|
|
|
|
} |
179
|
0
|
|
|
|
|
0
|
$self->SUPER::ithread_postdup($table,$ptr_map,$old_taddr); |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
2
|
|
|
2
|
|
609
|
use Carp qw(cluck); |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
265
|
|
183
|
|
|
|
|
|
|
sub _encap_destroy_hook { |
184
|
3
|
|
|
3
|
|
6
|
my ($encapped, $attr) = @_; |
185
|
3
|
50
|
|
|
|
58
|
return if in_global_destruction; |
186
|
3
|
|
|
|
|
19
|
$attr->DESTROY(); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub DESTROY { |
190
|
9
|
|
|
9
|
|
17
|
my $self = shift; |
191
|
9
|
50
|
|
|
|
163
|
return if in_global_destruction; |
192
|
9
|
|
|
|
|
63
|
$self->SUPER::DESTROY(); |
193
|
9
|
|
|
|
|
16
|
my $table = $self->[HR_KFLD_TABLEREF]; |
194
|
|
|
|
|
|
|
|
195
|
9
|
100
|
|
|
|
33
|
if($self->[HR_KFLD_REFSCALAR]) { |
196
|
3
|
|
|
|
|
11
|
$table->dref_del_ptr( |
197
|
|
|
|
|
|
|
$self->[HR_KFLD_REFSCALAR], |
198
|
|
|
|
|
|
|
\&_encap_destroy_hook, |
199
|
|
|
|
|
|
|
$self |
200
|
|
|
|
|
|
|
); |
201
|
3
|
|
|
|
|
16
|
$self->[HR_KFLD_REFSCALAR] = undef; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
1; |