| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
added a few commits ago.
|
|
|
|
|
|
|
|
| |
This was removed in commit eff754733a. It was necessary, as the
feature caused bugs #69456 and #122607.
Advertising the compile-time check with version-dependent qualifi-
cations would make the documentation too verbose.
|
|
|
|
|
| |
It is not possible to reach these without $symtab’s having been
assigned a stash reference.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
See the thread that includes
<20140821044934.29399.qmail@lists-nntp.develooper.com>.
This provides a way for a package to define constants in another pack-
age, without having to resort to *other::const = sub () { $value }.
Now one can write constant->import("other::const" => $value).
Documentation will be added in an upcoming commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was code in op.c:ck_rvconst (which runs when creating a derefer-
ence op, such as rv2sv, rv2av, etc.) that would check that a constant
kid holding a reference pointed to something of the right type. It
failed to take overloading into account.
The result was that these lines would fail to compile:
constant_reference_to_hash_with_coderef_overloading->();
constant_reference_to_sub_with_hashref_overloading->{key};
constant_reference_to_sub_with_arrayref_overloading->[0];
constant_reference_to_sub_with_scalarref_overloading->$*;
even though they should work.
Since the overloadedness could change any time, even checking for that
in op.c is incorrect. The only correct fix is to remove this compile-
time check. If something naughty gets through, it will be caught
at run time.
This fixes bugs #122607 and #69456.
|
| |
|
|
|
|
|
|
|
| |
Some stuff on CPAN is using this undocumented function, so give
constant.pm its own. It is already a core module, depending on
functionality provided by the core solely for its sake; so this
does not really change its relationship to the core.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that Internals::SvREADONLY turns on the PADTMP flag for all the
elements, the read-only flag on the elements themselves will not
actually make the returned elements read-only, because PADTMPs get
copied in all cases where readonliness matters. What this does is
prevent the original SV from being modified, allowing for more opti-
misations in perl’s internals (e.g., string buffers being stolen from
PADTMPs not marked read-only).
The order of the statements needs to be rearranged, otherwise we end
up setting the flag on a temporary copy of each element due to ‘for’.
|
|
|
|
| |
It was inconsistent throughout.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
In commit f99a5f08f203, I inadvertently made modifications to val-
ues return by list ‘constants’ affect what values are returned sub-
sequently.
It’s for this type of situation that PADTMP exists (values are never
referenced, but copied). So use it.
This is similar to 5608dcc62, which fixed #3105.
|
|
|
|
| |
This broke CPAN. Maybe we need to rethink this....
|
|
|
|
|
|
|
| |
I didn’t have this constant stuff ready as soon as I expected. I also
left a comment and a couple of ‘local $TODO’s lying around that don’t
need to be there. As a bonus, correct a typo in constant.pm’s docu-
mentation.
|
|
|
|
|
|
|
|
| |
I also removed ‘some symbols may be redefined without generating a
warning’. I know not to what it refers. It has been there as long as
constant.pm has. If a constant is clobbered by another constant with
the same value, there is no warning, as it is harmless. That may be
to what it refers, but we don’t need a caveat for that.
|
|
|
|
|
|
| |
Here we take advantage of the array-ref-stash-elem mechanism added in
the previous commit, which causes the actual elements of the stored
array to be pushed on to the stack.
|
| |
|
|
|
|
|
|
|
|
| |
under versions that support $::{foo} = \1.
This changes no behaviour. Future commits will change the way
sub(){42} and sub(){$forty_two} work. (The former will return a muta-
ble value; the latter will not be inlined at all.)
|
|
|
|
| |
I didn’t have this done in time for 5.19.1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes bugs #21979, #89188, #109746, #114838 and #115388 and
mostly fixes #109744 and #105906 (other issues still remain in those
two tickets).
Because the PADTMP flag was doing double duty, indicating that a
pad slot was in use in addition to indicating a target, constants
could not be shared between pad slots, as freeing one const op (and
turning of its PADTMP flag in pad_free) would mark some other pad
slot as free.
I believe this may have been fixed already by change 3b1c21fabed,
which made const ops use pad_swipe (which removes the SV from the
pad) instead of pad_free (which marks it as available for reuse). But
the copying still happens.
In any case, as of the previous commit, whether a pad slot for a con-
stant is in use is now stored in the pad name. Slots in use for const
ops now have &PL_sv_no names.
So there is no longer any reason to copy the constants.
The difference can be observed thus:
Before:
$ ./perl -lIlib -MDevel::Peek -e 'sub foo(){42} Dump foo; Dump foo'
SV = IV(0x7f94ea02ef10) at 0x7f94ea02ef20
REFCNT = 2
FLAGS = (PADTMP,IOK,READONLY,pIOK)
IV = 42
SV = IV(0x7f94ea02eeb0) at 0x7f94ea02eec0
REFCNT = 1
FLAGS = (PADTMP,IOK,READONLY,pIOK)
IV = 42
After:
$ ./perl -lIlib -MDevel::Peek -e 'sub foo(){42} Dump foo; Dump foo'
SV = IV(0x7f894882ef10) at 0x7f894882ef20
REFCNT = 3
FLAGS = (IOK,READONLY,pIOK)
IV = 42
SV = IV(0x7f894882ef10) at 0x7f894882ef20
REFCNT = 3
FLAGS = (IOK,READONLY,pIOK)
IV = 42
Notice the different addresses.
There are still special cases for copying &PL_sv_undef, which I need
to tackle.
Since most constants created by ‘use constant’ have the PADMY flag on
(since they reside in lexical variables inside constant.pm) and PADMY
and PADTMP are exclusive, I have stop turning on PADTMP for constants.
It is no longer necessary now, since before its purpose was to mark
pad entries as being in use. That means many to-do tests pass.
|
|
|
|
| |
including many to-do tests
|
|
|
|
|
|
| |
The reason for this change is that the test
that determines when to do this caused the
utf8 module to always be loaded.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch contributed by Sébastien Aperghis-Tramoni
For: RT #114770.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch blead
# Your branch is ahead of 'origin/blead' by 1 commit.
#
# Changes to be committed:
# (use "git reset HEAD^1 <file>..." to unstage)
#
# modified: dist/constant/lib/constant.pm
# modified: dist/constant/t/constant.t
#
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before releasing the version of constant.pm from bleadperl to the CPAN,
I tested it with the versions of Perl I have by hand, and it appears
that the current code fails to compile on 5.8:
Bareword "_DOWNGRADE" not allowed while "strict subs" in use at
lib/constant.pm line 142.
Added by bd8cb5529605f33aa9cf95d6c471386b3a0e015d
Removing the short-circuit return allows the code to compile and the
tests to pass on all stable Perl from 5.8.2 to 5.16.1.
|
| |
|
|
|
|
|
|
| |
The downgrade bug that constant.pm has to imitate is about to be fixed
in the next commit. The bug workaround is itself a bug if the bug it
is trying to work around is not present.
|
|
|
|
| |
This reverts commit d33333ec9850d2a0f2f5466e207dcc612dc4dc31.
|
|
|
|
| |
in preparation for the next commit
|
|
|
|
|
|
|
| |
This reverts commit 53777b0ce48433ad582498a56c60698a8fad29f6.
constant.pm 1.21 has already been released on CPAN. Reverting this for
now just keeps things simple.
|
| |
|
|
|
|
|
|
| |
Because sub lookup (and glob lookup in general) ignores the UTF8
flag, such subs are actually ‘correctly’ stored under the utf8-encoded
equivalent of the name, and not the name itself.
|
|
|
|
|
|
|
|
|
| |
Commit e5c69c9b added the test to dist/constant/t/constant.t, probably because
the bug was initially reported in combination with constant.pm. However, it was
a core bug in gv_init and can be reproduced easily without constant.pm.
With this change dist/constant can be safely synced back to CPAN without having
to SKIP or TODO this particular test.
|
|
|
|
|
|
|
|
|
| |
gv_init() has name and len args, but newCONSTSUB() (which it calls)
doesn't have a len arg, so any trailing garbage in name gets used by
newCONSTSUB.
In the test case, this means that we end up attaching the const CV
to both the "FOO" and qq{FOO, "\\n";\n} GVs. So it gets freed twice.
|
| |
|
|
|