summaryrefslogtreecommitdiff
path: root/sv.c
Commit message (Collapse)AuthorAgeFilesLines
* GvUNIQUE* have been defined as 0 since 2005/06/30 - high time to remove them.Nicholas Clark2009-04-131-17/+1
|
* Change Perl_newCONSTSUB() so that a NULL sv generates an empty list return.Nicholas Clark2009-03-291-0/+3
| | | | Don't call DESTROY if it's a constant subroutine.
* Don't COW PVFMs, as the IVX is now used for FmLINES. (since change 34134)Nicholas Clark2009-03-281-1/+1
|
* fix a couple of comments that annoyingly look like merge conflict markersDavid Mitchell2009-03-061-2/+2
|
* The correct name of PERL_UTF8_magic is PERL_MAGIC_utf8, so use it in sv.c ↵Vincent Pit2009-02-071-3/+3
| | | | apidocs
* Optimize away calls to empty DESTROY methodsRafael Garcia-Suarez2009-01-201-1/+5
|
* Combine sv_utf8_upgrade with a following growKarl2009-01-191-1/+2
|
* Bump coopyright year in embed.pl and various files that were just touchedRafael Garcia-Suarez2009-01-021-1/+2
| | | | (and run "make regen")
* Faster sv_utf8_upgrade()karl williamson2009-01-021-29/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider what currently happens when the tokenizer is scanning a string. It looks through it byte-by-byte until it finds a character that forces it to decide to go to utf8. It then calls sv_utf8_upgrade() with the portion of the string scanned so far. sv_utf8_upgrade() starts over from the beginning, and scans the string byte-by-byte until it finds a character that varies between non-utf8 and utf8. It then calls bytes_to_utf8(). bytes_to_utf8() allocates a new string that can handle the worst case expansion, 2n+1, of the entire string, and starts over from the beginning, and scans the input string byte-by-byte copying and converting each character to the output string as it goes. It doesn't return the size of the new string, so sv_utf8_upgrade() assumes it is only as big as what actually got converted, throwing away knowledge of any spare. It then returns to the tokenizer, which immediately does a grow to get space for the unparsed input. This is likely to cause a new string to be allocated and copied from the one we had just created, even if that string in actuality had enough space in it. Thus, the invariant head portion of the string is scanned 3 times, and probably 2 strings will be allocated and copied. My solution to cutting this down is to do several things. First, I added an extra flag for sv_utf8_upgrade that says don't bother to check if the string needs to be converted to utf8, just assume it does. This eliminates one of the passes. I also added a new parameter to sv_utf8_upgrade that says when you return, I want this much unused space in the string. That eliminates the extra grow. This was all done by renaming the current work-horse function from sv_utf8_upgrade_flags to be sv_utf8_upgrade_flags_grow() and making the current function name be a macro which calls the revised one with a 0 grow parameter. I also improved the internal efficiency of sv_utf8_upgrade so that when it does scan the string, it doesn't call bytes_to_utf8, but does the conversion itself, using a fast memory copy instead of the byte-oriented one for the invariant header, and it uses that header to get a better estimate of the needed size of the new string, and it doesn't throw away the knowledge of the allocated size. And, if it is clear without scanning the whole string that the conversion will fit in the already allocated string, it just uses that instead of allocating and copying a new one, using the algorithm I copied from the tokenizer. (In this case it does have to finish scanning the whole string to get the correct size.) The comments have details. It still is byte-oriented. Vectorization et. al. could yield performance improvements. One idea for that is in the comments. The patch also includes a new synonym I created which is a more accurate name than NATIVE_TO_ASCII.
* Add Perl_mro_register() to register Method Resolution Orders,Nicholas Clark2008-12-271-0/+2
| | | | | | Perl_mro_get_from_name() to retrieve MROs by name, and PL_registered_mros to store them in. Abolish the static array of mros, and instead register the dfs and c3 MRO structures.
* sv_dup(): avoid cloning empty arrayskevin brintnall2008-12-261-1/+4
| | | | | | | | | Testing the ARRAY pointer is insufficent. Arrays emptied by 'shift' or 'pop' may still have non-NULL 'ARRAY' pointers. Check more carefully to determine whether the array has anything worth duplicating. If not, reset the FILL and MAX offsets to -1 just as 'undef @ARRAY' would. This avoids potential corruption in the PL_ptr_table during perl_clone().
* Update comments and documentation dealing with utfKarl2008-12-261-0/+4
|
* It looks like the previous patch is working fine on UNIXish boxes,Steve Peters2008-12-191-4/+0
| | | | | but is failing on Windows. Anyways sv_utf8_upgrade_nomg() is a macro anyways, so moving the documentation to sv.h.
* Subject: PATCH 5.10 documentationSteve Peters2008-12-191-7/+16
| | | | | | From: karl williamson <public@khwilliamson.com> Date: Tue, 16 Dec 2008 16:00:34 -0700 Message-ID: <49483312.80804@khwilliamson.com>
* standardize save/restore of errno & vaxc$errnoChip Salzenberg2008-12-051-2/+2
| | | | | Message-ID: <20081127070141.GD17663@tytlal.topaz.cx> p4raw-id: //depot/perl@35018
* In Perl_ss_dup(), case SAVEt_FREEPV can be rolled into caseNicholas Clark2008-12-011-4/+2
| | | | | SAVEt_DELETE for a space optimisation. p4raw-id: //depot/perl@34969
* Re-order Perl_save_delete() to PTR, INT, PTR.Nicholas Clark2008-12-011-1/+3
| | | p4raw-id: //depot/perl@34967
* For SAVEHINTS(), re-order the savestack to be (?:PTR, )? INT, PTR.Nicholas Clark2008-12-011-2/+2
| | | | | This brings it to the same order as save_aelem() or save_pushi32ptr(). p4raw-id: //depot/perl@34964
* sv_add_arena() is now only called from sv.c, so it can be static.Nicholas Clark2008-11-261-2/+2
| | | p4raw-id: //depot/perl@34938
* [perl #948] [PATCH] Allow tied $,Chip Salzenberg2008-11-141-1/+1
| | | | | Message-ID: <20081114084436.GJ5779@tytlal.topaz.cx> p4raw-id: //depot/perl@34831
* Allow lvalue usage of SvRV() and add MUTABLE_SV() check.Marcus Holland-Moritz2008-11-101-2/+2
| | | | | Also add new SvRV_const() macro for read-only access. p4raw-id: //depot/perl@34804
* Fix warning code in Perl_sv_vcatpvfn() to make the TODOMarcus Holland-Moritz2008-11-091-9/+18
| | | | | | tests introduced with #34781 pass. Add some more warning tests to t/lib/warnings/sv. p4raw-id: //depot/perl@34783
* "Perl_newSVpvf("%lld")" is brokenHugo van der Sanden2008-11-091-5/+20
| | | | | | | Message-Id: <200811081329.mA8DTv7e018896@zen.crypt.org> Plus some test cases. p4raw-id: //depot/perl@34780
* Revert SvPVX() to allow lvalue usage, but also add aMarcus Holland-Moritz2008-11-071-3/+3
| | | | | | | MUTABLE_SV() check. Use SvPVX_const() instead of SvPVX() where only a const SV* is available. Also fix two falsely consted pointers in Perl_sv_2pv_flags(). p4raw-id: //depot/perl@34770
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-1/+10
| | | | | | Message-ID: <25940.1225611819@chthon> Date: Sun, 02 Nov 2008 01:43:39 -0600 p4raw-id: //depot/perl@34698
* Explicitly specify some printf formats for constant strings.Rafael Garcia-Suarez2008-11-021-11/+11
| | | | | | This is mostly to silence gcc's warning, "format not a string literal and no format arguments". p4raw-id: //depot/perl@34694
* Add MUTABLE_GV(), and eliminate (V *) casts in *.c.Nicholas Clark2008-10-311-34/+37
| | | | | | Can't easily do gv.h, as GvGP() (at least) needs to split into two macros - one const for reading, one non-const for writing. p4raw-id: //depot/perl@34679
* Change 34627 didn't realise that if S_find_uninit_var() takes aNicholas Clark2008-10-301-1/+1
| | | | | const SV *, then so can Perl_report_uninit(). p4raw-id: //depot/perl@34673
* Eliminate (SV *) casts from sv.c and [tu]*.c, except for the cast inNicholas Clark2008-10-301-52/+57
| | | | | Perl_sv_magicext(), which is documented. p4raw-id: //depot/perl@34671
* Add MUTABLE_IO(), and eliminate (IO *) casts in *.c.Nicholas Clark2008-10-291-5/+5
| | | p4raw-id: //depot/perl@34654
* Use pvs macros instead of pvn where possible.Marcus Holland-Moritz2008-10-291-5/+5
| | | p4raw-id: //depot/perl@34653
* Eliminate (AV *) casts in *.c.Nicholas Clark2008-10-291-26/+28
| | | p4raw-id: //depot/perl@34650
* Add MUTABLE_CV(), and eliminate (CV *) casts in *.c.Nicholas Clark2008-10-291-9/+9
| | | p4raw-id: //depot/perl@34647
* As Perl_cv_const_sv() now takes a const CV *, use that as the cast forNicholas Clark2008-10-291-2/+4
| | | | | its arguments. p4raw-id: //depot/perl@34646
* Every remaining (HV *) cast in *.cNicholas Clark2008-10-281-14/+14
| | | p4raw-id: //depot/perl@34629
* Consting in S_find_uninit_var() and the routines that it calls.Nicholas Clark2008-10-281-10/+10
| | | p4raw-id: //depot/perl@34627
* Some consting in Perl_ss_dup(), and a few (HV*) casts that can beNicholas Clark2008-10-281-16/+16
| | | | | (const HV *). p4raw-id: //depot/perl@34626
* A gaggle of casts in Perl_sv_magicext() that are (const ?V *).Nicholas Clark2008-10-281-3/+3
| | | p4raw-id: //depot/perl@34623
* Update copyright years.Nicholas Clark2008-10-251-2/+2
| | | p4raw-id: //depot/perl@34585
* Make C++ compilers happy #3: make implicit castMarcus Holland-Moritz2008-10-241-3/+5
| | | | | from 'void *' explicit. p4raw-id: //depot/perl@34576
* Add SV allocation tracing to -Dm and PERL_MEM_LOGMarcus Holland-Moritz2008-10-241-3/+26
| | | | | Message-ID: <20081022013731.23b5a2e5@r2d2> p4raw-id: //depot/perl@34568
* Yet another [ACGHS]V pointer in the interpreter structure that needs toNicholas Clark2008-10-141-0/+3
| | | | | | | be reset if its SV is freed. (see change 22688 (30952)). A real live bug found by Slaven and Andreas whilst smoking maint-5.8.x. I guess that we should audit the interpreter structure for any others. p4raw-id: //depot/perl@34479
* SEGV in readline with $/ set to a reference, discovered by theorbtwo.Nicholas Clark2008-09-151-1/+1
| | | | | The bug turns out to have been introduced in 2003, with change 18580. p4raw-id: //depot/perl@34371
* Don't add freed SVF_BREAK scalars to the freed list.Dave Mitchell2008-08-241-2/+12
| | | | | This may still be referenced, so don't reuse. p4raw-id: //depot/perl@34220
* In S_mro_get_linear_isa_dfs(), save copying by making a shared hashNicholas Clark2008-08-221-0/+2
| | | | | | | key scalar from the key of the hash entry we've just creating. (Currently the hash is disposed of afterwards, but soon it won't, so having both point to the same string buffer will also save memory.) p4raw-id: //depot/perl@34215
* Change 33807 to fix bug #52740 wasn't quite right, as it ended up withNicholas Clark2008-08-211-5/+3
| | | | | unitialised reads (and sometimes even SEGVs). p4raw-id: //depot/perl@34213
* better document how the weakref backrefs array is refcountedDave Mitchell2008-08-211-4/+20
| | | p4raw-id: //depot/perl@34211
* Assert that backreferences array is not freed rather than handling itDave Mitchell2008-08-201-9/+5
| | | | | | | | | | | In several places where the weakrefs backreferences array is used or freed, the code checks whether the array has already been freed and if so skips. Since the array already being freed is a bad bug, lets instead assert that this never happens, based on the assumptions that (a) such premature freeing bugs are likely ironed out by now, (b) if they aren't then we want to know about them and fix them rather than silently skip. p4raw-id: //depot/perl@34210
* [perl #56908] DBI memory leak in 5.10.0 due to change 26530Dave Mitchell2008-08-201-1/+2
| | | | | | | | | | | 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
* Fix use of a variable before it is initialised, introduced by changeNicholas Clark2008-07-151-1/+1
| | | | | | 34138, spotted by Jerry D. Hedden. I assume that he's compiling with options that enable trace flow analysis from the C compiler. p4raw-id: //depot/perl@34144