Author: Maciej Fijalkowski <[email protected]>
Branch: vmprof
Changeset: r76716:0e77fb70def9
Date: 2015-04-05 09:17 +0200
http://bitbucket.org/pypy/pypy/changeset/0e77fb70def9/

Log:    merge

diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -4,6 +4,7 @@
 from rpython.rtyper.annlowlevel import cast_instance_to_gcref, 
cast_base_ptr_to_instance
 from rpython.rlib.objectmodel import we_are_translated
 from rpython.rlib import jit, rposix, rgc
+from rpython.rlib.rarithmetic import ovfcheck_float_to_int
 from rpython.rtyper.tool import rffi_platform as platform
 from rpython.rlib.rstring import StringBuilder
 from pypy.interpreter.baseobjspace import W_Root
@@ -222,12 +223,12 @@
     assert isinstance(mod_vmprof, Module)
     #
     try:
-        period_usec = int(period * 1000000.0 + 0.5)
+        period_usec = ovfcheck_float_to_int(period * 1000000.0 + 0.5)
         if period_usec <= 0:
             raise ValueError
     except (ValueError, OverflowError):
-        raise OperationError(self.w_ValueError,
-                             self.wrap("'period' too large or non positive"))
+        raise OperationError(space.w_ValueError,
+                             space.wrap("'period' too large or non positive"))
     #
     mod_vmprof.vmprof.enable(space, fileno, period_usec)
 
diff --git a/pypy/module/_vmprof/test/test__vmprof.py 
b/pypy/module/_vmprof/test/test__vmprof.py
--- a/pypy/module/_vmprof/test/test__vmprof.py
+++ b/pypy/module/_vmprof/test/test__vmprof.py
@@ -58,3 +58,11 @@
         assert "py:foo:" in s
         assert "py:foo2:" in s
         assert no_of_codes2 >= no_of_codes + 2 # some extra codes from tests
+
+    def test_enable_ovf(self):
+        import _vmprof
+        raises(ValueError, _vmprof.enable, 999, 0)
+        raises(ValueError, _vmprof.enable, 999, -2.5)
+        raises(ValueError, _vmprof.enable, 999, 1e300)
+        raises(ValueError, _vmprof.enable, 999, 1e300 * 1e300)
+        raises(ValueError, _vmprof.enable, 999, (1e300*1e300) / (1e300*1e300))
diff --git a/rpython/jit/backend/llsupport/codemap.py 
b/rpython/jit/backend/llsupport/codemap.py
--- a/rpython/jit/backend/llsupport/codemap.py
+++ b/rpython/jit/backend/llsupport/codemap.py
@@ -151,6 +151,12 @@
                 return
             assert unique_id & 1 == 0
             if call_depth > self.last_call_depth:
+                assert call_depth == self.last_call_depth + 1
+                # ^^^ It should never be the case that we see
+                # debug_merge_points that suddenly go more than *one*
+                # call deeper than the previous one (unless we're at
+                # the start of a bridge, handled by
+                # inherit_code_from_position()).
                 self.l.append(unique_id)
                 self.l.append(pos) # <- this is a relative pos
                 self.patch_position.append(len(self.l))
diff --git a/rpython/jit/backend/llsupport/test/test_codemap.py 
b/rpython/jit/backend/llsupport/test/test_codemap.py
--- a/rpython/jit/backend/llsupport/test/test_codemap.py
+++ b/rpython/jit/backend/llsupport/test/test_codemap.py
@@ -91,8 +91,3 @@
     codemap.free_asm_block(200, 300)
     assert unpack_traceback(225) == []
     codemap.free()
-
-def test_codemaps_bug1():
-    builder = CodemapBuilder()
-    builder.debug_merge_point(3, 102, 0)
-    builder.debug_merge_point(0, 104, 10)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to