summaryrefslogtreecommitdiff
path: root/av.h
Commit message (Collapse)AuthorAgeFilesLines
* Skip trailing constants when searching padsFather Chrysostomos2013-07-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under ithreads, constants and GVs are stored in the pad. When names are looked up up in a pad, the search begins at the end and works its way toward the beginning, so that an $x declared later masks one declared earlier. If there are many constants at the end of the pad, which can happen for generated code such as lib/unicore/TestProp.pl (which has about 100,000 lines and over 500,000 pad entries for constants at the end of the file scope’s pad), it can take a long time to search through them all. Before commit 325e1816, constants used &PL_sv_undef ‘names’. Since that is the default value for array elements (when viewed directly through AvARRAY, rather than av_fetch), the pad allocation code did not even bother storing the ‘name’ for these. So the name pad (aka padnamelist) was not extended, leaving just 10 entries or so in the case of lib/unicore/TestProp.pl. Commit 325e1816 make pad constants have &PL_sv_no names, so the name pad would be implicitly extended as a result of storing &PL_sv_no, causing a huge slowdown in t/re/uniprops.t (which runs lib/unicore/TestProp.pl) under threaded builds. Now, normally the name pad *does* get extended to match the pad, in pad_tidy, but that is skipped for string eval (and required file scope, of course). Hence, wrapping the contents of lib/unicore/TestProp.pl in a sub or adding ‘my $x’ to end of it will cause the same slowdown before 325e1816. lib/unicore/TestProp.pl just happened to be written (ok, generated) in such a way that it ended up with a small name pad. This commit fixes things to make them as fast as before by recording the index of the last named variable in the pad. Anything following that is disregarded in pad lookup and search begins with the last named variable. (This actually does make things faster before for subs with many trailing constants in the pad.) This is not a complete fix. Adding ‘my $x’ to the end of a large file like lib/unicore/TestProp.pl will make it just as slow again. Ultimately we need another algorithm, such as a binary search.
* Add av_tindex() synonym for av_top_index()Karl Williamson2013-02-081-0/+4
| | | | | The latter is a somewhat less clumsy name. The old one is provided a a very clear name; the new one as a somewhat slangy version
* Change name 'av_top' to 'av_top_index'Karl Williamson2013-02-081-1/+1
| | | | | | | | In using the av_top() function created in a recent commit, I found myself being confused, and thinking it meant the top element of the array, whereas it really means the index of the top element of that array. Since the new name has not appeared in a stable release, it can be changed, without remorse, to include 'index' in it.
* Add av_top() synonym for av_len()Karl Williamson2013-01-191-1/+1
| | | | av_len() is misleadingly named.
* update the editor hints for spaces, not tabsRicardo Signes2012-05-291-2/+2
| | | | | This updates the editor hints in our files for Emacs and vim to request that tabs be inserted as spaces.
* [perl #97020] Carp (actually caller) leaking memoryFather Chrysostomos2011-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit eff7e72c3 (Detect incomplete caller overrides in Carp) used this little trick for detecting a @DB::args that an overridden caller() failed to set: + @args = \$i; # A sentinal, which no-one else has the address of But there is a bug in caller(). The first time caller tries to write to @DB::args, it calls Perl_init_dbargs first. That function checks whether @DB::args is AvREAL, in case someone has assigned to it, and takes appropriate measures. But caller doesn’t bother calling Perl_init_dbargs more than once. So manually-assigned items in @DB::args would leak, starting with the *second* call to caller. Commit eff7e72c3 triggered that bug, resulting in a regression in Carp, in that it started leaking. eff7e72c3 was backported to 5.12.2 with commit 97705941a4, so in both 5.12 and 5.14 Carp is affected. This bug (the caller bug, not Carp’s triggering thereof) also affects any caller overrides that set @DB::args themselves, if there are alternate calls to the overridden caller and CORE::caller. This commit fixes that by changing the if (!PL_dbargs) condition in pp_caller to if (!PL_dbargs || AvREAL(PL_dbargs)). I.e., if @args is either uninitialised or AvREAL then call Perl_init_dbargs. Perl_init_dbargs also has a bug in it, that this fixes: The array not only needs AvREAL turned off, but also AvREIFY turned on, so that assignments to it that occur after its initialisation turn AvREAL back on again. (In fact, Larry Wall added a comment suggesting this back in perl 5.000.)
* perlapi.pod EnhancementsShlomi Fish2011-07-181-0/+2
| | | | | This is a patch to enhance perlapi.pod by providing Perl equivalents and clarifying documentation where appropriate.
* Remove union _xivu from struct xpvav - replace it with a non-union xav_alloc.Nicholas Clark2010-05-211-4/+2
| | | | This was the only user of xivu_p1 in union _xivu, so remove that too.
* In the SV body, exchange the positions of the NV and stash/magic.Nicholas Clark2010-05-211-2/+3
|
* Eliminate *_ALLOCATED_HEAD and *_HEAD macros which are now used only once.Nicholas Clark2009-08-221-12/+3
|
* Eliminate the remaining definitions for *_allocated structs.Nicholas Clark2009-08-221-5/+0
|
* Add MUTABLE_AV(), and remove (AV *) casts from headers.Nicholas Clark2008-10-271-2/+2
| | | p4raw-id: //depot/perl@34608
* 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
* Deprecate (and remove core use of ) Nullav, Nullcv, Nullgv, Nullhe,Nicholas Clark2008-01-231-1/+5
| | | | | Nullhek and Nullhv. Nullop is going to be a bit less simple. p4raw-id: //depot/perl@33051
* factor out duplicate code in struct xpv*Marcus Holland-Moritz2007-12-301-41/+15
| | | | | Message-ID: <20071229181742.1933db40@r2d2> p4raw-id: //depot/perl@32783
* Perl_newAV() can become a mathom by making newAV() a wrapper aroundNicholas Clark2007-12-201-0/+10
| | | | | newSV_type() and tweaking Perl_sv_upgrade(). p4raw-id: //depot/perl@32675
* Update copyright years to include 2007. (Plus a couple of 2006s andNicholas Clark2007-01-021-1/+1
| | | | | earlier we missed in av.h and hv.h) p4raw-id: //depot/perl@29670
* Remove the vestigal "#if 0"s from header files that defined same-sizedNicholas Clark2007-01-021-4/+0
| | | | | *allocated structs, as these are not going to be needed again. p4raw-id: //depot/perl@29664
* Move all the FBM data fields from the table into a struct xbm_s whichNicholas Clark2006-12-281-0/+5
| | | | | is part of the xnv union. p4raw-id: //depot/perl@29634
* Move the low/high cop sequences from NVX/IVX to a two U32 structureNicholas Clark2006-12-281-0/+4
| | | | | | in the xnv union. This frees up IVX for the PL_generation code, which in turn will allow SvCUR to return to its real purpose. p4raw-id: //depot/perl@29630
* Move the GvNAME HEK into the IV union - every GV is now 1 pointerNicholas Clark2006-03-051-0/+4
| | | | | smaller. p4raw-id: //depot/perl@27380
* xgv_stash can be stored as a union with the NV, reducing the size ofNicholas Clark2006-02-251-1/+4
| | | | | PVGVs by another pointer. p4raw-id: //depot/perl@27326
* Store the stash for our in the magic slot. This will allow us to useNicholas Clark2006-02-241-2/+8
| | | | | | PVMGs in pad names where previously PVGVs were used. In turn, this gives much greater flexibility for the layout of PVGVs. p4raw-id: //depot/perl@27312
* Fix obsolete identifiers in commentRafael Garcia-Suarez2005-09-151-2/+2
| | | p4raw-id: //depot/perl@25417
* Attempt 2 at a diet memory layout can go live.Nicholas Clark2005-05-311-1/+1
| | | p4raw-id: //depot/perl@24649
* Goodbye xav_arylen. You won't be missed that much.Nicholas Clark2005-05-291-3/+1
| | | | | So now there's a buy 5 get one free offer on PVAV bodies. p4raw-id: //depot/perl@24619
* Change the IV to a union.Nicholas Clark2005-05-291-21/+12
| | | | | | | | Revert the NV union back to a plain NV Transpose the positions of IV and NV (NV is now first) Don't allocate the NV for PV,PVIV,PVAV and PVHV (last 2 non-allocations currently disabled by default) p4raw-id: //depot/perl@24617
* Rename the members of the SV head union to avoid pre-processorNicholas Clark2005-05-261-1/+1
| | | | | arguments with embed.h p4raw-id: //depot/perl@24590
* I think for now these have to be disabled by default.Nicholas Clark2005-05-251-1/+1
| | | p4raw-id: //depot/perl@24572
* Reorder the union to cause Win32 compilers to use void * alignment forNicholas Clark2005-05-241-1/+1
| | | | | it. p4raw-id: //depot/perl@24569
* Don't allocate an IV slot where the type doesn't use the IV slot.Nicholas Clark2005-05-231-0/+19
| | | p4raw-id: //depot/perl@24557
* create an "allocated" structure for PVs, PVAVs and PVHVsNicholas Clark2005-05-231-0/+2
| | | p4raw-id: //depot/perl@24544
* Re-order IVX slot in SV bodiesNicholas Clark2005-05-221-2/+12
| | | p4raw-id: //depot/perl@24542
* Add a union in place of xnv_nv, which allows AVs and HVs to re-useNicholas Clark2005-05-211-7/+17
| | | | | | | the memory to store pointers and integers. (Part 1 - will be reworked to be more efficient when IV or void* is 64 bit soon) p4raw-id: //depot/perl@24538
* Move the xpv_pv/xrv_rv member into the SV head, in a union withNicholas Clark2005-05-211-2/+1
| | | | | IV and UV. Avoid allocating a body for IVs and RVs. p4raw-id: //depot/perl@24531
* Goodbye AvFLAGSNicholas Clark2005-05-201-17/+9
| | | p4raw-id: //depot/perl@24518
* Fix up Larry's copyright statements to my best knowledge.Jarkko Hietaniemi2003-04-161-1/+2
| | | | | | | (Lots of Perl 5 source code archaeology was involved.) Larry didn't make strangled noises when I showed him the patch, either :-) p4raw-id: //depot/perl@19242
* Reverse copyright update (#18801) for files not changed in 2003.Hugo van der Sanden2003-03-021-1/+1
| | | p4raw-id: //depot/perl@18807
* Update all copyrights to 2003, from JarkkoHugo van der Sanden2003-03-021-1/+1
| | | p4raw-id: //depot/perl@18801
* Negative subscripts optionally passed to tied array methodsMark-Jason Dominus2002-08-171-0/+1
| | | | | Message-id: <20020415033855.6343.qmail@plover.com> p4raw-id: //depot/perl@17727
* Copyright++. (Not all the toplevel *.h have one, it seems.)Jarkko Hietaniemi2002-01-231-1/+1
| | | p4raw-id: //depot/perl@14391
* Missed the =head1 additions.Jarkko Hietaniemi2002-01-031-0/+4
| | | p4raw-id: //depot/perl@14041
* av.h cosmeticsSimon Cozens2001-03-301-1/+1
| | | | | Message-ID: <20010330181228.A9319@netthink.co.uk> p4raw-id: //depot/perl@9476
* Bump up Larry's copyright.Jarkko Hietaniemi2001-01-011-1/+1
| | | p4raw-id: //depot/perl@8289
* tweak comment about @DB::argsGurusamy Sarathy2000-06-081-2/+2
| | | p4raw-id: //depot/perl@6215
* set SvUTF8 on vectors only if there are chars > 127; update copyrightGurusamy Sarathy2000-02-061-1/+1
| | | | | years (from Gisle Aas) p4raw-id: //depot/perl@5009
* autogenerate API listing from comments in the source (from BenjaminGurusamy Sarathy2000-01-281-0/+10
| | | | | | | Stuhl <sho_pi@hotmail.com>); fix the markup format to be more flexible for better readability; add missing docs in sv.c; regenerate perltoc p4raw-id: //depot/perl@4915
* preliminary support for perl_clone() (still needs work inGurusamy Sarathy1999-11-081-1/+1
| | | | | | | | the following areas: SVOPs must indirect via pad; context stack, scope stack, and runlevels must be cloned; must hook up the virtualized pseudo-process support provided by "host"; ...) p4raw-id: //depot/perl@4538
* note about AVf_*Gurusamy Sarathy1999-09-101-0/+20
| | | p4raw-id: //depot/perl@4123