| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
In commit fedc1b0e2d9cec34b7e3b1fa65dd0f7eb4f539fd, I forgot that this
is dual-lifed and may be used on early Perls. This commit allows that,
but it will fail if such a Perl were to be used on an EBCDIC platform.
|
| |
|
|
|
|
|
|
|
|
|
| |
Extracted from patch submitted by Lajos Veres in RT #123693.
This commit applies those patches to files under dist/ *other than* those
pertaining to Tie-File.
Update $VERSION in Dumper.pm and Storable.pm after re-applying patches from RT
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 5bf4b3bf13bc4055684a48448b05920845ef7764.
On p5p-list, Steve Hay wrote on 2015-01-29:
"... these and other changes to Tie-File could break backwards compatibility.
The keys of %opt are passed in from user code, so we can't change the expected
key from "autodefer_threshhold" to "autodefer_threshold" without also asking
users to change their code, which is probably more hassle than it's worth."
Parts of the reverted commit will be re-committed from a new patch.
|
|
|
|
| |
Extracted from patch submitted by Lajos Veres in RT #123693.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(or, rather, in Opcode.xs).
It was providing scalar context when invoked in void context. Test-
ing Safe->reval itself is complicated, because Opcode.xs, which is an
essential part of the fix, is not dual-life.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
the threadsv op and the PL_threadsv_names var were part of the 5.005
threads model, long since removed. Remove some remaining references to
them.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test added.
This example hacks outside environment:
package My::Controller;
use strict;
sub jopa { return "jopa\n"; }
package main;
use Safe;
my $s = new Safe;
my $ok = $s->reval(q{
package My::Controller;
sub jopa { return "hacked\n"; }
My::Controller->jopa();
});
print My::Controller->jopa();
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
[DELTA]
2.33 Tue Apr 3 2012
- Don't eval code under 'no strict' (Father Chrysostomos)
2.32 Sat Mar 31 2012
- Make Safe play nice with Devel::Cover
|
|
|
|
|
|
| |
There has been a release of 2.32 on CPAN with changes that are not in
blead. So what bleadperl has is 2.31 plus a tiny fix that does not
affect older perl versions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With commit b50b20584, strict.pm starting putting hints in %^H to
indicate that strict mode has been enabled or disabled explicitly, so
version declarations should not change the setting.
This causes ‘Unbalanced string table refcount’ warnings when Safe.pm
encounters prohibited ops.
This happens because ops are leaking when those ops point to HEKs (in
the internal form that %^H takes when attached to ops).
This commit moves those new strict hints into $^H, to avoid those
warnings. This does simply paper over the real problem (leaked ops),
but at least it gets the warnings back down to the 5.14 amount.
Because of the new hints in $^H, B::Concise has been updated to
account for them, and so have all its tests. I modified OptreeCheck
to avoid setting the hints with ‘no strict;’, as that resulted in
slightly fewer changes to the tests. It will also result in fewer
changes to the tests in future.
Two B::Deparse tests started failing due to %^H not being localised.
Apparently there is a bug somewhere (in perl, Deparse.pm or deparse.t)
that got triggered as a result. In fact, one of the tests exhibited
*two* bugs. But for now, I’ve simply added a workaround to the two
tests so they don’t trigger those bugs (which bugs will have to wait
till after 5.16).
|
|
|
|
|
|
|
|
|
|
| |
Instead of evaluating code under ‘no strict’, we should be evaluating
it with no pragmata at all by default.
This allows ‘use 5.012’ to enable strictures in reval. It also
has the side effect of suppressing the ‘Unbalanced string table
refcount’ warnings, at least in some cases. This was brought up in
ticket #107000.
|
|
|
|
|
|
| |
For the sake of tests in the next commit, it needs runperl(), which
test.pl provides. Since this script is only run in the perl core, it
should be fine.
|
| |
|
|
|
|
|
|
|
|
| |
This module was depending on testing code points in the upper Latin1
range causing utf8_heavy.pl. However a recent performance improvement
caused those code points to skip the loading. This just changes the
code points to two higher values that cause it to load, and until and if
it changes again, will fix things.
|
|
|
|
|
| |
[rt.cpan.org #72872] Fix bad interaction with loading
Tie::Hash::NamedCapture on perls >= 5.14.0
|
| |
|
|
|
|
|
| |
Whilst it is possible to open regen/opcode.pl and parse it to find the __END__
token, it's not the cleanest approach.
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81888]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81888 >
Signed-off-by: Abigail <abigail@abigail.be>
|
| |
|
|
|
|
| |
This is to accomodate this new function in version.pm 0.85.
|
|
|
|
|
| |
Moves the various scripts that are called by regen.pl to a subdirectory
to reduce clutter.
|
| |
|
|
|
|
| |
Patch by Yasushi Nakajima (rt.cpan.org #61262)
|
|
|
|
|
| |
so mark the test for that as a TODO. We'll decide later what behaviour
is desirable here. Note that it warns instead.
|
| |
|
| |
|
|
|
|
| |
This reverts commit efbe327085cc15510d8c261772e9ac21be3635de.
|
|
|
|
| |
(suggested by Tim Bunce)
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
16ac9e9a4185d3315152ade5286d4dd3d25bff32
- Destroy all stash entries at once to avoid race conditions.
- For that we save away reference to stashes entries (not
stash entries themselves like previously, to avoid trigerring
tie methods)
- Don't skip sub-packages that might be named "main::"
|
| |
|
|
|
|
|
|
| |
This way, objects created from inside the Safe compartment won't be
able to call transparently code compiled in the Safe compartment,
without the restrictions being anymore in place.
|