1. Pypy
  2. Untitled project
  3. pypy

Commits

Armin Rigo  committed 0c17457

waaa

  • Participants
  • Parent commits ee1c4e0
  • Branches stmgc-c7

Comments (0)

Files changed (3)

File rpython/translator/c/gc.py

View file
     def get_stm_prebuilt_hash(self, obj):
         h = BasicFrameworkGcPolicy.get_prebuilt_hash(self, obj)
         if h is None:
-            h = object.__hash__(obj)   # a "random enough" number
+            h = lltype.identityhash(obj._as_ptr())
         return h
 
 

File rpython/translator/stm/funcgen.py

View file
 
 def stm_id(funcgen, op):
     arg0 = funcgen.expr(op.args[0])
-    return 'stm_id((object_t *)%s);' % (arg0,)
+    result = funcgen.expr(op.result)
+    return '%s = stm_id((object_t *)%s);' % (result, arg0)
 
 def stm_identityhash(funcgen, op):
     arg0 = funcgen.expr(op.args[0])
-    return 'stm_identityhash((object_t *)%s);' % (arg0,)
+    result = funcgen.expr(op.result)
+    return '%s = stm_identityhash((object_t *)%s);' % (result, arg0)
 
 def stm_addr_get_tid(funcgen, op):
     arg0   = funcgen.expr(op.args[0])

File rpython/translator/stm/test/test_ztranslated.py

View file
         data = data.split()
         i1 = data.index('1>>>')
         i2 = data.index('2>>>')
-        int(data[i1 + 1])
-        int(data[i1 + 2])
-        int(data[i2 + 1])
-        int(data[i2 + 2])
-        assert int(data[i1 + 1]) == prebuilt_hash
+        hash1 = int(data[i1 + 1])
+        id1   = int(data[i1 + 2])
+        hash2 = int(data[i2 + 1])
+        id2   = int(data[i2 + 2])
+        assert hash1 == prebuilt_hash
+        assert hash2 != 0
+        assert id1 != id2
 
     def test_start_thread(self):
         from rpython.rlib import rthread