On Wed, Nov 17, 2004 at 11:07:28PM +0100, Leopold Toetsch wrote:
> $ parrot pmfactbsr.imc
> 500500
> 3.459947
> 
> $ parrot -Oc pmfact.imc
> 500500
> 1.237185
> 
> Now what ;)
> Are you sure, that you can't do a tailcall sometimes? 

Sure, p6ge already makes heavy use of tailcalls.  In a bsr/ret scheme,
the tail calls become branches (and, using a caller-saves convention,
there's no saving/restoring of registers).  So, we end up with:

[EMAIL PROTECTED] pmichaud]$ parrot pmfact.imc
500500
5.950604
[EMAIL PROTECTED] pmichaud]$ parrot pmfactbsr.imc
500500
1.988304
[EMAIL PROTECTED] pmichaud]$ parrot -Oc pmfact.imc
500500
0.933195
[EMAIL PROTECTED] pmichaud]$ parrot -Oc pmfactbsrtail.imc
500500
0.221527

[EMAIL PROTECTED] pmichaud]$ perl -e 'print 0.93 / 0.22, "\n"'
4.22727272727273

> What about calling back into PIR code?

Sure, I'll just use the standard PIR calling conventions for those--
no problem.  

Pm

Reply via email to