Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r72284:293e18aefb23
Date: 2014-06-30 13:10 +0200
http://bitbucket.org/pypy/pypy/changeset/293e18aefb23/
Log: Integrate stm_write_card() inside PyPy
diff --git a/rpython/memory/gctransform/stmframework.py
b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -33,6 +33,17 @@
llannotation.SomePtr(GCClass.VISIT_FPTR)],
annmodel.s_None))
#
+ def pypy_stmcb_trace_cards(obj, visit_fn, start, stop):
+ gc.trace_partial(obj, start, stop, invokecallback, visit_fn)
+ pypy_stmcb_trace_cards.c_name = "pypy_stmcb_trace_cards"
+ self.autoregister_ptrs.append(
+ getfn(pypy_stmcb_trace_cards,
+ [llannotation.SomeAddress(),
+ llannotation.SomePtr(GCClass.VISIT_FPTR),
+ annmodel.s_Int,
+ annmodel.s_Int],
+ annmodel.s_None))
+ #
def pypy_stmcb_get_card_base_itemsize(obj, offset_itemsize):
gc.get_card_base_itemsize(obj, offset_itemsize)
pypy_stmcb_get_card_base_itemsize.c_name = (
diff --git a/rpython/translator/stm/src_stm/stmgcintf.c
b/rpython/translator/stm/src_stm/stmgcintf.c
--- a/rpython/translator/stm/src_stm/stmgcintf.c
+++ b/rpython/translator/stm/src_stm/stmgcintf.c
@@ -12,6 +12,7 @@
extern Signed pypy_stmcb_size_rounded_up(void*);
extern void pypy_stmcb_get_card_base_itemsize(void*, uintptr_t[]);
extern void pypy_stmcb_trace(void*, void(*)(void*));
+extern void pypy_stmcb_trace_cards(void*, void(*)(void*), uintptr_t,
uintptr_t);
inline ssize_t stmcb_size_rounded_up(struct object_s *obj) {
ssize_t result = pypy_stmcb_size_rounded_up(obj);
@@ -29,6 +30,11 @@
pypy_stmcb_trace(obj, (void(*)(void*))visit);
}
+inline void stmcb_trace_cards(struct object_s *obj, void visit(object_t **),
+ uintptr_t start, uintptr_t stop) {
+ pypy_stmcb_trace_cards(obj, (void(*)(void*))visit, start, stop);
+}
+
inline void stmcb_commit_soon()
{
if (pypy_stm_nursery_low_fill_mark == (uintptr_t)-1) {
diff --git a/rpython/translator/stm/test/test_ztranslated.py
b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -452,7 +452,8 @@
assert 'did not crash 84\n' in data
def test_stm_write_card(self):
- lst = [0] * 100
+ LST = lltype.GcArray(lltype.Signed)
+ lst = lltype.malloc(LST, 100, immortal=True)
def main(argv):
lst[42] = 43
print 'did not crash', lst[42]
@@ -460,7 +461,7 @@
t, cbuilder = self.compile(main)
first_op = t.graphs[0].startblock.operations[0]
- assert first_op.opnames == opnames[0] == 'stm_write'
+ assert first_op.opname == 'stm_write'
assert first_op.args[1].value == 42
data = cbuilder.cmdexec('')
assert 'did not crash 43\n' in data
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit