Author: Armin Rigo <[email protected]>
Branch:
Changeset: r67826:0ffd6995f846
Date: 2013-11-04 08:31 +0100
http://bitbucket.org/pypy/pypy/changeset/0ffd6995f846/
Log: The 'jitcounter' is another new object that is global, and that must
be reset between tests in case they are using the same piece of
compiled code.
diff --git a/pypy/module/micronumpy/test/test_zjit.py
b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -6,7 +6,7 @@
import py
from rpython.jit.metainterp import pyjitpl
from rpython.jit.metainterp.test.support import LLJitMixin
-from rpython.jit.metainterp.warmspot import reset_stats, get_stats
+from rpython.jit.metainterp.warmspot import reset_jit, get_stats
from pypy.module.micronumpy import interp_boxes
from pypy.module.micronumpy.compile import FakeSpace, Parser, InterpreterState
from pypy.module.micronumpy.base import W_NDimArray
@@ -67,8 +67,7 @@
def run(self, name):
self.compile_graph()
- reset_stats()
- pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear()
+ reset_jit()
i = self.code_mapping[name]
retval = self.interp.eval_graph(self.graph, [i])
py.test.skip("don't run for now")
@@ -147,8 +146,7 @@
def test_reduce_compile_only_once(self):
self.compile_graph()
- reset_stats()
- pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear()
+ reset_jit()
i = self.code_mapping['reduce']
# run it twice
retval = self.interp.eval_graph(self.graph, [i])
@@ -158,8 +156,7 @@
def test_reduce_axis_compile_only_once(self):
self.compile_graph()
- reset_stats()
- pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear()
+ reset_jit()
i = self.code_mapping['axissum']
# run it twice
retval = self.interp.eval_graph(self.graph, [i])
diff --git a/rpython/jit/metainterp/counter.py
b/rpython/jit/metainterp/counter.py
--- a/rpython/jit/metainterp/counter.py
+++ b/rpython/jit/metainterp/counter.py
@@ -151,3 +151,7 @@
def decay_all_counters(self):
"NOT_RPYTHON"
pass
+
+ def _clear_all(self):
+ self.timetable.clear()
+ self.celltable.clear()
diff --git a/rpython/jit/metainterp/test/support.py
b/rpython/jit/metainterp/test/support.py
--- a/rpython/jit/metainterp/test/support.py
+++ b/rpython/jit/metainterp/test/support.py
@@ -3,6 +3,7 @@
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.jit.backend.llgraph import runner
from rpython.jit.metainterp.warmspot import ll_meta_interp, get_stats
+from rpython.jit.metainterp.warmspot import reset_stats
from rpython.jit.metainterp.warmstate import unspecialize_value
from rpython.jit.metainterp.optimizeopt import ALL_OPTS_DICT
from rpython.jit.metainterp import pyjitpl, history, jitexc
diff --git a/rpython/jit/metainterp/warmspot.py
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -164,6 +164,12 @@
def reset_stats():
pyjitpl._warmrunnerdesc.stats.clear()
+def reset_jit():
+ """Helper for some tests (see micronumpy/test/test_zjit.py)"""
+ reset_stats()
+ pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear()
+ pyjitpl._warmrunnerdesc.jitcounter._clear_all()
+
def get_translator():
return pyjitpl._warmrunnerdesc.translator
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit