[pypy-svn] r37708 - in pypy/branch/jit-virtual-world/pypy/jit/timeshifter: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Feb 1 03:36:28 CET 2007
Author: arigo
Date: Thu Feb 1 03:36:26 2007
New Revision: 37708
Modified:
pypy/branch/jit-virtual-world/pypy/jit/timeshifter/rtimeshift.py
pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py
Log:
(pedronis, arigo)
Test case eventually designed (ha!) after a pypyjit assertion.
Fix.
Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/rtimeshift.py (original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/rtimeshift.py Thu Feb 1 03:36:26 2007
@@ -226,13 +226,16 @@
states_dic[key][index] = (frozen, newblock)
if global_resumer is not None and global_resumer is not return_marker:
+ assert jitstate.resuming is None
jitstate.curbuilder.log('start_new_block %s' % (key,))
greens_gv = jitstate.greens
rgenop = jitstate.curbuilder.rgenop
node = PromotionPathRoot(greens_gv, rgenop,
frozen, newblock,
global_resumer)
- jitstate.frame.dispatchqueue.mergecounter = 0
+ dispatchqueue = jitstate.frame.dispatchqueue
+ assert dispatchqueue.split_chain is None
+ dispatchqueue.clearlocalcaches()
jitstate.promotion_path = PromotionPathMergesToSee(node, 0)
#debug_print(lltype.Void, "PROMOTION ROOT")
start_new_block._annspecialcase_ = "specialize:arglltype(2)"
@@ -701,6 +704,9 @@
self.split_chain = None
self.global_merge_chain = None
self.return_chain = None
+ self.clearlocalcaches()
+
+ def clearlocalcaches(self):
self.mergecounter = 0
def clear(self):
@@ -711,8 +717,8 @@
return BaseDispatchQueue
attrnames = unrolling_iterable(attrnames)
class DispatchQueue(BaseDispatchQueue):
- def __init__(self):
- BaseDispatchQueue.__init__(self)
+ def clearlocalcaches(self):
+ BaseDispatchQueue.clearlocalcaches(self)
for name in attrnames:
setattr(self, name, {}) # the new dicts have various types!
return DispatchQueue
Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py (original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py Thu Feb 1 03:36:26 2007
@@ -275,3 +275,27 @@
assert res == 6
self.check_oops(**{'newlist': 1, 'list.len': 1})
+ def test_promote_bug_1(self):
+ def ll_function(x, y, z):
+ a = 17
+ while True:
+ hint(None, global_merge_point=True)
+ y += 1
+
+ if a != 17:
+ z = -z
+
+ if z > 0:
+ b = 1 - z
+ else:
+ b = 2
+ y = -y
+ if b == 2:
+ hint(z, promote=True)
+ return y + z + a
+ a += z
+
+ assert ll_function(1, 5, 8) == 22
+ res = self.timeshift(ll_function, [1, 5, 8], [],
+ policy=P_NOVIRTUAL)
+ assert res == 22
More information about the pypy-svn
mailing list