| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The attached patch bring the core Perl version code (including a fairly
significant leak when run in a tight loop) up to parity with CPAN
0.9902. This deals with all open issues except:
https://rt.cpan.org/Ticket/Display.html?id=81294
which I am having a hard time modeling.
John
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
|
|
|
|
|
|
|
|
|
| |
Replace 2 EXTENDs with 1. Whether the stack is extended by 1 or 2 makes
no signifigant memory difference, so use the large value of 2. Less
machine code is the purpose. This XSUB went from 0x1C2 long to 0x19E for me
after these changes on VC 2003 x86 32bit. The SP and items was moved so
items is tossed a tiny bit sooner by the compiler in case the compiler
tries to save it because it doesn't recogize noreturn declared funcs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
I found these 2 strlens while stepping through the interp while running a
script and both came from a pp_require. UNIVERSAL::can was not modified
since it is more rarely called than pp_require. A better more through
investigation of version obj comparison and upgrading will need to be done
in the future (new funcs needed for the derived/upg_version idiom, remove
the upg_version since it was changed to always be a ver obj, etc).
|
|
|
|
|
|
| |
Add item count checking to Internals::SvREFCNT in case prototype is
bypassed. Getting rid of the undef saves some instructions. Reading
SvREFCNT(sv) only once save an instruction.
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the context/pTHX from Perl_croak_no_modify and Perl_croak_xs_usage.
For croak_no_modify, it now has no parameters (and always has been
no return), and on some compilers will now be optimized to a conditional
jump. For Perl_croak_xs_usage one push asm opcode is removed at the caller.
For both funcs, their footprint in their callers (which probably are hot
code) is smaller, which means a tiny bit more room in the cache. My text
section went from 0xC1A2F to 0xC198F after apply this. Also see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/11/msg195233.html .
|
|
|
|
|
|
|
|
| |
Generally speaking, if there's branching and each branch may contain a
varying number of PUSH operations, EXTENDing to the longest number of
items should generally be more efficient since the stack will eventually
grow to a relatively steady state, but the extra branching incurred by
the X's will cost every time.
|
| |
|
|
|
|
|
|
|
|
| |
Move struct xsub_details details to RO memory from RW memory. This increases
the amount of bytes of the image that can be shared between Perl processes
by the OS. The inverse is each perl process takes less process specific
memory. I saw no change in .text, .rdata went from 0x21121 to 0x21391
(+0x270), .data went from 0x3b18 to 0x38b8 (-0x260). 32 bit Visual C.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It has always ignored set-magic, as far as I can tell.
Since the magic flags patch (4bac9ae47b), it has been ignor-
ing get- magic on magical scalars that were already PVs.
sv_utf8_upgrade_flags_grow begins with an if(!SvPOK(sv)) check, which
used to mean ‘if this scalar is magic or not a string’, but now means
simply ‘if this scalar is not a string’. SvPOK_nog is the new SvPOK.
Due to the way the flags now work, I had to modify sv_pvutf8n_force
as well, to keep existing tests passing.
|
|
|
|
|
| |
Now that gmagical svs use the OK flags the same way as muggles,
things like SvPOK || (SvGMAGICAL && SvPOKp) are no longer necessary.
|
| |
|
|
|
|
|
|
| |
Foo->can("can") should be true even if "package Foo" hasn't been seen
yet (obviously, since that method call doesn't die with a method not
found error).
|
| |
|
|
|
|
|
| |
This updates the editor hints in our files for Emacs and vim to request
that tabs be inserted as spaces.
|
|
|
|
|
|
|
| |
In boot_core_UNIVERSAL, there is no need to increment
PL_amagic_generation to indicate that there are classes using over-
loading. The previous commit removed the only use of it that required
it to be non-zero for overloading to work.
|
|
|
|
| |
by mortalising the temporary SVs.
|
|
|
|
| |
SvPV_force_nolen already calls sv_force_normal for us.
|
|
|
|
|
| |
This has been superseded by c2f1e229, which adds it
to perlsyn.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PerlIO::get_layers should not be ignoring an argument like 12, but
treating "12" (the string) as a filehandle, as those are both the
same value.
It’s an instance of the string/num bug, which is a bit like the
Unicode Bug.
This commit takes the conservative approach of expanding it to flat
scalars in general, but not references (in case we decide to do
something interesting later on, even though I think that would be a
bad idea).
|
| |
|
|
|
|
|
|
|
| |
Explicitly handle all math operations with version objects as noop
instead of letting Perl handle it magically with nomethod.
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following paragraph is in perlguts.pod:
To check if you've got an object derived from a specific class you have
to write:
if (sv_isobject(sv) && sv_derived_from(sv, class)) { ... }
which does the right thing with magical things like tied scalars.
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
|
|
| |
Return the previous behavior where CLASS->VERSION will return a
stringified version object of the contents of $CLASS::VERSION.
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"version" was being treated as a version object and then failing
the validation check. It should be treated as a string, just like
"versions":
$ perl5.15.4 -Ilib -e '$^V < "version"'
Invalid version object at -e line 1.
$ perl5.15.4 -Ilib -e '$^V < "versions"'
Invalid version format (dotted-decimal versions require at least three parts) at -e line 1.
See also perl #102586.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was treating it as a version object and then failing the validation
test, instead of treating it as an invalid version format, as it does
with "versions":
$ ./perl -Ilib -e'$VERSION = "versions"; main->VERSION(1)'
Invalid version format (dotted-decimal versions require at least three parts) at -e line 1.
$ ./perl -Ilib -e'$VERSION = "version"; main->VERSION(1)'
Invalid version object at -e line 1.
See also perl #102586.
|
| |
|
|
|
|
|
|
| |
Previously setting a large (negative in 32-bit signed) reference count
would be returned as a positive number on 64-bit builds and negative
on 32-bit builds.
|
| |
|
|
|
|
| |
This avoids creating a lot of temporary SVs.
|
| |
|
| |
|
| |
|
|
|
|
| |
plus other tweaks
|
|
|
|
|
| |
This adds _sv, _pv, and _pvn forms to sv_does, and changes it to use
sv_ref() instead of sv_reftype().
|
| |
|
|
|
|
|
|
|
| |
This makes them both nul-and-UTF8 clean, although the latter
is somewhat superficial, as mro isn't clean yet.
(Tests coming once ->can and ->DOES are clean)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See the thread starting at:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg175161.html
Instead of assuming that only Perl subs have mallocked CvFILEs and
only under threads, resulting in various hackery to borrow parts of
the SvPVX buffer where that assumption proves wrong, we can simply
add another flag (DYNFILE) to indicate whether CvFILE is mallocked,
instead of trying to use the ISXSUB flag for two purposes.
This simplifies the code greatly, eliminating bug #96126 in the pro-
cess (which had to do with sv_dup not knowing about the hackery that
this commit removes).
I removed that comment from cv_ckproto_len about CONSTSUBs doubling up
the buffer field, as it is no longer relevant. But I still left the
code as it is, since it’s better to do an explicit length check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch:
$ ./miniperl -le ' $VERSION = "3alpha"; print "main"->VERSION'
3alpha
$ ./miniperl -le ' $VERSION = "3alpha"; print "main"->VERSION(4)'
Invalid version format (non-numeric data) at -e line 1.
See the discussion starting at:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/06/msg173710.html
Basically, this patch allows custom version parsers to call ->VERSION
to retrieve the version, even if the default parser would choke on it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(aka: More fun with Hash::Util)
$ perl -lMHash::Util=lock_value
$h{a} = __PACKAGE__; lock_value %h, a; $h{a} = "3"; print $h{a}'
^D
3
OK, so it didn’t really lock it. Now for more fun:
$ perl -lMHash::Util=unlock_value
$h{a} = __PACKAGE__; unlock_value %h, a; $h{a} =~ y/ia/ao/;
print __PACKAGE__
^D
moan
There are three different ways to fix this:
1) Add an SvFAKE function to Internals:: (not *more* ‘internals’ for
people [ahem, Const::Fast, ahem] to abuse!)
2) Use B::* functions in Hash::Util to check the flags (too slow)
3) Make Internals::SvREADONLY less ‘internal’, by having it deal with
readonliness in general, rather than just the SVf_READONLY flag.
The third approach seems the most logical, so that’s what this
commit does.
There is one test in t/op/tr.t that uses Internals::SvREADONLY to
detect bovinity, so I’ve changed it to use B instead, as that will
have no effect on post-install efficiency.
(This approach also fixes Const::Fast’s bugginess, but that is purely
accidental.)
|
|
|
|
|
| |
boolSV returns an immortal. When sv_2mortal is called on
an immortal, it simply returns. So eliminate the call.
|
|
|
|
|
|
| |
I reverted the first version of this patch because I put the if()
statement before a declaration. I did a revert, rather than a correc-
tion, to make back-porting easier.
|
|
|
|
| |
This reverts commit 40f11004fb3b5fa1cd207a20090df837d721b736.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
utf8::decode was not respecting copy-on-write, but simply modify-
ing the PV (the scalar’s string buffer) in place, causing problems
with hashes:
my $name = "\x{c3}\x{b3}";
my ($k1) = keys %{ { $name=>undef } };
my $k2 = $name;
utf8::decode($k1);
utf8::decode($k2);
print "k1 eq k2 = '", $k1 eq $k2, "'\n";
my $h = { $k1 => 1, $k2 => 2 };
print "{k1} '", $h->{$k1}, "'\n";
print "{k2} '", $h->{$k2}, "'\n";
This example (from the RT ticket) shows that there were two hash ele-
ments with the same key.
As of this commit, the hash only has one element.
|
|
|
|
| |
At XS(XS_UNIVERSAL_DOES), invocant is spelled wrong.
|
|
|
|
|
|
|
|
|
| |
This patch changes the core functions to use the common names for the
fields that are shared between op.c and regcomp.c, just for consistency
of using one name throughout the core for the same thing.
A grep of cpan shows that both names are used in various modules; so
both names must be retained.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The /d, /l, and /u regex modifiers are mutually exclusive. This patch
changes the field that stores the character set to use more than one bit
with an enum determining which one. This data structure more
closely follows the semantics of their being mutually exclusive, and
conserves bits as well, and is better expandable.
A small API is added to set and query the bit field.
This patch is not .xs source backwards compatible. A handful of cpan
programs are affected.
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81904]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 >
Signed-off-by: Abigail <abigail@abigail.be>
|