File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -2370,6 +2370,24 @@ need a C<dTARG> in your variable declarations so that the C<*PUSH*>
23702370macros can make use of the local variable C<TARG>. See also
23712371C<dTARGET> and C<dXSTARG>.
23722372
2373+ Be careful with TARG: each non-recursive call to your OP, or XSUB for
2374+ dXSTARG, will use the same SV for TARG for each call, so you can't
2375+ assume the SV is pristine since the results from the previous call to
2376+ your OP or XSUB may still be in TARG.
2377+
2378+ Other state such as a cached numeric version of a PV or the cached
2379+ UTF-8 length may also be set. You can avoid problems with this by
2380+ using the normal sv_set*() APIs instead of trying to optimize by
2381+ directly manipulating the SV.
2382+
2383+ For OPs that implement the C<OA_TARGLEX> optimization, TARG may be
2384+ special in other ways, there may be references to it, it might be
2385+ blessed, it might be tied, or magical in other ways.
2386+
2387+ You must not use TARG to return a reference, since that reference will
2388+ be live until the next time the OP or XSUB executes non-recursively,
2389+ or until perl exits.
2390+
23732391=head2 Scratchpads
23742392
23752393The question remains on when the SVs which are I<target>s for opcodes
You can’t perform that action at this time.
0 commit comments