summaryrefslogtreecommitdiff
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* Langinfo.t: Handle systems without LC_ALLKarl Williamson2022-08-181-1/+10
|
* Implement OP_PADSV_STORE - combined sassign/padsv OPRichard Leach2022-08-175-98/+92
| | | | | | | | | | | | | | | | | | | | | This commit introduces a new OP to replace simple cases of OP_SASSIGN and OP_PADSV. For example, 'my $x = 1' is currently implemented as: 1 <;> nextstate(main 1 -e:1) v:{ 2 <$> const(IV 1) s 3 <0> padsv[$x:1,2] sRM*/LVINTRO 4 <2> sassign vKS/2 But now will be turned into: 1 <;> nextstate(main 1 -e:1) v:{ 2 <$> const(IV 1) s 3 <1> padsv_store[$x:1,2] vKMS/LVINTRO This intended to be a transparent performance optimization. It should be applicable for RHS optrees of varying complexity.
* Define a CvREFCOUNTED_ANYSV flagPaul "LeoNerd" Evans2022-08-163-1/+44
| | | | | | | | If this flag is set, then the CvXSUBANY(cv).any_sv pointer will have its reference count decremented when the CV itself is freed. This is useful for XS extensions that wish to store extra data in here. Without this flag, such extensions have to resort to using magic with a 'free' function to perform this work.
* Temporarily skip on WindowsKarl Williamson2022-08-091-0/+2
| | | | | The next commits will expose an existing Windows bug which will get fixed in a later set of commits
* Errno.t: provide labels for tests lacking themJames E Keenan2022-08-091-9/+13
| | | | Improve test descriptions, with feedback from Tony Cook.
* Define the remaining convenience cMETHOP* macrosPaul "LeoNerd" Evans2022-08-031-4/+4
| | | | | | | | | | | Several of these were missing: cMETHOP, cMETHOPo, kMETHOP Also, the field-accessing ones: cMETHOP_meth cMETHOP_rclass cMETHOPo_meth cMETHOPo_rclass This commit adds them all, and use them to neaten other code where appropriate.
* File::Find: fix "follow => 1" on WindowsA. Sinan Unur2022-08-023-26/+89
| | | | | | | | | | | | | | | | | | File::Find's code expects unix-style paths and it manipulates them using basic string operations. That code is very fragile, and ideally we should make it use File::Spec, but that would involve rewriting almost the whole module. Instead, we made it convert backslashes to slashes and handle drive letters. Note from xenu: this commit was adapted from the PR linked in this blogpost[1]. I have squashed it, written the commit message and slightly modified the code. [1] - https://www.nu42.com/2021/09/canonical-paths-file-find-way-forward.html Fixes #19995
* File::Find: normalise indentationTomasz Konojacki2022-08-023-518/+518
| | | | | | This commit doesn't contain any functional changes. If you're seeing it in "git blame" output, try using -w switch, it will hide whitespace-only changes.
* File::Find: "follow" and "follow_fast" aren't no-ops on Win32Tomasz Konojacki2022-08-021-5/+1
| | | | Not since 0d00729c03a1f68e1b51e986d1ce9000b0e3d301.
* fix B::walkoptree_debug()David Mitchell2022-07-312-3/+7
| | | | | | | | | | | | | It turns out that this method has been mostly broken since its introduction in 1998. It will normally successfully turn debugging on with a 'true' argument but will fail to disable again with a 'false' argument. This is for two reasons. First the XS code only ever sets the internal debugging flag, never disables it, and second, it was checking the truthfulness of the arg one too high on the stack and thus was actually checking the CV which had just been popped off the stack, which happened to be true.
* Add an EXISTS method to NDBM_FileLeon Timmermans2022-07-292-1/+7
|
* Don't set the OPf_SPECIAL bit on implicit VERSION/import/export callsDagfinn Ilmari Mannsåker2022-07-271-42/+42
| | | | | | The implicit method calls use by `use` and `no` were setting the OPf_SPECIAL bit on the ENTERSUB op, but that has never made any difference to anything.
* APItest:locale.t: Use proper test for LC_ALL presenceKarl Williamson2022-07-261-1/+1
| | | | | If no LC_ALL, there won't be an LC_ALL() sub. Instead use the string 'LC_ALL" and an explicit check to see if it is there.
* Bump B.pm version after recent commitDavid Mitchell2022-07-261-1/+1
|
* Add back-compatibility aliases for renamed CVf_METHOD flagPaul "LeoNerd" Evans2022-07-261-0/+6
|
* Rename CVf_METHOD to CVf_NOWARN_AMBIGUOUSPaul "LeoNerd" Evans2022-07-262-4/+4
| | | | Also renames the CvMETHOD* macro family to CvNOWARN_AMBIGUOUS*
* fixup XS::APItest::gimme() return valueDavid Mitchell2022-07-201-1/+4
| | | | | | | | Make this recently-added test function always return something, so that assigning its return value to a scalar variable doesn't underflow the stack. (I spotted this while debugging something else.)
* B::Concise - private flags may store the argument countRichard Leach2022-07-181-1/+6
|
* Add `newAVav()` and `newAVhv()`Paul "LeoNerd" Evans2022-07-132-0/+63
|
* Finish changing offset to hopKarl Williamson2022-07-101-2/+2
| | | | | This is a follow on to 0e647b0520a120213d2074ede2609a10076f2f8d, to finish changing the variable names to not be as confusing.
* APItest: Change comments/variable namesKarl Williamson2022-07-102-5/+4
| | | | | | These for hopping within a string had two items whose name both contained 'offset', confusing things. One of them is the number of characters to hop. Rename for clarity.
* goto(&xs_sub): provide correct caller contextDavid Mitchell2022-07-062-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GH #19188 in something like sub foo { goto &xs_sub } if the XS subroutine tries to get its caller context using GIMME_V, it used to always be reported as scalar, since the OP_GOTO is the current op being executed, and that op is marked as scalar. The correct answer should be to return the context of the caller of foo(), but that information is lost as, just before calling the XS sub, pp_goto pops the CXt_SUB off the context stack which holds the recorded value of the context of the caller. The fix in principle is for goto, just before calling the XS sub, to grab the gimme value from the about-to-be-popped CXt_SUB frame, and set OP_GOTO op's op_flag field with that gimme value. However, modifying ops at runtime isn't allowed, as ops are shared between threads. So instead set up a fake copy of the OP_GOTO and alter the gimme value in that instead. I'm pretty confident that on an exception, a LEAVE_SCOPE() will always be done before the JMPENV_JUMP(), so PL_op will be restored to its original value *before* the CPU stack is restored to it's old value (leaving the temporary OP_GOTO as garbage in an abandoned stack frame).
* Neaten the PADNAME flag constantsPaul "LeoNerd" Evans2022-07-053-3/+3
| | | | | | | | | | | Rename the `PADNAMEt_*` constants to `PADNAMEf_*`, as they're supposed to represent bitflags, not a type enumeration. Also updated the `B` and `B::Deparse` modules to make use of the new modern names (and avoid the old `SVpad_*` flags). Also added `PADNAMEt_*` back-compat defines, guarded by `#ifndef PERL_CORE` so as not to permit their use accidentally within perl core.
* Add builtin::is_taintedJames Raspass2022-07-051-16/+8
| | | | | Also tweak the implementation of the other two boolean builtins (is_bool & is_weak) to be slightly more efficient.
* Use HvHasAUX() rather than SvOOK() when operating on HVsPaul "LeoNerd" Evans2022-07-022-2/+2
|
* Change !! to cBOOL() in dist/ext modulesKarl Williamson2022-06-203-3/+3
|
* define POSIX:: constants from limits.h when building with mingwSidney Markowitz2022-06-171-0/+3
|
* Regularize HAS_POSIX_2008_LOCALE, USE_POSIX_2008_LOCALEKarl Williamson2022-06-161-3/+3
| | | | | | | | | A platform shouldn't be required to use the Posix 2008 locale handling functions if they are present. Perhaps they are buggy. So, a separate define for using them was introduced, USE_POSIX_2008_LOCALE. But until this commit there were cases that were looking at the underlying availability of the functions, not if the Configuration called for their use.
* Revert "Do per-word hop back"Karl Williamson2022-06-141-3/+0
| | | | | | | This reverts commit d6ad3b72778369a84a215b498d8d60d5b03aa1af and adds comments that it existed. This is so that this work which isn't really needed based on current usage in core isn't lost, and can be used in the future.
* Do per-word hop backKarl Williamson2022-06-141-0/+3
| | | | | | | This should speed up backing up a large distance in a UTF-8 string. But we don't actually do that in core. I did this work 5 years ago before I realized this. Rather than throw it away, this commit gets it into the history, and the next commit will revert it.
* Remove support for UltrixKarl Williamson2022-06-104-10/+3
| | | | | | Ultrix has been removed. Ultrix was the native Unix-like operating system for various Digital Equipment Corporation machines. Its final release was in 1995.
* POSIX.xs: White-space onlyKarl Williamson2022-06-091-27/+28
| | | | Properly indent some nested preprocessor directives
* POSIX.xs: Use macro to reduce complexityKarl Williamson2022-06-092-25/+31
| | | | | This #defines a macro and uses it to populate a structure, so that strings don't have to be typed twice.
* use Off_t for file offsets in sdbm.cTony Cook2022-06-092-4/+9
| | | | | | | | | | | On Win32 long is only 32-bits (even for x86_64), which meant file sizes were limited to 2GB. This successfully runs the example code, and can successfully read all the keys back. I didn't add a test, since creating a 2GB (or 8GB for the issue test) would be unfriendly.
* Opcode.xs now uses PL_op_name and PL_op_desc directlyNicholas Clark2022-06-081-4/+4
| | | | | This removes the last core use of the trivial accessor functions get_op_names() and get_op_descs().
* opset_len in Opcode.xs is a constant, so should be a static constNicholas Clark2022-06-082-19/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can also remove many dMY_CXT declarations, as they are no longer needed (and generate a now unused variable in threaded builds, hence compiler warnings). Previously it was part of the module's my_cxt_t, because it was a value calculated from the interpreter variable PL_maxo. But PL_maxo itself is *not* a variable - it was converted to a #define in Aug 2016 by commit 8d89205aa6324e7d: Remove PL_maxo We have an interpreter variable using memory, PL_maxo, which is defined to be the same as MAXO, a #defined constant. As far as I can tell, it is never used in lvalue context, in core or on CPAN, except for the initialisation in intrpvar.h. It can simply be removed and replaced with a macro defined as equiva- lent to MAXO. It was added in this commit: commit 84ea024ac9cdf20f21223e686dddea82d5eceb4f Author: Perl 5 Porters <perl5-porters.nicoh.com> Date: Tue Jan 2 23:21:55 1996 +0000 perl 5.002beta1h patch: perl.h 5.002beta1 attempted some memory optimizations, but unfortunately they can result in a memory leak problem. This can be avoided by #define STRANGE_MALLOC. I do that here until consensus is reached on a better strategy for handling the memory optimizations. Include maxo for the maximum number of operations (needed for the Safe extension). But apparently it is not needed for the Safe extension (tests pass without it). What the author of that commit didn't realise was that Opcode had been split out from Safe - the code in question is in this module not Safe.
* opt.t: Fix count of tests to be skippedJames E Keenan2022-06-061-1/+1
|
* bump $GDBM_File::VERSIONTony Cook2022-06-031-1/+1
|
* GDBM_File: fix fetching mmapsizeTony Cook2022-06-032-2/+7
| | | | | | | | | | | | | | | | | | | | | | | Originally this came up from a Coverity complaint. GDBM_SETMAXMAPSIZE accepts any of unsigned, unsigned long or size_t, but GDBM_GETMAXMAPSIZE only accepts size_t. Since this is the only case that uses unsigned values we can safely switch it to size_t. Unfortunately Coverity's analysis was pretty broken, it complained about c_uv being uninitialised at the call to newSVuv, but its example code flow went through the opt_dbname case, which sets vptr to != &c_uv so the newSVuv() wouldn't execute anyway. Before looking closely at the Coverity analysis and after finding the bug fixed here I thought for a moment that Coverity had been tracing into libgdbm, which could have caught the actual problem, but alas that was not the case. I expect this fix will not close CID 351943, and if it remains after this is applied I'll close it as a false positive. CID 351943.
* APItest.xs: flush output in test_bool_internals_funcLeon Timmermans2022-05-301-0/+1
| | | | | | With the explicit flush this test will fail when PERLIO=stdio, because stdio defaults to block-based buffering on pipes and therefore the output will come out wrong.
* make PERL_USE_SAFE_PUTENV the default and the only optionTomasz Konojacki2022-05-291-17/+1
| | | | | | | Now environ isn't owned by Perl and calling setenv/putenv in XS code will no longer result in memory corruption. Fixes #19399
* B:: Use proper hyperlink in podKarl Williamson2022-05-271-1/+1
|
* Extra B::PADNAME helpers: GEN and IsUndefNicolas R2022-05-272-1/+17
| | | | | | This commit adds two new helpers to B::PADNAME. - IsUndef to check if the PADNAME is PL_padname_undef - GEN to access to the xpadn_gen slot of the pad.
* Add B helpers to check if the Sv is a booleanNicolas R2022-05-273-4/+113
| | | | | | | | Bool are using PVNV. It makes it more convenient to provide these helpers at the top level for any SVs. So we can easily check if the SV is a boolean and check if it's true or false.
* XS-APItest - add tests for new API calls and for bool internalsYves Orton2022-05-274-2/+107
| | | | | | We do not have any tests for the bool internals. This creates a bunch of them to test and validate the various new API calls for creating and setting bools.
* POSIX.pod: Use proper hyperlinkKarl Williamson2022-05-041-1/+1
|
* Amiga-Exec/Exec.pm: Fix podKarl Williamson2022-05-041-3/+3
| | | | | This line has a syntax error in it. Fix it, and split into two lines so doesn't wrap on output in an 80 column terminal window
* for my ($x) ...: fix handling of degenerate 1-varDavid Mitchell2022-04-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new for my ($x,$y,...) (...) { ... } syntax has a couple of problems in the degenerate case of a single variable: for my ($x) (...) { ... } First, the loop variable is marked as lexical, but not as a variable to be introduced. So it behaves roughly as if written like: { my $x; for $x (...) { ... } } I can't think of any user-visible runtime change in behaviour this bug causes, so I haven't included a test for it. Second, it was being incorrectly deparsed as for $x (...) { ... } (i.e. without the 'my'). This commit fixes both of these issues. The basic problem is that the parser, in the case of multiple vars, passes a list subtree of PADSVs as the 'sv' argument of Perl_newFOROP, but in the case of a single var, passes a single PADSV op instead. This single PADSV doesn't have the LVINTRO flag set, so is indistinguishable from plain my $x; for $x .... This commit makes the parser set the OPf_PARENS flag on the lone PADSV to signal to newFOROP() that it's a degenerate 1-var list, and newFOROP() sets the OPf_PARENS flag on the ENTERITER op to signal to the deparser that this is "for my (...)" syntax, even if it only has a single var.
* re.pm - add notes that the debug output is NOT a "supported API".Yves Orton2022-04-131-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | The debug output leaks a large amount of information about the implementation details of the regex engine and as such is highly likely to change based on almost any change to the regex engine. Also from time to time we make changes to the output to improve legibility, etc. While the output of C<use re 'debug'> is intended for user consumption as well as for debugging the regex engine itself I believe that we should not provide any backcompat guarantees about its specific contents or format. Similarly the list of options we provide for C<use re 'Debug'> may be affected by changes in the internals of the engine, rending old categories irrelevant, or requiring new categories to be added. This patch adds language to the C<re.pm> docs that stipulate that the debug options we provide under C<use re 'Debug'> and the output we provide from C<use re 'debug'> and C<use re 'Debug'> are subject to change without notice at any major or minor release. While I do not anticipate changes to the output in a minor release I believe it is wise to specify that we do not commit ourselves to consistency in this regard in any way. For instance were the situation to arise that we had a security issue or serious performance issues or some other strong justification to make a change in a minor release then this could very well change the output we provide or the options we support.
* gdbm: make sure basic error codes are always definedSergey Poznyakoff2022-04-101-1/+6
| | | | | | | | * ext/GDBM_File/Makefile.PL: Don't protect basic error codes by ifdefs: they are not macros in recent versions of GDBM. Besides, they are known to exist in any GDBM version. For: https://github.com/Perl/perl5/pull/19602