summaryrefslogtreecommitdiff
path: root/dist/constant/t
Commit message (Collapse)AuthorAgeFilesLines
* Don’t let list const modification affect future retvalsFather Chrysostomos2013-08-041-2/+14
| | | | | | | | | | | 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.
* [perl #119045] Make list constant mutable againFather Chrysostomos2013-07-281-0/+1
| | | | This broke CPAN. Maybe we need to rethink this....
* Version number tweaks in tests and other cleanupFather Chrysostomos2013-07-251-7/+4
| | | | | | | 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.
* constant.pm: Make list constants read-onlyFather Chrysostomos2013-07-251-1/+0
| | | | | | 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.
* constant.t: Correct versionFather Chrysostomos2013-07-251-2/+2
| | | | I didn’t have this done in time for 5.19.1.
* op.c: Stop copying constants under ithreadsFather Chrysostomos2013-07-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Test (im)mutability of constants and constant-like subsFather Chrysostomos2013-07-251-1/+62
| | | | including many to-do tests
* Remove checks for Perl 5.6; adjust tests; bump version number.James E Keenan2013-01-181-1/+0
| | | | | | | | | | | | | | | | | | 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 #
* dist/constant/t/utf8.t: Skip tests for early PerlsSébastien Aperghis-Tramoni2012-12-051-1/+7
|
* Make Unicode constants under use utf8 work againFather Chrysostomos2011-04-171-0/+12
| | | | | | 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.
* Move test for #76540 to op/gv.tFlorian Ragwitz2010-09-081-14/+1
| | | | | | | | | 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.
* [perl #76540] "print CONSTANT," gives double-freeDavid Mitchell2010-07-241-1/+14
| | | | | | | | | 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.
* [perl #68640] Wrong error for undef constant nameZefram2009-12-151-1/+7
|
* Move constant from ext/ to dist/Nicholas Clark2009-09-291-0/+343