threads blocker: Not so transparent proxies

Reini Urban rurban at x-ray.at
Wed Nov 21 16:26:28 UTC 2012


We have a litle blocking situation with our parrot threads.
See https://github.com/parrot/parrot/issues/869 and tadzik's crashing nqp case.

tadzik.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);

nqplexinfo, the NQP lexpad for $a which holds $x, might get created in
another thread,
and then the proxy returned by GET_ATTR_lexinfo(INTERP, SELF, info) in
Parrot_NQPLexPad_set_pointer
cannot handle the GETATTR_NQPLexInfo_name_to_register_map call.

nqplexpad.pmc:
    VTABLE void set_pointer(void *ctx) {
        /* Check if we need to put any static values in place. */
        PMC *info;
        Hash *hash;
        GET_ATTR_lexinfo(INTERP, SELF, info);
        if (info->vtable->base_type != enum_class_LexInfo
#ifdef PARROT_HAS_THREADS
            && info->vtable->base_type != enum_class_Proxy
#endif
	    ) {
            PMC *name_map;
            GETATTR_NQPLexInfo_name_to_register_map(INTERP, info, name_map);
            hash = (Hash *)VTABLE_get_pointer(INTERP, name_map);
        }
        else {
            hash = (Hash *)VTABLE_get_pointer(INTERP, info);
        }
        SET_ATTR_lexinfo_hash(INTERP, SELF, hash);


I'm not familiar with the new proxies.
Is this a special problem?
how can we fix this single case (see
https://github.com/perl6/nqp/commit/a93915b910)?
and does nqp needs to check all PMC's for proxies?

-- 
Reini Urban
http://cpanel.net/   http://www.perl-compiler.org/


More information about the parrot-dev mailing list