summaryrefslogtreecommitdiff
path: root/dist/Safe
Commit message (Collapse)AuthorAgeFilesLines
* dist/Safe/t/safeutf8.t: Fix to work on early PerlsKarl Williamson2015-03-131-1/+6
| | | | | | 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.
* dist/Safe/t/safeutf8.t: Generalize to non-ASCII platformKarl Williamson2015-03-091-1/+1
|
* Corrections to spelling and grammatical errors.Lajos Veres2015-01-291-1/+1
| | | | | | | | | 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
* Revert "Corrections to spelling and grammatical errors."James E Keenan2015-01-291-1/+1
| | | | | | | | | | | | | 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.
* Corrections to spelling and grammatical errors.Lajos Veres2015-01-281-1/+1
| | | | Extracted from patch submitted by Lajos Veres in RT #123693.
* Correct perl ver in Safe ChangesFather Chrysostomos2015-01-111-1/+1
|
* Increase $Safe::VERSION to 2.39Father Chrysostomos2014-12-211-1/+1
|
* Safe Changes updateFather Chrysostomos2014-12-211-0/+4
|
* Propagate context properly in Safe->revalFather Chrysostomos2014-12-212-1/+14
| | | | | | | | (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.
* Add OP_MULTIDEREFDavid Mitchell2014-12-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* remove vestigal threadsv/threadsv_namedDavid Mitchell2014-09-191-1/+0
| | | | | | 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.
* Regenerate local Safe MANIFESTRafael Garcia-Suarez2014-08-051-3/+4
|
* Fix MANIFEST and Safe's changelogRafael Garcia-Suarez2014-08-052-3/+9
|
* Critical bugfix in module Safe (Opcode). Version increased, changelog and ↵syber2014-08-053-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | 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();
* Increase $Safe::VERSION to 2.37Father Chrysostomos2013-06-221-1/+1
|
* Fixed verbatim lines in POD over 79 charactersBrian Gottreu2013-06-221-1/+1
|
* fix various podcheck nitsDavid Golden2013-05-231-4/+2
|
* Make smartmatch, given & when experimentalBrian Fraser2013-03-261-1/+1
|
* Upgrade to Safe 2.35 from CPANRafael Garcia-Suarez2013-02-213-3/+16
|
* use non-dev version for SafeRicardo Signes2013-01-171-1/+1
|
* Test bug #111462, Safe + %^H + disallowed opsFather Chrysostomos2012-06-291-1/+11
|
* Updated Safe to CPAN release 2.33Chris 'BinGOs' Williams2012-06-176-20/+71
| | | | | | | | | | [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
* Decrease $Safe::VERSION to 2.31_01Father Chrysostomos2012-04-031-1/+1
| | | | | | 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.
* [perl #111462] Move strict hints from %^H to $^HFather Chrysostomos2012-04-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Safe.pm: Don’t eval code under ‘no strict’Father Chrysostomos2012-03-313-5/+26
| | | | | | | | | | 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.
* Convert safeops.t to test.plFather Chrysostomos2012-03-311-2/+5
| | | | | | 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.
* Increase $Safe::VERSION to 2.32Father Chrysostomos2012-03-311-1/+1
|
* Safe.pm: Make sure SWASHNEW is properly loadedKarl Williamson2012-01-202-5/+9
| | | | | | | | 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.
* Upgrade to Safe 2.30Rafael Garcia-Suarez2011-12-065-12/+39
| | | | | [rt.cpan.org #72872] Fix bad interaction with loading Tie::Hash::NamedCapture on perls >= 5.14.0
* Convert Safe's remaining hold out tests to Test::MoreNicholas Clark2011-01-252-58/+52
|
* Extract the opcode data from regen/opcode.pl into regen/opcodesNicholas Clark2011-01-091-4/+1
| | | | | Whilst it is possible to open regen/opcode.pl and parse it to find the __END__ token, it's not the cleanest approach.
* Fix typos (spelling errors) in dist/*Peter J. Acklam) (via RT2011-01-073-5/+5
| | | | | | | | | # 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>
* Bump Safe's version to 2.29Rafael Garcia-Suarez2010-10-313-3/+6
|
* Add &version::vxs::VCMP to Safe's default shareRafael Garcia-Suarez2010-10-311-0/+1
| | | | This is to accomodate this new function in version.pm 0.85.
* Move regen scripts to regen/Steffen Mueller2010-10-101-1/+1
| | | | | Moves the various scripts that are called by regen.pl to a subdirectory to reduce clutter.
* Bump Safe's VERSION to 2.28Rafael Garcia-Suarez2010-09-133-3/+7
|
* Avoid infinite loop in _find_code_refs.Rafael Garcia-Suarez2010-09-132-2/+17
| | | | Patch by Yasushi Nakajima (rt.cpan.org #61262)
* die() no longer propagates outside of a Safe compartmentRafael Garcia-Suarez2010-05-041-0/+1
| | | | | so mark the test for that as a TODO. We'll decide later what behaviour is desirable here. Note that it warns instead.
* Bump Safe's version to 2.27 and update Changes and META.ymlRafael Garcia-Suarez2010-04-293-11/+23
|
* Mention that Safe::reval() no wraps returned coderefsRafael Garcia-Suarez2010-04-291-3/+3
|
* Revert "Un-TODO warning test"Rafael Garcia-Suarez2010-04-291-0/+1
| | | | This reverts commit efbe327085cc15510d8c261772e9ac21be3635de.
* Wrap by default coderefs returned by rdo and revalRafael Garcia-Suarez2010-04-292-7/+3
| | | | (suggested by Tim Bunce)
* Add &version::vxs::stringify to the default shareRafael Garcia-Suarez2010-04-291-0/+1
|
* Bump version to 2.26Rafael Garcia-Suarez2010-03-093-2/+5
|
* More backwards-compatible way to force loading of SWASHNEW in SafeRafael Garcia-Suarez2010-03-092-3/+3
|
* B::sub_generation is not available for perls < 5.8.9Rafael Garcia-Suarez2010-03-081-1/+12
|
* Bump Safe to version 2.25Rafael Garcia-Suarez2010-03-073-2/+5
|
* Further improvements to the security fix in ↵Nick Cleaton2010-03-071-7/+8
| | | | | | | | | | 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::"
* Bump version to 2.24 and update ChangesRafael Garcia-Suarez2010-03-063-2/+9
|
* Clean the stashes from the Safe compartment after evaluation of code.Rafael Garcia-Suarez2010-03-061-2/+28
| | | | | | 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.