On Fri, 7 Dec 2007, Allison Randal wrote:

> I'm about to turn on the concurrency scheduler runloop in Parrot trunk. Before
> I do, I'd like test results on as many platforms as possible (especially
> Windows, since it doesn't use POSIX threads).
> 
> To test it, edit src/inter_create.c and uncomment the two lines that start
> with 'Parrot_cx...". Then run 'make test' and let me know if it fails any
> tests that passed before.

On Solaris 8/SPARC, the only regression is in src/vtables.t

    $ perl5.10 -Ilib t/src/vtables.t
    1..4
    ok 1 - Parrot_new_vtable
    ok 2 - Parrot_clone_vtable
    not ok 3 - Parrot_destroy_vtable # TODO vtable not NULL after destroy
    #     Failed (TODO) test (t/src/vtables.t at line 100)
    #          got: 'ok
    # not ok
    # '
    #     expected: 'ok
    # ok
    # '
    # './t/src/vtables_3' failed with exit code 0
    not ok 4 - parrot_alloc_vtables
    #     Failed test (t/src/vtables.t at line 142)
    # Exited with error code: [SIGNAL 139]
    # Received:
    # 
    # Expected:
    # ok
    # ok
    # ok
    # 
    # Looks like you failed 1 test of 4.

Under the debugger, here's what I see


    $ dbx vtables_4
    (dbx) run
    Running: vtables_4 
    (process id 3750)
    ok
    ok
    ok
    [EMAIL PROTECTED] ([EMAIL PROTECTED]) signal SEGV (no mapping at the fault 
address) in pmc_new at line 70 in file "pmc.c"
       70       PMC *const classobj = interp->vtables[base_type]->pmc_class;
    (dbx) where
    current thread: [EMAIL PROTECTED]
    =>[1] pmc_new(interp = 0x485318, base_type = 79), line 70 in "pmc.c"
      [2] Parrot_cx_runloop_end(interp = 0x485318), line 232 in "scheduler.c"
      [3] Parrot_really_destroy(interp = 0x485318, exit_code_unused = 0, 
arg_unused = (nil)), line 380 in "inter_create.c"
      [4] Parrot_exit(interp = 0x485318, status = 0), line 94 in "exit.c"
      [5] main(argc = 1, argv = 0xffbefa8c), line 33 in "vtables_4.c"
    (dbx) print *interp
    *interp = {
        ctx                   = {
            state = 0x486580
            bp    = {
                regs_n = 0x4866e0
                regs_i = 0x4866e0
            }
            bp_ps = {
                regs_p = 0x4867e0
                regs_s = 0x4867e0
            }
        }
        ctx_mem               = {
            free_list    = 0x486430
            n_free_slots = 81
        }
        arena_base            = 0x487078
        class_hash            = 0x4eb110
        vtables               = 0x67e0a0
        n_vtable_max          = 81
        n_vtable_alloced      = 100

    [ etc. ]

    }
    (dbx) print *interp->vtables
    *interp->vtables = (nil)

The problem may well be in the vtables_4.c test file and not in pmc_new:

    #include <parrot/parrot.h>
    #include <parrot/embed.h>
    #include <parrot/vtables.h>

    int
    main(int argc, char* argv[])
    {
        Interp *interp;
        VTABLE *vtable;

        interp = Parrot_new(NULL);
        if (!interp) {
            return 1;
        }

        parrot_alloc_vtables(interp);

        [ . . . ]

In parrot_alloc_vtables, space is allocated for the vtables, but
it is all zeroed.  It doesn't point anywhere useful.  Thus when 
Parrot_cx_runloop_end() calls pmc_new(), and it does:
   
   PMC *const classobj = interp->vtables[base_type]->pmc_class;

things go boom.

Whether this is a defect in the vtables_4 test sourcefile for failing to
initialize the vtables, or whether pmc_new ought to be more defensive, I
can't say.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to