summaryrefslogtreecommitdiff
path: root/ext/B
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge branch 'avar/POSIX-strptime' into blead"Ævar Arnfjörð Bjarmason2012-02-151-1/+1
| | | | | | | | | | This reverts commit 0e582130ad8fc3afc6514f60b7a513c550379b7d, reversing changes made to a748fe11f70695552294fe4e31343b2dacb59db2. Conflicts: ext/POSIX/POSIX.xs ext/POSIX/lib/POSIX.pm
* Initial hack at strptime(); just literal strings for nowPaul "LeoNerd" Evans2012-02-111-1/+1
|
* B.pm: Document stashflagsFather Chrysostomos2012-01-311-0/+2
| | | | | (actually just list in; you have to know the internals to use these things anyway)
* In B.xs, use *pvf() functions to reduce the number of API calls.Nicholas Clark2012-01-311-7/+5
| | | | This gives a small reduction in both source lines and object code size.
* [perl #77388] Make stacked -t workFather Chrysostomos2012-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up till now, -t was popping too much off the stack when stacked with other filetest operators. Since the special use of _ doesn’t apply to -t, we cannot simply have it use _ when stacked, but instead we pass the argument down from the previous op. To facilitate this, the whole stacked mechanism has to change. As before, in an expression like -r -w -x, -x and -w are flagged as ‘stacking’ ops (followed by another filetest), and -w and -r are flagged as stacked (preceded by another filetest). Stacking filetest ops no longer return a false value to the next op when a test fails, and stacked ops no longer check the truth of the value on the stack to determine whether to return early (if it’s false). The argument to the first filetest is now passed from one op to another. This is similar to the mechanism that overloaded objects were already using. Now it applies to any argument. Since it could be false, we cannot rely on the boolean value of the stack item. So, stacking ops, when they return false, now traverse the ->op_next pointers and find the op after the last stacked op. That op is returned to the runloop. This short-circuiting is proba- bly faster than calling every subsequent op (a separate function call for each). Filetest ops other than -t continue to use the last stat buffer when stacked, so the argument on the stack is ignored. But if the op is preceded by nothing other than -t (where preceded means on the right, since the ops are evaluated right-to-left), it *does* use the argument on the stack, since -t has not set the last stat buffer. The new OPpFT_AFTER_t flag indicates that a stacked op is preceded by nothing other than -t. In ‘-e -t foo’, the -e gets the flag, but not in ‘-e -t -r foo’, because -r will have saved the stat buffer, so -e can just use that.
* Increase $B::VERSION to 1.34Father Chrysostomos2012-01-231-1/+1
|
* B.xs add missing B::COP::stashflagsReini Urban2012-01-231-0/+11
| | | | Threaded perl added this field with 5.15.4 for utf8 stashes.
* B.pm POD: revise 44f7f2d5b1 on IoFLAGSReini Urban2012-01-231-2/+0
| | | | IoFLAGS are not defined in perliol.h
* B.pm: spaces after dotsFather Chrysostomos2012-01-191-28/+29
|
* B.pm: wording tweaksFather Chrysostomos2012-01-191-3/+4
|
* Make B’s pod fit in 79 colsFather Chrysostomos2012-01-191-2/+2
|
* Document B::PV’s LEN and CUR methodsFather Chrysostomos2012-01-191-1/+11
|
* Increase $B::VERSION to 1.32Father Chrysostomos2012-01-191-1/+1
|
* B.pm: fix and add B::IO documentationReini Urban2012-01-191-3/+28
| | | | | add pod to B::IO Methods and IoTYPE. fix IsSTD.
* [perl #103492] Give lvalue cx to (s)printf argsFather Chrysostomos2011-12-311-12/+15
| | | | | | | | | Or potential lvalue context, like function calls. The %n format code’s existence renders these two very much like func- tion calls, as they can modify their arguments. This allows sprintf("...%n", substr ...) to work.
* Convert POSIX::sleep to an XS wrapper for PerlProc_sleep().Nicholas Clark2011-12-301-1/+1
| | | | | | | | Previously it was a Perl wrapper for CORE::sleep, converting CORE::sleep's return value of elapsed time slept into the POSIX return value of seconds remaining. However, that approach could sometimes return a negative result if CORE::sleep had slept for more than a second longer than the requested time.
* Update concise-xs.t for recent DD changeFather Chrysostomos2011-12-251-1/+2
|
* Update concise-xs.t for B::Deparse’s new importsFather Chrysostomos2011-12-231-2/+2
|
* Teach B::Concise about OPpCONST_NOVERFather Chrysostomos2011-12-181-1/+2
|
* Stop tell($glob_copy) from clearing PL_last_in_gvFather Chrysostomos2011-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug is a side effect of rv2gv’s starting to return an incoercible mortal copy of a coercible glob in 5.14: $ perl5.12.4 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell' 0 $ perl5.14.0 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell' -1 In the first case, tell without arguments is returning the position of the filehandle. In the second case, tell with an explicit argument that happens to be a coercible glob (tell has an implicit rv2gv, so tell $fh is actu- ally tell *$fh) sets PL_last_in_gv to a mortal copy thereof, which is freed at the end of the statement, setting PL_last_in_gv to null. So there is no ‘last used’ handle by the time we get to the tell without arguments. This commit adds a new rv2gv flag that tells it not to copy the glob. By doing it unconditionally on the kidop, this allows tell(*$fh) to work the same way. Let’s hope nobody does tell(*{*$fh}), which will unset PL_last_in_gv because the inner * returns a mortal copy. This whole area is really icky. PL_last_in_gv should be refcounted, but that would cause handles to leak out of scope, breaking programs that rely on the auto-closing ‘feature’.
* Fix ext/B/t/f_map.t failureFather Chrysostomos2011-12-071-1/+1
| | | | | Tiny typo on my part. Strangely, the tests passed for me before, so I probably made a mistake in trying to switch branches.
* Fix up ext/B/t for strict.pm changesFather Chrysostomos2011-12-076-136/+136
|
* Optimise substr assignment in void contextFather Chrysostomos2011-11-262-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In void context we can optimise substr($foo, $bar, $baz) = $replacement; to something like substr($foo, $bar, $baz, $replacement); except that the execution order must be preserved. So what we actu- ally do is substr($replacement, $foo, $bar, $baz); with a flag to indicate that the replacement comes first. This means we can also optimise assignment to two-argument substr the same way. Although optimisations are not supposed to change behaviour, this one does. • It stops substr assignment from calling get-magic twice, which means the optimisation makes things less buggy than usual. • It causes the uninitialized warning (for an undefined first argu- ment) to mention the substr operator, as it did before the previous commit, rather than the assignment operator. I think that sort of detail is minor enough. I had to make the warning about clobbering references apply whenever substr does a replacement, and not only when used as an lvalue. So four-argument substr now emits that warning. I would consider that a bug fix, too. Also, if the numeric arguments to four-argument substr and the replacement string are undefined, the order of the uninitialized warn- ings is slightly different, but is consistent regardless of whether the optimisation is in effect. I believe this will make 95% of substr assignments run faster. So there is less incentive to use what I consider the less readable form (the four-argument form, which is not self-documenting). Since I like naïve benchmarks, here are Before and After: $ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000' real 0m2.391s user 0m2.381s sys 0m0.005s $ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000' real 0m0.936s user 0m0.927s sys 0m0.005s
* [perl #80628] __SUB__Father Chrysostomos2011-11-221-2/+2
| | | | | After much alternation, altercation and alteration, __SUB__ is finally here.
* Oops. I thought I tested that.Father Chrysostomos2011-11-201-1/+1
|
* Add new OPpEVAL flags to B::ConciseFather Chrysostomos2011-11-061-1/+1
|
* Increase $B::Concise::VERSION to 0.87Father Chrysostomos2011-11-061-1/+1
|
* Add evalbytes functionFather Chrysostomos2011-11-061-1/+1
| | | | | | | | | | | This function evaluates its argument as a byte string, regardless of the internal encoding. It croaks if the string contains characters outside the byte range. Hence evalbytes(" use utf8; '\xc4\x80' ") will return "\x{100}", even if the original string had the UTF8 flag on, and evalbytes(" '\xc4\x80' ") will return "\xc4\x80". This has the side effect of fixing the deparsing of CORE::break under ‘use feature’ when there is an override.
* update B::Concise test for B::Deparse changeZefram2011-09-161-0/+1
|
* Teach B::Concise about OPpFT_STACKINGFather Chrysostomos2011-09-101-1/+1
|
* remove index offsetting ($[)Zefram2011-09-094-10/+10
| | | | | | $[ remains as a variable. It no longer has compile-time magic. At runtime, it always reads as zero, accepts a write of zero, but dies on writing any other value.
* Replace use of AutoLoader in POSIX with a custom compilation deferral scheme.Aristotle Pagaltzis2011-09-011-1/+2
|
* Reassign op_private flags of OP_ENTERSUB such that bits 32 and 64 can be ↵Gerard Goossen2011-09-011-1/+1
| | | | used by OPpDEREF
* Add OPpCOREARGS_SCALARMOD flagFather Chrysostomos2011-08-261-1/+1
| | | | | pp_coreargs will use this to distinguish between the \$ and \[$@%*] prototypes.
* Add OPpCOREARGS_PUSHMARK flagFather Chrysostomos2011-08-251-1/+1
| | | | | | | | | This will be used to tell pp_coreargs when it needs to call pp_pushmark. For those functions that need a pushmark, it has to come between two things that pp_coreargs does; so the easiest way is to use this flag.
* Add private coreargs flags for vivifying GVsFather Chrysostomos2011-08-251-1/+2
|
* [perl #97088] Prevent double get-magic in various casesGerard Goossen2011-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch prevents get-magic from executing twice during autovivifi- cation when the op doing the autovivification is not directly nested inside the dereferencing op. This can happen in cases like this: ${ (), $a } = 1; Previously (as of 5.13.something), the outer op was marked with the OPpDEREFed flag, which indicated that get-magic had already been called by the vivifying op (calling get-magic during vivification is inevitable): $ perl5.14.0 -MO=Concise -e '${ $a } = 1' 8 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 2 -e:1) v:{ ->3 7 <2> sassign vKS/2 ->8 3 <$> const[IV 1] s ->4 6 <1> rv2sv sKRM*/DREFed,1 ->7 <-- right here - <@> scope sK ->6 - <0> ex-nextstate v ->4 5 <1> rv2sv sKM/DREFSV,1 ->6 4 <#> gv[*a] s ->5 -e syntax OK But in the ${()...} example above, there is a list op in the way that prevents the flag from being set inside the peephole optimizer. It’s not even possible to set it correctly in all cases, as in this exam- ple, which would need it both set and not set depending on which branch of the ternary operator is executed: ${ $x ? delete $a[0] : $a[0] } = 1 Instead of setting the OPpDEREFed flag, we now make a non-magic copy of the SV in vivify_ref (the first time get-magic is executed).
* Add OPpASSIGN_CV_TO_GV to B::ConciseFather Chrysostomos2011-08-191-0/+1
|
* Add OPpDONT_INIT_GV to B::ConciseFather Chrysostomos2011-08-191-0/+1
|
* &CORE::wantarray()Father Chrysostomos2011-08-181-0/+1
| | | | | | | | This commit allows &CORE::wantarray to be called via ampersand syntax or through references. It adds a new private flag for wantarray, OPpOFFBYONE, which caller will use as well, telling wantarray (or caller) to look one call fur- ther up the call stack.
* Remove OPpENTERSUB_NOMOD from B::ConciseFather Chrysostomos2011-08-151-2/+2
|
* B::Terse and B::Xref were missing some documentation.Reini Urban2011-08-142-3/+61
|
* Simplify embedvar.h, removing a level of macro indirection for PL_* variables.Nicholas Clark2011-08-112-17/+17
| | | | | | | For the default (non-multiplicity) configuration, PERLVAR*() macros now directly expand their arguments to tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>. This removes over 350 lines from F<embedvar.h>, which defined macros to map from C<PL_Idefgv> to C<PL_defgv> and so forth.
* Add tests for wrapping formats in B objectsFlorian Ragwitz2011-07-111-0/+9
|
* Reorder ops so that trans{,r} and aelemfast{,_lex} are adjacent.Nicholas Clark2011-06-121-1/+1
|
* Split OP_AELEMFAST_LEX out from OP_AELEMFAST.Nicholas Clark2011-06-122-3/+7
| | | | | | | | | | | | | 6a077020aea1c5f0 extended the OP_AELEMFAST optimisation to lexical arrays. Previously OP_AELEMFAST was only used as an optimisation for OP_GV, which is a PADOP/SVOP. However, by reusing the same opcode, and signalling (pad) lexical vs package, it introduced a myriad of special cases, because OP_PADAV is a BASEOP (not a PADOP), whilst OP_AELEMFAST is a PADOP/SVOP (which is larger). Using two OP numbers allows each variant to have the correct OP flags in PL_opargs. Both can continue to share the same C code.
* Store FBMs in PVMGs, instead of GVs.Nicholas Clark2011-06-111-2/+2
| | | | | | | | This should reduce the complexity of code dealing with GVs, as they no longer try to play several different incompatible roles. (As suggested by Ben Morrow. However, it didn't turn out to be as straightforward as one might have hoped).
* Store the BM table in mg_ptr instead of after SvCUR().Nicholas Clark2011-06-111-1/+18
| | | | | | | | | | | | Previously the 256 byte Boyer-Moore table was stored in the buffer of SvPVX() after the raw string by extending the buffer. Given that the scalar is alway upgraded to add PERL_MAGIC_bm magic, to clear the table and other flags, there's no extra memory cost in using mg_ptr in the MAGIC struct to point directly to the table. I believe that this removes the last place in the core that stores data beyond SvCUR().
* Abolish xbm_rare. Move BmUSEFUL() to union _xnvu and BmPREVIOUS() to the UV.Nicholas Clark2011-06-111-0/+5
| | | | | | | This reduces the complexity of the union declarations in sv.h. As B.xs is accessing the structures/unions directly, instead of using the macros, it needs a patch too.
* In B::Concise and op.h list all ops that use LVSUBFather Chrysostomos2011-06-091-1/+2
| | | | keys doesn’t actually use it yet, but it will soon.