Author: Remi Meier
Branch: c7
Changeset: r684:a40aa54fd216
Date: 2014-01-28 14:40 +0100
http://bitbucket.org/pypy/stmgc/changeset/a40aa54fd216/
Log: fix more possible bugs in duhton
diff --git a/c7/core.c b/c7/core.c
--- a/c7/core.c
+++ b/c7/core.c
@@ -142,9 +142,13 @@
/* XXX: only abort if we are younger */
spin_loop();
} while (1);
+
+ /* remove the write-barrier ONLY if we have the write-lock */
+ obj->stm_flags &= ~GCFLAG_WRITE_BARRIER;
- obj->stm_flags &= ~GCFLAG_WRITE_BARRIER;
if (prev_owner == 0) {
+ /* otherwise, we have the lock and already added it to
+ modified_objects / read-marker */
stm_read(obj);
LIST_APPEND(_STM_TL->modified_objects, obj);
}
diff --git a/duhton/frame.c b/duhton/frame.c
--- a/duhton/frame.c
+++ b/duhton/frame.c
@@ -200,7 +200,11 @@
DuObject *sym = DuSymbol_FromString(name);
_du_restore1(frame);
+ _du_save1(frame);
dictentry_t *e = find_entry((DuFrameObject *)frame, sym, 1);
+ _du_restore1(frame);
+
+ _du_write1(frame); /* e is part of frame or a new object */
e->builtin_macro = func;
}
@@ -245,6 +249,7 @@
dictentry_t *e;
DuFrame_Ensure("_DuFrame_EvalCall", frame);
+ /* find_entry not in write_mode will not collect */
e = find_entry((DuFrameObject *)frame, symbol, 0);
if (!e) {
e = find_entry((DuFrameObject *)Du_Globals, symbol, 0);
@@ -296,6 +301,7 @@
DuFrame_Ensure("DuFrame_GetSymbol", frame);
e = find_entry((DuFrameObject *)frame, symbol, 0);
+ /* find_entry does the read_barrier */
return e ? e->value : NULL;
}
@@ -304,10 +310,11 @@
dictentry_t *e;
DuFrame_Ensure("DuFrame_SetSymbol", frame);
- _du_save1(value);
+ _du_save2(value, frame);
e = find_entry((DuFrameObject *)frame, symbol, 1);
- _du_restore1(value);
+ _du_restore2(value, frame);
+ _du_write1(frame); /* e is new or part of frame */
e->value = value;
}
@@ -326,10 +333,11 @@
dictentry_t *e;
DuFrame_Ensure("DuFrame_SetUserFunction", frame);
- _du_save2(arglist, progn);
+ _du_save3(arglist, progn, frame);
e = find_entry((DuFrameObject *)frame, symbol, 1);
- _du_restore2(arglist, progn);
+ _du_restore3(arglist, progn, frame);
+ _du_write1(frame); /* e is part of frame or new */
e->func_arglist = arglist;
e->func_progn = progn;
}
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit