Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.91k stars 542 forks source link

AutoLoader implies suitability for constants, fails to mention inlining incompatibility [patch] #15866

Open p5pRT opened 7 years ago

p5pRT commented 7 years ago

Migrated from rt.perl.org#130735 (status was 'open')

Searchable as RT130735$

p5pRT commented 7 years ago

From @wchristian

Created by @wchristian

The problem is with this section of the AutoLoader documentation​:

http​://perldoc.perl.org/AutoLoader.html#Overriding-*AutoLoader*'s-AUTOLOAD-Subroutine

It describes how to do certain things with the module\, but choses to make its example with constants\, despite the fact that AutoLoader cannot create inlinable constant functions\, due to always executing after compile time.

The attached patch adds a note of this limitation.

Perl Info ``` Flags: category=library severity=low module=AutoLoader Site configuration information for perl 5.18.4: Configured by strawberry-perl at Thu Oct 2 12:12:07 2014. Summary of my perl5 (revision 5 version 18 subversion 4) configuration: Platform: osname=MSWin32, osvers=6.3, archname=MSWin32-x86-multi-thread-64int uname='Win32 strawberry-perl 5.18.4.1 #1 Thu Oct 2 12:10:29 2014 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno-strict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.7.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib C:\strawberry\c\lib\gcc\i686-w64-mingw32\4.7.3 libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl518.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"' Locally applied patches: @INC for perl 5.18.4: C:/strawberry/perl/site/lib/MSWin32-x86-multi-thread-64int C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib . Environment for perl 5.18.4: CYGWIN=nodosfilewarning HOME (unset) LANG=en_US.utf8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\Program Files (x86)\ImageMagick-6.9.5-Q16;c:\python27\;c:\python27\scripts;c:\programdata\oracle\java\javapath;c:\windows\system32;c:\perl\site\bin;c:\perl\bin;c:\program files\intel\wifi\bin\;c:\program files\common files\intel\wirelesscommon\;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\program files (x86)\skype\phone\;c:\program files (x86)\miktex 2.9\miktex\bin\;c:\program files\git\cmd;c:\program files (x86)\intel\opencl sdk\2.0\bin\x86;c:\program files (x86)\intel\opencl sdk\2.0\bin\x64;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\TSVN\bin;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files\OpenVPN\bin;c:\cygwin\bin;C:\Program Files\PostgreSQL\pg95\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\FileBot\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\KFFirstAide;C:\Users\Mithaldu\AppData\Roaming\npm;d:\android\android-ndk-r10d\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;d:\j\MeCab\bin\;C:\Program Files (x86)\Diffuse;C:\Users\Mithaldu\AppData\Local\Microsoft\WindowsApps;C:\Program Files\GPAC PERL_BADLANG (unset) SHELL (unset) ```
p5pRT commented 7 years ago

From @wchristian

0001-AutoLoader-note-incompatibility-with-constant-inlini.patch ```diff From ebaa5bca18e0e78b78277f54cad889c2e3876555 Mon Sep 17 00:00:00 2001 From: Christian Walde Date: Tue, 7 Feb 2017 19:23:05 +0100 Subject: [PATCH] AutoLoader: note incompatibility with constant inlining --- cpan/AutoLoader/lib/AutoLoader.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpan/AutoLoader/lib/AutoLoader.pm b/cpan/AutoLoader/lib/AutoLoader.pm index 5546f9e..398fc0b 100644 --- a/cpan/AutoLoader/lib/AutoLoader.pm +++ b/cpan/AutoLoader/lib/AutoLoader.pm @@ -305,6 +305,11 @@ If any module's own AUTOLOAD subroutine has no need to fallback to the AutoLoader's AUTOLOAD subroutine (because it doesn't have any AutoSplit subroutines), then that module should not use B at all. +Note: Despite the example above talking about constants, there are +currently no circumstances under which a function loaded by AutoLoader +can be inlined as a constant. If you desire to make use of this +optimization AutoLoader can not be used. + =head2 Package Lexicals Package lexicals declared with C in the main block of a package -- 2.10.1.windows.1 ```
p5pRT commented 7 years ago

