Am Montag, 25. September 2006 00:06 schrieb Karl Forner:
> On 9/15/06, Leopold Toetsch <[EMAIL PROTECTED]> wrote:
> > - There are 2 use cases for register_move
> >   a) optimized recursive tail calls
> >   b) simple function call argument passing compiled to native code in JIT
> > core

> So in that case ( a or b ?), the src_regs are always (0,1,2,..,n) ?
> If so I'm sure that we can use this property to optimize the code.

b) isn't yet using Parrot_register_move(). Therefore it isn't given that 
src_regs are always register positions.

> The problem is that I have no clue of JIT, registers and so on. But could
> you give an example of code that would
> lead to that case ?

Let's forget that case.
JIT code is only created for simple and matching arguments.

> > Again, we have to check if any argument conversions could take place and
> > then
> > turn off the optimization in case.
>
> ok, so where would the check take place ?
> I can imagine  an extra argument indicating whether or not doing this extra
> optimization, or two different functions/implementations,
> or more infomration about the registers  allowing the function to decide by
> itself to do or not the optimization on a register-couple basis ....

No. There have to be an extra check before tailcall optimization is done. When 
there's argument conversion, which involves P registers, 
Parrot_register_move() will not be used at all.

> So is there anything more I could do on this subject ?

Well, you could have a look at recursive_tail_call() in compilers/imcc/pcc.c 
and improve the checks, if the tailcall can be optimized.

> Karl

leo

Reply via email to