[pypy-svn] r70338 - in pypy/branch/virtual-forcing/pypy: jit/backend/test jit/metainterp jit/metainterp/test translator/benchmark
arigo at codespeak.net
arigo at codespeak.net
Tue Dec 29 16:28:43 CET 2009
Author: arigo
Date: Tue Dec 29 16:28:42 2009
New Revision: 70338
Modified:
pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
pypy/branch/virtual-forcing/pypy/jit/metainterp/optimizeopt.py
pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_optimizeopt.py
pypy/branch/virtual-forcing/pypy/translator/benchmark/bench-custom.py
pypy/branch/virtual-forcing/pypy/translator/benchmark/jitbench.py
pypy/branch/virtual-forcing/pypy/translator/benchmark/result.py
Log:
Merge trunk changes, -r70326:70337.
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py Tue Dec 29 16:28:42 2009
@@ -466,12 +466,13 @@
assert abs(res.value - 4.6) < 0.0001
def test_call_stack_alignment(self):
- # test stack alignment issues, notably for Mac OS/X
+ # test stack alignment issues, notably for Mac OS/X.
+ # also test the ordering of the arguments.
def func_ints(*ints):
s = str(ints) + '\n'
os.write(1, s) # don't remove -- crash if the stack is misaligned
- return sum(ints)
+ return sum([(10+i)*(5+j) for i, j in enumerate(ints)])
for nb_args in range(0, 35):
cpu = self.cpu
@@ -486,7 +487,7 @@
res = self.execute_operation(rop.CALL,
[funcbox] + map(BoxInt, args),
'int', descr=calldescr)
- assert res.value == sum(args)
+ assert res.value == func_ints(*args)
def test_field_basic(self):
t_box, T_box = self.alloc_instance(self.T)
Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/optimizeopt.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/optimizeopt.py Tue Dec 29 16:28:42 2009
@@ -798,11 +798,11 @@
def optimize_SETFIELD_GC(self, op):
value = self.getvalue(op.args[0])
+ fieldvalue = self.getvalue(op.args[1])
if value.is_virtual():
- value.setfield(op.descr, self.getvalue(op.args[1]))
+ value.setfield(op.descr, fieldvalue)
else:
value.ensure_nonnull()
- fieldvalue = self.getvalue(op.args[1])
self.heap_op_optimizer.optimize_SETFIELD_GC(op, value, fieldvalue)
def optimize_NEW_WITH_VTABLE(self, op):
@@ -907,9 +907,14 @@
d[value] = fieldvalue
def read_cached_field(self, descr, value):
+ # XXX self.cached_fields and self.lazy_setfields should probably
+ # be merged somehow
d = self.cached_fields.get(descr, None)
if d is None:
- return None
+ op = self.lazy_setfields.get(descr, None)
+ if op is None:
+ return None
+ return self.optimizer.getvalue(op.args[1])
return d.get(value, None)
def cache_arrayitem_value(self, descr, value, indexvalue, fieldvalue, write=False):
Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_optimizeopt.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_optimizeopt.py Tue Dec 29 16:28:42 2009
@@ -1369,6 +1369,28 @@
"""
self.optimize_loop(ops, 'Not, Not, Not, Not', expected)
+ def test_duplicate_setfield_5(self):
+ ops = """
+ [p0, i1]
+ p1 = new_with_vtable(ConstClass(node_vtable))
+ setfield_gc(p1, i1, descr=valuedescr)
+ setfield_gc(p0, p1, descr=nextdescr)
+ setfield_raw(i1, i1, descr=valuedescr) # random op with side-effects
+ p2 = getfield_gc(p0, descr=nextdescr)
+ i2 = getfield_gc(p2, descr=valuedescr)
+ setfield_gc(p0, NULL, descr=nextdescr)
+ escape(i2)
+ jump(p0, i1)
+ """
+ expected = """
+ [p0, i1]
+ setfield_raw(i1, i1, descr=valuedescr)
+ setfield_gc(p0, NULL, descr=nextdescr)
+ escape(i1)
+ jump(p0, i1)
+ """
+ self.optimize_loop(ops, 'Not, Not', expected)
+
def test_duplicate_setfield_sideeffects_1(self):
ops = """
[p1, i1, i2]
Modified: pypy/branch/virtual-forcing/pypy/translator/benchmark/bench-custom.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/benchmark/bench-custom.py (original)
+++ pypy/branch/virtual-forcing/pypy/translator/benchmark/bench-custom.py Tue Dec 29 16:28:42 2009
@@ -44,6 +44,7 @@
sys.stdout.flush()
refs = {}
+ final_error_count = 0
if not options.nocpython:
exes = full_pythons + exes
@@ -52,7 +53,10 @@
if i is not None:
for exe in exes:
for b in benchmarks:
- benchmark_result.result(exe, allowcreate=True).run_benchmark(b, verbose=options.verbose)
+ br = benchmark_result.result(exe, allowcreate=True)
+ result = br.run_benchmark(b, verbose=options.verbose)
+ if not result:
+ final_error_count += 1
if options.relto:
relto = options.relto
@@ -83,6 +87,9 @@
print row
print
+ if final_error_count:
+ raise SystemExit("%d benchmark run(s) failed" % final_error_count)
+
if __name__ == '__main__':
from optparse import OptionParser
parser = OptionParser()
Modified: pypy/branch/virtual-forcing/pypy/translator/benchmark/jitbench.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/benchmark/jitbench.py (original)
+++ pypy/branch/virtual-forcing/pypy/translator/benchmark/jitbench.py Tue Dec 29 16:28:42 2009
@@ -13,9 +13,17 @@
os.chdir(os.path.dirname(sys.argv[0]) or '.')
+errors = []
+
for sizefactor in sizefactors:
for executable in executables:
sys.argv[1:] = [executable, '--pickle=jitbench.benchmark_result',
'-v', '--no-cpython',
'--size-factor=%d' % sizefactor]
- execfile('bench-custom.py')
+ try:
+ execfile('bench-custom.py')
+ except SystemExit, e:
+ errors.append(str(e))
+
+if errors:
+ raise SystemExit('\n'.join(errors))
Modified: pypy/branch/virtual-forcing/pypy/translator/benchmark/result.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/translator/benchmark/result.py (original)
+++ pypy/branch/virtual-forcing/pypy/translator/benchmark/result.py Tue Dec 29 16:28:42 2009
@@ -88,7 +88,7 @@
def run_benchmark(self, benchmark, verbose=False):
self.asc_goods[benchmark.name] = benchmark.asc_good
if self.run_counts.get(benchmark.name, 0) > self.max_results:
- return
+ return -1
print 'running', benchmark.name, 'for', self.exe_name,
if verbose and self.pypy_rev > 0:
print '[rev %d]' % self.pypy_rev,
@@ -102,7 +102,7 @@
print '}'
self.run_counts[benchmark.name] = self.run_counts.get(benchmark.name, 0) + 1
if new_result == '-FAILED-':
- return
+ return 0
self.benchmarks.setdefault(benchmark.name, []).append(new_result)
if benchmark.name in self.best_benchmarks:
old_result = self.best_benchmarks[benchmark.name]
@@ -111,6 +111,7 @@
else:
new_result = min(new_result, old_result)
self.best_benchmarks[benchmark.name] = new_result
+ return 1
def getstat(self, *args):
# oh for supplied-p!
More information about the Pypy-commit
mailing list