Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created September 29, 2012 07:10
Show Gist options
  • Save tadzik/3803406 to your computer and use it in GitHub Desktop.
Save tadzik/3803406 to your computer and use it in GitHub Desktop.
┌─[tadzik@yavin4]─[~]
└─[%]─> cat threads.nqp
say("alive");
my $x := 5;
my $a := sub foo() {
say($x);
say(5);
}
my $b := pir::new__PSP('Task', $a);
pir::schedule__0P($b);
pir::wait__0P($b);
say(7);
┌─[tadzik@yavin4]─[~]
└─[%]─> parrot-nqp threads.nqp
alive
5
5
7
┌─[tadzik@yavin4]─[~]
└─[%]─> nqp threads.nqp
alive
src/pmc.c:209: failed assertion 'interp->n_vtable_max > base_type'
Backtrace - Obtained 22 stack frames (max trace depth is 32).
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x19f0d5) [0x7effaa52f0d5]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_confess+0x8a) [0x7effaa52f09a]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_pmc_new+0x5e) [0x7effaa57c4ee]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_ex_build_exception+0x68) [0x7effaa52de98]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x19e79e) [0x7effaa52e79e]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_ex_throw_from_c_args+0xf7) [0x7effaa52ec27]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x21ee71) [0x7effaa5aee71]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x21fafc) [0x7effaa5afafc]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1fd8e5) [0x7effaa58d8e5]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x17ba41) [0x7effaa50ba41]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1ef6b9) [0x7effaa57f6b9]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1eeb62) [0x7effaa57eb62]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1c3651) [0x7effaa553651]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_pcc_invoke_from_sig_object+0x190) [0x7effaa54c1a0]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_ext_call+0x188) [0x7effaa52fca8]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x31df34) [0x7effaa6adf34]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_pcc_invoke_from_sig_object+0x12b) [0x7effaa54c13b]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(Parrot_ext_call+0x188) [0x7effaa52fca8]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1f649d) [0x7effaa58649d]
/home/tadzik/src/parrot/install/lib/libparrot.so.4.7.0(+0x1f8244) [0x7effaa588244]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6b50) [0x7effa96a2b50]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7effa744370d]
Attempting to get PIR backtrace. No guarantees. Here goes...
current instr.: '' pc 118 ((file unknown):60173904) (threads.nqp:1)
called from Sub '' pc 29466 (src/stage2/gen/NQPHLL.pir:11147) (src/stage2/gen/NQPHLL.pm:1219)
called from Sub 'eval' pc 29318 (src/stage2/gen/NQPHLL.pir:11086) (src/stage2/gen/NQPHLL.pm:1206)
called from Sub 'evalfiles' pc 31784 (src/stage2/gen/NQPHLL.pir:12096) (src/stage2/gen/NQPHLL.pm:1419)
called from Sub 'command_eval' pc 30498 (src/stage2/gen/NQPHLL.pir:11596) (src/stage2/gen/NQPHLL.pm:1329)
called from Sub 'command_line' pc 30040 (src/stage2/gen/NQPHLL.pir:11427) (src/stage2/gen/NQPHLL.pm:1304)
called from Sub 'MAIN' pc 699 (src/stage2/gen/NQP.pir:228) (src/stage2/gen/NQP.pm:3127)
called from Sub '' pc 444 (src/stage2/gen/NQP.pir:156) (src/stage2/gen/NQP.pm:1500)
zsh: abort nqp threads.nqp
@leto
Copy link

leto commented Sep 29, 2012

It seems like new__PSP should take 3 arguments. Perhaps parrot-nqp gives a default value to the missing third value, but nqp doesn't?

@leto
Copy link

leto commented Sep 29, 2012

I just pushed a branch called smoke-me/threads_tests that turns this gist into a test for using Task PMC + parrot-nqp. The tests pass but the test file fails with a non-successful error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment