summaryrefslogtreecommitdiff
path: root/proto.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix error in 5b235299a82969c3, which gcc didn't spot, but g++ did.Nicholas Clark2010-07-211-1/+1
| | | | C, of course, is happy enough without a function prototype.
* Add Perl_init_dbargs(), to set up @DB::args without losing SV references.Nicholas Clark2010-07-211-0/+1
|
* Add \o{} escapeKarl Williamson2010-07-171-0/+8
| | | | | | | | | | This commit adds the new construct \o{} to express a character constant by its octal ordinal value, along with ancillary tests and documentation. A function to handle this is added to util.c, and it is called from the 3 parsing places it could occur. The function is a candidate for in-lining, though I doubt that it will ever be used frequently.
* protect CvGV weakref with backrefDavid Mitchell2010-07-141-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each CV usually has a pointer, CvGV(cv), back to the GV that corresponds to the CV's name (or to *foo::__ANON__ for anon CVs). This pointer wasn't reference counted, to avoid loops. This could leave it dangling if the GV is deleted. We fix this by: For named subs, adding backref magic to the GV, so that when the GV is freed, it can trigger processing the CV's CvGV field. This processing consists of: if it looks like the freeing of the GV is about to trigger freeing of the CV too, set it to NULL; otherwise make it point to *foo::__ANON__ (and set CvAONON(cv)). For anon subs, make CvGV a strong reference, i.e. increment the refcnt of *foo::__ANON__. This doesn't cause a loop, since in this case the __ANON__ glob doesn't point to the CV. This also avoids dangling pointers if someone does an explicit 'delete $foo::{__ANON__}'. Note that there was already some partial protection for CvGV with commit f1c32fec87699aee2eeb638f44135f21217d2127. This worked by anonymising any corresponding CV when freeing a stash or stash entry. This had two drawbacks. First it didn't fix CVs that were anonmous or that weren't currently pointed to by the GV (e.g. after local *foo), and second, it caused *all* CVs to get anonymised during cleanup, even the ones that would have been deleted shortly afterwards anyway. This commit effectively removes that former commit, while reusing a bit of the actual anonymising code.
* protect CvSTASH weakref with backrefsDavid Mitchell2010-07-141-7/+7
| | | | | | | | | | | | | | Each CV usually has a pointer, CvSTASH, back to the stash that it was complied in. This pointer isn't reference counted, to avoid loops. Which can leave it dangling if the stash is deleted. There is already protection for the similar GvSTASH field in GVs: the stash has an array of backrefs, xhv_backreferences, pointing to the GVs whose GvSTASHes point to it, and which is used to zero all the GvSTASH fields should the stash be deleted. All this patch does is also add the CVs with CvSTASH to that stash's backref list too.
* process xhv_backreferences early in S_hfreeentriesDavid Mitchell2010-07-141-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deleting a stash, make the algorithm GvSTASH($_) = NULL for (@xhv_backreferences); delete xhv_backreferences; free each stash entry; Previously the algorithm was hide xhv_backreferences as ordinary backref magic; free each stash entry: this may trigger a sv_del_backref() for each GV being freed delete @xhv_backreferences The new method is: * more efficient: one scan through @xhv_backreferences rather than lots of calls to sv_del_backref(), removing elements one by one; * makes the code simpler; the 'hide xhv_backreferences as backref magic' hack no longer needs to be done * removes a bug whereby GVs that had a refcnt > 1 (the usual case) were left with a GvSTASH pointing to the freed stash; it's now NULL instead. I couldn't think of a test for this. There are two drawbacks: * If the GV gets freed at the same time as the stash, the freeing code sees the GV with a GVSTASH of NULL rather than still pointing to the stash. * As far as I can see, the only difference this currently makes is that mro_method_changed_in() is no longer called by sv_clear(), but since we're blowing away the whole stash anyway, method resolution doesn't really bother us any more. At some point in the future I might set GvSTASH to %__ANON__ rather than NULL.
* Create S_assert_uft8_cache_coherent() with one copy of the cache panic code.Nicholas Clark2010-07-121-0/+6
| | | | | Replacing 4 copies of this debugging-only routine with 1 reduces source and object code size.
* S_sv_pos_u2b_cached now updates the UTF-8 length cache if at the end of string.Nicholas Clark2010-07-121-3/+4
| | | | | | | Pass in a boolean to S_sv_pos_u2b_forwards, which sets it to true if it discovers that the UTF-8 offset is at (or after) the end of the string. This can only happen if we don't already know the SV's length (in Unicode characters), because if we know it, we always call S_sv_pos_u2b_midway().
* Break S_utf8_mg_len_cache_update() out from Perl_sv_len_utf8().Nicholas Clark2010-07-121-0/+6
|
* Wrap PL_blockhooks in an API function.Ben Morrow2010-07-121-0/+5
| | | | | This should help prevent people from thinking they can get cute with the contents.
* Avoid UTF-8 cache panics with offsets beyond the string. Fixes RT #75898.Nicholas Clark2010-07-111-4/+5
| | | | | | Change S_sv_pos_u2b_forwards() to take a point to the (requested) UTF-8 offset, and return the actual UTF-8 offset for the byte position returned. This ensures that the cache is consistent with reality.
* In S_sv_pos_u2b_midway, inline the call to S_sv_pos_u2b_forwards.Nicholas Clark2010-07-111-1/+1
|
* Get rid of PERL_DECL_PROTJan Dubois2010-07-071-55/+55
| | | | | It was added for PERL_OBJECT support in commit 0cb9638, which has been removed again with commit acfe0ab.
* add my_[l]stat_flags(); make my_[l]stat() mathomsDavid Mitchell2010-07-031-2/+4
| | | | | | | my_stat() and my_lstat() call get magic on the stack arg, so create _flags() variants that allow us to control this. (I can't just change the signature or the mg_get() behaviour since my_[l]stat() are listed as being in the public API, even though they're undocumented.)
* Add Perl_croak_no_modify() to implement Perl_croak("%s", PL_no_modify).Nicholas Clark2010-06-271-0/+3
| | | | | This reduces object code size, reducing CPU cache pressure on the non-exception paths.
* Merge flags and argc parameters to S_tied_handle_method().Nicholas Clark2010-06-131-1/+1
| | | | | | This generates slightly smaller object code overall, which means that the "hot" code (the non-overloaded paths through the ops) will be smaller, and hence more likely to stay in the CPU cache.
* In S_tied_handle_method() default to mortalizing extra arguments.Nicholas Clark2010-06-131-1/+1
| | | | | Convert the gimme argument to a flags argument, and add a flag bit to signal that mortalization is not required. Only "BINMODE" needs this.
* Add a gimme parameter to S_tied_handle_method().Nicholas Clark2010-06-131-1/+1
| | | | This allows "GETC" to use it.
* Change S_tied_handle_method() to varargs to allow extra SV parameters.Nicholas Clark2010-06-131-1/+1
| | | | This enables "BINMODE", "EOF" and "SYSSEEK" to use it.
* Merge simple tied handle method calls into S_tied_handle_method().Nicholas Clark2010-06-131-0/+8
|
* Change name of ibcmp to foldEQKarl Williamson2010-06-051-6/+18
| | | | | | | | | | | | | | | | As discussed on p5p, ibcmp has different semantics from other cmp functions in that it is a binary instead of ternary function. It is less confusing then to have a name that implies true/false. There are three functions affected: ibcmp, ibcmp_locale and ibcmp_utf8. ibcmp is actually equivalent to foldNE, but for the same reason that things like 'unless' and 'until' are cautioned against, I changed the functions to foldEQ, so that the existing names, like ibcmp_utf8 are defined as macros as being the complement of foldEQ. This patch also changes the one file where turning ibcmp into a macro causes problems. It changes it to use the new name. It also documents for the first time ibcmp, ibcmp_locale and their new names.
* Deprecate find_rundefsvoffset()Vincent Pit2010-06-031-1/+3
|
* Make pp_reverse fetch the lexical $_ from the correct padVincent Pit2010-06-031-0/+1
| | | | | | This is achieved by introducing a new find_rundefsv() function in pad.c This fixes [perl #75436].
* Convert PAD_DUP to a function Perl_padlist_dup().Nicholas Clark2010-05-241-0/+8
| | | | assert() that pads are never AvREAL().
* When deleting CLONE_PARAMS, push any unreferenced SVs onto the temps stack.Nicholas Clark2010-05-241-0/+7
| | | | | | | | | | | | Effectively this leaves the cloned-into interpreter in a consistent state. In the cloned-from interpreter, the SV targets of non-reference owning pointers *are* referenced and managed by other pointers. SvREFCNT() == 0 SVs in the cloned-into interpreter result from the non-reference owning pointers being found and followed, but the reference owning and managing pointers not being part of the subsection of interpreter state cloned over. Hence, this change creates reference owning pointers to this SVs on the temps stack, which ensures that they are correctly cleaned up, and don't "leak" until interpreter destruction. (Which might be some time away, in a persistent process.)
* Better ithreads cloning - add all SVs with a 0 refcnt to the temps stack.Nicholas Clark2010-05-241-0/+9
| | | | | | | | | | Track all SVs created by sv_dup() that have a 0 reference count. If they still have a 0 reference count at the end of cloning, assign a reference to each to the temps stack. As the temps stack is cleared at thread exit, SVs book keeping will be correct and consistent before perl_destruct() makes its check for leaked scalars. Remove special case code for checking each @_ and the parent's temp stack.
* Abstract *correct* initialisation of CLONE_PARAMS into Perl_clone_params_new().Nicholas Clark2010-05-241-0/+15
| | | | | | | | | | | | | As it allocates memory dynamically, add Perl_clone_params_del(). This will allow CLONE_PARAMS to be expand in future in a source and binary compatible fashion. These implementations of Perl_clone_params_new()/Perl_clone_params_del() jump through hoops to remain source and binary compatible, in particular, by not assuming that the structure member is present and correctly initialised. Hence they should be suitable for inclusion into Devel::PPPort. Convert threads.xs to use them, resolving RT #73046.
* Convert Perl_sv_dup_inc() from a macro to a real function.Nicholas Clark2010-05-241-0/+6
|
* Make HvFILL() count the allocated buckets, instead of reading a stored value.Nicholas Clark2010-05-211-0/+5
| | | | | Add a function Perl_hv_fill to perform the count. This will save 1 IV per hash, and on some systems cause struct xpvhv to become cache aligned.
* make overload respect get magicDavid Mitchell2010-05-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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, <>.
* add flags arg to sv_2nv (as sv_2nv_flags)David Mitchell2010-05-081-1/+1
|
* Fix parameter name for die_unwind() in embed.fncRafael Garcia-Suarez2010-05-041-2/+2
|
* Merge remote branch 'zefram/zefram/reliable_exception' into bleadRafael Garcia-Suarez2010-05-041-7/+32
|\ | | | | | | | | Conflicts: pp_ctl.c
| * SV-based interfaces for dieing and warningZefram2010-04-231-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act much like their _sv-less counterparts, but take a single SV argument instead of sprintf-like format and args. They will accept RVs, passing them through as such. This means there's no more need to clobber ERRSV in order to throw a structured exception. pp_warn() and pp_die() are rewritten to use the _sv interfaces. This fixes part of [perl #74538]. It also means that a structured warning object will be passed through to $SIG{__WARN__} instead of being stringified, thus bringing warn in line with die with respect to structured exception objects. The new functions and their existing counterparts are all fully documented.
* | Deprecate Perl_ptr_table_clear(). Nothing outside sv.c uses it.Nicholas Clark2010-04-291-1/+3
| | | | | | | | | | Inline the necessary parts of Perl_ptr_table_clear() into Perl_ptr_table_free(). No need to reset memory to zero that is about to be freed anyway.
* | Convert Perl_magic_methcall() to varargs.Nicholas Clark2010-04-261-1/+1
| | | | | | | | | | This means removing its macro wrapper, as there's no portable way to do varargs macros.
* | For Perl_magic_methcall() add G_UNDEF_FILL to fill the stack with &PL_sv_undef.Nicholas Clark2010-04-261-1/+1
| | | | | | | | | | | | This replaces the previous special case of using a negative argument count to signify this, allowing the argument count to become unsigned. Rename it from n to argc.
* | remove Perl_pmflagRobin Barker2010-04-261-6/+0
| |
* | regen header after last patchesRafael Garcia-Suarez2010-04-261-0/+3
| |
* | Change the flags argument to magic_methcall/magic_methcall1 from I32 to U32.Nicholas Clark2010-04-251-2/+2
| |
* | add Perl_magic_methcallDavid Mitchell2010-04-251-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new function that wraps the setup needed to call a magic method like FETCH (the existing S_magic_methcall function has been renamed S_magic_methcall1). There is one functional change, done mainly to allow for a single clean wrapper function, and that is that the method calls are no longer wrapped with SAVETMPS/FREETMPS. Previously only about half of them had this, so some relied on the caller to free, some didn't. At least we're consistent now. Doing it this way is necessary because otherwise magic_methcall() can't return an SV (eg for POP) because it'll be a temp and get freed by FREETMPS before it gets returned. So you'd have to copy everything, which would slow things down.
* | consting in lex_stuff_pvnRobin Barker2010-04-231-1/+1
|/
* Regen headers after previous patchesRafael Garcia-Suarez2010-02-191-6/+7
|
* Convert Perl_sv_pos_u2b_proper() to Perl_sv_pos_u2b_flags().Nicholas Clark2010-02-141-4/+4
| | | | | | | 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.
* Removes 32-bit limit on substr arguments. The full range of IV and UV is ↵Eric Brine2010-02-141-0/+5
| | | | available for the pos and len arguments, with safe conversion to STRLEN where it's smaller than an IV.
* Qualify pointer arguments of prescan_version in embed.fncRafael Garcia-Suarez2010-01-151-1/+1
|
* Omnibus strict and lax version parsingDavid Golden2010-01-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Authors: John Peacock, David Golden and Zefram The goal of this mega-patch is to enforce strict rules for version numbers provided to 'package NAME VERSION' while formalizing the prior, lax rules used for version object creation. Parsing for use() is unchanged. version.pm adds two globals, $STRICT and $LAX, containing regular expressions that define the rules. There are two additional functions -- version::is_strict and version::is_lax -- that test an argument against these rules. However, parsing of strings that might contain version numbers is done in core via the Perl_scan_version function, which may be called during compilation or may be called later when version objects are created by Perl_new_version or Perl_upg_version. A new helper function, Perl_prescan_version, has been added to validate a string under either strict or lax rules. This is used in toke.c for 'package NAME VERSION' in strict mode and by Perl_scan_version in lax mode. It matches the behavior of the verison.pm regular expressions, but does not use them directly. A new test file, comp/packagev.t, validates strict and lax behaviors of 'package NAME VERSION' and 'version->new(VERSION)' respectively and verifies their behavior against the $STRICT and $LAX regular expressions, as well. Validating these two implementation should help ensure they each work as intended. Other files and tests have been modified as necessary to support these changes. There is remaining work to be done in a few areas: * documenting all changes in behavior and new functions * determining proper treatment of "," as decimal separators in various locales * updating diagnostics for new error messages * porting changes back to the version.pm distribution on CPAN, including pure-Perl versions
* qr/\X/ expansionKarl Williamson2009-12-051-0/+60
|
* cleanup get_arena param-names, mark as May-ChangeJim Cromie2009-11-241-1/+1
| | | | | new param-names reflect actual usage. Mark as may-change so we can add a reqid field later.
* Move change c35076938c7236fb into embed.fnc, from the generated file proto.hNicholas Clark2009-11-231-1/+1
|