aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2007-09-11 09:43:05 +0000
committerArmin Rigo <arigo@tunes.org>2007-09-11 09:43:05 +0000
commitfa51d9dbf590086a1e0569a32c24addb4940e30c (patch)
treeb4bd7d2f17677a27a9d9d13bbd53dec92d59a0a9 /pypy/rpython/rweakref.py
parentFix fakeweakaddress to resist to pointer casts. (diff)
downloadpypy-fa51d9dbf590086a1e0569a32c24addb4940e30c.tar.gz
pypy-fa51d9dbf590086a1e0569a32c24addb4940e30c.tar.bz2
pypy-fa51d9dbf590086a1e0569a32c24addb4940e30c.zip
RTyping of RPython-level weakrefs (lltypesystem only in this check-in).
Diffstat (limited to 'pypy/rpython/rweakref.py')
-rw-r--r--pypy/rpython/rweakref.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/pypy/rpython/rweakref.py b/pypy/rpython/rweakref.py
index e9d95065c5..b5100a1959 100644
--- a/pypy/rpython/rweakref.py
+++ b/pypy/rpython/rweakref.py
@@ -9,6 +9,24 @@ class __extend__(annmodel.SomeLLWeakRef):
def rtyper_makekey(self):
return self.__class__,
-
class LLWeakRefRepr(Repr):
lowleveltype = llmemory.WeakRef
+
+# ____________________________________________________________
+#
+# RPython-level weakrefs
+
+class __extend__(annmodel.SomeWeakRef):
+ def rtyper_makerepr(self, rtyper):
+ return WeakRefRepr()
+ def rtyper_makekey(self):
+ return self.__class__,
+
+
+class WeakRefRepr(Repr):
+ lowleveltype = llmemory.WeakRef
+
+ def rtype_simple_call(self, hop):
+ v_wref, = hop.inputargs(self)
+ hop.exception_cannot_occur()
+ return hop.genop('weakref_deref', [v_wref], resulttype=hop.r_result)