summaryrefslogtreecommitdiff
path: root/perl.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a builtin:: namespace, with true/false/isboolPaul "LeoNerd" Evans2021-11-291-0/+1
| | | | | | | | This finishes the perl-visible API required for RFC 0008 https://github.com/Perl/RFCs/blob/master/rfcs/rfc0008.md It also begins the "builtin::" namespace of RFC 0009 https://github.com/Perl/RFCs/blob/master/rfcs/rfc0009.md
* newSVpvn_flags(x, .. ,SVs_TEMP) more efficient than sv_2mortal(newSVpv(x,0))Richard Leach2021-11-291-3/+6
|
* Remove DOS/DJGPP supportDagfinn Ilmari Mannsåker2021-11-021-20/+2
| | | | | | DJGPP is a port of the GNU toolchain to 32-bit x86 systems running DOS. The last known attempt to build Perl on it was on 5.20, which only got as far as building miniperl.
* Remove NetWare supportDagfinn Ilmari Mannsåker2021-10-081-17/+7
| | | | The build has been broken since 2009.
* Replace "Grandfather" with a description of the relevant heuristicNicholas Clark2021-09-281-1/+10
| | | | | | | | | | In April 2003 commit f2095865e3489f4e: Noted by Nat: -0 didn't work that well with Unicode. added support for passing hexadecimal to the -0 option. As '-0' has an optional argument, the chosen syntax for hex was ambiguous with '-0' clustered with an '-x' option with an argument, so the heuristic described here was implemented.
* perl_alloc_using() should use ->pCallocNicholas Clark2021-09-281-2/+1
| | | | | | | | Use ->pCalloc instead of ->pMalloc followed by Zero() This commit is analogous to the change in perl_alloc() in the previous commit - the order of S_init_tls_and_interp() and Zero() can be swapped, at which point the change to use "calloc" is obvious.
* No need to wrap INIT_TRACK_MEMPOOL with #ifdef PERL_TRACK_MEMPOOLNicholas Clark2021-09-281-2/+0
| | | | | | | `INIT_TRACK_MEMPOOL` is defined as a no-op if `PERL_TRACK_MEMPOOL` is not defined, so no need to wrap it in `#ifdef`. Spotted by Ilmari.
* perl_alloc() wants zeroed memory so should use calloc()Nicholas Clark2021-09-281-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The previous code 1) allocated memory with PerlMem_malloc() 2) passed the pointer to S_init_tls_and_interp() 3) called Zero() or ZeroD() 4) optionally invoked INIT_TRACK_MEMPOOL() 5) returned the pointer ZeroD() and Zero() are equivalent, apart from the return value of the expression. The layers of functions and macros obscured what what was actually happening, and what the ordering dependencies are: * S_init_tls_and_interp() uses only the address of the pointer * Zero() zeros the memory * Only INIT_TRACK_MEMPOOL() touches the contents * all the "memory wrap" macros inside the other macros can't "trigger" Hence the order of Zero() and S_init_tls_and_interp() can be swapped, at which point Zero() immediately follows malloc(), meaning that the two should be be replaced with calloc(). This simplifies the function considerably.
* Use sv_inc() for the env de-dup hash in S_init_postdump_symbols().Nicholas Clark2021-08-231-4/+5
| | | | This replaces an hv_exists/hv_store pair with a single LVALUE hv_fetch.
* Comment about some subtleties in S_init_postdump_symbols().Nicholas Clark2021-08-231-0/+11
|
* Move some variables in S_init_postdump_symbols() to a tighter scope.Nicholas Clark2021-08-231-10/+11
|
* Pre-size the %ENV hash before populating it from environ.Nicholas Clark2021-08-231-1/+20
| | | | | Also use HvTOTALKEYS() instead of HvKEYS(), as the latter makes a check for placeholders, which here cannot make a difference.
* replace all instances of PERL_IMPLICIT_CONTEXT with MULTIPLICITYTomasz Konojacki2021-06-091-2/+2
| | | | | | | | | | | | Since the removal of PERL_OBJECT (acfe0abcedaf592fb4b9cb69ce3468308ae99d91) PERL_IMPLICIT_CONTEXT and MULTIPLICITY have been synonymous and they're being used interchangeably. To simplify the code, this commit replaces all instances of PERL_IMPLICIT_CONTEXT with MULTIPLICITY. PERL_IMPLICIT_CONTEXT will stay defined for compatibility with XS modules.
* Rename G_ARRAY to G_LIST; provide back-compat when not(PERL_CORE)Paul "LeoNerd" Evans2021-06-021-2/+2
|
* Base *.[ch] files: Replace leading tabs with blanksMichael G Schwern2021-05-311-1915/+1915
| | | | | | | This is a rebasing by @khw of part of GH #18792, which I needed to get in now to proceed with other commits. It also strips trailing white space from the affected files.
* gh18842: fix a pair of sprintf format warningsHugo van der Sanden2021-05-311-2/+2
| | | | | The format is '%s', so it is not appropriate to wrap the char * arguments in SVfARG().
* Bump copyright to 2021 in perl.c and README.Steve Hay2021-01-071-2/+3
| | | | | | Check that porting/copyright.t is passing when run with --now: ../perl -I../lib porting/copyright.t --now
* Consolidate and document all get_cvFOO() variantsKarl Williamson2020-12-131-5/+12
|
* Remove empty "#ifdef"sTom Hukins2020-12-081-2/+0
|
* perl - update usage data to match perlrunDan Book2020-11-231-28/+28
|
* autodoc.pl: Enhance apidoc_section featureKarl Williamson2020-11-061-7/+7
| | | | | | | | | | | This feature allows documentation destined for perlapi or perlintern to be split into sections of related functions, no matter where the documentation source is. Prior to this commit the line had to contain the exact text of the title of the section. Now it can be a $variable name that autodoc.pl expands to the title. It still has to be an exact match for the variable in autodoc, but now, the expanded text can be changed in autodoc alone, without other files needing to be updated at the same time.
* Non-Configure code required to implement a strict by default optionTodd Rinaldo2020-09-151-0/+4
|
* Reorganize perlapiKarl Williamson2020-09-041-6/+6
| | | | | This uses a new organization of sections that I came up with. I asked for comments on p5p, but there were none.
* Change some =head1 to apidoc_section linesKarl Williamson2020-09-041-1/+1
| | | | | apidoc_section is slightly favored over head1, as it is known only to autodoc, and can't be confused with real pod.
* perl.c: Convert to use av_count()Karl Williamson2020-08-191-2/+2
|
* Remove PL_appctx and PL_timesbase interpreter variablesDagfinn Ilmari Mannsåker2020-07-201-7/+0
| | | | These were only ever needed by Symbian.
* Remove use of dVAR in coreDagfinn Ilmari Mannsåker2020-07-201-15/+0
| | | | | It only does anything under PERL_GLOBAL_STRUCT, which is gone. Keep the dNOOP defintion for CPAN back-compat
* Remove PERL_GLOBAL_STRUCTDagfinn Ilmari Mannsåker2020-07-201-3/+0
| | | | | | | | This was originally added for MinGW, which no longer needs it, and only still used by Symbian, which is now removed. This also leaves perlapi.[ch] empty, but we keep the header for CPAN backwards compatibility.
* Remove Symbian portDagfinn Ilmari Mannsåker2020-07-201-9/+2
| | | | | Also eliminate USE_HEAP_INSTEAD_OF_STACK and SETSOCKOPT_OPTION_VALUE_T, since Symbian was the only user of those.
* Make PL_utf8_foldclosures interpreter levelKarl Williamson2020-06-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This resolves #17774. This ticket is because the fixes in GH #17154 failed to get every case, leaving this one outlier to be fixed by this commit. The text in https://github.com/Perl/perl5/issues/17154 gives extensive details as to the problem. But briefly, in an attempt to speed up interpreter cloning, I moved certain SVs from interpreter level to global level in e80a0113c4a8036dfb22aec44d0a9feb65d36fed (v5.27.11, March 2018). This was doable, we thought, because the content of these SVs is constant throughout the life of the program, so no need to copy them when cloning a new interpreter or thread. However when an interpreter exits, all its SVs get cleaned up, which caused these to become garbage in applications where another interpreter remains running. This circumstance is rare enough that the bug wasn't reported until September 2019, #17154. I made an initial attempt to fix the problem, and closed that ticket, but I overlooked one of the variables, which was reported in #17774, which this commit addresses. Effectively the behavior is reverted to the way it was before e80a0113c4a8036dfb22aec44d0a9feb65d36fed.
* Fix a bunch of repeated-word typosDagfinn Ilmari Mannsåker2020-05-221-1/+1
| | | | | Mostly in comments and docs, but some in diagnostic messages and one case of 'or die die'.
* fixup to free_and_set_cop_warnings()David Mitchell2020-03-201-3/+3
| | | | | | | | | | | | | | | | | | | v5.31.9-156-g94c8b9c1f0 introduced the free_and_set_cop_warnings() macro. It's first argument expects a COP rather than a COP*. Its usage in S_restore_cop_warnings(() is to modify PL_cucop, but in order to pass a COP rather than a COP*, the original commit made a local copy of PL_curcop and ended up inadvertently updating the copy instead. This commit changes the maco so it expects a COP*, and updates the bulk of its callers to use &PL_compiling rather than PL_compiling, and fixes up S_restore_cop_warnings(). The symptoms were ASAN failures in a few test scripts including uni/parser.t and ext/XS-APItest/t/handy0*.t. (The S_restore_cop_warnings() function was only used by Perl__force_out_malformed_utf8_message(), so didn't cause many issues outside of test scripts which forced such "malformed "errors).
* Add macro to free and set cop_warningsNicolas R2020-03-161-9/+3
| | | | | This is avoiding the boilerplate to free the cop_warning string when setting it.
* Add thread safety to some environment accessesKarl Williamson2020-03-111-4/+0
| | | | | | | | | | | | | | | | | | The previous commit added a mutex specifically for protecting against simultaneous accesses of the environment. This commit changes the normal getenv, putenv, and clearenv functions to use it, to avoid races. This makes the code simpler in places where we've gotten burned and added stuff to avoid races. Other places where we haven't known we were getting burned could have existed until now. Now that comes automatically, and we can remove the special cases we earlier stumbled over. getenv() returns a pointer to static memory, which can be overwritten at any moment from another thread, or even another getenv from the same thread. This commit changes the accesses to be under control of a mutex, and in the case of getenv, a mortalized copy is created so that there is no possible race.
* Add mutex for accessing ENVKarl Williamson2020-03-111-0/+1
|
* pp_i_modulo(): remove workaround for ancient glibc bugDagfinn Ilmari Mannsåker2020-02-051-22/+0
| | | | | | | | | Old glibc versions had a buggy modulo implementation for 64 bit integers on 32-bit architectures. This was fixed in glibc 2.3, released in 2002 (the version check in the code is overly cautious). Removing the alternate PP function support is left for the next commit, in case we need to resurrect it in future.
* Bump copyright to 2020 in perl.c and README.Nicolas R2020-01-021-2/+2
| | | | | | | check that porting/copyright.t is passing when run with --now ../perl -I../lib porting/copyright.t --now
* Add memCHRs() macro and use itKarl Williamson2019-12-181-1/+1
| | | | | | | This replaces strchr("list", c) calls throughout the core. They don't work properly when 'c' is a NUL, returning the position of the terminating NUL in "list" instead of failure. This could lead to segfaults or even security issues.
* Revert "Move PL_check to the interp vars to fix threading issues"Tony Cook2019-12-161-1/+0
| | | | | and the associated commits, at least until a way to make wrap_op_checker() work is available.
* Move PL_check to the interp vars to fix threading issuesStefan Seifert2019-12-121-0/+1
| | | | Fixes issue #14816
* Note that G_RETHROW is documentedKarl Williamson2019-12-111-0/+1
| | | | This is for Devel::PPPort.
* Move regex global variables to interpreter levelKarl Williamson2019-11-261-0/+69
| | | | | | | | | | | | | | | | | | | | | | | This is part of fixing gh #17154 This scenario from the ticket (https://github.com/Perl/perl5/issues/17154#issuecomment-558877358) shows why this fix is necessary: main interpreter initializes PL_AboveLatin1 to an SV it owns loads threads::lite and creates a new thread/interpreter which initializes PL_AboveLatin1 to a SV owned by the new interpreter threads::lite child interpreter finishes, freeing all of its SVs, PL_AboveLatin1 is now invalid main interpreter uses a regexp that relies on PL_AboveLatin1, dies horribly. By making these interpreter level variables, this is avoided. There is extra copying, but it is just the SV headers, as the real data is kept as static C arrays.
* add explicit 1-arg and 3-arg sig handler functionsDavid Mitchell2019-11-181-1/+4
| | | | | | | Currently, whether the OS-level signal handler function is declared as 1-arg or 3-arg depends on the configuration. Add explicit versions of these functions, principally so that POSIX.xs can call which version of the handler it wants regardless of configuration: see next commit.
* Add -Dy debugging of tr///, y///Karl Williamson2019-11-171-1/+2
|
* intrpvar.h: Add variable for use in tr///Karl Williamson2019-11-061-0/+3
| | | | This is part of this branch of changes.
* perl.c: Remove obsolete commentKarl Williamson2019-10-311-1/+0
|
* Note that G_METHOD[_NAMED] are documentedKarl Williamson2019-09-021-0/+3
|
* Document my_exit()Karl Williamson2019-09-021-0/+9
|
* Revert "Revert "postpone perl_parse() exit(0) bugfix""Tony Cook2019-08-071-8/+19
| | | | | | | | This reverts commit 2773b4f50f991900e38d33daace2b9c6a0902c6a. I haven't made much progress in resolving the problems this produces downstream, so rather than leaving it broken, I'll revert it until they can be solved.
* Revert "postpone perl_parse() exit(0) bugfix"Tony Cook2019-07-091-19/+8
| | | | | | | | | | This reverts commit 857320cbf85e762add18885ae8a197b5e0c21b69, re-instating the [perl #2754] fix, which was reverted in late 2017 to allow Module::Install based distributions to update or re-work per [perl #132577]. # Conflicts: # t/op/blocks.t