summaryrefslogtreecommitdiff
path: root/cop.h
Commit message (Collapse)AuthorAgeFilesLines
* Recursive MULTICALL prematurely freed CVDavid Mitchell2010-10-191-2/+2
| | | | | | | | See [perl #78070]. Basically, POPSUB/LEAVESUB had a mechanism to decrement the reference count of the CV only at CvDEPTH==1; POP_MULTICALL was decrementing it at all depths.
* Define CxPADLOOP unconditionally, as post f83b46a0 it is always used.Nicholas Clark2010-09-091-3/+1
| | | | Previously it was only used under -DITHREADS
* bad things happened with for $x (...) { *x = *y }David Mitchell2010-09-081-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | fix for [perl #21469]: since the GP may be pulled from under us and freed, coredumps and strange things can happen. Fix this by storing a pointer to the GV in the loop block, rather than a pointer to the GvSV slot. The ITHREADS variant already stores GV rather than than &GvSV; extend this to non-threaded builds too. Also, for both threaded and non-threaded, it used to push &GvSV on the save stack. Fix this by introducing a new save type, SAVEt_GVSV. This behaves similarly to SAVEt_SV, but without magic get/set. This means that for $package_var (...) is now close in behaviour to local $package_var = ... (except for the magic bit).
* create itervar_u union in struct block_loopDavid Mitchell2010-09-081-19/+12
| | | | | | | make it clearer what types of pointer to the iterator variable can be stored, reduce the amount of #ifdef USE_ITHREADS, get rid of some macros, and generally make the code easier to follow. No change to the size of the structure.
* eliminate targoffset from struct block_loopDavid Mitchell2010-09-081-6/+4
| | | | This value is also available via via cx->blk_loop.my_op->op_targ
* eliminate next_op from struct block_loopDavid Mitchell2010-09-081-13/+0
| | | | | | This field is only used in non-threaded builds, and the comments imply that this is because in non-threaded builds this value may be modified. But nothing in core modifies it.
* Change the first argument of Perl_fetch_cop_label() to COP *Nicholas Clark2010-09-021-1/+1
| | | | | | | | | | From a suggestion from Ben Morrow. The first argument used to be struct refcounted_he *, which exposed an implementation detail - that the COP's labels are (now) stored in this way. Google Code Search and an unpacked CPAN both fail to find any users of this API, so the impact should be minimal.
* Revert "Fix off-by-one: avoid allocating an extra context"Chip Salzenberg2010-07-271-1/+1
| | | | | This reverts commit 395b8e2d02eadc9b0639534410c39c530bc8a33d. The fencepost error is coming from inside the programmer!
* Fix off-by-one: avoid allocating an extra contextChip Salzenberg2010-07-271-1/+1
| | | | (patch req by Nicholas)
* Stop using WITH_THR and WITH_THX, as they were never necessary here.Nicholas Clark2010-06-161-2/+2
|
* Merge remote branch 'zefram/zefram/reliable_exception' into bleadRafael Garcia-Suarez2010-05-041-1/+1
|\ | | | | | | | | Conflicts: pp_ctl.c
| * bring G_KEEPERR back to the realm of sanityZefram2010-04-231-1/+1
| | | | | | | | | | | | | | | | | | Makes the G_KEEPERR logic more consistent, and in particular make it sensibly handle non-string exceptions. An exception in a destructor is now always emitted as a warning, and never copied or merged into $@ of the surrounding context. No more clobbering exceptions being handled elsewhere, and no more double reporting. This fixes the rest of [perl #74538].
* | For Perl_magic_methcall() add G_UNDEF_FILL to fill the stack with &PL_sv_undef.Nicholas Clark2010-04-261-0/+3
|/ | | | | | This replaces the previous special case of using a negative argument count to signify this, allowing the argument count to become unsigned. Rename it from n to argc.
* Move PERL_ASYNC_CHECK() from POPBLOCK() to the kill case of Perl_apply().Nicholas Clark2010-04-181-1/+0
| | | | | | This ensures that (safe) signals sent to the same process are still dispatched within the same statement (as before), without overloading the semantics of block popping.
* Move PERL_ASYNC_CHECK() from the runloop to control flow OPs.Nicholas Clark2010-04-151-0/+1
| | | | | | | | | For the typical code this gives a 5% speedup, and removes the cost of "safe signals". Tight looping code will show less gains, but should never be slower. Subtle bugs might remain - there might be constructions that enter the runloop (where signals used to be dispatched) but don't contain any PERL_ASYNC_CHECK() calls themselves.
* more mods to -Dl debugging outputDavid Mitchell2010-04-061-9/+6
|
* improve -Dl debugging outputDavid Mitchell2010-03-301-21/+61
| | | | | In particular, distinguish between scope and context stack push/pops, show depth of JUMPENV stack, and show STACKINFO push/pops
* Eliminate OP_SETSTATE from cop.h headerReini Urban2009-12-131-3/+3
| | | | | | | | | It had been added with change 3728 to track linenumbers in optimized else, disabled by change 4309, and removed with change 33072. Bump copyright, latest change was "Fix MULTICALL in List-Util" 2009-03-07 with commit 1bbbfc50
* Add line information to jumplevel debug informationGerard Goossen2009-11-121-4/+6
| | | | | | | | | | | | | Add information about where in the C code the jumplevel poping/setting up was done. Gerard From 7b95a19d6fbd3615a034cea79fa087b80e4a9555 Mon Sep 17 00:00:00 2001 From: Gerard Goossen <gerard@ggoossen.net> Date: Thu, 12 Nov 2009 16:50:13 +0100 Subject: [PATCH] Add line information to jumplevel debug information provided when using -Dl Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
* Add assertion to JMPENV_POP to assert that the jumplevel popped is the top ↵Gerard Goossen2009-10-311-0/+1
| | | | level jumplevel
* Add clear magic to %^H so that the HE chain is reset when you empty it.Zefram2009-08-211-4/+9
| | | | This fixes [perl #68590] : %^H not lexical enough.
* Remove all #ifdef MACOS_TRADITIONAL code in core and non-dual-life XS code.Nicholas Clark2009-04-271-5/+1
| | | | | | | | (MacOS support was removed from MakeMaker in 6.22, and merged to blead on 15th December 2004 with 5dca256ec738057dc331fb644a93eca44ad5fa14. After this point MacOS wouldn't even have been able to build the perl binary, because it would not have been able to build DynaLoader. If anyone wishes to resurrect MacOS, start by reversing this commit and the relevant part of that commit.)
* Fix MULTICALL in List-UtilAlex Vandiver2009-03-071-0/+3
| | | | | | | | Add a new stack frame; the MULTICALL code in pp_return assumes there is a clean stack, and blindly changes the top-most stack value. This change brings cop.h more in line with the "poor-man's MULTICALL" provided in ext/List-Util/multicall.h, which also always pushes a new stack.
* rxres_free() and rxres_restore() are only used in pp_ctl.c, so can beNicholas Clark2008-11-261-4/+6
| | | | | static. Macros PUSHSUBST() and POPSUBST() are only viable in PERL_CORE. p4raw-id: //depot/perl@34935
* A couple of (COP*)s that can actually be (const COP *)s.Nicholas Clark2008-10-281-2/+2
| | | p4raw-id: //depot/perl@34621
* Convert all (CV *) casts to (const CV *). Convert (XPVCV*) casts to addNicholas Clark2008-10-271-4/+4
| | | | | MUTABLE_PTR(), to validate that there is no casting away of const. p4raw-id: //depot/perl@34610
* Add a macro MUTABLE_PTR(p), which on (non-pedantic) gcc will not castNicholas Clark2008-10-271-2/+2
| | | | | | | | | | away const, returning a void *. Add MUTABLE_SV(sv) which uses this, and replace all (SV *) casts either with MUTABLE_SV(sv), or (const SV *). This probably still needs some work - assigning to SvPVX() and SvRV() is now likely to generate a casting error. The core doesn't do this. But as-is it's finding bugs that can be fixed. p4raw-id: //depot/perl@34605
* Update copyright years.Nicholas Clark2008-10-251-2/+2
| | | p4raw-id: //depot/perl@34585
* Eliminate cop_label from struct cop by storing a label as the firstNicholas Clark2008-04-071-11/+3
| | | | | | entry in the hints hash. Most statements don't have labels, so this will save memory. Not sure how much. p4raw-id: //depot/perl@33656
* Change 33653 (inevitably) missed one cop_label, because I mistook itNicholas Clark2008-04-061-1/+1
| | | | | for part of some other context-stack related struct. p4raw-id: //depot/perl@33655
* A macro used only once isn't a typing saving, and 3 macro definitionsNicholas Clark2008-04-061-1/+1
| | | | | | | never used are more obfuscation than clarification, so inline the only use of SAVECOPLABEL_FREE(), and remove the unthreaded variant and both SAVECOPLABEL()s. Exterminate! Exterminate! Exterminate! p4raw-id: //depot/perl@33654
* Micro-optimise the order of the context types. [Because I can :-)]Nicholas Clark2008-02-041-12/+19
| | | | | Here saves 72 bytes in pp_ctl.o. Small, but in the right direction. p4raw-id: //depot/perl@33232
* The third argument of PUSHEVAL was never used by anything. Ever.Nicholas Clark2008-01-281-1/+1
| | | p4raw-id: //depot/perl@33086
* The layout for struct block_loop under ithreads can be simplified.Nicholas Clark2008-01-261-17/+18
| | | | | | | | | | | | | Instead of wedging the pad offset into a void* iterdata, and always storing PL_comppad even when it isn't used, instead do this: PAD *oldcomppad; /* Also used for the GV, if targoffset is 0 */ /* This is also accesible via cx->blk_loop.my_op->op_targ */ PADOFFSET targoffset; and store the GV pointer in oldcompad. Pointers to pointers seems cleaner. This also allows us to eliminate the flag bit CXp_PADVAR. p4raw-id: //depot/perl@33081
* Investigation reveals that the work of restoring the iterator to theNicholas Clark2008-01-261-16/+2
| | | | | | | | | | | | | | | | | pad is shared between POPLOOP, using itersave, and the end of scope restore action requested by Perl_save_padsv(). In fact, the only user of SAVEt_PADSV is pp_enteriter, and it already provides enough information to allow it to perform the sv_2mortal() in POPLOOP. So make it do so. Rather than creating a new routine, use the existing routine because nothing else (at least nothing else known to Google's codesearch) uses it. But rename it just in case something we can't see is being naughty and using our private functions - they will get link errors against 5.12. All this means that itersave is now redundant. So remove it. This makes struct context 48 bytes on ILP32 platforms with 32bit IVs, down from 64 bytes in 5.10. 33% more context stack in the same memory. p4raw-id: //depot/perl@33080
* As itersave points to the initial CxITERVAR(), and the state ofNicholas Clark2008-01-261-10/+7
| | | | | | | | | SvPADMY() does not change over the duration of the scope, we can perform conditional actions at loop push time. For the non-pad case, a reference to the initial CxITERVAR() is already held on the scope stack thanks to SAVEGENERICSV(*svp); in pp_enteriter. So there is no need to save another reference to it in itersave - it's not going away. p4raw-id: //depot/perl@33076
* Restore the else block accidently eaten by change 33074.Nicholas Clark2008-01-261-0/+3
| | | p4raw-id: //depot/perl@33075
* In POPLOOP, if CxITERVAR(cx) is non-NULL, then so is itersave, andNicholas Clark2008-01-261-4/+1
| | | | | itersave is a less complex expression for the C compiler. p4raw-id: //depot/perl@33074
* Re: struct context now 12.5% smaller than 5.10Benjamin Smith2008-01-261-28/+24
| | | | | | Message-ID: <20080124215537.GB10198@vtrl.co.uk> Date: Thu, 24 Jan 2008 21:55:37 +0000 p4raw-id: //depot/perl@33070
* In struct block_loop, merge itermax and iterlval into a unionNicholas Clark2008-01-241-18/+10
| | | | | | | | | lval_max_u, as CXt_LOOP_LAZYIV doesn't use iterlval and the other LOOP types don't use itermax. This reduces struct block_loop by 1 IV. As it's the largest component of the unions making up struct context, this reduces struct context. On ILP32 it will now be 56 bytes, down from the 64 of 5.10.x, as I've already removed the element 'label'. p4raw-id: //depot/perl@33063
* Merge CXt_LOOP_STACK's use of itermax for the reverse minimum withNicholas Clark2008-01-241-5/+9
| | | | | iterary, as the two structure members are not used simultaneously. p4raw-id: //depot/perl@33062
* Change the context type of for ($a .. $b) to CXt_LOOP_LAZYIV, andNicholas Clark2008-01-241-3/+6
| | | | | | assert that it isn't using cx->blk_loop.iterlval. Fix a casting bug when assigning a sentinal to cx->blk_loop.iterary. p4raw-id: //depot/perl@33061
* Split out foreach iterations of temporary lists on the stack toNicholas Clark2008-01-241-2/+3
| | | | | CXt_LOOP_STACK. Don't use cx->blk_loop.iterary to store PL_curstack. p4raw-id: //depot/perl@33059
* Split CXt_LOOP into CXt_LOOP_PLAIN and CXt_LOOP_FOR, eliminating theNicholas Clark2008-01-241-11/+20
| | | | | CXp_FOREACH flag added as part of given/when. p4raw-id: //depot/perl@33057
* Eliminate the U8 sbu_once from struct subst, and shrink sbu_rflags fromNicholas Clark2008-01-211-5/+5
| | | | | I32 to U8, which reduces the size of the struct by at least 4 bytes. p4raw-id: //depot/perl@33035
* In struct block_subst, access the member once via a macro CxONCE()Nicholas Clark2008-01-211-0/+2
| | | | | which will allow the storage location to be changed. p4raw-id: //depot/perl@33034
* Tidy up context type flags.Nicholas Clark2008-01-211-10/+9
| | | p4raw-id: //depot/perl@33032
* In struct block_eval, eliminate old_in_eval and old_op_type by storingNicholas Clark2008-01-211-7/+10
| | | | | the data in blk_u16. p4raw-id: //depot/perl@33030
* In struct block_eval, access the members old_in_eval and old_op_typeNicholas Clark2008-01-211-2/+5
| | | | | | via macros CxOLD_IN_EVAL() and CxOLD_OP_TYPE(), which will allow the storage location to be changed. p4raw-id: //depot/perl@33029
* In struct block change blku_type from U8 to U16, and the "spare" U8 toNicholas Clark2008-01-211-10/+9
| | | | | | U16, with the lockstep changes in struct subst. Eliminate lval from struct block_sub, and instead store it in the U16 in struct block. p4raw-id: //depot/perl@33028