On Mon, Oct 4, 2010 at 11:56 PM, Antonio Cuni <anto.c...@gmail.com> wrote:
> On 04/10/10 23:32, fi...@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:])

ah, great! :)

>
> ciao,
> Anto
> _______________________________________________
> pypy-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/pypy-dev
>
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to