[pypy-svn] r65652 - pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp
antocuni at codespeak.net
antocuni at codespeak.net
Mon Jun 8 00:13:05 CEST 2009
Author: antocuni
Date: Mon Jun 8 00:13:03 2009
New Revision: 65652
Modified:
pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize3.py
Log:
more refactoring&simplification: don't track the constness of nodes, as nobody
is using it so far. The idea is that optimizatons relying on the constness
should be done during the optimize_operation phase, not during the find_node
phase. I'm not 100% sure this will cover all possible case though, so maybe
we will need to reintroduce this later.
Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize3.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize3.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize3.py Mon Jun 8 00:13:03 2009
@@ -5,18 +5,14 @@
class InstanceNode(object):
- def __init__(self, source, const=False, escaped=True):
+ def __init__(self, source, escaped=True):
self.source = source
- if const:
- assert isinstance(source, Const)
- self.const = const
self.escaped = escaped
def __repr__(self):
flags = ''
if self.escaped: flags += 'e'
#if self.startbox: flags += 's'
- if self.const: flags += 'c'
#if self.virtual: flags += 'v'
#if self.virtualized: flags += 'V'
return "<InstanceNode %s (%s)>" % (self.source, flags)
@@ -68,10 +64,7 @@
try:
return self.nodes[box]
except KeyError:
- if isinstance(box, Const):
- node = self.newnode(box, const=True)
- else:
- node = self.newnode(box)
+ node = self.newnode(box)
self.nodes[box] = node
return node
@@ -82,17 +75,11 @@
for op in self.loop.operations:
self._find_nodes_in_guard_maybe(op)
- if self._is_pure_and_constfoldable(op):
- box = op.result
- assert box is not None
- self.nodes[box] = self.newnode(box.constbox(), const=True)
- else:
- # default case
- for box in op.args:
- self.getnode(box)
- box = op.result
- if box is not None:
- self.nodes[box] = self.newnode(box)
+ for box in op.args:
+ self.getnode(box)
+ resbox = op.result
+ if resbox is not None:
+ self.nodes[resbox] = self.newnode(resbox)
for optimization in self.optlist:
optimization.find_nodes_for_op(self, op)
@@ -103,14 +90,6 @@
for arg in op.suboperations[0].args:
self.getnode(arg)
- def _is_pure_and_constfoldable(self, op):
- if not op.is_always_pure():
- return False
- for arg in op.args:
- if not self.getnode(arg).const:
- return False
- return True
-
class LoopOptimizer(object):
@@ -293,13 +272,13 @@
def find_nodes_new_with_vtable(self, spec, op):
box = op.result
node = spec.newnode(box, escaped=False)
- node.known_class = spec.newnode(op.args[0], const=True)
+ node.known_class = spec.newnode(op.args[0])
spec.nodes[box] = node
def find_nodes_guard_class(self, spec, op):
node = spec.getnode(op.args[0])
if node.known_class is None:
- node.known_class = spec.newnode(op.args[1], const=True)
+ node.known_class = spec.newnode(op.args[1])
# -----------------------------
More information about the Pypy-commit
mailing list