[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] About work on possible mips port

From: Paolo Bonzini
Subject: Re: [Lightning] About work on possible mips port
Date: Wed, 06 Oct 2010 09:39:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3

On 10/06/2010 06:31 AM, Paulo César Pereira de Andrade wrote:
   At first I am thinking about using the approach I used, but reverted to
not make default, for function calls, that is to patch a stack pointer
adjustment on demand, i.e. as result of jit_allocai or function calls
that require arguments on stack. There is no push/pop opcodes
anyway, but would need to assert that no more than 32767 bytes
are allocated, to make patching possible.

I initially said I don't like the idea of patching the prolog on jit_allocai or function calls, however I now noticed that the PowerPC port is doing that for jit_allocai. So, for that case I now think patching the prolog is good.

For function calls, however, it would be much better (and portable) to adjust the stack pollution support so that instead of

         push %eax
         push %ebx
         call f1           ; jit_calli
         push %eax
         push %ebx
         call f2           ; jit_finish
         add $16, %esp

it generates

         push %eax
         push %ebx
         call f1
         mov %eax, 4(%esp)
         mov %ebx, (%esp)
         call f2
         add $8, %esp

1. move pointer to register and to indirect jump/call

That's what jit_calli does for PowerPC.

   Conditional branches must be limited to 18 bits distance, or, add
a jump over with an inverse condition and implement an unconditional

I think this is fine.  It's 256 KB after all.

   Still also need to find out how to properly implement carry
primitives, as there is only add/sub without side effects, and
signed add/sub that generate a trap on overflow.

Something like this:

        add destlo, src1lo, src2lo
        sltu aux, destlo, src1lo        ; sgtu for subtraction

        add desthi, src1hi, src2hi
        add desthi, desthi, aux


reply via email to

[Prev in Thread] Current Thread [Next in Thread]