summaryrefslogtreecommitdiff
path: root/perlvars.h
Commit message (Collapse)AuthorAgeFilesLines
* The size of PL_hash_seed depends on the chosen hash algorithm.Nicholas Clark2012-11-231-1/+1
| | | | For most 8 is fine, but SipHash needs 16.
* Hash Function Change - Murmur hash and true per process hash seedYves Orton2012-11-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does the following: *) Introduces multiple new hash functions to choose from at build time. This includes Murmur-32, SDBM, DJB2, SipHash, SuperFast, and One-at-a-time. Currently this is handled by muning hv.h. Configure support hopefully to follow. *) Changes the default hash to Murmur hash which is faster than the old default One-at-a-time. *) Rips out the old HvREHASH mechanism and replaces it with a per-process random hash seed. *) Changes the old PL_hash_seed from an interpreter value to a global variable. This means it does not have to be copied during interpreter setup or cloning. *) Changes the format of the PERL_HASH_SEED variable to a hex string so that hash seeds longer than fit in an integer are possible. *) Changes the return of Hash::Util::hash_seed() from a number to a string. This is to accomodate hash functions which have more bits than can be fit in an integer. *) Adds new functions to Hash::Util to improve introspection of hashes -) hash_value() - returns an integer hash value for a given string. -) bucket_info() - returns basic hash bucket utilization info -) bucket_stats() - returns more hash bucket utilization info -) bucket_array() - which keys are in which buckets in a hash More details on the new hash functions can be found below: Murmur Hash: (v3) from google, see http://code.google.com/p/smhasher/wiki/MurmurHash3 Superfast Hash: From Paul Hsieh. http://www.azillionmonkeys.com/qed/hash.html DJB2: a hash function from Daniel Bernstein http://www.cse.yorku.ca/~oz/hash.html SDBM: a hash function sdbm. http://www.cse.yorku.ca/~oz/hash.html SipHash: by Jean-Philippe Aumasson and Daniel J. Bernstein. https://www.131002.net/siphash/ They have all be converted into Perl's ugly macro format. I have not done any rigorous testing to make sure this conversion is correct. They seem to function as expected however. All of them use the random hash seed. You can force the use of a given function by defining one of PERL_HASH_FUNC_MURMUR PERL_HASH_FUNC_SUPERFAST PERL_HASH_FUNC_DJB2 PERL_HASH_FUNC_SDBM PERL_HASH_FUNC_ONE_AT_A_TIME Setting the environment variable PERL_HASH_SEED_DEBUG to 1 will make perl output the current seed (changed to hex) and the hash function it has been built with. Setting the environment variable PERL_HASH_SEED to a hex value will cause that value to be used at the seed. Any missing bits of the seed will be set to 0. The bits are filled in from left to right, not the traditional right to left so setting it to FE results in a seed value of "FE000000" not "000000FE". Note that we do the hash seed initialization in perl_construct(). Doing it via perl_alloc() (via init_tls) causes problems under threaded builds as the buffers used for reentrant srand48 functions are not allocated. See also the p5p mail "Hash improvements blocker: portable random code that doesnt depend on a functional interpreter", Message-ID: <CANgJU+X+wNayjsNOpKRqYHnEy_+B9UH_2irRA5O3ZmcYGAAZFQ@mail.gmail.com>
* add wrap_op_checker() API functionZefram2012-02-111-0/+40
| | | | | This function provides a convenient and thread-safe way for modules to hook op checking.
* Simplify embedvar.h, removing a level of macro indirection for PL_* variables.Nicholas Clark2011-08-111-33/+35
| | | | | | | For the default (non-multiplicity) configuration, PERLVAR*() macros now directly expand their arguments to tokens such as C<PL_defgv>, instead of expanding to C<PL_Idefgv>. This removes over 350 lines from F<embedvar.h>, which defined macros to map from C<PL_Idefgv> to C<PL_defgv> and so forth.
* Re-order perlvars.h to group related variables, and spread mutexes out.Nicholas Clark2011-06-121-45/+41
| | | | | | Move variables smaller than pointers into groups, to avoid holes in the structure for PERL_GLOBAL_STRUCT. Spreading the mutexes out tries to keep them off the same cache lines, which may help slightly on multi-processor machines.
* PL_perlio_mutex is only needed with USE_UIHREADS && USE_PERLIONicholas Clark2011-06-121-1/+1
| | | | (Not that Configure will let you configure with ithreads but without perlio)
* Change PL_use_safe_putenv from int to bool.Nicholas Clark2011-06-121-1/+1
| | | | | It is only ever checked for truth/falsehood, and all assignments to it (in core and on CPAN) are either 0 or 1.
* Move PL_runops_{std,dbg} to perl.h, and make them const.Nicholas Clark2011-06-121-6/+0
| | | | | They exist solely to ensure that Perl_runops_standard and Perl_runops_debug are linked in - nothing assigns to either variable, and nothing reads them.
* Move PL_global_struct_size, PL_interp_size{,_5_16_0} to perl.hNicholas Clark2011-06-121-18/+0
| | | | Make them const U16 - they should have been const from the start.
* In perlvar.h, move the always-present globals above those conditionally compiledNicholas Clark2011-06-121-2/+2
| | | | | Rename PL_interp_size_5_10_0 to PL_interp_size_5_16_0, as it is only intended to track interpreter size within (forwards) binary compatible maintenance branches.
* Move PL_{revision,version,subversion} to perl.h, making them const U8.Nicholas Clark2011-06-121-9/+0
| | | | | To get the initialisation to work, the location of #include patchlevel.h needs to be moved.
* Move PL_sh_path to perl.h (except for OS/2), as it's const char[]Nicholas Clark2011-06-121-5/+1
| | | | | | | | On OS/2, keep it in perlvars.h, as it's not const there. makedef.pl doesn't pay attention to C pre-processor symbols, so it will always see the declaration in perlvars.h, and add the symbol to the linker file, so no need to mention sh_path in globvar.sym. Add special case logic in regen/embed.pl to make the embedvar.h macros for PL_sh_path defined only on OS/2.
* Move PL_{No,Yes,hexdigit} from perlvars.h to perl.h, as all are const char[]Nicholas Clark2011-06-121-6/+0
| | | | | | | | | | | They were converted in perl.h from const char[] to #define in 31fb120917c4f65d, then re-instated as const char[], but in perlvars.h, in 3fe35a814d0a98f4. There's no need for compile-time constants to jump through the hoops of perlvars.h, even for Symbian, as the various "EXTCONST" variables already in perl.h demonstrate. These were the only 3 users of the the PERLVARISC macro, so eliminate that, and all related code.
* Eliminate PL_patleave, unused since perl 5.0 alpha 2.Nicholas Clark2011-06-121-1/+0
| | | | | | | patleave was added in perl 3.0 patch #35 patch #29 -- 395c379347344a50, used in scanpat(). scanpat() was refactored and renamed to scan_pat() in 5.0 alpha 2, "commented" out with the C pre-processor in 5.000, and removed in 5.001.
* Restore building with -DPERL_GLOBAL_STRUCT, broken since 4dc941f7cb795735.Nicholas Clark2011-05-221-1/+0
| | | | | | | | | As PL_charclass is a constant, it doesn't need to be accessed via the global struct. It should be exported via globvar.sym, not PERLVARA() in perlvars.h [With a PERVARA() it all compiles perfectly, once C<dVAR>s are added where now needed, but the build loops forever because the (real) charclass array is never initialised]
* RT #76248: double-freed SV with nested sig-handlerDavid Mitchell2010-11-011-4/+0
| | | | | | | | | | | | | | | | | | | There was some buggy code in Perl_sighandler() related to getting an SV with the signal name to pass to the perl-level handler function. ` Basically: on threaded builds, a sig handler that died leaked PL_psig_name[sig]; on unthreaded builds, in a recursive handler that died, PL_sig_sv was prematurely freed. PL_sig_sv was originally just a file static var that was not recursion-save anyway, and got promoted to perlvars.h when it should instead have been done away with. So I've got rid of it now, and rationalised the code, which fixed the two issues listed above. Also added an assert which makes the dodgy manual popping of the save stack slightly less dodgy.
* embed.pl -> regen/embed.plFather Chrysostomos2010-10-131-1/+1
| | | | so newcomers can find it more easily
* Remove MEMBER_TO_FPTR.Ben Morrow2010-10-061-3/+3
| | | | This is left over from PERL_OBJECT (see beeff2, 16c915, and so on).
* make PL_charclass available to modules under Win32Tony Cook2010-09-261-0/+1
|
* Fix a typo in the PL_keyword_plugin docsFlorian Ragwitz2010-08-281-1/+1
|
* lexer APIZefram2009-11-151-8/+1
| | | | | | | | | Attached is a patch that adds a public API for the lowest layers of lexing. This is meant to provide a solid foundation for the parsing that Devel::Declare and similar modules do, and it complements the pluggable keyword mechanism. The API consists of some existing variables combined with some new functions, all marked as experimental (which making them public certainly is).
* Implement facility to plug in syntax triggered by keywordsJesse Vincent2009-11-051-3/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Date: Tue, 27 Oct 2009 01:29:40 +0000 From: Zefram <zefram@fysh.org> To: perl5-porters@perl.org Subject: bareword sub lookups Attached is a patch that changes how the tokeniser looks up subroutines, when they're referenced by a bareword, for prototype and const-sub purposes. Formerly, it has looked up bareword subs directly in the package, which is contrary to the way the generated op tree looks up the sub, via an rv2cv op. The patch makes the tokeniser generate the rv2cv op earlier, and dig around in that. The motivation for this is to allow modules to hook the rv2cv op creation, to affect the name->subroutine lookup process. Currently, such hooking affects op execution as intended, but everything goes wrong with a bareword ref where the tokeniser looks at some unrelated CV, or a blank space, in the package. With the patch in place, an rv2cv hook correctly affects the tokeniser and therefore the prototype-based aspects of parsing. The patch also changes ck_subr (which applies the argument context and checking parts of prototype behaviour) to handle subs referenced by an RV const op inside the rv2cv, where formerly it would only handle a gv op inside the rv2cv. This is to support the most likely kind of modified rv2cv op. [This commit includes the Makefile.PL for XS-APITest-KeywordRPN missing from the original patch, as well as updates to perldiag.pod and a MANIFEST sort]
* Following 32238, change "interpreter_size" to "interp_size" in the new Craig A. Berry2007-11-111-2/+2
| | | | | | global symbols to keep overall symbol length within 31 characters, which is what the VMS C compiler with default flags can handle. p4raw-id: //depot/perl@32275
* "Bake" the values of PERL_REVISION, PERL_VERSION and PERL_SUBVERSIONNicholas Clark2007-11-071-0/+26
| | | | | | | | | | | into global variables (and hence a shared perl library). Additionally under MULTIPLICITY record the size of the interpreter structure (total, and for this version) and under PERL_GLOBAL_STRUCT the size of the global variables structure. Coupled with PL_bincompat_options this will allow 5.10.1 (and later), when compiled with a shared perl library, to perform sanity checks in main() to verify that the shared library is indeed binary compatible. p4raw-id: //depot/perl@32238
* Fix up copyright years for files modified in 2007.Nicholas Clark2007-11-071-1/+1
| | | p4raw-id: //depot/perl@32237
* delete PL_hash_seed_set, PL_lineary; move PL_runops_std/dbgDave Mitchell2007-05-251-0/+6
| | | | | | | the first two aren't used, and the last two are just place holders to ensure that both runops functions get linked in; so make them global rather than per-interpeter p4raw-id: //depot/perl@31280
* delete unused vars PL_av_fetch_sv, PL_hv_fetch_svDave Mitchell2007-05-201-2/+5
| | | | | | and fix 'duplicate symbol' warnings from embed.pl for utf8cache and sh_path p4raw-id: //depot/perl@31246
* extend threads 'veto cleanup' to perl_free and system stuffDave Mitchell2007-01-151-0/+5
| | | p4raw-id: //depot/perl@29827
* OS/2 compilation fixes by IlyaIlya Zakharevich2006-11-281-0/+4
| | | | | | Subject: [PATCH 5.8.8] Build on OS/2 Message-ID: <20061128113629.GA18108@powdermilk.math.berkeley.edu> p4raw-id: //depot/perl@29407
* Enable perlio mutexes under threads (by Jarkko)Rafael Garcia-Suarez2006-10-201-1/+1
| | | p4raw-id: //depot/perl@29065
* More leak fixes, by JarkkoRafael Garcia-Suarez2006-10-201-0/+4
| | | p4raw-id: //depot/perl@29060
* Need to migrate the refcounted_he structure to be properly shared.Nicholas Clark2006-04-111-0/+4
| | | | | | Add a mutex for manipulated their reference counts. Unwrap the structure, so that for ithreads it can store SVs in pads. p4raw-id: //depot/perl@27764
* Change PL_perlio_fd_refcnt from a fixed size static array to a pointerNicholas Clark2006-02-031-1/+2
| | | | | to a dynamic array. p4raw-id: //depot/perl@27059
* Update copyright years (including some years where we made changes butNicholas Clark2006-01-081-1/+2
| | | | | did not update) p4raw-id: //depot/perl@26732
* sprinkle dVARJarkko Hietaniemi2006-01-061-0/+2
| | | | | Message-ID: <43BE7C4D.1010302@gmail.com> p4raw-id: //depot/perl@26675
* re-implement MY_CXT API more efficiently, and add explicitDave Mitchell2005-12-291-0/+5
| | | | | interpeter arg variant p4raw-id: //depot/perl@26523
* Silence some bcc32 compiler warningsSteve Hay2005-06-221-1/+1
| | | | | ("Superfluous & with function") p4raw-id: //depot/perl@24937
* combopatchJarkko Hietaniemi2005-04-251-1/+1
| | | | | Message-ID: <426BFA57.9060105@iki.fi> p4raw-id: //depot/perl@24318
* Symbian port of PerlJarkko Hietaniemi2005-04-211-5/+58
| | | | | Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com> p4raw-id: //depot/perl@24271
* Third consting batchAndy Lester2005-03-241-1/+1
| | | | | Message-Id: <2f14220e7101a03f7659dbe79a03b115@petdance.com> p4raw-id: //depot/perl@24074
* SuSE's perl safe_putenf diffMichael Schroeder2004-11-171-0/+3
| | | | | | | | | Message-ID: <20041111145443.GA1854@immd4.informatik.uni-erlangen.de> slightly reworked to make the PL_use_safe_putenv variable fit in the current framework. This patch turns on the use of safe putenv for any application that embeds a perl interpreter. p4raw-id: //depot/perl@23507
* Apply much of Ilya's microperl patch, but instead ofJarkko Hietaniemi2003-08-121-0/+4
| | | | | | | | | implementing the opendir()/readdir()/closedir() using external commands give up "ANSI-pureness" and define them in uconfig.sh, also define other stuff like rename() and putenv(). Leave out the $| emulation in my_fork() since we are not supposed to have fork() under microperl. p4raw-id: //depot/perl@20646
* Move the csighandler to be a data variable so thatJarkko Hietaniemi2003-08-081-0/+2
| | | | | | | | things like DLL trampolines can't mess up the code variables the Perl_csighandler (seen in Cygwin: Perl_csighandler in POSIX extension was different than in main executable). p4raw-id: //depot/perl@20565
* Make Storable work with blead/maint by making PL_sv_placeholderJarkko Hietaniemi2003-07-281-0/+4
| | | | | | a true global, bump $VERSION to 2.08. Will take a look at the portability issue of placeholders soon. p4raw-id: //depot/perl@20263
* Restore SIGFPE on exec()Chip Salzenberg2003-07-101-0/+4
| | | | | Message-ID: <20030710171319.GA21588@perlsupport.com> p4raw-id: //depot/perl@20117
* Remove PL_earlytaint since the hash seed codeJarkko Hietaniemi2003-07-041-2/+0
| | | | | can be delayed until perl_parse(). p4raw-id: //depot/perl@19979
* Introduce (global) variable PL_earlytaint whichJarkko Hietaniemi2003-06-271-0/+3
| | | | | | | is set very early in main(), before perl_parse() has been called and PL_tainting (or PL_taint_warn) might have been set. p4raw-id: //depot/perl@19863
* More moves to intrpvar.h.Jarkko Hietaniemi2003-05-121-9/+0
| | | p4raw-id: //depot/perl@19499
* Move the thread *hook into interpreter.Jarkko Hietaniemi2003-05-111-6/+0
| | | p4raw-id: //depot/perl@19497
* Fix up Larry's copyright statements to my best knowledge.Jarkko Hietaniemi2003-04-161-1/+1
| | | | | | | (Lots of Perl 5 source code archaeology was involved.) Larry didn't make strangled noises when I showed him the patch, either :-) p4raw-id: //depot/perl@19242