From @jkeenan

On Tue\, 07 Feb 2017 18​:31​:35 GMT\, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com\, generated with the help of perlbug 1.39 running under perl 5.18.4.

----------------------------------------------------------------- [Please describe your issue here]

The problem is with this section of the AutoLoader documentation​:

http​://perldoc.perl.org/AutoLoader.html#Overriding-*AutoLoader*'s- AUTOLOAD-Subroutine

It describes how to do certain things with the module\, but choses to make its example with constants\, despite the fact that AutoLoader cannot create inlinable constant functions\, due to always executing after compile time.

The attached patch adds a note of this limitation.

We have a bit of a technical problem here. The AutoLoader library is found within the core distribution under 'cpan/Autoloader/'. This suggests that it is maintained upstream on cpan rather than in blead. This impression is confirmed by its entry in Porting/Maintainers.pl.

However\, when I go to https://rt.cpan.org//Dist/Display.html?Queue=AutoLoader and click on "Preferred Bug Tracker\," I'm taken back to rt.perl.org -- which implies that it's maintained in core.

So we need to clarify where this bug report should go. copying the maintainer.

Thank you very much. Jim Keenan

-- James E Keenan (jkeenan@​cpan.org)

p5pRT commented 7 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 7 years ago

From @jkeenan

On Wed\, 08 Feb 2017 18​:30​:09 GMT\, jkeenan wrote​:

On Tue\, 07 Feb 2017 18​:31​:35 GMT\, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com\, generated with the help of perlbug 1.39 running under perl 5.18.4.

----------------------------------------------------------------- [Please describe your issue here]

The problem is with this section of the AutoLoader documentation​:

http​://perldoc.perl.org/AutoLoader.html#Overriding-*AutoLoader*'s- AUTOLOAD-Subroutine

It describes how to do certain things with the module\, but choses to make its example with constants\, despite the fact that AutoLoader cannot create inlinable constant functions\, due to always executing after compile time.

The attached patch adds a note of this limitation.

We have a bit of a technical problem here. The AutoLoader library is found within the core distribution under 'cpan/Autoloader/'. This suggests that it is maintained upstream on cpan rather than in blead. This impression is confirmed by its entry in Porting/Maintainers.pl.

However\, when I go to https://rt.cpan.org//Dist/Display.html?Queue=AutoLoader and click on "Preferred Bug Tracker\," I'm taken back to rt.perl.org -- which implies that it's maintained in core.

So we need to clarify where this bug report should go. copying the maintainer.

Thank you very much. Jim Keenan

I have not heard back from the listed maintainer (SMUELLER).

pumpking​: guidance requested.

Thank you very much.

-- James E Keenan (jkeenan@​cpan.org)

p5pRT commented 7 years ago

From @xsawyerx

On 02/26/2017 11​:41 PM\, James E Keenan via RT wrote​:

On Wed\, 08 Feb 2017 18​:30​:09 GMT\, jkeenan wrote​:

On Tue\, 07 Feb 2017 18​:31​:35 GMT\, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com\, generated with the help of perlbug 1.39 running under perl 5.18.4.

----------------------------------------------------------------- [Please describe your issue here]

The problem is with this section of the AutoLoader documentation​:

http​://perldoc.perl.org/AutoLoader.html#Overriding-*AutoLoader*'s- AUTOLOAD-Subroutine

It describes how to do certain things with the module\, but choses to make its example with constants\, despite the fact that AutoLoader cannot create inlinable constant functions\, due to always executing after compile time.

The attached patch adds a note of this limitation.

We have a bit of a technical problem here. The AutoLoader library is found within the core distribution under 'cpan/Autoloader/'. This suggests that it is maintained upstream on cpan rather than in blead. This impression is confirmed by its entry in Porting/Maintainers.pl.

However\, when I go to https://rt.cpan.org//Dist/Display.html?Queue=AutoLoader and click on "Preferred Bug Tracker\," I'm taken back to rt.perl.org -- which implies that it's maintained in core.

So we need to clarify where this bug report should go. copying the maintainer.

