develooper Front page | perl.perl5.porters | Postings from September 2012

NWCLARK TPF grant report #52

From:
Nicholas Clark
Date:
September 7, 2012 13:55
Subject:
NWCLARK TPF grant report #52
Message ID:
20120907205546.GE9834@plum.flirble.org
[Hours]		[Activity]
2012/08/27	Monday
 0.25		File::Find::find and chdir
 0.50		bootstrapping Will Braswell
 2.50		reading/responding to list mail
 3.50		smartmatch
=====
 6.75

2012/08/28	Tuesday
 2.00		File::Find::find and chdir
 0.25		bootstrapping Will Braswell
 0.50		process, scalability, mentoring
 1.25		reading/responding to list mail
 0.50		t/porting/filenames.t
=====
 4.50

2012/08/29	Wednesday
 1.50		RT #114174, RT #114176, RT #114194, RT #114296, RT #114532
 0.75		RT #114576
 0.50		bootstrapping Will Braswell
 0.75		process, scalability, mentoring
 3.50		reading/responding to list mail
 1.50		smartmatch
 0.75		smartmatch, junctions
 0.25		smoke-me branches
=====
 9.50

2012/08/30	Thursday
 1.75		RT #114118
 0.25		RT #114410
 1.25		Remove support for VM/ESA
 2.50		bootstrapping Will Braswell
 0.75		hashes
 0.00		reading/responding to list mail
=====
 6.50

2012/08/31	Friday
 0.25		Cwd.xs
 0.25		PTR2NV
 0.75		RT #114410
 0.75		RT #114602
 0.25		Remove support for VM/ESA
 0.25		dl_aix.xs
 3.75		newCONSTSUB
 0.25		perlport
 0.25		process, scalability, mentoring
 0.75		reading/responding to list mail
=====
 7.50

2012/09/01	Saturday
 0.25		RT #114312
 0.25		darwin SEGV
 1.00		optimising sub entry
 0.50		process, scalability, mentoring
=====
 2.00

2012/09/02	Sunday
 1.50		PL_main_start/PL_main_root
 0.75		reading/responding to list mail
=====
 2.25

Which I calculate is 39.00 hours

I managed to write tests for the various blocks of code in op.c which calls
CopLINE_set(PL_curcop, oldline), related to generating better warnings from
multi-line constructions. All that is, except this code in newCONSTSUB:

    if (IN_PERL_RUNTIME) {
	/* at runtime, it's not safe to manipulate PL_curcop: it may be
	 * an op shared between threads. Use a non-shared COP for our
	 * dirty work */
	 SAVEVPTR(PL_curcop);
	 SAVECOMPILEWARNINGS();
	 PL_compiling.cop_warnings = DUP_WARNINGS(PL_curcop->cop_warnings);
	 PL_curcop = &PL_compiling;
    }
    SAVECOPLINE(PL_curcop);
    CopLINE_set(PL_curcop, PL_parser ? PL_parser->copline : NOLINE);


This all feels hacky. Why does it need to be set...

So, I think that it contributes to the following bug. Sorry it's not
clear, but note that some of the line numbers in the redefined
warnings *differ* depending on whether it's in a BEGIN block:

$ ./perl -Ilib -we 'eval qq{ {\n\n\nDynaLoader::boot_DynaLoader("DynaLoader")}}; eval qq{{\n\n\nDynaLoader::boot_DynaLoader("DynaLoader")}}'
Subroutine DynaLoader::dl_load_file redefined at (eval 2) line 4.
Subroutine DynaLoader::dl_unload_file redefined at (eval 2) line 4.
Subroutine DynaLoader::dl_find_symbol redefined at (eval 2) line 4.
Subroutine DynaLoader::dl_undef_symbols redefined at (eval 2) line 4.
Subroutine DynaLoader::dl_install_xsub redefined at (eval 2) line 4.
Subroutine DynaLoader::dl_error redefined at (eval 2) line 4.
$ ./perl -Ilib -we 'eval qq{ {\n\n\nDynaLoader::boot_DynaLoader("DynaLoader")}}; eval qq{BEGIN {\n\n\nDynaLoader::boot_DynaLoader("DynaLoader")}}'
Subroutine DynaLoader::dl_load_file redefined at (eval 2) line 1.
Subroutine DynaLoader::dl_unload_file redefined at (eval 2) line 1.
Subroutine DynaLoader::dl_find_symbol redefined at (eval 2) line 1.
Subroutine DynaLoader::dl_undef_symbols redefined at (eval 2) line 1.
Subroutine DynaLoader::dl_install_xsub redefined at (eval 2) line 1.
Subroutine DynaLoader::dl_error redefined at (eval 2) line 1.


