[pypy-commit] pypy default: some cleanups (no behaviour changes yet)
cfbolz
noreply at buildbot.pypy.org
Fri Apr 4 17:30:19 CEST 2014
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r70439:ec122f84c324
Date: 2014-04-04 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/ec122f84c324/
Log: some cleanups (no behaviour changes yet)
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -584,7 +584,6 @@
for guard in extra_guards:
if guard.is_guard():
- import pdb; pdb.set_trace()
descr = target.resume_at_jump_descr.clone_if_mutable()
inliner.inline_descr_inplace(descr)
guard.setdescr(descr)
diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -18,7 +18,10 @@
position = -1
def generalization_of(self, other, renum, bad):
- raise NotImplementedError
+ result = self.generalization_of_dont_handle_bad(other, renum, bad)
+ if not result:
+ bad[self] = bad[other] = None
+ return result
def generate_guards(self, other, box, cpu, extra_guards, renum):
if self.generalization_of(other, renum, {}):
@@ -67,37 +70,27 @@
def __init__(self, fielddescrs):
self.fielddescrs = fielddescrs
- def generalization_of(self, other, renum, bad):
+ def generalization_of_dont_handle_bad(self, other, renum, bad):
assert self.position != -1
if self.position in renum:
if renum[self.position] == other.position:
return True
- bad[self] = None
- bad[other] = None
return False
renum[self.position] = other.position
if not self._generalization_of(other):
- bad[self] = None
- bad[other] = None
return False
assert isinstance(other, AbstractVirtualStructStateInfo)
assert len(self.fielddescrs) == len(self.fieldstate)
assert len(other.fielddescrs) == len(other.fieldstate)
if len(self.fielddescrs) != len(other.fielddescrs):
- bad[self] = None
- bad[other] = None
return False
for i in range(len(self.fielddescrs)):
if other.fielddescrs[i] is not self.fielddescrs[i]:
- bad[self] = None
- bad[other] = None
return False
if not self.fieldstate[i].generalization_of(other.fieldstate[i],
renum, bad):
- bad[self] = None
- bad[other] = None
return False
return True
@@ -130,11 +123,8 @@
self.known_class = known_class
def _generalization_of(self, other):
- if not isinstance(other, VirtualStateInfo):
- return False
- if not self.known_class.same_constant(other.known_class):
- return False
- return True
+ return (isinstance(other, VirtualStateInfo) and
+ self.known_class.same_constant(other.known_class))
def debug_header(self, indent):
debug_print(indent + 'VirtualStateInfo(%d):' % self.position)
@@ -146,11 +136,8 @@
self.typedescr = typedescr
def _generalization_of(self, other):
- if not isinstance(other, VStructStateInfo):
- return False
- if self.typedescr is not other.typedescr:
- return False
- return True
+ return (isinstance(other, VStructStateInfo) and
+ self.typedescr is other.typedescr)
def debug_header(self, indent):
debug_print(indent + 'VStructStateInfo(%d):' % self.position)
@@ -165,28 +152,20 @@
return (isinstance(other, VArrayStateInfo) and
self.arraydescr is other.arraydescr)
- def generalization_of(self, other, renum, bad):
+ def generalization_of_dont_handle_bad(self, other, renum, bad):
assert self.position != -1
if self.position in renum:
if renum[self.position] == other.position:
return True
- bad[self] = None
- bad[other] = None
return False
renum[self.position] = other.position
if not self._generalization_of(other):
- bad[self] = None
- bad[other] = None
return False
if len(self.fieldstate) != len(other.fieldstate):
- bad[self] = None
- bad[other] = None
return False
for i in range(len(self.fieldstate)):
if not self.fieldstate[i].generalization_of(other.fieldstate[i],
renum, bad):
- bad[self] = None
- bad[other] = None
return False
return True
@@ -216,41 +195,29 @@
self.arraydescr = arraydescr
self.fielddescrs = fielddescrs
- def generalization_of(self, other, renum, bad):
+ def generalization_of_dont_handle_bad(self, other, renum, bad):
assert self.position != -1
if self.position in renum:
if renum[self.position] == other.position:
return True
- bad[self] = None
- bad[other] = None
return False
renum[self.position] = other.position
if not self._generalization_of(other):
- bad[self] = None
- bad[other] = None
return False
assert isinstance(other, VArrayStructStateInfo)
if len(self.fielddescrs) != len(other.fielddescrs):
- bad[self] = None
- bad[other] = None
return False
p = 0
for i in range(len(self.fielddescrs)):
if len(self.fielddescrs[i]) != len(other.fielddescrs[i]):
- bad[self] = None
- bad[other] = None
return False
for j in range(len(self.fielddescrs[i])):
if self.fielddescrs[i][j] is not other.fielddescrs[i][j]:
- bad[self] = None
- bad[other] = None
return False
if not self.fieldstate[p].generalization_of(other.fieldstate[p],
renum, bad):
- bad[self] = None
- bad[other] = None
return False
p += 1
return True
@@ -302,49 +269,33 @@
self.position_in_notvirtuals = -1
self.lenbound = value.lenbound
- def generalization_of(self, other, renum, bad):
+ def generalization_of_dont_handle_bad(self, other, renum, bad):
# XXX This will always retrace instead of forcing anything which
# might be what we want sometimes?
assert self.position != -1
if self.position in renum:
if renum[self.position] == other.position:
return True
- bad[self] = None
- bad[other] = None
return False
renum[self.position] = other.position
if not isinstance(other, NotVirtualStateInfo):
- bad[self] = None
- bad[other] = None
return False
if other.level < self.level:
- bad[self] = None
- bad[other] = None
return False
if self.level == LEVEL_CONSTANT:
if not self.constbox.same_constant(other.constbox):
- bad[self] = None
- bad[other] = None
return False
elif self.level == LEVEL_KNOWNCLASS:
if not self.known_class.same_constant(other.known_class):
- bad[self] = None
- bad[other] = None
return False
if not self.intbound.contains_bound(other.intbound):
- bad[self] = None
- bad[other] = None
return False
if self.lenbound and other.lenbound:
if self.lenbound.mode != other.lenbound.mode or \
self.lenbound.descr != other.lenbound.descr or \
not self.lenbound.bound.contains_bound(other.lenbound.bound):
- bad[self] = None
- bad[other] = None
return False
elif self.lenbound:
- bad[self] = None
- bad[other] = None
return False
return True
More information about the pypy-commit
mailing list