summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* Create `defer` syntax and `OP_PUSHDEFER` opcodePaul "LeoNerd" Evans2021-08-251-1/+2
| | | | | | | | | | | | | | | Adds syntax `defer { BLOCK }` to create a deferred block; code that is deferred until the scope exits. This syntax is guarded by use feature 'defer'; Adds a new opcode, `OP_PUSHDEFER`, which is a LOGOP whose `op_other` field gives the start of an optree to be deferred until scope exit. That op pointer will be stored on the save stack and invoked as part of scope unwind. Included is support for `B::Deparse` to deparse the optree back into syntax.
* only #include <xlocale.h> when it is actually neededTony Cook2021-08-111-1/+1
| | | | | | | | | | | This header was originally only needed for builds on darwin and FreeBSD, but was being included whenever it was detected. This has caused problems when what was an internal header was removed (from glibc) and in general wasn't needed anyway. On FreeBSD only localeconv_l() requires xlocale.h, so we test specifically for that.
* Remove the flags OPpSORT_STABLE and OPpSORT_UNSTABLE.Nicholas Clark2021-07-311-4/+0
| | | | | | Remove the code in Perl_ck_sort() that reads from PL_hintgv that sets these, and the code in pp_sort that reads them and sets SORTf_STABLE and SORTf_UNSTABLE (which were no longer read. Remove these too.)
* STATUS_UNIX_EXIT_SET(): Save a '&' instr by casting to U8Karl Williamson2021-07-301-1/+1
|
* Add 64bit single-1bit_pos()Karl Williamson2021-07-301-0/+12
| | | | | | | | | | | | | This will prove useful in future commits on platforms that have 64 bit capability. The deBruijn sequence used here, taken from the internet, differs from the 32 bit one in how they treat a word with no set bits. But this is considered undefined behavior, so that difference is immaterial. Apparently figuring this out uses brute force methods, and so I decided to live with this difference, rather than to expend the time needed to bring them into sync.
* Create and use single_1bit_pos32()Karl Williamson2021-07-301-0/+12
| | | | | | This moves the code from regcomp.c to inline.h that calculates the position of the lone set bit in a U32. This is in preparation for use by other call sites.
* Add PERL_GCC_VERSION_GE and kinKarl Williamson2021-07-271-15/+26
| | | | | | This saves typing and potential mistakes The idea and implementation are from Tomasz Konojacki
* perl.h: Add some commentsKarl Williamson2021-07-251-4/+6
|
* skip using gcc brace groups for STMT_START/ENDTony Cook2021-07-151-5/+0
| | | | | | | | | | This warns (and warns a lot) on clang, and since these are documented to only work to make a single statement, so there's little value to allowing them to work in an expression. An alternative would be to disable GCC brace groups on clang, but these are used extensively in DEBUGGING builds to add extra checks in sv.h.
* ensure types of PL_nan and PL_inf are consistentTony Cook2021-06-241-0/+17
| | | | | | | Different types for a variable across compilation units can in theory cause undefined behavior. In this case I think it's unlikely to cause an issue, but LTO builds also (correctly) complain about the type mismatch, so ensure they match.
* Fix several unicode.org linksThibault DUPONCHELLE2021-06-171-1/+1
|
* perl.h: Pay attention to if can have non-int bitfieldsKarl Williamson2021-06-151-0/+12
|
* Fix ASSUME definitionKarl Williamson2021-06-151-24/+23
| | | | | | Commit 5d5b9c460e2a06563d2b5e35a1a79991460696eb fixed the definition of ASSUME for some purposes, but broke it on Windows. This commit should fix that.
* replace all instances of PERL_IMPLICIT_CONTEXT with MULTIPLICITYTomasz Konojacki2021-06-091-17/+13
| | | | | | | | | | | | 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.
* Base *.[ch] files: Replace leading tabs with blanksMichael G Schwern2021-05-311-447/+447
| | | | | | | 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.
* perl.h: Fix typo in commentKarl Williamson2021-05-281-1/+1
|
* Add ability to easily add info to DEBUG outputKarl Williamson2021-03-171-2/+33
| | | | | | | | | | This commit adds two macros that a user can define and recompile Perl to get every active DEBUG statement to do some thing beyond what it would normally do. This allows someone to recompile Perl when they need to delve deeper into fixing a bug without otherwise increasing memory use or slowing execution.
* perl.h: Clarify debugging msg for localesKarl Williamson2021-03-101-4/+9
| | | | | | I wrote this years ago, and now have discovered it was written assuming the consumer is more familiar with the underlying code than warranted.
* Create DEBUG macro for when two flags must be setKarl Williamson2021-02-111-5/+10
| | | | | | | There are some debugging statements that should only be displayed when two flags are set; so far the v flag and another. This commit creates a macro for that purpose that saves a conditional (at least when unoptimized) over the previous way to do it.
* perl.h: Fix typos in conditional macro namesTAKAI Kousuke2021-01-141-2/+2
|
* perl.h - enable USE_QUADMATH builds (mingw compilers only) on MS Windowssisyphus2021-01-101-1/+16
| | | | Align __float128 when using 64-bit mingw compilers.
* Use SSize_t for read lock counterKarl Williamson2020-12-311-1/+1
| | | | | | | We have tests to make sure this doesn't go negative, but wrongly declared the variable as unsigned. Spotted by Craig Berry.
* Add GETENV_LOCKKarl Williamson2020-12-191-0/+17
| | | | | | | | get_env() needs to lock other threads from writing to the environment while it is executing. It may need to have an exclusive lock if those threads can clobber its buffer before it gets a chance to save them. The previous commit has added a Configure probe which tells us if that is the case. This commit uses it to select which type of mutex to use.
* perl.h: Add capability for many-reader ENV mutex lockingKarl Williamson2020-12-191-12/+12
| | | | | | | | There are several places where there could be a problem in the environment were changed by another thread when a function is executing, but otherwise if another thread were reading the environment at the same time, there isn't a problem. This adds mutex for that situation. Future commits will take advantage of it.
* perl.h: White-space onlyKarl Williamson2020-12-131-50/+50
| | | | Properly indent some nested #defines
* many-reader mutexes: Change structure element nameKarl Williamson2020-12-121-1/+1
| | | | | The old name did not encompass all the possible reasons for the mutex signal condition to be invoked
* Fix freebsd/netbsd buildsKarl Williamson2020-12-081-2/+3
| | | | | | | These have an inconsistent configuration in which several functions exist for thread-safe locales, but the crucial one doesn't show up in our Configure probe. The code this commit fixes assumed that all or nothing would be present.
* Name individual locale locksKarl Williamson2020-12-081-5/+48
| | | | | | | | | These locks for different functions all use the same underlying mutex; but that may not always be the case. By creating separate names used only when we think they will be necessary, the compiler will complain if the conditions in the code that actually use them are the same. Doing this showed a misspelling in an #ifdef, fixed in 9289d4dc7a3d24b20c6e25045e687321ee3e8faf
* Refactor locale mutex setupKarl Williamson2020-12-081-80/+108
| | | | | | | | | | | | | | | | | | | | | | | This was prompted by my realization that even on a locale thread-safe platform, there are functions we call that may not be thread-safe in that they return their results in an internal static buffer, which may be process-wide instead of per-thread. Tomasz Konojacki++ briefly looked at Windows source code for localeconv() and this indeed did appear to be the case. If we thought a platform was thread-safe, no locale mutexes were set up, and instead the calls in the code to lock were no-oops. This would lead to potential races, the most likely candidate being localeconv(). None have been reported, at least as far as we know. Likely that function isn't called frequently. This would be true on both Posix 2008 and Windows platforms, except possibly for FreeBSD, which may be the only platform that we support that has a localeconv_l() function, which is supposed to be immune from this issue.. The solution adopted here is to test for all the possible functions that the Perl core uses that may be susceptible to this, and to set up the mutex if any are found. Thus there won't be no-ops where there should be a lock.
* Change name of mutex macro.Karl Williamson2020-12-081-6/+6
| | | | | This macro is for localeconv(); the new name is clearer as to the meaning, and this preps for further changes.
* Fix up many-reader mutex typedefKarl Williamson2020-12-081-2/+2
| | | | This previously worked on some compilers, but not others.
* Not all Win32 compilers have a small macro bufferKarl Williamson2020-12-061-1/+1
| | | | | | | | | | | | Commit e7ae132ec78 consolidated PERL_SMALL_MACRO_BUFFER usages, but it omitted the _MSC_VER number at which the buffer became large enough. Apparently it did this because Windows compilations were failing with the error "string too long", which doesn't happen if __ASSERT_ expands to nothing, which it does under PERL_SMALL_MACRO_BUFFER. However, commits 92a0bb2 and 88086fd shortened the offending strings so later Windows compilers don't have to be considered as having small macro buffers.
* perl.h: Move some code aroundKarl Williamson2020-12-061-47/+52
| | | | | This is in preparation for future commits where things will be needed earlier/later than currently.
* Always define dMY_CXT_SV, and to dNOOPKarl Williamson2020-12-061-2/+5
|
* perl.h: Remove ';' from 'NOOP;'Karl Williamson2020-12-041-4/+4
| | | | These are useless here
* Add mutex locking for many-reader/1-writerKarl Williamson2020-11-261-0/+9
| | | | | | The mutex macros already in perl are sufficient to allow us to emulate this type of locking, which may also be available natively, but I don't think it is worth the effort to use the native calls.
* perlapi: Document UVf, as deprecatedKarl Williamson2020-11-231-1/+7
|
* Document dTHXa, dTHXoaKarl Williamson2020-11-211-0/+11
|
* Document NUM2PTRKarl Williamson2020-11-211-0/+8
| | | | or at least lead people to use something better
* perlapi: Document memzeroKarl Williamson2020-11-181-0/+6
|
* Remove PERLIO_FUNCS_CONSTKarl Williamson2020-11-181-3/+0
| | | | | As the comment said, this was temporary until vtables got to be all const
* perlapi: Document Perlacos and similarKarl Williamson2020-11-111-0/+35
|
* Add a few helpers to B for INVLISTNicolas R2020-11-101-0/+1
| | | | | | | | | | | | | This commit provide some basic method to access to internal fields from one INVLIST: SVt_INVLIST - prev_index - is_offset - array_len - get_invlist_array This allows B::C to be walk and save invlists.
* perl.h: Fix misplaced #ifdefKarl Williamson2020-11-061-2/+2
| | | | | | | This fixes GH #18295 The #ifdef introduced in 6bcc290 was meant to go after the line that it actually did
* perlapi: PERL_ABS takes an argumentKarl Williamson2020-11-061-1/+1
|
* autodoc.pl: Enhance apidoc_section featureKarl Williamson2020-11-061-24/+24
| | | | | | | | | | | 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.
* Certain PERL_UNICODE symbols are core onlyKarl Williamson2020-11-021-0/+4
|
* perlapi: Document IV_MAX, UV_MAXKarl Williamson2020-11-021-0/+19
|
* perl.h: Fix rarely compiled syntax errorsKarl Williamson2020-10-221-2/+2
| | | | This #ifdef'd code clearly doesn't get compiled, as it would fail.
* perl.h: Fix typo in commentKarl Williamson2020-10-221-2/+3
|