summaryrefslogtreecommitdiff
path: root/perl.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix SET_NUMERIC_STANDARD, _UNDERLYING spellingKarl Williamson2015-04-071-2/+2
|
* Don't raise Wide char warning in UTF-8 localeKarl Williamson2015-03-271-3/+8
| | | | | | | | | | | | This belongs in the category of "I can't believe I did that." Commit 613abc6d16e99bd9834fe6afd79beb61a3a4734d introduced warning messages when a multi-byte character is operated on in a single byte locale. But the two macros introduced fail to suppress said messages when in a multi-byte locale where the operation is perfectly valid. This partially solves v5.22 blocker [perl #123527]. But it could still fail if the test files are called from within a non-UTF-8 locale. I will issue a pull request for fixing that.
* Replace common Emacs file-local variables with dir-localsDagfinn Ilmari Mannsåker2015-03-221-6/+0
| | | | | | | | | | | | | | | | An empty cpan/.dir-locals.el stops Emacs using the core defaults for code imported from CPAN. Committer's work: To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed to be incremented in many files, including throughout dist/PathTools. perldelta entry for module updates. Add two Emacs control files to MANIFEST; re-sort MANIFEST. For: RT #124119.
* perl.h: Fix nit in commentKarl Williamson2015-03-191-1/+2
|
* Document API for XS LC_NUMERIC locale manipulationKarl Williamson2015-03-191-1/+92
| | | | | XS writers may need to manipulate the LC_NUMERIC locale. Some macros are available to do this. This documents them and the issues.
* perl.h: White-space onlyKarl Williamson2015-03-191-5/+5
| | | | | Remove some empty /**/ and align line continuation backslashes onto tab boundaries
* Change some locale manipulation macros in prep for APIKarl Williamson2015-03-191-60/+71
| | | | | | | | | | This changes the way some of the current internal-only macros are named and used in order to simplify things and minimize what gets exposed as part of the API. Although these have not been listed as publicly available, it costs essentially nothing to keep the old names around in case someone was illegally using them.
* perl.h: Only #define item onceKarl Williamson2015-03-121-4/+2
| | | | | This definition was duplicated in both branches of an #if #else #endif It's better to do it once, outside the #if.
* perl.h: Make macro do nothing when LC_CTYPE not availableKarl Williamson2015-03-091-6/+10
| | | | Otherwise things won't compile.
* IRIX: floating point: do not flush to zeroJarkko Hietaniemi2015-03-031-0/+20
| | | | | | Fix for [perl #123767] IRIX64 blead (ddce084a) opbasic/arith.t failure Use the PERL_SYS_FPU_INIT to initialize the FPU flags appropriately.
* infnan: NV_MANT_REAL_DIG is unusedJarkko Hietaniemi2015-02-271-9/+0
| | | | (now that the nan payload code is gone)
* infnan: one should not define NV_NAN from NV_SNANJarkko Hietaniemi2015-02-261-9/+0
| | | | More generally, the NaN should be the quiet one.
* infnan: drop NV_QNAN and NV_SNANJarkko Hietaniemi2015-02-261-8/+0
| | | | They are unused, better keep the API small.
* Add qr/\b{gcb}/Karl Williamson2015-02-191-0/+1
| | | | | | | | | | | A function implements seeing if the space between any two characters is a grapheme cluster break. Afer I wrote this, I realized that an array lookup might be a better implementation, but the deadline for v5.22 was too close to change it. I did see that my gcc optimized it down to an array lookup. This makes the implementation of \X go from being complicated to trivial.
* add a comment documenting STATIC_ASSERT_GLOBAL/STATIC_ASSERT_STMTLukas Mai2015-02-131-0/+12
|
* infnan: revert nan payload/signaling changesJarkko Hietaniemi2015-02-111-32/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 4258cf903c752ec19a3aeee9b93020533d923e1a 91e945c051cfcdf499d5b43aa5ac0a5681cdd595 eb254f2672a985ec3c34810f624f36c18fc35fc7 c9a671b17a9c588469bcef958038daaaaf9cc88b 99fcdd4df47515fb0a62a046e622adec0871754d ba511db061a88439acb528a66c780ab574bb4fb0 0d1cf11425608e9be019f27a3a4575bc71c49e6b c2ea8a88f8537d00ba25ec8feb63ef5dc085ef2b b5a6eedc2f49a90089cca896ee20f41e373fb4c9 30419b527d2c5a06cefe2db9183f59e2697c47fc 29b62199cd4c359dfc6b9d690341de40d105ca5f be181dc9d91c84a2fe03912c993c8259fed92641 4de1bcfe1abdaba0a5da394ddea0cc6fd7e36c7b 6e915616c4ccb4f6cc3122c5d395765db96c0a2d b2e3501558a1017eb529be0915c25d31671e7869 bfaa02d55f4ace1571e6fa9e5b47d5e3ac3cecc6 569f27e562618bdddcf4a9fc71612283a73747e9 4f89311dc8de87ddc9a302c6f2d2c844951bbd28 a307a0b0d83c509cc2adaad8cebb44260294bf36 6640aa2c3b93d7ac78e4e86983fe5948b3ca55f2 b74dc0b3c96390d8bf83d8c3ffc0c2c2d1f0a5d3 c3a8e5a5b4bb89a15de642c023dfd5cbc4678938
* infnan: the nan quiet/signaling bit is not enoughJarkko Hietaniemi2015-02-081-0/+32
|
* infnan: do not define NV_NAN from a signaling nanJarkko Hietaniemi2015-02-081-3/+0
| | | | This is not a strong guarantee that the NV_NAN is a quiet NaN.
* [PATCH] fix PL_nan_u from leaking in every translation object on Win32 VCDaniel Dragan2015-02-041-8/+0
|
* infnan: more NV_SNAN/NV_QNANJarkko Hietaniemi2015-02-041-1/+3
|
* static_assert workaround for AIX/xlcLukas Mai2015-02-031-1/+2
|
* infnan: fixup for 02e75e52Jarkko Hietaniemi2015-02-031-1/+1
|
* infnan: define NV_QNAN and NV_SNAN if feasibleJarkko Hietaniemi2015-02-021-0/+4
|
* infnan: comment tweak, IS_NUMBER_NOT_INT also if saw infnanJarkko Hietaniemi2015-02-021-1/+1
|
* infnan: define NV_NAN (and NV_QNAN, NV_SNAN) if sunmathJarkko Hietaniemi2015-02-021-0/+5
|
* Add NV_MANT_REAL_DIG.Jarkko Hietaniemi2015-02-021-0/+9
|
* Add NV_IMPLICIT_BIT define.Jarkko Hietaniemi2015-02-021-0/+7
|
* Add NV_MIX_ENDIAN define.Jarkko Hietaniemi2015-02-021-0/+8
|
* Add NV_LITTLE_ENDIAN and NV_BIG_ENDIAN defines.Jarkko Hietaniemi2015-02-021-0/+16
|
* Wrong ifdef guard.Jarkko Hietaniemi2015-02-021-2/+2
|
* Add DOUBLE_BIG_ENDIAN define.Jarkko Hietaniemi2015-02-021-0/+6
|
* Move the endianness defines from sv.c to perl.hJarkko Hietaniemi2015-02-021-0/+32
|
* Corrections to spelling and grammatical errors.Lajos Veres2015-01-281-1/+1
| | | | Extracted from patch submitted by Lajos Veres in RT #123693.
* PerlIO::scalar write() at large file positionTony Cook2015-01-271-0/+2
| | | | Prevents treating a large file position as negative (or even wrapped).
* Revert "refactor gv_add_by_type"Matthew Horsfall2015-01-201-13/+0
| | | | | | | This reverts commit 819b139db33e2022424694e381422766903d4f65. This could be repapplied for 5.23.1, with modifications or additional patches to solve the breakage discussed in RT 123580.
* Move unlikely executed macro to functionKarl Williamson2015-01-131-9/+6
| | | | | | | | | | The bulk of this macro is extremely rarely executed, so it makes sense to optimize for space, as it is called from a fair number of places, and move as much as possible to a single function. For whatever it's worth, on my system with my typical compilation options, including -O0, the savings was 19640 bytes in regexec.o, 4528 in utf8.o, at a cost of 1488 in locale.o.
* refactor gv_add_by_typeDaniel Dragan2015-01-061-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gv_add_by_type was added in commit d5713896ec in 5.11.0 . Improve gv_add_by_type by making it return the newly created SV*, instead of the the GV *, which the caller must deref both the GV head to get svu and then deref a slice into the GP, even though it already derefed svu and GP right before, to figure out whether to call gv_add_by_type in the first place. The original version of this patch had gv_add_by_type returning a SV ** to ensure lvalue-ness but it was discovered it wasn't needed and not smart. -rename gv_add_by_type since it was removed from public api and its proto changed -remove null check since it is impossible to pass null through GvAVn(), and unlikely with gv_AVadd, null segvs reliably crash in the rare case of a problem -instead of S_gv_init_svtype and gv_add_by_type using a tree of logic/ conditional jumps in asm, use a lookup table, GPe (e=enum or entry) enums are identical to offsets into the GP struct, all of then fit under 0xFF, if the CC and CPU arch wants, CC can load the const once into a register, then use the number for the 2nd deref, then use the number again as an arg to gv_add_by_type, the low (&~0xf) or high (<<2) 2 bits in a GPe can be used for something else in the future since GPe is pointer aligned -SVt_LAST triggers "panic: sv_upgrade to unknown type", so use that value for entries of a GP which are not SV head *s and are invalid to pass as an arg -remove the tree of logic in S_gv_init_svtype, replace with a table -S_gv_init_svtype is now tail call friendly and very small -change the GV**n to be rvalues only, assigning to GV**n is probably a memory leak -fix 1 core GV**n as lvalue use -GvSVn's unusual former definition is from commit 547f15c3f9 in 2005 and DEFSV as lvalue is gone in core as of commit 414bf5ae08 from 2008 since all the GV**n macros are now rvalues, this goes too -PTRPTR2IDX and PTRSIZELOG2 could use better names -in pp_rv2av dont declare strings like that VC linker won't dedup that, and other parts of core also have "an ARRAY", perl521.dll previously had 2 "an ARRAY" and "a HASH" strings in it due to this before VC 2003 32 perl521.dll .text 0xc8813 in machine code bytes after .text 0xc8623
* perl.h:MY_CXT_CLONE: void *, not void **Father Chrysostomos2015-01-031-1/+1
| | | | | C++ fails otherwise, and PL_my_cxt_list is void ** so individual elephants (aka elements) should be void *.
* reorder MY_CXT_CLONE for less memory readsDaniel Dragan2015-01-031-2/+4
| | | | | | | | | | | | | | | Nn VC 2003 32, taking a very simple CLONE XSUB, specifically Time::HiRes::CLONE, shows a reduction from 0x53 to 0x47 bytes of machine code. This is because my_cxt_index has to be reread after the memcpy function call incase my_cxt_index was changed by memcpy (GCC usually inlines short fixed length memcpys, on VC P5P perl, the option to inline memcpy is off), also the new my_cxtp does not need to be saved in a non-vol anymore, previously my_cxtp had to be copied to a non-vol for it be available after the memcpy function call. In a simple XSUB like the one mentioned here, saving and restoring the non-vol register is also removed. See details in perl #123534.
* Raise warning on multi-byte char in single-byte localeKarl Williamson2014-12-291-0/+23
| | | | | | | | | See http://nntp.perl.org/group/perl.perl5.porters/211909 Something is quite likely wrong with the logic if say in a Greek locale, Unicode characters (especially Greek ones) are encountered. The same character will be represented by two different code points. This warning alerts the user to this undesirable state of affairs.
* Don't raise 'poorly supported' locale warning unnecessarilyKarl Williamson2014-12-291-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 8c6180a91de91a1194f427fc639694f43a903a78 added a warning message for when Perl determines that the program's underlying locale just switched into is poorly supported. At the time it was thought that this would be an extremely rare occurrence. However, a bug in HP-UX - B.11.00/64 causes this message to be raised for the "C" locale. A workaround was done that silenced those. However, before it got fixed, this message would occur gobs of times executing the test suite. It was raised even if the script is not locale-aware, so that the underlying locale was completely irrelevant. There is a good prospect that someone using an older Asian locale as their default would get this message inappropriately, even if they don't use locales, or switch to a supported one before using them. This commit causes the message to be raised only if it actually is relevant. When not in the scope of 'use locale', the message is stored, not raised. Upon the first locale-dependent operation within a bad locale, the saved message is raised, and the storage cleared. I was able to do this without adding extra branching to the main-line non-locale execution code. This was done by adding regnodes which get jumped to by switch statements, and refactoring some existing C tests so they exclude non-locale right off the bat. These changes would have been necessary for another locale warning that I previously agreed to implement, and which is coming a few commits from now. I do not know of any way to add tests in the test suite for this. It is in fact rare for modern locales to have these issues. The way I tested this was to temporarily change the C code so that all locales are viewed as defective, and manually note that the warnings came out where expected, and only where expected. I chose not to try to output this warning on any POSIX functions called. I believe that all that are affected are deprecated or scheduled to be deprecated anyway. And POSIX is closer to the hardware of the machine. For convenience, I also don't output the message for some zero-length pattern matches. If something is going to be matched, the message will likely very soon be raised anyway.
* const the PerlIO vtablesDaniel Dragan2014-12-271-3/+3
| | | | | | | | | | | Previously the PerlIO vtables were const only on PERL_GLOBAL_STRUCT_PRIVATE builds, which was created for former Symbian port and today is rarely used. Since writing/hooking the PerlIO vtables from XS has never been public API and is very unlikely to be occuring on CPAN, make then const so they will be shared between perl processes. b4 VC2008 x64 perl521.dll .rdata section 0x7293C bytes, .data 0x34B0 bytes after .rdata 0x7321C .data 0x2BD0
* optimize CLEAR_ERRSVDaniel Dragan2014-12-261-7/+10
| | | | | | | | | | | | | | | | | | -gv_add_by_type is special only for non-GVs, and add AV to GV, otherwise it is just assigning to GP slot (in this case through GvSV), which CLEAR_ERRSV already did in another branch, so inline the gv_add_by_type -dont compute GvSV multiple times, GvSV contains 2 derefs, after this patch it will contains just 1 deref ("*svp") without an offset (deref without offset is smaller in x86 machine code than deref with offset) -SvREFCNT_dec_NN for efficiency -move SvPOK_only closer to SvMAGICAL, this ensures SvFLAGS is read and written only once, not 2 reads and 1 write, this is specifically for RISC-ish cpus -the goto clresv_newemptypv is because VC optimizer in -O1 didn't combine the branches perl521.dll VC 2003 before .text section size in machine code bytes 0xc8a63, after 0xc88e3
* const the core magic vtablesDaniel Dragan2014-12-261-8/+1
| | | | | | | | | | | | | | | | | | A remark in http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115113.html caused commit bc028b6b7f / http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115116.html . That remark is not true according to http://www.nntp.perl.org/group/perl.perl5.porters/2006/07/msg115115.html and http://www.nntp.perl.org/group/perl.perl5.porters/2013/01/msg197318.html . To save memory between perl processes, const the tables so the memory is shared by the OS between perl processes. b4 .rdata section of x64 VC 2008 miniperl 0x667EE bytes .data 0x3440 bytes after .rdata 0x66FAE .data 0x2C80, 0x3440-0x2C80=0x7C0 saved, based on the .data section size crossing a page boundary this saved 4K of per process memory on Win64 miniperl.
* Add OP_MULTIDEREFDavid Mitchell2014-12-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This op is an optimisation for any series of one or more array or hash lookups and dereferences, where the key/index is a simple constant or package/lexical variable. If the first-level lookup is of a simple array/hash variable or scalar ref, then that is included in the op too. So all of the following are replaced with a single op: $h{foo} $a[$i] $a[5][$k][$i] $r->{$k} local $a[0][$i] exists $a[$i]{$k} delete $h{foo} while these aren't: $a[0] already handled by OP_AELEMFAST $a[$x+1] not a simple index and these are partially replaced: (expr)->[0]{$k} the bit following (expr) is replaced $h{foo}[$x+1][0] the first and third lookups are each done with a multideref op, while the $x+1 expression and middle lookup are done by existing add, aelem etc ops. Up until now, aggregate dereferencing has been very heavyweight in ops; for example, $r->[0]{$x} is compiled as: gv[*r] s rv2sv sKM/DREFAV,1 rv2av[t2] sKR/1 const[IV 0] s aelem sKM/DREFHV,2 rv2hv sKR/1 gvsv[*x] s helem vK/2 When executing this, in addition to the actual calls to av_fetch() and hv_fetch(), there is a lot of overhead of pushing SVs on and off the stack, and calling lots of little pp() functions from the runops loop (each with its potential indirect branch miss). The multideref op avoids that by running all the code in a loop in a switch statement. It makes use of the new UNOP_AUX type to hold an array of typedef union { PADOFFSET pad_offset; SV *sv; IV iv; UV uv; } UNOP_AUX_item; In something like $a[7][$i]{foo}, the GVs or pad offsets for @a and $i are stored as items in the array, along with a pointer to a const SV holding 'foo', and the UV 7 is stored directly. Along with this, some UVs are used to store a sequence of actions (several actions are squeezed into a single UV). Then the main body of pp_multideref is a big while loop round a switch, which reads actions and values from the AUX array. The two big branches in the switch are ones that are affectively unrolled (/DREFAV, rv2av, aelem) and (/DREFHV, rv2hv, helem) triplets. The other branches are various entry points that handle retrieving the different types of initial value; for example 'my %h; $h{foo}' needs to get %h from the pad, while '(expr)->{foo}' needs to pop expr off the stack. Note that there is a slight complication with /DEREF; in the example above of $r->[0]{$x}, the aelem op is actually aelem sKM/DREFHV,2 which means that the aelem, after having retrieved a (possibly undef) value from the array, is responsible for autovivifying it into a hash, ready for the next op. Similarly, the rv2sv that retrieves $r from the typeglob is responsible for autovivifying it into an AV. This action of doing the next op's work for it complicates matters somewhat. Within pp_multideref, the autovivification action is instead included as the first step of the current action. In terms of benchmarking with Porting/bench.pl, a simple lexical $a[$i][$j] shows a reduction of approx 40% in numbers of instructions executed, while $r->[0][0][0] uses 54% fewer. The speed-up for hash accesses is relatively more modest, since the actual hash lookup (i.e. hv_fetch()) is more expensive than an array lookup. A lexical $h{foo} uses 10% fewer, while $r->{foo}{bar}{baz} uses 34% fewer instructions. Overall, bench.pl --tests='/expr::(array|hash)/' ... gives: PRE POST ------ ------ Ir 100.00 145.00 Dr 100.00 165.30 Dw 100.00 175.74 COND 100.00 132.02 IND 100.00 171.11 COND_m 100.00 127.65 IND_m 100.00 203.90 with cache misses unchanged at 100%. In general, the more lookups done, the bigger the proportionate saving.
* add UNOP_AUX OP classDavid Mitchell2014-12-071-0/+1
| | | | | | | | | | | | | This is the same as a UNOP, but with the addition of an op_aux field, which points to an array of UNOP_AUX_item unions. It is intended as a general escape mechanism for adding per-op-type extra fields (or arrays of items) to UNOPs. Its class character (for regen/opcodes etc) is '+'. Currently there are no ops of this type; but shortly, OP_MULTIDEREF will be added, which is the original motivation for this new op type.
* g++ groks __attribute__((unused)) at least since 4.3.6.Jarkko Hietaniemi2014-12-061-1/+1
| | | | | Cannot find the exact moment from gcc release notes, but tests fine in 4.3.6. (not fine = "warning: unused ...")
* [perl #123063] allow assert() to be used as an expressionTony Cook2014-12-031-2/+4
| | | | | In non-DEBUGGING builds it would be replaced with nothing, producing a syntax error
* [perl #123223] Make PADNAME a separate typeFather Chrysostomos2014-11-301-4/+4
| | | | | | | | | | | distinct from SV. This should fix the CPAN modules that were failing when the PadnameLVALUE flag was added, because it shared the same bit as SVs_OBJECT and pad names were going through code paths not designed to handle pad names. Unfortunately, it will probably break other CPAN modules, but I think this change is for the better, as it makes both pad names and SVs sim- pler and makes pad names take less memory.
* perl.h: Add PNf and PNfARGFather Chrysostomos2014-11-301-0/+3
| | | | | for pad names. Currently equivalent to SVf(ARG), they will be changed shortly when I make pad names a separate type.