Author: Armin Rigo <[email protected]>
Branch:
Changeset: r942:20b40ac2ddb1
Date: 2014-03-03 18:32 +0100
http://bitbucket.org/pypy/stmgc/changeset/20b40ac2ddb1/
Log: More comments. Remove a line that is actually useless. Change the
value we overwrite stm_large_free chunks with. Fix a test.
diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -53,8 +53,13 @@
uint8_t other_segment_num = prev_owner - 1;
assert(get_priv_segment(other_segment_num)->write_lock_num ==
prev_owner);
+
+ /* Do generic contention management. If found that we must abort,
+ calls abort_with_mutex() and never returns. If found that the
+ other thread must abort, signal it with NSE_SIGABORT. Note that
+ this can overwrite a NSE_SIGPAUSE, which is fine. */
contention_management(other_segment_num);
- assert(get_priv_segment(other_segment_num)->pub.nursery_end ==
NSE_SIGABORT);
+ assert(get_segment(other_segment_num)->nursery_end == NSE_SIGABORT);
/* The rest of this code is for the case where we continue to
run. We have to signal the other thread to abort, and wait
@@ -64,12 +69,10 @@
switch (sp) {
case SP_RUNNING:
- /* The other thread is running now, so if we set
- NSE_SIGABORT in 'nursery_end', it will soon enter a
- mutex_lock() and thus abort. Note that this line can
- overwrite a NSE_SIGPAUSE, which is fine.
+ /* The other thread is running now, so as NSE_SIGABORT was
+ set in its 'nursery_end', it will soon enter a
+ mutex_lock() and thus abort.
*/
- get_segment(other_segment_num)->nursery_end = NSE_SIGABORT;
break;
/* The other cases are where the other thread is at a
diff --git a/c7/stm/largemalloc.c b/c7/stm/largemalloc.c
--- a/c7/stm/largemalloc.c
+++ b/c7/stm/largemalloc.c
@@ -273,8 +273,8 @@
/* unlink the following chunk */
mscan->d.next->prev = mscan->d.prev;
mscan->d.prev->next = mscan->d.next;
- assert(mscan->prev_size = (size_t)-1);
- assert(mscan->size = (size_t)-1);
+ assert((mscan->prev_size = (size_t)-258, 1)); /* 0xfffffffffffffefe */
+ assert((mscan->size = (size_t)-515, 1)); /* 0xfffffffffffffdfd */
/* merge the two chunks */
assert(fsize == fscan->prev_size);
diff --git a/c7/test/test_largemalloc.py b/c7/test/test_largemalloc.py
--- a/c7/test/test_largemalloc.py
+++ b/c7/test/test_largemalloc.py
@@ -168,4 +168,4 @@
if i in keep_me:
assert all[i][50] == chr(65 + i)
else:
- assert all_orig[i][50] == '\xDD'
+ assert all_orig[i][50] == '\xDE'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit