Closed p5pRT closed 18 years ago
Perl's .pmc files are not documented\, and don't seem to add value to require.
While stracing the perl interpreter today\, I saw it stating .pmc files when I didn't expected.
The 'standard' .pod documentation (the perl* pods mentioned in perldoc perl) don't mention requrire stating .pmc files
I later found some documentation in B::Bytecode that mentions files with .pmc extension. but that doesn't seem to generate a .pmc file that is compatible with what the perl interpreter is looking for.
$ cat Echo.pm warn "Hello World\n"; $ perl -MO=Bytecode\,-uEcho\,-oEcho.pmc Echo.pm Echo.pm syntax OK dd:dcd$ perl -e 'require Echo' Number found where operator expected at Echo.pm line 1\, near "linux" syntax error at Echo.pm line 1\, near "linux" Compilation failed in require at -e line 1.
Since that didn't work\, I tried
$ cp Echo.pm Echo2.pmc $ perl -e 'require Echo2' Hello World
If .pmc files are supposed to work in some fasion\, they should be documented.
If they don't add any value\, there should be a configuration option to not use them\, thus avoiding potentially expensive stats when requiring files.
What you want is B::C.
@cwest - Status changed from 'open' to 'resolved'
On Fri\, 9 May 2003 at 15:47 -0000\, Casey West \perlbug\-followup@​perl\.org wrote:
What you want is B::C.
Casey\, I'm not sure why you say I want B::C. I didn't see B::C mentioning .pmc files\, so perhaps you are trying to tell me that there is a better way to generate an .pmc file using B::C
My bug report was that .pmc files don't seem to be documented\, but yet perl stat's and uses .pmc files.
I was thinking that if the code in S_doopen_pmc() in pp_ctl.c is not supposed to work then .pmc files should be removed.
S_doopen_pmc(pTHX_ const char *name\, const char *mode) { STRLEN namelen = strlen(name); PerlIO *fp;
if (namelen > 3 && strEQ(name + namelen - 3\, ".pm")) { SV *pmcsv = Perl_newSVpvf(aTHX_ "%s%c"\, name\, 'c'); char *pmc = SvPV_nolen(pmcsv); Stat_t pmstat; Stat_t pmcstat; if (PerlLIO_stat(pmc\, &pmcstat) \< 0) { fp = PerlIO_open(name\, mode); }
When I looked around a little more I found $ perlcc -B file # Compiles using the bytecode backend mentioned in perldoc perlcc
I tried some variations on that and was able to get the desired results
dd:tmp$ perlcc -B Echo.pm -o Echo.pmc /usr/local/bin/perlcc: Will not create a shared library for bytecode dd:tmp$ perl -e 'require Echo' Hello World
I think that the bug I reported was based on the instructions in ext/B/NOTES that states perl -MO=Bytecode\,-m\,-oFoo.pmc Foo.pm
I now see the disclamer in perlcompile.pod :-) B::Bytecode Stores the parse tree in a machine-independent format\, suitable for later reloading through the ByteLoader module. Status: 5 (some things work\, some things don't\, some things are untested).
This really isn't resolved\, as perldoc -f require states
If EXPR is a bareword\, the require assumes a ".pm" extension and replaces "::" with "/" in the filename for you\, to make it easy to load standard modules. This form of loading of modules does not risk altering your namespace.
but it doesn't mention .pmc.
If an appropriate file with a .pmc extension exists (and is newer than a similar .pm file\, or no .pm file is found) perl will load the .pmc file.
This behavior is not documented in perldoc -f require.
dd:tmp$ cat Echo.pm warn "Hello World\n"; dd:tmp$ cat Echox.pm warn "Goodbye World\n";
dd:tmp$ perlcc -B Echo.pm -o Echox.pmc /usr/local/bin/perlcc: Will not create a shared library for bytecode dd:tmp$ touch Echox.pm dd:tmp$ perl -le 'require Echox' Goodbye World dd:tmp$ touch Echox.pmc dd:tmp$ perl -le 'require Echox' Hello World
Same perl code\, different output\, based on timestamps of .pm and .pmc files!
On Fri\, 9 May 2003 at 15:47 -0000\, Casey West via RT \<perlbug-followup@perl...:
From: Casey West via RT \perlbug\-followup@​perl\.org To: dcd Date: 9 May 2003 15:47:29 -0000 Subject: [perl #8860] [RESOLVED] .pmc extension not documented in require
According to our records\, your request regarding ".pmc extension not documented in require" has been resolved.
If you have any further questions or concerns on the above subject\, please respond to this message.
For other topics\, please create a new ticket.
Please don't feel obligated to say "Thanks" or "Kudos" or "I want to have your child" or "I owe you a beer" -- if you respond to this message it will reopen the ticket. If you must\, please send email directly to the person who handled your ticket\, and not to the tracking system.
\<URL: http://rt.perl.org/rt2/Ticket/Display.html?id=8860 >
It was Friday\, May 09\, 2003 when David Dyck took the soap box\, saying: : : This really isn't resolved\, as : perldoc -f require states : : : If EXPR is a bareword\, the require assumes a ".pm" : extension and replaces "::" with "/" in the : filename for you\, to make it easy to load standard : modules. This form of loading of modules does not : risk altering your namespace. : : but it doesn't mention .pmc.
Now it does\, see patch below.
Casey West
-- "DOS addresses only 1 Megabyte of RAM because we cannot imagine any applications needing more." -- Microsoft\, 1980\, on the development of DOS
Casey West wrote:
Now it does\, see patch below.
I believe L\<B::ByteCode|B::ByteCode> should be L\<B::Bytecode|B::Bytecode>. BTW\, good work with these patches.
Casey West
-- dug
It was Friday\, May 09\, 2003 when Douglas Hunter took the soap box\, saying: : Casey West wrote: : : >Now it does\, see patch below. : > : : I believe L\<B::ByteCode|B::ByteCode> should be : L\<B::Bytecode|B::Bytecode>. BTW\, good work with these patches.
Excellent point (dang mac os)\, thank thanks. :-)
Casey West
-- Shooting yourself in the foot with MS-Windows The gun blows up in your hand.
Casey West wrote:
It was Friday\, May 09\, 2003 when Douglas Hunter took the soap box\, saying: : Casey West wrote: : : >Now it does\, see patch below. : > : : I believe L\<B::ByteCode|B::ByteCode> should be : L\<B::Bytecode|B::Bytecode>. BTW\, good work with these patches.
Excellent point (dang mac os)\, thank thanks. :-)
Thanks thanks thanks\, apppplied\, as #19466\, at least this is going to be documented.
--- perl-current.orig/pod/perlfunc.pod Fri May 9 00:58:19 2003 +++ perl-current/pod/perlfunc.pod Fri May 9 16:58:23 2003 @@ -4056\,6 +4056\,15 @@
eval "require $class";
+Now that you understand how C\
looks for files in the case of +a bareword argument\, there is a little extra functionality going on +behind the scenes. Before C\ looks for a "F\<.pm>" extension\, +it will first look for a filename with a "F\<.pmc>" extension. A file +with this extension is assumed to be Perl bytecode generated by +L\<B::Bytecode|B::Bytecode>. If this file is found\, and it's modification +time is newer than a coinciding "F\<.pm>" non-compiled file\, it will be +loaded in place of that non-compiled file ending in a "F\<.pm>" extension.
@rgs - Status changed from 'open' to 'resolved'
David Dyck \david\.dyck@​fluke\.com writes:
This really isn't resolved\, as perldoc -f require states
If EXPR is a bareword\, the require assumes a "\.pm" extension and replaces "​::" with "/" in the filename for you\, to make it easy to load standard modules\. This form of loading of modules does not risk altering your namespace\.
but it doesn't mention .pmc.
IIRC we decided that .pmc logic was going to be deprecated or deleted.
-- Nick Ing-Simmons http://www.ni-s.u-net.com/
Nick Ing-Simmons \nick@​ing\-simmons\.net writes:
David Dyck \david\.dyck@​fluke\.com writes:
This really isn't resolved\, as perldoc -f require states
If EXPR is a bareword\, the require assumes a "\.pm" extension and replaces "​::" with "/" in the filename for you\, to make it easy to load standard modules\. This form of loading of modules does not risk altering your namespace\.
but it doesn't mention .pmc.
IIRC we decided that .pmc logic was going to be deprecated or deleted.
Or maybe better to hide the logic behind #ifdef's.
Regards\, Slaven
-- Slaven Rezic - slaven@rezic.de
Tk-AppMaster: a perl/Tk module launcher designed for handhelds http://tk-appmaster.sf.net
Slaven Rezic wrote:
Nick Ing-Simmons \nick@​ing\-simmons\.net writes:
IIRC we decided that .pmc logic was going to be deprecated or deleted.
Or maybe better to hide the logic behind #ifdef's.
I'd like to hide it behind a "#ifndef PERL_USE_PMC_FILES". So the functionality is here unless we want to build a perl tailored for compilation speed (CGI applications come to mind.)
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
On Sun\, May 11\, 2003 at 10:50:47PM +0200\, Rafael Garcia-Suarez wrote:
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
Please don't. I just restarted now to revamp Bytecode after a looong delay (sorry)
- with some success - it passes all of t/base\, and most of t/comp and t/op ( allmost all failures are in tests which play with DATA handle ). I hope I get it right before 5.8.1.
Regards\, Adi
Rafael Garcia-Suarez \rgarciasuarez@​free\.fr writes:
Slaven Rezic wrote:
Nick Ing-Simmons \nick@​ing\-simmons\.net writes:
IIRC we decided that .pmc logic was going to be deprecated or deleted.
Or maybe better to hide the logic behind #ifdef's.
I'd like to hide it behind a "#ifndef PERL_USE_PMC_FILES".
So long as the name of the define and the sense of the #ifn?def make sense.
So the functionality is here unless we want to build a perl tailored for compilation speed (CGI applications come to mind.)
For various devious reasons related to selecting versions of modules I often have lots of things in @INC - the extra (futile) attempts to open .pmc slows things down even more.
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
Until bytecode loads faster than or is smaller than the .pm file I fail to see the point in it. It does not even hide much now that Deparse is so good.
-- Nick Ing-Simmons http://www.ni-s.u-net.com/
On måndag\, maj 12\, 2003\, at 09:43 Europe/Stockholm\, Nick Ing-Simmons wrote:
So long as the name of the define and the sense of the #ifn?def make sense.
So the functionality is here unless we want to build a perl tailored for compilation speed (CGI applications come to mind.)
For various devious reasons related to selecting versions of modules I often have lots of things in @INC - the extra (futile) attempts to open .pmc slows things down even more.
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
Until bytecode loads faster than or is smaller than the .pm file I fail to see the point in it. It does not even hide much now that Deparse is so good.
Why hide it?
I say keep it so people are encouraged to work on ByteCode or perhaps remove it and put it on the todo that ByteCodeloader should be implemented as a coderef in INC
Arthur
On Mon\, May 12\, 2003 at 10:36:40AM +0200\, Arthur Bergman wrote:
Why hide it?
I say keep it so people are encouraged to work on ByteCode or perhaps remove it and put it on the todo that ByteCodeloader should be implemented as a coderef in INC
I completely hate the ByteLoader design but I already spent a lot of hours on it and I promised to make it work - so I have to do it :)
And about hiding - ByteLoader can nuke Deparse by stripping the syntax tree - see if I make this work again.
Since the .pmc has been there for years without ByteLoader working at all I think it should stay there now that it kinda works again.
OK for #ifndef'ing it out but please don't make this the default.
Regards\, Adi
Arthur Bergman \sky@​nanisky\.com writes:
Why hide it?
I say keep it so people are encouraged to work on ByteCode or perhaps remove it and put it on the todo that ByteCodeloader should be implemented as a coderef in INC
You can take by complaints as a vote for the latter.
-- Nick Ing-Simmons http://www.ni-s.u-net.com/
In article \20030511225047\.6b713c9b\.rgarciasuarez@​free\.fr\, rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:
Slaven Rezic wrote:
Nick Ing-Simmons \nick@​ing\-simmons\.net writes:
IIRC we decided that .pmc logic was going to be deprecated or deleted.
Or maybe better to hide the logic behind #ifdef's.
I'd like to hide it behind a "#ifndef PERL_USE_PMC_FILES". So the functionality is here unless we want to build a perl tailored for compilation speed (CGI applications come to mind.)
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
Well if we keep them with the same name won't they be a bit confusing for people when Perl 6/Parrot comes out with a different idea of what a .pmc file is?
-- Peter Scott
Peter Scott \Peter@​PSDT\.com writes:
In article \20030511225047\.6b713c9b\.rgarciasuarez@​free\.fr\, rgarciasuarez@free.fr (Rafael Garcia-Suarez) writes:
Slaven Rezic wrote:
Nick Ing-Simmons \nick@​ing\-simmons\.net writes:
IIRC we decided that .pmc logic was going to be deprecated or deleted.
Or maybe better to hide the logic behind #ifdef's.
I'd like to hide it behind a "#ifndef PERL_USE_PMC_FILES". So the functionality is here unless we want to build a perl tailored for compilation speed (CGI applications come to mind.)
Or do we really want to kill .pmc files ? That somehow implies some lack of support for B::Bytecode. (not untrue.)
Well if we keep them with the same name won't they be a bit confusing for people when Perl 6/Parrot comes out with a different idea of what a .pmc file is?
Ah yes that was the other reason I had 'em on my hit list.
-- Nick Ing-Simmons http://www.ni-s.u-net.com/
On måndag\, maj 12\, 2003\, at 18:22 Europe/Stockholm\, Nick Ing-Simmons wrote:
Well if we keep them with the same name won't they be a bit confusing for people when Perl 6/Parrot comes out with a different idea of what a .pmc file is?
Ah yes that was the other reason I had 'em on my hit list.
Perhaps parrot which came along later is the one that should change?
Arthur
[sky@nanisky.com - Mon May 12 10:54:04 2003]:
On måndag\, maj 12\, 2003\, at 18:22 Europe/Stockholm\, Nick Ing-Simmons wrote:
Well if we keep them with the same name won't they be a bit confusing for people when Perl 6/Parrot comes out with a different idea of what a .pmc file is?
Ah yes that was the other reason I had 'em on my hit list.
Perhaps parrot which came along later is the one that should change?
It appears that Perl 5 .pmc files are being used for various Perl 6 projects. Removing or deprecating them now seems to be a bad thing.
@smpeters - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#8860 (status was 'resolved')
Searchable as RT8860$