Jens Rieks <[EMAIL PROTECTED]> wrote:

> $ tar xzf err6.tgz

I could reduce the bug to the program below. Program runs with -G and
segfaults without.

It seems that Dan's comment WRT delegate is too true:

,--[ delegate.pmc ]------------------------------------------------------
| The following bit is a fast register save/restore pair.
| ...
|
| Also note that if the vtable method clobbers a register that contains a
| string or PMC not otherwise rooted it could be collected too early.
`------------------------------------------------------------------------

The register P12 is reused in the overridden method calls, the object
P12 in main isn't visible then anymore and gets DODed.
I think, we need a custom mark for objects that trace the saved register
area(s).

leo

    newclass P9, "Source"
    newclass P10, "Source::Buffer"
    find_type I9,"Source"
    new P12, I9

    set S20, P12
    print S20
    set S20, P12         # <-------- SEGV, P12 destroyed
    print S20
    end

.namespace ["Source"]
.pcc_sub __get_string:  # buffer
    getprop P12, "buf", P2
    sweep 1
    typeof I12, P12
    ne I12, .PerlUndef, buffer_ok
    find_type I12, "Source::Buffer"
    new P12, I12
    new P14, .PerlString
    set P14, "hello\n"
    setprop P12, "buf", P14
    setprop P2, "buffer", P12
buffer_ok:
    set S5, P12
    invoke P1

.namespace ["Source::Buffer"]
.pcc_sub __get_string:
    sweep 1
    getprop P12, "buf", P2
    set S16, P12
    set S5, S16
    invoke P1

Reply via email to