[pypy-commit] pypy default: 32-bit JIT: avoid one obscure "call(llong_sub, x, 0)"

arigo noreply at buildbot.pypy.org
Thu Sep 4 14:26:38 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r73298:3f18f8fae752
Date: 2014-09-04 14:26 +0200
http://bitbucket.org/pypy/pypy/changeset/3f18f8fae752/

Log:	32-bit JIT: avoid one obscure "call(llong_sub, x, 0)"

diff --git a/pypy/module/_lsprof/interp_lsprof.py b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -175,7 +175,11 @@
 
     def _stop(self, profobj, entry):
         tt = profobj.ll_timer() - self.ll_t0
-        it = tt - self.ll_subt
+        ll_subt = self.ll_subt
+        if jit.isconstant(ll_subt) and not ll_subt:
+            it = tt       # for 32-bit JIT: avoid the 'call(llong_sub, tt, 0)'
+        else:
+            it = tt - ll_subt
         if self.previous:
             self.previous.ll_subt += tt
         entry._stop(tt, it)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
--- a/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_cprofile.py
@@ -34,7 +34,7 @@
             r = re.compile(r" call[(]ConstClass[(](.+?)[)]")
             calls = r.findall(repr(loop.ops_by_id(method)))
             if sys.maxint == 2147483647:
-                assert len(calls) == 6
+                assert len(calls) == 5
             else:
                 assert len(calls) == 2
             for x in calls:


More information about the pypy-commit mailing list