summaryrefslogtreecommitdiff
path: root/hv.c
Commit message (Collapse)AuthorAgeFilesLines
* Perl_newHVhv() should copy immortal values as-is, such as PL_sv_undefNicholas Clark2009-08-201-3/+5
| | | | | | | | | | | | Currently it calls newSVsv() always, which copies the value, but the immortal SVs are used as much for their addresses as their values. You can't get the immortals into HVs from Perl-space, except for PL_sv_placeholder, and any hash with those will take the else block, where the call to Perl_hv_iternext_flags() won't be returning placeholders anyway. Hence If XS code has gone to the trouble to get the "impossible" in there, they had a reason for it. I am assuming that Perl_hv_copy_hints_hv() should stay as-is, as it is documented that only strings and integers are supported values for %^H.
* Instead of a const char *, pass a HEK * to anonymise_cv().Nicholas Clark2009-06-221-6/+11
| | | | | This will cope properly with Unicode package names. It also allows use of more efficient perl API calls, avoiding any strlen()s.
* Regenerate headers and fix compilation with threads after last commitRafael Garcia-Suarez2009-06-211-2/+2
|
* When a glob is deleted, mark its sub as ANON.Ben Morrow2009-06-211-2/+41
|
* In Perl_hv_iternext_flags(), clarify and generalise the empty hash bailout code.Nicholas Clark2009-06-021-4/+3
|
* Fix RT26188, speed up keys() on empty hashMax Maischein2009-06-011-17/+23
|
* Nicholas says that SvREFCNT_dec should be sufficient hereRafael Garcia-Suarez2009-05-301-1/+3
| | | | (instead of marking the SV as mortal.)
* Fix [RT#63110] -- two small memory leaks were introduced in 5b9c067Alex Vandiver2009-05-301-1/+1
|
* Remove all the 5005threads specific mutex macros, which are now vestigial.Nicholas Clark2009-05-211-7/+0
|
* Make Perl_hek_dup() cope with a NULL "source" parameter (by returning NULL).Nicholas Clark2009-05-041-1/+5
| | | | Change its callers to take advantage of this.
* Add a key flag HVhek_KEYCANONICAL for Perl_hv_common(), which signals that theNicholas Clark2008-12-281-2/+6
| | | | | | key is in canonical form - any key passed encoded in UTF-8 cannot be represented as bytes, hence the downgrade check can be skipped. Use this internally for shared hash key scalars, as they are always canonical.
* Precomputing the hash value for a string representable in bytes, but passed inNicholas Clark2008-12-281-0/+5
| | | | | in UTF-8, would result in storing the wrong hash value in the hash, and hence failing lookups. I guess not that much XS code precomputes hash values.
* In struct mro_meta, rename mro_linear_dfs to mro_linear_all, and change it fromNicholas Clark2008-12-271-3/+3
| | | | AV * to HV *.
* In struct mro_meta, rename mro_linear_c3 to mro_linear_current, and change itNicholas Clark2008-12-271-4/+4
| | | | from AV * to SV *.
* Optimisation of the use of the meta structure - don't create a hash if all weNicholas Clark2008-12-271-1/+11
| | | | | are dealing with is data for the current MRO. Instead the direct pointer "owns" the (reference to the) data, with the hash pointer left as NULL to signal this.
* Repurpose struct mro_meta to allow it to store cached linear ISA for arbitaryNicholas Clark2008-12-271-1/+0
| | | | | | | method resolution orders. mro_linear_dfs becomes a hash holding the different MROs' private data. mro_linear_c3 becomes a shortcut pointer to the current MRO's private data.
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-1/+5
| | | | | | Message-ID: <25940.1225611819@chthon> Date: Sun, 02 Nov 2008 01:43:39 -0600 p4raw-id: //depot/perl@34698
* Eliminate (SV *) casts from the rest of *.c, picking up one (further)Nicholas Clark2008-10-301-41/+47
| | | | | erroneous const in dump.c. p4raw-id: //depot/perl@34675
* Every remaining (HV *) cast in *.cNicholas Clark2008-10-281-1/+1
| | | p4raw-id: //depot/perl@34629
* Perl_hv_placeholders_get() actually takes a const HV *hv.Nicholas Clark2008-10-281-2/+2
| | | p4raw-id: //depot/perl@34618
* Update copyright years.Nicholas Clark2008-10-251-2/+2
| | | p4raw-id: //depot/perl@34585
* Another missing 'static' picked up by one of Merijn's smokers.Nicholas Clark2008-09-201-1/+1
| | | p4raw-id: //depot/perl@34383
* Create a direct lookup hash for ->isa() lookup, by retaining theNicholas Clark2008-09-121-0/+1
| | | | | | | | | | | de-duping hash used by S_mro_get_linear_isa_dfs(). Provide a new function Perl_get_isa_hash() to lazily retrieve this. (Which could actually be static if S_isa_lookup() and Perl_sv_derived_from() moved into mro.c.) Make S_isa_lookup() use this lookup hash in place of a linear walk of the linear isa. This should turn isa lookups from O(n) to O(1), which should make heavy users of ->isa() faster. (eg PPI, and hence Perl Critic). p4raw-id: //depot/perl@34354
* Re: blead with -Dusemymalloc fails on t/comp/hints.tVincent Pit2008-09-111-1/+1
| | | | | Message-ID: <48C83522.9010804@profvince.com> p4raw-id: //depot/perl@34338
* [perl #56908] DBI memory leak in 5.10.0 due to change 26530Dave Mitchell2008-08-201-0/+1
| | | | | | | | | | | A weakref to a HV would leak, because the xhv_backreferences array is created with a refcount of 2 (to avoid premature freeing during global destruction), but the RC was only decremented once when the parent HV was freed. Also, when thread cloned, the new array was being created with a RC of 1, rather than 2, which coincidentally worked due to the first bug. p4raw-id: //depot/perl@34209
* Don't bother hashing the key, or performing any other preparatory work,Nicholas Clark2008-08-091-36/+40
| | | | | if there isn't anything to find. p4raw-id: //depot/perl@34190
* Run Porting/checkARGS_ASSERT.pl and fix what it picks up. (Which,Nicholas Clark2008-05-101-0/+2
| | | | | coincidentally were both from changes I made) p4raw-id: //depot/perl@33814
* So why didn't the build break for me? Fix problems spotted by JerryNicholas Clark2008-04-071-2/+2
| | | | | Hedden. p4raw-id: //depot/perl@33659
* Split out S_refcounted_he_new_common() fromNicholas Clark2008-04-071-29/+55
| | | | | | | | | Perl_refcounted_he_new_common(), so that Perl_store_cop_label() can call it without needing to create two temporary SVs. Use it in newSTATEOP() and eliminate the two temporary SVs. Make Perl_fetch_cop_label() more defensive by not assuming that the value for ":" is always a PV. Remove its "compatibility" macro. p4raw-id: //depot/perl@33657
* Eliminate cop_label from struct cop by storing a label as the firstNicholas Clark2008-04-071-0/+25
| | | | | | 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
* Use malloc_good_size() to round up the size of requested arenas to theNicholas Clark2008-02-271-2/+5
| | | | | | size that will actually be allocated, to squeeze last few bytes into use. p4raw-id: //depot/perl@33390
* assert() that every NN argument is not NULL. Otherwise we have theNicholas Clark2008-02-121-1/+77
| | | | | | | | | | | | ability to create landmines that will explode under someone in the future when they upgrade their compiler to one with better optimisation. We've already done this at least twice. (Yes, some of the assertions are after code that would already have SEGVd because it already deferences a pointer, but they are put in to make it easier to automate checking that each and every case is covered.) Add a tool, checkARGS_ASSERT.pl, to check that every case is covered. p4raw-id: //depot/perl@33291
* Extend newSVpvn_flags() to also call sv_2mortal() if SVs_TEMP is set inNicholas Clark2008-01-031-3/+4
| | | | | | the flags. Move its implementation just ahead of sv_2mortal()'s for CPU cache locality. Refactor all code that can be to use this. p4raw-id: //depot/perl@32818
* Add a new function newSVpvn_flags(), which takes a third parameter ofNicholas Clark2008-01-021-12/+6
| | | | | | | | | | flag bits. Right now the only flag bit is SVf_UTF8, which will call SvUTF8_on() on the new SV for you. Provide a wrapper newSVpvn_utf8(), which takes a boolean, and passes in SVf_UTF8 if that is true. Refactor the core to use it where possible. It makes the source code clearer and smaller, but seems to be swings and roundabouts on object code size. p4raw-id: //depot/perl@32807
* Similiarly Perl_newHV() can become a mathom by making newHV() aNicholas Clark2007-12-201-24/+0
| | | | | wrapper around newSV_type() and tweaking Perl_sv_upgrade(). p4raw-id: //depot/perl@32676
* ex-PVBM and mro interact badlyBen Morrow2007-10-171-1/+1
| | | | | Message-ID: <20071015215616.GA43800@osiris.mauzo.dyndns.org> p4raw-id: //depot/perl@32119
* Fix Win32 breakage caused by #31926Steve Hay2007-09-211-1/+1
| | | p4raw-id: //depot/perl@31937
* Silence a load of "value computed is not used" warningsRafael Garcia-Suarez2007-09-211-7/+7
| | | p4raw-id: //depot/perl@31936
* Remove now-unnecessary =cuts where POD is now adjacent to POD.Nicholas Clark2007-09-201-20/+0
| | | p4raw-id: //depot/perl@31932
* Add a new function Perl_hv_common_key_len(), which contains theNicholas Clark2007-09-201-77/+18
| | | | | | | | manipulations to convert negative lengths to positive length + UTF-8 flag. hv_delete(), hv_exists(), hv_fetch(), hv_store() and hv_store_flags() all become mathoms. The macros hv_fetchs() and hv_stores() call hv_common() directly. p4raw-id: //depot/perl@31931
* Move the SV dereference of Perl_hv_fetch()/Perl_hv_store()/Nicholas Clark2007-09-201-27/+34
| | | | | | Perl_hv_store_flags() into Perl_hv_common(). All already pass in HV_FETCH_JUST_SV, which only these three pass in. p4raw-id: //depot/perl@31930
* Switch Perl_hv_common() to returning void * rather than HE *.Nicholas Clark2007-09-201-23/+24
| | | p4raw-id: //depot/perl@31926
* Convert hv_delete_ent(), hv_exists_ent(), hv_fetch_ent() andNicholas Clark2007-09-201-31/+1
| | | | | | hv_store_ent() to macros, and consign the function bodies to history. Er, mathoms.c p4raw-id: //depot/perl@31924
* assert that what is passed into the hash functions is really an HV.Nicholas Clark2007-09-201-0/+4
| | | | | | (MRO code is calling hash functions during global destruction, hence the check on SVTYPEMASK.) p4raw-id: //depot/perl@31922
* Make hv_fetch_common() non-static, and change its name to hv_common(),Nicholas Clark2007-09-201-39/+36
| | | | | as it now also performs hv_delete()/hv_delete_ent() p4raw-id: //depot/perl@31919
* Inline and abolish S_hv_magic_uvar_xkey().Nicholas Clark2007-09-191-34/+29
| | | p4raw-id: //depot/perl@31917
* Send all delete()/delete_ent() calls via S_hv_fetch_common().Nicholas Clark2007-09-191-21/+11
| | | | | This puts all the key normalisation code in one place. p4raw-id: //depot/perl@31916
* ext/XS/APItest/t/hash.t was failing because the fieldhash code didn'tNicholas Clark2007-09-191-1/+4
| | | | | reset the pre-computed hash value. p4raw-id: //depot/perl@31913
* Call the key transformation function for hv_exists()/hv_fetch()/Nicholas Clark2007-09-191-10/+9
| | | | | hv_store(). (And test this) p4raw-id: //depot/perl@31912
* Call the key transformation function for hv_delete().Nicholas Clark2007-09-191-5/+13
| | | | | | | Honour the HV_DISABLE_UVAR_XKEY for hv_delete(). Test this. [Pass in 3 more parameters to S_hv_magic_uvar_xkey()] p4raw-id: //depot/perl@31905