[pypy-svn] r36036 - pypy/dist/pypy/translator/backendopt
antocuni at codespeak.net
antocuni at codespeak.net
Fri Dec 29 14:47:08 CET 2006
Author: antocuni
Date: Fri Dec 29 14:47:08 2006
New Revision: 36036
Modified:
pypy/dist/pypy/translator/backendopt/malloc.py
Log:
Other steps in porting malloc removal to ootype. Now BaseMallocRemover
should be free from any explicit reference to lltype.
Modified: pypy/dist/pypy/translator/backendopt/malloc.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/malloc.py (original)
+++ pypy/dist/pypy/translator/backendopt/malloc.py Fri Dec 29 14:47:08 2006
@@ -30,10 +30,10 @@
def get_STRUCT(self, TYPE):
raise NotImplementedError
- def do_substruct_access(self, op):
+ def visit_substruct_op(self, node, union, op):
raise NotImplementedError
- def equivalent_substruct(self, S, fieldname):
+ def do_substruct_access(self, op):
raise NotImplementedError
def union_wrapper(self, S):
@@ -91,10 +91,7 @@
union(node, op.args[0], node, op.result)
continue
if op.opname in self.SUBSTRUCT_OPS:
- S = op.args[0].concretetype.TO
- if self.equivalent_substruct(S, op.args[1].value):
- # assumed to be similar to a cast_pointer
- union(node, op.args[0], node, op.result)
+ if self.visit_substruct_op(node, union, op):
continue
for i in range(len(op.args)):
if isinstance(op.args[i], Variable):
@@ -276,6 +273,14 @@
assert isinstance(STRUCT, lltype.GcStruct)
return STRUCT
+ def visit_substruct_op(self, node, union, op):
+ S = op.args[0].concretetype.TO
+ if self.equivalent_substruct(S, op.args[1].value):
+ # assumed to be similar to a cast_pointer
+ union(node, op.args[0], node, op.result)
+ return True
+ return False
+
def do_substruct_access(self, op):
S = op.args[0].concretetype.TO
name = op.args[1].value
More information about the Pypy-commit
mailing list