summaryrefslogtreecommitdiff
path: root/intrpvar.h
Commit message (Collapse)AuthorAgeFilesLines
* Add environment variable for -Dr: PERL_DUMP_RE_MAX_LENKarl Williamson2016-02-191-0/+2
| | | | | | | | | | | | | | | | | | | The regex engine when displaying debugging info, say under -Dr, will elide data in order to keep the output from getting too long. For example, the number of code points in all of Unicode matched by \w is quite large, and so when displaying a pattern that matches this, only the first some number of them are printed, and the rest are truncated, represented by "...". Sometimes, one wants to see more than what the compiled-into-the-engine-max shows. This commit creates code to read this environment variable to override the default max lengths. This changes the lengths for everything to the input number, even if they have different compiled maximums in the absence of this variable. I'm not currently documenting this variable, as I don't think it works properly under threads, and we may want to alter the behavior in various ways as a result of gaining experience with using it.
* intrvar.h: document PL_tmps_maxDavid Mitchell2016-02-031-1/+1
| | | | Its name implies that it's the top allocated element; in fact it's top+1.
* Add qr/\b{lb}/Karl Williamson2016-01-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the final Unicode boundary type previously missing from core Perl: the LineBreak one. This feature is already available in the Unicode::LineBreak module, but I've been told that there are portability and some other issues with that module. What's added here is a light-weight version that is lacking the customizable features of the module. This implements the default Line Breaking algorithm, but with the customizations that Unicode is expecting everybody to add, as their test file tests for them. In other words, this passes Unicode's fairly extensive furnished tests, but wouldn't if it didn't include certain customizations specified by Unicode beyond the basic algorithm. The implementation uses a look-up table of the characters surrounding a boundary to see if it is a suitable place to break a line. In a few cases, context needs to be taken into account, so there is code in addition to the lookup table to handle those. This should meet the needs for line breaking of many applications, without having to load the module. The algorithm is somewhat independent of the Unicode version, just like the other boundary types. Only if new rules are added, or existing ones modified is there need to go in and change this code. Otherwise, running regen/mk_invlists.pl should be sufficient when a new Unicode release is done to keep it up-to-date, again like the other Unicode boundary types.
* remove deprecated PL_timesbufDaniel Dragan2016-01-171-5/+0
| | | | Saves memory in interp struct.
* Fix broken fix for RT #127212Aaron Crane2016-01-171-3/+5
| | | | | | As ilmari++ points out, the fix didn't work on builds without PERL_IMPLICIT_CONTEXT (including non-threaded, non-multiplicity) or PERL_DEBUG_READONLY_COW.
* Fix version numbers in intrpvar.h commentsAaron Crane2016-01-171-2/+2
| | | | | | | | | | There are two version numbers in intrpvar.h that have been repeatedly but confusingly bumped by an older version of Porting/bump-perl-version. Now that the porting script ignores intrpvar.h, it's better to restore the version numbers to the way they were when they were originally added. The comment for PERL_LAST_5_18_0_INTERP_MEMBER was introduced in commit d399cf59bde32e412ae99791ae46a871c7337b42, and the comments for PL_timesbuf was introduced in 25983af42cdcf2dc1fea6717dac7aac441b6301d.
* RT #127212: retain binary compatibility across plain/DEBUGGINGAaron Crane2016-01-171-3/+4
| | | | | | | | | | | | | | | | | | | | | Niko Tyni of Debian points out that the size of the interpreter structure differs between plain and -DDEBUGGING builds, and that this breaks binary compatibility of XS modules between such builds. Making the definition of PL_memory_debug_header unconditional on PERL_TRACK_MEMPOOL (which itself is defined only on debug builds) eliminates this needless incompatibility. There is some confusion about whether plain and debug builds are expected to be compatible. Commit 1e8125c621275d18c74bc8dae3bfc3c03929fe1e (July 2010) refers in passing to "binary incompatible perls with the same API version (i.e. the same perl version configured with and without DEBUGGING)". But f2b88940d815760ad254d35a0ee1eb2ed8ce7762 (November 2009) says explicitly that "-DDEBUGGING and not need to be binary compatible with each other", and I think this explicit statement is a better example to follow. Further, this compatibility is clearly useful for our downstream packagers (as reported by Niko), and for any users who'd like to be able to use a debug build for tracking down problems (including those encountered while using modules with XS parts).
* Bump the perl version in various places for 5.23.7David Golden2015-12-211-2/+2
|
* Bump the perl version in various places for 5.23.6Abigail2015-11-201-2/+2
|
* avoid (TAINTING_get && TAINT_get)David Mitchell2015-11-101-1/+1
| | | | | | | | | | In various places we test for both (PL_tainting && PL_tainted). Since if tainting isn't enabled PL_tainted should never get set, it's more efficient to just test for (TAINT_get). We ensure that PL_tainted doesn't actually get set when !PL_tainting by changing some "setting" macros from PL_tainted = TRUE to PL_tainted = PL_tainting.
* Bump version to 5.23.5Steve Hay2015-10-201-2/+2
|
* optimise save/restore of PL_delaymagic.David Mitchell2015-10-181-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | A few places (pp_push, pp_unshift, pp_aassign) have to set PL_delaymagic on entry, and restore it on exit. These are hot pieces of code. Rather than using ENTER/SAVEI16(PL_delaymagic)/LEAVE, add an extra field to the jumpenv struct, and make the JUMPENV_PUSH / POP macros automatically save and restore this var. This means that pp_push etc only need to do a local save: U16 old_delaymagic = PL_delaymagic; PL_delaymagic = DM_DELAY; .... PL_delaymagic = old_delaymagic; and in case of an exception being raised, PL_delaymagic still gets restored. This transfers the cost of saving PL_delaymagic from each call to pp_aassign etc to each time a new run level is invoked. The latter should be much less frequent. Note that prior to this commit, pp_aassign wasn't actually saving and restoring PL_delaymagic; it was just setting it to 0 at the end. So this commit also makes pp_aassign safe against PL_delaymagic re-entrancy like pp_push and pp_unshift already were.
* Bump the perl version in various places for 5.23.4.Peter Martini2015-09-211-2/+2
|
* Various pods: Add C<> around many typed-as-is thingsKarl Williamson2015-09-031-1/+1
| | | | Removes 'the' in front of parameter names in some instances.
* perlapi, perlintern: Add L<> links to podKarl Williamson2015-09-031-5/+5
|
* Bump the perl version in various places for 5.23.3.Matthew Horsfall2015-08-201-2/+2
|
* document what PL_generation is forDavid Mitchell2015-08-171-1/+2
|
* Eliminate PL_sawalias, GPf_ALIASED_SVDavid Mitchell2015-08-171-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | These two commits: v5.21.3-759-gff2a62e "Skip no-common-vars optimisation for aliases" v5.21.4-210-gc997e36 "Make list assignment respect foreach aliasing" added a run-time mechanism to detect aliased package variables, by either "*pkg = ...," or "for $pkg (...)", and used that information to enable the OPpASSIGN_COMMON mechanism at runtime for detecting common elements in a list assign, e.g. for $alias ($a, ...) { ($a,$b) = (1,$alias); } The previous commit but one changed the OPpASSIGN_COMMON mechanism such that it no longer uses PL_sawalias. So this var and the mechanism for setting it can now be removed. This commit removes: * the PL_sawalias variable * the GPf_ALIASED_SV GP flag * the SAVEt_GP_ALIASED_SV and save_aliased_sv() save type.
* Bump version to 5.23.2Matthew Horsfall2015-07-201-2/+2
|
* patchlevel: we are now perl v5.23.1Ricardo Signes2015-06-201-2/+2
|
* bump version to v5.23.0Ricardo Signes2015-06-011-2/+2
|
* bump version to v5.22.0 with Porting/bump-perl-versionRicardo Signes2015-05-081-2/+2
|
* Bump version for 5.21.12 (although it's unlikely to happen)Steve Hay2015-04-211-2/+2
|
* Bump version for 5.21.11 (if that happens)Steve Hay2015-03-201-2/+2
|
* Skip PL_warn_locale use unless compiled inKarl Williamson2015-03-071-1/+3
| | | | | | | The use of this variable was inconsistent. It was not dup'ed on thread cloning unless LC_CTYPE is being used, but elsewhere it was. This led to segfaults on threaded builds. Now it isn't touched anywhere unless LC_CTYPE is used.
* added link to announcementSawyer X2015-02-211-2/+2
|
* Add \b{sb}Karl Williamson2015-02-191-0/+1
|
* Add qr/\b{wb}/Karl Williamson2015-02-191-0/+1
|
* Remove obsolete macros/tables for \XKarl Williamson2015-02-191-2/+0
| | | | | A previous commit changed how \X is implemented, and now we don't need these anymore.
* 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.
* More bumpbing of version number to 5.21.9. Missed this yesterday.Matthew Horsfall2015-01-211-2/+2
|
* Don't raise 'poorly supported' locale warning unnecessarilyKarl Williamson2014-12-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Bump version number to 5.21.8Max Maischein2014-12-211-2/+2
| | | | | Add 5.21.8 in Module::CoreList Point Maintainers.pl to new version of Module::CoreList
* Add OP_MULTIDEREFDavid Mitchell2014-12-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Revert ‘Used pad name lists for pad ids’Father Chrysostomos2014-12-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8771da69db30134352181c38401c7e50753a7ee8. Pad lists need to carry IDs around with them, so that when something tries to close over a pad, it is possible to confirm that the right pad is being closed over (either the original outer pad, or a clone of it). (See the commit message of db4cf31d1, in which commit I added an ID to the padlist struct.) In 8771da69 I found that I could use the memory address of the pad’s name list (name lists are shared) and avoid the extra field. Some time after 8771da69 I realised that a pad list could be freed, and the same address reused for another pad list, so using a memory address may not be so wise. I thought it highly unlikely, though, and put it on the back burner. I have just run into that. t/comp/form_scope.t is now failing for me with test 13, added by db4cf31d1. It bisects to 3d6de2cd1 (PERL_PADNAME_MINIMAL), but that’s a red herring. Trivial changes to the script make the problem go away. And it only happens on non- debugging builds, and only on my machine. Stepping through with gdb shows that the format-cloning is following the format prototype’s out- side pointer and confirming that it is has the correct pad (yes, the memory addresses are the same), which I know it doesn’t, because I can see what the test is doing. While generation numbers can still fall afoul of the same problem, it is much less likely. Anyway, the worst thing about 8771da69 is the typo in the first word of the commit message.
* Add ‘immortal’ pad name intrp varsFather Chrysostomos2014-11-301-0/+2
| | | | | These will replace the current use of &PL_sv_undef and &PL_sv_no as pad names.
* Make encoding pragma lexical in scopeKarl Williamson2014-11-201-1/+2
| | | | | | | | | | | | | | | | | | | | The encoding pragma is deprecated, but in the meantime it causes spooky action at a distance with other modules that it may be combined with. In these modules, operations such as chr(), ord(), and utf8::upgrade() will suddenly start doing the wrong thing. The documentation for 'encoding' has said to call it after loading other modules, but this may be impractical. This is especially bad with anything that auto-loads at first use, like \N{} does now for charnames. There is an issue with combining this with setting the variable ${^ENCODING} directly. The potential for conflicts has always been there, and remains. This commit introduces a shadow hidden variable, subservient to ${^ENCODING} (to preserve backwards compatibility) that has lexical scope validity. The pod for 'encoding' has been revamped to be more concise, clear, use more idiomatic English, and to speak from a modern perspective.
* Bump the perl version in various places for 5.21.7Chris 'BinGOs' Williams2014-11-211-2/+2
|
* add filename handling to xs handshakeDaniel Dragan2014-11-131-0/+1
| | | | | | | | | | | | | | | | | | | | | - this improves the error message on ABI incompatibility, per [perl #123136] - reduce the number of gv_fetchfile calls in newXS over registering many XSUBs - "v" was not stripped from PERL_API_VERSION_STRING since string "vX.XX.X\0", a typical version number is 8 bytes long, and aligned to 4/8 by most compilers in an image. A double digit maint release is extremely unlikely. - newXS_deffile saves on machine code in bootstrap functions by not passing arg filename - move newXS to where the rest of the newXS*()s live - move the "no address" panic closer to the start to get it out of the way sooner flow wise (it nothing to do with var gv or cv) - move CvANON_on to not check var name twice - change die message to use %p, more efficient on 32 ptr/64 IV platforms see ML post "about commit "util.c: fix comiler warnings"" - vars cv/xs_spp (stack pointer pointer)/xs_interp exist for inspection by a C debugger in an unoptimized build
* remove obsolete PL_apiversionDaniel Dragan2014-11-071-1/+0
| | | | | Commit 0e42d607f5 made PL_apiversion unused. Remove it to save memory in interp struct.
* Bump the perl version in various places for 5.21.6Abigail2014-10-201-2/+2
|
* [perl #122445] use magic on $DB::single etc to avoid overload issuesTony Cook2014-10-091-0/+2
| | | | | | | | | This prevents perl recursing infinitely when an overloaded object is assigned to $DB::single, $DB::trace or $DB::signal This is done by referencing their values as IVs instead of as SVs in dbstate, and by adding magic to those variables so that assignments to the scalars update the PL_DBcontrol array.
* Bump version to 5.21.5Steve Hay2014-09-201-2/+2
|
* Skip no-common-vars optimisation for aliasesFather Chrysostomos2014-09-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ‘no common vars’ optimisation allows perl to copy the values straight from the rhs to the lhs in a list assignment. In ($a,$b) = ($c,$d), that means $c gets assigned to $a, then $d to $b. If the same variable occurs on both sides of the expression (($a,$b)=($b,$a)), then it is necessary to make temporary copies of the variables on the rhs, before assigning them to the left. If some variables have been aliased to others, then the common vars detection can be fooled: *x = *y; $x = 3; ($x, $z) = (1, $y); That assigns 1 to $x, and then goes to assign $y to $z, but $y is the same as $x, which has just been clobbered. So 1 gets assigned instead of 3. This commit solves this by recording in each typeglob whether the sca- lar is an alias of a scalar from elsewhere. If such a glob is encountered, then the entire expression is ‘tainted’ such that list assignments will assume there might be common vars.
* Allow for changing size of bracketed regex char classKarl Williamson2014-09-031-0/+1
| | | | | | | | This commit allows Perl to be compiled with a bitmap size that is larger than 256. This bitmap is used to directly look up whether a character matches or not, without having to do a binary search or hash lookup. It might improve the performance for some installations that have a lot of use of scripts that are above the Latin1 range.
* Split PL_padix into two variablesFather Chrysostomos2014-08-281-0/+1
| | | | | | | | | | | | | | | | | | | | | PL_padix keeps track of the position in the pad when pad_alloc has to start scanning for an available slot. The availability of a slot is determined differently for targets (which may reuse slots that are already targets from previous state- ments, at least when pad_reset is enabled) and constants (which may not reuse targets). Having the same index for both may require scanning the entire pad for allocating a constant or GV. t/re/uniprops.t was running far too slowly under USE_BROKEN_PAD_RESET because of this. pad_reset would reset PL_padix to point to the beginning of a pad with a few hundred thousand entries. pad_alloc would then have to scan the entire pad before adding a GV to the end. It is still too slow, even with this commit, but for other reasons. (This is just a partial fix.)
* intrpvar.h: Correct commentFather Chrysostomos2014-08-281-1/+2
| | | | | | | This description has been a little faulty for quite some time, not just because of the last few commits. Any time pad_free or pad_swipe is called, that pad slot becomes available and PL_padix is reset. So ‘max used’ is not accurate.
* Bump version number from 5.21.3 to 5.21.4Peter Martini2014-08-211-2/+2
|
* Bump version number from 5.21.2 to 5.21.3Abigail2014-07-201-2/+2
|
* Bump the perl version in various places for 5.21.2Matthew Horsfall (alh)2014-06-201-2/+2
|