summaryrefslogtreecommitdiff
path: root/perlapi.h
Commit message (Collapse)AuthorAgeFilesLines
* Hash Function Change - Murmur hash and true per process hash seedYves Orton2012-11-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+2
| | | | | 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-9/+9
| | | | | | | 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.
* Move PL_runops_{std,dbg} to perl.h, and make them const.Nicholas Clark2011-06-121-4/+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-6/+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-6/+0
| | | | | To get the initialisation to work, the location of #include patchlevel.h needs to be moved.
* Move PL_{No,Yes,hexdigit} from perlvars.h to perl.h, as all are const char[]Nicholas Clark2011-06-121-12/+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-2/+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-2/+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]
* Move all the generated file header printing into read_only_top()Nicholas Clark2011-01-231-4/+4
| | | | | | | | | Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
* Generate pp_* prototypes in pp_proto.h, and remove pp.symNicholas Clark2011-01-091-1/+1
| | | | | | | | | | | Eliminate the #define pp_foo Perl_pp_foo(pTHX) macros, and update the 13 locations that relied on them. regen/opcode.pl now generates prototypes for the PP functions directly, into pp_proto.h. It no longer writes pp.sym, and regen/embed.pl no longer reads this, removing the only ordering dependency in the regen scripts. opcode.pl is now responsible for prototypes for pp_* functions. (embed.pl remains responsible for ck_* functions, reading from regen/opcodes)
* RT #76248: double-freed SV with nested sig-handlerDavid Mitchell2010-11-011-2/+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-2/+2
| | | | so newcomers can find it more easily
* make PL_charclass available to modules under Win32Tony Cook2010-09-261-0/+2
|
* Eliminate PL_* accessor functions under ithreads.Nicholas Clark2010-09-211-664/+3
| | | | | | | | | | | | | | | | | | | | | | When MULTIPLICITY was first developed, and interpreter state moved into an interpreter struct, thread and interpreter local PL_* variables were defined as macros that called accessor functions, returning the address of the value, outside of the perl core. The intent was to allow members within the interpreter struct to change size without breaking binary compatibility, so that bug fixes could be merged to a maintenance branch that necessitated such a size change. However, some non-core code defines PERL_CORE, sometimes intentionally to bypass this mechanism for speed reasons, sometimes for other reasons but with the inadvertent side effect of bypassing this mechanism. As some of this code is widespread in production use, the result is that the core *can't* change the size of members of the interpreter struct, as it will break such modules compiled against a previous release on that maintenance branch. The upshot is that this mechanism is redundant, and well-behaved code is penalised by it. Hence it can and should be removed. Accessor functions are still needed for globals when PERL_GLOBAL_STRUCT is defined.
* Remove offer_nice_chunk(), PL_nice_chunk and PL_nice_chunk_size.Nicholas Clark2010-09-081-4/+0
| | | | | | | | | | | | | | | | | | These provided a non-public API for the hash and array code to donate free memory direct to the SV head allocation routines, instead of returning it to the malloc system with free(). I assume that on some older mallocs this could offer significant benefits. However, my benchmarking on a modern malloc couldn't detect any significant effect (positive or negative) on removing the code. Its (continued) presence, however, has downsides a: slightly more code complexity b: slightly larger interpreter structure c: in the steady state, if net creation of SVs is zero, 1 chunk of allocated but unused memory will exist (per thread) So I think it best to remove it.
* make recursive part of peephole optimiser hookableZefram2010-08-261-0/+2
| | | | | | | | New variable PL_rpeepp makes it possible for extensions to hook the per-op-chain part of the peephole optimiser (which recurses into side chains). The existing variable PL_peepp still allows hooking the per-sub part of the peephole optimiser, maintaining perfect backward compatibility.
* Check API compatibility when loading xs modulesFlorian Ragwitz2010-07-261-0/+2
| | | | | | | | | | | | | This adds PL_apiversion, allowing the API version of a running interpreter to be introspected. It is used in the new XS_APIVERSION_BOOTCHECK macro, which is added to the _boot function of every XS module, to compare it against the API version the module has been compiled against. If the versions do not match, an exception is thrown. This doesn't fully prevent binary incompatible extensions to be loaded. It merely compares PERL_API_* between compile- and runtime, and does not attempt to solve the problem of identifying binary incompatible perls with the same API version (i.e. the same perl version configured with and without DEBUGGING).
* Generic hooks into Perl_block_{start,end}.Ben Morrow2010-07-121-0/+2
| | | | | | | | | | These take the form of a vtable pushed onto the new PL_blockhooks array. This could probably do with a API around it later. Separate pre_end and post_end hooks are needed to capture globals before the stack is unwound (like needblockscope in the existing code). The intention is that once a vtable is installed it never gets removed, so where necessary extensions using this will need to use a hinthv element to determine whether to do anything or not.
* add PL_signalhook to hook into signal dispatchDavid Mitchell2010-06-041-0/+2
| | | | | This is initially intended for threads::shared and shouldn't (yet) be considered part of the public API.
* unwinding target nominated by separate globalZefram2010-04-251-0/+2
| | | | | | | | When unwinding due to die, the new global PL_restartjmpenv points to the JMP_ENV at which longjmping should stop and control should be transferred to PL_restartop. This replaces the previous use of cxstack[cxstack_ix+1].blk_eval.cur_top_env, located in a nominally-discarded context frame.
* qr/\X/ expansionKarl Williamson2009-12-051-0/+20
|
* Add ENTER_with_name and LEAVE_with_name to automaticly check for matching ↵Gerard Goossen2009-11-121-0/+2
| | | | ENTER/LEAVE when debugging is enabled
* regen generated files changed by the previous patch - facility to plug in ↵Jesse Vincent2009-11-051-0/+2
| | | | syntax triggered by keywords
* somewhat fix failing regex tests. but break lots of other stuff at the same timeYves Orton2009-10-191-0/+6
|
* Remove obsolete interpreter variable PL_utf8_alnumcRafael Garcia-Suarez2009-09-131-2/+0
|
* Add a pluggable hook in op_free()Vincent Pit2009-07-081-0/+2
|
* Remove binary compatibility scaffolding for the change to PL_bitcount.Nicholas Clark2009-05-201-2/+0
|
* Bump coopyright year in embed.pl and various files that were just touchedRafael Garcia-Suarez2009-01-021-1/+1
| | | | (and run "make regen")
* Add Perl_mro_register() to register Method Resolution Orders,Nicholas Clark2008-12-271-0/+2
| | | | | | Perl_mro_get_from_name() to retrieve MROs by name, and PL_registered_mros to store them in. Abolish the static array of mros, and instead register the dfs and c3 MRO structures.
* Rename PL_breakable_sub_generation to PL_breakable_sub_gen, to pleaseNicholas Clark2008-11-181-2/+2
| | | | | the ANSI gods of VMS. p4raw-id: //depot/perl@34886
* Fix the bug introduced with MRO, whereby the internals were not savingNicholas Clark2008-11-171-0/+2
| | | | | lines in subroutines defined inside eval ""s for the debugger. p4raw-id: //depot/perl@34873
* [perl #948] [PATCH] Allow tied $,Chip Salzenberg2008-11-141-2/+2
| | | | | Message-ID: <20081114084436.GJ5779@tytlal.topaz.cx> p4raw-id: //depot/perl@34831
* Update copyright year in embed.pl, and everything that it builds.Nicholas Clark2008-10-251-1/+1
| | | p4raw-id: //depot/perl@34586
* Run 'make regen' for #34567 and #34568.Marcus Holland-Moritz2008-10-241-0/+2
| | | p4raw-id: //depot/perl@34569
* Remove the -P switchRafael Garcia-Suarez2008-01-111-2/+0
| | | p4raw-id: //depot/perl@32954
* Remove (probably) the last vestige of the assertions implementation -Nicholas Clark2007-11-241-2/+0
| | | | | a now unused variable. p4raw-id: //depot/perl@32477
* Following 32238, change "interpreter_size" to "interp_size" in the new Craig A. Berry2007-11-111-4/+4
| | | | | | 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
* Bug fix for storing shared objects in shared structuresJerry D. Hedden2007-11-081-0/+2
| | | | | | | | From: "Jerry D. Hedden" <jdhedden@cpan.org> Message-ID: <1ff86f510711061136t52a1fe62waf384c4551612181@mail.gmail.com> (core patch only) p4raw-id: //depot/perl@32241
* "Bake" the values of PERL_REVISION, PERL_VERSION and PERL_SUBVERSIONNicholas Clark2007-11-071-0/+12
| | | | | | | | | | | 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
* PL_cshname is actually a constant value known at compile time.Nicholas Clark2007-10-051-4/+0
| | | | | | | PL_cshlen can be calculated by the compiler. So eliminate both as interpreter variables, and the code that calculates PL_cshlen at runtime. p4raw-id: //depot/perl@32035
* Reverse change #31978Rafael Garcia-Suarez2007-10-031-4/+0
| | | | | p4raw-link: @31978 on //depot/perl: d804f4346b490171e547d5cc512063e53da10708 p4raw-id: //depot/perl@32015
* Change 31987 forgot to re-run embed.plNicholas Clark2007-09-281-0/+2
| | | p4raw-id: //depot/perl@31990
* RE: [PATCH] use 5.010 is ugly; use 5.10.0 warnsRobin Barker2007-09-261-0/+2
| | | | | | From: "Robin Barker" <Robin.Barker@npl.co.uk> Message-ID: <2C2E01334A940D4792B3E115F95B7226C9D1C3@exchsvr1.npl.ad.local> p4raw-id: //depot/perl@31978
* Re: optimize push @ISA, (was Re: parent.pm at http://corion.net/perl-dev)Brandon Black2007-08-311-2/+0
| | | | | | From: "Brandon Black" <blblack@gmail.com> Message-ID: <84621a60708121336m13dcf9e5uac624fb246f2a79c@mail.gmail.com> p4raw-id: //depot/perl@31770
* delete PL_hash_seed_set, PL_lineary; move PL_runops_std/dbgDave Mitchell2007-05-251-8/+4
| | | | | | | 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
* move PL_error_count into the PL_parser structDave Mitchell2007-05-211-2/+0
| | | p4raw-id: //depot/perl@31255
* move PL_multi_end into the PL_parser structDave Mitchell2007-05-211-2/+0
| | | p4raw-id: //depot/perl@31254
* move PL_tokenbuf into the PL_parser structDave Mitchell2007-05-211-2/+0
| | | p4raw-id: //depot/perl@31252