[pypy-commit] pypy faster-rstruct: partial backout of 89a3ecaf0b2d, we no longer need to compare field offsets before translation

antocuni noreply at buildbot.pypy.org
Wed Nov 25 05:22:18 EST 2015


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct
Changeset: r80934:909baa7fdb8e
Date: 2015-11-25 11:09 +0100
http://bitbucket.org/pypy/pypy/changeset/909baa7fdb8e/

Log:	partial backout of 89a3ecaf0b2d, we no longer need to compare field
	offsets before translation

diff --git a/rpython/rtyper/lltypesystem/llmemory.py b/rpython/rtyper/lltypesystem/llmemory.py
--- a/rpython/rtyper/lltypesystem/llmemory.py
+++ b/rpython/rtyper/lltypesystem/llmemory.py
@@ -214,20 +214,6 @@
         dst = cast_adr_to_ptr(dstadr, PTR)
         _reccopy(src, dst)
 
-    def force_as_int(self):
-        """
-        NOT_RPYTHON
-        Return the actual offset as an integer.
-        """
-        if self.TYPE._arrayfld:
-            obj = lltype.malloc(self.TYPE, 0)
-        else:
-            obj = lltype.malloc(self.TYPE)
-        baseadr = cast_ptr_to_adr(obj)
-        interioradr = baseadr + self
-        return cast_adr_to_int(interioradr, 'forced') - cast_adr_to_int(baseadr, 'forced')
-
-
 
 class CompositeOffset(AddressOffset):
 
diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py
--- a/rpython/rtyper/lltypesystem/opimpl.py
+++ b/rpython/rtyper/lltypesystem/opimpl.py
@@ -103,13 +103,6 @@
 
 
 def op_int_eq(x, y):
-    # so far we support only == and only for FieldOffset. In theory, we could
-    # generalize support for direct comparisons of AddressOffsets
-    if isinstance(x, llmemory.FieldOffset):
-        x = x.force_as_int()
-    if isinstance(y, llmemory.FieldOffset):
-        y = y.force_as_int()
-    #
     if not isinstance(x, (int, long)):
         from rpython.rtyper.lltypesystem import llgroup
         assert isinstance(x, llgroup.CombinedSymbolic), (


More information about the pypy-commit mailing list