[pypy-commit] pypy gc-incminimark-pinning: move ExtRegistryEntry classes to their rgc method counterparts
groggi
noreply at buildbot.pypy.org
Mon Jun 2 17:24:30 CEST 2014
Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning
Changeset: r71844:c1d096aacb11
Date: 2014-05-22 17:27 +0200
http://bitbucket.org/pypy/pypy/changeset/c1d096aacb11/
Log: move ExtRegistryEntry classes to their rgc method counterparts
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -38,6 +38,20 @@
# XXX update doc string to match actual behavior
return False
+class PinEntry(ExtRegistryEntry):
+ _about_ = pin
+
+ def compute_result_annotation(self, s_arg):
+ from rpython.annotator.model import s_Bool
+ return s_Bool
+
+ def specialize_call(self, hop):
+ hop.exception_cannot_occur()
+ v_obj, = hop.inputargs(hop.args_r[0])
+ v_addr = hop.genop('cast_ptr_to_adr', [v_obj],
+ resulttype=llmemory.Address)
+ return hop.genop('gc_pin', [v_addr], resulttype=lltype.Bool)
+
def unpin(obj):
"""Unpin 'obj', allowing it to move again.
Must only be called after a call to pin(obj) returned True.
@@ -46,6 +60,19 @@
raise AssertionError("pin() always returns False, "
"so unpin() should not be called")
+class UnpinEntry(ExtRegistryEntry):
+ _about_ = unpin
+
+ def compute_result_annotation(self, s_arg):
+ pass
+
+ def specialize_call(self, hop):
+ hop.exception_cannot_occur()
+ v_obj, = hop.inputargs(hop.args_r[0])
+ v_addr = hop.genop('cast_ptr_to_adr', [v_obj],
+ resulttype=llmemory.Address)
+ hop.genop('gc_unpin', [v_addr])
+
# ____________________________________________________________
# Annotation and specialization
@@ -602,32 +629,5 @@
hop.exception_cannot_occur()
return hop.genop('gc_gcflag_extra', vlist, resulttype = hop.r_result)
-class Entry(ExtRegistryEntry): # XXX understand this, is it correct? (groggi)
- _about_ = pin
-
- def compute_result_annotation(self, s_arg):
- from rpython.annotator.model import SomeBool
- return SomeBool()
-
- def specialize_call(self, hop):
- hop.exception_cannot_occur()
- v_obj, = hop.inputargs(hop.args_r[0])
- v_addr = hop.genop('cast_ptr_to_adr', [v_obj],
- resulttype=llmemory.Address)
- return hop.genop('gc_pin', [v_addr], resulttype=lltype.Bool)
-
-class Entry(ExtRegistryEntry): # XXX understand this, is it correct? (groggi)
- _about_ = unpin
-
- def compute_result_annotation(self, s_arg):
- pass
-
- def specialize_call(self, hop):
- hop.exception_cannot_occur()
- v_obj, = hop.inputargs(hop.args_r[0])
- v_addr = hop.genop('cast_ptr_to_adr', [v_obj],
- resulttype=llmemory.Address)
- hop.genop('gc_unpin', [v_addr])
-
def lltype_is_gc(TP):
return getattr(getattr(TP, "TO", None), "_gckind", "?") == 'gc'
More information about the pypy-commit
mailing list