[pypy-dev] [pypy-svn] r77589 - pypy/trunk/pypy/jit/metainterp

Antonio Cuni anto.cuni at gmail.com
Mon Oct 4 23:56:34 CEST 2010


On 04/10/10 23:32, fijal at codespeak.net wrote:

>   def transform(op):
>       from pypy.jit.metainterp.history import AbstractDescr
> -    # Rename CALL_PURE to CALL.
> +    # Rename CALL_PURE and CALL_INVARIANT to CALL.
>       # Simplify the VIRTUAL_REF_* so that they don't show up in the backend.
> -    if op.getopnum() == rop.CALL_PURE:
> +    if (op.getopnum() == rop.CALL_PURE or
> +        op.getopnum() == rop.CALL_LOOPINVARIANT):
>           op = ResOperation(rop.CALL, op.getarglist()[1:], op.result,
>                             op.getdescr())
>       elif op.getopnum() == rop.VIRTUAL_REF:

Hi,
I just wanted to tell that since the resoperation-refactoring, there is now a 
nice "copy_and_change" method to be used exactly for the case where you want 
to replace an operation with a "similar" one.

So, the code above should be written like:

    op = op.copy_and_change(rop.CALL, args=op.getarglist()[1:])

ciao,
Anto



More information about the Pypy-dev mailing list