[pypy-svn] r32301 - pypy/branch/kill-keepalives/pypy/translator/backendopt
mwh at codespeak.net
mwh at codespeak.net
Thu Sep 14 12:47:47 CEST 2006
Author: mwh
Date: Thu Sep 14 12:47:44 2006
New Revision: 32301
Modified:
pypy/branch/kill-keepalives/pypy/translator/backendopt/malloc.py
Log:
a tiny amount of support in malloc removal for get/setinteriorfield
i think (hope) that malloc removal can become a fair bit less complicated in
the end.
Modified: pypy/branch/kill-keepalives/pypy/translator/backendopt/malloc.py
==============================================================================
--- pypy/branch/kill-keepalives/pypy/translator/backendopt/malloc.py (original)
+++ pypy/branch/kill-keepalives/pypy/translator/backendopt/malloc.py Thu Sep 14 12:47:44 2006
@@ -176,6 +176,14 @@
return False # non-constant array index
if op.opname in FIELD_ACCESS:
pass # ok
+ elif op.opname == 'getinteriorfield':
+ for arg in op.args[1:]:
+ if not isinstance(arg, Constant):
+ return False
+ elif op.opname == 'setinteriorfield':
+ for arg in op.args[1:-1]:
+ if not isinstance(arg, Constant):
+ return False
elif op.opname in SUBSTRUCT_ACCESS:
S = op.args[0].concretetype.TO
name = op.args[1].value
@@ -298,6 +306,19 @@
op.result)
newops.append(newop)
last_removed_access = len(newops)
+ elif op.opname == "getinteriorfield":
+ S = op.args[0].concretetype.TO
+ key = tuple([S] + [a.value for a in op.args[1:]])
+ newop = SpaceOperation("same_as",
+ [newvarsmap[key]],
+ op.result)
+ newops.append(newop)
+ last_removed_access = len(newops)
+ elif op.opname == "setinteriorfield":
+ S = op.args[0].concretetype.TO
+ key = tuple([S] + [a.value for a in op.args[1:-1]])
+ newvarsmap[key] = op.args[-1]
+ last_removed_access = len(newops)
elif op.opname in ("setfield", "setarrayitem"):
S = op.args[0].concretetype.TO
fldname = op.args[1].value
More information about the Pypy-commit
mailing list