From: Nicholas Clark Date: Sun, 29 Oct 2006 18:30:25 +0000 (+0000) Subject: Add the note from change 25773 about auditing for destruction ordering. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6d71adcd08598698fcddf4d2e47f1893427c4e79;p=p5sagit%2Fp5-mst-13.2.git Add the note from change 25773 about auditing for destruction ordering. p4raw-id: //depot/perl@29130 --- diff --git a/pod/perltodo.pod b/pod/perltodo.pod index c85174e..bae2fa9 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -478,6 +478,127 @@ ever creep back to libperl.a. Note, of course, that this will only tell whether B platform is using those naughty interfaces. +=head2 Audit the code for destruction ordering assumptions + +Change 25773 notes + + +=head2 Allocate OPs from arenas + +Currently all new OP structures are individually malloc()ed and free()d. +All C implementations have space overheads, and are now as fast as +custom allocates so it would both use less memory and less CPU to allocate +the various OP structures from arenas. The SV arena code can probably be +re-used for this. + +=head2 Improve win32/wince.c + +Currently, numerous functions look virtually, if not completely, +identical in both C and C files, which can't +be good. + +=head1 Tasks that need a knowledge of XS + +These tasks would need C knowledge, and roughly the level of knowledge of +the perl API that comes from writing modules that use XS to interface to +C. + +=head2 shrink Cs + +By removing unused elements and careful re-ordering, the structures for Cs, +Cs, Cs and Cs have recently been shrunk considerably. Cs +probably aren't worth it, as typical programs don't use more than 8, and +(at least) C uses C/C/C on a C, +so it would mean code changes to modules on CPAN. Cs might have some +savings to win. + +=head2 autovivification + +Make all autovivification consistent w.r.t LVALUE/RVALUE and strict/no strict; + +This task is incremental - even a little bit of work on it will help. + +=head2 Unicode in Filenames + +chdir, chmod, chown, chroot, exec, glob, link, lstat, mkdir, open, +opendir, qx, readdir, readlink, rename, rmdir, stat, symlink, sysopen, +system, truncate, unlink, utime, -X. All these could potentially accept +Unicode filenames either as input or output (and in the case of system +and qx Unicode in general, as input or output to/from the shell). +Whether a filesystem - an operating system pair understands Unicode in +filenames varies. + +Known combinations that have some level of understanding include +Microsoft NTFS, Apple HFS+ (In Mac OS 9 and X) and Apple UFS (in Mac +OS X), NFS v4 is rumored to be Unicode, and of course Plan 9. How to +create Unicode filenames, what forms of Unicode are accepted and used +(UCS-2, UTF-16, UTF-8), what (if any) is the normalization form used, +and so on, varies. Finding the right level of interfacing to Perl +requires some thought. Remember that an OS does not implicate a +filesystem. + +(The Windows -C command flag "wide API support" has been at least +temporarily retired in 5.8.1, and the -C has been repurposed, see +L.) + +=head2 Unicode in %ENV + +Currently the %ENV entries are always byte strings. + +=head2 use less 'memory' + +Investigate trade offs to switch out perl's choices on memory usage. +Particularly perl should be able to give memory back. + +This task is incremental - even a little bit of work on it will help. + +=head2 Re-implement C<:unique> in a way that is actually thread-safe + +The old implementation made bad assumptions on several levels. A good 90% +solution might be just to make C<:unique> work to share the string buffer +of SvPVs. That way large constant strings can be shared between ithreads, +such as the configuration information in F. + +=head2 Make tainting consistent + +Tainting would be easier to use if it didn't take documented shortcuts and +allow taint to "leak" everywhere within an expression. + +=head2 readpipe(LIST) + +system() accepts a LIST syntax (and a PROGRAM LIST syntax) to avoid +running a shell. readpipe() (the function behind qx//) could be similarly +extended. + +=head2 strcat(), strcpy(), strncat(), strncpy(), sprintf(), vsprintf() + +Maybe create a utility that checks after each libperl.a creation that +none of the above (nor sprintf(), vsprintf(), or *SHUDDER* gets()) +ever creep back to libperl.a. + + nm libperl.a | ./miniperl -alne '$o = $F[0] if /:$/; print "$o $F[1]" if $F[0] eq "U" && $F[1] =~ /^(?:strn?c(?:at|py)|v?sprintf|gets)$/' + +Note, of course, that this will only tell whether B platform +is using those naughty interfaces. + +=head2 Audit the code for destruction ordering assumptions + +Change 25773 notes + + /* Need to check SvMAGICAL, as during global destruction it may be that + AvARYLEN(av) has been freed before av, and hence the SvANY() pointer + is now part of the linked list of SV heads, rather than pointing to + the original body. */ + /* FIXME - audit the code for other bugs like this one. */ + +adding the C check to + + if (AvARYLEN(av) && SvMAGICAL(AvARYLEN(av))) { + MAGIC *mg = mg_find (AvARYLEN(av), PERL_MAGIC_arylen); + +Go through the core and look for similar assumptions that SVs have particular +types, as all bets are off during global destruction. + =head1 Tasks that need a knowledge of the interpreter These tasks would need C knowledge, and knowledge of how the interpreter works,