[pypy-svn] r77304 - pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt
antocuni at codespeak.net
antocuni at codespeak.net
Thu Sep 23 17:09:08 CEST 2010
Author: antocuni
Date: Thu Sep 23 17:09:06 2010
New Revision: 77304
Modified:
pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/ccall.py
Log:
use getvalue() everywhere, instead of accessing directly to the boxes
Modified: pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/ccall.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/ccall.py (original)
+++ pypy/branch/jitffi/pypy/jit/metainterp/optimizeopt/ccall.py Thu Sep 23 17:09:06 2010
@@ -7,10 +7,10 @@
def __init__(self):
self.func_args = {}
- def get_oopspec(self, funcbox):
+ def get_oopspec(self, funcval):
# XXX: not RPython at all, just a hack while waiting to have an
# "official" way to know if and which oopspec we are calling
- funcname = str(funcbox)
+ funcname = str(funcval.box)
if '_libffi_prepare_call' in funcname:
return 'prepare_call'
elif '_libffi_push_arg' in funcname:
@@ -20,8 +20,8 @@
return None
def optimize_CALL(self, op):
- funcbox = op.getarg(0)
- oopspec = self.get_oopspec(funcbox)
+ funcval = self.getvalue(op.getarg(0))
+ oopspec = self.get_oopspec(funcval)
if oopspec == 'prepare_call':
self.do_prepare_call(op)
return
@@ -33,22 +33,25 @@
self.emit_operation(op)
def do_prepare_call(self, op):
- funcbox = op.getarg(1)
- assert funcbox not in self.func_args
- self.func_args[funcbox] = []
+ funcval = self.getvalue(op.getarg(1))
+ assert funcval not in self.func_args
+ self.func_args[funcval] = []
def do_push_arg(self, op):
- funcbox = op.getarg(1)
- self.func_args[funcbox].append(op)
+ # we store the op in func_args because we might want to emit it later,
+ # in case we give up with the optimization
+ funcval = self.getvalue(op.getarg(1))
+ self.func_args[funcval].append(op)
def do_call(self, op):
- funcbox = op.getarg(1)
- funcsymbox = op.getarg(2)
- arglist = [funcsymbox]
- for push_op in self.func_args[funcbox]:
- arglist.append(push_op.getarg(2))
+ funcval = self.getvalue(op.getarg(1))
+ funcsymval = self.getvalue(op.getarg(2))
+ arglist = [funcsymval.force_box()]
+ for push_op in self.func_args[funcval]:
+ argval = self.getvalue(push_op.getarg(2))
+ arglist.append(argval.force_box())
newop = ResOperation(rop.CALL_C, arglist, op.result, None)
- del self.func_args[funcbox]
+ del self.func_args[funcval]
return newop
def propagate_forward(self, op):
More information about the Pypy-commit
mailing list