Closed p5pRT closed 14 years ago
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
commit f7461760003db2ce68155c97ea6c1658e96fcd27 Author: Zefram \zefram@​fysh\.org Date: Sun Nov 8 15:03:45 2009 +0100
Bareword sub lookups
Reported on rt.cpan.org as https://rt.cpan.org/Ticket/Display.html?id=54581
The failing test looks up method names in the symbol table and then checks with ->can if the methods are available. After the above commit the method 'looks_like_number' fails this test.
This is one of two known\, open RC-blockers for 5.12.0. Karl Williamson is hard at work on the other one.
Steve Hay is putting out a blead release the day after tomorrow. It'd make me so incredibly happy if we could ship 5.11.5 with no known RC-blockers.
-j
Andreas has bisected the failure:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
commit f7461760003db2ce68155c97ea6c1658e96fcd27 Author: Zefram \zefram@​fysh\.org Date: Sun Nov 8 15:03:45 2009 +0100
Bareword sub lookups
Reported on rt.cpan.org as https://rt.cpan.org/Ticket/Display.html?id=54581
The failing test looks up method names in the symbol table and then checks with ->can if the methods are available. After the above commit the method 'looks_like_number' fails this test.
The RT System itself - Status changed from 'new' to 'open'
Andreas has bisected the failure:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
commit f7461760003db2ce68155c97ea6c1658e96fcd27 Author: Zefram \zefram@​fysh\.org Date: Sun Nov 8 15:03:45 2009 +0100
Bareword sub lookups
What happens is that the module contains:
sub splice { my $listh = shift; my $count = shift || 1;
looks_like_number $count or croak "Bogus splice: non-numeric '$count'"; ... }
But it never defines looks_like_number.
The test suite looks at the symbol table and calls ->can($_).
In perl-5.10.1 looks_like_number is not in the symbol table\, in
perl-5.11.4 it is.
A shorter test case for this:
#!/usr/bin/perl -l
package RT_72740;
use strict; use warnings; my $f = 1;
sub s1 { s2 $f; }
package main;
print for keys %RT_72740::; __END__
$ perl-5.10.0 rt-72740.pl s1 BEGIN
$ perl-5.11.4 rt-72740.pl s1 s2 BEGIN
Best regards\,
Bram
Citeren Bram \p5p@​perl\.wizbit\.be:
Andreas has bisected the failure:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
commit f7461760003db2ce68155c97ea6c1658e96fcd27 Author: Zefram \zefram@​fysh\.org Date: Sun Nov 8 15:03:45 2009 +0100
Bareword sub lookups
What happens is that the module contains:
sub splice { my $listh = shift; my $count = shift || 1;
looks\_like\_number $count or croak "Bogus splice​: non\-numeric '$count'";
... }
But it never defines looks_like_number.
The test suite looks at the symbol table and calls ->can($_).
In perl-5.10.1 looks_like_number is not in the symbol table\, in perl-5.11.4 it is.
A shorter test case for this:
#!/usr/bin/perl -l
package RT_72740;
use strict; use warnings; my $f = 1;
sub s1 { s2 $f; }
package main;
print for keys %RT_72740::; __END__
$ perl-5.10.0 rt-72740.pl s1 BEGIN
$ perl-5.11.4 rt-72740.pl s1 s2 BEGIN
Thinking some more about it:
There is a case in which 'looks_like_number $count'/'s2 $f' works
without s2 being defined in RT_72740 (because of indirect object
syntax):
#!/usr/bin/perl -l
package RT_72740;
use strict; use warnings; my $f = bless {}\, "main";;
sub s1 { s2 $f; }
package main;
print for keys %RT_72740::;
sub s2 { print "a"; } RT_72740::s1();
__END__
$ perl5.10.0 rt-72740.pl s1 BEGIN a
$ perl5.11.4 rt-72740.pl s1 s2 BEGIN a
Best regards\,
Bram
By fumbling around in the dark\, I was able to come up with a fix\,
which is no doubt the worst approach. But it shows where the problem
lies: The new rv2cv created in Perl_yylex (in the bareword-handling
code) leaves an extra GV lying around\, which needs to be deleted if
the rv2cv turns out to be temporary.
All tests pass for me with this patch (except for cpan/CGI/t/http.t\,
but thatās unrelated).
I donāt know where tests for this should go. Here is a test case:
{ package LinkedList::Single; if(0) { my $x; looks_like_number $x; method Package; another_method {}; bareword; } } is( join("-"\, keys %LinkedList::Single::)\, ""\, 'bare words or methods do not leave extra globs lying around' );
Father Chrysostomos wrote:
new rv2cv created in Perl_yylex (in the bareword-handling code) leaves an extra GV lying around\, which needs to be deleted if the rv2cv turns out to be temporary.
Yes\, that's probably going to be the best approach. I think you put the deletion in the wrong place\, though\, and it would be better to do it automatically in gv.c\, the same way that GVs get automatically downgraded to the optimised form for const subs. Also got a bit of concern about the used-once warnings\, mediated through the GvMULTI flag.
-zefram
Attached patch fixes the bug by reverting the patch inserting rv2cv into the lexer.
The reverted patch didn't fix any real bugs. Instead of doing difficult to make the rv2cv hack work\, instead a proper hook should be develop to allow hooking into the function lookup.
Gerard Goossen
On Thu\, Feb 18\, 2010 at 11:31:56AM -0800\, Jesse Vincent wrote:
This is one of two known\, open RC-blockers for 5.12.0. Karl Williamson is hard at work on the other one.
Steve Hay is putting out a blead release the day after tomorrow. It'd make me so incredibly happy if we could ship 5.11.5 with no known RC-blockers.
-j
Andreas has bisected the failure:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
commit f7461760003db2ce68155c97ea6c1658e96fcd27 Author: Zefram \zefram@​fysh\.org Date: Sun Nov 8 15:03:45 2009 +0100
Bareword sub lookups
Reported on rt.cpan.org as https://rt.cpan.org/Ticket/Display.html?id=54581
The failing test looks up method names in the symbol table and then checks with ->can if the methods are available. After the above commit the method 'looks_like_number' fails this test.
Gerard Goossen wrote:
Attached patch fixes the bug by reverting the patch inserting rv2cv into the lexer.
I object to this approach. The rv2cv patch has real value\, and the "proper hook" for function lookup that you refer to is in fact the op checker for rv2cv. The patch is not a hack\, it's a cleanup of pre-existing hacks.
I'll work on #72740 myself.
-zefram
Jesse Vincent wrote:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
Fixed by the attached patch.
The issue is that speculative function lookups were leaving detritus consisting of empty GVs in the stash. These didn't affect normal functioning\, but code that looks inside the stash could see them\, and code that makes unreliable assumptions about the format of the stash can be broken. This is the same general mode of failure that we saw with namespace::clean.
LinkedList-Single's failing test was using direct stash access poorly\, in a way that made for a poor test\, quite apart from making too many assumptions about stash structure. In the latest version of the package\, 0.99.6\, the test has been changed to a much better form\, which actually tests what it meant to and incidentally doesn't read the stash at all.
Although they don't affect normal functioning\, the empty GVs shouldn't be there. It's much like the upgraded constant subs\, which we concluded ought to be downgraded when the upgraded form is no longer required\, in order to save memory. The solution here is similar: delete the empty GV when it is detected that a real GV is no longer required. The present patch does this at the same time as checking for constant-sub downgradability.
-zefram
Thanks\, this patch was applied to blead as 2867cdbcac19071f99ab71a81d63dbd894cebd3b by Dave. I've checked that it fixes the issue for LinkedList::Single 0.99.1\, so I'm closing the bug.
Vincent.
Thanks\, this patch was applied to blead as 2867cdbcac19071f99ab71a81d63dbd894cebd3b by Dave. I've checked that it fixes the issue for LinkedList::Single 0.99.1\, so I'm closing the bug.
Vincent.
bitcard@profvince.com - Status changed from 'open' to 'resolved'
On Tue\, Mar 09\, 2010 at 12:22:10AM +0000\, Zefram wrote:
Jesse Vincent wrote:
The distribution LEMBARK/LinkedList-Single-0.99.1.tar.gz fails since commit v5.11.1-147-gf746176:
Fixed by the attached patch.
The issue is that speculative function lookups were leaving detritus consisting of empty GVs in the stash. These didn't affect normal functioning\, but code that looks inside the stash could see them\, and code that makes unreliable assumptions about the format of the stash can be broken. This is the same general mode of failure that we saw with namespace::clean.
LinkedList-Single's failing test was using direct stash access poorly\, in a way that made for a poor test\, quite apart from making too many assumptions about stash structure. In the latest version of the package\, 0.99.6\, the test has been changed to a much better form\, which actually tests what it meant to and incidentally doesn't read the stash at all.
Although they don't affect normal functioning\, the empty GVs shouldn't be there. It's much like the upgraded constant subs\, which we concluded ought to be downgraded when the upgraded form is no longer required\, in order to save memory. The solution here is similar: delete the empty GV when it is detected that a real GV is no longer required. The present patch does this at the same time as checking for constant-sub downgradability.
Thanks\, I've applied this as 2867cdbcac19071f99ab71a81d63dbd894cebd3b.
However\, I have some concerns about the original work\, f7461760003db2ce68155c97ea6c1658e96fcd27.
Having spent a few hours now trying to understand that patch and that bit of toke.c (and not entirely succeeding)\, your original patch looks rather hackish\, from the point of view that not all the logic is located within that one section of yylex; in particular I don't like the extra logic in op_clear() and the call to gv_try_downgrade().
My understanding of your patch is that it speculatively does
rv2cv_op = newCVREF(0\, const_op)
earlier on in the barewod processing logic than before\, before the lexer
has had a chance to decide whether the bareword is indeed a function call
or something else (like BAREWORD => foo ). Doing this earlier means the
PL_check hook gets called earlier\, which gives Lexical::Var etc a chance to
tell the lexer that it should indeed treat this as function\, even if it
wouldn't normally. If the hook doesn't tell the lexer this\, then the lexer
gets to go on with its original bareword processing instead\, and if it
decides it's something boring and non-functionish\, it does
op_clear(rv2cv_op)
just before returning\, thus freeing the unneeded op. However\, the newCVREF() may have also created a glob entry\, which needs to be undone if we clear rv2cv_op. So\, you've added some code to op_clear() which says "if this is an OP_GV or OP_GVSV we're freeing\, then try to downgrade the associated GV on the grounds that it might have been accidentally vivified earlier by the lexer.
Now then:
surely it would be better for the lexer to decide for itself whether it touched the GV by checking its status prior to calling newCVREF()\, then if necessary undoing its mess at the same time as calling op_clear()\, rather than this leaking out into unrelated areas of code?
Anyway\, whether that turns out to be a sensible idea or not\, it's really something for post-5.12.
But something for before 5.12:
You've added a new function\, Perl_gv_try_downgrade\, and its marked as being part of the public API. I can't see any reason why it needs to be. Tthere's a difference between merely exporting it\, and advertising it as public in the docs: stuff that goes in the API can not (easily) be removed or have its functionality changed.
I intend soon to re-mark it as non-API and experimental someone convinces me otherwise.
-- In the 70's we wore flares because we didn't know any better. What possible excuse does the current generation have?
Dave Mitchell wrote:
PL_check hook gets called earlier\, which gives Lexical::Var etc a chance to tell the lexer that it should indeed treat this as function\, even if it wouldn't normally.
Not quite. If the bareword is followed by a fat comma\, it doesn't get treated as a function call\, regardless of what the rv2cv op turns up. This hook doesn't change syntax.
The point of the change is that the possible function is looked up only through rv2cv ops. Whatever the op identifies as being the function (or lack of function) referenced by that bareword gets used as such\, for all purposes\, including particularly for prototype processing. Formerly the lexer had an inconsistent view of functions: it used rv2cv ops to reference functions for execution\, but would look directly in packages to reference them for prototype processing and to decide whether a bareword refers to a function at all. (The latter is relevant for things like "foo $x"\, which is either a function call or indirect object syntax depending on whether "foo" exists as a function.)
newCVREF() may have also created a glob entry\, which needs to be undone if we clear rv2cv_op.
Yes. Except that "need" is a bit strong. newCVREF() may have implicitly created a GV in order to reference a currently-undefined function\, and it may have implicitly upgraded a constant-sub placeholder into a GV in order to have a first-class CV to reference. These upgradings don't change the nominal content of the package\, and so nominally don't need to be undone. It's more than anything else just a waste of memory to keep the upgraded GVs around when they're no longer required to be first-class. And\, of course\, the lexer's previous behaviour of looking directly in the package enabled it to avoid upgrading them at all.
So\, you've added some code to op\_clear\(\) which says
"if this is an OP_GV or OP_GVSV we're freeing\, then try to downgrade the associated GV on the grounds that it might have been accidentally vivified earlier by the lexer.
Yes\, pretty much. In principle\, anything that deletes a reference to a GV could sensibly do the same thing. It's done only in op freeing because that's a sensible tradeoff to get the original memory behaviour back with minimum fuss.
surely it would be better for the lexer to decide for itself whether it touched the GV by checking its status prior to calling newCVREF()\, then if necessary undoing its mess at the same time as calling op_clear()\, rather than this leaking out into unrelated areas of code?
Not as sensible as it first seems. The op construction code knows\, and always did know\, where to find the GV. So the op code is hardly "unrelated"\, and it's pretty sensible for the op destruction code to know about special requirements upon deleting GV references. It is really the lexer that was the unrelated code into which knowledge of GVs leaked.
In the new system\, that part of the lexer is quite insulated from knowledge of GV lookups. The code that did know what GV was involved is precisely what was being moved out of the lexer in order to improve pluggability. Now the knowledge of how to look up GVs for function references is localised to the op code. Indeed\, the op code now gets to decide whether a GV is to be involved at all (it isn't when Lexical::Var takes over)\, and a non-core rv2cv checker could decide to look up GVs somewhere other than the core logic says. The only way of being sure about which GV wants downgrading is to look in the op that was actually created and which is being discarded.
You've added a new function\, Perl_gv_try_downgrade\, and its marked as being part of the public API. I can't see any reason why it needs to be.
The intention is that things other than the lexer might do similar kinds of speculative GV lookup\, and might thus want to do similar downgrading when deleting GV references. I don't have anything that does this\, and it's not a critical capability\, but I saw no reason to restrict it to the core and some use in not so restricting it.
If we eventually find that we don't want this sort of downgrading\, or we tackle it in a completely different way\, gv_try_downgrade() can safely become a no-op. It's not tying us to a way of working that might turn out to be inconvenient\, other than the existence of GVs\, which has been pretty inconvenient but is established by a lot more of the API than this function.
-zefram
On Wed\, Mar 10\, 2010 at 09:10:04PM +0000\, Zefram wrote:
You've added a new function\, Perl_gv_try_downgrade\, and its marked as being part of the public API. I can't see any reason why it needs to be.
The intention is that things other than the lexer might do similar kinds of speculative GV lookup\, and might thus want to do similar downgrading when deleting GV references. I don't have anything that does this\, and it's not a critical capability\, but I saw no reason to restrict it to the core and some use in not so restricting it.
If we eventually find that we don't want this sort of downgrading\, or we tackle it in a completely different way\, gv_try_downgrade() can safely become a no-op. It's not tying us to a way of working that might turn out to be inconvenient\, other than the existence of GVs\, which has been pretty inconvenient but is established by a lot more of the API than this function.
The trouble is that anything that's added to the public API immediately ties our hands. IMO there's already far too much stuff in the API\, and its one of the things that makes the perl core so hard to work on: anything you want to change or improve will probably break someone's XS somewhere.
Anyway\, for now I've removed it from the public API with
4c1069378194cb28b7554e5db5a450e0595b43f4
The thing about this is that we can always add it back to the API at a later date\, but not vice-versa.
-- Wesley Crusher gets beaten up by his classmates for being a smarmy git\, and consequently has a go at making some friends of his own age for a change. -- Things That Never Happen in "Star Trek" #18
2010/3/11 Dave Mitchell \davem@​iabyn\.com:
On Wed\, Mar 10\, 2010 at 09:10:04PM +0000\, Zefram wrote:
You've added a new function\, Perl_gv_try_downgrade\, and its marked as being part of the public API. I can't see any reason why it needs to be.
The intention is that things other than the lexer might do similar kinds of speculative GV lookup\, and might thus want to do similar downgrading when deleting GV references. Ā I don't have anything that does this\, and it's not a critical capability\, but I saw no reason to restrict it to the core and some use in not so restricting it.
If we eventually find that we don't want this sort of downgrading\, or we tackle it in a completely different way\, gv_try_downgrade() can safely become a no-op. Ā It's not tying us to a way of working that might turn out to be inconvenient\, other than the existence of GVs\, which has been pretty inconvenient but is established by a lot more of the API than this function.
The trouble is that anything that's added to the public API immediately ties our hands. IMO there's already far too much stuff in the API\, and its one of the things that makes the perl core so hard to work on: anything you want to change or improve will probably break someone's XS somewhere.
Anyway\, for now I've removed it from the public API with
Ā Ā 4c1069378194cb28b7554e5db5a450e0595b43f4
The thing about this is that we can always add it back to the API at a later date\, but not vice-versa.
For what its worth: There were more XS API breakages by *removing* some exports from the public API than breaking the API somehow.
It's just that porters mostly don't care about export-strict platforms\, as AIX\, cygwin\, MsWin32\, mingw\, which fail on missing exports\, whereas most other platforms just export all symbols regardless of the export list. Maybe delete an export only if you can test it on a platform which detects such a deletion..
From my experience: 1 API breakage by removing op_seq and opt_op_seqmax for optimizer. 3 API deletions broke B::Generate for those platforms. Perl_pad_alloc\, Perl_fold_constants\, Perl_cv_clone not exported. CPAN #28912
There were several more deletion issues which I forgot. As long as only windows and AIX is affected nobody cares. -- Reini Urban http://phpwiki.org/ http://murbreak.at/
On Mon\, Mar 15\, 2010 at 07:24:52AM +0100\, Reini Urban wrote:
For what its worth: There were more XS API breakages by *removing* some exports from the public API than breaking the API somehow.
It's just that porters mostly don't care about export-strict platforms\, as AIX\, cygwin\, MsWin32\, mingw\, which fail on missing exports\, whereas most other platforms just export all symbols regardless of the export list. Maybe delete an export only if you can test it on a platform which detects such a deletion..
From my experience: 1 API breakage by removing op_seq and opt_op_seqmax for optimizer. 3 API deletions broke B::Generate for those platforms. Perl_pad_alloc\, Perl_fold_constants\, Perl_cv_clone not exported. CPAN #28912
There were several more deletion issues which I forgot. As long as only windows and AIX is affected nobody cares.
Until such functions are in the public API\, modules using them are buggy. That they happen to work on some platforms is unfortunate.
*I repeat*:
Functions can be added to the public API if they have tests and documentation.
Patches welcome.
No-one cares to do *that* either.
Nicholas Clark
It's just that porters mostly don't care about export-strict platforms\, as AIX\, cygwin\, MsWin32\, mingw\, which fail on missing exports\, whereas most other platforms just export all symbols regardless of the export list.
It's not that we don't care\, it's that most of us are much less experienced with those platforms _and_ they're harder to get access to / develop on for many of us. It's definitely a self-reinforcing problem.
I know that Curtis Jewell is doing some very nice stuff to make it easier for those of us who aren't well versed in Win32 to smoke locally. It's my hope that that will help catch these sort of issues faster and in a more...widely distributed fashion\, rather than leaning on much smaller set of porters who use Win32 as their primary platform.
On Mon\, 15 Mar 2010 04:42:14 -0400\, jesse \jesse@​fsck\.com wrote:
It's just that porters mostly don't care about export-strict platforms\, as AIX\, cygwin\, MsWin32\, mingw\, which fail on missing exports\, whereas most other platforms just export all symbols regardless of the export list.
It's not that we don't care\, it's that most of us are much less experienced with those platforms _and_ they're harder to get access to / develop on for many of us. It's definitely a self-reinforcing problem.
I know that Curtis Jewell is doing some very nice stuff to make it easier for those of us who aren't well versed in Win32 to smoke locally. It's my hope that that will help catch these sort of issues faster and in a more...widely distributed fashion\, rather than leaning on much smaller set of porters who use Win32 as their primary platform.
On 20 Oct 2008\, I wrote the attached mail\, which got NO response at all. The included code in that mail might be not very well portable\, but it might well do nicely as a base for some sort of API test\, which we currently do not have.
If I run that perl script again today on Linux-64bit with DEBUGGING\, I get the following list:
Symbol perl_alloc_using not found in libperl.so Symbol perl_clone not found in libperl.so Symbol perl_clone_using not found in libperl.so Symbol Perl_my_chsize not found in libperl.so Symbol Perl_croak_nocontext not found in libperl.so Symbol Perl_die_nocontext not found in libperl.so Symbol Perl_deb_nocontext not found in libperl.so Symbol Perl_form_nocontext not found in libperl.so Symbol Perl_load_module_nocontext not found in libperl.so Symbol Perl_mess_nocontext not found in libperl.so Symbol Perl_warn_nocontext not found in libperl.so Symbol Perl_warner_nocontext not found in libperl.so Symbol Perl_newSVpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_nocontext not found in libperl.so Symbol Perl_sv_setpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_mg_nocontext not found in libperl.so Symbol Perl_sv_setpvf_mg_nocontext not found in libperl.so Symbol Perl_do_aspawn not found in libperl.so Symbol Perl_do_spawn not found in libperl.so Symbol Perl_do_spawn_nowait not found in libperl.so Symbol Perl_dump_fds not found in libperl.so Symbol Perl_my_bcopy not found in libperl.so Symbol Perl_my_bzero not found in libperl.so Symbol Perl_my_memcmp not found in libperl.so Symbol Perl_my_memset not found in libperl.so Symbol Perl_my_swap not found in libperl.so Symbol Perl_my_htonl not found in libperl.so Symbol Perl_my_ntohl not found in libperl.so Symbol Perl_newPADOP not found in libperl.so Symbol Perl_regdupe_internal not found in libperl.so Symbol Perl_unlnk not found in libperl.so Symbol Perl_dump_mstats not found in libperl.so Symbol Perl_get_mstats not found in libperl.so Symbol Perl_GetVars not found in libperl.so Symbol Perl_init_global_struct not found in libperl.so Symbol Perl_free_global_struct not found in libperl.so Symbol Perl_cx_dup not found in libperl.so Symbol Perl_si_dup not found in libperl.so Symbol Perl_ss_dup not found in libperl.so Symbol Perl_any_dup not found in libperl.so Symbol Perl_he_dup not found in libperl.so Symbol Perl_hek_dup not found in libperl.so Symbol Perl_re_dup_guts not found in libperl.so Symbol Perl_fp_dup not found in libperl.so Symbol Perl_dirp_dup not found in libperl.so Symbol Perl_gp_dup not found in libperl.so Symbol Perl_mg_dup not found in libperl.so Symbol Perl_sv_dup not found in libperl.so Symbol Perl_rvpv_dup not found in libperl.so Symbol Perl_parser_dup not found in libperl.so Symbol Perl_sys_intern_dup not found in libperl.so Symbol Perl_sys_intern_clear not found in libperl.so Symbol Perl_sys_intern_init not found in libperl.so Symbol Perl_Slab_Alloc not found in libperl.so Symbol Perl_Slab_Free not found in libperl.so Symbol Perl_sv_setsv_cow not found in libperl.so Symbol Perl_stashpv_hvname_match not found in libperl.so Symbol Perl_my_sprintf not found in libperl.so Symbol Perl_my_cxt_init not found in libperl.so Symbol Perl_my_cxt_index not found in libperl.so Symbol Perl_signbit not found in libperl.so
--8\<--- globals.pl #!/pro/bin/perl
qx{make global.sym};
my $nm; if (my @lp = glob "libperl.*") { $nm = $lp[0]; } else { $nm = "perl"; } my %sym; open my $nl\, "-|"\, "nm $nm" or die "Cannot execute $nm: $!\n"; while (\<$nl>) { my ($sym) = (m/ [DT] (.*)/) or next; ($sym) = (m/^\.?(\S+)/) if $sym =~ m/^[0-9]+$/; # AIX nm format $sym{$1}++; }
open my $gs\, "\<"\, "global.sym" or die "global.sym: $!\n"; while (\<$gs>) { m/^\s*#/ and next; chomp; exists $sym{$_} or print "Symbol $_ not found in $nm\n"; } -->8---
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using & porting perl 5.6.2\, 5.8.x\, 5.10.x\, 5.11.x on HP-UX 10.20\, 11.00\, 11.11\, 11.23\, and 11.31\, OpenSuSE 10.3\, 11.0\, and 11.1\, AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Message RFC822:
MIME-Version: 1.0
X-Xs4all-Spam-Score: 0.0 () none
List-Post: mailto:perl5-porters@perl.org
X-Spam-Status: No, hits=0.0 required=8.0 tests=
X-Mailer: Claws Mail 3.5.0cvs121 (GTK+ 2.12.0; x86_64-unknown-linux-gnu)
Envelope-To: h.m.brand@xs4all.nl
List-Help: mailto:perl5-porters-help@perl.org
X-Xs4all-Spam: NO
X-List-Archive: http://nntp.perl.org/group/perl.perl5.porters/140776
X-Virus-Checked: Checked
X-Xs4all-DNSBL-Checked: mxdrop216.xs4all.nl checked 63.251.223.186 against
DNS blacklists
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAIAAACI8LKTAAAACXBIWXMAAABIAAAASABGyWs+AAAC
JElEQVRo3u2aMY4CMQxFczZ6RItEzRm4DBINDbRUSPRInIRbsNK6+dJfezN4kokn48IaCSjysL8d
e9Knoj2fr9f9/gllqQ6U9/vxWK3EdwdIEGjRIVCu18NhuxUfK46SH81+fzrdbuKPx/P5ctHQdAdI
TKAgpvV6s9ntBEfXEYSGgMQzIHnuFBBjkshCNJ2KtJZ04hHNAugP8bZr3NIHhbcF0AKoK0CoaHXU
LUWBIs1n+jV+Fl8CVqOApEXAwyMO/DSR4XVntoAYDR7eBjQupuYAYTMph8Rj21D4m7MChN02tpqs
NSnb/KqU2oHCXu5xDCgflj/RAgBiKBIXnICzAsSjWBsTz5K4/HeXYvb8yK5lY3VGEwPi2aONKT+5
AlcxrTPOwcTiraGRChgMEKJh0bVVifGVTq6qgBiNVl8QE29EsK6VE+YJAOG2wz5AvsqUS6uqgHCA
n4NGvBYpnJ64Jgg27sCtxtBk1CJIA4S/GhdWKh07QxUB48jWGhZ4jKamRRr/T8/M0AaEyctry6YB
4dTGj9iWZNs3DahES5kPCJOu0RQbF/fQOBprsB9gaO9JtPDzII9U5ySXX7AnuIt91y54AAW7rPpT
LCe5gt3F+CLqr2UarGB3MXvMylWGq4+9RCx3TW1oJq1t3HPQlFs6N1fFNEB4s8dn7Ne7ACSm7TPQ
I5quAWmw6qBpulHM33B0Csge4Nd8JTTYG2b1XyRe3lH8x34ABJ6aePuQ2N4AAAAASUVORK5CYII=
Message-ID: 20081020141630.50e2a92a@pc09.procura.nl
Content-Type: text/plain; charset="utf-8"
X-Virus-Scanned: by XS4ALL Virus Scanner
X-RT-Original-Encoding: utf-8
Received: from lists.develooper.com (x6.develooper.com [63.251.223.186])
by mxdrop216.xs4all.nl (8.13.8/8.13.8) with SMTP id m9KCGpCc053046 for
h.m.brand@xs4all.nl; Mon, 20 Oct 2008 14:16:54 +0200 (CEST)
(envelope-from perl5-porters-return-140776-h.m.brand=xs4all.nl@perl.org)
Received: (qmail 18875 invoked by uid 514); 20 Oct 2008 12:16:47 -0000
Received: (qmail 18863 invoked from network); 20 Oct 2008 12:16:47 -0000
Delivered-To: mailing list perl5-porters@perl.org
Delivered-To: perl5-porters@perl.org
Subject: Exported symbols: the perl API
X-CNFS-Analysis: v=1.0 c=1 a=y5E4-Y8cAAAA:8 a=kMH87Q7bAAAA:8
a=xiKuzzWyAAAA:8 a=_IEhM8lNAAAA:8 a=qnD2cK_NAAAA:8 a=soeUKm9BJnQ_E9ObvqgA:9
a=_B0mzIMB8GEyr2rfugEA:7 a=97s7vhpIQ84qvKMX8RCHr4YSqSoA:4 a=RUW1g8P72R0A:10
a=8N6igchGCLUA:10 a=QLm6itZTqP8A:10 a=8Yd0Br3-97kA:10
Return-Path: perl5-porters-return-140776-h.m.brand=xs4all.nl@perl.org
X-Spam-Check-BY: la.mx.develooper.com
Date: Mon, 20 Oct 2008 14:16:30 +0200
Mailing-List: contact perl5-porters-help@perl.org; run by ezmlm
Precedence: bulk
To: Perl5 Porters perl5-porters@perl.org
List-ID:
embed.pl generates global.sym, which contains a list of all the functions that are documented to be in the perl API. There is currently however no test to check if all those are actually available, and it turns out that if you build with -Duseshrplib, many are indeed not available. Example:
$ grep signbit embed.fnc AMdnoP |int |Perl_signbit |NV f $ grep signbit global.sym Perl_signbit $ nm libperl.so | grep signbit Exit 1 $
and Perl_signbit is not explicitly skipped in makedef.pl - that is only used for aix win32 wince os2 MacOS netware - so I expect it to be in libperl.{so|sl|a|dll}
An (unportable) simple test case: --8<--- globals.pl
qx{make global.sym};
my $nm; if (my @lp = glob "libperl.") { $nm = $lp[0]; } else { $nm = "perl"; } my %sym; open my $nl, "-|", "nm $nm" or die "Cannot execute $nm: $!\n"; while (<$nl>) { m/ [DT] (.)/ and $sym{$1}++; }
open my $gs, "<", "global.sym" or die "global.sym: $!\n"; while (<$gs>) { m/^\s*#/ and next; chomp; exists $sym{$} or print "Symbol $ not found in $nm\n"; } -->8---
showed me a complete list on Linux and AIX:
Linux $ /pro/bin/perl global.pl Symbol perl_alloc_using not found in libperl.so Symbol perl_clone not found in libperl.so Symbol perl_clone_using not found in libperl.so Symbol Perl_my_chsize not found in libperl.so Symbol Perl_croak_nocontext not found in libperl.so Symbol Perl_die_nocontext not found in libperl.so Symbol Perl_deb_nocontext not found in libperl.so Symbol Perl_form_nocontext not found in libperl.so Symbol Perl_load_module_nocontext not found in libperl.so Symbol Perl_mess_nocontext not found in libperl.so Symbol Perl_warn_nocontext not found in libperl.so Symbol Perl_warner_nocontext not found in libperl.so Symbol Perl_newSVpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_nocontext not found in libperl.so Symbol Perl_sv_setpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_mg_nocontext not found in libperl.so Symbol Perl_sv_setpvf_mg_nocontext not found in libperl.so Symbol Perl_do_aspawn not found in libperl.so Symbol Perl_do_spawn not found in libperl.so Symbol Perl_do_spawn_nowait not found in libperl.so Symbol Perl_dump_fds not found in libperl.so Symbol Perl_my_bcopy not found in libperl.so Symbol Perl_my_bzero not found in libperl.so Symbol Perl_my_memcmp not found in libperl.so Symbol Perl_my_memset not found in libperl.so Symbol Perl_my_swap not found in libperl.so Symbol Perl_my_htonl not found in libperl.so Symbol Perl_my_ntohl not found in libperl.so Symbol Perl_newPADOP not found in libperl.so Symbol Perl_regdupe_internal not found in libperl.so Symbol Perl_unlnk not found in libperl.so Symbol Perl_dump_mstats not found in libperl.so Symbol Perl_get_mstats not found in libperl.so Symbol Perl_GetVars not found in libperl.so Symbol Perl_init_global_struct not found in libperl.so Symbol Perl_free_global_struct not found in libperl.so Symbol Perl_cx_dup not found in libperl.so Symbol Perl_si_dup not found in libperl.so Symbol Perl_ss_dup not found in libperl.so Symbol Perl_any_dup not found in libperl.so Symbol Perl_he_dup not found in libperl.so Symbol Perl_hek_dup not found in libperl.so Symbol Perl_re_dup_guts not found in libperl.so Symbol Perl_fp_dup not found in libperl.so Symbol Perl_dirp_dup not found in libperl.so Symbol Perl_gp_dup not found in libperl.so Symbol Perl_mg_dup not found in libperl.so Symbol Perl_sv_dup not found in libperl.so Symbol Perl_rvpv_dup not found in libperl.so Symbol Perl_parser_dup not found in libperl.so Symbol Perl_sys_intern_dup not found in libperl.so Symbol Perl_sys_intern_clear not found in libperl.so Symbol Perl_sys_intern_init not found in libperl.so Symbol Perl_Slab_Alloc not found in libperl.so Symbol Perl_Slab_Free not found in libperl.so Symbol Perl_sv_setsv_cow not found in libperl.so Symbol Perl_stashpv_hvname_match not found in libperl.so Symbol Perl_my_sprintf not found in libperl.so Symbol Perl_my_cxt_init not found in libperl.so Symbol Perl_my_cxt_index not found in libperl.so Symbol Perl_signbit not found in libperl.so Linux $
And on AIX:
$ /pro/bin/perl /tmp/global.pl Symbol perl_alloc_using not found in libperl.a Symbol perl_clone_using not found in libperl.a Symbol Perl_my_chsize not found in libperl.a Symbol Perl_do_aspawn not found in libperl.a Symbol Perl_do_spawn not found in libperl.a Symbol Perl_do_spawn_nowait not found in libperl.a Symbol Perl_dump_fds not found in libperl.a Symbol Perl_my_bcopy not found in libperl.a Symbol Perl_my_bzero not found in libperl.a Symbol Perl_my_memcmp not found in libperl.a Symbol Perl_my_memset not found in libperl.a Symbol Perl_my_swap not found in libperl.a Symbol Perl_my_htonl not found in libperl.a Symbol Perl_my_ntohl not found in libperl.a Symbol Perl_unlnk not found in libperl.a Symbol Perl_dump_mstats not found in libperl.a Symbol Perl_get_mstats not found in libperl.a Symbol Perl_GetVars not found in libperl.a Symbol Perl_init_global_struct not found in libperl.a Symbol Perl_free_global_struct not found in libperl.a Symbol Perl_sys_intern_dup not found in libperl.a Symbol Perl_sys_intern_clear not found in libperl.a Symbol Perl_sys_intern_init not found in libperl.a Symbol Perl_Slab_Alloc not found in libperl.a Symbol Perl_Slab_Free not found in libperl.a Symbol Perl_sv_setsv_cow not found in libperl.a Symbol Perl_my_sprintf not found in libperl.a Symbol Perl_my_cxt_index not found in libperl.a Symbol Perl_signbit not found in libperl.a $
Note that the list on AIX is actually shorter
BTW I'm extremely interested in a way to portably do this on win32
-- H.Merijn Brand Amsterdam Perl Mongers http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
embed.pl generates global.sym\, which contains a list of all the functions that are documented to be in the perl API. There is currently however no test to check if all those are actually available\, and it turns out that if you build with -Duseshrplib\, many are indeed not available. Example:
$ grep signbit embed.fnc AMdnoP |int |Perl_signbit |NV f $ grep signbit global.sym Perl_signbit $ nm libperl.so | grep signbit Exit 1 $
and Perl_signbit is not explicitly skipped in makedef.pl - that is only used for aix win32 wince os2 MacOS netware - so I expect it to be in libperl.{so|sl|a|dll}
An (unportable) simple test case: --8\<--- globals.pl #!/pro/bin/perl
qx{make global.sym};
my $nm; if (my @lp = glob "libperl.*") { $nm = $lp[0]; } else { $nm = "perl"; } my %sym; open my $nl\, "-|"\, "nm $nm" or die "Cannot execute $nm: $!\n"; while (\<$nl>) { m/ [DT] (.*)/ and $sym{$1}++; }
open my $gs\, "\<"\, "global.sym" or die "global.sym: $!\n"; while (\<$gs>) { m/^\s*#/ and next; chomp; exists $sym{$_} or print "Symbol $_ not found in $nm\n"; } -->8---
showed me a complete list on Linux and AIX:
Linux $ /pro/bin/perl global.pl Symbol perl_alloc_using not found in libperl.so Symbol perl_clone not found in libperl.so Symbol perl_clone_using not found in libperl.so Symbol Perl_my_chsize not found in libperl.so Symbol Perl_croak_nocontext not found in libperl.so Symbol Perl_die_nocontext not found in libperl.so Symbol Perl_deb_nocontext not found in libperl.so Symbol Perl_form_nocontext not found in libperl.so Symbol Perl_load_module_nocontext not found in libperl.so Symbol Perl_mess_nocontext not found in libperl.so Symbol Perl_warn_nocontext not found in libperl.so Symbol Perl_warner_nocontext not found in libperl.so Symbol Perl_newSVpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_nocontext not found in libperl.so Symbol Perl_sv_setpvf_nocontext not found in libperl.so Symbol Perl_sv_catpvf_mg_nocontext not found in libperl.so Symbol Perl_sv_setpvf_mg_nocontext not found in libperl.so Symbol Perl_do_aspawn not found in libperl.so Symbol Perl_do_spawn not found in libperl.so Symbol Perl_do_spawn_nowait not found in libperl.so Symbol Perl_dump_fds not found in libperl.so Symbol Perl_my_bcopy not found in libperl.so Symbol Perl_my_bzero not found in libperl.so Symbol Perl_my_memcmp not found in libperl.so Symbol Perl_my_memset not found in libperl.so Symbol Perl_my_swap not found in libperl.so Symbol Perl_my_htonl not found in libperl.so Symbol Perl_my_ntohl not found in libperl.so Symbol Perl_newPADOP not found in libperl.so Symbol Perl_regdupe_internal not found in libperl.so Symbol Perl_unlnk not found in libperl.so Symbol Perl_dump_mstats not found in libperl.so Symbol Perl_get_mstats not found in libperl.so Symbol Perl_GetVars not found in libperl.so Symbol Perl_init_global_struct not found in libperl.so Symbol Perl_free_global_struct not found in libperl.so Symbol Perl_cx_dup not found in libperl.so Symbol Perl_si_dup not found in libperl.so Symbol Perl_ss_dup not found in libperl.so Symbol Perl_any_dup not found in libperl.so Symbol Perl_he_dup not found in libperl.so Symbol Perl_hek_dup not found in libperl.so Symbol Perl_re_dup_guts not found in libperl.so Symbol Perl_fp_dup not found in libperl.so Symbol Perl_dirp_dup not found in libperl.so Symbol Perl_gp_dup not found in libperl.so Symbol Perl_mg_dup not found in libperl.so Symbol Perl_sv_dup not found in libperl.so Symbol Perl_rvpv_dup not found in libperl.so Symbol Perl_parser_dup not found in libperl.so Symbol Perl_sys_intern_dup not found in libperl.so Symbol Perl_sys_intern_clear not found in libperl.so Symbol Perl_sys_intern_init not found in libperl.so Symbol Perl_Slab_Alloc not found in libperl.so Symbol Perl_Slab_Free not found in libperl.so Symbol Perl_sv_setsv_cow not found in libperl.so Symbol Perl_stashpv_hvname_match not found in libperl.so Symbol Perl_my_sprintf not found in libperl.so Symbol Perl_my_cxt_init not found in libperl.so Symbol Perl_my_cxt_index not found in libperl.so Symbol Perl_signbit not found in libperl.so Linux $
And on AIX:
$ /pro/bin/perl /tmp/global.pl Symbol perl_alloc_using not found in libperl.a Symbol perl_clone_using not found in libperl.a Symbol Perl_my_chsize not found in libperl.a Symbol Perl_do_aspawn not found in libperl.a Symbol Perl_do_spawn not found in libperl.a Symbol Perl_do_spawn_nowait not found in libperl.a Symbol Perl_dump_fds not found in libperl.a Symbol Perl_my_bcopy not found in libperl.a Symbol Perl_my_bzero not found in libperl.a Symbol Perl_my_memcmp not found in libperl.a Symbol Perl_my_memset not found in libperl.a Symbol Perl_my_swap not found in libperl.a Symbol Perl_my_htonl not found in libperl.a Symbol Perl_my_ntohl not found in libperl.a Symbol Perl_unlnk not found in libperl.a Symbol Perl_dump_mstats not found in libperl.a Symbol Perl_get_mstats not found in libperl.a Symbol Perl_GetVars not found in libperl.a Symbol Perl_init_global_struct not found in libperl.a Symbol Perl_free_global_struct not found in libperl.a Symbol Perl_sys_intern_dup not found in libperl.a Symbol Perl_sys_intern_clear not found in libperl.a Symbol Perl_sys_intern_init not found in libperl.a Symbol Perl_Slab_Alloc not found in libperl.a Symbol Perl_Slab_Free not found in libperl.a Symbol Perl_sv_setsv_cow not found in libperl.a Symbol Perl_my_sprintf not found in libperl.a Symbol Perl_my_cxt_index not found in libperl.a Symbol Perl_signbit not found in libperl.a $
Note that the list on AIX is actually shorter
BTW I'm extremely interested in a way to portably do this on win32
-- H.Merijn Brand Amsterdam Perl Mongers http://amsterdam.pm.org/ using & porting perl 5.6.2\, 5.8.x\, 5.10.x\, 5.11.x on HP-UX 10.20\, 11.00\, 11.11\, 11.23\, and 11.31\, SuSE 10.1\, 10.2\, and 10.3\, AIX 5.2\, and Cygwin. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
2010/3/15 Nicholas Clark \nick@​ccl4\.org:
On Mon\, Mar 15\, 2010 at 07:24:52AM +0100\, Reini Urban wrote:
For what its worth: There were more XS API breakages by *removing* some exports from the public API than breaking the API somehow.
It's just that porters mostly don't care about export-strict platforms\, as AIX\, cygwin\, MsWin32\, mingw\, which fail on missing exports\, whereas most other platforms just export all symbols regardless of the export list. Maybe delete an export only if you can test it on a platform which detects such a deletion..
From my experience: 1 API breakage by removing op_seq and opt_op_seqmax for optimizer. 3 API deletions broke B::Generate for those platforms. Perl_pad_alloc\, Perl_fold_constants\, Perl_cv_clone not exported. CPAN #28912
There were several more deletion issues which I forgot. As long as only windows and AIX is affected nobody cares.
Until such functions are in the public API\, modules using them are buggy. That they happen to work on some platforms is unfortunate.
Thing is that at the time B::Generate was written those functions were public\, until you made them non-public and B::Generate stopped working on win32/cygwin/AIX.
This happened with a lot of B modules. I had time to take care for some\, but not all. Not taking care about B modules means not taking care about future perl5 optimizations.
*I repeat*:
Functions can be added to the public API if they have tests and documentation.
Patches welcome.
No-one cares to do *that* either.
I'm with Marc Lehman here. I really have not enough time fix such core issues. I didn't remove the A flag and I'm not familiar enough with those functions.
I rather fixed the module to leave out certain features the original authors had indented. -- Reini Urban http://phpwiki.org/ http://murbreak.at/
On Tue\, Mar 16\, 2010 at 09:39:28AM +0100\, Reini Urban wrote:
2010/3/15 Nicholas Clark \nick@​ccl4\.org:
Thing is that at the time B::Generate was written those functions were public\, until you made them non-public and B::Generate stopped working on win32/cygwin/AIX.
They have never been public. This is 5.6.0:
http://perl5.git.perl.org/perl.git/blob/perl-5.6.0:/embed.pl
1421 p |CV* |cv_clone |CV* proto 1508 p |OP* |fold_constants |OP* arg 1792 p |PADOFFSET|pad_alloc |I32 optype|U32 tmptype
This happened with a lot of B modules. I had time to take care for some\, but not all. Not taking care about B modules means not taking care about future perl5 optimizations.
My experience is that it's *very* hard to make op-level changes that have any significant speed up on perl generally. I don't agree with the *generalisation* implied by your statement.
*I repeat*:
Functions can be added to the public API if they have tests and documentation.
Patches welcome.
No-one cares to do *that* either.
I'm with Marc Lehman here. I really have not enough time fix such core issues. I didn't remove the A flag and I'm not familiar enough with those functions.
I rather fixed the module to leave out certain features the original authors had indented.
No-one removed the A flag. They were never public. They were never exported. The original author *wrote* a broken module.
You're a volunteer too - there's no obligation for you (or anyone else) to fix this.
But as no-one *is* volunteering\, it's not going to change.
Nicholas Clark
Migrated from rt.perl.org#72740 (status was 'resolved')
Searchable as RT72740$