ie "line 4" vs "line 1" despite the fact that the only difference between
the two overlong 1-liners is the six character string "BEGIN "


So, I'd like to take the above code out. If I remove it, the build fails:

GLOB_CSH is not a valid File::Glob macro at ../lib/File/Glob.pm line 66

The problem comes down to this bit of Perl_gv_fetchpvn_flags():

    if (!stash) {
    no_stash:
	if (len && isIDFIRST_lazy(name)) {
...
	    if (global)
		stash = PL_defstash;
	    else if (IN_PERL_COMPILETIME) {
		stash = PL_curstash;
...
	    }
	    else
		stash = CopSTASH(PL_curcop);


$expletive. The behaviour of the function Perl_gv_fetchpvn_flags() differs
between "Compile Time" and "Run Time". That's really, um, less than awesome.
(This also isn't the only place deep within a function unrelated to parsing
or optree building that behaviour differs depending on whether
IN_PERL_COMPILETIME is true of false. You can laugh, or you can cry, or
maybe you should do both at the same time.)

Specifically, the way that newCONSTSUB_flags() actually controls how
gv_fetchpvn_flags() gets a stash to default from is by

* setting PL_curstash to the stash to use
* assigning &PL_compiling to PL_curcop to make gv_fetchpvn_flags() notice this.


This is not sane.

I think that the right way to fix this is to have a way to pass the default
stash into Perl_gv_fetchpvn_flags(). Or even split it into two - one half
that locates the stash to use, and the other half that takes a stash, and
does the initialisation. So that code can be changed to something like this:

@@ -1521,7 +1529,9 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN fu
 
     if (!stash) {
     no_stash:
-       if (len && isIDFIRST_lazy(name)) {
+        if (def_stash) {
+            stash = def_stash;
+        } else if (len && isIDFIRST_lazy(name)) {
            bool global = FALSE;
 
            switch (len) {

However, it's not at all clear to me how to cleanly get that def_stash into
there. I sent a very ugly proof of concept code to perl5-porters, with which
all tests pass and my convoluted example becomes consistent. But it's a
total bodge, and it's not clear to me (or anyone who has looked at this
previously) what the right way to proceed is. We know where we want to be,
but "If I were you sir, I wouldn't start from here".


The other thing of note this week was that after Steve Hay shipped v5.17.3,
I removed support for VM/ESA. VM/ESA was a mainframe OS. IBM ended service
on it in June 2003. It was superseded by Z/VM.

 Cross/Makefile-cross-SH       |   3 -
 MANIFEST                      |   6 -
 Makefile.SH                   |   3 -
 Porting/perlhist_calculate.pl |   2 +-
 README.bs2000                 |   2 +-
 README.os390                  |   2 +-
 README.vmesa                  | 140 ----------
 ext/DynaLoader/dl_vmesa.xs    | 196 --------------
 ext/Errno/Errno_pm.PL         |   5 +-
 hints/vmesa.sh                | 342 ------------------------
 lib/perl5db.pl                |   3 +-
 perl.c                        |   4 -
 perl.h                        |   7 +-
 plan9/mkfile                  |   2 +-
 pod/perl.pod                  |   1 -
 pod/perl58delta.pod           |   4 +-
 pod/perldelta.pod             |   9 +-
 pod/perlebcdic.pod            |   4 -
 pod/perlfunc.pod              |   2 +-
 pod/perlport.pod              |  31 +--
 pp_sys.c                      |  12 -
 t/io/pipe.t                   |  10 +-
 t/op/magic.t                  |   2 +-
 thread.h                      |   5 +-
 util.c                        |   6 +-
 vmesa/Makefile                |  15 --
 vmesa/vmesa.c                 | 592 ------------------------------------------
 vmesa/vmesaish.h              |  10 -
 win32/Makefile                |   4 +-
 win32/makefile.mk             |   4 +-
 x2p/a2p.h                     |   2 +-
 31 files changed, 39 insertions(+), 1391 deletions(-)

The plan is to continue removing one per dev release until the code freeze.
The list of suspected "special biologist word for stable" platforms is here:

https://metacpan.org/module/RJBS/perl-5.16.0/pod/perldelta.pod#Platforms-with-no-supporting-programmers:

Nicholas Clark



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About