| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These stopped working when the CvROOT and CvXSUB fields were merged
in 5.10.0:
$ perl5.8.9 -le 'print sort utf8::is_utf8 2,1'
Usage: utf8::is_utf8(sv) at -e line 1.
$ perl5.10.0 -le 'print sort utf8::is_utf8 2,1'
12
(In the latter case, the utf8::is_utf8 routine is not being called.)
pp_sort has this:
if (!(cv && CvROOT(cv))) {
if (cv && CvISXSUB(cv)) {
But CvROOT is the same as CvXSUB, so that block is never entered for
XSUBs, so this piece of code later on:
if (is_xsub)
PL_sortcop = (OP*)cv;
else
PL_sortcop = CvSTART(cv);
sets PL_sortcop to CvSTART for XSUBs, but CvSTART is NULL. Later on,
this if condition fails:
if (PL_sortcop) {
so the XSUB is treated as being absent.
|
|
|
|
|
|
| |
I added it to an existing block without realising that it was for
a separate package and that the standard convention throughout
APItest.xs is to use a separate BOOT block for every tested feature.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In 5.6.0, XS autoloading worked. $AUTOLOAD would be set, as with
a Perl sub.
Commit ed850460 (5.6.1) allowed ‘sub AUTOLOAD;’ to prevent autoload
inheritance. But the code to check for that mistakenly equated an
XSUB with a forward declaration. So XS autoloading simply did not
work any more.
Then someone found it didn’t work and introduced it as a ‘new’ feature
in 5.8.0, with commit adb5a9ae. For efficiency’s sake, instead of
joining the package name and sub name together, only to have the XSUB
do the same, it set the CvSTASH and SvPVX fields of the SV.
SvPVX was already being used for the sub’s prototype, so 8fa6a409
(just recently) made the autoloaded sub name and the prototype play
along nicely together, with a few fix-up commits (05b525f4, 3d5f9785
and 74ee33f2).
It was only after that that I find out that $AUTOLOAD used to be set
for XSUBs. See the discussion at these two links
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=4E9468E8.8050206@cpan.org
https://rt.perl.org/rt3/Ticket/Display.html?id=72708
This commit restores the original behaviour of setting $AUTOLOAD for
XSUBs, while retaining the CvSTASH+SvPVX method as well, as it has
been documented for a while.
Steffen Müller’s AUTOLOAD tests that I committed recently (120b7a08)
needed to be adjusted a bit. The test count was off, which was my
fault (I *thought* I had checked that.) The test XSUB was using
get_sv("AUTOLOAD"), which ended up fetching the caller’s $AUTOLOAD.
It was also using SvPV_set on an undefined scalar, which does not turn
the SvPOK flag on.
|
|
|
|
|
|
|
|
|
|
| |
If an AUTOLOAD sub is an XSUB, $AUTOLOAD won't be set. This is intended
as an optimization, but $AUTOLOAD *was* set back in 5.6.0, so this is
a regression.
Committer’s note: I modified the commit message and the comments, as
the original author did not know about the autoload mechanism setting
CvSTASH. For that matter, neither did I till yesterday.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The SvPVX slot of a CV is used both for the prototype and for the sub
name passed to an XS AUTOLOAD sub.
It used to be that such AUTOLOADing would clobber the prototype.
Commit 8fa6a4095 made the two uses of SvPVX try to play along nicely
with each other, so the prototype comes after the sub name if both
need to be present. It added the CvPROTO macro to account for that.
Some CPAN modules expect to be able to set the prototype with
sv_set[ps]v. So this commit makes that work as expected, by turn-
ing off the flag that says the prototype comes after the auto-
loaded sub name.
Anyone using Scalar::Util::set_prototype to work around the proto-
type-clobbering bug can now continue to do so, without triggering
a new bug.
|
|
|
|
|
|
| |
I meant to call this mro ‘just @ISA’, because it just uses @ISA and
no super-superclasses. But I misnamed it. It has nothing to do
with @INC.
|
| |
|
|
|
|
|
|
| |
The T_AVREF_REFCOUNT_FIXED and T_HVREF_REFCOUNT_FIXED can be used
in place of T_AVREF/T_HVREF. They do away with having to remember
to decrement refcounts manually.
|
|
|
|
|
|
|
|
|
|
| |
Perl has assumed up till now that the first element of an isa linear-
isation is the name of the class itself. That is true for dfs and c3,
but not requiring that makes it easier for plugin authors.
Since various parts of the mro code make that assumption, this commit
copies the AV returned by mro_alg.resolve to a new one beginning with
the class’s own name, if the original AV did not include it.
|
|
|
|
|
|
|
|
|
|
| |
The SvPVX field of a XS AUTOLOAD sub can contain both the prototype
and the name of an AUTOLOADed sub. The CvPROTO macro knows where in
the buffer to find the prototype. All code that reads the prototype
should use it. When I introduced it with commit 8fa6a4095, one code
path was missed: *regular_prototyped_sub = \&prototyped_XS_AUTOLOAD
was using the sub name of the rhs, instead of the prototype, in the
prototype check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Did you know that a subroutine’s prototype can be modified with s///?
Don’t look:
*AUTOLOAD = *Internals'SvREFCNT;
my $f = "Just another "; eval{main->$f};
print prototype AUTOLOAD;
$f =~ s/Just another /Perl hacker,\n/;
print prototype AUTOLOAD;
You did look, didn’t you? You must admit that’s creepy.
The problem goes back to this:
commit adb5a9ae91a0bed93d396bb0abda99831f9e2e6f
Author: Doug MacEachern <dougm@covalent.net>
Date: Sat Jan 6 01:30:05 2001 -0800
[patch] xsub AUTOLOAD fix/optimization
Message-ID: <Pine.LNX.4.10.10101060924280.24460-100000@mojo.covalent.net>
Allow AUTOLOAD to be an xsub and allow such xsubs
to avoid use of $AUTOLOAD.
p4raw-id: //depot/perl@8362
which includes this:
+ if (CvXSUB(cv)) {
+ /* rather than lookup/init $AUTOLOAD here
+ * only to have the XSUB do another lookup for $AUTOLOAD
+ * and split that value on the last '::',
+ * pass along the same data via some unused fields in the CV
+ */
+ CvSTASH(cv) = stash;
+ SvPVX(cv) = (char *)name; /* cast to loose constness warning */
+ SvCUR(cv) = len;
+ return gv;
+ }
That ‘unused’ field is not unused. It’s where the prototype is
stored. So, not only is it clobbering the prototype, it’s also leak-
ing it by assigning over the top of SvPVX. Furthermore, it’s blindly
assigning someone else’s string, which could be freed before it’s
even used.
Since it has been documented for a long time that SvPVX contains the
name of the AUTOLOADed sub, and since the use of SvPVX for prototypes
is documented nowhere, we have to preserve the former.
So this commit makes the prototype and the sub name share the same
buffer, in a manner resembling that which CvFILE used before I changed
it with bad4ae38.
There are two new internal macros, CvPROTO and CvPROTOLEN for retriev-
ing the prototype.
|
| |
|
| |
|
|
|
|
| |
in view of 2e3468793982.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This adds _pv, _pvn, and _pv versions of whichsig() in mg.c, which
get both kill "NAME" and %SIG lookup nul-clean.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit introduced some code that concatenates a pv on to
an sv and then does SvUTF8_on on the sv if the pv was utf8.
That can’t work if the sv was in Latin-1 (or single-byte) encoding
and contained extra-ASCII characters. Nor can it work if bytes are
appended to a utf8 sv. Both produce mangled utf8.
There is apparently no function apart from sv_catsv that handle
this. So I’ve modified sv_catpvn_flags to handle this if passed the
SV_CATUTF8 (concatenating a utf8 pv) or SV_CATBYTES (cancatenating a
byte pv) flag.
This avoids the overhead of creating a new sv (in fact, sv_catsv
even copies its rhs in some cases, so that would mean creating two
new svs). It might even be worthwhile to redefine sv_catsv in terms
of this....
|
|
|
|
|
|
|
|
|
|
|
| |
This patch also duplicates existing mro tests with copies that use
Unicode in identifiers, to test the mro code.
Since those tests trigger it, it also fixes a bug in the parsing
of *{...}: If the first character inside the braces is a non-ASCII
Unicode identifier character, the inside is now implicitly quoted
if it is just an identifier (just as it is with ASCII identifiers),
instead of being parsed as a bareword that would violate strict subs.
|
| |
|
|
|
|
| |
As with the previous commit, no Perl-level visible changes.
|
|
|
|
|
|
|
| |
Since gv_fetchmeth_pvn is primarily used from within gv.c,
and not much of anything is passing in the flag yet, this has
no visible changes on the Perl level; So tests remain
entirely in XS::APItest for the time being.
|
|
|
|
| |
This also uncomments the UTF-8 tests in XS::APItest.
|
|
|
|
|
|
|
|
| |
newXS was merged into newXS_flags; added a line in the docs
recommeding using that instead.
newCONSTSUB got a _flags version, which generates the CV in
the right glob if passed the UTF-8 flag.
|
|
|
|
|
| |
Since multi is a boolean (even though it’s typed as an int), there is
no need to have a separate parameter. We can just use a flag bit.
|
|
|
|
|
|
|
|
|
| |
Now that a glob can be initialized and fetched in UTF-8,
the next commit will introduce some changes in toke.c to
actually test this.
Committer’s note: To keep tests passing I had to incorporate
the toke.c:S_pending_ident changes in the same patch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
passed the UTF8 flag.
newCONSTSUB is still unclean however, so constant subs are
still generated under a wrong name.
gv_fullname4 is also UTF-8 aware now; While that should've gotten
it's own commit and tests, it's not possible to test the
UTF-8 part without the gv_init changes, and it's not possible
to test the gv_init changes without gv_fullname4.
Chicken and egg, as it were. So let's compromise and
wait for the relevant tests once globs can be intiialized as
UTF-8 from the Perl level without XS magic.
|
|
|
|
|
|
|
|
| |
method is a boolean flag (typed I32, but used as a boolean) added by
commit 54310121b442.
These new gv_autoload_* functions have a flags parameter, so there’s
no reason for this extra effective bool. We can just use a flag bit.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 4 was added in commit 54310121b442 (inseparable changes during
5.003/4 developement), presumably the ‘Don't look up &AUTOLOAD in @ISA
when calling plain function’ part.
Before that, gv_autoload had three arguments, so the 4 indicated the
new version (with the method argument).
Since these new functions don’t all have four arguments, and since
they have a new naming convention, there is not reason for the 4.
|
| |
|
|
|
|
|
|
| |
In addition from taking a flags parameter, it also takes the
length of the method; This will eventually make method
lookup nul-clean.
|
|
|
|
| |
It was not doing the sanity check for all three functions.
|
| |
|
|
|
|
|
| |
It wasn’t doing the XS::APItest::gv_fetchmeth_type sanity check for
all three gv_fetchmeth* functions.
|
|
|
|
|
| |
I'm probably pushing this too early. Can't do the
Perl-level tests because of that. TODO.
|
|
|
|
|
|
|
|
|
| |
gv_init_pvn() is the same as the old gv_init(), but takes
a flags parameter, which will be used for the UTF-8 cleanup.
The old gv_init() is now implemeneted as a macro in gv.h.
Also included is some minimal testing in XS::APItest.
|
|
|
|
|
|
| |
With 5.15.2 and the new xubpp, DynaLoader symbols were XS_INTERNAL, before
they were effectively XS_EXTERNAL. This broke B::C and possibly other
embedded apps which link to DynaLoader functions.
|
|
|
|
|
|
|
|
|
|
|
| |
Commit fa22ee54 changed some of the POSIX error messages to be more
consistent, but in doing so made many of them grammatically incorrect.
It is almost always incorrect in English to join two independent
clauses with a comma.
I don’t think it’s particularly important that error messages be gram-
matical; I just don’t want them getting worse over time. Hence, I
have not touched those that were already ungrammatical.
|
|
|
|
| |
Even though the underlying error is RMS$_DNF. Go figure.
|
|
|
|
|
| |
This new script tests that goto &xsub causes the sub to see the hints,
not of the subroutine it replaces, but of that subroutine’s caller.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Avoid list assignment to %ENV, which fails at compile time on VMS.
- Use consistent indentation for readability.
- Mark bsd_glob('~') tests TODO on VMS. The HOME path is successfully
retrieved, but it normally contains square brackets, which confuse
glob, because it thinks the directory portion of the path contained
within brackets is a pattern. The path probably needs to be
converted to Unix syntax first.
|
|
|
|
|
|
|
|
| |
0 isn't valid on all operating systems. TCASNOW has the value 0 on most
operating systems, but on Solaris (at least) TCASNOW, TCSADRAIN and
TCSAFLUSH have the same values as the equivalent ioctls, TCSETS, TCSETSW and
TCSETSF. Solaris faults 0, setting errno to EINVAL. This isn't useful as a
default behaviour.
|
|
|
|
|
|
| |
As POSIX.xs is not dual life, we can always rely on these macros being
defined for us in perl.h. (And these days, dual life XS code should let
Devel::PPPort take care of this sort of thing.)
|
|
|
|
|
|
| |
This shares identical code marshaling 6 to 9 input arguments into a
struct tm. However, as the return types differ we have to explicitly code
pushing the return value onto perl's stack.
|