Commits

Armin Rigo committed 90c9a69

Some remaining usages of id().

Comments (0)

Files changed (3)

pypy/lang/prolog/interpreter/term.py

 import math
 from pypy.rlib.objectmodel import we_are_translated, UnboxedValue
+from pypy.rlib.objectmodel import compute_unique_id
 from pypy.rlib.rarithmetic import intmask
 from pypy.lang.prolog.interpreter.error import UnificationFailed, UncatchableError
 from pypy.lang.prolog.interpreter import error
             raise UnificationFailed
 
     def get_unify_hash(self, heap):
-        return intmask(id(self) << TAGBITS | self.TAG)
+        return intmask(hash(self) << TAGBITS | self.TAG)
 
 
 
         return c
     if isinstance(obj1, Var):
         assert isinstance(obj2, Var)
-        return rcmp(id(obj1), id(obj2))
+        return rcmp(compute_unique_id(obj1), compute_unique_id(obj2))
     if isinstance(obj1, Atom):
         assert isinstance(obj2, Atom)
         return rcmp(obj1.name, obj2.name)

pypy/translator/backendopt/test/test_removenoops.py

         s2 = lltype.malloc(S)
         llop.keepalive(lltype.Void, s1)
         llop.keepalive(lltype.Void, s2)
-        return id(s1) + id(s2)
+        return lltype.cast_ptr_to_int(s1) + lltype.cast_ptr_to_int(s2)
     graph, t = get_graph(f, [])
     remove_superfluous_keep_alive(graph)
     ops = getops(graph)

pypy/translator/goal/targetrpystonex.py

 from pypy.translator.test import rpystone
+from pypy.rlib.objectmodel import current_object_addr_as_int
 
 
 def make_target_definition(LOOPS):
                 g.Array2Glob[i][j] = 0
         g.PtrGlb = None
         g.PtrGlbNext = None
-        return rpystone.pystones(loops), id(g)
+        return rpystone.pystones(loops), current_object_addr_as_int(g)
 
     def target(*args):
         return entry_point, [int]