When I install and use an exception handler for the second time Parrot
dumps. It looks like the "set_eh" messes up the sub object in P10
because when I uncomment the second newsub it works...

Is this a behaviour of the hidden invoke (of the exception handler) that
I am unaware of?

++Jos.nl

------------------------------------------------------------------------
.sub _main
                
        new_pad 0

        newsub P10, .Exception_Handler, _handler

        I12=1
        set_eh P10
        find_lex P13,"a"
        clear_eh
        P13=new PerlNum
        store_lex -1,"a",P13
        P13=I12
        find_lex P14,"a"
        print P14

        I17=2
        #newsub P10, .Exception_Handler, _handler
        set_eh P10
        print "mark1\n"
        find_lex P13,"b"        # <=== Crashes here
        print "mark2\n"
        clear_eh
        P18=new PerlNum
        store_lex -1,"b",P18
        P18=I17
        print P18
        end
.end

.sub _handler
        print "Hi from handler\n"
        set P2, P5["_invoke_cc"]
        invoke P2
.end
------------------------------------------------------------------------

When I run this code, "mark1" gets printed but then the interpreter
crashes:

------------------------------------------------------------------------
[EMAIL PROTECTED]:~/parrot/test > ../parrot test9.pir 
Hi from handler
1mark1
Segmentation fault (core dumped)
------------------------------------------------------------------------

++Jos.nl

-- 
ek is so lug jy vlieg deur my
sonder jou is ek sonder patroon
   "Breyten Breytenbach"

Reply via email to