summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* _MSC_VER is now always >= 1800 (i.e. Visual C++ 2013, aka Visual C++ 12.0)Steve Hay2021-12-161-7/+2
|
* fix redundant apidoc warningTony Cook2021-12-021-1/+1
| | | | fixes #19250
* Add a phase_name() macro.Felipe Gasper2021-11-251-0/+18
|
* Remove DOS/DJGPP supportDagfinn Ilmari Mannsåker2021-11-021-2/+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-12/+3
| | | | The build has been broken since 2009.
* add OPpUSEINT op_private flag bitDavid Mitchell2021-10-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The bitwise ops, such as a '<<', have an op_private flag that is set when compiled within the scope of 'use integer;'. Unfortunately, due to historical reasons, the defined flag that indicates this bit (bit 0) is HINT_INTEGER rather than an OPpfoo define. But HINT_INTEGER is supposed to represent a bit within PL_hints, not a bit within op_private. If someone reorganised the flags in PL_hints at some point, it would mess up bitwise ops. So this commit: 1) adds a new flag, OPpUSEINT, to indicate the bit within op_private. 2) Changes this flag's value from 0x1 to 0x4 to force it to be different than HINT_INTEGER - thus potentially flushing out any misuse of this flag anywhere (in core or XS code). 3) tells regen/op_private that the lower two bits of op_private in bitwise ops don't contain the argument count. They never did, but not specifying that in regen/op_private meant that the debugging code in op_free() never spotted the unknown bit 0 sometimes being set. 4) Also tell that debugging code to skip the test if the op is banned. This fixes a new fail in dist/Safe/t/safeops.t which was croaking about a banned op having an unrecognised op_private flag bit set before ck_bitop() had a chance to delete the arg count in op_private.
* Use fabs/fabsl/fabsq for NVs in pp_abs.TAKAI Kousuke2021-09-221-3/+3
| | | | | | In many floating point formats, fabs*() are rather simple operations such as just clearing the sign bit, and will be slightly faster than a conditional negation (especially with optimizing compilers).
* 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.