Michal Wallace <[EMAIL PROTECTED]> wrote:

> Hey all,

> I've got lambda (single-expression anonymous subroutine)
> working in pirate now, but I wasn't sure how to get it
> to do the correct calling convention with IMCC's "call".

I'm pretty sure, that you should use Parrot calling conventions for all
subs, the more that subs are objects inside Pie-thon.

>    print (lambda x: x+1)(0)  # prints "1\n"

>     jsr $I00001     #### :( why can't I "call"?#######

The register based j* branches take an absolute address. Imcc has no way
to find out where the branch will go in the general case. Using these
opcodes is almost unsopported inside imcc.

With Parrot calling conventions and an appropriate subroutine object you
can achieve the same effect, with additional context saving as needed.

While this jump opcode may be needed somewhen (what for? - or even get
tossed), all effort currently goes into PCC and optimizing that stuff
finally.

Further information:
docs/pdds/pdd03_calling_conventions.pod
docs/pmc/sub.pod
languages/imcc/docs/calling_conventions.pod

> Sincerely,
>
> Michal J Wallace

leo

Reply via email to