summaryrefslogtreecommitdiff
path: root/sv.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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