summaryrefslogtreecommitdiff
path: root/sv.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete interpreter variable PL_utf8_alnumcRafael Garcia-Suarez2009-09-131-1/+0
|
* convert a bunch of duplicated mortalization logic in sv.c into a private ↵Yves Orton2009-09-051-13/+15
| | | | file level macro
* add a note about the previous patches from gfxYves Orton2009-09-051-0/+12
|
* newSVpvn_flags() does mortalization in place, instead of calling sv_2mortal()gfx2009-09-051-2/+8
| | | | Signed-off-by: Yves Orton <demerphq@gemini.(none)>
* String with NULL auto-increment bug fixBo Borgerson2009-08-251-1/+1
| | | | | Check position relative to end of string length rather than whether char is NULL at end of initial alphanumerics in Perl_sv_inc
* Add clear magic to %^H so that the HE chain is reset when you empty it.Zefram2009-08-211-2/+3
| | | | This fixes [perl #68590] : %^H not lexical enough.
* Perl_newIO() can become a mathom by making newIO() a wrapper around newSV_type()Nicholas Clark2009-08-081-1/+15
| | | | and tweaking Perl_sv_upgrade().
* Move the "types are equal" early return ahead of the COW-removal.Nicholas Clark2009-08-081-3/+12
|
* in perl_clone_using, free the prt_tableDavid Mitchell2009-08-051-5/+6
| | | | | *after* we have called any CLONE methods (better fix for Variable::Magic than 240bfeb992)
* dup saved_curcop in PL_parserDavid Mitchell2009-07-261-0/+11
| | | | | | Commit 7c4baf47da introduced the saved_curcop field of PL_parser, but omitted to copy the entry during interpreter cloning. This may fix bugs [RT #58468], [RT #59498]
* mro::method_changed_in(..) ignores AUTOLOAD (RT #60220)Tony Cook2009-07-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Patch modified to use a boolean rather than an integer for tracking mro changes in S_glob_assign_ref and test fixed not to warn. URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60220 From the bug report: ----------------------------------------------------------------- When creating a subclass dynamically, and when adding AUTOLOAD dynamically into the parent class, then that AUTOLOAD is not seen in the method cache, even after a call to "mro::method_changed_in('Parent')". It only appears in the method cache after a call to mro::invalidate_all_method_caches(). The attached test file demonstrates the problem. This was detected while trying to solve bug 40159 in DBIx::DataModel. ----------------------------------------------------------------- Message-ID: <20081031132021.GA21341@mars.tony.develop-help.com>
* Allocate XPV* memory using sizeof() and the offset of the first real member.Nicholas Clark2009-07-171-58/+46
| | | | | | | | | | This avoids tripping over alignment differences between X* and x*_allocated, because x*_allocated doesn't have a double in it. Tidy up the documentation in comments. Eliminate relative_STRUCT_OFFSET() as it is no longer used. Eliminate use of xpv_allocated, xpviv_allocated, xpvav_allocated, xpvcv_allocated and xpvfm_allocated, but leave them in the headers as they are publicly visible.
* Eliminate struct regexp_allocated and xpvio_allocated.Nicholas Clark2009-07-171-6/+9
| | | | | | Calculate memory allocation using regexp and XPVIO, and the offset of the first real structure member. This avoids tripping over alignment differences between X* and x*_allocated, because x*_allocated doesn't have a double in it.
* Add a pluggable hook in op_free()Vincent Pit2009-07-081-0/+2
|
* Add test to make sure everything that outputs an exception or warning has a ↵James Mastros2009-06-271-2/+2
| | | | matching entry in perldiag (and fix it so that more of the existing ones do).
* Fix casting warningRafael Garcia-Suarez2009-05-311-2/+2
| | | | (that was introduced by 9ef5ed94af)
* Fix [RT#6266] -- sv_pos_u2b expects to be called with a valid character indexAlex Vandiver2009-05-301-2/+3
| | | | | | | sv_pos_u2b, when utf8 position caching is enabled, treats the uoffset it is given as real, storing it away for lature use. sprintf, here, passes the byte length of the string, which causes an invalid offset to be cached.
* Explicitely point to $. when it causes an uninitialized warning for ranges ↵Vincent Pit2009-05-261-0/+8
| | | | in scalar context
* Use only one block of memory for both PL_psig_name and PL_psig_ptr.Nicholas Clark2009-05-211-6/+4
|
* fix glob-assign for FORMATH.Merijn Brand2009-05-201-0/+1
|
* Remove binary compatibility scaffolding for the change to PL_bitcount.Nicholas Clark2009-05-201-1/+0
|
* Replace run-time on-demand initialisation of PL_bitcount with a constant table.Nicholas Clark2009-05-201-1/+1
| | | | | | | | | | | | | | | | (The table is 256 bytes; the run-time initialisation code is larger than this!) Adapt generate_uudmap.c to generate the initalisation block for PL_bitcount, writing the code to bitcount.h, using the same approach as uudmap.h. To preserve binary compatibility: for MULTIPLICITY: keep Ibitcount in the interpreter structure, but remove all the macros that access it. PL_bitcount is a new symbol in the object file, which won't clash with anything as that name wasn't used before. otherwise: keep PL_bitcount as a char *, but initialise it at compile time to a new constant array PL_bitcount array. Remove the code that attempts to Safefree() it at interpreter destruction time.
* In perl_clone_using(), use sv_dup_inc_multiple() to clone the temps stack.Nicholas Clark2009-05-191-6/+3
| | | | Avoid using Newxz() to zero allocate memory we will immediately overwrite.
* Add S_sv_dup_inc_multiple(), used in place of loops that call sv_dup_inc().Nicholas Clark2009-05-181-11/+24
| | | | Just 4 uses already give a size saving with gcc -Os.
* In perl_clone_using(), don't use Newxz() for arrays we immediately assign to.Nicholas Clark2009-05-181-2/+2
|
* In Perl_ptr_table_new(), fight back against the cult of Newxz().Nicholas Clark2009-05-181-1/+1
| | | | | (There's no need to zero-allocate memory for a structure when you're about to explicitly allocate every member.)
* Tidy the implementation of Perl_mg_dup().Nicholas Clark2009-05-181-25/+26
| | | | | | | | As all the structure elements are directly assigned to, use Newx() rather than Newxz(). Replace the explicit assignments with a direct structure copy. When reading values from the parent, read from those copied to the new structure, rather than the identical value in the old structure, to recduce CPU cache pressure.
* In Perl_mg_dup(), remove a branch by tracking the address to write to instead ofNicholas Clark2009-05-181-6/+4
| | | | the address of the structure, with a special case for the first time round.
* In Perl_mg_dup(), the while loop does the NULL check for us already.Nicholas Clark2009-05-181-4/+1
|
* In Perl_mg_dup(), don't call ptr_table_fetch, as we never call ptr_table_store.Nicholas Clark2009-05-181-4/+0
|
* Inline S_glob_2pv() into Perl_sv_2pv_flags(). (Existing bugs included.)Nicholas Clark2009-05-121-23/+17
| | | | Change 27942 missed this. (675c862fe1d4abfd048dce5f1958cca54b16c501)
* In Perl_gp_dup(), no need to explicitly zero ret->gp_refcnt after the Newxz().Nicholas Clark2009-05-041-1/+2
|
* Make Perl_hek_dup() cope with a NULL "source" parameter (by returning NULL).Nicholas Clark2009-05-041-4/+3
| | | | Change its callers to take advantage of this.
* Fix SEGVs when cloning a typeglob that has been undefined. (RT #64954)Nicholas Clark2009-05-041-1/+1
|
* Remove all #ifdef MACOS_TRADITIONAL code in core and non-dual-life XS code.Nicholas Clark2009-04-271-6/+0
| | | | | | | | (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.)
* In the context of PERL_OLD_COPY_ON_WRITE, remove comments about global mutexes.Nicholas Clark2009-04-191-12/+0
| | | | | These would only have been relevant if running under 5005 threads, which is long dead.
* 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>