summaryrefslogtreecommitdiff
path: root/proto.h
Commit message (Collapse)AuthorAgeFilesLines
* Shorten external symbol name for VMSFlorian Ragwitz2010-09-111-2/+2
| | | | | | VMS seems to have a 31 character limitation for external symbols. To be able to fit into that, rename 'coerce_qwlist_to_paren_list' to 'munge_qwlist_to_paren_list'.
* Remove offer_nice_chunk(), PL_nice_chunk and PL_nice_chunk_size.Nicholas Clark2010-09-081-6/+0
| | | | | | | | | | | | | | | | | | These provided a non-public API for the hash and array code to donate free memory direct to the SV head allocation routines, instead of returning it to the malloc system with free(). I assume that on some older mallocs this could offer significant benefits. However, my benchmarking on a modern malloc couldn't detect any significant effect (positive or negative) on removing the code. Its (continued) presence, however, has downsides a: slightly more code complexity b: slightly larger interpreter structure c: in the steady state, if net creation of SVs is zero, 1 chunk of allocated but unused memory will exist (per thread) So I think it best to remove it.
* make qw(...) first-class syntaxZefram2010-09-081-0/+5
| | | | | | | | | | This makes a qw(...) list literal a distinct token type for the parser, where previously it was munged into a "(",THING,")" sequence. The change means that qw(...) can't accidentally supply parens to parts of the grammar that want real parens. Due to many bits of code taking advantage of that by "foreach my $x qw(...) {}", this patch also includes a hack to coerce qw(...) to the old-style parenthesised THING, emitting a deprecation warning along the way.
* Move magicalize_{isa,overload} out into functionsFlorian Ragwitz2010-09-081-0/+11
| | | | | This way c++ compilers like us again, as we don't do jumps that skip initialisations anymore.
* make regen.Ben Morrow2010-09-071-0/+20
|
* Regenerate headers after last patchRafael Garcia-Suarez2010-09-061-2/+4
|
* Change the first argument of Perl_fetch_cop_label() to COP *Nicholas Clark2010-09-021-1/+5
| | | | | | | | | | From a suggestion from Ben Morrow. The first argument used to be struct refcounted_he *, which exposed an implementation detail - that the COP's labels are (now) stored in this way. Google Code Search and an unpacked CPAN both fail to find any users of this API, so the impact should be minimal.
* Refactor Perl_store_cop_label() to avoid exposing struct refcounted_he *.Nicholas Clark2010-09-011-2/+3
| | | | | | | Instead pass in a COP, as suggested by Ben Morrow. Also add length and flags parameters, and remove the comment suggesting this change. The underlying storage mechanism can honour length and UTF8/not, so there is no harm in exposing this one level higher.
* add sv_reftype_len() and make sv_reftype() be a wrapper for itYves Orton2010-08-301-0/+7
| | | | | | | | | sv_reftype() mostly returns strings whose length is known at compile time, so we can avoid a strlen() call if we return the length. Additionally, the non-length interface is potentially buggy in the face of class names which contain "\0", therefore providing a way to obtain the true length allows us to avoid any trickyness.
* make recursive part of peephole optimiser hookableZefram2010-08-261-0/+1
| | | | | | | | New variable PL_rpeepp makes it possible for extensions to hook the per-op-chain part of the peephole optimiser (which recurses into side chains). The existing variable PL_peepp still allows hooking the per-sub part of the peephole optimiser, maintaining perfect backward compatibility.
* Move the declaration for more_bodies outside of an #if defined(PERL_IN_SV_C)Nicholas Clark2010-08-201-1/+2
| | | | | | | It used to be a static function, hence the location, and I failed to spot that I needed to move it, when I edited it to be non-static. Problem spotted by Jerry D. Hedden.
* Expose more_bodies(), and use it to replace S_more_he().Nicholas Clark2010-08-201-6/+1
| | | | | | | Convert get_arena() to be static, as now its only user is Perl_more_bodies(). Perl_get_arena() was not in the public API, and neither Google codesearch nor an upacked CPAN show anything to be using it.
* In sv.c, pass in values to S_more_bodies, instead of using bodies_by_type.Nicholas Clark2010-08-201-1/+1
| | | | Also fix one value passed to the debugging *_printf() in the #else block.
* Revert "Make the peep recurse via PL_peepp"Florian Ragwitz2010-08-161-5/+1
| | | | | | | | | | | | | This reverts commit 65bfe90c4b4ea5706a50067179e60d4e8de6807a. While it made a few of the things I wanted possible, a couple of other things one might need to do and I thought this change would enable don't actually work. Thanks Zefram for pointing out my mistake. Conflicts: ext/XS-APItest/APItest.xs op.c
* optimise single backreferencesDavid Mitchell2010-08-011-4/+3
| | | | | | | | | | | Rather than creating an AV and pushing the backref onto it, store a single backref directly in the mg_obj or xhv_backreferences slot. If the backref is an AV, then we skip this optimisation (although I don't think at the moment, that an AV would ever be pointed to by some backref magic). So the test of whether the optimisation is is in effect is whether the thing in the slot is an AV or not.
* Revert "process xhv_backreferences early in S_hfreeentries"David Mitchell2010-07-291-0/+7
| | | | | | | | | | | This reverts commit 044d8c24fa9214cf0fe9c6fc8a44e03f3f5374d7. Conflicts: hv.c That commit tried to simply the xhv_backreferences processing, but was totally wrong and broke ordinary weak refs to hashes (see #76716).
* Change function signature of grok_bslash_oKarl Williamson2010-07-271-3/+4
| | | | The previous return value where NULL meant OK is outside-the-norm.
* Make the peep recurse via PL_peeppFlorian Ragwitz2010-07-251-1/+5
| | | | | | | | | | | Also allows extensions, when delegating to Perl_peep, to specify what function it should use when recursing into a part of the op tree. The usecase for this are extensions like namespace::alias, which need to hook into the peep to do their thing. With this change they can stop copying the whole peep only to add tiny bits of new behaviour to it, allowing them to work easier on a large variety of perls, without having to maintain one peep which works on all of them (which is HARD!).
* 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
|