summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* improve regexec_flags() API documentationDavid Mitchell2013-08-131-2/+2
| | | | | | In the API, rename the 'screamer' arg to be 'sv' instead; update the description of the functions args; improve the documentation of the REXEC_* flags for the 'flags' arg.
* Make PL_hints an alias for PL_compiling.cop_hintsFather Chrysostomos2013-08-111-0/+2
| | | | | | | | | | | | | | | | | | | PL_hints stores the hints at compile time that get copied into the cop_hints field of each COP (in newSTATEOP). Since perl-5.8.0-8053-gd5ec298, COPs have stored all the hints. Before that, COPs used to store only some of the hints. The hints were copied here and there into PL_compiling, a static COP-shaped buf- fer used during compilation, so that things like constant folding would see the correct hints. a0ed51b3 back in 1998 did that. Now that COPs can store all the hints, we can just use PL_compiling.cop_hints to avoid having to copy them from PL_hints from time to time. This simplifies the code and avoids creating bugs like those that a547fd219 and 1c75beb82 fixed.
* [perl #52000] Warn/abort on attempted perl exitJohn Gardiner Myers2013-07-291-0/+2
|
* Reinstate "Use new Svt_INVLIST for inversion lists."Karl Williamson2013-07-161-1/+2
| | | | | | | | | | | This reverts commit 2e0b8fbeab3502bee36f25825c3cdd0d075c4fd3, which reverted e0ce103ae532f9576f54a5938a24d1ee98dfb928, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: This converts inversion lists to use their own scalar type.
* Reinstate "Create SVt_INVLIST"Karl Williamson2013-07-161-7/+7
| | | | | | | | | | | | | | | | | This reverts commit 49cf1d6641a6dfd301302f616e4f25595dcc65d4, which reverted e045dbedc7da04e20cc8cfccec8a2e3ccc62cc8b, thus reinstating the latter commit. It turns out that the error being chased down was not due to this commit. Its original message was: This reshuffles the svtype enum to remove the dummy slot created in a previous commit, and add the new SVt_INVLIST type in its proper order. It still is unused, but since it is an extension of SVt_PV, it must be greater than that type's enum value. Since it can't be upgraded to any other PV type, it comes right after SVt_PV. Affected tables in the core are updated.
* PATCH: [perl #38193] embedded perl always calls setlocale(LC_ALL,"")Karl Williamson2013-07-091-0/+2
| | | | | | | | | | | | | | | | | | This commit causes the locale initialization to skip calling setlocal(foo, "") if the environment variable PERL_SKIP_LOCALE_INIT is set. Instead, the setup code calls setlocale(LC_ALL, NULL) (plus other similar calls for the subcategories) in order to find out what the current locale is. The original poster for this ticket has a workaround for it which involves using a modified copy of Perl core code. This patch defines the C preprocessor variable HAS_SKIP_LOCALE_INIT that can be used by XS writers to discover if the current Perl version needs the workaround or not. I was unable to come up with a test for this patch that did not involve building extensive infrastructure for testing embedded Perl. That does not seem worth it for such a trivial patch. I tested by hand.
* locale.c: Further checks for utf8ness of a localeKarl Williamson2013-07-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In reality, the return value of setlocale() is documented to be opaque, so using it to determine if a locale is UTF-8 or not may not work. It is a char*, which we treat as a name. We can safely assume that if the name contains UTF-8 (or slight variations thereof), that it is a UTF-8 locale. But if the name doesn't contain that, it still could be one. In fact there are currently many locales on our dromedary machine that fall into this category. Similarly, something containing 8859 is not going to be UTF-8. This commit adds another test for cases where there is no nl_langinfo(), and the locale name isn't helpful. It looks at the currency symbol, which typically will be in the locale's script. If that is illegal UTF-8, we know for sure that the locale isn't UTF-8 (or is corrupted). If it is legal UTF-8 (but not ASCII) we can be pretty sure that the locale is UTF-8. If it is ASCII, we still don't know one way or the other, so we err on it not being UTF-8. Originally, I was going to use the locale's error message strings, returned from strerror(), the source for $!, to check for this. These are supposed to be in terms of the LC_MESSAGES locale. Chances are vanishingly small that the locale is not UTF-8 if all the messages pass a utf8ness test, provided that the messages aren't just ASCII. However, on dromedary, the messages for many of the exotic locales haven't been translated, and are still in English, which doesn't help at all. I figure that this is quite likely to be the case generally, and the currency symbol is much more likely to have been translated. I left the code in though, commented out for possible future use. Note that this test will run only on systems that don't have nl_langinfo(). The test can also be turned off by setting a C compiler flag -DNO_LOCALE_MONETARY, (and -DNO_LOCALE_MESSAGES for the commented-out part), corresponding to the way the other categories can be turned off (none of which is documented).
* perl.h, locale.c: White space onlyKarl Williamson2013-07-051-5/+5
| | | | This indents some nested #if's to clarify the program structure.
* Revert "Create SVt_INVLIST"Karl Williamson2013-07-041-7/+7
| | | | | | | | This reverts commit e045dbedc7da04e20cc8cfccec8a2e3ccc62cc8b. Blead won't compile with address sanitizer; commit 7cb47964955167736b2923b008cc8023a9b035e8 reverting an earlier commit failed to fix that. I'm trying two more reversions to get it back working. This is one of those
* Revert "Use new Svt_INVLIST for inversion lists."Karl Williamson2013-07-041-2/+1
| | | | | | This reverts commit e0ce103ae532f9576f54a5938a24d1ee98dfb928. This commit is failing compilations with address sanitizer, and we don't know why. This reverts it while we work that out.
* Use new Svt_INVLIST for inversion lists.Karl Williamson2013-07-031-1/+2
| | | | This converts inversion lists to use their own scalar type.
* Create SVt_INVLISTKarl Williamson2013-07-031-7/+7
| | | | | | | | | | This reshuffles the svtype enum to remove the dummy slot created in a previous commit, and add the new SVt_INVLIST type in its proper order. It still is unused, but since it is an extension of SVt_PV, it must be greater than that type's enum value. Since it can't be upgraded to any other PV type, it comes right after SVt_PV. Affected tables in the core are updated.
* Reinstate UTF8fFather Chrysostomos2013-06-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This format string allows char*s to be interpolated with the utf8ness and length specified as well, avoiding the need to create extra SVs: Perl_croak(aTHX_ "Couldn't twiggle the twoggle in \"%"UTF8f"\"", UTF8fARG(is_utf8, len, s)); This is the second attempt. I screwed up in commits 1c8b67b38f0a5 and b3e714770ee1 because I didn’t really understand how varargs functions receive their arguments. They are like structs, in that different members can be different sizes. So therefore both ends--the caller and the called--*must* get the casts right, or the data will be corrupted. The main mistake I made was to use %u in the format for the first argument and then retrieve it as UV (a simple typo, I meant unsigned int or U32--I don’t remember). To be on the safe side, I added a UTF8fARG macro (after SVfARG), which (unlike SVfARG) takes three arguments and casts them explicitly, mak- ing it much harder to get this wrong at call sites.
* Revert "UTF8f"Karl Williamson2013-06-251-5/+0
| | | | | | | | This reverts commit 670610ebb17508101065cc5f5ecfe616aace5335. This and the other UTF8f patch are causing significant problems on some configurations on 32-bit platforms. We've decided to revert them until they can be resubmitted after the kinks get ironed out.
* UTF8fFather Chrysostomos2013-06-181-0/+5
| | | | | | | | | | | | | | This new format string allows char*s to be interpolated with the utf8ness and length specified as well: Perl_croak(aTHX_ "Couldn't twiggle the twoggle in \"%"UTF8f"\"", is_utf8, len, s); This commit changes one function call in gv.c to use UTF8f (it should go faster now) as an example of its use. This was brought up in ticket #113824. This commit does not fix #113824, but provides groundwork that makes it easier to fix.
* add strbeg argument to Perl_re_intuit_start()David Mitchell2013-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | (note that this is a change both to the perl API and the regex engine plugin API). Currently, Perl_re_intuit_start() is passed an SV, plus pointers to: where in the string to start matching (strpos); and to the end of the string (strend). Unlike Perl_regexec_flags(), it doesn't also have a strbeg arg. Because of this this, it guesses strbeg: based on the passed SV (if its svPOK()); or just set to strpos otherwise. This latter can happen if for example the SV is overloaded. Note also that this latter guess is wrong, and could in theory make /\b.../ fail. But just to confuse matters, although Perl_re_intuit_start() itself uses its guesstimate strbeg var, some of the functions it calls use the global value of PL_bostr instead. To make this work, the *callers* of Perl_re_intuit_start() currently set PL_bostr first. This is why \b doesn't actually break. The fix to this unholy mess is to simply add a strbeg arg to Perl_re_intuit_start(). It's also the first step to eliminating PL_bostr altogether.
* Remove DG/UX support.Nicholas Clark2013-05-271-7/+2
| | | | | DG/UX was a Unix sold by Data General. The last release was in April 2001. It only runs on Data General's own hardware.
* perl -V displayed PERL_NEW_COPY_ON_WRITE twiceDavid Mitchell2013-05-261-3/+0
| | | | | | I didn't realise that the perl -V list of defines is now split between perl.h and perl.c and so added it to one (thinking it was missing) when it was already in the other).
* re-enable Copy-on-Write by default.David Mitchell2013-05-261-5/+4
| | | | | | | | | | | | COW was first introduced (and enabled by default) in 5.17.7. It was disabled by default in 5.17.10, because it was though to have too many rough edges for the 5.18.0 release. By re-enabling it now, early in the 5.19.x release cycle, hopefully it will be ready for production use by 5.20. This commit mainly reverts 9f351b45f4 and e1fd41328c (with modifications), then updates perldelta.
* Remove fakethr.h and eliminate all references to it and FAKE_THREADSNicholas Clark2013-05-211-8/+1
| | | | | | | | | | fakethr.h and FAKE_THREADS were for a "green" threads implementation of 5005threads. 5005threads itself is long gone, and it's not clear that -DFAKE_THREADS *ever* built correctly. Certainly it did not work for the 5.005 release, and it did not work at the time of the commits for the initial checkin. The closest that it seems to have been to working is around commit c6ee37c52f2ca9e5 (Dec 1997), where the headers no longer contained errors, but perl.c failed to compile.
* Eliminate the implementations of [hv]to[vh][ls] for mixed-endian systems.Nicholas Clark2013-05-201-10/+6
| | | | | | As pp_pack.c has had mixed-endian support removed, there is little point in keeping code in perl.h and util.c only needed for architectures that cannot be built.
* DO_BO_{UN,}PACK can use my_swabn() directly.Nicholas Clark2013-05-201-21/+0
| | | | | This removes the only users of my_{be,le,h}to{be,le,h}n, so remove the definitions for those macros.
* Eliminate my_{hto[bl]e,[bl]etoh}{16,32,64,s,i,l} as nothing now uses them.Nicholas Clark2013-05-201-162/+0
|
* Eliminate the conditionally-compiled fallback functions for htonl etc.Nicholas Clark2013-05-201-16/+13
| | | | | | | | | | | These are now only being used for mixed-endian platforms which do not provide their own htnol (etc) functions. Given that the fallbacks have been buggy since they were added in Perl 3.0, it's safe to conclude that no mixed-endian platforms were ever using these functions. It's also unclear why these functions were ever marked as 'A', part of the API. XS code can't call them directly, as it can't rely on them being compiled. Unsurprisingly, no code on CPAN references them.
* Fallbacks for ntohl, ntohs, htonl and htons for little endian systems.Nicholas Clark2013-05-201-0/+24
| | | | | The host byteorder agnostic functions in util.c are now only used on mixed endian systems.
* Provide ntohl, ntohs, htonl and htons no-op macros on big endian systems.Nicholas Clark2013-05-201-8/+9
| | | | | | | | | | | This means that there are always macros or functions for ntohl, ntohs, htonl and htons available, so eliminate use of HAS_NTOHL etc, and unconditionally compile the code that it was protecting. However, as code on CPAN is using these guard macros, define all of them in perl.h (Technically the 4 are not quite no-ops, as they truncate their values to 32 or 16 bits, to be consistent with the implementations for platforms which need re-ordering.)
* Provide vtohl, vtohs, htovl and htovs no-op macros on little endian systems.Nicholas Clark2013-05-201-5/+7
| | | | | | | | | | | This means that there are always macros or functions for vtohl, vtohs, htovl and htovs available, so eliminate HAS_VTOHL etc, and unconditionally compile the code that it was protecting. grep.cpan.me shows that no code on CPAN uses any of these macros. (Technically the 4 are not quite no-ops, as they truncate their values to 32 or 16 bits, to be consistent with the implementations for platforms which need re-ordering.)
* vtohl, vtohs, htovl and htovs are no-ops on 64 bit little endian systems.Nicholas Clark2013-05-201-1/+3
| | | | | | | Previously they were implemented as function calls on 64 bit little endian systems. Bit endian systems implemented them as byte-swapping macros. 32 little endian system didn't implement them at all. 32 and 64 bit little endian systems now behave identically.
* Change LIKELY() and UNLIKELY() to cast their first argument to a bool.Nicholas Clark2013-05-201-2/+2
| | | | | | | | | | | This avoids problems such as pointers being compared with the literal value 1. Suggested by Zefram. Note that this is technically a change of behaviour, as the macro EXPECT(), which they are both both wrappers for, returns its value, so they will now be returning TRUE or FALSE, rather than the actual value passed to them. However, all uses in the core and on CPAN are only within if() statements, so this should not make any difference in practice.
* If PERL_NO_INLINE_FUNCTIONS is defined, don't include "inline.h"Nicholas Clark2013-05-031-2/+15
| | | | | | | | | | | | | | This permits test code to include the perl headers for definitions without creating a link dependency on the perl library (which may not exist yet). Some of the static inline functions in inline.h reference functions in the perl object files, and some compilers aren't smart enough to eliminate unused static inline functions, hence including the inline.h in probe code can cause link errors even though the probe code uses none of the functions it declares. When probing, a failed link is taken as meaning that the probed-for function is not present, as the assumption is that the link fails because of it. Hence other causes of link failures cause the probing code to generate incorrect results, and action (and bugs) at a distance.
* (UN)LIKELY branch prediction hints in a few strategic placesSteffen Mueller2013-03-061-3/+3
| | | | | | | | This adds branch prediction hints to a few strategic places such as growing stack or strings, some exception handling, and a few hot functions such as sv_upgrade. This is not exhaustive by any means.
* Disable by default the new Copy-on-Write for 5.18David Mitchell2013-03-021-3/+7
| | | | | | | | It was felt that the new COW feature wasn't ready to be enabled be default in 5.18: principally because too much XS code will assume it can just manipulate the PVX buffer of an SVf_POK SV. See RT #116569 for the discussion.
* Fix redeclaration compiler errors on EBCDICNicholas Clark2013-02-251-0/+2
| | | | | This patch was posted in http://markmail.org/message/pwjxbxnlazvxgsyw
* Rename PL_interp_size_5_16_0 to PL_interp_size_5_18_0.Nicholas Clark2013-02-191-2/+2
|
* Remove the BeOS port.Nicholas Clark2012-12-141-10/+6
| | | | | | | | | BeOS was an operating system for personal computers developed by Be Inc, initially for their BeBox hardware. The OS Haiku was written as an open source replacement/continuation for BeOS, and its perl port is current and actively maintained. The BeOS port has not been updated since 2004.
* perl.h: fix signedness warning with clangDavid Mitchell2012-12-121-1/+1
| | | | | 'len' arg to my_vsnprintf() is supposed to be Size_t; cast it that way before testing it.
* perl.h: Add commentsKarl Williamson2012-12-091-0/+6
|
* perl.h: Mention PERL_SAWAMPERSAND in perl -V outputFather Chrysostomos2012-11-271-0/+3
|
* Disable PL_sawampersandFather Chrysostomos2012-11-271-0/+5
| | | | | | | | | | | | | | | | | | | PL_sawampersand actually causes bugs (e.g., perl #4289), because the behaviour changes. eval '$&' after a match will produce different results depending on whether $& was seen before the match. Using copy-on-write for the pre-match copy (preceding patches do that) alleviates the slowdown caused by mentioning $&. The copy doesn’t happen unless the string is modified after the match. It’s now a post- match copy. So we no longer need to do things differently depending on whether $& has been seen. PL_sawampersand is now #defined to be equal to what it would be if every program began with $',$&,$`. I left the PL_sawampersand code in place, in case this commit proves immature. Running Configure with -Accflags=PERL_SAWAMPERSAND will reënable the PL_sawampersand mechanism.
* Enable PERL_NEW_COPY_ON_WRITE by defaultFather Chrysostomos2012-11-271-0/+4
| | | | | | | | One can disable this with -Accflags=-DPERL_NO_COW. I am leaving this in for debugging purposes. If it causes no problems in 5.18, we might remove the defines and enable it unconditionally in 5.20, but then again we might not.
* New COW mechanismFather Chrysostomos2012-11-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | This was discussed in ticket #114820. This new copy-on-write mechanism stores a reference count for the PV inside the PV itself, at the very end. (I was using SvEND+1 at first, but parts of the regexp engine expect to be able to do SvCUR_set(sv,0), which causes the wrong byte of the string to be used as the reference count.) Only 256 SVs can share the same PV this way. Also, only strings with allocated space after the trailing null can be used for copy-on-write. Much of the code is shared with PERL_OLD_COPY_ON_WRITE. The restric- tion against doing copy-on-write with magical variables has hence been inherited, though it is not necessary. A future commit will take care of that. I had to modify _core_swash_init to handle $@ differently. The exist- ing mechanism of copying $@ to a new scalar and back again was very fragile. With copy-on-write, $@ =~ s/// can cause pp_subst’s string pointers to become stale. So now we remove the scalar from *@ and allow the utf8-table-loading code to autovivify a new one. Then we restore the untouched $@ afterwards if all goes well.
* Remove "register" declarationsKarl Williamson2012-11-241-4/+4
| | | | | | | This finishes the removal of register declarations started by eb578fdb5569b91c28466a4d1939e381ff6ceaf4. It neglected the ones in function parameter declarations, and didn't include things in dist, ext, and lib, which this does include
* Remove the EPOC port.Nicholas Clark2012-11-191-11/+6
| | | | | | | EPOC was a family of operating systems developed by Psion for mobile devices. It was the predecessor of Symbian. The port was last updated in April 2002.
* [perl #114864] Don’t use amt for DESTROYFather Chrysostomos2012-11-171-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | DESTROY has been cached in overload tables since perl-5.6.0-2080-g32251b2, making it 4 times faster than before (over- load tables are faster than method lookup). But it slows down symbol lookup on stashes with overload tables, because overload tables use magic, and SvRMAGICAL results in calls to mg_find on every hash lookup. By reusing SvSTASH(stash) to cache the DESTROY method (if the stash is unblessed, of course, as most stashes are), we can avoid making all destroyable stashes magical and also speed up DESTROY lookup slightly more. The results: • 10% increase in stash lookup speed after destructors. That was just testing $Foo::{x}. Other stash lookups will have other overheads that make the difference less impressive. • 5% increase in DESTROY lookup speed. I was using an empty DESTROY method to test this, so, again, real DESTROY methods will have more overhead and less speedup.
* clean up the users of PL_no_memDaniel Dragan2012-11-121-1/+1
| | | | | | | | | This commit eliminates a couple strlen()s of a literal. "Out of memory!\n" and PL_no_mem did not string pool on Visual C, so PL_no_mem was given a length. This commit removes S_write_no_mem and replaces it with nonstatic. Perl_croak_no_mem was made nocontext to save instructions in it's callers. NORETURN_FUNCTION_END caused a syntax error on Visual C C++ mode and therefore was removed.
* create aTHXa, some unused dTHXs removed in /win32/*Daniel Dragan2012-11-081-0/+2
| | | | | | | | | dTHXes that were unused, or because Newx/Safefree were the only things called were removed. In some places the dTHX turned into dTHXa and aTHXa so the context is not fetched until it is actually used (locality/frees a C stack slot or frees a non-volatile register). Also see http://www.nntp.perl.org/group/perl.perl5.porters/2012/10/msg194414.html and http://www.nntp.perl.org/group/perl.perl5.porters/2012/10/msg194861.html
* perl.h: s/non-existant/nonexistent/Father Chrysostomos2012-11-051-1/+1
|
* More violent warning about using NO_TAINT_SUPPORTSteffen Mueller2012-11-051-0/+3
| | | | | | | | | | | I failed to update the commit message of the previous commit (sorry!). The code is in a much better shape than the message claims and Configure support, for example, won't be added at all to require more determination from users. PL_taint_warn has since received the same treatment. To wit: # define TAINT_WARN_get (PL_taint_warn) # define TAINT_WARN_set(s) (PL_taint_warn = (s))
* Add C define to remove taint support from perlSteffen Mueller2012-11-051-5/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By defining NO_TAINT_SUPPORT, all the various checks that perl does for tainting become no-ops. It's not an entirely complete change: it doesn't attempt to remove the taint-related interpreter variables, but instead virtually eliminates access to it. Why, you ask? Because it appears to speed up perl's run-time significantly by avoiding various "are we running under taint" checks and the like. This change is not in a state to go into blead yet. The actual way I implemented it might raise some (valid) objections. Basically, I replaced all uses of the global taint variables (but not PL_taint_warn!) with an extra layer of get/set macros (TAINT_get/TAINTING_get). Furthermore, the change is not complete: - PL_taint_warn would likely deserve the same treatment. - Obviously, tests fail. We have tests for -t/-T - Right now, I added a Perl warn() on startup when -t/-T are detected but the perl was not compiled support it. It might be argued that it should be silently ignored! Needs some thinking. - Code quality concerns - needs review. - Configure support required. - Needs thinking: How does this tie in with CPAN XS modules that use PL_taint and friends? It's easy to backport the new macros via PPPort, but that doesn't magically change all code out there. Might be harmless, though, because whenever you're running under NO_TAINT_SUPPORT, any check of PL_taint/etc is going to come up false. Thus, the only CPAN code that SHOULD be adversely affected is code that changes taint state.
* Allow regexp-to-pvlv assignmentFather Chrysostomos2012-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since the xpvlv and regexp structs conflict, we have to find somewhere else to put the regexp struct. I was going to sneak it in SvPVX, allocating a buffer large enough to fit the regexp struct followed by the string, and have SvPVX - sizeof(regexp) point to the struct. But that would make all regexp flag-checking macros fatter, and those are used in hot code. So I came up with another method. Regexp stringification is not speed-critical. So we can move the regexp stringification out of re->sv_u and put it in the regexp struct. Then the regexp struct itself can be pointed to by re->sv_u. So SVt_REGEXPs will have re->sv_any and re->sv_u pointing to the same spot. PVLVs can then have sv->sv_any point to the xpvlv body as usual, but have sv->sv_u point to a regexp struct. All regexp member access can go through sv_u instead of sv_any, which will be no slower than before. Regular expressions will no longer be SvPOK, so we give sv_2pv spec- ial logic for regexps. We don’t need to make the regexp struct larger, as SvLEN is currently always 0 iff mother_re is set. So we can replace the SvLEN field with the pv. SvFAKE is never used without SvPOK or SvSCREAM also set. So we can use that to identify regexps.