There appears to be a possible GC-related bug introduced to Parrot prior to r27449 which is showing up in Rakudo. Using the following script (courtesy of Jonathan W):

--------------------------------
class Foo {
   has $.x;
   method boo { say $.x }
}

class Bar is Foo {
   method set($v) { $.x = $v }
}

my Foo $u .= new(x => 5);
$u.boo;                    # 5

$u= Bar.new(Foo{ x => 12 });
$u.boo;                    # 12
$u.set(9);
$u.boo;                    # 9
--------------------------------

'perl6 obj_init.p6' results :

5
Segmentation fault

--------------------------------

'parrot ~/src/parrot/languages/perl6/perl6.pbc obj_init.p6' results:

cjfields:tests cjfields$ parrot ~/src/parrot/languages/perl6/perl6.pbc obj_init.p6
5
get_pmc_keyed() not implemented in class 'Undef'
current instr.: '_block10' pc 137 (EVAL_13:46)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/ HLLCompiler.pir:458) called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/ HLLCompiler.pir:587) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/ PCT/HLLCompiler.pir:676)
called from Sub 'parrot;Perl6::Compiler;main' pc 9647 (perl6.pir:187)

--------------------------------

'parrot -G ~/src/parrot/languages/perl6/perl6.pbc obj_init.p6' results:

5
get_pmc_keyed() not implemented in class 'Any'
current instr.: '_block10' pc 137 (EVAL_13:46)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/ HLLCompiler.pir:458) called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/ HLLCompiler.pir:587) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/ PCT/HLLCompiler.pir:676)
called from Sub 'parrot;Perl6::Compiler;main' pc 9647 (perl6.pir:187)

--------------------------------

Note difference with Any (-G) vs Undef (no -G). Not sure if it means anything.

-chris

Reply via email to