This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Oops. Didn't mean to commit 27426 to maint first. Integrate it:
[perl5.git] / scope.c
CommitLineData
a0d0e21e 1/* scope.c
79072805 2 *
4bb101f2 3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
54ca4ee7 4 * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
79072805
LW
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 *
a0d0e21e
LW
9 */
10
11/*
12 * "For the fashion of Minas Tirith was such that it was built on seven
13 * levels..."
79072805
LW
14 */
15
ddfa107c 16/* This file contains functions to manipulate several of Perl's stacks;
166f8a29
DM
17 * in particular it contains code to push various types of things onto
18 * the savestack, then to pop them off and perform the correct restorative
19 * action for each one. This corresponds to the cleanup Perl does at
20 * each scope exit.
21 */
22
79072805 23#include "EXTERN.h"
864dbfa3 24#define PERL_IN_SCOPE_C
79072805
LW
25#include "perl.h"
26
a0d0e21e 27SV**
864dbfa3 28Perl_stack_grow(pTHX_ SV **sp, SV **p, int n)
a0d0e21e 29{
97aff369 30 dVAR;
3280af22 31 PL_stack_sp = sp;
2ce36478 32#ifndef STRESS_REALLOC
3280af22 33 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
2ce36478 34#else
6b88bc9c 35 av_extend(PL_curstack, (p - PL_stack_base) + (n) + 1);
2ce36478 36#endif
3280af22 37 return PL_stack_sp;
a0d0e21e
LW
38}
39
2ce36478
SM
40#ifndef STRESS_REALLOC
41#define GROW(old) ((old) * 3 / 2)
42#else
43#define GROW(old) ((old) + 1)
44#endif
45
e336de0d 46PERL_SI *
864dbfa3 47Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems)
e336de0d 48{
97aff369 49 dVAR;
e336de0d 50 PERL_SI *si;
a02a5408 51 Newx(si, 1, PERL_SI);
e336de0d
GS
52 si->si_stack = newAV();
53 AvREAL_off(si->si_stack);
54 av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
3280af22 55 AvALLOC(si->si_stack)[0] = &PL_sv_undef;
e336de0d
GS
56 AvFILLp(si->si_stack) = 0;
57 si->si_prev = 0;
58 si->si_next = 0;
59 si->si_cxmax = cxitems - 1;
60 si->si_cxix = -1;
e788e7d3 61 si->si_type = PERLSI_UNDEF;
a02a5408 62 Newx(si->si_cxstack, cxitems, PERL_CONTEXT);
9965345d
JH
63 /* Without any kind of initialising PUSHSUBST()
64 * in pp_subst() will read uninitialised heap. */
65 Poison(si->si_cxstack, cxitems, PERL_CONTEXT);
e336de0d
GS
66 return si;
67}
68
79072805 69I32
864dbfa3 70Perl_cxinc(pTHX)
79072805 71{
97aff369 72 dVAR;
a3b680e6 73 const IV old_max = cxstack_max;
2ce36478 74 cxstack_max = GROW(cxstack_max);
c09156bb 75 Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */
9965345d
JH
76 /* Without any kind of initialising deep enough recursion
77 * will end up reading uninitialised PERL_CONTEXTs. */
78 Poison(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
79072805
LW
79 return cxstack_ix + 1;
80}
81
79072805 82void
864dbfa3 83Perl_push_scope(pTHX)
79072805 84{
97aff369 85 dVAR;
3280af22
NIS
86 if (PL_scopestack_ix == PL_scopestack_max) {
87 PL_scopestack_max = GROW(PL_scopestack_max);
88 Renew(PL_scopestack, PL_scopestack_max, I32);
79072805 89 }
3280af22 90 PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
79072805
LW
91
92}
93
94void
864dbfa3 95Perl_pop_scope(pTHX)
79072805 96{
97aff369 97 dVAR;
35a4481c 98 const I32 oldsave = PL_scopestack[--PL_scopestack_ix];
8990e307 99 LEAVE_SCOPE(oldsave);
79072805
LW
100}
101
102void
864dbfa3 103Perl_markstack_grow(pTHX)
a0d0e21e 104{
97aff369 105 dVAR;
35a4481c
AL
106 const I32 oldmax = PL_markstack_max - PL_markstack;
107 const I32 newmax = GROW(oldmax);
a0d0e21e 108
3280af22
NIS
109 Renew(PL_markstack, newmax, I32);
110 PL_markstack_ptr = PL_markstack + oldmax;
111 PL_markstack_max = PL_markstack + newmax;
a0d0e21e
LW
112}
113
114void
864dbfa3 115Perl_savestack_grow(pTHX)
79072805 116{
97aff369 117 dVAR;
8aacddc1 118 PL_savestack_max = GROW(PL_savestack_max) + 4;
3280af22 119 Renew(PL_savestack, PL_savestack_max, ANY);
79072805
LW
120}
121
4b3c1a47
AE
122void
123Perl_savestack_grow_cnt(pTHX_ I32 need)
124{
97aff369 125 dVAR;
4b3c1a47
AE
126 PL_savestack_max = PL_savestack_ix + need;
127 Renew(PL_savestack, PL_savestack_max, ANY);
128}
129
2ce36478
SM
130#undef GROW
131
79072805 132void
864dbfa3 133Perl_tmps_grow(pTHX_ I32 n)
677b06e3 134{
97aff369 135 dVAR;
677b06e3
GS
136#ifndef STRESS_REALLOC
137 if (n < 128)
138 n = (PL_tmps_max < 512) ? 128 : 512;
139#endif
140 PL_tmps_max = PL_tmps_ix + n + 1;
141 Renew(PL_tmps_stack, PL_tmps_max, SV*);
142}
143
144
145void
864dbfa3 146Perl_free_tmps(pTHX)
79072805 147{
97aff369 148 dVAR;
79072805 149 /* XXX should tmps_floor live in cxstack? */
35a4481c 150 const I32 myfloor = PL_tmps_floor;
3280af22 151 while (PL_tmps_ix > myfloor) { /* clean up after last statement */
901017d6 152 SV* const sv = PL_tmps_stack[PL_tmps_ix];
a0714e2c 153 PL_tmps_stack[PL_tmps_ix--] = NULL;
8aacddc1 154 if (sv && sv != &PL_sv_undef) {
463ee0b2 155 SvTEMP_off(sv);
8990e307 156 SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */
463ee0b2 157 }
79072805
LW
158 }
159}
160
76e3520e 161STATIC SV *
cea2e8a9 162S_save_scalar_at(pTHX_ SV **sptr)
79072805 163{
97aff369 164 dVAR;
901017d6 165 SV * const osv = *sptr;
561b68a9 166 register SV * const sv = *sptr = newSV(0);
79072805 167
a0d0e21e 168 if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv) && SvTYPE(osv) != SVt_PVGV) {
a0d0e21e 169 if (SvGMAGICAL(osv)) {
35a4481c 170 const bool oldtainted = PL_tainted;
a0d0e21e 171 SvFLAGS(osv) |= (SvFLAGS(osv) &
c268c2a6 172 (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
3280af22 173 PL_tainted = oldtainted;
a0d0e21e 174 }
0cbee0a4 175 mg_localize(osv, sv);
79072805
LW
176 }
177 return sv;
178}
179
7a4c00b4 180SV *
864dbfa3 181Perl_save_scalar(pTHX_ GV *gv)
7a4c00b4 182{
97aff369 183 dVAR;
fb4fc1fa 184 SV ** const sptr = &GvSVn(gv);
27cc343c 185 PL_localizing = 1;
0cbee0a4 186 SvGETMAGIC(*sptr);
27cc343c 187 PL_localizing = 0;
7a4c00b4 188 SSCHECK(3);
b37c2d43 189 SSPUSHPTR(SvREFCNT_inc_simple(gv));
4e4c362e 190 SSPUSHPTR(SvREFCNT_inc(*sptr));
7a4c00b4 191 SSPUSHINT(SAVEt_SV);
4e4c362e 192 return save_scalar_at(sptr);
7a4c00b4
PP
193}
194
f4dd75d9 195/* Like save_sptr(), but also SvREFCNT_dec()s the new value. Can be used to
b9d12d37
GS
196 * restore a global SV to its prior contents, freeing new value. */
197void
864dbfa3 198Perl_save_generic_svref(pTHX_ SV **sptr)
b9d12d37 199{
97aff369 200 dVAR;
b9d12d37
GS
201 SSCHECK(3);
202 SSPUSHPTR(sptr);
203 SSPUSHPTR(SvREFCNT_inc(*sptr));
204 SSPUSHINT(SAVEt_GENERIC_SVREF);
205}
206
f4dd75d9
GS
207/* Like save_pptr(), but also Safefree()s the new value if it is different
208 * from the old one. Can be used to restore a global char* to its prior
209 * contents, freeing new value. */
210void
211Perl_save_generic_pvref(pTHX_ char **str)
212{
97aff369 213 dVAR;
f4dd75d9
GS
214 SSCHECK(3);
215 SSPUSHPTR(str);
216 SSPUSHPTR(*str);
217 SSPUSHINT(SAVEt_GENERIC_PVREF);
218}
219
05ec9bb3
NIS
220/* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree().
221 * Can be used to restore a shared global char* to its prior
222 * contents, freeing new value. */
223void
224Perl_save_shared_pvref(pTHX_ char **str)
225{
97aff369 226 dVAR;
05ec9bb3
NIS
227 SSCHECK(3);
228 SSPUSHPTR(str);
229 SSPUSHPTR(*str);
230 SSPUSHINT(SAVEt_SHARED_PVREF);
231}
232
14f338dc
DM
233/* set the SvFLAGS specified by mask to the values in val */
234
235void
236Perl_save_set_svflags(pTHX_ SV* sv, U32 mask, U32 val)
237{
97aff369 238 dVAR;
14f338dc
DM
239 SSCHECK(4);
240 SSPUSHPTR(sv);
241 SSPUSHINT(mask);
242 SSPUSHINT(val);
243 SSPUSHINT(SAVEt_SET_SVFLAGS);
244}
245
79072805 246void
864dbfa3 247Perl_save_gp(pTHX_ GV *gv, I32 empty)
79072805 248{
97aff369 249 dVAR;
576df6af 250 SSGROW(3);
4633a7c4 251 SSPUSHPTR(SvREFCNT_inc(gv));
5f05dabc 252 SSPUSHPTR(GvGP(gv));
79072805
LW
253 SSPUSHINT(SAVEt_GP);
254
5f05dabc
PP
255 if (empty) {
256 register GP *gp;
fae75791 257
a02a5408 258 Newxz(gp, 1, GP);
146174a9 259
fae75791 260 if (GvCVu(gv))
3280af22 261 PL_sub_generation++; /* taking a method out of circulation */
146174a9
CB
262 if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
263 gp->gp_io = newIO();
264 IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
265 }
44a8e56a 266 GvGP(gv) = gp_ref(gp);
fb4fc1fa 267#ifndef PERL_DONT_CREATE_GVSV
561b68a9 268 GvSV(gv) = newSV(0);
fb4fc1fa 269#endif
146174a9 270 GvLINE(gv) = CopLINE(PL_curcop);
07409e01
NC
271 /* XXX Ideally this cast would be replaced with a change to const char*
272 in the struct. */
273 GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (char *) "";
5f05dabc
PP
274 GvEGV(gv) = gv;
275 }
276 else {
44a8e56a 277 gp_ref(GvGP(gv));
5f05dabc
PP
278 GvINTRO_on(gv);
279 }
79072805 280}
79072805 281
79072805 282AV *
864dbfa3 283Perl_save_ary(pTHX_ GV *gv)
79072805 284{
97aff369 285 dVAR;
901017d6 286 AV * const oav = GvAVn(gv);
67a38de0 287 AV *av;
fb73857a 288
67a38de0
NIS
289 if (!AvREAL(oav) && AvREIFY(oav))
290 av_reify(oav);
79072805
LW
291 SSCHECK(3);
292 SSPUSHPTR(gv);
67a38de0 293 SSPUSHPTR(oav);
79072805
LW
294 SSPUSHINT(SAVEt_AV);
295
4608196e 296 GvAV(gv) = NULL;
fb73857a 297 av = GvAVn(gv);
0cbee0a4
DM
298 if (SvMAGIC(oav))
299 mg_localize((SV*)oav, (SV*)av);
fb73857a 300 return av;
79072805
LW
301}
302
303HV *
864dbfa3 304Perl_save_hash(pTHX_ GV *gv)
79072805 305{
97aff369 306 dVAR;
fb73857a
PP
307 HV *ohv, *hv;
308
79072805
LW
309 SSCHECK(3);
310 SSPUSHPTR(gv);
fb73857a 311 SSPUSHPTR(ohv = GvHVn(gv));
79072805
LW
312 SSPUSHINT(SAVEt_HV);
313
4608196e 314 GvHV(gv) = NULL;
fb73857a 315 hv = GvHVn(gv);
0cbee0a4
DM
316 if (SvMAGIC(ohv))
317 mg_localize((SV*)ohv, (SV*)hv);
fb73857a 318 return hv;
79072805
LW
319}
320
321void
864dbfa3 322Perl_save_item(pTHX_ register SV *item)
79072805 323{
97aff369 324 dVAR;
901017d6 325 register SV * const sv = newSVsv(item);
79072805
LW
326
327 SSCHECK(3);
328 SSPUSHPTR(item); /* remember the pointer */
79072805
LW
329 SSPUSHPTR(sv); /* remember the value */
330 SSPUSHINT(SAVEt_ITEM);
331}
332
333void
864dbfa3 334Perl_save_int(pTHX_ int *intp)
79072805 335{
97aff369 336 dVAR;
79072805
LW
337 SSCHECK(3);
338 SSPUSHINT(*intp);
339 SSPUSHPTR(intp);
340 SSPUSHINT(SAVEt_INT);
341}
342
343void
9febdf04
RH
344Perl_save_bool(pTHX_ bool *boolp)
345{
97aff369 346 dVAR;
9febdf04
RH
347 SSCHECK(3);
348 SSPUSHBOOL(*boolp);
349 SSPUSHPTR(boolp);
350 SSPUSHINT(SAVEt_BOOL);
351}
352
353void
864dbfa3 354Perl_save_I32(pTHX_ I32 *intp)
79072805 355{
97aff369 356 dVAR;
79072805
LW
357 SSCHECK(3);
358 SSPUSHINT(*intp);
359 SSPUSHPTR(intp);
360 SSPUSHINT(SAVEt_I32);
361}
362
85e6fe83
LW
363/* Cannot use save_sptr() to store a char* since the SV** cast will
364 * force word-alignment and we'll miss the pointer.
365 */
366void
864dbfa3 367Perl_save_pptr(pTHX_ char **pptr)
85e6fe83 368{
97aff369 369 dVAR;
85e6fe83
LW
370 SSCHECK(3);
371 SSPUSHPTR(*pptr);
372 SSPUSHPTR(pptr);
373 SSPUSHINT(SAVEt_PPTR);
374}
375
79072805 376void
146174a9
CB
377Perl_save_vptr(pTHX_ void *ptr)
378{
97aff369 379 dVAR;
146174a9
CB
380 SSCHECK(3);
381 SSPUSHPTR(*(char**)ptr);
382 SSPUSHPTR(ptr);
383 SSPUSHINT(SAVEt_VPTR);
384}
385
386void
864dbfa3 387Perl_save_sptr(pTHX_ SV **sptr)
79072805 388{
97aff369 389 dVAR;
79072805
LW
390 SSCHECK(3);
391 SSPUSHPTR(*sptr);
392 SSPUSHPTR(sptr);
393 SSPUSHINT(SAVEt_SPTR);
394}
395
c3564e5c
GS
396void
397Perl_save_padsv(pTHX_ PADOFFSET off)
398{
97aff369 399 dVAR;
c3564e5c 400 SSCHECK(4);
f3548bdc 401 ASSERT_CURPAD_ACTIVE("save_padsv");
c3564e5c 402 SSPUSHPTR(PL_curpad[off]);
f3548bdc 403 SSPUSHPTR(PL_comppad);
c3564e5c
GS
404 SSPUSHLONG((long)off);
405 SSPUSHINT(SAVEt_PADSV);
406}
407
79072805 408void
864dbfa3 409Perl_save_hptr(pTHX_ HV **hptr)
79072805 410{
97aff369 411 dVAR;
79072805 412 SSCHECK(3);
85e6fe83 413 SSPUSHPTR(*hptr);
79072805
LW
414 SSPUSHPTR(hptr);
415 SSPUSHINT(SAVEt_HPTR);
416}
417
418void
864dbfa3 419Perl_save_aptr(pTHX_ AV **aptr)
79072805 420{
97aff369 421 dVAR;
79072805 422 SSCHECK(3);
85e6fe83 423 SSPUSHPTR(*aptr);
79072805
LW
424 SSPUSHPTR(aptr);
425 SSPUSHINT(SAVEt_APTR);
426}
427
428void
864dbfa3 429Perl_save_freesv(pTHX_ SV *sv)
8990e307 430{
97aff369 431 dVAR;
8990e307
LW
432 SSCHECK(2);
433 SSPUSHPTR(sv);
434 SSPUSHINT(SAVEt_FREESV);
435}
436
437void
26d9b02f
JH
438Perl_save_mortalizesv(pTHX_ SV *sv)
439{
97aff369 440 dVAR;
26d9b02f
JH
441 SSCHECK(2);
442 SSPUSHPTR(sv);
443 SSPUSHINT(SAVEt_MORTALIZESV);
444}
445
446void
864dbfa3 447Perl_save_freeop(pTHX_ OP *o)
8990e307 448{
97aff369 449 dVAR;
8990e307 450 SSCHECK(2);
11343788 451 SSPUSHPTR(o);
8990e307
LW
452 SSPUSHINT(SAVEt_FREEOP);
453}
454
455void
864dbfa3 456Perl_save_freepv(pTHX_ char *pv)
8990e307 457{
97aff369 458 dVAR;
8990e307
LW
459 SSCHECK(2);
460 SSPUSHPTR(pv);
461 SSPUSHINT(SAVEt_FREEPV);
462}
463
464void
864dbfa3 465Perl_save_clearsv(pTHX_ SV **svp)
8990e307 466{
97aff369 467 dVAR;
f3548bdc 468 ASSERT_CURPAD_ACTIVE("save_clearsv");
8990e307 469 SSCHECK(2);
3280af22 470 SSPUSHLONG((long)(svp-PL_curpad));
8990e307 471 SSPUSHINT(SAVEt_CLEARSV);
d9d18af6 472 SvPADSTALE_off(*svp); /* mark lexical as active */
8990e307
LW
473}
474
475void
864dbfa3 476Perl_save_delete(pTHX_ HV *hv, char *key, I32 klen)
8990e307 477{
97aff369 478 dVAR;
8990e307
LW
479 SSCHECK(4);
480 SSPUSHINT(klen);
481 SSPUSHPTR(key);
b37c2d43 482 SSPUSHPTR(SvREFCNT_inc_simple(hv));
8990e307
LW
483 SSPUSHINT(SAVEt_DELETE);
484}
485
486void
146174a9
CB
487Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p)
488{
97aff369 489 dVAR;
146174a9
CB
490 SSCHECK(3);
491 SSPUSHDXPTR(f);
492 SSPUSHPTR(p);
493 SSPUSHINT(SAVEt_DESTRUCTOR_X);
494}
495
496void
59413342 497Perl_save_aelem(pTHX_ AV *av, I32 idx, SV **sptr)
4e4c362e 498{
97aff369 499 dVAR;
bfc4de9f 500 SV *sv;
0cbee0a4 501 SvGETMAGIC(*sptr);
4e4c362e 502 SSCHECK(4);
b37c2d43 503 SSPUSHPTR(SvREFCNT_inc_simple(av));
4e4c362e
GS
504 SSPUSHINT(idx);
505 SSPUSHPTR(SvREFCNT_inc(*sptr));
506 SSPUSHINT(SAVEt_AELEM);
5dd42e15
DM
507 /* if it gets reified later, the restore will have the wrong refcnt */
508 if (!AvREAL(av) && AvREIFY(av))
b37c2d43 509 SvREFCNT_inc_void(*sptr);
4e4c362e 510 save_scalar_at(sptr);
bfc4de9f
DM
511 sv = *sptr;
512 /* If we're localizing a tied array element, this new sv
513 * won't actually be stored in the array - so it won't get
514 * reaped when the localize ends. Ensure it gets reaped by
515 * mortifying it instead. DAPM */
516 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
517 sv_2mortal(sv);
4e4c362e
GS
518}
519
520void
e1ec3a88 521Perl_save_helem(pTHX_ HV *hv, SV *key, SV **sptr)
4e4c362e 522{
97aff369 523 dVAR;
bfc4de9f 524 SV *sv;
0cbee0a4 525 SvGETMAGIC(*sptr);
4e4c362e 526 SSCHECK(4);
b37c2d43
AL
527 SSPUSHPTR(SvREFCNT_inc_simple(hv));
528 SSPUSHPTR(SvREFCNT_inc_simple(key));
4e4c362e
GS
529 SSPUSHPTR(SvREFCNT_inc(*sptr));
530 SSPUSHINT(SAVEt_HELEM);
531 save_scalar_at(sptr);
bfc4de9f
DM
532 sv = *sptr;
533 /* If we're localizing a tied hash element, this new sv
534 * won't actually be stored in the hash - so it won't get
535 * reaped when the localize ends. Ensure it gets reaped by
536 * mortifying it instead. DAPM */
537 if (SvTIED_mg(sv, PERL_MAGIC_tiedelem))
538 sv_2mortal(sv);
4e4c362e
GS
539}
540
2053acbf
NC
541SV*
542Perl_save_svref(pTHX_ SV **sptr)
543{
544 dVAR;
545 SvGETMAGIC(*sptr);
546 SSCHECK(3);
547 SSPUSHPTR(sptr);
548 SSPUSHPTR(SvREFCNT_inc(*sptr));
549 SSPUSHINT(SAVEt_SVREF);
550 return save_scalar_at(sptr);
551}
552
4e4c362e 553void
864dbfa3 554Perl_save_op(pTHX)
462e5cf6 555{
97aff369 556 dVAR;
462e5cf6 557 SSCHECK(2);
533c011a 558 SSPUSHPTR(PL_op);
462e5cf6
MB
559 SSPUSHINT(SAVEt_OP);
560}
561
455ece5e 562I32
864dbfa3 563Perl_save_alloc(pTHX_ I32 size, I32 pad)
455ece5e 564{
97aff369 565 dVAR;
35a4481c 566 register const I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix]
8aacddc1 567 - (char*)PL_savestack);
35a4481c 568 register const I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack));
455ece5e
AD
569
570 /* SSCHECK may not be good enough */
571 while (PL_savestack_ix + elems + 2 > PL_savestack_max)
8aacddc1 572 savestack_grow();
455ece5e
AD
573
574 PL_savestack_ix += elems;
575 SSPUSHINT(elems);
576 SSPUSHINT(SAVEt_ALLOC);
577 return start;
578}
579
462e5cf6 580void
864dbfa3 581Perl_leave_scope(pTHX_ I32 base)
79072805 582{
97aff369 583 dVAR;
79072805
LW
584 register SV *sv;
585 register SV *value;
586 register GV *gv;
587 register AV *av;
588 register HV *hv;
20454177 589 void* ptr;
f4dd75d9 590 register char* str;
161b7d16 591 I32 i;
79072805
LW
592
593 if (base < -1)
cea2e8a9 594 Perl_croak(aTHX_ "panic: corrupt saved stack index");
3280af22 595 while (PL_savestack_ix > base) {
79072805
LW
596 switch (SSPOPINT) {
597 case SAVEt_ITEM: /* normal string */
598 value = (SV*)SSPOPPTR;
599 sv = (SV*)SSPOPPTR;
600 sv_replace(sv,value);
3280af22 601 PL_localizing = 2;
79072805 602 SvSETMAGIC(sv);
3280af22 603 PL_localizing = 0;
79072805 604 break;
8aacddc1 605 case SAVEt_SV: /* scalar reference */
79072805
LW
606 value = (SV*)SSPOPPTR;
607 gv = (GV*)SSPOPPTR;
7a4c00b4 608 ptr = &GvSV(gv);
5dd42e15 609 av = (AV*)gv; /* what to refcnt_dec */
2053acbf
NC
610 restore_sv:
611 sv = *(SV**)ptr;
612 DEBUG_S(PerlIO_printf(Perl_debug_log,
613 "restore svref: %p %p:%s -> %p:%s\n",
614 ptr, sv, SvPEEK(sv), value, SvPEEK(value)));
615 *(SV**)ptr = value;
616 SvREFCNT_dec(sv);
617 PL_localizing = 2;
618 SvSETMAGIC(value);
619 PL_localizing = 0;
620 SvREFCNT_dec(value);
621 if (av) /* actually an av, hv or gv */
622 SvREFCNT_dec(av);
623 break;
8aacddc1 624 case SAVEt_GENERIC_PVREF: /* generic pv */
f4dd75d9
GS
625 str = (char*)SSPOPPTR;
626 ptr = SSPOPPTR;
627 if (*(char**)ptr != str) {
628 Safefree(*(char**)ptr);
629 *(char**)ptr = str;
630 }
631 break;
05ec9bb3
NIS
632 case SAVEt_SHARED_PVREF: /* shared pv */
633 str = (char*)SSPOPPTR;
634 ptr = SSPOPPTR;
635 if (*(char**)ptr != str) {
5e54c26f 636#ifdef NETWARE
9ecbcc42 637 PerlMem_free(*(char**)ptr);
5e54c26f 638#else
05ec9bb3 639 PerlMemShared_free(*(char**)ptr);
5e54c26f 640#endif
05ec9bb3
NIS
641 *(char**)ptr = str;
642 }
643 break;
8aacddc1 644 case SAVEt_GENERIC_SVREF: /* generic sv */
b9d12d37
GS
645 value = (SV*)SSPOPPTR;
646 ptr = SSPOPPTR;
f4dd75d9
GS
647 sv = *(SV**)ptr;
648 *(SV**)ptr = value;
649 SvREFCNT_dec(sv);
b9d12d37
GS
650 SvREFCNT_dec(value);
651 break;
8aacddc1 652 case SAVEt_AV: /* array reference */
79072805
LW
653 av = (AV*)SSPOPPTR;
654 gv = (GV*)SSPOPPTR;
fb73857a 655 if (GvAV(gv)) {
35a4481c 656 AV * const goner = GvAV(gv);
404a4710
NC
657 /* FIXME - this is a temporary hack until we work out what
658 the correct behaviour for magic should be. */
659 sv_unmagic((SV*)goner, PERL_MAGIC_arylen_p);
b162af07 660 SvMAGIC_set(av, SvMAGIC(goner));
32da55ab 661 SvFLAGS((SV*)av) |= SvMAGICAL(goner);
fb73857a 662 SvMAGICAL_off(goner);
b162af07 663 SvMAGIC_set(goner, NULL);
fb73857a
PP
664 SvREFCNT_dec(goner);
665 }
8aacddc1 666 GvAV(gv) = av;
fb73857a 667 if (SvMAGICAL(av)) {
3280af22 668 PL_localizing = 2;
fb73857a 669 SvSETMAGIC((SV*)av);
3280af22 670 PL_localizing = 0;
fb73857a 671 }
8aacddc1
NIS
672 break;
673 case SAVEt_HV: /* hash reference */
79072805
LW
674 hv = (HV*)SSPOPPTR;
675 gv = (GV*)SSPOPPTR;
fb73857a 676 if (GvHV(gv)) {
35a4481c 677 HV * const goner = GvHV(gv);
b162af07 678 SvMAGIC_set(hv, SvMAGIC(goner));
fb73857a
PP
679 SvFLAGS(hv) |= SvMAGICAL(goner);
680 SvMAGICAL_off(goner);
b162af07 681 SvMAGIC_set(goner, NULL);
fb73857a
PP
682 SvREFCNT_dec(goner);
683 }
8aacddc1 684 GvHV(gv) = hv;
fb73857a 685 if (SvMAGICAL(hv)) {
3280af22 686 PL_localizing = 2;
fb73857a 687 SvSETMAGIC((SV*)hv);
3280af22 688 PL_localizing = 0;
fb73857a 689 }
8aacddc1 690 break;
79072805
LW
691 case SAVEt_INT: /* int reference */
692 ptr = SSPOPPTR;
693 *(int*)ptr = (int)SSPOPINT;
694 break;
9febdf04
RH
695 case SAVEt_BOOL: /* bool reference */
696 ptr = SSPOPPTR;
697 *(bool*)ptr = (bool)SSPOPBOOL;
698 break;
79072805
LW
699 case SAVEt_I32: /* I32 reference */
700 ptr = SSPOPPTR;
701 *(I32*)ptr = (I32)SSPOPINT;
702 break;
703 case SAVEt_SPTR: /* SV* reference */
704 ptr = SSPOPPTR;
705 *(SV**)ptr = (SV*)SSPOPPTR;
706 break;
146174a9 707 case SAVEt_VPTR: /* random* reference */
85e6fe83
LW
708 case SAVEt_PPTR: /* char* reference */
709 ptr = SSPOPPTR;
710 *(char**)ptr = (char*)SSPOPPTR;
711 break;
79072805
LW
712 case SAVEt_HPTR: /* HV* reference */
713 ptr = SSPOPPTR;
714 *(HV**)ptr = (HV*)SSPOPPTR;
715 break;
716 case SAVEt_APTR: /* AV* reference */
717 ptr = SSPOPPTR;
718 *(AV**)ptr = (AV*)SSPOPPTR;
719 break;
fb73857a 720 case SAVEt_GP: /* scalar reference */
79072805
LW
721 ptr = SSPOPPTR;
722 gv = (GV*)SSPOPPTR;
8aacddc1
NIS
723 gp_free(gv);
724 GvGP(gv) = (GP*)ptr;
fae75791 725 if (GvCVu(gv))
3280af22 726 PL_sub_generation++; /* putting a method back into circulation */
4633a7c4 727 SvREFCNT_dec(gv);
8aacddc1 728 break;
8990e307
LW
729 case SAVEt_FREESV:
730 ptr = SSPOPPTR;
731 SvREFCNT_dec((SV*)ptr);
732 break;
26d9b02f
JH
733 case SAVEt_MORTALIZESV:
734 ptr = SSPOPPTR;
735 sv_2mortal((SV*)ptr);
736 break;
8990e307
LW
737 case SAVEt_FREEOP:
738 ptr = SSPOPPTR;
f3548bdc 739 ASSERT_CURPAD_LEGAL("SAVEt_FREEOP"); /* XXX DAPM tmp */
8990e307
LW
740 op_free((OP*)ptr);
741 break;
742 case SAVEt_FREEPV:
743 ptr = SSPOPPTR;
1df70142 744 Safefree(ptr);
8990e307
LW
745 break;
746 case SAVEt_CLEARSV:
3280af22 747 ptr = (void*)&PL_curpad[SSPOPLONG];
8990e307 748 sv = *(SV**)ptr;
dd2155a4
DM
749
750 DEBUG_Xv(PerlIO_printf(Perl_debug_log,
f3548bdc
DM
751 "Pad 0x%"UVxf"[0x%"UVxf"] clearsv: %ld sv=0x%"UVxf"<%"IVdf"> %s\n",
752 PTR2UV(PL_comppad), PTR2UV(PL_curpad),
753 (long)((SV **)ptr-PL_curpad), PTR2UV(sv), (IV)SvREFCNT(sv),
dd2155a4
DM
754 (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon"
755 ));
756
bc44cdaf
GS
757 /* Can clear pad variable in place? */
758 if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
8aacddc1
NIS
759 /*
760 * if a my variable that was made readonly is going out of
761 * scope, we want to remove the readonlyness so that it can
762 * go out of scope quietly
8aacddc1 763 */
a26e96df 764 if (SvPADMY(sv) && !SvFAKE(sv))
8aacddc1
NIS
765 SvREADONLY_off(sv);
766
6fc92669 767 if (SvTHINKFIRST(sv))
840a7b70 768 sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF);
a0d0e21e
LW
769 if (SvMAGICAL(sv))
770 mg_free(sv);
8990e307
LW
771
772 switch (SvTYPE(sv)) {
773 case SVt_NULL:
774 break;
775 case SVt_PVAV:
44a8e56a 776 av_clear((AV*)sv);
8990e307
LW
777 break;
778 case SVt_PVHV:
44a8e56a 779 hv_clear((HV*)sv);
8990e307
LW
780 break;
781 case SVt_PVCV:
cea2e8a9 782 Perl_croak(aTHX_ "panic: leave_scope pad code");
8990e307 783 default:
0c34ef67 784 SvOK_off(sv);
8990e307
LW
785 break;
786 }
d9d18af6 787 SvPADSTALE_on(sv); /* mark as no longer live */
8990e307
LW
788 }
789 else { /* Someone has a claim on this, so abandon it. */
35a4481c 790 const U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
8990e307
LW
791 switch (SvTYPE(sv)) { /* Console ourselves with a new value */
792 case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break;
793 case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break;
561b68a9 794 default: *(SV**)ptr = newSV(0); break;
8990e307 795 }
53868620 796 SvREFCNT_dec(sv); /* Cast current value to the winds. */
d9d18af6
DM
797 /* preserve pad nature, but also mark as not live
798 * for any closure capturing */
2740392c 799 SvFLAGS(*(SV**)ptr) |= padflags | SVs_PADSTALE;
8990e307
LW
800 }
801 break;
802 case SAVEt_DELETE:
803 ptr = SSPOPPTR;
804 hv = (HV*)ptr;
805 ptr = SSPOPPTR;
748a9306 806 (void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
4e4c362e 807 SvREFCNT_dec(hv);
8aacddc1 808 Safefree(ptr);
8990e307 809 break;
146174a9
CB
810 case SAVEt_DESTRUCTOR_X:
811 ptr = SSPOPPTR;
acfe0abc 812 (*SSPOPDXPTR)(aTHX_ ptr);
a0d0e21e
LW
813 break;
814 case SAVEt_REGCONTEXT:
455ece5e 815 case SAVEt_ALLOC:
161b7d16 816 i = SSPOPINT;
3280af22 817 PL_savestack_ix -= i; /* regexp must have croaked */
a0d0e21e 818 break;
55497cff 819 case SAVEt_STACK_POS: /* Position on Perl stack */
161b7d16 820 i = SSPOPINT;
3280af22 821 PL_stack_sp = PL_stack_base + i;
55497cff 822 break;
161b7d16
SM
823 case SAVEt_AELEM: /* array element */
824 value = (SV*)SSPOPPTR;
825 i = SSPOPINT;
826 av = (AV*)SSPOPPTR;
5dd42e15
DM
827 if (!AvREAL(av) && AvREIFY(av)) /* undo reify guard */
828 SvREFCNT_dec(value);
161b7d16 829 ptr = av_fetch(av,i,1);
4e4c362e
GS
830 if (ptr) {
831 sv = *(SV**)ptr;
3280af22 832 if (sv && sv != &PL_sv_undef) {
14befaf4 833 if (SvTIED_mg((SV*)av, PERL_MAGIC_tied))
b37c2d43 834 SvREFCNT_inc_void_NN(sv);
4e4c362e
GS
835 goto restore_sv;
836 }
837 }
838 SvREFCNT_dec(av);
839 SvREFCNT_dec(value);
840 break;
161b7d16
SM
841 case SAVEt_HELEM: /* hash element */
842 value = (SV*)SSPOPPTR;
9002cb76 843 sv = (SV*)SSPOPPTR;
161b7d16
SM
844 hv = (HV*)SSPOPPTR;
845 ptr = hv_fetch_ent(hv, sv, 1, 0);
4e4c362e 846 if (ptr) {
35a4481c 847 const SV * const oval = HeVAL((HE*)ptr);
3280af22 848 if (oval && oval != &PL_sv_undef) {
4e4c362e 849 ptr = &HeVAL((HE*)ptr);
14befaf4 850 if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
b37c2d43 851 SvREFCNT_inc_void(*(SV**)ptr);
4e4c362e 852 SvREFCNT_dec(sv);
5dd42e15 853 av = (AV*)hv; /* what to refcnt_dec */
4e4c362e
GS
854 goto restore_sv;
855 }
856 }
857 SvREFCNT_dec(hv);
858 SvREFCNT_dec(sv);
859 SvREFCNT_dec(value);
860 break;
462e5cf6 861 case SAVEt_OP:
533c011a 862 PL_op = (OP*)SSPOPPTR;
462e5cf6 863 break;
25eaa213 864 case SAVEt_HINTS:
045ac317
RGS
865 if ((PL_hints & HINT_LOCALIZE_HH) && GvHV(PL_hintgv)) {
866 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
867 GvHV(PL_hintgv) = NULL;
868 }
3280af22 869 *(I32*)&PL_hints = (I32)SSPOPINT;
dfa41748
DM
870 if (PL_hints & HINT_LOCALIZE_HH) {
871 SvREFCNT_dec((SV*)GvHV(PL_hintgv));
872 GvHV(PL_hintgv) = (HV*)SSPOPPTR;
873 }
874
b3ac6de7 875 break;
cb50131a 876 case SAVEt_COMPPAD:
f3548bdc 877 PL_comppad = (PAD*)SSPOPPTR;
58ed4fbe 878 if (PL_comppad)
cb50131a
CB
879 PL_curpad = AvARRAY(PL_comppad);
880 else
4608196e 881 PL_curpad = NULL;
cb50131a 882 break;
c3564e5c
GS
883 case SAVEt_PADSV:
884 {
35a4481c 885 const PADOFFSET off = (PADOFFSET)SSPOPLONG;
c3564e5c
GS
886 ptr = SSPOPPTR;
887 if (ptr)
f3548bdc 888 AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR;
c3564e5c
GS
889 }
890 break;
8b7059b1
DM
891 case SAVEt_SAVESWITCHSTACK:
892 {
893 dSP;
7452cf6a
AL
894 AV* const t = (AV*)SSPOPPTR;
895 AV* const f = (AV*)SSPOPPTR;
8b7059b1
DM
896 SWITCHSTACK(t,f);
897 PL_curstackinfo->si_stack = f;
898 }
899 break;
14f338dc
DM
900 case SAVEt_SET_SVFLAGS:
901 {
35a4481c
AL
902 const U32 val = (U32)SSPOPINT;
903 const U32 mask = (U32)SSPOPINT;
14f338dc
DM
904 sv = (SV*)SSPOPPTR;
905 SvFLAGS(sv) &= ~mask;
906 SvFLAGS(sv) |= val;
907 }
908 break;
2053acbf
NC
909 /* These are only saved in mathoms.c */
910 case SAVEt_SVREF: /* scalar reference */
911 value = (SV*)SSPOPPTR;
912 ptr = SSPOPPTR;
913 av = NULL; /* what to refcnt_dec */
914 goto restore_sv;
915 case SAVEt_LONG: /* long reference */
916 ptr = SSPOPPTR;
917 *(long*)ptr = (long)SSPOPLONG;
918 break;
919 case SAVEt_I16: /* I16 reference */
920 ptr = SSPOPPTR;
921 *(I16*)ptr = (I16)SSPOPINT;
922 break;
923 case SAVEt_I8: /* I8 reference */
924 ptr = SSPOPPTR;
925 *(I8*)ptr = (I8)SSPOPINT;
926 break;
927 case SAVEt_IV: /* IV reference */
928 ptr = SSPOPPTR;
929 *(IV*)ptr = (IV)SSPOPIV;
930 break;
931 case SAVEt_NSTAB:
932 gv = (GV*)SSPOPPTR;
933 (void)sv_clear((SV*)gv);
934 break;
935 case SAVEt_DESTRUCTOR:
936 ptr = SSPOPPTR;
937 (*SSPOPDPTR)(ptr);
938 break;
79072805 939 default:
cea2e8a9 940 Perl_croak(aTHX_ "panic: leave_scope inconsistency");
79072805
LW
941 }
942 }
943}
8990e307 944
8990e307 945void
864dbfa3 946Perl_cx_dump(pTHX_ PERL_CONTEXT *cx)
8990e307 947{
97aff369 948 dVAR;
35ff7856 949#ifdef DEBUGGING
22c35a8c 950 PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), PL_block_type[CxTYPE(cx)]);
6b35e009 951 if (CxTYPE(cx) != CXt_SUBST) {
760ac839 952 PerlIO_printf(Perl_debug_log, "BLK_OLDSP = %ld\n", (long)cx->blk_oldsp);
146174a9
CB
953 PerlIO_printf(Perl_debug_log, "BLK_OLDCOP = 0x%"UVxf"\n",
954 PTR2UV(cx->blk_oldcop));
760ac839
LW
955 PerlIO_printf(Perl_debug_log, "BLK_OLDMARKSP = %ld\n", (long)cx->blk_oldmarksp);
956 PerlIO_printf(Perl_debug_log, "BLK_OLDSCOPESP = %ld\n", (long)cx->blk_oldscopesp);
146174a9
CB
957 PerlIO_printf(Perl_debug_log, "BLK_OLDPM = 0x%"UVxf"\n",
958 PTR2UV(cx->blk_oldpm));
760ac839 959 PerlIO_printf(Perl_debug_log, "BLK_GIMME = %s\n", cx->blk_gimme ? "LIST" : "SCALAR");
8990e307 960 }
6b35e009 961 switch (CxTYPE(cx)) {
8990e307
LW
962 case CXt_NULL:
963 case CXt_BLOCK:
964 break;
146174a9
CB
965 case CXt_FORMAT:
966 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
967 PTR2UV(cx->blk_sub.cv));
968 PerlIO_printf(Perl_debug_log, "BLK_SUB.GV = 0x%"UVxf"\n",
969 PTR2UV(cx->blk_sub.gv));
970 PerlIO_printf(Perl_debug_log, "BLK_SUB.DFOUTGV = 0x%"UVxf"\n",
971 PTR2UV(cx->blk_sub.dfoutgv));
972 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
973 (int)cx->blk_sub.hasargs);
f39bc417
DM
974 PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
975 PTR2UV(cx->blk_sub.retop));
146174a9 976 break;
8990e307 977 case CXt_SUB:
146174a9
CB
978 PerlIO_printf(Perl_debug_log, "BLK_SUB.CV = 0x%"UVxf"\n",
979 PTR2UV(cx->blk_sub.cv));
760ac839 980 PerlIO_printf(Perl_debug_log, "BLK_SUB.OLDDEPTH = %ld\n",
8990e307 981 (long)cx->blk_sub.olddepth);
760ac839 982 PerlIO_printf(Perl_debug_log, "BLK_SUB.HASARGS = %d\n",
8990e307 983 (int)cx->blk_sub.hasargs);
146174a9
CB
984 PerlIO_printf(Perl_debug_log, "BLK_SUB.LVAL = %d\n",
985 (int)cx->blk_sub.lval);
f39bc417
DM
986 PerlIO_printf(Perl_debug_log, "BLK_SUB.RETOP = 0x%"UVxf"\n",
987 PTR2UV(cx->blk_sub.retop));
8990e307
LW
988 break;
989 case CXt_EVAL:
760ac839 990 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_IN_EVAL = %ld\n",
8990e307 991 (long)cx->blk_eval.old_in_eval);
760ac839 992 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_OP_TYPE = %s (%s)\n",
22c35a8c
GS
993 PL_op_name[cx->blk_eval.old_op_type],
994 PL_op_desc[cx->blk_eval.old_op_type]);
0f79a09d
GS
995 if (cx->blk_eval.old_namesv)
996 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_NAME = %s\n",
aa07b2f6 997 SvPVX_const(cx->blk_eval.old_namesv));
146174a9
CB
998 PerlIO_printf(Perl_debug_log, "BLK_EVAL.OLD_EVAL_ROOT = 0x%"UVxf"\n",
999 PTR2UV(cx->blk_eval.old_eval_root));
f39bc417
DM
1000 PerlIO_printf(Perl_debug_log, "BLK_EVAL.RETOP = 0x%"UVxf"\n",
1001 PTR2UV(cx->blk_eval.retop));
8990e307
LW
1002 break;
1003
1004 case CXt_LOOP:
760ac839 1005 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n",
8990e307 1006 cx->blk_loop.label);
760ac839 1007 PerlIO_printf(Perl_debug_log, "BLK_LOOP.RESETSP = %ld\n",
8990e307 1008 (long)cx->blk_loop.resetsp);
146174a9
CB
1009 PerlIO_printf(Perl_debug_log, "BLK_LOOP.REDO_OP = 0x%"UVxf"\n",
1010 PTR2UV(cx->blk_loop.redo_op));
1011 PerlIO_printf(Perl_debug_log, "BLK_LOOP.NEXT_OP = 0x%"UVxf"\n",
1012 PTR2UV(cx->blk_loop.next_op));
1013 PerlIO_printf(Perl_debug_log, "BLK_LOOP.LAST_OP = 0x%"UVxf"\n",
1014 PTR2UV(cx->blk_loop.last_op));
760ac839 1015 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERIX = %ld\n",
8990e307 1016 (long)cx->blk_loop.iterix);
146174a9
CB
1017 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERARY = 0x%"UVxf"\n",
1018 PTR2UV(cx->blk_loop.iterary));
1019 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERVAR = 0x%"UVxf"\n",
1020 PTR2UV(CxITERVAR(cx)));
1021 if (CxITERVAR(cx))
1022 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERSAVE = 0x%"UVxf"\n",
1023 PTR2UV(cx->blk_loop.itersave));
1024 PerlIO_printf(Perl_debug_log, "BLK_LOOP.ITERLVAL = 0x%"UVxf"\n",
1025 PTR2UV(cx->blk_loop.iterlval));
8990e307
LW
1026 break;
1027
1028 case CXt_SUBST:
760ac839 1029 PerlIO_printf(Perl_debug_log, "SB_ITERS = %ld\n",
8990e307 1030 (long)cx->sb_iters);
760ac839 1031 PerlIO_printf(Perl_debug_log, "SB_MAXITERS = %ld\n",
8990e307 1032 (long)cx->sb_maxiters);
35ef4773
GS
1033 PerlIO_printf(Perl_debug_log, "SB_RFLAGS = %ld\n",
1034 (long)cx->sb_rflags);
760ac839 1035 PerlIO_printf(Perl_debug_log, "SB_ONCE = %ld\n",
8990e307 1036 (long)cx->sb_once);
760ac839 1037 PerlIO_printf(Perl_debug_log, "SB_ORIG = %s\n",
8990e307 1038 cx->sb_orig);
146174a9
CB
1039 PerlIO_printf(Perl_debug_log, "SB_DSTR = 0x%"UVxf"\n",
1040 PTR2UV(cx->sb_dstr));
1041 PerlIO_printf(Perl_debug_log, "SB_TARG = 0x%"UVxf"\n",
1042 PTR2UV(cx->sb_targ));
1043 PerlIO_printf(Perl_debug_log, "SB_S = 0x%"UVxf"\n",
1044 PTR2UV(cx->sb_s));
1045 PerlIO_printf(Perl_debug_log, "SB_M = 0x%"UVxf"\n",
1046 PTR2UV(cx->sb_m));
1047 PerlIO_printf(Perl_debug_log, "SB_STREND = 0x%"UVxf"\n",
1048 PTR2UV(cx->sb_strend));
1049 PerlIO_printf(Perl_debug_log, "SB_RXRES = 0x%"UVxf"\n",
1050 PTR2UV(cx->sb_rxres));
8990e307
LW
1051 break;
1052 }
65e66c80 1053#else
96a5add6 1054 PERL_UNUSED_CONTEXT;
65e66c80 1055 PERL_UNUSED_ARG(cx);
17c3b450 1056#endif /* DEBUGGING */
35ff7856 1057}
241d1a3b
NC
1058
1059/*
1060 * Local variables:
1061 * c-indentation-style: bsd
1062 * c-basic-offset: 4
1063 * indent-tabs-mode: t
1064 * End:
1065 *
37442d52
RGS
1066 * ex: set ts=8 sts=4 sw=4 noet:
1067 */