Discussion:
[perl #39807] [BUG] load_bytecode of .pir files fails (sometimes)
(too old to reply)
Patrick R . Michaud
2006-07-13 01:47:11 UTC
Permalink
# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #39807]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39807 >


[I looked in the RT database and didn't find a ticket for
this (known) issue, so I'm submitting it here. Apologies for
any duplication.]

When load_bytecode is used on a .pir file, it sometimes causes
problems with the imcc compiler a bit later. Demonstration:

$ cat x.pir
.sub main :main
load_bytecode 'PGE.pbc'
load_bytecode 'dumper.pir'
load_bytecode 'PGE/Dumper.pir'

$P0 = compreg 'PGE::P5Regex'
$P1 = $P0('aabb*')
$P2 = $P1('fooaabbbar')

_dumper($P2)
.end
$ ./parrot x.pir
error:imcc:syntax error, unexpected $end
in file 'EVAL_1' line 72

Changing the .pir to .pbc causes things to magically work:

[***@orange trunk]$ cat y.pir
.sub main :main
load_bytecode 'PGE.pbc'
load_bytecode 'dumper.pbc'
load_bytecode 'PGE/Dumper.pbc'

$P0 = compreg 'PGE::P5Regex'
$P1 = $P0('aabb*')
$P2 = $P1('fooaabbbar')

_dumper($P2)
.end
$ ./parrot y.pir
"VAR1" => PMC 'PGE::Match' => "aabbb" @ 3
$

I'll add the above as tests to t/pmc/sub.t as soon
as I have the RT ticket number. :-)

Thanks,

Pm
Chromatic
2009-01-04 18:14:02 UTC
Permalink
Post by Patrick R . Michaud
The imcc problem is still there. Found by testing TT #127.
98 get_class P0, "Data::Dumper" P0=PMCNULL
101 if_null P0, 5 P0=PMCNULL
106 load_bytecode "Data/Dumper.pbc"
0 get_class P1, "Data::Dumper" P1=PMCNULL
3 if_null P1, 5 P1=PMCNULL
8 load_bytecode "Data/Dumper/Default."
0 get_class P1, "Data::Dumper::Defaul" P1=PMCNULL
3 if_null P1, 5 P1=PMCNULL
8 load_bytecode "Data/Dumper/Base"
.sub main
load_bytecode "test.pir"
.end
Current Source Filename loadbc.pir
000000000000-000000000000 000002: load_bytecode_sc "test.pir"
000000000001-000000000002 000002: set_returns_pc PMC_CONST(2)
000000000002-000000000004 000002: returncc
So, the string test.pir is still there, implying imcc parses it
correctly, I think.
That's correct. Parrot's tracing output only displays the first n characters
of STRINGs.

-- c

Loading...