I've been unable to get pheme to run on my system, and after
chromatic and I did some testing tonight we think we've narrowed
the problem down to an issue with using load_bytecode on files
containing :multi subs.
The example here are all using r12492. Here's my short test
program that evokes the bug:
$ cat foo.pir
.sub 'foo' :multi(string)
.param string x
say "foo"
say "does"
print x
print "\n"
.end
$ cat x.pir
.sub main :main
load_bytecode 'PGE.pbc'
load_bytecode 'foo.pir'
say "Hello\n"
.end
When running on x86 (32-bit), I get:
$ ./parrot x.pir
ResizablePMCArray: index out of bounds!
current instr.: 'main' pc -1 ((unknown file):-1)
$
A trace shows that it fails at the load_bytecode 'foo.pir' step.
Under x86-64, it fails at the same point but with a different
message:
$ ./parrot x.pir
Parrot VM: PANIC: Out of mem!
C file src/memory.c, line 122
Parrot file (not available), line (not available)
[..rest omitted for brevity..]
I haven't been able to reproduce this failure with any .pbc
file other than PGE.pbc. (I can't think of anything in PGE.pbc
that would cause this, other than it's a fairly large .pbc file.)
Switching the files to be .pir instead of .pbc or vice-versa
doesn't seem to affect t hings.
Surprisingly, adding *more* load_bytecode instructions between
the loads of 'PGE.pbc' and 'foo.pir' seems to help:
$ cat y.pir
.sub main :main
load_bytecode 'PGE.pbc'
load_bytecode 'ncurses.pbc'
load_bytecode 'Getopt/Obj.pbc'
load_bytecode 'foo.pir'
say "Hello\n"
.end
$ ./parrot y.pir
Hello
$
Loading other .pbc or .pir files that do not have :multi subs
seems to not be a problem; at least, I've only encountered the
problem when a load_bytecode encounters a :multi. And
commenting out any :multi causes the error to go away.
Pm
> When running on x86 (32-bit), I get:
>
> $ ./parrot x.pir
> ResizablePMCArray: index out of bounds!
> current instr.: 'main' pc -1 ((unknown file):-1)
> $
I see this too on x86, running t/car.t through Pheme. I traced the C to
compilers/imcc/imclexer.c:5575 (the yyparse() call). That's as far as I want
to go.
-- c
Fixed (r12593), thanks for the testcase.
> Pm
leo