summaryrefslogtreecommitdiff
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* Replace references to PL_vtbl_{bm,fm} in the code with PL_vtbl_regexp.Nicholas Clark2011-06-111-2/+2
| | | | | Also, in Perl_sv_magic() merge the case for PERL_MAGIC_dbfile with the others that return a NULL vtable.
* Tests for Perl_get_vtbl()Nicholas Clark2011-06-112-0/+49
|
* Store FBMs in PVMGs, instead of GVs.Nicholas Clark2011-06-112-4/+4
| | | | | | | | 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-112-1/+22
| | | | | | | | | | | | 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.
* Use SvTAIL() instead of BmFLAGS(). The core no longer uses BmFLAGS().Nicholas Clark2011-06-111-2/+0
|
* Don't fbm_compile() studied scalars, to give more flexibility in SV flag usage.Nicholas Clark2011-06-111-2/+18
| | | | | No real-world code would ever end up using a studied scalar as a compile-time second argument to index, so this isn't a real pessimisation.
* Don't allow study on an FBM scalar, to give more flexibility in SV flag usage.Nicholas Clark2011-06-111-2/+24
| | | | | No real-world code would ever end up studying an FBM scalar, so this isn't a real pessimisation.
* Test dumping studied scalars.Nicholas Clark2011-06-111-1/+29
|
* Perl_do_sv_dump() shouldn't show "IV" for a FBM, as it's not valid.Nicholas Clark2011-06-111-0/+38
| | | | | | | The memory is used for part of the FBM state. Tidy the order of conditions in the if() determining whether the IV/UV should be shown.
* In IPC::Open3, inline xfork() and xclose_on_exec(), and delete xpipe_anon().Nicholas Clark2011-06-111-20/+7
| | | | | | | All three functions are private, undocumented, unexported, and un(ab)used by any code on CPAN. The first two are used in only one place, so inline them. The third was added in 8960aa876f446ad2, without adding any code which used it, and it has remained unused ever since.
* In IPC::Open3::_open(), refactor the DO_SPAWN code to loop over @handles.Nicholas Clark2011-06-111-19/+9
|
* In IPC::Open3::_open(), refactor the fork/exec code to loop over @handles.Nicholas Clark2011-06-111-21/+10
|
* In IPC::Open3::_open(), refactor the common code into loops over @handles.Nicholas Clark2011-06-111-18/+20
| | | | | As fh_is_fd() is now used in only one location, inline it. (This function isn't exported, isn't documented, and isn't (ab)used by anything on CPAN.)
* In IPC::Open3::_open(), switch from 'r' and 'w' to '<' and '>'.Nicholas Clark2011-06-111-4/+4
| | | | | | | IO::Handle accepts either, but open only accepts the latter. In spawn_with_handles(), hoist the C<require Fcntl> into the only block that needs it - this avoids loading Fcntl on Win32.
* Use $handles[2]{dup_of_out} for the special case code for shared STD{OUT,ERR}.Nicholas Clark2011-06-111-5/+6
| | | | | As C<dup_of_out> is never set on the other two members of @handles, this will allow code simplification.
* In IPC::Open3::_open3(), move $kid_{rdr,wtr,err} to @handles.Nicholas Clark2011-06-111-29/+26
| | | | Switch to 3-arg open where code is changing.
* In IPC::Open3::_open3(), move $dup_{wtr,rdr,err} to @handles.Nicholas Clark2011-06-111-18/+18
|
* In IPC::Open3::_open3(), move $dad_{wtr,rdr,err} to @handles.Nicholas Clark2011-06-111-38/+41
| | | | | Switch to 3-arg open where code is changing. Additionally, @_ can now be used in place of @cmd.
* Move the table describing file handles near to the top of IPC::Open::open3().Nicholas Clark2011-06-111-22/+18
| | | | | Also convert fileno BAREWORD to fileno \*BAREWORD. These will aid future refactoring.
* Move the autovivification emulation code to the top of IPC::Open3::_open3().Nicholas Clark2011-06-111-7/+8
| | | | This avoids having to re-assign to the scalars $dad_wtr and $dad_rdr.
* Refactor IPC::Open3::_open3() to find the caller's package itself.Nicholas Clark2011-06-112-8/+7
| | | | | | | | | Previously it was passed in as a parameter by IPC::Open2::open2() and IPC::Open3::open3(), each of which used C<calller> to find it. Move the use of caller to one place. It would also be possible to use C<caller> to eliminate the first parameter to _open3(), but this would add more code than it removes, so doesn't seem wise.
* IPC::Open3::open3() couldn't duplicate numeric file descriptors on Windows.Nicholas Clark2011-06-112-4/+24
|
* Avoid an uninitialized hash key in IPC::Open::spawn_with_handles().Nicholas Clark2011-06-112-8/+4
|
* IPC::Open3::open3() shouldn't fail if any of *STD{IN,OUT,ERR} are localized.Nicholas Clark2011-06-112-5/+32
| | | | | | | | | | Previously it would fail on Win32, because spawn_with_handles() would attempt to duplicate all three, ignoring failures at this point, but then report failure to close any as a fatal error, even if this was because the earlier dup-ing had failed. Also avoid a warning in the *nix code path in open3() if STDERR is localized (and hence fileno STDERR is undefined).
* Add debug code to test IPC::Open3::spawn_with_handles() on *nix.Nicholas Clark2011-06-111-2/+23
| | | | | This allows testing of the (normally) Win32 and OS/2 specific code paths in IPC::Open3::open3().
* In IPC::Open3::_open(), use 3 argument open to avoid a special case for STDERR.Nicholas Clark2011-06-111-6/+3
| | | | | | | | The code for STDIN and STDOUT never ends up needing to duplicate a reference. The code for STDERR can, because of the earlier special case code to save STDOUT. It was special-cased to use fileno in commit 8b3e92c60014b4e7, in 1998. This was before 3 argument open. With 3 argument open the special case can be avoided.
* Generalise IPC::Open3::xopen() to $n-argument open.Nicholas Clark2011-06-111-2/+4
| | | | Previously it could only perform 2 argument open.
* Simplify the test for IPC::Open bug RT #72016.Nicholas Clark2011-06-111-10/+8
| | | | | | | | | | | | | | | | | | | | | The original bug was a request that errors be reported in the parent process, with a TODO test, and then a patch that added the feature for the !DO_SPAWN case, and removed the TODO. The *implication* of the bug report and the way the original test was only TODO for the !DO_SPAWN case was that errors were reported inconsistently between the two code paths of open3(). However, this is not the case - the DO_SPAWN path through open3() return a (pseudo) PID (and no error) when asked to run a non-existent program. Hence there is now a feature discrepancy between the alternative implementations, which feels like a bug that should (ultimately) be addressed. The original test could have expressed that more directly with one code path and a TODO. The refactoring of bd29e8c290c68f4f failed to spot this, and introduced new logic errors in the DO_SPAWN path - waitpid() should not be called if $@ is set. Set $pid outside the eval {} - this makes sure it is (re)set to undef if the eval fails, instead of holding its previous (now bogus) value.
* 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.
* Test that IPC::Open{2,3} correctly fault read-only file-handle parameters.Nicholas Clark2011-06-062-2/+10
|
* Test that IPC::Open{2,3} correctly qualify file handles to their package.Nicholas Clark2011-06-062-2/+26
|
* In IPC-Open2.t, use functions other than ok(), to generate better diagnostics.Nicholas Clark2011-06-061-8/+6
|
* In IPC-Open3.t, merge two similar tests using a loop.Nicholas Clark2011-06-061-19/+9
|
* [perl #92258] <$fh> hangs on a glob copyFather Chrysostomos2011-06-051-3/+10
| | | | | | | | | Opening a file handle to \$glob causes assertion failures (under debugging) or hangs or other erratic behaviour without debugging. This might even crash in some cases. It never really worked properly, but it didn’t start hanging apparently until 5.12.2 and 5.14.0.
* Make Devel::Peek::fill_mstats work on COWsFather Chrysostomos2011-06-042-0/+9
|
* Get PerlIO::scalar to write to COWsFather Chrysostomos2011-06-043-3/+12
|
* Update lengthen time-out time for t/re/re.t.Nobuhiro Iwamatsu2011-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we carry out this test on SH4, it becomes the time-out. 2 seconds are set in watchdog, but are too short for SH4. This patch was changed for 10 seconds. $ time ./perl t/re/re.t 1..19 ok 1 - is_regexp(REGEXP ref) ok 2 - is_regexp(REGEXP) ok 3 - is_regexp("") ok 4 - regexp_pattern[0] (ref) ok 5 - regexp_pattern[1] (ref) ok 6 - scalar regexp_pattern (ref) ok 7 - regexp_pattern[0] (bare REGEXP) ok 8 - regexp_pattern[1] (bare REGEXP) ok 9 - scalar regexp_pattern (bare REGEXP) ok 10 - !regexp_pattern("") ok 11 - regnames ok 12 - regnames ok 13 - regnames in scalar context ok 14 - regnames ok 15 ok 16 ok 17 ok 18 ok 19 - Didn't loop real 0m7.482s user 0m3.848s sys 0m0.036s
* Get f_map.t working on non-threaded perlsFather Chrysostomos2011-06-041-2/+2
| | | | (broken by 767eda4)
* Teach B::Concise about OPpMAYBE_LVSUBFather Chrysostomos2011-06-031-0/+1
|
* [perl #7946] Lvalue subs do not autovivifyFather Chrysostomos2011-06-033-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes autovivification work with lvalue subs. It follows the same technique used by other autovivifiable ops (aelem, helem, tc.), except that, due to flag constraints, it uses a single flag and instead checks the op tree at run time to find out what sort of thing to vivify. The flag constraints are that these two flags: #define OPpENTERSUB_HASTARG 32 /* Called from OP tree. */ #define OPpENTERSUB_NOMOD 64 /* Immune to op_lvalue() for :attrlist. */ conflict with these: #define OPpDEREF (32|64) /* autovivify: Want ref to something: */ #define OPpDEREF_AV 32 /* Want ref to AV. */ #define OPpDEREF_HV 64 /* Want ref to HV. */ #define OPpDEREF_SV (32|64) /* Want ref to SV. */ Renumbering HASTARG and NOMOD is problematic, as there are places in op.c that change entersubs into rv2cvs, and the entersub and rv2cv flags would conflict. Setting the flags correctly when changing the type is hard and would result in subtle bugs if not done perfectly. Ops like ${...} don’t actually autovivify; it’s the op inside that does it. In those cases, the parent op is flagged with OPpDEREFed, and it skips get-magic, as it has already been called by the inner op. Since entersub is now marked as being an autovivifying op, ${...} in lvalue context ends up skipping get-magic if there is a foo() inside. And this affects even regular subs. So pp_leavesub and pp_return have to call get-magic; hence the new tests in gmagic.t.
* Correct entersub/rv2cv priv constants in B::ConciseFather Chrysostomos2011-06-031-3/+3
| | | | See the commit message of d4ddbae for detail.
* Tweak the test from 183eb698e2ceb8ab to work with PERL_UNICODE set.Nicholas Clark2011-06-021-14/+14
| | | | | | One should always generate the golden B::Concise output with PERL_UNICODE set so that ${^OPEN} is set, as the test system knows how to take it out, not put it in.
* Deparse glob the same way regardless of PERL_EXTERNAL_GLOBFather Chrysostomos2011-06-011-0/+1
| | | | | This should fix the recent new failure in the VMS smokes (since 2f77d7b).
* [perl #91946] add constant folding testsJim Cromie2011-06-011-1/+152
| | | | | | | test arithmetic folding, conditional folding (both true & false), and string, lc() & uc() folds, and mixed string.int folds. Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
* Warn when list-assigning to TEMPFather Chrysostomos2011-06-011-1/+5
|
* Tests for XS lvalue functionsFather Chrysostomos2011-06-013-1/+43
| | | | | including the ‘Useless assignment to a temporary’ warning which is only triggered by these.
* reflags.t: Remove no longer applicable TODOKarl Williamson2011-05-311-6/+2
| | | | | | When this test was written, t the new 5.14 regex modifiers were not usable in suffix notation. That changed before 5.14 shipped, but the test did not.
* Un-TODO a test on Snow LeopardFather Chrysostomos2011-05-231-1/+1
| | | | Snow Leopard is Darwin 10, which compares less than 6 lexicographically.
* Correct comments about B::PV::PVBM.Nicholas Clark2011-05-201-6/+11
| | | | | Original comments, partially incorrect, added in 5a44e503dc748f53 and f4c3658468ba5234.