[pypy-svn] r35249 - in pypy/branch/jit-real-world/pypy: annotation jit/timeshifter jit/timeshifter/test
arigo at codespeak.net
arigo at codespeak.net
Mon Dec 4 12:24:53 CET 2006
Author: arigo
Date: Mon Dec 4 12:24:51 2006
New Revision: 35249
Modified:
pypy/branch/jit-real-world/pypy/annotation/model.py
pypy/branch/jit-real-world/pypy/jit/timeshifter/test/test_promotion.py
pypy/branch/jit-real-world/pypy/jit/timeshifter/transform.py
Log:
Last check-in from yesterday night.
Modified: pypy/branch/jit-real-world/pypy/annotation/model.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/annotation/model.py (original)
+++ pypy/branch/jit-real-world/pypy/annotation/model.py Mon Dec 4 12:24:51 2006
@@ -606,8 +606,7 @@
if v is None:
# i think we can only get here in the case of void-returning
# functions
- from pypy.annotation.bookkeeper import getbookkeeper
- return getbookkeeper().immutablevalue(None)
+ return s_None
if isinstance(v, MethodType):
ll_ptrtype = lltype.typeOf(v.im_self)
assert isinstance(ll_ptrtype, lltype.Ptr)
Modified: pypy/branch/jit-real-world/pypy/jit/timeshifter/test/test_promotion.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/timeshifter/test/test_promotion.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/timeshifter/test/test_promotion.py Mon Dec 4 12:24:51 2006
@@ -215,16 +215,20 @@
assert res == ll_function(6, 3, 2, 2)
def test_green_across_global_mp(self):
- def ll_function(n, total):
- while n:
+ def ll_function(n1, n2, n3, n4, total):
+ while n2:
hint(None, global_merge_point=True)
- total += n
- hint(n, concrete=True)
- n -= 1
+ total += n3
+ hint(n4, concrete=True)
+ hint(n3, concrete=True)
+ hint(n2, concrete=True)
+ hint(n1, concrete=True)
+ n2 -= 1
return total
- res = self.timeshift(ll_function, [5, 100], [0], policy=P_NOVIRTUAL)
- assert res == 115
+ res = self.timeshift(ll_function, [None, 4, 3, None, 100], [0],
+ policy=P_NOVIRTUAL)
+ assert res == ll_function(None, 4, 3, None, 100)
def test_remembers_across_mp(self):
def ll_function(x, flag):
Modified: pypy/branch/jit-real-world/pypy/jit/timeshifter/transform.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/jit/timeshifter/transform.py (original)
+++ pypy/branch/jit-real-world/pypy/jit/timeshifter/transform.py Mon Dec 4 12:24:51 2006
@@ -108,11 +108,12 @@
def graph_calling_color(self, tsgraph):
args_hs, hs_res = self.hannotator.bookkeeper.tsgraphsigs[tsgraph]
if originalconcretetype(hs_res) is lltype.Void:
- return 'gray'
+ c = 'gray'
elif hs_res.is_green():
- return 'yellow'
+ c = 'yellow'
else:
- return 'red'
+ c = 'red'
+ return c
def timeshifted_graph_of(self, graph, args_v):
bk = self.hannotator.bookkeeper
@@ -349,6 +350,11 @@
N = self.get_resume_point(mergeblock)
c_resumeindex = inputconst(lltype.Signed, N)
self.genop(block, 'guard_global_merge', [c_resumeindex])
+
+ # Note: the jitstate.greens list will contain the correct
+ # green gv's for the following global_merge_point, because
+ # the green values have just been restored by the resume
+ # point logic here
else:
mergeblock = block
greens2 = greens1
@@ -526,21 +532,29 @@
def handle_red_call(self, block, pos, color='red'):
link = split_block(self.hannotator, block, pos+1)
op = block.operations.pop(pos)
+ #if op.opname == 'direct_call':
+ # f = open('LOG', 'a')
+ # print >> f, color, op.args[0].value
+ # f.close()
assert len(block.operations) == pos
nextblock = link.target
linkargs = link.args
varsalive = list(linkargs)
-
+
+ if color == 'red':
+ assert not self.hannotator.binding(op.result).is_green()
+
try:
index = varsalive.index(op.result)
+ except ValueError:
+ uses_retval = False
+ else:
uses_retval = True # it will be restored by a restore_local
del varsalive[index]
old_v_result = linkargs.pop(index)
linkargs.insert(0, old_v_result)
v_result = nextblock.inputargs.pop(index)
nextblock.inputargs.insert(0, v_result)
- except ValueError:
- uses_retval = False
reds, greens = self.sort_by_color(varsalive)
@@ -607,6 +621,10 @@
def handle_yellow_call(self, block, pos):
op = block.operations[pos]
+ #if op.opname == 'direct_call':
+ # f = open('LOG', 'a')
+ # print >> f, 'handle_yellow_call', op.args[0].value
+ # f.close()
hs_result = self.hannotator.binding(op.result)
if not hs_result.is_green():
# yellow calls are supposed to return greens,
More information about the Pypy-commit
mailing list