[pypy-commit] pypy int-tag-untag-as-operations: move an ll_assert around: cast_ptr_to_int *can* be used on an even pointer (to

cfbolz noreply at buildbot.pypy.org
Fri Oct 28 16:58:35 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: int-tag-untag-as-operations
Changeset: r48565:4c4642283aff
Date: 2011-10-28 16:58 +0200
http://bitbucket.org/pypy/pypy/changeset/4c4642283aff/

Log:	move an ll_assert around: cast_ptr_to_int *can* be used on an even
	pointer (to check whether it is tagged). however, int_untag should
	really only be used on odd numbers.

diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py
--- a/pypy/jit/metainterp/blackhole.py
+++ b/pypy/jit/metainterp/blackhole.py
@@ -448,6 +448,7 @@
 
     @arguments("i", returns="i")
     def bhimpl_int_untag(a):
+        ll_assert((a & 1) == 1, "bhimpl_int_untag: not an odd int")
         return a >> 1
     @arguments("i", returns="i")
     def bhimpl_int_tag(a):
@@ -522,7 +523,6 @@
     @arguments("r", returns="i")
     def bhimpl_cast_ptr_to_int(a):
         i = lltype.cast_ptr_to_int(a)
-        ll_assert((i & 1) == 1, "bhimpl_cast_ptr_to_int: not an odd int")
         return i
     @arguments("i", returns="r")
     def bhimpl_cast_int_to_ptr(i):


More information about the pypy-commit mailing list