line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ref::Store::PP::Key; |
2
|
1
|
|
|
1
|
|
355
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
4
|
use Scalar::Util qw(weaken refaddr); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
5
|
1
|
|
|
1
|
|
5
|
use Ref::Store::Common; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp::Heavy; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
7
|
1
|
|
|
1
|
|
298
|
use Ref::Store::PP::Magic; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
50
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use base qw(Ref::Store::Key); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
294
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
25
|
|
|
25
|
|
47
|
my ($cls,$scalar,$table) = @_; |
13
|
|
|
|
|
|
|
|
14
|
25
|
|
|
|
|
41
|
my $self = []; |
15
|
25
|
|
|
|
|
43
|
@{$self}[HR_KFLD_STRSCALAR, HR_KFLD_REFSCALAR, HR_KFLD_TABLEREF] = |
|
25
|
|
|
|
|
65
|
|
16
|
|
|
|
|
|
|
("$scalar", $scalar, $table); |
17
|
25
|
|
|
|
|
42
|
bless $self, $cls; |
18
|
|
|
|
|
|
|
|
19
|
25
|
|
|
|
|
57
|
$table->scalar_lookup->{$scalar} = $self; |
20
|
25
|
|
|
|
|
70
|
weaken($table->scalar_lookup->{$scalar}); |
21
|
|
|
|
|
|
|
|
22
|
25
|
|
|
|
|
82
|
hr_pp_trigger_register($self,$table->forward,"$scalar"); |
23
|
25
|
|
|
|
|
78
|
hr_pp_trigger_register($self,$table->scalar_lookup,"$scalar"); |
24
|
25
|
|
|
|
|
57
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
0
|
|
|
sub ithread_predup { |
28
|
|
|
|
|
|
|
#Perl data structures are still valid here.. |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
0
|
|
|
sub ithread_postdup { |
32
|
|
|
|
|
|
|
#PP::Magic information is dup'd as well, nothing for us here. Key is static |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
package Ref::Store::PP::Key::Encapsulating; |
36
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
37
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
38
|
1
|
|
|
1
|
|
4
|
use base qw(Ref::Store::PP::Key); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
266
|
|
39
|
1
|
|
|
1
|
|
7
|
use Ref::Store::Common; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
110
|
|
40
|
1
|
|
|
1
|
|
5
|
use Ref::Store::Common qw(:pp_constants); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
111
|
|
41
|
1
|
|
|
1
|
|
6
|
use Ref::Store::PP::Magic; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
53
|
|
42
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(weaken isweak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
43
|
1
|
|
|
1
|
|
5
|
use Log::Fu; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
44
|
1
|
|
|
1
|
|
91
|
use Ref::Store::ThreadUtil; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
56
|
|
45
|
1
|
|
|
1
|
|
4
|
use Devel::GlobalDestruction; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
53
|
use constant HR_KFLD_VHREF => HR_KFLD_AVAILABLE() + 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
5
|
use Devel::Peek qw(Dump); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new { |
52
|
18
|
|
|
18
|
|
38
|
my ($cls,$obj,$table) = @_; |
53
|
18
|
|
|
|
|
30
|
my $self = []; |
54
|
18
|
|
|
|
|
29
|
@{$self}[HR_KFLD_STRSCALAR, HR_KFLD_REFSCALAR, HR_KFLD_TABLEREF] = |
|
18
|
|
|
|
|
39
|
|
55
|
|
|
|
|
|
|
($obj+0, $obj, $table); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#log_err("Creating new encapsulating key for object", $obj+0); |
58
|
18
|
|
|
|
|
60
|
hr_pp_trigger_register($obj, $table->scalar_lookup,$obj+0); |
59
|
|
|
|
|
|
|
|
60
|
18
|
|
|
|
|
69
|
weaken($table->scalar_lookup->{$obj+0} = $self); |
61
|
|
|
|
|
|
|
|
62
|
18
|
|
|
|
|
30
|
bless $self, $cls; |
63
|
18
|
|
|
|
|
44
|
return $self; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub ithread_predup { |
68
|
0
|
|
|
0
|
|
0
|
my ($self,$table,$ptr_map,$value) = @_; |
69
|
0
|
|
|
|
|
0
|
hr_thrutil_store_kinfo(HR_THR_KENCAP_PREFIX, |
70
|
|
|
|
|
|
|
$self->[HR_KFLD_STRSCALAR], $ptr_map, $value+0); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub ithread_postdup { |
74
|
0
|
|
|
0
|
|
0
|
my ($self,$new_table,$ptr_map,$old_taddr) = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
my $obj = $self->[HR_KFLD_REFSCALAR]; |
77
|
0
|
|
|
|
|
0
|
my $old_objaddr = $self->[HR_KFLD_STRSCALAR]; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
hr_pp_trigger_replace_key( |
80
|
|
|
|
|
|
|
$obj, $old_objaddr, $self->[HR_KFLD_TABLEREF]->scalar_lookup, |
81
|
|
|
|
|
|
|
$obj + 0); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
my $old_vaddr = hr_thrutil_get_kinfo( |
84
|
|
|
|
|
|
|
HR_THR_KENCAP_PREFIX, $old_objaddr, $ptr_map); |
85
|
0
|
0
|
|
|
|
0
|
if(!$old_vaddr) { |
86
|
0
|
|
|
|
|
0
|
print Dumper($ptr_map); |
87
|
0
|
|
|
|
|
0
|
die("Couldn't find old value for key"); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
my $vhash = $ptr_map->{ |
90
|
0
|
|
|
|
|
0
|
HR_THR_LINFO_PREFIX . $old_taddr}->reverse->{$old_vaddr}; |
91
|
0
|
0
|
|
|
|
0
|
if(!$vhash) { |
92
|
0
|
|
|
|
|
0
|
print Dumper($ptr_map->{HR_THR_LINFO_PREFIX.$old_taddr}); |
93
|
0
|
|
|
|
|
0
|
die("Couldn't find old vhash! ($old_vaddr)"); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
hr_pp_trigger_replace_key( |
96
|
0
|
|
|
|
|
0
|
$obj, $old_objaddr, $vhash, |
97
|
|
|
|
|
|
|
$obj + 0); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
0
|
$self->[HR_KFLD_STRSCALAR] = $obj + 0; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub link_value { |
103
|
18
|
|
|
18
|
|
32
|
my ($self,$value) = @_; |
104
|
18
|
|
|
|
|
27
|
my $obj = $self->[HR_KFLD_REFSCALAR]; |
105
|
18
|
|
|
|
|
36
|
my $stored_privhash = $self->[HR_KFLD_TABLEREF]->reverse->{$value+0}; |
106
|
18
|
|
|
|
|
46
|
hr_pp_trigger_register($obj, $stored_privhash, $obj+0); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub unlink_value { |
110
|
12
|
|
|
12
|
|
20
|
my ($self,$value) = @_; |
111
|
12
|
|
|
|
|
24
|
my $obj = $self->[HR_KFLD_REFSCALAR]; |
112
|
|
|
|
|
|
|
hr_pp_trigger_unregister($obj, |
113
|
12
|
|
|
|
|
43
|
$self->[HR_KFLD_TABLEREF]->reverse->{$value+0}, |
114
|
|
|
|
|
|
|
$obj + 0 |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub exchange_value { |
119
|
0
|
|
|
0
|
|
0
|
my ($self,$old,$new) = @_; |
120
|
0
|
|
|
|
|
0
|
$self->unlink_value($old); |
121
|
0
|
|
|
|
|
0
|
$self->link_value($new); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub weaken_encapsulated { |
126
|
6
|
|
|
6
|
|
10
|
my $self = shift; |
127
|
6
|
|
|
|
|
19
|
weaken($self->[HR_KFLD_REFSCALAR]); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub kstring { |
132
|
32
|
|
|
32
|
|
41
|
my $self = shift; |
133
|
32
|
|
|
|
|
81
|
$self->[HR_KFLD_STRSCALAR]; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub dump { |
137
|
0
|
|
|
0
|
|
0
|
my ($self,$hrd) = @_; |
138
|
0
|
|
|
|
|
0
|
$hrd->iprint("ENCAP: %s", $hrd->fmt_ptr($self->[HR_KFLD_REFSCALAR])); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
#This is called: |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# 1) When the reverse value entry is deleted: |
144
|
|
|
|
|
|
|
# ACTION: clean up encapsulated object magic |
145
|
|
|
|
|
|
|
# |
146
|
|
|
|
|
|
|
# 2) When the object itself has triggered |
147
|
|
|
|
|
|
|
# A deletion from the value's reverse entry. |
148
|
|
|
|
|
|
|
# ACTION: |
149
|
|
|
|
|
|
|
|
150
|
1
|
|
|
1
|
|
467
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub DESTROY { |
153
|
18
|
50
|
|
18
|
|
380
|
return if in_global_destruction; |
154
|
18
|
|
|
|
|
104
|
my $self = shift; |
155
|
18
|
|
|
|
|
30
|
my $table = $self->[HR_KFLD_TABLEREF]; |
156
|
18
|
|
|
|
|
25
|
my $obj = $self->[HR_KFLD_REFSCALAR]; |
157
|
18
|
|
|
|
|
29
|
my $obj_s = $self->[HR_KFLD_STRSCALAR]; |
158
|
|
|
|
|
|
|
|
159
|
18
|
|
|
|
|
42
|
delete $table->scalar_lookup->{$obj_s}; |
160
|
18
|
|
|
|
|
32
|
my $value = delete $table->forward->{$obj_s}; |
161
|
|
|
|
|
|
|
|
162
|
18
|
100
|
|
|
|
40
|
if($obj) { |
163
|
14
|
|
|
|
|
37
|
hr_pp_trigger_unregister($obj, $table->scalar_lookup, $obj_s); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
#log_info("Found stored.. $stored", $stored+0); |
167
|
|
|
|
|
|
|
|
168
|
18
|
100
|
|
|
|
43
|
return unless $value; |
169
|
16
|
|
|
|
|
34
|
my $vhash = $table->reverse->{$value+0}; |
170
|
|
|
|
|
|
|
|
171
|
16
|
100
|
66
|
|
|
86
|
if(defined $value && defined $obj && defined $vhash) { |
|
|
|
100
|
|
|
|
|
172
|
1
|
|
|
|
|
4
|
hr_pp_trigger_unregister($obj, $vhash, $obj_s); |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
16
|
100
|
|
|
|
58
|
if(defined $vhash) { |
176
|
5
|
|
|
|
|
11
|
delete $vhash->{$self->[HR_KFLD_STRSCALAR]}; |
177
|
5
|
100
|
|
|
|
21
|
if(!%$vhash) { |
178
|
|
|
|
|
|
|
#log_info("Table empty!"); |
179
|
2
|
|
|
|
|
6
|
delete $table->reverse->{$value+0}; |
180
|
2
|
|
|
|
|
7
|
hr_pp_trigger_unregister($value, $table->reverse, $obj_s); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
package Ref::Store::PP; |
188
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
189
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
190
|
1
|
|
|
1
|
|
4
|
use Scalar::Util qw(weaken refaddr); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
191
|
1
|
|
|
1
|
|
5
|
use base qw(Ref::Store); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
192
|
1
|
|
|
1
|
|
6
|
use Ref::Store::PP::Magic; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
193
|
1
|
|
|
1
|
|
5
|
use Ref::Store::Common qw(:pp_constants); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
80
|
|
194
|
1
|
|
|
1
|
|
5
|
use Ref::Store::ThreadUtil; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
1
|
|
|
1
|
|
5
|
use Log::Fu { level => "debug" }; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub new_key { |
200
|
43
|
|
|
43
|
0
|
70
|
my ($self,$ukey) = @_; |
201
|
43
|
100
|
|
|
|
91
|
my $cls = ref $ukey ? 'Ref::Store::PP::Key::Encapsulating' : |
202
|
|
|
|
|
|
|
'Ref::Store::PP::Key'; |
203
|
43
|
|
|
|
|
125
|
$cls->new($ukey, $self); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub dref_add { |
207
|
160
|
|
|
160
|
0
|
266
|
my ($self,$value,$target,$key) = @_; |
208
|
160
|
|
66
|
|
|
517
|
$key ||= $value+0; |
209
|
160
|
|
|
|
|
385
|
hr_pp_trigger_register($value,$target,$key); |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub dref_del { |
213
|
62
|
|
|
62
|
0
|
103
|
my ($self,$value,$target,$key) = @_; |
214
|
62
|
|
|
|
|
142
|
hr_pp_trigger_unregister($value, $target, $key); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
*dref_add_str = \&dref_add; |
218
|
|
|
|
|
|
|
*dref_add_ptr = \&dref_add; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
*dref_del_ptr = \&dref_del; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
#sub dref_add_str { |
223
|
|
|
|
|
|
|
# my ($self,$value,$target,$key) = @_; |
224
|
|
|
|
|
|
|
# hr_pp_trigger_register($value, $key, $target); |
225
|
|
|
|
|
|
|
#} |
226
|
|
|
|
|
|
|
# |
227
|
|
|
|
|
|
|
#sub dref_add_ptr { |
228
|
|
|
|
|
|
|
# my ($self,$value,$target) = @_; |
229
|
|
|
|
|
|
|
# hr_pp_trigger_register($value, $value+0, $target); |
230
|
|
|
|
|
|
|
#} |
231
|
|
|
|
|
|
|
# |
232
|
|
|
|
|
|
|
#sub dref_del_ptr { |
233
|
|
|
|
|
|
|
# my ($self,$value,$target,$mkey) = @_; |
234
|
|
|
|
|
|
|
# hr_pp_trigger_unregister($value,$target,$mkey); |
235
|
|
|
|
|
|
|
#} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub ithread_store_lookup_info { |
238
|
0
|
|
|
0
|
0
|
|
my ($self,$ptr_map) = @_; |
239
|
0
|
|
|
|
|
|
my $Linfo = Ref::Store::ThreadUtil::OldLookups->new($self); |
240
|
0
|
|
|
|
|
|
$ptr_map->{HR_THR_LINFO_PREFIX . ($self + 0) } = $Linfo; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
1; |