There is an optimization that does it for you FYI (or just use newlist_hint)

On Sat, Apr 13, 2013 at 6:13 PM, bivab <[email protected]> wrote:
> Author: David Schneider <[email protected]>
> Branch:
> Changeset: r63312:1bd588482153
> Date: 2013-04-13 18:00 +0200
> http://bitbucket.org/pypy/pypy/changeset/1bd588482153/
>
> Log:    preallocate list to hold the locations of arguments to a call
>
> diff --git a/rpython/jit/backend/arm/regalloc.py 
> b/rpython/jit/backend/arm/regalloc.py
> --- a/rpython/jit/backend/arm/regalloc.py
> +++ b/rpython/jit/backend/arm/regalloc.py
> @@ -554,10 +554,9 @@
>          return self._prepare_call(op)
>
>      def _prepare_call(self, op, force_store=[], save_all_regs=False):
> -        args = []
> -        args.append(None)
> +        args = [None] * (op.numargs()+1)
>          for i in range(op.numargs()):
> -            args.append(self.loc(op.getarg(i)))
> +           args[i+1] = self.loc(op.getarg(i))
>          # spill variables that need to be saved around calls
>          self.vfprm.before_call(save_all_regs=save_all_regs)
>          if not save_all_regs:
> _______________________________________________
> pypy-commit mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/pypy-commit
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to