summaryrefslogtreecommitdiff
path: root/pp.c
Commit message (Collapse)AuthorAgeFilesLines
* followup to magic/overload fixDavid Mitchell2010-05-211-6/+6
| | | | | | | 6f1401dc2acd2a2b85df22b0a74e5f7e6e0a33aa was over-enthusiastic on removing redundant code in the comparison ops. This code was only used on 64-bit #ifdef branches which is why I failed to spot it earlier. So restore that code!
* make overload respect get magicDavid Mitchell2010-05-211-174/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In most places, ops checked their args for overload *before* doing mg_get(). This meant that, among other issues, tied vars that returned overloaded objects wouldn't trigger calling the overloaded method. (Actually, for tied and arrays and hashes, it still often would since mg_get gets called beforehand in rvalue context). This patch does the following: Makes sure get magic is called first. Moves most of the overload code formerly included by macros at the start of each pp function into the separate helper functions Perl_try_amagic_bin, Perl_try_amagic_un, S_try_amagic_ftest, with 3 new wrapper macros: tryAMAGICbin_MG, tryAMAGICun_MG, tryAMAGICftest_MG. This made the code 3800 bytes smaller. Makes sure that FETCH is not called multiple times. Much of this bit was helped by some earlier work from Father Chrysostomos. Added new functions and macros sv_inc_nomg(), sv_dec_nomg(), dPOPnv_nomg, dPOPXiirl_ul_nomg, dPOPTOPnnrl_nomg, dPOPTOPiirl_ul_nomg dPOPTOPiirl_nomg, SvIV_please_nomg, SvNV_nomg (again, some of these were based on Father Chrysostomos's work). Fixed the list version of the repeat operator (x): it now only calls overloaded methods for the scalar version: (1,2,$overloaded) x 10 no longer erroneously calls x_method($overloaded,10)) The only thing I haven't checked/fixed yet is overloading the iterator operator, <>.
* shift; optimizationRuslan Zakirov2010-05-031-1/+2
|
* avoid use of operator name in macroRobin Barker2010-04-261-2/+2
|
* use cBOOL for bool castsDavid Mitchell2010-04-151-1/+1
| | | | | | | | | | | | | bool b = (bool)some_int doesn't necessarily do what you think. In some builds, bool is defined as char, and that cast's behaviour is thus undefined. So this line in mg.c: const bool was_temp = (bool)SvTEMP(sv); was actually setting was_temp to false even when the SVs_TEMP flag was set. Fix this by replacing all the (bool) casts with a new cBOOL() cast macro that (hopefully) does the right thing.
* Merge commit 'origin/davem/post-5.12' into bleadDavid Mitchell2010-04-131-0/+1
|\
| * [perl #45167] Taint removal by sprintfDavid Mitchell2010-03-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under some circumstances the value returned by sprintf wasn't tainted, even though its args were. While trying to fix this, I also came across a second bug (which made fixing the first bug very confusing!) where the TARG of the sprintf op, after getting tainted once, permanently retained taint magic, which depending on circumstances, wasn't always set to untainted (mg_len =0) The original bug basically boiled down to parts of Perl_sv_vcatpvfn() directly manipulating the target with SvGROW() / Copy(), which failed to taint the target. Other parts used sv_catsv(), which did. So for example: "%s%s" failed, (only SvGROW) "%s %s" worked (the space char was appended using sv_catsv).
* | [perl #74168] Assertion failure when emitting a stricture error messageRafael Garcia-Suarez2010-04-091-2/+2
| |
* | Don't initialize end in pp_reverse when begin is NULLVincent Pit2010-03-311-5/+8
| | | | | | | | | | | | This change is a complement to 572558b47236782e60e41bd235c96eae7cbca3db. Arithmetic on null pointers isn't defined by the C standard, so it may crash even before entering the loop.
* | Avoid a segfault when reversing an empty array in-place.Rafael Garcia-Suarez2010-03-311-1/+1
|/
* Symbol S_no_symref_sv should be static (local to the compilation unit).Jan Dubois2010-02-231-1/+1
|
* Convert Perl_sv_pos_u2b_proper() to Perl_sv_pos_u2b_flags().Nicholas Clark2010-02-141-3/+3
| | | | | | | Change from a value/return offset pointer to passing a Unicode offset, and returning a byte offset. The optional length value/return pointer remains. Add a flags argument, passed to SvPV_flags(). This allows the caller to specify whether mg_get() should be called on sv.
* Remove a vestigial STRLEN case and convert a label to lowercase.Nicholas Clark2010-02-141-5/+5
| | | | (Tweaking 777f7c561610dee6.)
* Removes 32-bit limit on substr arguments. The full range of IV and UV is ↵Eric Brine2010-02-141-50/+93
| | | | available for the pos and len arguments, with safe conversion to STRLEN where it's smaller than an IV.
* Revert "[perl #62646] Maximum string length with substr"Rafael Garcia-Suarez2010-01-181-10/+7
| | | | | | | | This reverts commit b6d1426f94a845fb8fece8b6ad0b7d9f35f2d62e. Conflicts: pp.c
* A fig leaf for calling sv_pos_u2b with IV* where it expects I32*.Craig A. Berry2010-01-161-1/+4
| | | | | | | | | | | Following v5.11.3-103-gb6d1426, any compiler paying attention whines about the pointer mismatch (which on VMS breaks the build). Zefram reports a further patch in progress: Message-ID: <20100116022631.GA10264@fysh.org> but this gets the warning out of the way so other work can proceed.
* [perl #62646] Maximum string length with substrZefram2010-01-151-7/+7
| | | | (This is only a partial fix, since it doesn't handle lvalue substr)
* Another C<return NORMAL> needed post bb4c52e023e0, missed from 805bf316c58a.Nicholas Clark2009-12-031-0/+1
|
* Add assertions that pp_padav and pp_padhv push scalars of the correct type.Gerard Goossen2009-11-251-0/+2
|
* Inline PL_no_symref_sv into its users. Deprecate the visible global variable.Nicholas Clark2009-11-151-2/+5
| | | | | | | | | As the core no longer needs this fixed string outside of pp.c, it seems daft to make it public just in case any module wants to use it. Modules that do should provide their own inline copy in future. Also restore the visible global PL_no_symref_sv back to the original format specificiation (of 5.10.0 and earlier).
* add code for Unicode semantics for non-utf8 latin1 charsKarl Williamson2009-11-141-104/+632
|
* Fix compiler warning:Jerry D. Hedden2009-11-131-1/+1
| | | | | pp.c: In function `Perl_pp_delete': pp.c:4297: warning: 'sv' might be used uninitialized in this function
* Add ENTER_with_name and LEAVE_with_name to automaticly check for matching ↵Gerard Goossen2009-11-121-8/+8
| | | | ENTER/LEAVE when debugging is enabled
* Optimize reversing an array in-placeVincent Pit2009-11-101-8/+67
|
* SvREFCNT_dec already checks if the SV is non-NULL (continued)Vincent Pit2009-11-081-4/+2
|
* move JMPENV_JUMP to die_where and mark it as "noreturn"Gerard Goossen2009-11-061-0/+1
|
* SvREFCNT_dec already checks if the SV is non-NULLVincent Pit2009-11-051-6/+3
|
* [perl #69875] Slow down split in scalar context :-)Father Chrysostomos2009-10-311-1/+3
| | | | | | | | | The patch to speed up split in scalar context broke Font::GlyphNames, because it stops scalar(@array = split) from working. The attached patch fixes this, and ineluctably slows it down slightly. (Patch amended by replacing the 2nd GIMME_V macro call by the gimme variable)
* Avoid adding magic with rvalue $#aEric Brine2009-10-281-5/+12
|
* add an elipses to string/ref warnings when str longer than 32 charsYves Orton2009-10-261-2/+2
| | | | | | Wasted a few minutes more than necessary trying to work out why the string was truncated when in fact it was the error message that was truncating the string.
* Fix built-in prototype of each, keys, and valuesRafael Garcia-Suarez2009-10-221-0/+4
| | | | | | | Since those keywords can now compile to two different ops each, the usual inspection of opflags is not sufficient for perl to return a meaningful prototype. So we hardcode the correct return value for 5.12 : \[@%]
* Optimise if (%foo) to be faster than if(keys %foo)demerphq2009-10-151-0/+18
| | | | | | | | | | | Thread was "[PATCH] Make if (%hash) {} act the same as if (keys %hash) {}" http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00432.html but the implementation evolved from the approach described in the subject, to instead add a new opcode pp_boolkeys, to exactly preserve the existing behaviour. Various conflicts with the passage of time resolved, 'register' removed, and a $VERSION bump.
* Add Perl_ck_warner(), which combines Perl_ckwarn() and Perl_warner().Nicholas Clark2009-10-121-16/+13
| | | | | | | Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code size (about 0.2%), for 1 more function call if warnings are not enabled. However, if we're now in the L1 or L2 cache when we weren't previously, that's still going to be a speed win.
* Apply the same policy for the value returned by push() and unshift()Vincent Pit2009-10-041-9/+5
| | | | | That is, only push the len when the static context is not void, and honour len magic.
* push in Void Contextchromatic2009-09-231-1/+3
| | | | | | | | | | The attached patch avoids pushing an IV onto the stack for a push op in void context. The "Is there attached magic" branch in the op checks for void context as does the non-magical branch in the unshift op. -- c [Edited version of patch after review by Yitzchak Scott-Thoennes]
* split: Improve performance in scalar contextBo Borgerson2009-09-131-43/+119
| | | | Improve the performance of split in scalar context
* split: Remove implicit split to @_Bo Borgerson2009-09-131-2/+0
| | | | Remove the long deprecated feature where split in scalar context writes to @_
* Introduce "delete local"Vincent Pit2009-07-251-2/+185
|
* Use the new SAVEHDELETE() macro wherever possibleVincent Pit2009-07-251-11/+5
|
* pp.c and time64.c don't need to be executableVincent Pit2009-05-141-0/+0
|
* Code refs aren't lockableJerry D. Hedden2009-01-251-2/+2
| | | | | | Remove the check for code refs in pp_lock. For debugging, assert that the ref is not a code ref (per Dave Mitchell's suggestion).
* On scope end, delete localized array elements that should not exist anymore, ↵Vincent Pit2008-12-281-3/+27
| | | | so that the array recovers its previous length. Honour EXISTS and DELETE for tied arrays.
* Introduce SvCANEXISTDELETE in pp.h, which simplify the logic in pp_helem and ↵Vincent Pit2008-12-281-14/+11
| | | | pp_hslice
* Re: [perl #59280] perlbug AutoReply: PUSH on tied array gives incorrect ↵Luke Ross2008-11-251-2/+6
| | | | | | | | context to method and can result in needless calls to FETCHSIZE From: "Luke Ross" <lukeross@gmail.com> Message-ID: <970a62710809301441v1d8d1877tfc30d7b91cd4dc1a@mail.gmail.com> p4raw-id: //depot/perl@34908
* Re: [perl #59998] [PATCH] crypt() returns tainted data even when input ↵Chip Salzenberg2008-11-171-7/+4
| | | | | | | strings are detainted Message-ID: <20081117071429.GD5495@tytlal.topaz.cx> p4raw-id: //depot/perl@34860
* Re: [perl #60360] [PATCH] UPDATED: local $SIG{FOO} = sub {...}; sets signal ↵Chip Salzenberg2008-11-131-1/+2
| | | | | | | | | | | | handler to SIG_DFL Message-ID: <20081112234504.GI2062@tytlal.topaz.cx> Updated patch to retain source compatibility. Plus using the correct PERL_ARGS_ASSERT_SAVE_HELEM_FLAGS macro and running make regen. p4raw-id: //depot/perl@34829
* Re: [perl #60360] [PATCH] local $SIG{FOO} = sub {...}; sets signalChip Salzenberg2008-11-121-1/+1
| | | | | Message-ID: <20081111000040.GB19329@tytlal.topaz.cx> p4raw-id: //depot/perl@34819
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-2/+5
| | | | | | 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-5/+5
| | | | | | 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-12/+13
| | | | | | 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