line |
stmt |
bran |
cond |
sub |
time |
code |
1
|
|
|
|
|
|
/* scope.c |
2
|
|
|
|
|
|
* |
3
|
|
|
|
|
|
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
4
|
|
|
|
|
|
* 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Larry Wall and others |
5
|
|
|
|
|
|
* |
6
|
|
|
|
|
|
* You may distribute under the terms of either the GNU General Public |
7
|
|
|
|
|
|
* License or the Artistic License, as specified in the README file. |
8
|
|
|
|
|
|
* |
9
|
|
|
|
|
|
*/ |
10
|
|
|
|
|
|
|
11
|
|
|
|
|
|
/* |
12
|
|
|
|
|
|
* For the fashion of Minas Tirith was such that it was built on seven |
13
|
|
|
|
|
|
* levels... |
14
|
|
|
|
|
|
* |
15
|
|
|
|
|
|
* [p.751 of _The Lord of the Rings_, V/i: "Minas Tirith"] |
16
|
|
|
|
|
|
*/ |
17
|
|
|
|
|
|
|
18
|
|
|
|
|
|
/* This file contains functions to manipulate several of Perl's stacks; |
19
|
|
|
|
|
|
* in particular it contains code to push various types of things onto |
20
|
|
|
|
|
|
* the savestack, then to pop them off and perform the correct restorative |
21
|
|
|
|
|
|
* action for each one. This corresponds to the cleanup Perl does at |
22
|
|
|
|
|
|
* each scope exit. |
23
|
|
|
|
|
|
*/ |
24
|
|
|
|
|
|
|
25
|
|
|
|
|
|
#include "EXTERN.h" |
26
|
|
|
|
|
|
#define PERL_IN_SCOPE_C |
27
|
|
|
|
|
|
#include "perl.h" |
28
|
|
|
|
|
|
|
29
|
|
|
|
|
|
SV** |
30
|
50474
|
|
|
|
|
Perl_stack_grow(pTHX_ SV **sp, SV **p, SSize_t n) |
31
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
dVAR; |
33
|
|
|
|
|
|
|
34
|
|
|
|
|
|
PERL_ARGS_ASSERT_STACK_GROW; |
35
|
|
|
|
|
|
|
36
|
50474
|
|
|
|
|
PL_stack_sp = sp; |
37
|
|
|
|
|
|
#ifndef STRESS_REALLOC |
38
|
50474
|
|
|
|
|
av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128); |
39
|
|
|
|
|
|
#else |
40
|
|
|
|
|
|
av_extend(PL_curstack, (p - PL_stack_base) + (n) + 1); |
41
|
|
|
|
|
|
#endif |
42
|
50474
|
|
|
|
|
return PL_stack_sp; |
43
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
45
|
|
|
|
|
|
#ifndef STRESS_REALLOC |
46
|
|
|
|
|
|
#define GROW(old) ((old) * 3 / 2) |
47
|
|
|
|
|
|
#else |
48
|
|
|
|
|
|
#define GROW(old) ((old) + 1) |
49
|
|
|
|
|
|
#endif |
50
|
|
|
|
|
|
|
51
|
|
|
|
|
|
PERL_SI * |
52
|
42230
|
|
|
|
|
Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems) |
53
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
dVAR; |
55
|
|
|
|
|
|
PERL_SI *si; |
56
|
42230
|
|
|
|
|
Newx(si, 1, PERL_SI); |
57
|
42230
|
|
|
|
|
si->si_stack = newAV(); |
58
|
42230
|
|
|
|
|
AvREAL_off(si->si_stack); |
59
|
42230
|
50
|
|
|
|
av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0); |
60
|
42230
|
|
|
|
|
AvALLOC(si->si_stack)[0] = &PL_sv_undef; |
61
|
42230
|
|
|
|
|
AvFILLp(si->si_stack) = 0; |
62
|
42230
|
|
|
|
|
si->si_prev = 0; |
63
|
42230
|
|
|
|
|
si->si_next = 0; |
64
|
42230
|
|
|
|
|
si->si_cxmax = cxitems - 1; |
65
|
42230
|
|
|
|
|
si->si_cxix = -1; |
66
|
42230
|
|
|
|
|
si->si_type = PERLSI_UNDEF; |
67
|
42230
|
50
|
|
|
|
Newx(si->si_cxstack, cxitems, PERL_CONTEXT); |
68
|
|
|
|
|
|
/* Without any kind of initialising PUSHSUBST() |
69
|
|
|
|
|
|
* in pp_subst() will read uninitialised heap. */ |
70
|
42230
|
50
|
|
|
|
PoisonNew(si->si_cxstack, cxitems, PERL_CONTEXT); |
71
|
42230
|
|
|
|
|
return si; |
72
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
74
|
|
|
|
|
|
I32 |
75
|
5784
|
|
|
|
|
Perl_cxinc(pTHX) |
76
|
|
|
|
|
|
{ |
77
|
|
|
|
|
|
dVAR; |
78
|
5784
|
|
|
|
|
const IV old_max = cxstack_max; |
79
|
5784
|
|
|
|
|
cxstack_max = GROW(cxstack_max); |
80
|
5784
|
50
|
|
|
|
Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); |
81
|
|
|
|
|
|
/* Without any kind of initialising deep enough recursion |
82
|
|
|
|
|
|
* will end up reading uninitialised PERL_CONTEXTs. */ |
83
|
5784
|
50
|
|
|
|
PoisonNew(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT); |
84
|
5784
|
|
|
|
|
return cxstack_ix + 1; |
85
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
87
|
|
|
|
|
|
void |
88
|
1809329637
|
|
|
|
|
Perl_push_scope(pTHX) |
89
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
dVAR; |
91
|
1809329637
|
100
|
|
|
|
if (PL_scopestack_ix == PL_scopestack_max) { |
92
|
32216
|
|
|
|
|
PL_scopestack_max = GROW(PL_scopestack_max); |
93
|
32216
|
50
|
|
|
|
Renew(PL_scopestack, PL_scopestack_max, I32); |
94
|
|
|
|
|
|
#ifdef DEBUGGING |
95
|
|
|
|
|
|
Renew(PL_scopestack_name, PL_scopestack_max, const char*); |
96
|
|
|
|
|
|
#endif |
97
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
#ifdef DEBUGGING |
99
|
|
|
|
|
|
PL_scopestack_name[PL_scopestack_ix] = "unknown"; |
100
|
|
|
|
|
|
#endif |
101
|
1809329637
|
|
|
|
|
PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix; |
102
|
|
|
|
|
|
|
103
|
1809329637
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
105
|
|
|
|
|
|
void |
106
|
1770757444
|
|
|
|
|
Perl_pop_scope(pTHX) |
107
|
|
|
|
|
|
{ |
108
|
|
|
|
|
|
dVAR; |
109
|
1770757444
|
|
|
|
|
const I32 oldsave = PL_scopestack[--PL_scopestack_ix]; |
110
|
1770757444
|
100
|
|
|
|
LEAVE_SCOPE(oldsave); |
111
|
1770757442
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
113
|
|
|
|
|
|
void |
114
|
1266
|
|
|
|
|
Perl_markstack_grow(pTHX) |
115
|
|
|
|
|
|
{ |
116
|
|
|
|
|
|
dVAR; |
117
|
1266
|
|
|
|
|
const I32 oldmax = PL_markstack_max - PL_markstack; |
118
|
1266
|
|
|
|
|
const I32 newmax = GROW(oldmax); |
119
|
|
|
|
|
|
|
120
|
1266
|
50
|
|
|
|
Renew(PL_markstack, newmax, I32); |
121
|
1266
|
|
|
|
|
PL_markstack_ptr = PL_markstack + oldmax; |
122
|
1266
|
|
|
|
|
PL_markstack_max = PL_markstack + newmax; |
123
|
1266
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
125
|
|
|
|
|
|
void |
126
|
89742
|
|
|
|
|
Perl_savestack_grow(pTHX) |
127
|
|
|
|
|
|
{ |
128
|
|
|
|
|
|
dVAR; |
129
|
89742
|
|
|
|
|
PL_savestack_max = GROW(PL_savestack_max) + 4; |
130
|
89742
|
50
|
|
|
|
Renew(PL_savestack, PL_savestack_max, ANY); |
131
|
89742
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
133
|
|
|
|
|
|
void |
134
|
1041376
|
|
|
|
|
Perl_savestack_grow_cnt(pTHX_ I32 need) |
135
|
|
|
|
|
|
{ |
136
|
|
|
|
|
|
dVAR; |
137
|
1041376
|
|
|
|
|
PL_savestack_max = PL_savestack_ix + need; |
138
|
1041376
|
50
|
|
|
|
Renew(PL_savestack, PL_savestack_max, ANY); |
139
|
1041376
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
141
|
|
|
|
|
|
#undef GROW |
142
|
|
|
|
|
|
|
143
|
|
|
|
|
|
void |
144
|
56242
|
|
|
|
|
Perl_tmps_grow(pTHX_ SSize_t n) |
145
|
|
|
|
|
|
{ |
146
|
|
|
|
|
|
dVAR; |
147
|
|
|
|
|
|
#ifndef STRESS_REALLOC |
148
|
56242
|
100
|
|
|
|
if (n < 128) |
149
|
50532
|
100
|
|
|
|
n = (PL_tmps_max < 512) ? 128 : 512; |
150
|
|
|
|
|
|
#endif |
151
|
56242
|
|
|
|
|
PL_tmps_max = PL_tmps_ix + n + 1; |
152
|
56242
|
50
|
|
|
|
Renew(PL_tmps_stack, PL_tmps_max, SV*); |
153
|
56242
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
156
|
|
|
|
|
|
void |
157
|
635561357
|
|
|
|
|
Perl_free_tmps(pTHX) |
158
|
|
|
|
|
|
{ |
159
|
|
|
|
|
|
dVAR; |
160
|
|
|
|
|
|
/* XXX should tmps_floor live in cxstack? */ |
161
|
635561357
|
|
|
|
|
const SSize_t myfloor = PL_tmps_floor; |
162
|
2528552403
|
100
|
|
|
|
while (PL_tmps_ix > myfloor) { /* clean up after last statement */ |
163
|
1575605568
|
|
|
|
|
SV* const sv = PL_tmps_stack[PL_tmps_ix--]; |
164
|
|
|
|
|
|
#ifdef PERL_POISON |
165
|
|
|
|
|
|
PoisonWith(PL_tmps_stack + PL_tmps_ix + 1, 1, SV *, 0xAB); |
166
|
|
|
|
|
|
#endif |
167
|
1575605568
|
50
|
|
|
|
if (sv && sv != &PL_sv_undef) { |
|
|
50
|
|
|
|
|
168
|
1575605568
|
|
|
|
|
SvTEMP_off(sv); |
169
|
1575605568
|
|
|
|
|
SvREFCNT_dec_NN(sv); /* note, can modify tmps_ix!!! */ |
170
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
} |
172
|
635561357
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
174
|
|
|
|
|
|
STATIC SV * |
175
|
53373200
|
|
|
|
|
S_save_scalar_at(pTHX_ SV **sptr, const U32 flags) |
176
|
|
|
|
|
|
{ |
177
|
|
|
|
|
|
dVAR; |
178
|
|
|
|
|
|
SV * osv; |
179
|
|
|
|
|
|
SV *sv; |
180
|
|
|
|
|
|
|
181
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SCALAR_AT; |
182
|
|
|
|
|
|
|
183
|
53373200
|
|
|
|
|
osv = *sptr; |
184
|
53373200
|
100
|
|
|
|
sv = (flags & SAVEf_KEEPOLDELEM) ? osv : (*sptr = newSV(0)); |
185
|
|
|
|
|
|
|
186
|
53373200
|
100
|
|
|
|
if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv)) { |
|
|
100
|
|
|
|
|
187
|
13025860
|
100
|
|
|
|
if (SvGMAGICAL(osv)) { |
188
|
19471386
|
|
|
|
|
SvFLAGS(osv) |= (SvFLAGS(osv) & |
189
|
12980924
|
|
|
|
|
(SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT; |
190
|
|
|
|
|
|
} |
191
|
13025860
|
100
|
|
|
|
if (!(flags & SAVEf_KEEPOLDELEM)) |
192
|
13025848
|
|
|
|
|
mg_localize(osv, sv, cBOOL(flags & SAVEf_SETMAGIC)); |
193
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
195
|
53373200
|
|
|
|
|
return sv; |
196
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
198
|
|
|
|
|
|
void |
199
|
662522657
|
|
|
|
|
Perl_save_pushptrptr(pTHX_ void *const ptr1, void *const ptr2, const int type) |
200
|
|
|
|
|
|
{ |
201
|
|
|
|
|
|
dVAR; |
202
|
662522657
|
|
|
|
|
dSS_ADD; |
203
|
662522657
|
|
|
|
|
SS_ADD_PTR(ptr1); |
204
|
662522657
|
|
|
|
|
SS_ADD_PTR(ptr2); |
205
|
662522657
|
|
|
|
|
SS_ADD_UV(type); |
206
|
662522657
|
100
|
|
|
|
SS_ADD_END(3); |
207
|
662522657
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
209
|
|
|
|
|
|
SV * |
210
|
51057696
|
|
|
|
|
Perl_save_scalar(pTHX_ GV *gv) |
211
|
|
|
|
|
|
{ |
212
|
|
|
|
|
|
dVAR; |
213
|
51057696
|
100
|
|
|
|
SV ** const sptr = &GvSVn(gv); |
214
|
|
|
|
|
|
|
215
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SCALAR; |
216
|
|
|
|
|
|
|
217
|
51057696
|
100
|
|
|
|
if (SvGMAGICAL(*sptr)) { |
218
|
12921442
|
|
|
|
|
PL_localizing = 1; |
219
|
12921442
|
|
|
|
|
(void)mg_get(*sptr); |
220
|
12921442
|
|
|
|
|
PL_localizing = 0; |
221
|
|
|
|
|
|
} |
222
|
76586364
|
|
|
|
|
save_pushptrptr(SvREFCNT_inc_simple(gv), SvREFCNT_inc(*sptr), SAVEt_SV); |
223
|
51057696
|
|
|
|
|
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */ |
224
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
226
|
|
|
|
|
|
/* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to |
227
|
|
|
|
|
|
* restore a global SV to its prior contents, freeing new value. */ |
228
|
|
|
|
|
|
void |
229
|
29779521
|
|
|
|
|
Perl_save_generic_svref(pTHX_ SV **sptr) |
230
|
|
|
|
|
|
{ |
231
|
|
|
|
|
|
dVAR; |
232
|
|
|
|
|
|
|
233
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_GENERIC_SVREF; |
234
|
|
|
|
|
|
|
235
|
44585865
|
|
|
|
|
save_pushptrptr(sptr, SvREFCNT_inc(*sptr), SAVEt_GENERIC_SVREF); |
236
|
29779521
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
238
|
|
|
|
|
|
/* Like save_pptr(), but also Safefree()s the new value if it is different |
239
|
|
|
|
|
|
* from the old one. Can be used to restore a global char* to its prior |
240
|
|
|
|
|
|
* contents, freeing new value. */ |
241
|
|
|
|
|
|
void |
242
|
45590355
|
|
|
|
|
Perl_save_generic_pvref(pTHX_ char **str) |
243
|
|
|
|
|
|
{ |
244
|
|
|
|
|
|
dVAR; |
245
|
|
|
|
|
|
|
246
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_GENERIC_PVREF; |
247
|
|
|
|
|
|
|
248
|
45590355
|
|
|
|
|
save_pushptrptr(*str, str, SAVEt_GENERIC_PVREF); |
249
|
45590355
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
251
|
|
|
|
|
|
/* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree(). |
252
|
|
|
|
|
|
* Can be used to restore a shared global char* to its prior |
253
|
|
|
|
|
|
* contents, freeing new value. */ |
254
|
|
|
|
|
|
void |
255
|
0
|
|
|
|
|
Perl_save_shared_pvref(pTHX_ char **str) |
256
|
|
|
|
|
|
{ |
257
|
|
|
|
|
|
dVAR; |
258
|
|
|
|
|
|
|
259
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SHARED_PVREF; |
260
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
save_pushptrptr(str, *str, SAVEt_SHARED_PVREF); |
262
|
0
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
264
|
|
|
|
|
|
/* set the SvFLAGS specified by mask to the values in val */ |
265
|
|
|
|
|
|
|
266
|
|
|
|
|
|
void |
267
|
12887603
|
|
|
|
|
Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val) |
268
|
|
|
|
|
|
{ |
269
|
|
|
|
|
|
dVAR; |
270
|
12887603
|
|
|
|
|
dSS_ADD; |
271
|
|
|
|
|
|
|
272
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SET_SVFLAGS; |
273
|
|
|
|
|
|
|
274
|
12887603
|
|
|
|
|
SS_ADD_PTR(sv); |
275
|
12887603
|
|
|
|
|
SS_ADD_INT(mask); |
276
|
12887603
|
|
|
|
|
SS_ADD_INT(val); |
277
|
12887603
|
|
|
|
|
SS_ADD_UV(SAVEt_SET_SVFLAGS); |
278
|
12887603
|
100
|
|
|
|
SS_ADD_END(4); |
279
|
12887603
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
281
|
|
|
|
|
|
void |
282
|
19287624
|
|
|
|
|
Perl_save_gp(pTHX_ GV *gv, I32 empty) |
283
|
|
|
|
|
|
{ |
284
|
|
|
|
|
|
dVAR; |
285
|
|
|
|
|
|
|
286
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_GP; |
287
|
|
|
|
|
|
|
288
|
28925411
|
|
|
|
|
save_pushptrptr(SvREFCNT_inc(gv), GvGP(gv), SAVEt_GP); |
289
|
|
|
|
|
|
|
290
|
19287624
|
100
|
|
|
|
if (empty) { |
291
|
2372008
|
|
|
|
|
GP *gp = Perl_newGP(aTHX_ gv); |
292
|
2372008
|
|
|
|
|
HV * const stash = GvSTASH(gv); |
293
|
|
|
|
|
|
bool isa_changed = 0; |
294
|
|
|
|
|
|
|
295
|
2372008
|
50
|
|
|
|
if (stash && HvENAME(stash)) { |
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
296
|
2372006
|
100
|
|
|
|
if (GvNAMELEN(gv) == 3 && strnEQ(GvNAME(gv), "ISA", 3)) |
|
|
100
|
|
|
|
|
297
|
|
|
|
|
|
isa_changed = TRUE; |
298
|
2372004
|
100
|
|
|
|
else if (GvCVu(gv)) |
|
|
100
|
|
|
|
|
299
|
|
|
|
|
|
/* taking a method out of circulation ("local")*/ |
300
|
8
|
|
|
|
|
mro_method_changed_in(stash); |
301
|
|
|
|
|
|
} |
302
|
2372008
|
100
|
|
|
|
if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) { |
|
|
100
|
|
|
|
|
303
|
8
|
|
|
|
|
gp->gp_io = newIO(); |
304
|
8
|
|
|
|
|
IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START; |
305
|
|
|
|
|
|
} |
306
|
2372008
|
|
|
|
|
GvGP_set(gv,gp); |
307
|
2372008
|
100
|
|
|
|
if (isa_changed) mro_isa_changed_in(stash); |
308
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
else { |
310
|
16915616
|
|
|
|
|
gp_ref(GvGP(gv)); |
311
|
16915616
|
|
|
|
|
GvINTRO_on(gv); |
312
|
|
|
|
|
|
} |
313
|
19287624
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
315
|
|
|
|
|
|
AV * |
316
|
84762
|
|
|
|
|
Perl_save_ary(pTHX_ GV *gv) |
317
|
|
|
|
|
|
{ |
318
|
|
|
|
|
|
dVAR; |
319
|
84762
|
50
|
|
|
|
AV * const oav = GvAVn(gv); |
320
|
|
|
|
|
|
AV *av; |
321
|
|
|
|
|
|
|
322
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_ARY; |
323
|
|
|
|
|
|
|
324
|
84762
|
100
|
|
|
|
if (!AvREAL(oav) && AvREIFY(oav)) |
|
|
50
|
|
|
|
|
325
|
6
|
|
|
|
|
av_reify(oav); |
326
|
84762
|
|
|
|
|
save_pushptrptr(SvREFCNT_inc_simple_NN(gv), oav, SAVEt_AV); |
327
|
|
|
|
|
|
|
328
|
84762
|
|
|
|
|
GvAV(gv) = NULL; |
329
|
84762
|
50
|
|
|
|
av = GvAVn(gv); |
330
|
84762
|
100
|
|
|
|
if (SvMAGIC(oav)) |
331
|
4918
|
|
|
|
|
mg_localize(MUTABLE_SV(oav), MUTABLE_SV(av), TRUE); |
332
|
84762
|
|
|
|
|
return av; |
333
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
335
|
|
|
|
|
|
HV * |
336
|
40150
|
|
|
|
|
Perl_save_hash(pTHX_ GV *gv) |
337
|
|
|
|
|
|
{ |
338
|
|
|
|
|
|
dVAR; |
339
|
|
|
|
|
|
HV *ohv, *hv; |
340
|
|
|
|
|
|
|
341
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_HASH; |
342
|
|
|
|
|
|
|
343
|
40150
|
50
|
|
|
|
save_pushptrptr( |
344
|
|
|
|
|
|
SvREFCNT_inc_simple_NN(gv), (ohv = GvHVn(gv)), SAVEt_HV |
345
|
|
|
|
|
|
); |
346
|
|
|
|
|
|
|
347
|
40150
|
|
|
|
|
GvHV(gv) = NULL; |
348
|
40150
|
50
|
|
|
|
hv = GvHVn(gv); |
349
|
40150
|
100
|
|
|
|
if (SvMAGIC(ohv)) |
350
|
5082
|
|
|
|
|
mg_localize(MUTABLE_SV(ohv), MUTABLE_SV(hv), TRUE); |
351
|
40150
|
|
|
|
|
return hv; |
352
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
354
|
|
|
|
|
|
void |
355
|
15204556
|
|
|
|
|
Perl_save_item(pTHX_ SV *item) |
356
|
|
|
|
|
|
{ |
357
|
|
|
|
|
|
dVAR; |
358
|
15204556
|
|
|
|
|
SV * const sv = newSVsv(item); |
359
|
|
|
|
|
|
|
360
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_ITEM; |
361
|
|
|
|
|
|
|
362
|
15204556
|
|
|
|
|
save_pushptrptr(item, /* remember the pointer */ |
363
|
|
|
|
|
|
sv, /* remember the value */ |
364
|
|
|
|
|
|
SAVEt_ITEM); |
365
|
15204556
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
367
|
|
|
|
|
|
void |
368
|
63220749
|
|
|
|
|
Perl_save_bool(pTHX_ bool *boolp) |
369
|
|
|
|
|
|
{ |
370
|
|
|
|
|
|
dVAR; |
371
|
63220749
|
|
|
|
|
dSS_ADD; |
372
|
|
|
|
|
|
|
373
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_BOOL; |
374
|
|
|
|
|
|
|
375
|
63220749
|
|
|
|
|
SS_ADD_PTR(boolp); |
376
|
63220749
|
|
|
|
|
SS_ADD_UV(SAVEt_BOOL | (*boolp << 8)); |
377
|
63220749
|
100
|
|
|
|
SS_ADD_END(2); |
378
|
63220749
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
380
|
|
|
|
|
|
void |
381
|
51490689
|
|
|
|
|
Perl_save_pushi32ptr(pTHX_ const I32 i, void *const ptr, const int type) |
382
|
|
|
|
|
|
{ |
383
|
|
|
|
|
|
dVAR; |
384
|
51490689
|
|
|
|
|
dSS_ADD; |
385
|
|
|
|
|
|
|
386
|
51490689
|
|
|
|
|
SS_ADD_INT(i); |
387
|
51490689
|
|
|
|
|
SS_ADD_PTR(ptr); |
388
|
51490689
|
|
|
|
|
SS_ADD_UV(type); |
389
|
51490689
|
100
|
|
|
|
SS_ADD_END(3); |
390
|
51490689
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
392
|
|
|
|
|
|
void |
393
|
17504018
|
|
|
|
|
Perl_save_int(pTHX_ int *intp) |
394
|
|
|
|
|
|
{ |
395
|
|
|
|
|
|
dVAR; |
396
|
17504018
|
|
|
|
|
const int i = *intp; |
397
|
17504018
|
|
|
|
|
UV type = ((UV)((UV)i << SAVE_TIGHT_SHIFT) | SAVEt_INT_SMALL); |
398
|
|
|
|
|
|
int size = 2; |
399
|
17504018
|
|
|
|
|
dSS_ADD; |
400
|
|
|
|
|
|
|
401
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_INT; |
402
|
|
|
|
|
|
|
403
|
17504018
|
50
|
|
|
|
if ((int)(type >> SAVE_TIGHT_SHIFT) != i) { |
404
|
0
|
|
|
|
|
SS_ADD_INT(i); |
405
|
|
|
|
|
|
type = SAVEt_INT; |
406
|
|
|
|
|
|
size++; |
407
|
|
|
|
|
|
} |
408
|
17504018
|
|
|
|
|
SS_ADD_PTR(intp); |
409
|
17504018
|
|
|
|
|
SS_ADD_UV(type); |
410
|
17504018
|
100
|
|
|
|
SS_ADD_END(size); |
411
|
17504018
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
413
|
|
|
|
|
|
void |
414
|
30394400
|
|
|
|
|
Perl_save_I8(pTHX_ I8 *bytep) |
415
|
|
|
|
|
|
{ |
416
|
|
|
|
|
|
dVAR; |
417
|
30394400
|
|
|
|
|
dSS_ADD; |
418
|
|
|
|
|
|
|
419
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_I8; |
420
|
|
|
|
|
|
|
421
|
30394400
|
|
|
|
|
SS_ADD_PTR(bytep); |
422
|
30394400
|
|
|
|
|
SS_ADD_UV(SAVEt_I8 | ((UV)*bytep << 8)); |
423
|
30394400
|
100
|
|
|
|
SS_ADD_END(2); |
424
|
30394400
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
426
|
|
|
|
|
|
void |
427
|
15196785
|
|
|
|
|
Perl_save_I16(pTHX_ I16 *intp) |
428
|
|
|
|
|
|
{ |
429
|
|
|
|
|
|
dVAR; |
430
|
15196785
|
|
|
|
|
dSS_ADD; |
431
|
|
|
|
|
|
|
432
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_I16; |
433
|
|
|
|
|
|
|
434
|
15196785
|
|
|
|
|
SS_ADD_PTR(intp); |
435
|
15196785
|
|
|
|
|
SS_ADD_UV(SAVEt_I16 | ((UV)*intp << 8)); |
436
|
15196785
|
100
|
|
|
|
SS_ADD_END(2); |
437
|
15196785
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
439
|
|
|
|
|
|
void |
440
|
407237372
|
|
|
|
|
Perl_save_I32(pTHX_ I32 *intp) |
441
|
|
|
|
|
|
{ |
442
|
|
|
|
|
|
dVAR; |
443
|
407237372
|
|
|
|
|
const I32 i = *intp; |
444
|
407237372
|
|
|
|
|
UV type = ((I32)((U32)i << SAVE_TIGHT_SHIFT) | SAVEt_I32_SMALL); |
445
|
|
|
|
|
|
int size = 2; |
446
|
407237372
|
|
|
|
|
dSS_ADD; |
447
|
|
|
|
|
|
|
448
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_I32; |
449
|
|
|
|
|
|
|
450
|
407237372
|
100
|
|
|
|
if ((I32)(type >> SAVE_TIGHT_SHIFT) != i) { |
451
|
42
|
|
|
|
|
SS_ADD_INT(i); |
452
|
|
|
|
|
|
type = SAVEt_I32; |
453
|
|
|
|
|
|
size++; |
454
|
|
|
|
|
|
} |
455
|
407237372
|
|
|
|
|
SS_ADD_PTR(intp); |
456
|
407237372
|
|
|
|
|
SS_ADD_UV(type); |
457
|
407237372
|
100
|
|
|
|
SS_ADD_END(size); |
458
|
407237372
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
460
|
|
|
|
|
|
void |
461
|
1289617336
|
|
|
|
|
Perl_save_strlen(pTHX_ STRLEN *ptr) |
462
|
|
|
|
|
|
{ |
463
|
|
|
|
|
|
dVAR; |
464
|
1289617336
|
|
|
|
|
dSS_ADD; |
465
|
|
|
|
|
|
|
466
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_STRLEN; |
467
|
|
|
|
|
|
|
468
|
1289617336
|
|
|
|
|
SS_ADD_IV(*ptr); |
469
|
1289617336
|
|
|
|
|
SS_ADD_PTR(ptr); |
470
|
1289617336
|
|
|
|
|
SS_ADD_UV(SAVEt_STRLEN); |
471
|
1289617336
|
100
|
|
|
|
SS_ADD_END(3); |
472
|
1289617336
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
474
|
|
|
|
|
|
/* Cannot use save_sptr() to store a char* since the SV** cast will |
475
|
|
|
|
|
|
* force word-alignment and we'll miss the pointer. |
476
|
|
|
|
|
|
*/ |
477
|
|
|
|
|
|
void |
478
|
110753244
|
|
|
|
|
Perl_save_pptr(pTHX_ char **pptr) |
479
|
|
|
|
|
|
{ |
480
|
|
|
|
|
|
dVAR; |
481
|
|
|
|
|
|
|
482
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_PPTR; |
483
|
|
|
|
|
|
|
484
|
110753244
|
|
|
|
|
save_pushptrptr(*pptr, pptr, SAVEt_PPTR); |
485
|
110753244
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
487
|
|
|
|
|
|
void |
488
|
284949255
|
|
|
|
|
Perl_save_vptr(pTHX_ void *ptr) |
489
|
|
|
|
|
|
{ |
490
|
|
|
|
|
|
dVAR; |
491
|
|
|
|
|
|
|
492
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_VPTR; |
493
|
|
|
|
|
|
|
494
|
284949255
|
|
|
|
|
save_pushptrptr(*(char**)ptr, ptr, SAVEt_VPTR); |
495
|
284949255
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
497
|
|
|
|
|
|
void |
498
|
88697766
|
|
|
|
|
Perl_save_sptr(pTHX_ SV **sptr) |
499
|
|
|
|
|
|
{ |
500
|
|
|
|
|
|
dVAR; |
501
|
|
|
|
|
|
|
502
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SPTR; |
503
|
|
|
|
|
|
|
504
|
88697766
|
|
|
|
|
save_pushptrptr(*sptr, sptr, SAVEt_SPTR); |
505
|
88697766
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
507
|
|
|
|
|
|
void |
508
|
13745192
|
|
|
|
|
Perl_save_padsv_and_mortalize(pTHX_ PADOFFSET off) |
509
|
|
|
|
|
|
{ |
510
|
|
|
|
|
|
dVAR; |
511
|
13745192
|
|
|
|
|
dSS_ADD; |
512
|
|
|
|
|
|
|
513
|
|
|
|
|
|
ASSERT_CURPAD_ACTIVE("save_padsv"); |
514
|
13745192
|
|
|
|
|
SS_ADD_PTR(SvREFCNT_inc_simple_NN(PL_curpad[off])); |
515
|
13745192
|
|
|
|
|
SS_ADD_PTR(PL_comppad); |
516
|
13745192
|
|
|
|
|
SS_ADD_UV((UV)off); |
517
|
13745192
|
|
|
|
|
SS_ADD_UV(SAVEt_PADSV_AND_MORTALIZE); |
518
|
13745192
|
50
|
|
|
|
SS_ADD_END(4); |
519
|
13745192
|
|
|
|
|
} |
520
|
|
|
|
|
|
|
521
|
|
|
|
|
|
void |
522
|
110
|
|
|
|
|
Perl_save_hptr(pTHX_ HV **hptr) |
523
|
|
|
|
|
|
{ |
524
|
|
|
|
|
|
dVAR; |
525
|
|
|
|
|
|
|
526
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_HPTR; |
527
|
|
|
|
|
|
|
528
|
110
|
|
|
|
|
save_pushptrptr(*hptr, hptr, SAVEt_HPTR); |
529
|
110
|
|
|
|
|
} |
530
|
|
|
|
|
|
|
531
|
|
|
|
|
|
void |
532
|
110
|
|
|
|
|
Perl_save_aptr(pTHX_ AV **aptr) |
533
|
|
|
|
|
|
{ |
534
|
|
|
|
|
|
dVAR; |
535
|
|
|
|
|
|
|
536
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_APTR; |
537
|
|
|
|
|
|
|
538
|
110
|
|
|
|
|
save_pushptrptr(*aptr, aptr, SAVEt_APTR); |
539
|
110
|
|
|
|
|
} |
540
|
|
|
|
|
|
|
541
|
|
|
|
|
|
void |
542
|
1128708461
|
|
|
|
|
Perl_save_pushptr(pTHX_ void *const ptr, const int type) |
543
|
|
|
|
|
|
{ |
544
|
|
|
|
|
|
dVAR; |
545
|
1128708461
|
|
|
|
|
dSS_ADD; |
546
|
1128708461
|
|
|
|
|
SS_ADD_PTR(ptr); |
547
|
1128708461
|
|
|
|
|
SS_ADD_UV(type); |
548
|
1128708461
|
100
|
|
|
|
SS_ADD_END(2); |
549
|
1128708461
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
551
|
|
|
|
|
|
void |
552
|
657510028
|
|
|
|
|
Perl_save_clearsv(pTHX_ SV **svp) |
553
|
|
|
|
|
|
{ |
554
|
|
|
|
|
|
dVAR; |
555
|
657510028
|
|
|
|
|
const UV offset = svp - PL_curpad; |
556
|
657510028
|
|
|
|
|
const UV offset_shifted = offset << SAVE_TIGHT_SHIFT; |
557
|
|
|
|
|
|
|
558
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_CLEARSV; |
559
|
|
|
|
|
|
|
560
|
|
|
|
|
|
ASSERT_CURPAD_ACTIVE("save_clearsv"); |
561
|
657510028
|
|
|
|
|
SvPADSTALE_off(*svp); /* mark lexical as active */ |
562
|
657510028
|
50
|
|
|
|
if ((offset_shifted >> SAVE_TIGHT_SHIFT) != offset) { |
563
|
0
|
|
|
|
|
Perl_croak(aTHX_ "panic: pad offset %"UVuf" out of range (%p-%p)", |
564
|
|
|
|
|
|
offset, svp, PL_curpad); |
565
|
|
|
|
|
|
} |
566
|
|
|
|
|
|
|
567
|
|
|
|
|
|
{ |
568
|
657510028
|
|
|
|
|
dSS_ADD; |
569
|
657510028
|
|
|
|
|
SS_ADD_UV(offset_shifted | SAVEt_CLEARSV); |
570
|
657510028
|
100
|
|
|
|
SS_ADD_END(1); |
571
|
|
|
|
|
|
} |
572
|
657510028
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
574
|
|
|
|
|
|
void |
575
|
3759188
|
|
|
|
|
Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen) |
576
|
|
|
|
|
|
{ |
577
|
|
|
|
|
|
dVAR; |
578
|
|
|
|
|
|
|
579
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_DELETE; |
580
|
|
|
|
|
|
|
581
|
3759188
|
|
|
|
|
save_pushptri32ptr(key, klen, SvREFCNT_inc_simple(hv), SAVEt_DELETE); |
582
|
3759188
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
584
|
|
|
|
|
|
void |
585
|
3119334
|
|
|
|
|
Perl_save_hdelete(pTHX_ HV *hv, SV *keysv) |
586
|
|
|
|
|
|
{ |
587
|
|
|
|
|
|
STRLEN len; |
588
|
|
|
|
|
|
I32 klen; |
589
|
|
|
|
|
|
const char *key; |
590
|
|
|
|
|
|
|
591
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_HDELETE; |
592
|
|
|
|
|
|
|
593
|
3119334
|
100
|
|
|
|
key = SvPV_const(keysv, len); |
594
|
3119334
|
100
|
|
|
|
klen = SvUTF8(keysv) ? -(I32)len : (I32)len; |
595
|
3119334
|
|
|
|
|
SvREFCNT_inc_simple_void_NN(hv); |
596
|
3119334
|
|
|
|
|
save_pushptri32ptr(savepvn(key, len), klen, hv, SAVEt_DELETE); |
597
|
3119334
|
|
|
|
|
} |
598
|
|
|
|
|
|
|
599
|
|
|
|
|
|
void |
600
|
66
|
|
|
|
|
Perl_save_adelete(pTHX_ AV *av, SSize_t key) |
601
|
|
|
|
|
|
{ |
602
|
|
|
|
|
|
dVAR; |
603
|
66
|
|
|
|
|
dSS_ADD; |
604
|
|
|
|
|
|
|
605
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_ADELETE; |
606
|
|
|
|
|
|
|
607
|
|
|
|
|
|
SvREFCNT_inc_void(av); |
608
|
66
|
|
|
|
|
SS_ADD_UV(key); |
609
|
66
|
|
|
|
|
SS_ADD_PTR(av); |
610
|
66
|
|
|
|
|
SS_ADD_IV(SAVEt_ADELETE); |
611
|
66
|
50
|
|
|
|
SS_ADD_END(3); |
612
|
66
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
614
|
|
|
|
|
|
void |
615
|
0
|
|
|
|
|
Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p) |
616
|
|
|
|
|
|
{ |
617
|
|
|
|
|
|
dVAR; |
618
|
0
|
|
|
|
|
dSS_ADD; |
619
|
|
|
|
|
|
|
620
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_DESTRUCTOR; |
621
|
|
|
|
|
|
|
622
|
0
|
|
|
|
|
SS_ADD_DPTR(f); |
623
|
0
|
|
|
|
|
SS_ADD_PTR(p); |
624
|
0
|
|
|
|
|
SS_ADD_UV(SAVEt_DESTRUCTOR); |
625
|
0
|
0
|
|
|
|
SS_ADD_END(3); |
626
|
0
|
|
|
|
|
} |
627
|
|
|
|
|
|
|
628
|
|
|
|
|
|
void |
629
|
269493951
|
|
|
|
|
Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p) |
630
|
|
|
|
|
|
{ |
631
|
|
|
|
|
|
dVAR; |
632
|
269493951
|
|
|
|
|
dSS_ADD; |
633
|
|
|
|
|
|
|
634
|
269493951
|
|
|
|
|
SS_ADD_DXPTR(f); |
635
|
269493951
|
|
|
|
|
SS_ADD_PTR(p); |
636
|
269493951
|
|
|
|
|
SS_ADD_UV(SAVEt_DESTRUCTOR_X); |
637
|
269493951
|
100
|
|
|
|
SS_ADD_END(3); |
638
|
269493951
|
|
|
|
|
} |
639
|
|
|
|
|
|
|
640
|
|
|
|
|
|
void |
641
|
52269669
|
|
|
|
|
Perl_save_hints(pTHX) |
642
|
|
|
|
|
|
{ |
643
|
|
|
|
|
|
dVAR; |
644
|
52269669
|
|
|
|
|
COPHH *save_cophh = cophh_copy(CopHINTHASH_get(&PL_compiling)); |
645
|
52269669
|
100
|
|
|
|
if (PL_hints & HINT_LOCALIZE_HH) { |
646
|
778980
|
|
|
|
|
HV *oldhh = GvHV(PL_hintgv); |
647
|
778980
|
|
|
|
|
save_pushptri32ptr(oldhh, PL_hints, save_cophh, SAVEt_HINTS); |
648
|
778980
|
|
|
|
|
GvHV(PL_hintgv) = NULL; /* in case copying dies */ |
649
|
778980
|
|
|
|
|
GvHV(PL_hintgv) = hv_copy_hints_hv(oldhh); |
650
|
|
|
|
|
|
} else { |
651
|
51490689
|
|
|
|
|
save_pushi32ptr(PL_hints, save_cophh, SAVEt_HINTS); |
652
|
|
|
|
|
|
} |
653
|
52269663
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
655
|
|
|
|
|
|
static void |
656
|
7657502
|
|
|
|
|
S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2, |
657
|
|
|
|
|
|
const int type) |
658
|
|
|
|
|
|
{ |
659
|
7657502
|
|
|
|
|
dSS_ADD; |
660
|
7657502
|
|
|
|
|
SS_ADD_PTR(ptr1); |
661
|
7657502
|
|
|
|
|
SS_ADD_INT(i); |
662
|
7657502
|
|
|
|
|
SS_ADD_PTR(ptr2); |
663
|
7657502
|
|
|
|
|
SS_ADD_UV(type); |
664
|
7657502
|
50
|
|
|
|
SS_ADD_END(4); |
665
|
7657502
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
667
|
|
|
|
|
|
void |
668
|
324
|
|
|
|
|
Perl_save_aelem_flags(pTHX_ AV *av, SSize_t idx, SV **sptr, |
669
|
|
|
|
|
|
const U32 flags) |
670
|
324
|
100
|
|
|
|
{ |
671
|
324
|
|
|
|
|
dVAR; dSS_ADD; |
672
|
|
|
|
|
|
SV *sv; |
673
|
|
|
|
|
|
|
674
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS; |
675
|
|
|
|
|
|
|
676
|
188
|
|
|
|
|
SvGETMAGIC(*sptr); |
677
|
324
|
|
|
|
|
SS_ADD_PTR(SvREFCNT_inc_simple(av)); |
678
|
324
|
|
|
|
|
SS_ADD_IV(idx); |
679
|
648
|
|
|
|
|
SS_ADD_PTR(SvREFCNT_inc(*sptr)); |
680
|
324
|
|
|
|
|
SS_ADD_UV(SAVEt_AELEM); |
681
|
324
|
50
|
|
|
|
SS_ADD_END(4); |
682
|
|
|
|
|
|
/* The array needs to hold a reference count on its new element, so it |
683
|
|
|
|
|
|
must be AvREAL. */ |
684
|
324
|
100
|
|
|
|
if (!AvREAL(av) && AvREIFY(av)) |
|
|
50
|
|
|
|
|
685
|
18
|
|
|
|
|
av_reify(av); |
686
|
324
|
|
|
|
|
save_scalar_at(sptr, flags); /* XXX - FIXME - see #60360 */ |
687
|
324
|
100
|
|
|
|
if (flags & SAVEf_KEEPOLDELEM) |
688
|
324
|
|
|
|
|
return; |
689
|
312
|
|
|
|
|
sv = *sptr; |
690
|
|
|
|
|
|
/* If we're localizing a tied array element, this new sv |
691
|
|
|
|
|
|
* won't actually be stored in the array - so it won't get |
692
|
|
|
|
|
|
* reaped when the localize ends. Ensure it gets reaped by |
693
|
|
|
|
|
|
* mortifying it instead. DAPM */ |
694
|
312
|
100
|
|
|
|
if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied)) |
|
|
100
|
|
|
|
|
695
|
16
|
|
|
|
|
sv_2mortal(sv); |
696
|
|
|
|
|
|
} |
697
|
|
|
|
|
|
|
698
|
|
|
|
|
|
void |
699
|
2315180
|
|
|
|
|
Perl_save_helem_flags(pTHX_ HV *hv, SV *key, SV **sptr, const U32 flags) |
700
|
2315180
|
100
|
|
|
|
{ |
701
|
|
|
|
|
|
dVAR; |
702
|
|
|
|
|
|
SV *sv; |
703
|
|
|
|
|
|
|
704
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_HELEM_FLAGS; |
705
|
|
|
|
|
|
|
706
|
1217084
|
|
|
|
|
SvGETMAGIC(*sptr); |
707
|
|
|
|
|
|
{ |
708
|
2315180
|
|
|
|
|
dSS_ADD; |
709
|
2315180
|
|
|
|
|
SS_ADD_PTR(SvREFCNT_inc_simple(hv)); |
710
|
2315180
|
|
|
|
|
SS_ADD_PTR(newSVsv(key)); |
711
|
4630360
|
|
|
|
|
SS_ADD_PTR(SvREFCNT_inc(*sptr)); |
712
|
2315180
|
|
|
|
|
SS_ADD_UV(SAVEt_HELEM); |
713
|
2315180
|
50
|
|
|
|
SS_ADD_END(4); |
714
|
|
|
|
|
|
} |
715
|
2315180
|
|
|
|
|
save_scalar_at(sptr, flags); |
716
|
2315180
|
100
|
|
|
|
if (flags & SAVEf_KEEPOLDELEM) |
717
|
2315180
|
|
|
|
|
return; |
718
|
2315164
|
|
|
|
|
sv = *sptr; |
719
|
|
|
|
|
|
/* If we're localizing a tied hash element, this new sv |
720
|
|
|
|
|
|
* won't actually be stored in the hash - so it won't get |
721
|
|
|
|
|
|
* reaped when the localize ends. Ensure it gets reaped by |
722
|
|
|
|
|
|
* mortifying it instead. DAPM */ |
723
|
2315164
|
100
|
|
|
|
if (SvTIED_mg((const SV *)hv, PERL_MAGIC_tied)) |
|
|
100
|
|
|
|
|
724
|
6
|
|
|
|
|
sv_2mortal(sv); |
725
|
|
|
|
|
|
} |
726
|
|
|
|
|
|
|
727
|
|
|
|
|
|
SV* |
728
|
0
|
|
|
|
|
Perl_save_svref(pTHX_ SV **sptr) |
729
|
0
|
0
|
|
|
|
{ |
730
|
|
|
|
|
|
dVAR; |
731
|
|
|
|
|
|
|
732
|
|
|
|
|
|
PERL_ARGS_ASSERT_SAVE_SVREF; |
733
|
|
|
|
|
|
|
734
|
0
|
|
|
|
|
SvGETMAGIC(*sptr); |
735
|
0
|
|
|
|
|
save_pushptrptr(sptr, SvREFCNT_inc(*sptr), SAVEt_SVREF); |
736
|
0
|
|
|
|
|
return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */ |
737
|
|
|
|
|
|
} |
738
|
|
|
|
|
|
|
739
|
|
|
|
|
|
I32 |
740
|
115018133
|
|
|
|
|
Perl_save_alloc(pTHX_ I32 size, I32 pad) |
741
|
|
|
|
|
|
{ |
742
|
|
|
|
|
|
dVAR; |
743
|
115018133
|
|
|
|
|
const I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix] |
744
|
|
|
|
|
|
- (char*)PL_savestack); |
745
|
115018133
|
|
|
|
|
const UV elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack)); |
746
|
115018133
|
|
|
|
|
const UV elems_shifted = elems << SAVE_TIGHT_SHIFT; |
747
|
|
|
|
|
|
|
748
|
115018133
|
50
|
|
|
|
if ((elems_shifted >> SAVE_TIGHT_SHIFT) != elems) |
749
|
0
|
|
|
|
|
Perl_croak(aTHX_ |
750
|
|
|
|
|
|
"panic: save_alloc elems %"UVuf" out of range (%"IVdf"-%"IVdf")", |
751
|
|
|
|
|
|
elems, (IV)size, (IV)pad); |
752
|
|
|
|
|
|
|
753
|
115018133
|
100
|
|
|
|
SSGROW(elems + 1); |
754
|
|
|
|
|
|
|
755
|
115018133
|
|
|
|
|
PL_savestack_ix += elems; |
756
|
115018133
|
|
|
|
|
SSPUSHUV(SAVEt_ALLOC | elems_shifted); |
757
|
115018133
|
|
|
|
|
return start; |
758
|
|
|
|
|
|
} |
759
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
762
|
|
|
|
|
|
#define ARG0_SV MUTABLE_SV(arg0.any_ptr) |
763
|
|
|
|
|
|
#define ARG0_AV MUTABLE_AV(arg0.any_ptr) |
764
|
|
|
|
|
|
#define ARG0_HV MUTABLE_HV(arg0.any_ptr) |
765
|
|
|
|
|
|
#define ARG0_PTR arg0.any_ptr |
766
|
|
|
|
|
|
#define ARG0_PV (char*)(arg0.any_ptr) |
767
|
|
|
|
|
|
#define ARG0_PVP (char**)(arg0.any_ptr) |
768
|
|
|
|
|
|
#define ARG0_I32 (arg0.any_i32) |
769
|
|
|
|
|
|
|
770
|
|
|
|
|
|
#define ARG1_SV MUTABLE_SV(arg1.any_ptr) |
771
|
|
|
|
|
|
#define ARG1_AV MUTABLE_AV(arg1.any_ptr) |
772
|
|
|
|
|
|
#define ARG1_GV MUTABLE_GV(arg1.any_ptr) |
773
|
|
|
|
|
|
#define ARG1_SVP (SV**)(arg1.any_ptr) |
774
|
|
|
|
|
|
#define ARG1_PVP (char**)(arg1.any_ptr) |
775
|
|
|
|
|
|
#define ARG1_PTR arg1.any_ptr |
776
|
|
|
|
|
|
#define ARG1_PV (char*)(arg1.any_ptr) |
777
|
|
|
|
|
|
#define ARG1_I32 (arg1.any_i32) |
778
|
|
|
|
|
|
|
779
|
|
|
|
|
|
#define ARG2_SV MUTABLE_SV(arg2.any_ptr) |
780
|
|
|
|
|
|
#define ARG2_AV MUTABLE_AV(arg2.any_ptr) |
781
|
|
|
|
|
|
#define ARG2_HV MUTABLE_HV(arg2.any_ptr) |
782
|
|
|
|
|
|
#define ARG2_GV MUTABLE_GV(arg2.any_ptr) |
783
|
|
|
|
|
|
#define ARG2_PV (char*)(arg2.any_ptr) |
784
|
|
|
|
|
|
|
785
|
|
|
|
|
|
void |
786
|
1976616674
|
|
|
|
|
Perl_leave_scope(pTHX_ I32 base) |
787
|
|
|
|
|
|
{ |
788
|
|
|
|
|
|
dVAR; |
789
|
|
|
|
|
|
|
790
|
|
|
|
|
|
/* Localise the effects of the TAINT_NOT inside the loop. */ |
791
|
1976616674
|
|
|
|
|
bool was = TAINT_get; |
792
|
|
|
|
|
|
|
793
|
|
|
|
|
|
ANY arg0, arg1, arg2; |
794
|
|
|
|
|
|
|
795
|
|
|
|
|
|
/* these initialisations are logically unnecessary, but they shut up |
796
|
|
|
|
|
|
* spurious 'may be used uninitialized' compiler warnings */ |
797
|
1976616674
|
|
|
|
|
arg0.any_ptr = NULL; |
798
|
1976616674
|
|
|
|
|
arg1.any_ptr = NULL; |
799
|
1976616674
|
|
|
|
|
arg2.any_ptr = NULL; |
800
|
|
|
|
|
|
|
801
|
1976616674
|
50
|
|
|
|
if (base < -1) |
802
|
0
|
|
|
|
|
Perl_croak(aTHX_ "panic: corrupt saved stack index %ld", (long) base); |
803
|
|
|
|
|
|
DEBUG_l(Perl_deb(aTHX_ "savestack: releasing items %ld -> %ld\n", |
804
|
|
|
|
|
|
(long)PL_savestack_ix, (long)base)); |
805
|
6687089499
|
100
|
|
|
|
while (PL_savestack_ix > base) { |
806
|
|
|
|
|
|
UV uv; |
807
|
|
|
|
|
|
U8 type; |
808
|
|
|
|
|
|
|
809
|
|
|
|
|
|
SV *refsv; |
810
|
|
|
|
|
|
SV **svp; |
811
|
|
|
|
|
|
|
812
|
4710472827
|
|
|
|
|
TAINT_NOT; |
813
|
|
|
|
|
|
|
814
|
|
|
|
|
|
{ |
815
|
4710472827
|
|
|
|
|
I32 ix = PL_savestack_ix - 1; |
816
|
4710472827
|
|
|
|
|
ANY *p = &PL_savestack[ix]; |
817
|
4710472827
|
|
|
|
|
uv = p->any_uv; |
818
|
4710472827
|
|
|
|
|
type = (U8)uv & SAVE_MASK; |
819
|
4710472827
|
100
|
|
|
|
if (type > SAVEt_ARG0_MAX) { |
820
|
|
|
|
|
|
ANY *p0 = p; |
821
|
3854910063
|
|
|
|
|
arg0 = *--p; |
822
|
3854910063
|
100
|
|
|
|
if (type > SAVEt_ARG1_MAX) { |
823
|
2196935511
|
|
|
|
|
arg1 = *--p; |
824
|
2196935511
|
100
|
|
|
|
if (type > SAVEt_ARG2_MAX) { |
825
|
36124419
|
|
|
|
|
arg2 = *--p; |
826
|
|
|
|
|
|
} |
827
|
|
|
|
|
|
} |
828
|
3854910063
|
|
|
|
|
ix -= (p0 - p); |
829
|
|
|
|
|
|
} |
830
|
4710472827
|
|
|
|
|
PL_savestack_ix = ix; |
831
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
833
|
4710472827
|
|
|
|
|
switch (type) { |
834
|
|
|
|
|
|
case SAVEt_ITEM: /* normal string */ |
835
|
15204556
|
|
|
|
|
sv_replace(ARG1_SV, ARG0_SV); |
836
|
15204556
|
50
|
|
|
|
if (SvSMAGICAL(ARG1_SV)) { |
837
|
0
|
|
|
|
|
PL_localizing = 2; |
838
|
0
|
|
|
|
|
mg_set(ARG1_SV); |
839
|
0
|
|
|
|
|
PL_localizing = 0; |
840
|
|
|
|
|
|
} |
841
|
|
|
|
|
|
break; |
842
|
|
|
|
|
|
|
843
|
|
|
|
|
|
/* This would be a mathom, but Perl_save_svref() calls a static |
844
|
|
|
|
|
|
function, S_save_scalar_at(), so has to stay in this file. */ |
845
|
|
|
|
|
|
case SAVEt_SVREF: /* scalar reference */ |
846
|
0
|
|
|
|
|
svp = ARG1_SVP; |
847
|
|
|
|
|
|
refsv = NULL; /* what to refcnt_dec */ |
848
|
0
|
|
|
|
|
goto restore_sv; |
849
|
|
|
|
|
|
|
850
|
|
|
|
|
|
case SAVEt_SV: /* scalar reference */ |
851
|
51057696
|
|
|
|
|
svp = &GvSV(ARG1_GV); |
852
|
51057696
|
|
|
|
|
refsv = ARG1_SV; /* what to refcnt_dec */ |
853
|
|
|
|
|
|
restore_sv: |
854
|
|
|
|
|
|
{ |
855
|
53373200
|
|
|
|
|
SV * const sv = *svp; |
856
|
53373200
|
|
|
|
|
*svp = ARG0_SV; |
857
|
53373200
|
|
|
|
|
SvREFCNT_dec(sv); |
858
|
53373200
|
100
|
|
|
|
if (SvSMAGICAL(ARG0_SV)) { |
859
|
13025860
|
|
|
|
|
PL_localizing = 2; |
860
|
13025860
|
|
|
|
|
mg_set(ARG0_SV); |
861
|
13025860
|
|
|
|
|
PL_localizing = 0; |
862
|
|
|
|
|
|
} |
863
|
53373200
|
|
|
|
|
SvREFCNT_dec_NN(ARG0_SV); |
864
|
53373200
|
|
|
|
|
SvREFCNT_dec(refsv); |
865
|
2402528266
|
|
|
|
|
break; |
866
|
|
|
|
|
|
} |
867
|
|
|
|
|
|
case SAVEt_GENERIC_PVREF: /* generic pv */ |
868
|
45590355
|
50
|
|
|
|
if (*ARG0_PVP != ARG1_PV) { |
869
|
45590355
|
|
|
|
|
Safefree(*ARG0_PVP); |
870
|
45590355
|
|
|
|
|
*ARG0_PVP = ARG1_PV; |
871
|
|
|
|
|
|
} |
872
|
|
|
|
|
|
break; |
873
|
|
|
|
|
|
case SAVEt_SHARED_PVREF: /* shared pv */ |
874
|
0
|
0
|
|
|
|
if (*ARG1_PVP != ARG0_PV) { |
875
|
|
|
|
|
|
#ifdef NETWARE |
876
|
|
|
|
|
|
PerlMem_free(*ARG1_PVP); |
877
|
|
|
|
|
|
#else |
878
|
0
|
|
|
|
|
PerlMemShared_free(*ARG1_PVP); |
879
|
|
|
|
|
|
#endif |
880
|
0
|
|
|
|
|
*ARG1_PVP = ARG0_PV; |
881
|
|
|
|
|
|
} |
882
|
|
|
|
|
|
break; |
883
|
|
|
|
|
|
case SAVEt_GVSV: /* scalar slot in GV */ |
884
|
17076938
|
|
|
|
|
svp = &GvSV(ARG1_GV); |
885
|
17076938
|
|
|
|
|
goto restore_svp; |
886
|
|
|
|
|
|
case SAVEt_GENERIC_SVREF: /* generic sv */ |
887
|
29779521
|
|
|
|
|
svp = ARG1_SVP; |
888
|
|
|
|
|
|
restore_svp: |
889
|
|
|
|
|
|
{ |
890
|
47154057
|
|
|
|
|
SV * const sv = *svp; |
891
|
47154057
|
|
|
|
|
*svp = ARG0_SV; |
892
|
47154057
|
|
|
|
|
SvREFCNT_dec(sv); |
893
|
47154057
|
|
|
|
|
SvREFCNT_dec(ARG0_SV); |
894
|
47154057
|
|
|
|
|
break; |
895
|
|
|
|
|
|
} |
896
|
|
|
|
|
|
case SAVEt_GVSLOT: /* any slot in GV */ |
897
|
|
|
|
|
|
{ |
898
|
297598
|
|
|
|
|
HV *const hv = GvSTASH(ARG2_GV); |
899
|
297598
|
|
|
|
|
svp = ARG1_SVP; |
900
|
446397
|
50
|
|
|
|
if (hv && HvENAME(hv) && ( |
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
901
|
439499
|
50
|
|
|
|
(ARG0_SV && SvTYPE(ARG0_SV) == SVt_PVCV) |
902
|
6898
|
50
|
|
|
|
|| (*svp && SvTYPE(*svp) == SVt_PVCV) |
|
|
50
|
|
|
|
|
903
|
|
|
|
|
|
)) |
904
|
|
|
|
|
|
{ |
905
|
297598
|
50
|
|
|
|
if ((char *)svp < (char *)GvGP(ARG2_GV) |
906
|
297598
|
50
|
|
|
|
|| (char *)svp > (char *)GvGP(ARG2_GV) + sizeof(struct gp) |
907
|
297598
|
50
|
|
|
|
|| GvREFCNT(ARG2_GV) > 1) |
908
|
297598
|
|
|
|
|
PL_sub_generation++; |
909
|
0
|
|
|
|
|
else mro_method_changed_in(hv); |
910
|
|
|
|
|
|
} |
911
|
|
|
|
|
|
goto restore_svp; |
912
|
|
|
|
|
|
} |
913
|
|
|
|
|
|
case SAVEt_AV: /* array reference */ |
914
|
84762
|
|
|
|
|
SvREFCNT_dec(GvAV(ARG1_GV)); |
915
|
84762
|
|
|
|
|
GvAV(ARG1_GV) = ARG0_AV; |
916
|
84762
|
100
|
|
|
|
if (SvSMAGICAL(ARG0_SV)) { |
917
|
4908
|
|
|
|
|
PL_localizing = 2; |
918
|
4908
|
|
|
|
|
mg_set(ARG0_SV); |
919
|
4908
|
|
|
|
|
PL_localizing = 0; |
920
|
|
|
|
|
|
} |
921
|
84762
|
|
|
|
|
SvREFCNT_dec_NN(ARG1_GV); |
922
|
84762
|
|
|
|
|
break; |
923
|
|
|
|
|
|
case SAVEt_HV: /* hash reference */ |
924
|
40150
|
|
|
|
|
SvREFCNT_dec(GvHV(ARG1_GV)); |
925
|
40150
|
|
|
|
|
GvHV(ARG1_GV) = ARG0_HV; |
926
|
40150
|
100
|
|
|
|
if (SvSMAGICAL(ARG0_SV)) { |
927
|
5076
|
|
|
|
|
PL_localizing = 2; |
928
|
5076
|
|
|
|
|
mg_set(ARG0_SV); |
929
|
5076
|
|
|
|
|
PL_localizing = 0; |
930
|
|
|
|
|
|
} |
931
|
40150
|
|
|
|
|
SvREFCNT_dec_NN(ARG1_GV); |
932
|
40150
|
|
|
|
|
break; |
933
|
|
|
|
|
|
case SAVEt_INT_SMALL: |
934
|
17504018
|
|
|
|
|
*(int*)ARG0_PTR = (int)(uv >> SAVE_TIGHT_SHIFT); |
935
|
17504018
|
|
|
|
|
break; |
936
|
|
|
|
|
|
case SAVEt_INT: /* int reference */ |
937
|
0
|
|
|
|
|
*(int*)ARG0_PTR = (int)ARG1_I32; |
938
|
0
|
|
|
|
|
break; |
939
|
|
|
|
|
|
case SAVEt_STRLEN: /* STRLEN/size_t ref */ |
940
|
1289617336
|
|
|
|
|
*(STRLEN*)ARG0_PTR = (STRLEN)arg1.any_iv; |
941
|
1289617336
|
|
|
|
|
break; |
942
|
|
|
|
|
|
case SAVEt_BOOL: /* bool reference */ |
943
|
63220749
|
|
|
|
|
*(bool*)ARG0_PTR = cBOOL(uv >> 8); |
944
|
|
|
|
|
|
#ifdef NO_TAINT_SUPPORT |
945
|
|
|
|
|
|
PERL_UNUSED_VAR(was); |
946
|
|
|
|
|
|
#else |
947
|
63220749
|
100
|
|
|
|
if (ARG0_PTR == &(TAINT_get)) { |
948
|
|
|
|
|
|
/* If we don't update , to reflect what was saved on the |
949
|
|
|
|
|
|
* stack for PL_tainted, then we will overwrite this attempt to |
950
|
|
|
|
|
|
* restore it when we exit this routine. Note that this won't |
951
|
|
|
|
|
|
* work if this value was saved in a wider-than necessary type, |
952
|
|
|
|
|
|
* such as I32 */ |
953
|
1104
|
|
|
|
|
was = *(bool*)ARG0_PTR; |
954
|
|
|
|
|
|
} |
955
|
|
|
|
|
|
#endif |
956
|
|
|
|
|
|
break; |
957
|
|
|
|
|
|
case SAVEt_I32_SMALL: |
958
|
407237330
|
|
|
|
|
*(I32*)ARG0_PTR = (I32)(uv >> SAVE_TIGHT_SHIFT); |
959
|
407237330
|
|
|
|
|
break; |
960
|
|
|
|
|
|
case SAVEt_I32: /* I32 reference */ |
961
|
|
|
|
|
|
#ifdef PERL_DEBUG_READONLY_OPS |
962
|
|
|
|
|
|
if (*(I32*)ARG0_PTR != ARG1_I32) |
963
|
|
|
|
|
|
#endif |
964
|
42
|
|
|
|
|
*(I32*)ARG0_PTR = ARG1_I32; |
965
|
42
|
|
|
|
|
break; |
966
|
|
|
|
|
|
case SAVEt_SPTR: /* SV* reference */ |
967
|
88697766
|
|
|
|
|
*(SV**)(ARG0_PTR)= ARG1_SV; |
968
|
88697766
|
|
|
|
|
break; |
969
|
|
|
|
|
|
case SAVEt_VPTR: /* random* reference */ |
970
|
|
|
|
|
|
case SAVEt_PPTR: /* char* reference */ |
971
|
395702499
|
|
|
|
|
*ARG0_PVP = ARG1_PV; |
972
|
395702499
|
|
|
|
|
break; |
973
|
|
|
|
|
|
case SAVEt_HPTR: /* HV* reference */ |
974
|
110
|
|
|
|
|
*(HV**)ARG0_PTR = MUTABLE_HV(ARG1_PTR); |
975
|
110
|
|
|
|
|
break; |
976
|
|
|
|
|
|
case SAVEt_APTR: /* AV* reference */ |
977
|
110
|
|
|
|
|
*(AV**)ARG0_PTR = ARG1_AV; |
978
|
110
|
|
|
|
|
break; |
979
|
|
|
|
|
|
case SAVEt_GP: /* scalar reference */ |
980
|
|
|
|
|
|
{ |
981
|
|
|
|
|
|
HV *hv; |
982
|
|
|
|
|
|
/* possibly taking a method out of circulation */ |
983
|
19287624
|
50
|
|
|
|
const bool had_method = !!GvCVu(ARG1_GV); |
|
|
100
|
|
|
|
|
984
|
19287624
|
|
|
|
|
gp_free(ARG1_GV); |
985
|
19287624
|
|
|
|
|
GvGP_set(ARG1_GV, (GP*)ARG0_PTR); |
986
|
19287624
|
50
|
|
|
|
if ((hv=GvSTASH(ARG1_GV)) && HvENAME_get(hv)) { |
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
50
|
|
|
|
|
987
|
19287622
|
100
|
|
|
|
if ( GvNAMELEN(ARG1_GV) == 3 |
988
|
9804
|
100
|
|
|
|
&& strnEQ(GvNAME(ARG1_GV), "ISA", 3) |
989
|
|
|
|
|
|
) |
990
|
6
|
|
|
|
|
mro_isa_changed_in(hv); |
991
|
19287616
|
100
|
|
|
|
else if (had_method || GvCVu(ARG1_GV)) |
|
|
50
|
|
|
|
|
|
|
100
|
|
|
|
|
992
|
|
|
|
|
|
/* putting a method back into circulation ("local")*/ |
993
|
307740
|
100
|
|
|
|
gv_method_changed(ARG1_GV); |
994
|
|
|
|
|
|
} |
995
|
19287624
|
|
|
|
|
SvREFCNT_dec_NN(ARG1_GV); |
996
|
19287624
|
|
|
|
|
break; |
997
|
|
|
|
|
|
} |
998
|
|
|
|
|
|
case SAVEt_FREESV: |
999
|
554169008
|
|
|
|
|
SvREFCNT_dec(ARG0_SV); |
1000
|
554169008
|
|
|
|
|
break; |
1001
|
|
|
|
|
|
case SAVEt_FREECOPHH: |
1002
|
2
|
|
|
|
|
cophh_free((COPHH *)ARG0_PTR); |
1003
|
2
|
|
|
|
|
break; |
1004
|
|
|
|
|
|
case SAVEt_MORTALIZESV: |
1005
|
4350983
|
|
|
|
|
sv_2mortal(ARG0_SV); |
1006
|
4350983
|
|
|
|
|
break; |
1007
|
|
|
|
|
|
case SAVEt_FREEOP: |
1008
|
|
|
|
|
|
ASSERT_CURPAD_LEGAL("SAVEt_FREEOP"); |
1009
|
18415015
|
|
|
|
|
op_free((OP*)ARG0_PTR); |
1010
|
18415015
|
|
|
|
|
break; |
1011
|
|
|
|
|
|
case SAVEt_FREEPV: |
1012
|
23772088
|
|
|
|
|
Safefree(ARG0_PTR); |
1013
|
23772088
|
|
|
|
|
break; |
1014
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
{ |
1016
|
|
|
|
|
|
SV **svp; |
1017
|
|
|
|
|
|
I32 i; |
1018
|
|
|
|
|
|
SV *sv; |
1019
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
case SAVEt_CLEARPADRANGE: |
1021
|
186319484
|
|
|
|
|
i = (I32)((uv >> SAVE_TIGHT_SHIFT) & OPpPADRANGE_COUNTMASK); |
1022
|
372638968
|
|
|
|
|
svp = &PL_curpad[uv >> |
1023
|
372638968
|
|
|
|
|
(OPpPADRANGE_COUNTSHIFT + SAVE_TIGHT_SHIFT)] + i - 1; |
1024
|
515736271
|
|
|
|
|
goto clearsv; |
1025
|
|
|
|
|
|
case SAVEt_CLEARSV: |
1026
|
657510028
|
|
|
|
|
svp = &PL_curpad[uv >> SAVE_TIGHT_SHIFT]; |
1027
|
|
|
|
|
|
i = 1; |
1028
|
|
|
|
|
|
clearsv: |
1029
|
1430263693
|
100
|
|
|
|
for (; i; i--, svp--) { |
1030
|
1007609128
|
|
|
|
|
sv = *svp; |
1031
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
DEBUG_Xv(PerlIO_printf(Perl_debug_log, |
1033
|
|
|
|
|
|
"Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n", |
1034
|
|
|
|
|
|
PTR2UV(PL_comppad), PTR2UV(PL_curpad), |
1035
|
|
|
|
|
|
(long)(svp-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv), |
1036
|
|
|
|
|
|
(SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon" |
1037
|
|
|
|
|
|
)); |
1038
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
/* Can clear pad variable in place? */ |
1040
|
1007609128
|
100
|
|
|
|
if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) { |
|
|
100
|
|
|
|
|
1041
|
|
|
|
|
|
/* |
1042
|
|
|
|
|
|
* if a my variable that was made readonly is going out of |
1043
|
|
|
|
|
|
* scope, we want to remove the readonlyness so that it can |
1044
|
|
|
|
|
|
* go out of scope quietly |
1045
|
|
|
|
|
|
*/ |
1046
|
1002144975
|
100
|
|
|
|
if (SvPADMY(sv) && !SvFAKE(sv)) |
1047
|
1000576291
|
|
|
|
|
SvREADONLY_off(sv); |
1048
|
|
|
|
|
|
|
1049
|
1002144975
|
100
|
|
|
|
if (SvTHINKFIRST(sv)) |
1050
|
661155727
|
|
|
|
|
sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF |
1051
|
|
|
|
|
|
|SV_COW_DROP_PV); |
1052
|
1002144973
|
100
|
|
|
|
if (SvTYPE(sv) == SVt_PVHV) |
1053
|
5307581
|
|
|
|
|
Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); |
1054
|
1002144973
|
100
|
|
|
|
if (SvMAGICAL(sv)) |
1055
|
|
|
|
|
|
{ |
1056
|
1991497
|
|
|
|
|
sv_unmagic(sv, PERL_MAGIC_backref); |
1057
|
1991497
|
50
|
|
|
|
if (SvTYPE(sv) != SVt_PVCV) |
1058
|
1991497
|
|
|
|
|
mg_free(sv); |
1059
|
|
|
|
|
|
} |
1060
|
|
|
|
|
|
|
1061
|
1002144973
|
|
|
|
|
switch (SvTYPE(sv)) { |
1062
|
|
|
|
|
|
case SVt_NULL: |
1063
|
|
|
|
|
|
break; |
1064
|
|
|
|
|
|
case SVt_PVAV: |
1065
|
28274722
|
|
|
|
|
av_clear(MUTABLE_AV(sv)); |
1066
|
28274722
|
|
|
|
|
break; |
1067
|
|
|
|
|
|
case SVt_PVHV: |
1068
|
5307581
|
|
|
|
|
hv_clear(MUTABLE_HV(sv)); |
1069
|
5307581
|
|
|
|
|
break; |
1070
|
|
|
|
|
|
case SVt_PVCV: |
1071
|
|
|
|
|
|
{ |
1072
|
|
|
|
|
|
HEK * const hek = CvNAME_HEK((CV *)sv); |
1073
|
|
|
|
|
|
assert(hek); |
1074
|
54
|
|
|
|
|
share_hek_hek(hek); |
1075
|
54
|
|
|
|
|
cv_undef((CV *)sv); |
1076
|
54
|
50
|
|
|
|
CvNAME_HEK_set(sv, hek); |
1077
|
54
|
|
|
|
|
break; |
1078
|
|
|
|
|
|
} |
1079
|
|
|
|
|
|
default: |
1080
|
946328165
|
100
|
|
|
|
SvOK_off(sv); |
1081
|
|
|
|
|
|
break; |
1082
|
|
|
|
|
|
} |
1083
|
|
|
|
|
|
SvPADSTALE_on(sv); /* mark as no longer live */ |
1084
|
|
|
|
|
|
} |
1085
|
|
|
|
|
|
else { /* Someone has a claim on this, so abandon it. */ |
1086
|
|
|
|
|
|
assert( SvFLAGS(sv) & SVs_PADMY); |
1087
|
|
|
|
|
|
assert(!(SvFLAGS(sv) & SVs_PADTMP)); |
1088
|
5464153
|
|
|
|
|
switch (SvTYPE(sv)) { /* Console ourselves with a new value */ |
1089
|
1356564
|
|
|
|
|
case SVt_PVAV: *svp = MUTABLE_SV(newAV()); break; |
1090
|
644648
|
|
|
|
|
case SVt_PVHV: *svp = MUTABLE_SV(newHV()); break; |
1091
|
|
|
|
|
|
case SVt_PVCV: |
1092
|
|
|
|
|
|
{ |
1093
|
|
|
|
|
|
/* Create a stub */ |
1094
|
52
|
|
|
|
|
*svp = newSV_type(SVt_PVCV); |
1095
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
/* Share name */ |
1097
|
|
|
|
|
|
assert(CvNAMED(sv)); |
1098
|
130
|
50
|
|
|
|
CvNAME_HEK_set(*svp, |
1099
|
|
|
|
|
|
share_hek_hek(CvNAME_HEK((CV *)sv))); |
1100
|
52
|
|
|
|
|
break; |
1101
|
|
|
|
|
|
} |
1102
|
3462889
|
|
|
|
|
default: *svp = newSV(0); break; |
1103
|
|
|
|
|
|
} |
1104
|
5464153
|
|
|
|
|
SvREFCNT_dec_NN(sv); /* Cast current value to the winds. */ |
1105
|
|
|
|
|
|
/* preserve pad nature, but also mark as not live |
1106
|
|
|
|
|
|
* for any closure capturing */ |
1107
|
5464153
|
|
|
|
|
SvFLAGS(*svp) |= (SVs_PADMY|SVs_PADSTALE); |
1108
|
|
|
|
|
|
} |
1109
|
|
|
|
|
|
} |
1110
|
|
|
|
|
|
break; |
1111
|
|
|
|
|
|
} |
1112
|
|
|
|
|
|
case SAVEt_DELETE: |
1113
|
6878522
|
|
|
|
|
(void)hv_delete(ARG0_HV, ARG2_PV, ARG1_I32, G_DISCARD); |
1114
|
6878522
|
|
|
|
|
SvREFCNT_dec(ARG0_HV); |
1115
|
6878522
|
|
|
|
|
Safefree(arg2.any_ptr); |
1116
|
6878522
|
|
|
|
|
break; |
1117
|
|
|
|
|
|
case SAVEt_ADELETE: |
1118
|
66
|
|
|
|
|
(void)av_delete(ARG0_AV, arg1.any_iv, G_DISCARD); |
1119
|
66
|
|
|
|
|
SvREFCNT_dec(ARG0_AV); |
1120
|
66
|
|
|
|
|
break; |
1121
|
|
|
|
|
|
case SAVEt_DESTRUCTOR_X: |
1122
|
156401322
|
|
|
|
|
(*arg1.any_dxptr)(aTHX_ ARG0_PTR); |
1123
|
156401322
|
|
|
|
|
break; |
1124
|
|
|
|
|
|
case SAVEt_REGCONTEXT: |
1125
|
|
|
|
|
|
/* regexp must have croaked */ |
1126
|
|
|
|
|
|
case SAVEt_ALLOC: |
1127
|
11733252
|
|
|
|
|
PL_savestack_ix -= uv >> SAVE_TIGHT_SHIFT; |
1128
|
11733252
|
|
|
|
|
break; |
1129
|
|
|
|
|
|
case SAVEt_STACK_POS: /* Position on Perl stack */ |
1130
|
1738
|
|
|
|
|
PL_stack_sp = PL_stack_base + arg0.any_i32; |
1131
|
1738
|
|
|
|
|
break; |
1132
|
|
|
|
|
|
case SAVEt_AELEM: /* array element */ |
1133
|
324
|
|
|
|
|
svp = av_fetch(ARG2_AV, arg1.any_iv, 1); |
1134
|
324
|
50
|
|
|
|
if (!AvREAL(ARG2_AV) && AvREIFY(ARG2_AV)) /* undo reify guard */ |
|
|
0
|
|
|
|
|
1135
|
0
|
|
|
|
|
SvREFCNT_dec(ARG0_SV); |
1136
|
324
|
50
|
|
|
|
if (svp) { |
1137
|
324
|
|
|
|
|
SV * const sv = *svp; |
1138
|
324
|
50
|
|
|
|
if (sv && sv != &PL_sv_undef) { |
|
|
50
|
|
|
|
|
1139
|
324
|
100
|
|
|
|
if (SvTIED_mg((const SV *)ARG2_AV, PERL_MAGIC_tied)) |
|
|
100
|
|
|
|
|
1140
|
22
|
|
|
|
|
SvREFCNT_inc_void_NN(sv); |
1141
|
|
|
|
|
|
refsv = ARG2_SV; |
1142
|
|
|
|
|
|
goto restore_sv; |
1143
|
|
|
|
|
|
} |
1144
|
|
|
|
|
|
} |
1145
|
0
|
|
|
|
|
SvREFCNT_dec(ARG2_AV); |
1146
|
0
|
|
|
|
|
SvREFCNT_dec(ARG0_SV); |
1147
|
0
|
|
|
|
|
break; |
1148
|
|
|
|
|
|
case SAVEt_HELEM: /* hash element */ |
1149
|
|
|
|
|
|
{ |
1150
|
2315180
|
|
|
|
|
HE * const he = hv_fetch_ent(ARG2_HV, ARG1_SV, 1, 0); |
1151
|
2315180
|
|
|
|
|
SvREFCNT_dec(ARG1_SV); |
1152
|
2315180
|
50
|
|
|
|
if (he) { |
1153
|
2315180
|
|
|
|
|
const SV * const oval = HeVAL(he); |
1154
|
2315180
|
50
|
|
|
|
if (oval && oval != &PL_sv_undef) { |
|
|
50
|
|
|
|
|
1155
|
2315180
|
|
|
|
|
svp = &HeVAL(he); |
1156
|
2315180
|
100
|
|
|
|
if (SvTIED_mg((const SV *)ARG2_HV, PERL_MAGIC_tied)) |
|
|
100
|
|
|
|
|
1157
|
12
|
|
|
|
|
SvREFCNT_inc_void(*svp); |
1158
|
|
|
|
|
|
refsv = ARG2_SV; /* what to refcnt_dec */ |
1159
|
|
|
|
|
|
goto restore_sv; |
1160
|
|
|
|
|
|
} |
1161
|
|
|
|
|
|
} |
1162
|
0
|
|
|
|
|
SvREFCNT_dec(ARG2_HV); |
1163
|
0
|
|
|
|
|
SvREFCNT_dec(ARG0_SV); |
1164
|
0
|
|
|
|
|
break; |
1165
|
|
|
|
|
|
} |
1166
|
|
|
|
|
|
case SAVEt_OP: |
1167
|
63646000
|
|
|
|
|
PL_op = (OP*)ARG0_PTR; |
1168
|
63646000
|
|
|
|
|
break; |
1169
|
|
|
|
|
|
case SAVEt_HINTS: |
1170
|
52269669
|
100
|
|
|
|
if ((PL_hints & HINT_LOCALIZE_HH)) { |
1171
|
2129960
|
100
|
|
|
|
while (GvHV(PL_hintgv)) { |
1172
|
1064974
|
|
|
|
|
HV *hv = GvHV(PL_hintgv); |
1173
|
1064974
|
|
|
|
|
GvHV(PL_hintgv) = NULL; |
1174
|
1064974
|
|
|
|
|
SvREFCNT_dec(MUTABLE_SV(hv)); |
1175
|
|
|
|
|
|
} |
1176
|
|
|
|
|
|
} |
1177
|
52269669
|
|
|
|
|
cophh_free(CopHINTHASH_get(&PL_compiling)); |
1178
|
52269669
|
|
|
|
|
CopHINTHASH_set(&PL_compiling, (COPHH*)ARG0_PTR); |
1179
|
52269669
|
|
|
|
|
*(I32*)&PL_hints = ARG1_I32; |
1180
|
52269669
|
100
|
|
|
|
if (PL_hints & HINT_LOCALIZE_HH) { |
1181
|
778980
|
|
|
|
|
SvREFCNT_dec(MUTABLE_SV(GvHV(PL_hintgv))); |
1182
|
778980
|
|
|
|
|
GvHV(PL_hintgv) = MUTABLE_HV(SSPOPPTR); |
1183
|
|
|
|
|
|
} |
1184
|
52269669
|
100
|
|
|
|
if (!GvHV(PL_hintgv)) { |
1185
|
|
|
|
|
|
/* Need to add a new one manually, else rv2hv can |
1186
|
|
|
|
|
|
add one via GvHVn and it won't have the magic set. */ |
1187
|
314530
|
|
|
|
|
HV *const hv = newHV(); |
1188
|
314530
|
|
|
|
|
hv_magic(hv, NULL, PERL_MAGIC_hints); |
1189
|
314530
|
|
|
|
|
GvHV(PL_hintgv) = hv; |
1190
|
|
|
|
|
|
} |
1191
|
|
|
|
|
|
assert(GvHV(PL_hintgv)); |
1192
|
|
|
|
|
|
break; |
1193
|
|
|
|
|
|
case SAVEt_COMPPAD: |
1194
|
405267194
|
|
|
|
|
PL_comppad = (PAD*)ARG0_PTR; |
1195
|
405267194
|
100
|
|
|
|
if (PL_comppad) |
1196
|
405266790
|
|
|
|
|
PL_curpad = AvARRAY(PL_comppad); |
1197
|
|
|
|
|
|
else |
1198
|
404
|
|
|
|
|
PL_curpad = NULL; |
1199
|
|
|
|
|
|
break; |
1200
|
|
|
|
|
|
case SAVEt_PADSV_AND_MORTALIZE: |
1201
|
|
|
|
|
|
{ |
1202
|
|
|
|
|
|
SV **svp; |
1203
|
|
|
|
|
|
assert (ARG1_PTR); |
1204
|
13745192
|
|
|
|
|
svp = AvARRAY((PAD*)ARG1_PTR) + (PADOFFSET)arg0.any_uv; |
1205
|
|
|
|
|
|
/* This mortalizing used to be done by POPLOOP() via itersave. |
1206
|
|
|
|
|
|
But as we have all the information here, we can do it here, |
1207
|
|
|
|
|
|
save even having to have itersave in the struct. */ |
1208
|
13745192
|
|
|
|
|
sv_2mortal(*svp); |
1209
|
13745192
|
|
|
|
|
*svp = ARG2_SV; |
1210
|
|
|
|
|
|
} |
1211
|
13745192
|
|
|
|
|
break; |
1212
|
|
|
|
|
|
case SAVEt_SAVESWITCHSTACK: |
1213
|
|
|
|
|
|
{ |
1214
|
570
|
|
|
|
|
dSP; |
1215
|
570
|
|
|
|
|
SWITCHSTACK(ARG0_AV, ARG1_AV); |
1216
|
570
|
|
|
|
|
PL_curstackinfo->si_stack = ARG1_AV; |
1217
|
|
|
|
|
|
} |
1218
|
570
|
|
|
|
|
break; |
1219
|
|
|
|
|
|
case SAVEt_SET_SVFLAGS: |
1220
|
12887603
|
|
|
|
|
SvFLAGS(ARG2_SV) &= ~((U32)ARG1_I32); |
1221
|
12887603
|
|
|
|
|
SvFLAGS(ARG2_SV) |= (U32)ARG0_I32; |
1222
|
12887603
|
|
|
|
|
break; |
1223
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
/* These are only saved in mathoms.c */ |
1225
|
|
|
|
|
|
case SAVEt_NSTAB: |
1226
|
0
|
|
|
|
|
(void)sv_clear(ARG0_SV); |
1227
|
0
|
|
|
|
|
break; |
1228
|
|
|
|
|
|
case SAVEt_LONG: /* long reference */ |
1229
|
0
|
|
|
|
|
*(long*)ARG0_PTR = arg1.any_long; |
1230
|
0
|
|
|
|
|
break; |
1231
|
|
|
|
|
|
case SAVEt_IV: /* IV reference */ |
1232
|
0
|
|
|
|
|
*(IV*)ARG0_PTR = arg1.any_iv; |
1233
|
0
|
|
|
|
|
break; |
1234
|
|
|
|
|
|
|
1235
|
|
|
|
|
|
case SAVEt_I16: /* I16 reference */ |
1236
|
15196785
|
|
|
|
|
*(I16*)ARG0_PTR = (I16)(uv >> 8); |
1237
|
15196785
|
|
|
|
|
break; |
1238
|
|
|
|
|
|
case SAVEt_I8: /* I8 reference */ |
1239
|
30394400
|
|
|
|
|
*(I8*)ARG0_PTR = (I8)(uv >> 8); |
1240
|
30394400
|
|
|
|
|
break; |
1241
|
|
|
|
|
|
case SAVEt_DESTRUCTOR: |
1242
|
0
|
|
|
|
|
(*arg1.any_dptr)(ARG0_PTR); |
1243
|
0
|
|
|
|
|
break; |
1244
|
|
|
|
|
|
case SAVEt_COMPILE_WARNINGS: |
1245
|
50405175
|
100
|
|
|
|
if (!specialWARN(PL_compiling.cop_warnings)) |
|
|
100
|
|
|
|
|
1246
|
4010694
|
|
|
|
|
PerlMemShared_free(PL_compiling.cop_warnings); |
1247
|
|
|
|
|
|
|
1248
|
50405175
|
|
|
|
|
PL_compiling.cop_warnings = (STRLEN*)ARG0_PTR; |
1249
|
50405175
|
|
|
|
|
break; |
1250
|
|
|
|
|
|
case SAVEt_PARSER: |
1251
|
4388977
|
|
|
|
|
parser_free((yy_parser *) ARG0_PTR); |
1252
|
4388977
|
|
|
|
|
break; |
1253
|
|
|
|
|
|
case SAVEt_READONLY_OFF: |
1254
|
5090
|
|
|
|
|
SvREADONLY_off(ARG0_SV); |
1255
|
5090
|
|
|
|
|
break; |
1256
|
|
|
|
|
|
default: |
1257
|
0
|
|
|
|
|
Perl_croak(aTHX_ "panic: leave_scope inconsistency %u", type); |
1258
|
|
|
|
|
|
} |
1259
|
|
|
|
|
|
} |
1260
|
|
|
|
|
|
|
1261
|
1976616672
|
|
|
|
|
TAINT_set(was); |
1262
|
1976616672
|
|
|
|
|
} |
1263
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
void |
1265
|
0
|
|
|
|
|
Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) |
1266
|
|
|
|
|
|
{ |
1267
|
|
|
|
|
|
dVAR; |
1268
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
PERL_ARGS_ASSERT_CX_DUMP; |
1270
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
#ifdef DEBUGGING |
1272
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]); |
1273
|
|
|
|
|
|
if (CxTYPE(cx) != CXt_SUBST) { |
1274
|
|
|
|
|
|
const char *gimme_text; |
1275
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp); |
1276
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n", |
1277
|
|
|
|
|
|
PTR2UV(cx->blk_oldcop)); |
1278
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp); |
1279
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp); |
1280
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n", |
1281
|
|
|
|
|
|
PTR2UV(cx->blk_oldpm)); |
1282
|
|
|
|
|
|
switch (cx->blk_gimme) { |
1283
|
|
|
|
|
|
case G_VOID: |
1284
|
|
|
|
|
|
gimme_text = "VOID"; |
1285
|
|
|
|
|
|
break; |
1286
|
|
|
|
|
|
case G_SCALAR: |
1287
|
|
|
|
|
|
gimme_text = "SCALAR"; |
1288
|
|
|
|
|
|
break; |
1289
|
|
|
|
|
|
case G_ARRAY: |
1290
|
|
|
|
|
|
gimme_text = "LIST"; |
1291
|
|
|
|
|
|
break; |
1292
|
|
|
|
|
|
default: |
1293
|
|
|
|
|
|
gimme_text = "UNKNOWN"; |
1294
|
|
|
|
|
|
break; |
1295
|
|
|
|
|
|
} |
1296
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", gimme_text); |
1297
|
|
|
|
|
|
} |
1298
|
|
|
|
|
|
switch (CxTYPE(cx)) { |
1299
|
|
|
|
|
|
case CXt_NULL: |
1300
|
|
|
|
|
|
case CXt_BLOCK: |
1301
|
|
|
|
|
|
break; |
1302
|
|
|
|
|
|
case CXt_FORMAT: |
1303
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_FORMAT.CV = 0x%"UVxf"\n", |
1304
|
|
|
|
|
|
PTR2UV(cx->blk_format.cv)); |
1305
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_FORMAT.GV = 0x%"UVxf"\n", |
1306
|
|
|
|
|
|
PTR2UV(cx->blk_format.gv)); |
1307
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_FORMAT.DFOUTGV = 0x%"UVxf"\n", |
1308
|
|
|
|
|
|
PTR2UV(cx->blk_format.dfoutgv)); |
1309
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_FORMAT.HASARGS = %d\n", |
1310
|
|
|
|
|
|
(int)CxHASARGS(cx)); |
1311
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_FORMAT.RETOP = 0x%"UVxf"\n", |
1312
|
|
|
|
|
|
PTR2UV(cx->blk_format.retop)); |
1313
|
|
|
|
|
|
break; |
1314
|
|
|
|
|
|
case CXt_SUB: |
1315
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n", |
1316
|
|
|
|
|
|
PTR2UV(cx->blk_sub.cv)); |
1317
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n", |
1318
|
|
|
|
|
|
(long)cx->blk_sub.olddepth); |
1319
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n", |
1320
|
|
|
|
|
|
(int)CxHASARGS(cx)); |
1321
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n", (int)CxLVAL(cx)); |
1322
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n", |
1323
|
|
|
|
|
|
PTR2UV(cx->blk_sub.retop)); |
1324
|
|
|
|
|
|
break; |
1325
|
|
|
|
|
|
case CXt_EVAL: |
1326
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n", |
1327
|
|
|
|
|
|
(long)CxOLD_IN_EVAL(cx)); |
1328
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n", |
1329
|
|
|
|
|
|
PL_op_name[CxOLD_OP_TYPE(cx)], |
1330
|
|
|
|
|
|
PL_op_desc[CxOLD_OP_TYPE(cx)]); |
1331
|
|
|
|
|
|
if (cx->blk_eval.old_namesv) |
1332
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n", |
1333
|
|
|
|
|
|
SvPVX_const(cx->blk_eval.old_namesv)); |
1334
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_EVAL_ROOT = 0x%"UVxf"\n", |
1335
|
|
|
|
|
|
PTR2UV(cx->blk_eval.old_eval_root)); |
1336
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_EVAL.RETOP = 0x%"UVxf"\n", |
1337
|
|
|
|
|
|
PTR2UV(cx->blk_eval.retop)); |
1338
|
|
|
|
|
|
break; |
1339
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
case CXt_LOOP_LAZYIV: |
1341
|
|
|
|
|
|
case CXt_LOOP_LAZYSV: |
1342
|
|
|
|
|
|
case CXt_LOOP_FOR: |
1343
|
|
|
|
|
|
case CXt_LOOP_PLAIN: |
1344
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n", CxLABEL(cx)); |
1345
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n", |
1346
|
|
|
|
|
|
(long)cx->blk_loop.resetsp); |
1347
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.MY_OP = 0x%"UVxf"\n", |
1348
|
|
|
|
|
|
PTR2UV(cx->blk_loop.my_op)); |
1349
|
|
|
|
|
|
/* XXX: not accurate for LAZYSV/IV */ |
1350
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%"UVxf"\n", |
1351
|
|
|
|
|
|
PTR2UV(cx->blk_loop.state_u.ary.ary)); |
1352
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERIX = %ld\n", |
1353
|
|
|
|
|
|
(long)cx->blk_loop.state_u.ary.ix); |
1354
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERVAR = 0x%"UVxf"\n", |
1355
|
|
|
|
|
|
PTR2UV(CxITERVAR(cx))); |
1356
|
|
|
|
|
|
break; |
1357
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
case CXt_SUBST: |
1359
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_ITERS = %ld\n", |
1360
|
|
|
|
|
|
(long)cx->sb_iters); |
1361
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_MAXITERS = %ld\n", |
1362
|
|
|
|
|
|
(long)cx->sb_maxiters); |
1363
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_RFLAGS = %ld\n", |
1364
|
|
|
|
|
|
(long)cx->sb_rflags); |
1365
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_ONCE = %ld\n", |
1366
|
|
|
|
|
|
(long)CxONCE(cx)); |
1367
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_ORIG = %s\n", |
1368
|
|
|
|
|
|
cx->sb_orig); |
1369
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_DSTR = 0x%"UVxf"\n", |
1370
|
|
|
|
|
|
PTR2UV(cx->sb_dstr)); |
1371
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_TARG = 0x%"UVxf"\n", |
1372
|
|
|
|
|
|
PTR2UV(cx->sb_targ)); |
1373
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_S = 0x%"UVxf"\n", |
1374
|
|
|
|
|
|
PTR2UV(cx->sb_s)); |
1375
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_M = 0x%"UVxf"\n", |
1376
|
|
|
|
|
|
PTR2UV(cx->sb_m)); |
1377
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_STREND = 0x%"UVxf"\n", |
1378
|
|
|
|
|
|
PTR2UV(cx->sb_strend)); |
1379
|
|
|
|
|
|
PerlIO_printf(Perl_debug_log, "SB_RXRES = 0x%"UVxf"\n", |
1380
|
|
|
|
|
|
PTR2UV(cx->sb_rxres)); |
1381
|
|
|
|
|
|
break; |
1382
|
|
|
|
|
|
} |
1383
|
|
|
|
|
|
#else |
1384
|
|
|
|
|
|
PERL_UNUSED_CONTEXT; |
1385
|
|
|
|
|
|
PERL_UNUSED_ARG(cx); |
1386
|
|
|
|
|
|
#endif /* DEBUGGING */ |
1387
|
132
|
|
|
|
|
} |
1388
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
/* |
1390
|
|
|
|
|
|
* Local variables: |
1391
|
|
|
|
|
|
* c-indentation-style: bsd |
1392
|
|
|
|
|
|
* c-basic-offset: 4 |
1393
|
|
|
|
|
|
* indent-tabs-mode: nil |
1394
|
|
|
|
|
|
* End: |
1395
|
|
|
|
|
|
* |
1396
|
|
|
|
|
|
* ex: set ts=8 sts=4 sw=4 et: |
1397
|
|
|
|
|
|
*/ |