This Week on p5p 2001/06/17
Notes
Please send corrections and additions to perl-thisweek-YYYYMM@simon-cozens.org where YYYYMM is the current year and month. Changes and additions to the perl5-porters biographies are particularly welcome.
This was a reasonably busy week, seeing just over 400 messages.
Many thanks to Leon for taking over these summaries in my absence.
More -Wall fixes
Doug MacEachern has been furiously fixing up compiler warnings this week, tidying up ext/
so that it is less noisy under -Wall
.
One major problem was that if an XSUB has no arguments and all the work is done in PP code, the helper variable ax
is likely to be unused; Doug added a macro, PERL_UNUSED_VAR
, to wrap around ax
in such cases to prevent xsubpp
creating code that produced warnings.
Nick Clark also produced a mega (141K) warning-satisfying patch.
Dough also fixed up some missing dTHX
es in some of the extensions. This led to an associated change in ExtUtil/Constant.pm
, Nick Clark’s helper module for creating the constant
subroutine in XS modules. It took a while for people to get their heads around the idea that this was a Perl module that spat out XS code - unfortunately, MakeMaker doesn’t like the idea of having two .xs
files in a module, so you can’t have a separate file for constants; hence, you have to do evil things like modifying the XS code produced by h2xs
in place. Urgh.
Miscellaneous Darwin Updates
Wilfredo Sanchez and Larry Schatzer have been our Mac OS X heroes this week. They uncovered a bunch of problems, some of which have even been fixed. Firstly, PerlIO was intercepting a warning from the locale system before it had been properly initialized, and was causing segfaults. There were also some numeric problems with INT32_MIN
- Apple’s stdin.h
defines it as being -2147483648 instead of the more gcc-friendly -2147483647-1. As Jarkko said, the real long-term fix would be to fix Apple’s header files; unfortunately, we can’t do that very easily, so we have to work around to redefining INT32_MIN
on Darwin ourselves.
Hash accessor macros
Abhijit Menon-Sen asked why hv.c
does things like
register XPVHV* xhv;
...
xhv = (XPVHV*)SvANY(hv);
... use of xhv->xhv_* ...
instead of simply
SvFOO(hv);
which is considerably easier to grep for. He then sent seven large patches which revert to the macro behaviour. Jarkko applied the patches, but then found that this generated a bunch of new warnings, and some nasty errors on HPUX.
Doug MacEachern piped up, saying that the original code was there for reasons of performance; direct access saves a couple of indirections every time one of the xhv_
fields is accessed. He also said that the first
xhv = (XPVHV*)SvANY(hv);
might be stored in a register, optimising further accesses. Both Mike Guy and Ilmari Karonen suggested reverting to the previous optimised format, but putting in the macro version as comments so that they can be grepped for. Spider was called in to fix up the HPUX indigestion.
Abhijit also threw in some updates to dump.c
, and removed the tests in the core for “anonymous stashes” - a concept which didn’t even appear to exist…
iThreads development
Artur’s been busy this week with iThreads support; he’s working on a number of different areas. Firstly, the continuing conversion of the Threads.pm
module for iThreads. His new module will be called threads.pm
and will soon appear on CPAN once he’s finished writing test cases. Another tack was to make regular expressions safe in threaded environments, but that seems to have temporarily ground to a halt.
His big achievement this week was the implementation and documenting of the CLONE
method, a callback like DESTROY
called on all objects when a thread is cloned. This caused some brief problems on Win32 because of the way it was detecting stashes. Stashes are, of course, normal hashes, so you have to be careful to call the CLONE
method from a stash, rather than do something horrible like attempt to call the CLONE
entry from a hash. Nick added
if (gv_stashpv(HvNAME(hv),0)
as a guard, and it all worked again.
Cross-compilation
Jarkko has reported that the basics of cross-compilation support are working; he built miniperl for iPAQ by constructing an SSH tunnel, sending the binaries produced by Configure across and reading back the results. Read about it.
SV Documentation
God of the week award goes to Dave Mitchell. Over on the Perl 6 lists, I’d asked for people to look through the Perl 5 sources and see what sort of things happen to SVs, so that I could see what needed to happen for Perl 6. In doing so, he produced 800 lines of documentation and comments for sv.c
. Wow.
On his travels, he asked some questions about SV macros; the answers may be interesting. Read about it.
Various
Ilya put in a couple of scary patches for OS/2, including one which made Configure self-modifying. This was considered to be a Bad Thing.
Jarkko integrated the NetWare modifications to Perl, and the Memoize
module.
Sean Teague announced that the Perl Power Tools can be downloaded from CPAN as Bundle::PPT
.
Chris Nandor updated File::Find
and its tests to cope with MacOS; however, this consisted mainly of several iterations of
if (macos) {
A
} else {
B
}
which Jarkko balked at. Thomas Wegner rewrote the test suite to be much more maintainable.
Mike Guy noticed that many of the internal functions don’t support UTF8 strings properly; an important culprit is Perl_warner
, which means every warning or error message containing UTF8 data gets mangled. He wants something which sanitizes a string for display. Any takers?
Peter Prymmer hacked h2ph
to deal with C trigraphs - you remember them, the evil convention of using, say, “??=” instead of “#”. Urgh. He also fixed up some of the extensions to build more happily under VMS. Craig Berry also chipped in some extension patches for VMS.
Until next week I remain, your humble and obedient servant,
Mark-Jason Dominus - This week on perl5-porters (10 June–17 June 2001) - Notes - More -Wall fixes - Miscellaneous Darwin Updates - Hash accessor macros - iThreads development - Cross-compilation - SV Documentation - Various
Tags
Feedback
Something wrong with this article? Help us out by opening an issue or pull request on GitHub