summaryrefslogtreecommitdiff
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* Fix Devel::Peek’s tests for format changesFather Chrysostomos2012-08-051-2/+2
|
* Add a depth field to formatsFather Chrysostomos2012-08-051-2/+4
| | | | | Instead of lengthening the struct, we can reuse SvCUR, which is cur- rently unused.
* Make PL_(top|body|form)target PVIVsFather Chrysostomos2012-08-051-3/+11
| | | | | | | | | | | | | These are only used for storing a string and an IV. Making them into full-blown SVt_PVFMs is overkill. FmLINES was only being used on these three scalars. So make it use the SvIVX field. struct xpvfm no longer needs an xfm_lines member, because SVt_PVFMs no longer use it. This also causes a TODO test in taint.t to start passing, but I do not fully understand why. But at least that’s progress. :-)
* Add PERL_NO_GET_CONTEXT to Win32COREDaniel Dragan2012-07-301-0/+1
| | | | | Win32CORE is already ithreads aware, but was still making Perl_get_context calls. This fixes that. Smaller machine code is the result.
* Make undef &foo remove call checkersFather Chrysostomos2012-07-291-1/+10
| | | | | | | | | The fact that the call checker is stored in magic is an implementation detail. cv_undef does not free magic, so the call checker lives on. If we were to move the parameter prototype into magic internally, we would not want undef to stop clearing it. To me, the current situa- tion with call checkers is similar.
* Optimize a single character [class] into EXACTishKarl Williamson2012-07-241-4/+4
| | | | | Things like /[s]/ or /[s]/i can be optimized as if they did not have the brackets, /s/ or /s/i.
* Bump B's VERSION and note the changes in perldelta.pod.Nicholas Clark2012-07-241-1/+1
|
* Expose all GV flags matching qr/GVf_/ as constants in B.Nicholas Clark2012-07-241-2/+2
| | | | Previously only those matching qr/GVf_IMPORTED/ were exposed.
* Expose all CV flags matching qr/CVf_/ as constants in B.Nicholas Clark2012-07-241-11/+3
| | | | | | Previously most were exposed as constants, but often B was not taught about flags added to cv.h. Determining the flags by parsing cv.h also permits the removal of various version-specific logic from the Makefile.PL
* Expose all SV flags matching qr/SV(?:[fps]|pad)_/ as constants in B.Nicholas Clark2012-07-241-2/+1
| | | | Previously only a subset were exposed as constants.
* In ext/B/Makefile.PL, order the list of files to scan lexically.Nicholas Clark2012-07-241-4/+5
| | | | | | It doesn't actually matter which order the files are scanned for constants, but it's neater and slightly clearer where to add new files if there is an obvious order.
* ensure that the env var SV after C<{FOO}='x'> is PV onlyChip Salzenberg2012-07-243-2/+6
|
* Only generate above-Uni warning for \p{}, \P{}Karl Williamson2012-07-191-8/+17
| | | | | | | | | | | This warning was being generated inappropriately during some internal operations, such as parsing a program; spotted by Tom Christiansen. The solution is to move the check for this situation out of the common code, and into the code where just \p{} and \P{} are handled. As mentioned in the commit's perldelta, there remains a bug [perl #114148], where no warning gets generated when it should
* Magic flags harmonization.Chip Salzenberg2012-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In restore_magic(), which is called after any magic processing, all of the public OK flags have been shifted into the private OK flags. Thus the lack of an appropriate public OK flags was used to trigger both get magic and required conversions. This scheme did not cover ROK, however, so all properly written code had to make sure mg_get was called the right number of times anyway. Meanwhile the private OK flags gained a second purpose of marking converted but non-authoritative values (e.g. the IV conversion of an NV), and the inadequate flag shift mechanic broke this in some cases. This patch removes the shift mechanic for magic flags, thus exposing (and fixing) some improper usage of magic SVs in which mg_get() was not called correctly. It also has the side effect of making magic get functions specifically set their SVs to undef if that is desired, as the new behavior of empty get functions is to leave the value unchanged. This is a feature, as now get magic that does not modify its value, e.g. tainting, does not have to be special cased. The changes to cpan/ here are only temporary, for development only, to keep blead working until upstream applies them (or something like them). Thanks to Rik and Father C for review input.
* Simplify ck_grepFather Chrysostomos2012-07-143-20/+20
| | | | | | | | | | | | | | | | | | Back in perl 5.000, ck_grep would call ck_sort (which was still the case until 354dd559d99 just recently) and the latter would traverse its way through the op_next pointers to find an op that tried to escape the block, setting its op_next pointer to null. Then ck_grep would traverse op_next pointers itself to find the place where ck_sort stopped. That caused problems for grep which were fixed in 748a93069b (perl 5.001). It was fixed by setting op_next to 0 on the first op, so that the loop in ck_grep would not do anything. But that loop was left there. This commit removes it. There are also a couple of things I missed when disentangling ck_grep and ck_sort in commit /354dd559d9. I accidentally put if (o->op_flags & OPf_STACKED) inside if (o->op_flags & OPf_STACKED). And the OPf_SPECIAL flag was only being set for sort’s use, so ck_grep doesn’t need to copy that.
* [perl #113710] Make __SUB__ work in sort blockFather Chrysostomos2012-07-142-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the peephole optimiser encounters a __SUB__, it looks to see whether the current sub is clonable. If it is not, it inlines the __SUB__ as a const op. This works most of the time. A forward declaration will cause the sub definition to reuse the existing stub. When that happens, the sub visible during compilation in PL_compcv is not the sub that the op tree will finally be attached to. But the peephole optimiser is called after that, with PL_compcv set to the other CV (what was a stub). ck_sort was calling the peephole optimiser on the sort block ahead of time. So this caused __SUB__ to point to the wrong subroutine. By removing the CALL_PEEP call from ck_sort and adding logic to the peephole optimiser itself to traverse the sort block (it is not in the usual op_next chain), this bug is eliminated. I modified the DEFER macro to work as a single statement. You don’t want to know how much time I spent debugging the bus errors that were occurring because if(foo) DEFER; didn’t do what I though. It turns out that grepstart and mapstart, which also use ck_sort, had their blocks go through the peephole optimiser twice, because grepwhile already has special-casing in the peephole optimiser. This also has the side-effect of making map and grep slightly more efficient, in that they no longer execute a scope op (which is just pp_null). By temporarily disconnecting the subtree before running the optimiser, ck_sort was hiding a possible optimisation (skipping the scope op).
* silence warning about use of --libpodsRobin Barker2012-07-131-1/+0
| | | | | --lipods warns, and I don't think it is needed in this test, so I have removed it
* handy.: Add some tests for its APIKarl Williamson2012-07-082-2/+801
|
* Let rv2cv-hook CVs’ protos participate in method intuitionFather Chrysostomos2012-07-081-1/+7
| | | | | | | | | | | | | | | | Commit 39c012bc2fc2f1cf wasn’t enough. If a subroutine has a proto- type beginning with * then its name is treated as a sub call, even when followed by a package name: {package Foo} sub Foo {} foo Foo; # Foo->foo {package Bar} sub bar (*) {} bar Bar; # bar(Bar) This was not applying to subs looked up via rv2cv hooks.
* rv2cv hooks should not create 2nd-class subsFather Chrysostomos2012-07-062-0/+54
| | | | | | | | | | | | | | | | | $ perl5.17.2 -Mblib -e 'sub foo{}; foo $bar; use Lexical::Sub baz => sub{}; baz $bar' Can't call method "baz" on an undefined value at -e line 1. $ perl5.17.2 -Mblib -e 'sub foo{}; foo bar; use Lexical::Sub baz => sub{}; baz bar' Can't locate object method "baz" via package "bar" (perhaps you forgot to load "bar"?) at -e line 1. So if you use Lexical::Sub, your sub doesn’t get to participate in determining whether ‘foo $bar’ or ‘foo bar’ is a method call. This is because Lexical::Sub uses an rv2cv hook to intercept sub lookup. And toke.c:S_intuit_method thinks there cannot be a CV with- out a GV (which was the case when it was first written). Commit f7461760 introduced this rv2cv hooking for bareword lookup, but failed to update S_intuit_method accordingly.
* rt #72232 - ignore wday/yday in mini_mktime as indirectly documentedTony Cook2012-07-051-1/+16
|
* Increase $B::Concise::VERSION to 0.91Father Chrysostomos2012-07-041-1/+1
|
* Record folded constants in the op treeFather Chrysostomos2012-07-043-30/+30
|
* Avoid needless use of deprecated exists on array elementsEric Brine2012-07-031-2/+2
|
* op.c:newFOROP: Fall back to realloc for unslabbed opsFather Chrysostomos2012-07-022-0/+22
| | | | | | | | | | | | | | | | | | | | When an op is allocated, PL_compcv is checked to see whether it can hold an op slab if it does not hold one already. If PL_compcv is not usable, for whatever reason, it falls back to malloc. Since the new slab allocator was added in commit 8be227a, newFOROP has been assuming, probably correctly, that its listop which it needs to enlarge to a loopop was allocated by slab. Since newFOROP is an API function, we should err on the safe side and check first whether the op is slab-allocated, falling back to realloc if it is not. To trigger this potential bug, one has to set things up such that there is a usable pad available, but no usable PL_compcv. I said ‘probably correctly’ above because this situation is highly unlikely and probably indicative of bugs elsewhere. (But we should still err on the side of safety.)
* handy.h: Fix isBLANK_uni and isBLANK_utf8Karl Williamson2012-06-293-1/+29
| | | | | | | | | | These macros have never worked outside the Latin1 range, so this extends them to work. There are no tests I could find for things in handy.h, except that many of them are called all over the place during the normal course of events. This commit adds a new file for such testing, containing for now only with a few tests for the isBLANK's
* Null HeVAL and local delete → crashFather Chrysostomos2012-06-271-0/+4
| | | | | | | | | The XS API allows hash entries to be created with null values. perl itself uses these internally, too. Though they should rarely be seen by Perl code, Perl ops should still be able to handle them without crashing (by croaking). I fixed helem and hslice in 5.16 (commit 746f6409), but missed localised deletions.
* Increase $PerlIO::scalar::VERSION to 0.15Father Chrysostomos2012-06-201-1/+1
|
* [perl #113764] Make &= duping work with PerlIO::scalarFather Chrysostomos2012-06-202-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | In trying to fix bug #112780, I made in-memory handle duplication tem- porarily hide the underlying scalar so it wouldn’t be set to the empty string (commit 49b69fb3a). I used PerlIO_sv_dup in j rather than PerlIOScalar_arg. The for- mer is usually what is called anyway. There is only one branch of PerlIOScalar_arg that doesn’t call PerlIO_sv_dup. I don’t remember what I was thinking back then, but I think I thought that branch was there for paranoia. But actually, it is used for "&=", so this started failing: open FILE, '>', \my $content or die "Couldn't open scalar filehandle"; open my $fh, ">&=FILE" or die "Couldn't open: $!"; print $fh "Foo-Bar\n"; close $fh; close FILE; print $content; This commit fixes the bug in the smallest way possible, which means switching from PerlIO_sv_dup to PerlIOScalar_arg in PerlIOScalar_arg, which, in turn, entails fiddling with RVs.
* PATCH: [perl #113750] re.pm clobbers $_Karl Williamson2012-06-202-3/+8
| | | | Thanks to Jesse Luehrs and Father Chrysostomos for testing advice.
* POSIX: Sometimes `printf` beats interpolationAristotle Pagaltzis2012-06-191-1/+1
|
* Tidier example code for POSIX::localeconv()Daniel Perrett2012-06-191-21/+26
|
* Update DynaLoader's VERSION after commit 7d08496d81c138d9.Nicholas Clark2012-06-181-1/+1
|
* update docs for (?{}) jumbo fixDavid Mitchell2012-06-141-2/+3
| | | | | | Update the docs and add perldelta entries summarising the changes and fixes related to (?{}) and (??{}) accumulated over the 120 or so commits in this branch.
* let B know about new op_code_list fieldDavid Mitchell2012-06-132-0/+6
|
* propagate /msix and (?msix) etc flags into (??{})David Mitchell2012-06-131-1/+10
| | | | | | | | | | | In /.........(??{ some_string_value; }).../flags and /(?flags).(??{ some_string_value; }).../, use flags when compiling the inner /some_string_value/ pattern. Achieve this by storing the compile-time modifier flags in the (apparently) unused 'flags' field of the EVAL node in the (??{}) case.
* make Perl_... and my_re_op_compile sigs matchDavid Mitchell2012-06-131-1/+1
|
* eliminate RExC_seen_evals and RExC_rx->seen_evalsDavid Mitchell2012-06-131-1/+0
| | | | | these were used as part of the old "use re 'eval'" security mechanism used by the now-eliminated PL_reginterp_cnt
* bump re.pm version numberDavid Mitchell2012-06-131-1/+1
|
* fix =/== typo in ext/re/t/regop.tDavid Mitchell2012-06-131-1/+1
|
* add op_comp field to regexp_engine APIDavid Mitchell2012-06-131-2/+6
| | | | | | | | | | | | | | | | | | | | Perl's internal function for compiling regexes that knows about code blocks, Perl_re_op_compile, isn't part of the engine API. However, the way that regcomp.c is dual-lifed as ext/re/re_comp.c with debugging compiled in, means that Perl_re_op_compile is also compiled as my_re_op_compile. These days days the mechanism to choose whether to call the main functions or the debugging my_* functions when 'use re debug' is in scope, is the re engine API jump table. Ergo, to ensure that my_re_op_compile gets called appropriately, this method needs adding to the jump table. So, I've added it, but documented as 'for perl internal use only, set to null in your engine'. I've also updated current_re_engine() to always return a pointer to a jump table, even if we're using the internal engine (formerly it returned null). This then allows us to use the simple condition (eng->op_comp) to determine whether the current engine supports code blocks.
* make qr/(?{})/ behave with closuresDavid Mitchell2012-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this commit, qr// with a literal (compile-time) code block will Do the Right Thing as regards closures and the scope of lexical vars; in particular, the following now creates three regexes that match 1, 2 and 3: for my $i (0..2) { push @r, qr/^(??{$i})$/; } "1" =~ $r[1]; # matches Previously, $i would be evaluated as undef in all 3 patterns. This is achieved by wrapping the compilation of the pattern within a new anonymous CV, which is then attached to the pattern. At run-time pp_qr() clones the CV as well as copying the REGEXP; and when the code block is executed, it does so using the pad of the cloned CV. Which makes everything come out all right in the wash. The CV is stored in a new field of the REGEXP, called qr_anoncv. Note that run-time qr//s are still not fixed, e.g. qr/$foo(?{...})/; nor is it yet fixed where the qr// is embedded within another pattern: continuing with the code example from above, my $i = 99; "1" =~ $r[1]; # bare qr: matches: correct! "X99" =~ /X$r[1]/; # embedded qr: matches: whoops, it's still seeing the wrong $i
* add Perl_re_op_compile functionDavid Mitchell2012-06-132-0/+2
| | | | | | | | | | | | Make Perl_re_compile() a thin wrapper around a new function, Perl_re_op_compile(). This function can take either a string pattern or a list of ops. Then make pmruntime() pass a list of ops directly to it, rather concatenating all the consts into a single string and passing the const to Perl_re_compile(). For now, Perl_re_op_compile just does the same: if its passed an op tree rather than an SV, then it just concats the consts. So this is is just the next step towards eventually allowing the regex engine to use the ops directly.
* [perl #111610] Trouble with XS-APItest/t/clone-with-stack.tMichael Schroeder2012-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | I ran into a bit of a problem when building perl-5.16.0. 'make test' showed a segfault in ext/XS-APItest/t/clone-with-stack.t. It seems to be caused by accessing already freed memory, it segfaults because I have MALLOC_PERTUBE_ set, thus glibc fills freed memory with some value. Digging deeper, it seems like perl_clone() does not fix the cx's blk_oldcop element when doing context cloning, thus blk_oldcop still points to PL_compiling in the old interp--the calling scope for the BEGIN block being the compilation of the code surrounding it--and the POPBLOCK done in leavesub will copy the data from the old interp to PL_curcop. After fixing this, it still crashed because interp_dup->Iop was zero after the runops_standard() call (which is probably correct as the end of the BEGIN block was reached). So I also added an if statement that checks the pointer.
* Add alloccopstash provisionally to the APIFather Chrysostomos2012-06-083-1/+21
|
* Make B::COP::stashpv respect utf8 and embedded nullsFather Chrysostomos2012-06-052-7/+33
| | | | | | | | | This was mentioned in ticket #113060. This commit also adds another stashoff test. The diff looks a bit complicated, because it stops ->file and ->stashpv from being XS aliases.
* Fix version logic in B.xsFather Chrysostomos2012-06-051-4/+2
|
* Change B::COP::stashlen to stashoffFather Chrysostomos2012-06-053-13/+16
| | | | | | | | | | | | | This was brought up in ticket #78742. The stashlen method has never been in a stable release, and no longer exists, as of d4d03940c, since it is dependent on a define that d4d03940c removed. So this commit removes stashlen from B.xs and adds stashoff in its place, since this is what B::C needs. It also adds a few basic tests for the stash and stashpv methods.
* [perl #78742] Store CopSTASH in a pad under threadsFather Chrysostomos2012-06-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, a pointer to the cop’s stash was stored in cop->cop_stash under non-threaded perls, and the name and name length were stored in cop->cop_stashpv and cop->cop_stashlen under ithreads. Consequently, eval "__PACKAGE__" would end up returning the wrong package name under threads if the current package had been assigned over. This commit changes the way cops store their stash under threads. Now it is an offset (cop->cop_stashoff) into the new PL_stashpad array (just a mallocked block), which holds pointers to all stashes that have code compiled in them. I didn’t use the lexical pads, because CopSTASH(cop) won’t work unless PL_curpad is holding the right pad. And things start to get very hairy in pp_caller, since the correct pad isn’t anywhere easily accessible on the context stack (oldcomppad actually referring to the current comppad). The approach I’ve followed uses far less code, too. In addition to fixing the bug, this also saves memory. Instead of allocating a separate PV for every single statement (to hold the stash name), now all lines of code in a package can share the same stashpad slot. So, on a 32-bit OS X, that’s 16 bytes less memory per COP for short package names. Since stashoff is the same size as stashpv, there is no difference there. Each package now needs just 4 bytes in the stashpad for storing a pointer. For speed’s sake PL_stashpadix stores the index of the last-used stashpad offset. So only when switching packages is there a linear search through the stashpad.
* Increase $B::VERSION to 1.36Father Chrysostomos2012-06-041-1/+1
|