This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document the unportability of atan2() edge cases
[perl5.git] / pp.h
1 /*    pp.h
2  *
3  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
4  *    2000, 2001, 2002, 2003, 2004, 2005 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 #define PP(s) OP * Perl_##s(pTHX)
12
13 /*
14 =head1 Stack Manipulation Macros
15
16 =for apidoc AmU||SP
17 Stack pointer.  This is usually handled by C<xsubpp>.  See C<dSP> and
18 C<SPAGAIN>.
19
20 =for apidoc AmU||MARK
21 Stack marker variable for the XSUB.  See C<dMARK>.
22
23 =for apidoc Am|void|PUSHMARK|SP
24 Opening bracket for arguments on a callback.  See C<PUTBACK> and
25 L<perlcall>.
26
27 =for apidoc Ams||dSP
28 Declares a local copy of perl's stack pointer for the XSUB, available via
29 the C<SP> macro.  See C<SP>.
30
31 =for apidoc ms||djSP
32
33 Declare Just C<SP>. This is actually identical to C<dSP>, and declares
34 a local copy of perl's stack pointer, available via the C<SP> macro.
35 See C<SP>.  (Available for backward source code compatibility with the
36 old (Perl 5.005) thread model.)
37
38 =for apidoc Ams||dMARK
39 Declare a stack marker variable, C<mark>, for the XSUB.  See C<MARK> and
40 C<dORIGMARK>.
41
42 =for apidoc Ams||dORIGMARK
43 Saves the original stack mark for the XSUB.  See C<ORIGMARK>.
44
45 =for apidoc AmU||ORIGMARK
46 The original stack mark for the XSUB.  See C<dORIGMARK>.
47
48 =for apidoc Ams||SPAGAIN
49 Refetch the stack pointer.  Used after a callback.  See L<perlcall>.
50
51 =cut */
52
53 #undef SP /* Solaris 2.7 i386 has this in /usr/include/sys/reg.h */
54 #define SP sp
55 #define MARK mark
56 #define TARG targ
57
58 #define PUSHMARK(p)     \
59         STMT_START {                                    \
60             if (++PL_markstack_ptr == PL_markstack_max) \
61             markstack_grow();                           \
62             *PL_markstack_ptr = (p) - PL_stack_base;    \
63         } STMT_END
64
65 #define TOPMARK         (*PL_markstack_ptr)
66 #define POPMARK         (*PL_markstack_ptr--)
67
68 #define dSP             register SV **sp = PL_stack_sp
69 #define djSP            dSP
70 #define dMARK           register SV **mark = PL_stack_base + POPMARK
71 #define dORIGMARK       I32 origmark = mark - PL_stack_base
72 #define SETORIGMARK     origmark = mark - PL_stack_base
73 #define ORIGMARK        (PL_stack_base + origmark)
74
75 #define SPAGAIN         sp = PL_stack_sp
76 #define MSPAGAIN        STMT_START { sp = PL_stack_sp; mark = ORIGMARK; } STMT_END
77
78 #define GETTARGETSTACKED targ = (PL_op->op_flags & OPf_STACKED ? POPs : PAD_SV(PL_op->op_targ))
79 #define dTARGETSTACKED SV * GETTARGETSTACKED
80
81 #define GETTARGET targ = PAD_SV(PL_op->op_targ)
82 #define dTARGET SV * GETTARGET
83
84 #define GETATARGET targ = (PL_op->op_flags & OPf_STACKED ? sp[-1] : PAD_SV(PL_op->op_targ))
85 #define dATARGET SV * GETATARGET
86
87 #define dTARG SV *targ
88
89 #define NORMAL PL_op->op_next
90 #define DIE return Perl_die
91 #define DIE_NULL return DieNull
92
93 /*
94 =for apidoc Ams||PUTBACK
95 Closing bracket for XSUB arguments.  This is usually handled by C<xsubpp>.
96 See C<PUSHMARK> and L<perlcall> for other uses.
97
98 =for apidoc Amn|SV*|POPs
99 Pops an SV off the stack.
100
101 =for apidoc Amn|char*|POPp
102 Pops a string off the stack. Deprecated. New code should provide
103 a STRLEN n_a and use POPpx.
104
105 =for apidoc Amn|char*|POPpx
106 Pops a string off the stack.
107 Requires a variable STRLEN n_a in scope.
108
109 =for apidoc Amn|char*|POPpbytex
110 Pops a string off the stack which must consist of bytes i.e. characters < 256.
111 Requires a variable STRLEN n_a in scope.
112
113 =for apidoc Amn|NV|POPn
114 Pops a double off the stack.
115
116 =for apidoc Amn|IV|POPi
117 Pops an integer off the stack.
118
119 =for apidoc Amn|long|POPl
120 Pops a long off the stack.
121
122 =cut
123 */
124
125 #define PUTBACK         PL_stack_sp = sp
126 #define RETURN          return PUTBACK, NORMAL
127 #define RETURNOP(o)     return PUTBACK, o
128 #define RETURNX(x)      return x, PUTBACK, NORMAL
129
130 #define POPs            (*sp--)
131 #define POPp            (SvPVx(POPs, PL_na))            /* deprecated */
132 #define POPpx           (SvPVx(POPs, n_a))
133 #define POPpbytex       (SvPVbytex(POPs, n_a))
134 #define POPn            (SvNVx(POPs))
135 #define POPi            ((IV)SvIVx(POPs))
136 #define POPu            ((UV)SvUVx(POPs))
137 #define POPl            ((long)SvIVx(POPs))
138 #define POPul           ((unsigned long)SvIVx(POPs))
139 #ifdef HAS_QUAD
140 #define POPq            ((Quad_t)SvIVx(POPs))
141 #define POPuq           ((Uquad_t)SvUVx(POPs))
142 #endif
143
144 #define TOPs            (*sp)
145 #define TOPm1s          (*(sp-1))
146 #define TOPp1s          (*(sp+1))
147 #define TOPp            (SvPV(TOPs, PL_na))             /* deprecated */
148 #define TOPpx           (SvPV(TOPs, n_a))
149 #define TOPn            (SvNV(TOPs))
150 #define TOPi            ((IV)SvIV(TOPs))
151 #define TOPu            ((UV)SvUV(TOPs))
152 #define TOPl            ((long)SvIV(TOPs))
153 #define TOPul           ((unsigned long)SvUV(TOPs))
154 #ifdef HAS_QUAD
155 #define TOPq            ((Quad_t)SvIV(TOPs))
156 #define TOPuq           ((Uquad_t)SvUV(TOPs))
157 #endif
158
159 /* Go to some pains in the rare event that we must extend the stack. */
160
161 /*
162 =for apidoc Am|void|EXTEND|SP|int nitems
163 Used to extend the argument stack for an XSUB's return values. Once
164 used, guarantees that there is room for at least C<nitems> to be pushed
165 onto the stack.
166
167 =for apidoc Am|void|PUSHs|SV* sv
168 Push an SV onto the stack.  The stack must have room for this element.
169 Does not handle 'set' magic.  Does not use C<TARG>.  See also C<PUSHmortal>,
170 C<XPUSHs> and C<XPUSHmortal>.
171
172 =for apidoc Am|void|PUSHp|char* str|STRLEN len
173 Push a string onto the stack.  The stack must have room for this element.
174 The C<len> indicates the length of the string.  Handles 'set' magic.  Uses
175 C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to declare it.  Do not
176 call multiple C<TARG>-oriented macros to return lists from XSUB's - see
177 C<mPUSHp> instead.  See also C<XPUSHp> and C<mXPUSHp>.
178
179 =for apidoc Am|void|PUSHn|NV nv
180 Push a double onto the stack.  The stack must have room for this element.
181 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
182 called to declare it.  Do not call multiple C<TARG>-oriented macros to
183 return lists from XSUB's - see C<mPUSHn> instead.  See also C<XPUSHn> and
184 C<mXPUSHn>.
185
186 =for apidoc Am|void|PUSHi|IV iv
187 Push an integer onto the stack.  The stack must have room for this element.
188 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
189 called to declare it.  Do not call multiple C<TARG>-oriented macros to 
190 return lists from XSUB's - see C<mPUSHi> instead.  See also C<XPUSHi> and
191 C<mXPUSHi>.
192
193 =for apidoc Am|void|PUSHu|UV uv
194 Push an unsigned integer onto the stack.  The stack must have room for this
195 element.  Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG>
196 should be called to declare it.  Do not call multiple C<TARG>-oriented
197 macros to return lists from XSUB's - see C<mPUSHu> instead.  See also
198 C<XPUSHu> and C<mXPUSHu>.
199
200 =for apidoc Am|void|XPUSHs|SV* sv
201 Push an SV onto the stack, extending the stack if necessary.  Does not
202 handle 'set' magic.  Does not use C<TARG>.  See also C<XPUSHmortal>,
203 C<PUSHs> and C<PUSHmortal>.
204
205 =for apidoc Am|void|XPUSHp|char* str|STRLEN len
206 Push a string onto the stack, extending the stack if necessary.  The C<len>
207 indicates the length of the string.  Handles 'set' magic.  Uses C<TARG>, so
208 C<dTARGET> or C<dXSTARG> should be called to declare it.  Do not call
209 multiple C<TARG>-oriented macros to return lists from XSUB's - see
210 C<mXPUSHp> instead.  See also C<PUSHp> and C<mPUSHp>.
211
212 =for apidoc Am|void|XPUSHn|NV nv
213 Push a double onto the stack, extending the stack if necessary.  Handles
214 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
215 declare it.  Do not call multiple C<TARG>-oriented macros to return lists
216 from XSUB's - see C<mXPUSHn> instead.  See also C<PUSHn> and C<mPUSHn>.
217
218 =for apidoc Am|void|XPUSHi|IV iv
219 Push an integer onto the stack, extending the stack if necessary.  Handles
220 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be called to
221 declare it.  Do not call multiple C<TARG>-oriented macros to return lists
222 from XSUB's - see C<mXPUSHi> instead.  See also C<PUSHi> and C<mPUSHi>.
223
224 =for apidoc Am|void|XPUSHu|UV uv
225 Push an unsigned integer onto the stack, extending the stack if necessary.
226 Handles 'set' magic.  Uses C<TARG>, so C<dTARGET> or C<dXSTARG> should be
227 called to declare it.  Do not call multiple C<TARG>-oriented macros to
228 return lists from XSUB's - see C<mXPUSHu> instead.  See also C<PUSHu> and
229 C<mPUSHu>.
230
231 =for apidoc Am|void|PUSHmortal
232 Push a new mortal SV onto the stack.  The stack must have room for this
233 element.  Does not handle 'set' magic.  Does not use C<TARG>.  See also
234 C<PUSHs>, C<XPUSHmortal> and C<XPUSHs>.
235
236 =for apidoc Am|void|mPUSHp|char* str|STRLEN len
237 Push a string onto the stack.  The stack must have room for this element.
238 The C<len> indicates the length of the string.  Handles 'set' magic.  Does
239 not use C<TARG>.  See also C<PUSHp>, C<mXPUSHp> and C<XPUSHp>.
240
241 =for apidoc Am|void|mPUSHn|NV nv
242 Push a double onto the stack.  The stack must have room for this element.
243 Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHn>, C<mXPUSHn>
244 and C<XPUSHn>.
245
246 =for apidoc Am|void|mPUSHi|IV iv
247 Push an integer onto the stack.  The stack must have room for this element.
248 Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHi>, C<mXPUSHi>
249 and C<XPUSHi>.
250
251 =for apidoc Am|void|mPUSHu|UV uv
252 Push an unsigned integer onto the stack.  The stack must have room for this
253 element.  Handles 'set' magic.  Does not use C<TARG>.  See also C<PUSHu>,
254 C<mXPUSHu> and C<XPUSHu>.
255
256 =for apidoc Am|void|XPUSHmortal
257 Push a new mortal SV onto the stack, extending the stack if necessary.  Does
258 not handle 'set' magic.  Does not use C<TARG>.  See also C<XPUSHs>,
259 C<PUSHmortal> and C<PUSHs>.
260
261 =for apidoc Am|void|mXPUSHp|char* str|STRLEN len
262 Push a string onto the stack, extending the stack if necessary.  The C<len>
263 indicates the length of the string.  Handles 'set' magic.  Does not use
264 C<TARG>.  See also C<XPUSHp>, C<mPUSHp> and C<PUSHp>.
265
266 =for apidoc Am|void|mXPUSHn|NV nv
267 Push a double onto the stack, extending the stack if necessary.  Handles
268 'set' magic.  Does not use C<TARG>.  See also C<XPUSHn>, C<mPUSHn> and
269 C<PUSHn>.
270
271 =for apidoc Am|void|mXPUSHi|IV iv
272 Push an integer onto the stack, extending the stack if necessary.  Handles
273 'set' magic.  Does not use C<TARG>.  See also C<XPUSHi>, C<mPUSHi> and
274 C<PUSHi>.
275
276 =for apidoc Am|void|mXPUSHu|UV uv
277 Push an unsigned integer onto the stack, extending the stack if necessary.
278 Handles 'set' magic.  Does not use C<TARG>.  See also C<XPUSHu>, C<mPUSHu>
279 and C<PUSHu>.
280
281 =cut
282 */
283
284 #define EXTEND(p,n)     STMT_START { if (PL_stack_max - p < (int)(n)) {         \
285                             sp = stack_grow(sp,p, (int) (n));           \
286                         } } STMT_END
287
288 /* Same thing, but update mark register too. */
289 #define MEXTEND(p,n)    STMT_START {if (PL_stack_max - p < (int)(n)) {          \
290                             int markoff = mark - PL_stack_base;         \
291                             sp = stack_grow(sp,p,(int) (n));            \
292                             mark = PL_stack_base + markoff;             \
293                         } } STMT_END
294
295 #define PUSHs(s)        (*++sp = (s))
296 #define PUSHTARG        STMT_START { SvSETMAGIC(TARG); PUSHs(TARG); } STMT_END
297 #define PUSHp(p,l)      STMT_START { sv_setpvn(TARG, (p), (l)); PUSHTARG; } STMT_END
298 #define PUSHn(n)        STMT_START { sv_setnv(TARG, (NV)(n)); PUSHTARG; } STMT_END
299 #define PUSHi(i)        STMT_START { sv_setiv(TARG, (IV)(i)); PUSHTARG; } STMT_END
300 #define PUSHu(u)        STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END
301
302 #define XPUSHs(s)       STMT_START { EXTEND(sp,1); (*++sp = (s)); } STMT_END
303 #define XPUSHTARG       STMT_START { SvSETMAGIC(TARG); XPUSHs(TARG); } STMT_END
304 #define XPUSHp(p,l)     STMT_START { sv_setpvn(TARG, (p), (l)); XPUSHTARG; } STMT_END
305 #define XPUSHn(n)       STMT_START { sv_setnv(TARG, (NV)(n)); XPUSHTARG; } STMT_END
306 #define XPUSHi(i)       STMT_START { sv_setiv(TARG, (IV)(i)); XPUSHTARG; } STMT_END
307 #define XPUSHu(u)       STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
308 #define XPUSHundef      STMT_START { SvOK_off(TARG); XPUSHs(TARG); } STMT_END
309
310 #define PUSHmortal      PUSHs(sv_newmortal())
311 #define mPUSHp(p,l)     sv_setpvn_mg(PUSHmortal, (p), (l))
312 #define mPUSHn(n)       sv_setnv_mg(PUSHmortal, (NV)(n))
313 #define mPUSHi(i)       sv_setiv_mg(PUSHmortal, (IV)(i))
314 #define mPUSHu(u)       sv_setuv_mg(PUSHmortal, (UV)(u))
315
316 #define XPUSHmortal     XPUSHs(sv_newmortal())
317 #define mXPUSHp(p,l)    STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
318 #define mXPUSHn(n)      STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END
319 #define mXPUSHi(i)      STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END
320 #define mXPUSHu(u)      STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END
321
322 #define SETs(s)         (*sp = s)
323 #define SETTARG         STMT_START { SvSETMAGIC(TARG); SETs(TARG); } STMT_END
324 #define SETp(p,l)       STMT_START { sv_setpvn(TARG, (p), (l)); SETTARG; } STMT_END
325 #define SETn(n)         STMT_START { sv_setnv(TARG, (NV)(n)); SETTARG; } STMT_END
326 #define SETi(i)         STMT_START { sv_setiv(TARG, (IV)(i)); SETTARG; } STMT_END
327 #define SETu(u)         STMT_START { sv_setuv(TARG, (UV)(u)); SETTARG; } STMT_END
328
329 #define dTOPss          SV *sv = TOPs
330 #define dPOPss          SV *sv = POPs
331 #define dTOPnv          NV value = TOPn
332 #define dPOPnv          NV value = POPn
333 #define dTOPiv          IV value = TOPi
334 #define dPOPiv          IV value = POPi
335 #define dTOPuv          UV value = TOPu
336 #define dPOPuv          UV value = POPu
337 #ifdef HAS_QUAD
338 #define dTOPqv          Quad_t value = TOPu
339 #define dPOPqv          Quad_t value = POPu
340 #define dTOPuqv         Uquad_t value = TOPuq
341 #define dPOPuqv         Uquad_t value = POPuq
342 #endif
343
344 #define dPOPXssrl(X)    SV *right = POPs; SV *left = CAT2(X,s)
345 #define dPOPXnnrl(X)    NV right = POPn; NV left = CAT2(X,n)
346 #define dPOPXiirl(X)    IV right = POPi; IV left = CAT2(X,i)
347
348 #define USE_LEFT(sv) \
349         (SvOK(sv) || SvGMAGICAL(sv) || !(PL_op->op_flags & OPf_STACKED))
350 #define dPOPXnnrl_ul(X) \
351     NV right = POPn;                            \
352     SV *leftsv = CAT2(X,s);                             \
353     NV left = USE_LEFT(leftsv) ? SvNV(leftsv) : 0.0
354 #define dPOPXiirl_ul(X) \
355     IV right = POPi;                                    \
356     SV *leftsv = CAT2(X,s);                             \
357     IV left = USE_LEFT(leftsv) ? SvIV(leftsv) : 0
358
359 #define dPOPPOPssrl     dPOPXssrl(POP)
360 #define dPOPPOPnnrl     dPOPXnnrl(POP)
361 #define dPOPPOPnnrl_ul  dPOPXnnrl_ul(POP)
362 #define dPOPPOPiirl     dPOPXiirl(POP)
363 #define dPOPPOPiirl_ul  dPOPXiirl_ul(POP)
364
365 #define dPOPTOPssrl     dPOPXssrl(TOP)
366 #define dPOPTOPnnrl     dPOPXnnrl(TOP)
367 #define dPOPTOPnnrl_ul  dPOPXnnrl_ul(TOP)
368 #define dPOPTOPiirl     dPOPXiirl(TOP)
369 #define dPOPTOPiirl_ul  dPOPXiirl_ul(TOP)
370
371 #define RETPUSHYES      RETURNX(PUSHs(&PL_sv_yes))
372 #define RETPUSHNO       RETURNX(PUSHs(&PL_sv_no))
373 #define RETPUSHUNDEF    RETURNX(PUSHs(&PL_sv_undef))
374
375 #define RETSETYES       RETURNX(SETs(&PL_sv_yes))
376 #define RETSETNO        RETURNX(SETs(&PL_sv_no))
377 #define RETSETUNDEF     RETURNX(SETs(&PL_sv_undef))
378
379 #define ARGTARG         PL_op->op_targ
380
381     /* See OPpTARGET_MY: */
382 #define MAXARG          (PL_op->op_private & 15)
383
384 #define SWITCHSTACK(f,t) \
385     STMT_START {                                                        \
386         AvFILLp(f) = sp - PL_stack_base;                                \
387         PL_stack_base = AvARRAY(t);                                     \
388         PL_stack_max = PL_stack_base + AvMAX(t);                        \
389         sp = PL_stack_sp = PL_stack_base + AvFILLp(t);                  \
390         PL_curstack = t;                                                \
391     } STMT_END
392
393 #define EXTEND_MORTAL(n) \
394     STMT_START {                                                        \
395         if (PL_tmps_ix + (n) >= PL_tmps_max)                            \
396             tmps_grow(n);                                               \
397     } STMT_END
398
399 #define AMGf_noright    1
400 #define AMGf_noleft     2
401 #define AMGf_assign     4
402 #define AMGf_unary      8
403
404 #define tryAMAGICbinW(meth,assign,set) STMT_START { \
405           if (PL_amagic_generation) { \
406             SV* tmpsv; \
407             SV* right= *(sp); SV* left= *(sp-1);\
408             if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
409                 (tmpsv=amagic_call(left, \
410                                    right, \
411                                    CAT2(meth,_amg), \
412                                    (assign)? AMGf_assign: 0))) {\
413                SPAGAIN; \
414                (void)POPs; set(tmpsv); RETURN; } \
415           } \
416         } STMT_END
417
418 #define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv)
419 #define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs)
420
421 #define AMG_CALLun(sv,meth) amagic_call(sv,&PL_sv_undef,  \
422                                         CAT2(meth,_amg),AMGf_noright | AMGf_unary)
423 #define AMG_CALLbinL(left,right,meth) \
424             amagic_call(left,right,CAT2(meth,_amg),AMGf_noright)
425
426 #define tryAMAGICunW(meth,set,shift,ret) STMT_START { \
427           if (PL_amagic_generation) { \
428             SV* tmpsv; \
429             SV* arg= sp[shift]; \
430           if(0) goto am_again;  /* shut up unused warning */ \
431           am_again: \
432             if ((SvAMAGIC(arg))&&\
433                 (tmpsv=AMG_CALLun(arg,meth))) {\
434                SPAGAIN; if (shift) sp += shift; \
435                set(tmpsv); ret; } \
436           } \
437         } STMT_END
438
439 #define FORCE_SETs(sv) STMT_START { sv_setsv(TARG, (sv)); SETTARG; } STMT_END
440
441 #define tryAMAGICun(meth)       tryAMAGICunW(meth,SETsvUN,0,RETURN)
442 #define tryAMAGICunSET(meth)    tryAMAGICunW(meth,SETs,0,RETURN)
443 #define tryAMAGICunTARGET(meth, shift)                                  \
444         STMT_START { dSP; sp--;         /* get TARGET from below PL_stack_sp */         \
445             { dTARGETSTACKED;                                           \
446                 { dSP; tryAMAGICunW(meth,FORCE_SETs,shift,RETURN);}}} STMT_END
447
448 #define setAGAIN(ref)   \
449     STMT_START {                                        \
450         sv = ref;                                       \
451         if (!SvROK(ref))                                \
452             Perl_croak(aTHX_ "Overloaded dereference did not return a reference");      \
453         if (ref != arg && SvRV(ref) != SvRV(arg)) {     \
454             arg = ref;                                  \
455             goto am_again;                              \
456         }                                               \
457     } STMT_END
458
459 #define tryAMAGICunDEREF(meth) tryAMAGICunW(meth,setAGAIN,0,(void)0)
460
461 #define opASSIGN (PL_op->op_flags & OPf_STACKED)
462 #define SETsv(sv)       STMT_START {                                    \
463                 if (opASSIGN || (SvFLAGS(TARG) & SVs_PADMY))            \
464                    { sv_setsv(TARG, (sv)); SETTARG; }                   \
465                 else SETs(sv); } STMT_END
466
467 #define SETsvUN(sv)     STMT_START {                                    \
468                 if (SvFLAGS(TARG) & SVs_PADMY)          \
469                    { sv_setsv(TARG, (sv)); SETTARG; }                   \
470                 else SETs(sv); } STMT_END
471
472 /* newSVsv does not behave as advertised, so we copy missing
473  * information by hand */
474
475 /* SV* ref causes confusion with the member variable
476    changed SV* ref to SV* tmpRef */
477 #define RvDEEPCP(rv) STMT_START { SV* tmpRef=SvRV(rv);      \
478   if (SvREFCNT(tmpRef)>1) {                 \
479     SvRV_set(rv, AMG_CALLun(rv,copy));  \
480     SvREFCNT_dec(tmpRef);                   \
481   } } STMT_END
482
483 /*
484 =for apidoc mU||LVRET
485 True if this op will be the return value of an lvalue subroutine
486
487 =cut */
488 #define LVRET ((PL_op->op_private & OPpMAYBE_LVSUB) && is_lvalue_sub())