FAQ
Dear Perl Porters,

I see that 5.8.1 is nearing completion - are there any chances that
the Bytecode compiler/loader will work ok? My 5.8.0 (Solaris 7,
Sparc, Forte 6.2) compiles happily with perlcc, but won't run a
simple hello world...

Thanks & best regards,

Marek

Search Discussions

  • Nicholas Clark at Mar 17, 2003 at 9:35 pm

    On Mon, Mar 17, 2003 at 05:28:37PM +0100, marek.rouchal@infineon.com wrote:
    Dear Perl Porters,

    I see that 5.8.1 is nearing completion - are there any chances that
    the Bytecode compiler/loader will work ok? My 5.8.0 (Solaris 7,
    Sparc, Forte 6.2) compiles happily with perlcc, but won't run a
    simple hello world...
    I fear that the chances of any changes happening to the bytecode compiler/
    loader are slim indeed. It seems to be very broken:

    5.6.1:

    $ cat hw.pl
    print "Hello world from perl $]\n"
    $ /usr/bin/perlcc -B hw.pl
    $ ls -l a.out
    -rwxrwxr-x 1 nick nick 1195 Mar 17 21:28 a.out
    $ ./a.out
    Hello world from perl 5.006001

    5.8.0

    $ perlcc5.8.0 -B hw.pl
    $ ls -l a.out
    -rwxrwxr-x 1 nick nick 3318 Mar 17 21:29 a.out
    $ ./a.out
    $ perl5.8.0 -MB::Deparse a.out
    $

    $ perlcc5.9.0 -B hw.pl
    /usr/local/bin/perlcc5.9.0: hw.pl did not compile, which can't happen:
    234: no such instruction "xcv_outside_seq"
    323: no such instruction "xcv_outside_seq"
    631: no such instruction "xcv_outside_seq"
    668: no such instruction "xcv_outside_seq"
    705: no such instruction "xcv_outside_seq"
    742: no such instruction "xcv_outside_seq"
    779: no such instruction "xcv_outside_seq"
    816: no such instruction "xcv_outside_seq"
    853: no such instruction "xcv_outside_seq"
    890: no such instruction "xcv_outside_seq"
    927: no such instruction "xcv_outside_seq"
    964: no such instruction "xcv_outside_seq"
    1001: no such instruction "xcv_outside_seq"
    1038: no such instruction "xcv_outside_seq"
    1075: no such instruction "xcv_outside_seq"
    1114: no such instruction "xcv_outside_seq"
    1153: no such instruction "xcv_outside_seq"
    1192: no such instruction "xcv_outside_seq"
    1233: no such instruction "xcv_outside_seq"
    1270: no such instruction "xcv_outside_seq"
    1494: no such instruction "xcv_outside_seq"
    1585: no such instruction "xcv_outside_seq"
    2286: no such instruction "xcv_outside_seq"
    4471: no such instruction "xcv_outside_seq"
    5117: no such instruction "xcv_outside_seq"
    5638: no such instruction "xcv_outside_seq"
    5677: no such instruction "xcv_outside_seq"
    5856: no such instruction "xcv_outside_seq"
    7215: no such instruction "xcv_outside_seq"
    7480: no such instruction "xcv_outside_seq"
    There were 30 assembly errors
    CHECK failed--call queue aborted.

    $ ls -l a.out
    -rwxrwxr-x 1 nick nick 48 Mar 17 21:29 a.out
    $ cat a.out
    #!/usr/local/bin/perl5.9.0
    use ByteLoader 0.04;

    (all 2 lines)

    This probably all ought to be logged as a bug.

    Nicholas Clark
  • Dave Mitchell at Mar 19, 2003 at 9:30 pm

    On Mon, Mar 17, 2003 at 09:32:06PM +0000, Nicholas Clark wrote:
    I fear that the chances of any changes happening to the bytecode compiler/
    loader are slim indeed. It seems to be very broken: [snip]
    $ perlcc5.9.0 -B hw.pl
    /usr/local/bin/perlcc5.9.0: hw.pl did not compile, which can't happen:
    234: no such instruction "xcv_outside_seq"
    ....

    xcv_outside_seq is a new field I added to the CV struct a few months ago;
    at the time I also blindly patched ext/B/B/Bytecode.pm and C.pm at the
    places where they appeared to have mentions of other fields from
    CV. I mentioned at the time that I didn't understand any of this, and
    that it was probably wrong.

    I now amend that statement to "I don't understand any of this, but it's
    definitely wrong" :-(

    I've just spent an hour rumaging around in B/B/, but don't have a clue
    what any of it means.

    :-((

    --
    "But Sidley Park is already a picture, and a most amiable picture too.
    The slopes are green and gentle. The trees are companionably grouped at
    intervals that show them to advantage. The rill is a serpentine ribbon
    unwound from the lake peaceably contained by meadows on which the right
    amount of sheep are tastefully arranged." Lady Croom - Arcadia
  • Enache Adrian at Mar 19, 2003 at 11:05 pm

    On Wed, Mar 19, 2003 at 09:30:46PM +0000, Dave Mitchell wrote:
    On Mon, Mar 17, 2003 at 09:32:06PM +0000, Nicholas Clark wrote:
    I fear that the chances of any changes happening to the bytecode compiler/
    loader are slim indeed. It seems to be very broken: [snip]
    $ perlcc5.9.0 -B hw.pl
    /usr/local/bin/perlcc5.9.0: hw.pl did not compile, which can't happen:
    234: no such instruction "xcv_outside_seq"
    ....

    xcv_outside_seq is a new field I added to the CV struct a few months ago;
    at the time I also blindly patched ext/B/B/Bytecode.pm and C.pm at the
    places where they appeared to have mentions of other fields from
    CV. I mentioned at the time that I didn't understand any of this, and
    that it was probably wrong.

    I now amend that statement to "I don't understand any of this, but it's
    definitely wrong" :-(

    I've just spent an hour rumaging around in B/B/, but don't have a clue
    what any of it means.

    :-((
    Looks like you just forgot to add it to bytecode.pl too.

    diff -rup /arc/perl-current/bytecode.pl ./bytecode.pl
    --- /arc/perl-current/bytecode.pl 2003-03-08 10:01:39.000000000 +0200
    +++ ./bytecode.pl 2003-03-20 00:40:42.000000000 +0200
    @@ -382,6 +382,7 @@ xcv_file CvFILE(bstate->bs_sv) pvindex
    xcv_depth CvDEPTH(bstate->bs_sv) long
    xcv_padlist *(SV**)&CvPADLIST(bstate->bs_sv) svindex
    xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex
    +xcv_outside_seq *(SV**)&CvOUTSIDE_SEQ(bstate->bs_sv) svindex
    xcv_flags CvFLAGS(bstate->bs_sv) U16
    av_extend bstate->bs_sv SSize_t x
    av_push bstate->bs_sv svindex x

    A make regen is needed, of course.
    This doesn't mean that perlcc -B 'works' now.
    It only stops barfing about 'no such instruction' etc.
    The produced a.out won't output anything at all :-(
    ( perlio issue ?
    - could someone with a recent non-perlio perl test it ? )

    Regards
    Adi
  • Dave Mitchell at Mar 19, 2003 at 11:33 pm

    On Thu, Mar 20, 2003 at 01:02:02AM +0200, Enache Adrian wrote:
    Looks like you just forgot to add it to bytecode.pl too.

    diff -rup /arc/perl-current/bytecode.pl ./bytecode.pl
    --- /arc/perl-current/bytecode.pl 2003-03-08 10:01:39.000000000 +0200
    +++ ./bytecode.pl 2003-03-20 00:40:42.000000000 +0200
    @@ -382,6 +382,7 @@ xcv_file CvFILE(bstate->bs_sv) pvindex
    xcv_depth CvDEPTH(bstate->bs_sv) long
    xcv_padlist *(SV**)&CvPADLIST(bstate->bs_sv) svindex
    xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex
    +xcv_outside_seq *(SV**)&CvOUTSIDE_SEQ(bstate->bs_sv) svindex
    xcv_flags CvFLAGS(bstate->bs_sv) U16
    av_extend bstate->bs_sv SSize_t x
    av_push bstate->bs_sv svindex x
    Is that *(SV**) bit correct? xcv_outside_seq is a number, not a pointer.

    --
    You live and learn (although usually you just live).
  • Enache Adrian at Mar 20, 2003 at 12:22 am

    On Wed, Mar 19, 2003 at 11:33:55PM +0000, Dave Mitchell wrote:
    Is that *(SV**) bit correct? xcv_outside_seq is a number, not a pointer.
    Oops.

    --- /arc/perl-current/bytecode.pl 2003-03-08 10:01:39.000000000 +0200
    +++ ./bytecode.pl 2003-03-20 02:11:53.000000000 +0200
    @@ -382,6 +382,7 @@
    xcv_depth CvDEPTH(bstate->bs_sv) long
    xcv_padlist *(SV**)&CvPADLIST(bstate->bs_sv) svindex
    xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex
    +xcv_outside_seq CvOUTSIDE_SEQ(bstate->bs_sv) U32
    xcv_flags CvFLAGS(bstate->bs_sv) U16
    av_extend bstate->bs_sv SSize_t x
    av_push bstate->bs_sv svindex x
  • Enache Adrian at Mar 20, 2003 at 5:40 am

    On Mon, Mar 17, 2003 at 05:28:37PM +0100, marek.rouchal@infineon.com wrote:
    Dear Perl Porters,

    I see that 5.8.1 is nearing completion - are there any chances that
    the Bytecode compiler/loader will work ok? My 5.8.0 (Solaris 7,
    Sparc, Forte 6.2) compiles happily with perlcc, but won't run a
    simple hello world...

    Thanks & best regards,

    Marek
    Please give it a try:
    (make regen needed)
    -------------------------------------------------------------------
    --- /arc/perl-current/op.c 2003-03-09 14:42:37.000000000 +0200
    +++ ./op.c 2003-03-20 06:32:49.000000000 +0200
    @@ -1796,7 +1796,7 @@ Perl_newPROG(pTHX_ OP *o)
    CALL_PEEP(PL_eval_start);
    }
    else {
    - if (!o)
    + if (o->op_type == OP_STUB)
    return;
    PL_main_root = scope(sawparens(scalarvoid(o)));
    PL_curcop = &PL_compiling;
    --- /arc/perl-current/bytecode.pl 2003-03-08 10:01:39.000000000 +0200
    +++ ./bytecode.pl 2003-03-20 02:11:53.000000000 +0200
    @@ -382,6 +382,7 @@ xcv_file CvFILE(bstate->bs_sv) pvindex
    xcv_depth CvDEPTH(bstate->bs_sv) long
    xcv_padlist *(SV**)&CvPADLIST(bstate->bs_sv) svindex
    xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex
    +xcv_outside_seq CvOUTSIDE_SEQ(bstate->bs_sv) U32
    xcv_flags CvFLAGS(bstate->bs_sv) U16
    av_extend bstate->bs_sv SSize_t x
    av_push bstate->bs_sv svindex x
    -------------------------------------------------------------------

    Since newPROG() is called now with the output of block_end() as
    its argument (see perly.y:131) 'o' could never be Null - as it
    used to be in 5.6.1 when to body of the script was void.

    The ByteLoader relies on that 'if (!o) return' because it sets
    itself PL_main_start (i.e. the first OP to be run) in byterun.c.

    That looks like a very fine & exciting feature - for any module
    that wants to substitute its own code to the running script.

    Now Perl breaks the magic and executes just an op_stub instead.

    I have no much idea how broken ByteLoader could be: but I think
    that putting it back into work in 5.8.1 is a far better idea than
    letting it rot.
    (notice that - for instance - pattern matches don't work yet, they
    die with a "can't coerce .." message, but that's probably fixable)

    Regards
    Adi

    Note:
    It won't work with 5.8.0 - because perl < #18723 puts also a nextstate
    in empty blocks :(
  • Rafael Garcia-Suarez at Mar 20, 2003 at 11:48 pm

    Enache Adrian wrote:
    Please give it a try:
    Thanks, applied as #19038.
    That's one problem less... however situation is far from
    perfect. The core has evolved while letting the backends stall.
    For example with Nicholas' test :

    $ cat hw.pl
    print "Hello world from perl $]\n"
    $ /opt/perl/bin/perlcc5.9.0 -B hw.pl
    $ ./a.out
    Hello world from perl 5.009
    $ /opt/perl/bin/perlcc5.9.0 hw.pl
    $ ./a.out
    panic: invalid pad in pad_sv: 0x8193424[0x81b6860] at hw.pl line 1.
  • Enache Adrian at Mar 21, 2003 at 3:25 am

    On Fri, Mar 21, 2003 at 12:22:31AM +0100, Rafael Garcia-Suarez wrote:

    $ cat hw.pl
    print "Hello world from perl $]\n"
    $ /opt/perl/bin/perlcc5.9.0 -B hw.pl
    $ ./a.out
    Hello world from perl 5.009
    $ /opt/perl/bin/perlcc5.9.0 hw.pl
    $ ./a.out
    panic: invalid pad in pad_sv: 0x8193424[0x81b6860] at hw.pl line 1.
    Hmm, that's the C backend. ( you forgot the -B switch ). You just
    stumbled on another bug.

    About ByteLoader: most problems are with the regular expressions,
    because the PMOP structure has changed since 5.6.1. It looks very
    fixable, though. It'll work one of these days :)

    Thank you anyway for applying my patch: I'm very excited about
    that 'code substitution' feature, which I plan to use myself
    in a module.

    Regards
    Adi

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedMar 17, '03 at 4:29p
activeMar 21, '03 at 3:25a
posts9
users5
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase