Before reporting this as a bug I would like to know if it is not my
shallow understanding of Parrot... :-)
I set an exception handler, then call a subroutine and within that
subroutine an exception is triggered (because of a find_lex of a
non-existing lexical). The exception is handled but if I then want to
RETurn, I get an error message:
josv@jadzia:~/parrot/test > ../parrot test10.pir
mark 1
Hi from handler
Hi from sub1
Wrong type on top of stack!
The offending program is:
------------------------------------------------------------------------
.sub _main
new_pad 0
newsub P10, .Exception_Handler, _handler
set_eh P10
print "mark 1\n"
call _sub1
print "mark 2\n"
clear_eh
print "mark 3\n"
end
.end
.sub _sub1
find_lex P13,"a"
print "Hi from sub1\n"
ret
.end
.sub _handler
print "Hi from handler\n"
set P2, P5["_invoke_cc"]
invoke P2
.end
------------------------------------------------------------------------
++Jos.nl
--
ek is so lug jy vlieg deur my
sonder jou is ek sonder patroon
"Breyten Breytenbach"
> Hi,
>
> Before reporting this as a bug I would like to know if it is not my
> shallow understanding of Parrot... :-)
> Wrong type on top of stack!
> call _sub1
> .sub _sub1
Exception handlers and "plain" subs don't play together (yet). You have
to use .pcc_sub (parrot calling conventions). Plain subs have their
return address on the control stack, where the exception handlers are
living too.
s. languages/imcc/docs/calling_conventions.pod
leo