[pypy-commit] pypy stmgc-c8: add some bits to the fake stm-hashtable to make pypy translate

Raemi noreply at buildbot.pypy.org
Wed Feb 25 13:32:52 CET 2015


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c8
Changeset: r76127:28ebc96dd613
Date: 2015-02-25 13:20 +0100
http://bitbucket.org/pypy/pypy/changeset/28ebc96dd613/

Log:	add some bits to the fake stm-hashtable to make pypy translate

diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -310,6 +310,28 @@
     def len(self):
         return len(self._content)
 
+    def list(self):
+        items = []
+        for key in self._content.keys():
+            items.append(self.lookup(key))
+        count = len(items)
+        return items, count
+
+    def freelist(self, array):
+        pass
+
+    def lookup(self, key):
+        return EntryObjectEmulation(self, key)
+
+    def writeobj(self, entry, nvalue):
+        self.set(entry.key, nvalue)
+
+class EntryObjectEmulation(object):
+    def __init__(self, hashtable, key):
+        self.hashtable = hashtable
+        self.key = key
+        self.index = r_uint(key)
+        self.object = hashtable.get(key)
 
 
 class HashtableForTest(object):


More information about the pypy-commit mailing list