Thank you very much. Jim Keenan I have not heard back from the listed maintainer (SMUELLER).

pumpking​: guidance requested.

SMUELLER is sometimes overflowing in email. Let's give it another day or two.

p5pRT commented 7 years ago

From @xsawyerx

On Mon\, 27 Feb 2017 06​:06​:29 -0800\, xsawyerx@​gmail.com wrote​:

On 02/26/2017 11​:41 PM\, James E Keenan via RT wrote​:

On Wed\, 08 Feb 2017 18​:30​:09 GMT\, jkeenan wrote​:

On Tue\, 07 Feb 2017 18​:31​:35 GMT\, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com\, generated with the help of perlbug 1.39 running under perl 5.18.4.

----------------------------------------------------------------- [Please describe your issue here]

The problem is with this section of the AutoLoader documentation​:

http​://perldoc.perl.org/AutoLoader.html#Overriding-*AutoLoader*'s- AUTOLOAD-Subroutine

It describes how to do certain things with the module\, but choses to make its example with constants\, despite the fact that AutoLoader cannot create inlinable constant functions\, due to always executing after compile time.

The attached patch adds a note of this limitation.

We have a bit of a technical problem here. The AutoLoader library is found within the core distribution under 'cpan/Autoloader/'. This suggests that it is maintained upstream on cpan rather than in blead. This impression is confirmed by its entry in Porting/Maintainers.pl.

However\, when I go to https://rt.cpan.org//Dist/Display.html?Queue=AutoLoader and click on "Preferred Bug Tracker\," I'm taken back to rt.perl.org -- which implies that it's maintained in core.

So we need to clarify where this bug report should go. copying the maintainer.

Thank you very much. Jim Keenan I have not heard back from the listed maintainer (SMUELLER).

pumpking​: guidance requested.

SMUELLER is sometimes overflowing in email. Let's give it another day or two.

Now knowing the maintainer is overwhelmed with other issues at the moment\, I think we need to decide whether to move this into core or not without him. He's fine with it.

The benefit of bringing it into core is that it's widely used enough that I would consider crucial\, and will benefit from having a net of developers\, which is why I'm leaning towards that.

toddr commented 4 years ago

@xsawyerx what did you decide?

xsawyerx commented 4 years ago

We should move AutoLoader to core.

khwilliamson commented 4 years ago

On 4/10/20 4:54 AM, Sawyer X wrote:

We should move |AutoLoader| to core.

When?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Perl/perl5/issues/15866#issuecomment-611982632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2DHZ5NMBKWDIVT526AOLRL33FDANCNFSM4KU5ZP2A.

jkeenan commented 4 years ago

On 4/10/20 4:54 AM, Sawyer X wrote: We should move |AutoLoader| to core. When?

We're in code freeze. Hence, my recommendation: 5.33.1.

jkeenan commented 4 years ago

On 4/10/20 4:54 AM, Sawyer X wrote: We should move |AutoLoader| to core. When?

We're in code freeze. Hence, my recommendation: 5.33.1.

I've created https://github.com/Perl/perl5/issues/17707 to track transfer of AutoLoader to dist/. I recommend that we move further discussion of the transfer (including its timing) to that ticket, and that we retain this ticket to focus on the issue raised, and patch submitted, by the original poster in Feb 2017.

Thank you very much. Jim Keenan

jkeenan commented 4 years ago

On 4/10/20 4:54 AM, Sawyer X wrote: We should move |AutoLoader| to core. When?

We're in code freeze. Hence, my recommendation: 5.33.1.

I've created #17707 to track transfer of AutoLoader to dist/. I recommend that we move further discussion of the transfer (including its timing) to that ticket, and that we retain this ticket to focus on the issue raised, and patch submitted, by the original poster in Feb 2017.

Thank you very much. Jim Keenan

To get back to the original subject of this ticket ... Is the following patch to AutoLoader.pm's documentation valid?

+Note: Despite the example above talking about constants, there are
+currently no circumstances under which a function loaded by AutoLoader
+can be inlined as a constant. If you desire to make use of this
+optimization AutoLoader can not be used.
+