Author: Nicolas Truessel <[email protected]>
Branch: quad-color-gc
Changeset: r86738:022badc3be64
Date: 2016-08-30 15:21 +0200
http://bitbucket.org/pypy/pypy/changeset/022badc3be64/
Log: Implement write barrier and try fix pypy compile error
diff --git a/rpython/memory/gc/qcgc.py b/rpython/memory/gc/qcgc.py
--- a/rpython/memory/gc/qcgc.py
+++ b/rpython/memory/gc/qcgc.py
@@ -1,5 +1,5 @@
from rpython.memory.gc.base import GCBase
-from rpython.memory.support import mangle_hash
+#from rpython.memory.support import mangle_hash
from rpython.rtyper.lltypesystem import rffi, lltype, llgroup, llmemory,
llarena
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rlib.debug import ll_assert
@@ -88,6 +88,14 @@
#llop.gc_writebarrier(dest_addr)
#return True
+ # XXX: WRITE BARRIER
+ def write_barrier(self, addr_struct):
+ llop.qcgc_write_barrier(lltype.Void, addr_struct)
+
+ def register_finalizer(self, fq_index, gcobj):
+ # XXX: Not supported
+ pass
+
def id_or_identityhash(self, gcobj, is_hash):
hdr = self.header(llmemory.cast_ptr_to_adr(gcobj))
has_hash = (hdr.flags & QCGC_HAS_HASH)
@@ -96,7 +104,7 @@
if is_hash:
if has_hash:
return i # Do not mangle for objects with built in hash
- i = mangle_hash(i)
+ i = i ^ (i >> 5)
return i
def id(self, gcobje):
diff --git a/rpython/memory/gctransform/qcgcframework.py
b/rpython/memory/gctransform/qcgcframework.py
--- a/rpython/memory/gctransform/qcgcframework.py
+++ b/rpython/memory/gctransform/qcgcframework.py
@@ -58,6 +58,25 @@
for _ in livevars: # Does not move, so no writing back
hop.genop("qcgc_pop_root", [])
+ def gct_gc_fq_register(self, hop):
+ pass
+# index = self.get_finalizer_queue_index(hop)
+# c_index = rmodel.inputconst(lltype.Signed, index)
+# v_ptr = hop.spaceop.args[1]
+# v_ptr = hop.genop("cast_opaque_ptr", [v_ptr],
+# resulttype=llmemory.GCREF)
+# hop.genop("direct_call", [self.register_finalizer_ptr,
self.c_const_gc,
+# c_index, v_ptr])
+
+ def gct_gc_fq_next_dead(self, hop):
+ pass
+# index = self.get_finalizer_queue_index(hop)
+# c_ll_next_dead = self.finalizer_handlers[index][2]
+# v_adr = hop.genop("direct_call", [c_ll_next_dead],
+# resulttype=llmemory.Address)
+# hop.genop("cast_adr_to_ptr", [v_adr],
+# resultvar = hop.spaceop.result)
+
class QcgcRootWalker(BaseRootWalker):
def walk_stack_roots(self, collect_stack_root, is_minor=False):
raise NotImplementedError
diff --git a/rpython/rtyper/lltypesystem/lloperation.py
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -518,6 +518,7 @@
'qcgc_allocate': LLOp(canmallocgc=True),
'qcgc_collect': LLOp(canmallocgc=True),
'qcgc_is_prebuilt': LLOp(),
+ 'qcgc_write_barrier': LLOp(),
# __________ weakrefs __________
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -965,3 +965,7 @@
result = self.expr(op.result)
return '%s = (((object_t *) %s)->flags & QCGC_PREBUILT_OBJECT) != 0;'
% (
result, obj)
+
+ def OP_QCGC_WRITE_BARRIER(self, op):
+ obj = self.expr(op.args[0])
+ return 'qcgc_write(%s);' % (obj,)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit