[pypy-dev] [pypy-svn] pypy jit-longlong: Intermediate check-in, breaks everything by exposing cases of

Maciej Fijalkowski fijall at gmail.com
Mon Jan 10 12:23:12 CET 2011


For what is worth I'm happy with making "rething regalloc API" a
sprint topic. So far I failed to come up with something more
reasonable.

Cheers,
fijal

On Mon, Jan 10, 2011 at 12:33 AM, arigo <commits-noreply at bitbucket.org> wrote:
> Author: Armin Rigo <arigo at tunes.org>
> Branch: jit-longlong
> Changeset: r40545:9a472ddf9893
> Date: 2011-01-09 23:33 +0100
> http://bitbucket.org/pypy/pypy/changeset/9a472ddf9893/
>
> Log:    Intermediate check-in, breaks everything by exposing cases of
>        constant arguments that are not correctly handled so far. /me is
>        again annoyed by the API of regalloc.py, which seems to be very
>        reasonable, until we hit these cases.
>
> diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
> --- a/pypy/jit/backend/x86/assembler.py
> +++ b/pypy/jit/backend/x86/assembler.py
> @@ -1174,6 +1174,13 @@
>         self.mc.SBB_rr(resloc.value, resloc.value)
>         self.mc.NEG_r(resloc.value)
>
> +    def genop_llong_lt(self, op, arglocs, resloc):
> +        # XXX just a special case for now: "x < 0"
> +        loc1, = arglocs
> +        self.mc.PMOVMSKB_rx(resloc.value, loc1.value)
> +        self.mc.SHR_ri(resloc.value, 7)
> +        self.mc.AND_ri(resloc.value, 1)
> +
>     def genop_new_with_vtable(self, op, arglocs, result_loc):
>         assert result_loc is eax
>         loc_vtable = arglocs[-1]
> @@ -1784,6 +1791,7 @@
>             if isinstance(op.getdescr(), LongLongCallDescr):
>                 self.mc.MOV_br(resloc.value, eax.value)      # long long
>                 self.mc.MOV_br(resloc.value + 4, edx.value)
> +                # XXX should ideally not move the result on the stack
>             else:
>                 self.mc.FSTP_b(resloc.value)   # float return
>         elif size == WORD:
>
> diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py
> --- a/pypy/jit/codewriter/jtransform.py
> +++ b/pypy/jit/codewriter/jtransform.py
> @@ -894,7 +894,8 @@
>                 args = op.args
>                 op1 = self.prepare_builtin_call(op, "llong_%s", args)
>                 op2 = self._handle_oopspec_call(op1, args,
> -                                                EffectInfo.OS_LLONG_%s)
> +                                                EffectInfo.OS_LLONG_%s,
> +                                                EffectInfo.EF_PURE)
>                 return op2
>         ''' % (_op, _oopspec.lower(), _oopspec)).compile()
>
> @@ -1273,7 +1274,7 @@
>
>     def _handle_oopspec_call(self, op, args, oopspecindex, extraeffect=None):
>         calldescr = self.callcontrol.getcalldescr(op, oopspecindex)
> -        if extraeffect:
> +        if extraeffect is not None:
>             calldescr.get_extra_info().extraeffect = extraeffect
>         if isinstance(op.args[0].value, str):
>             pass  # for tests only
>
> diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
> --- a/pypy/jit/backend/x86/regalloc.py
> +++ b/pypy/jit/backend/x86/regalloc.py
> @@ -653,6 +653,22 @@
>         self.PerformLLong(op, [loc1, loc2, loc3], loc0)
>         self.xrm.possibly_free_vars(args)
>
> +    def _maybe_consider_llong_lt(self, op):
> +        # XXX just a special case for now
> +        from pypy.rlib.longlong2float import longlong2float
> +        box = op.getarg(2)
> +        if not isinstance(box, ConstFloat):
> +            return False
> +        if not (box.value == longlong2float(r_longlong(0))):
> +            return False
> +        # "x < 0"
> +        box = op.getarg(1)
> +        loc1 = self.xrm.make_sure_var_in_reg(box, imm_fine=False)
> +        loc0 = self.rm.force_allocate_reg(op.result)
> +        self.PerformLLong(op, [loc1], loc0)
> +        self.xrm.possibly_free_var(box)
> +        return True
> +
>     def _consider_llong_to_int(self, op):
>         # accept an argument in a xmm register or in the stack
>         loc1 = self.xrm.loc(op.getarg(1))
> @@ -769,6 +785,9 @@
>                 if (oopspecindex == EffectInfo.OS_LLONG_EQ or
>                     oopspecindex == EffectInfo.OS_LLONG_NE):
>                     return self._consider_llong_cmp_xx(op)
> +                if oopspecindex == EffectInfo.OS_LLONG_LT:
> +                    if self._maybe_consider_llong_lt(op):
> +                        return
>         #
>         self._consider_call(op)
>
> _______________________________________________
> pypy-svn mailing list
> pypy-svn at codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-svn
>



More information about the Pypy-dev mailing list